@dylanpiercey/work 0.0.11 → 0.0.12

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.
Files changed (153) hide show
  1. package/dist/index.mjs +3 -3
  2. package/dist/public/assets/{_CY9fvXvg.js → _-gyK8vJ-.js} +2 -2
  3. package/dist/public/assets/{_CY9fvXvg.js.map → _-gyK8vJ-.js.map} +1 -1
  4. package/dist/public/assets/{_BGcQuwom.js → _9XtunSg7.js} +2 -2
  5. package/dist/public/assets/{_BGcQuwom.js.map → _9XtunSg7.js.map} +1 -1
  6. package/dist/public/assets/{_COjvApw5.js → _B31BFjeo.js} +2 -2
  7. package/dist/public/assets/{_COjvApw5.js.map → _B31BFjeo.js.map} +1 -1
  8. package/dist/public/assets/{_BUNsdM7N.js → _B4U6RXlg.js} +2 -2
  9. package/dist/public/assets/{_BUNsdM7N.js.map → _B4U6RXlg.js.map} +1 -1
  10. package/dist/public/assets/{_DGzOveRF.js → _B6OKTJ3U.js} +2 -2
  11. package/dist/public/assets/{_DGzOveRF.js.map → _B6OKTJ3U.js.map} +1 -1
  12. package/dist/public/assets/{_CbL7aWfv.js → _B7X9man_.js} +2 -2
  13. package/dist/public/assets/{_CbL7aWfv.js.map → _B7X9man_.js.map} +1 -1
  14. package/dist/public/assets/{_C2iaQ953.js → _B8okAqG-.js} +2 -2
  15. package/dist/public/assets/{_C2iaQ953.js.map → _B8okAqG-.js.map} +1 -1
  16. package/dist/public/assets/{_Dp01MMO42.js → _BCDnEeXi2.js} +2 -2
  17. package/dist/public/assets/{_Dp01MMO42.js.map → _BCDnEeXi2.js.map} +1 -1
  18. package/dist/public/assets/{_AvFmZM6P.js → _BD3GuTLe.js} +2 -2
  19. package/dist/public/assets/{_AvFmZM6P.js.map → _BD3GuTLe.js.map} +1 -1
  20. package/dist/public/assets/{_CNDu3El-.js → _BH3qAqXE.js} +2 -2
  21. package/dist/public/assets/{_CNDu3El-.js.map → _BH3qAqXE.js.map} +1 -1
  22. package/dist/public/assets/{_Dou03otF.js → _BLA94hyL.js} +2 -2
  23. package/dist/public/assets/{_Dou03otF.js.map → _BLA94hyL.js.map} +1 -1
  24. package/dist/public/assets/{_B60B9ttT2.js → _BMK2JGG-2.js} +2 -2
  25. package/dist/public/assets/{_B60B9ttT2.js.map → _BMK2JGG-2.js.map} +1 -1
  26. package/dist/public/assets/{_CaEMsx56.js → _BOMR_lTT.js} +2 -2
  27. package/dist/public/assets/{_CaEMsx56.js.map → _BOMR_lTT.js.map} +1 -1
  28. package/dist/public/assets/{_CG7XKeSB.js → _BP3KIWZr.js} +2 -2
  29. package/dist/public/assets/{_CG7XKeSB.js.map → _BP3KIWZr.js.map} +1 -1
  30. package/dist/public/assets/{_DCcYmQ_s2.js → _BmaVzQYH2.js} +2 -2
  31. package/dist/public/assets/{_DCcYmQ_s2.js.map → _BmaVzQYH2.js.map} +1 -1
  32. package/dist/public/assets/{_DIBiig5O2.js → _BpWV4xDR2.js} +2 -2
  33. package/dist/public/assets/{_DIBiig5O2.js.map → _BpWV4xDR2.js.map} +1 -1
  34. package/dist/public/assets/{_DE0OXEWX.js → _Brh7taK_.js} +2 -2
  35. package/dist/public/assets/{_DE0OXEWX.js.map → _Brh7taK_.js.map} +1 -1
  36. package/dist/public/assets/{_CToEE4-R.js → _BsL8kuCs.js} +2 -2
  37. package/dist/public/assets/{_CToEE4-R.js.map → _BsL8kuCs.js.map} +1 -1
  38. package/dist/public/assets/{_CDE_l3Ah.js → _BtGc54QO.js} +2 -2
  39. package/dist/public/assets/{_CDE_l3Ah.js.map → _BtGc54QO.js.map} +1 -1
  40. package/dist/public/assets/{_K3UNrLtV.js → _BuU3dU-v.js} +2 -2
  41. package/dist/public/assets/{_K3UNrLtV.js.map → _BuU3dU-v.js.map} +1 -1
  42. package/dist/public/assets/{_isfb253p2.js → _Bw-xXnfr2.js} +2 -2
  43. package/dist/public/assets/{_isfb253p2.js.map → _Bw-xXnfr2.js.map} +1 -1
  44. package/dist/public/assets/{_r4jzjyPa2.js → _BzmURZrG2.js} +2 -2
  45. package/dist/public/assets/{_r4jzjyPa2.js.map → _BzmURZrG2.js.map} +1 -1
  46. package/dist/public/assets/{_CL0s7Kya.js → _C0VVn7_H.js} +2 -2
  47. package/dist/public/assets/{_CL0s7Kya.js.map → _C0VVn7_H.js.map} +1 -1
  48. package/dist/public/assets/{_CEW9INI2.js → _CCOa-67I.js} +2 -2
  49. package/dist/public/assets/{_CEW9INI2.js.map → _CCOa-67I.js.map} +1 -1
  50. package/dist/public/assets/{_DTYxR8JQ.js → _CCWd2cbl.js} +2 -2
  51. package/dist/public/assets/{_DTYxR8JQ.js.map → _CCWd2cbl.js.map} +1 -1
  52. package/dist/public/assets/{_DLrpVVOP.js → _CJfh1bA_.js} +2 -2
  53. package/dist/public/assets/{_DLrpVVOP.js.map → _CJfh1bA_.js.map} +1 -1
  54. package/dist/public/assets/{_77Fyk0IZ2.js → _CKHJpMi32.js} +2 -2
  55. package/dist/public/assets/{_77Fyk0IZ2.js.map → _CKHJpMi32.js.map} +1 -1
  56. package/dist/public/assets/{_tY5zLQZp.js → _CLa87tfT.js} +2 -2
  57. package/dist/public/assets/{_tY5zLQZp.js.map → _CLa87tfT.js.map} +1 -1
  58. package/dist/public/assets/{_D69Y468R2.js → _CNPd6AKz2.js} +2 -2
  59. package/dist/public/assets/{_D69Y468R2.js.map → _CNPd6AKz2.js.map} +1 -1
  60. package/dist/public/assets/{_YzHkI38Y2.js → _CTwY-w6f2.js} +2 -2
  61. package/dist/public/assets/{_YzHkI38Y2.js.map → _CTwY-w6f2.js.map} +1 -1
  62. package/dist/public/assets/{_CRfCwzvc.js → _CXQQiNs1.js} +2 -2
  63. package/dist/public/assets/{_CRfCwzvc.js.map → _CXQQiNs1.js.map} +1 -1
  64. package/dist/public/assets/{_BaqI91VC2.js → _Ca6yBPZK2.js} +2 -2
  65. package/dist/public/assets/{_BaqI91VC2.js.map → _Ca6yBPZK2.js.map} +1 -1
  66. package/dist/public/assets/{_ChU_0Gs7.js → _Cm86uuyb.js} +2 -2
  67. package/dist/public/assets/{_ChU_0Gs7.js.map → _Cm86uuyb.js.map} +1 -1
  68. package/dist/public/assets/{_DRFrNohk.js → _CnphyoYq.js} +2 -2
  69. package/dist/public/assets/{_DRFrNohk.js.map → _CnphyoYq.js.map} +1 -1
  70. package/dist/public/assets/{_VdtJ_5pb2.js → _CqX4LQGj2.js} +2 -2
  71. package/dist/public/assets/{_VdtJ_5pb2.js.map → _CqX4LQGj2.js.map} +1 -1
  72. package/dist/public/assets/{_N_MncSgy.js → _Cs2xR5zT.js} +2 -2
  73. package/dist/public/assets/{_N_MncSgy.js.map → _Cs2xR5zT.js.map} +1 -1
  74. package/dist/public/assets/{_BJO73Smt2.js → _Ct7oMGlY2.js} +2 -2
  75. package/dist/public/assets/{_BJO73Smt2.js.map → _Ct7oMGlY2.js.map} +1 -1
  76. package/dist/public/assets/{_DV3zDssv.js → _CvIA8snX.js} +2 -2
  77. package/dist/public/assets/{_DV3zDssv.js.map → _CvIA8snX.js.map} +1 -1
  78. package/dist/public/assets/{_CVbLeR5M.js → _CvPUh_B0.js} +2 -2
  79. package/dist/public/assets/{_CVbLeR5M.js.map → _CvPUh_B0.js.map} +1 -1
  80. package/dist/public/assets/{_DqMqiyah.js → _CxVlY1q1.js} +2 -2
  81. package/dist/public/assets/{_DqMqiyah.js.map → _CxVlY1q1.js.map} +1 -1
  82. package/dist/public/assets/{_Z_ClK8ZW.js → _CypNdMTQ.js} +2 -2
  83. package/dist/public/assets/{_Z_ClK8ZW.js.map → _CypNdMTQ.js.map} +1 -1
  84. package/dist/public/assets/{_CIBWjTJ8.js → _CzGoLHpy.js} +2 -2
  85. package/dist/public/assets/{_CIBWjTJ8.js.map → _CzGoLHpy.js.map} +1 -1
  86. package/dist/public/assets/{_CnYv5yOJ.js → _D0UH-qzF.js} +2 -2
  87. package/dist/public/assets/{_CnYv5yOJ.js.map → _D0UH-qzF.js.map} +1 -1
  88. package/dist/public/assets/{_Db3F1ZqM2.js → _D8DKeNtk2.js} +2 -2
  89. package/dist/public/assets/{_Db3F1ZqM2.js.map → _D8DKeNtk2.js.map} +1 -1
  90. package/dist/public/assets/{_BJIyZxK0.js → _DDtfsPTV.js} +2 -2
  91. package/dist/public/assets/{_BJIyZxK0.js.map → _DDtfsPTV.js.map} +1 -1
  92. package/dist/public/assets/{_BKAMvBgJ.js → _DH0HY4Nr.js} +2 -2
  93. package/dist/public/assets/{_BKAMvBgJ.js.map → _DH0HY4Nr.js.map} +1 -1
  94. package/dist/public/assets/{_BwTiY7vg2.js → _DQxqrF2p2.js} +2 -2
  95. package/dist/public/assets/{_BwTiY7vg2.js.map → _DQxqrF2p2.js.map} +1 -1
  96. package/dist/public/assets/{_BFytbAm5.js → _DU_7z2vs.js} +2 -2
  97. package/dist/public/assets/{_BFytbAm5.js.map → _DU_7z2vs.js.map} +1 -1
  98. package/dist/public/assets/{_CvNx2YfP2.js → _DXjhrVim2.js} +2 -2
  99. package/dist/public/assets/{_CvNx2YfP2.js.map → _DXjhrVim2.js.map} +1 -1
  100. package/dist/public/assets/{_zWA2RsS1.js → _DmaZeTni.js} +2 -2
  101. package/dist/public/assets/{_zWA2RsS1.js.map → _DmaZeTni.js.map} +1 -1
  102. package/dist/public/assets/{_7VADVuOA.js → _DoNipARR.js} +2 -2
  103. package/dist/public/assets/{_7VADVuOA.js.map → _DoNipARR.js.map} +1 -1
  104. package/dist/public/assets/{_YFy-LCwd.js → _Dp25UBl7.js} +2 -2
  105. package/dist/public/assets/{_YFy-LCwd.js.map → _Dp25UBl7.js.map} +1 -1
  106. package/dist/public/assets/{_CAf6rM7T.js → _DrB0wHeE.js} +2 -2
  107. package/dist/public/assets/{_CAf6rM7T.js.map → _DrB0wHeE.js.map} +1 -1
  108. package/dist/public/assets/{_C6p3UjM0.js → _DtW-KREB.js} +2 -2
  109. package/dist/public/assets/{_C6p3UjM0.js.map → _DtW-KREB.js.map} +1 -1
  110. package/dist/public/assets/{_Dy1d23fd2.js → _Dvy34Yg_2.js} +2 -2
  111. package/dist/public/assets/{_Dy1d23fd2.js.map → _Dvy34Yg_2.js.map} +1 -1
  112. package/dist/public/assets/{_tv3y18472.js → _GlOqBOcg2.js} +2 -2
  113. package/dist/public/assets/{_tv3y18472.js.map → _GlOqBOcg2.js.map} +1 -1
  114. package/dist/public/assets/{_C2Swe4f0.js → _Gpz7cA9P.js} +2 -2
  115. package/dist/public/assets/{_C2Swe4f0.js.map → _Gpz7cA9P.js.map} +1 -1
  116. package/dist/public/assets/{_BsE1kvV-2.js → _K6YjF5HA2.js} +2 -2
  117. package/dist/public/assets/{_BsE1kvV-2.js.map → _K6YjF5HA2.js.map} +1 -1
  118. package/dist/public/assets/{_kSqeI-Mv2.js → _LLhMP4fB2.js} +2 -2
  119. package/dist/public/assets/{_kSqeI-Mv2.js.map → _LLhMP4fB2.js.map} +1 -1
  120. package/dist/public/assets/{_DdoBNw7O2.js → _Ne8qEUH82.js} +2 -2
  121. package/dist/public/assets/{_DdoBNw7O2.js.map → _Ne8qEUH82.js.map} +1 -1
  122. package/dist/public/assets/{_Bit2YbJH.js → _RHQKbTNw.js} +2 -2
  123. package/dist/public/assets/{_Bit2YbJH.js.map → _RHQKbTNw.js.map} +1 -1
  124. package/dist/public/assets/{_Dnj_upFW.js → _UABdeDPG.js} +2 -2
  125. package/dist/public/assets/{_Dnj_upFW.js.map → _UABdeDPG.js.map} +1 -1
  126. package/dist/public/assets/{_DWZwPPmf.js → _VdrzhuKU.js} +2 -2
  127. package/dist/public/assets/{_DWZwPPmf.js.map → _VdrzhuKU.js.map} +1 -1
  128. package/dist/public/assets/{_DSiCqz1P2.js → _VpkJ9R4I2.js} +2 -2
  129. package/dist/public/assets/{_DSiCqz1P2.js.map → _VpkJ9R4I2.js.map} +1 -1
  130. package/dist/public/assets/{_DLs3aRaJ.js → __Q8ATTST.js} +2 -2
  131. package/dist/public/assets/{_DLs3aRaJ.js.map → __Q8ATTST.js.map} +1 -1
  132. package/dist/public/assets/{_vIlLN3ua.js → __WU9JTqk.js} +2 -2
  133. package/dist/public/assets/{_vIlLN3ua.js.map → __WU9JTqk.js.map} +1 -1
  134. package/dist/public/assets/{_BZ6_GIpc2.js → _ioxvNBlq2.js} +2 -2
  135. package/dist/public/assets/{_BZ6_GIpc2.js.map → _ioxvNBlq2.js.map} +1 -1
  136. package/dist/public/assets/{_Cay9-_-u.js → _l-4CNi-P.js} +2 -2
  137. package/dist/public/assets/{_Cay9-_-u.js.map → _l-4CNi-P.js.map} +1 -1
  138. package/dist/public/assets/{_HN4GzXai.js → _rdXXJ91o.js} +2 -2
  139. package/dist/public/assets/{_HN4GzXai.js.map → _rdXXJ91o.js.map} +1 -1
  140. package/dist/public/assets/{_CCC02X-42.js → _speyknRe2.js} +2 -2
  141. package/dist/public/assets/{_CCC02X-42.js.map → _speyknRe2.js.map} +1 -1
  142. package/dist/public/assets/{_CdQVpQAM.js → _v0CL1jTB.js} +2 -2
  143. package/dist/public/assets/{_CdQVpQAM.js.map → _v0CL1jTB.js.map} +1 -1
  144. package/dist/public/assets/{_DeeBFErP.js → _vvqUsxvZ.js} +2 -2
  145. package/dist/public/assets/{_DeeBFErP.js.map → _vvqUsxvZ.js.map} +1 -1
  146. package/dist/public/assets/{_BAif6Kkv.js → _wyUUoFip.js} +2 -2
  147. package/dist/public/assets/{_BAif6Kkv.js.map → _wyUUoFip.js.map} +1 -1
  148. package/dist/public/assets/{_JivX8J_W2.js → _xHfOHdoE2.js} +2 -2
  149. package/dist/public/assets/{_JivX8J_W2.js.map → _xHfOHdoE2.js.map} +1 -1
  150. package/dist/public/assets/{index-DW02FbhG.js → index-DMpI1yWM.js} +44 -44
  151. package/dist/public/assets/index-DMpI1yWM.js.map +1 -0
  152. package/package.json +1 -1
  153. package/dist/public/assets/index-DW02FbhG.js.map +0 -1
@@ -1,31 +1,31 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_DE0OXEWX.js","assets/_Bit2YbJH.js","assets/_DGzOveRF.js","assets/_CnYv5yOJ.js","assets/_CY9fvXvg.js","assets/_HN4GzXai.js","assets/_YFy-LCwd.js","assets/_7VADVuOA.js","assets/_DWZwPPmf.js","assets/_Cay9-_-u.js","assets/_CIBWjTJ8.js","assets/_DLs3aRaJ.js","assets/_BXeXVLqQ.js","assets/_CNDu3El-.js","assets/_BaqI91VC2.js","assets/_BwTiY7vg2.js","assets/_77Fyk0IZ2.js","assets/_CpYNKFv52.js","assets/_bTVj8UrX2.js","assets/_kIpfj7zU2.js","assets/_gzcpVVnB2.js","assets/_JivX8J_W2.js","assets/_DIBiig5O2.js","assets/_isfb253p2.js","assets/_BJO73Smt2.js","assets/_DqMqiyah.js","assets/_DeeBFErP.js","assets/_DTYxR8JQ.js","assets/_BFytbAm5.js","assets/_Dnj_upFW.js","assets/_BJIyZxK0.js","assets/_DLrpVVOP.js","assets/_CDE_l3Ah.js","assets/_C2Swe4f0.js","assets/_CEW9INI2.js","assets/_tY5zLQZp.js","assets/_zWA2RsS1.js","assets/_DRFrNohk.js","assets/_CdQVpQAM.js","assets/_C6p3UjM0.js","assets/_BaHq4SXp.js","assets/_BYOwaDjH.js","assets/_CQJs3lWb.js","assets/_CYNrtFtB.js","assets/_DmIc4jLQ.js","assets/_CY8IvGdO2.js","assets/_CBce3t8t2.js","assets/_DYvRD3hg2.js","assets/_Dl-2e7rI2.js","assets/_woXpYk--.js","assets/_YzHkI38Y2.js","assets/_BZ6_GIpc2.js","assets/_DSiCqz1P2.js","assets/_kSqeI-Mv2.js","assets/_r4jzjyPa2.js","assets/_B60B9ttT2.js","assets/_D69Y468R2.js","assets/_Dx-8-gkx.js","assets/_DLbMbJfH2.js","assets/_C8oCnwJJ2.js","assets/_CAf6rM7T.js","assets/_CRfCwzvc.js","assets/_BGcQuwom.js","assets/_AvFmZM6P.js","assets/_N_MncSgy.js","assets/_CToEE4-R.js","assets/_BUNsdM7N.js","assets/_C2iaQ953.js","assets/_ChU_0Gs7.js","assets/_COjvApw5.js","assets/_DVTAwKKz.js","assets/_DV3zDssv.js","assets/_DWQbgPoS.js","assets/_DJMQeKeT.js","assets/_BKAMvBgJ.js","assets/_CCC02X-42.js","assets/_DCcYmQ_s2.js","assets/_DqKBuwfJ2.js","assets/_oqKa8noW.js","assets/_CnvKMtbv.js","assets/_IyjqRm3v.js","assets/_rLFTqkRN2.js","assets/_CacY0gHj2.js","assets/_B5eOa1yu.js","assets/_Dixweg8N.js","assets/_D1A_Heim2.js","assets/_O90oeIOV2.js","assets/_VdtJ_5pb2.js","assets/_DOwzaHZ02.js","assets/_B3gFvitq2.js","assets/_Cfkwpbl82.js","assets/_BiFt_7mu2.js","assets/_CMLA9XwU2.js","assets/_DdoBNw7O2.js","assets/_vIlLN3ua.js","assets/_Z_ClK8ZW.js","assets/_CaEMsx56.js","assets/_Dou03otF.js","assets/_Bj61d0ZC2.js","assets/_CL0s7Kya.js","assets/_BM315xPC.js","assets/_Cvrh5tZx2.js","assets/_CVbLeR5M.js","assets/_BAif6Kkv.js","assets/_L8AbGenz.js","assets/_ByJddavk.js","assets/_K3UNrLtV.js","assets/_CG7XKeSB.js","assets/_CbL7aWfv.js","assets/_tv3y18472.js","assets/_Db3F1ZqM2.js","assets/_Dy1d23fd2.js","assets/_CvNx2YfP2.js","assets/_BsE1kvV-2.js","assets/_Dp01MMO42.js","assets/_B6D30XZt.js"])))=>i.map(i=>d[i]);
2
- var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=/[\\;]/g,r=e=>e===`;`?`\\3B `:`\\\\`,i=function e(t,n,r){let i=``,a=``,o;if(t){if(typeof t!=`object`)i+=t;else if(Array.isArray(t))for(let s of t)o=e(s,n,r),o&&(i+=a+o,a=n);else for(let e in t)o=r(e,t[e]),o&&(i+=a+o,a=n)}return i},a=e=>(e+(e<26?10:e<962?334:11998)).toString(36),o,s,c=2,l=[],u=[],d=(e=>{for(let t=0;t<e.length;)e[t++](e[t++])}),f=e=>{(!o||e.b.F?.H!==0)&&e.c(e.b,e.d)},p,m=(e,t)=>t[1+e]||=(document.addEventListener(e,t,!0),1),h={},g=1e6,_,v=function e(t){t.H=0,t.D?.forEach(e),t.B?.forEach(Ie)},y,b,x=(e,t)=>e.T?.(t),S=new WeakMap,C,ee=function e(t,n,r){let i,o,s=0,c=0;for(;t<n.length;)if(i=n.charCodeAt(t++),o=s,s=0,i===32)r[a(c++)]=C;else if(i===37||i===49)C.replaceWith(C=r[a(c++)]=new Text),i===49&&(r[a(c++)]=Pe());else if(i===38)return t;else if(i===47||i===48)t=e(t,n,r[a(c++)]=Ne(r.$,r.F)),i===48&&(r[a(c++)]=Pe());else if(i<92)for(i=25*o+i-67;i--;)te();else if(i<107)for(i=10*o+i-97;i--;)ne();else if(i<117){for(i=10*o+i-107;i--;)C=C.parentNode||C;ne()}else s=o*10+i-117},te=()=>{if(C.firstChild)return C=C.firstChild;for(;!C.nextSibling&&C.parentNode;)C=C.parentNode;ne()},ne=()=>C=C.nextSibling||C,w={},re,ie,ae,oe,se={},T=/[\p{L}\p{N}]/gu,E=``,D={},ce={},O=ye((e,...t)=>{e=a(e);let n=`D`+e,r=[],i=0;for(;i<t.length;)r.push(lt(``,t[i++],t[i++],t[i++])());return(t,i)=>{i!==(t[n]??(t[`A`+e]&&0))&&Xt(t,e,r[t[n]=i],st)}}),le=ye((e,t,n)=>{e=a(e),t!==void 0&&(t=a(t)),n!==void 0&&(n=a(n));let r=`A`+e;return(i,a)=>{let o=i[e],s=o.nodeType===1,c=s?o:o.parentNode,l=i[r];l||(l=i[r]={},l.S=s?c.firstChild:i[t],l.K=s?c.lastChild:n===void 0?o.previousSibling:i[n]);let u=l.S;if(l.L&&u===l.K&&u.tagName===`T`){let e=u;e.firstChild||e.appendChild(new Text),l=i[r]={},l.S=u=e.firstChild,l.K=e.lastChild,e.replaceWith(...e.childNodes)}let d=s?!!c.firstChild:u.parentNode===c;a?d||ze(l,c,s?null:o):d&&(s&&(l.S=c.firstChild,l.K=c.lastChild),Be(l))}}),ue=ye((e,t,n,r)=>{e=a(e);let i=`A`+e,o=`D`+e;return(a,s,c)=>{let l=ve(s);if(a[o]!==(a[o]=l?.a||l)||t&&!(l||a[i])){if(Xt(a,e,l||(t?t(a):void 0),Zt),n&&(a[i].T=e=>n()(a,e)),typeof l==`string`){if(t){let e=t(a);Xt(a[i],`a`,e,st),e.f&&Je(e.e,e.f,a[i].Aa)}}else l?.f&&Je(l.e,l.f,a[i])}if(l){let e=a[i],n=c?.();if(typeof l==`string`)(t?_t:vt)(e,`a`,(r?n[0]:n)||{},ce[e.a.tagName]),(e.Ia||e.Ea)&&Se(e,Yt);else{for(let t in l.g)l.g[t](e,l.h[t]);if(l.d){if(r)l.d(e,l._?n[0]:n);else{let r=t?{...n,content:t(a)}:n||{};l.d(e,l._?r:[r])}}}}}}),de=ye(e=>{e=a(e);let t=`A`+e,n=`D`+e;return(r,i)=>{if(r[n]!==(r[n]=i?.a||i)&&(Xt(r,e,i,st),i?.f&&Je(i.e,i.f,r[t])),i)for(let e in i.g)i.g[e](r[t],i.h[e])}}),k=ye(e=>(t,n,r,i,o)=>{t=a(t);let s=`A`+t,c=`O`+t,l=lt(``,n,r,i)();return(n,r)=>{let i=n[t],a=ke(n[s]),u=n[s]=[];n[c]=null;let d=a.length,f=i.nodeType>1?i.parentNode||a[0]?.S.parentNode:i,p,m,h=0;e(r,(e,t)=>{let r=u.length,i=a[r],s=d&&(p||e!==(i?.M??r)?(p||=a.reduce((e,t,n)=>n<r?e:(t.I=n,e.set(t.M??n,t)),new Map)).get(e):i&&(h++,i));s?(m=!0,p?.delete(e)):s=st(n.$,l,n,f),s.M=e,u.push(s),o?.(s,t)});let g=u.length,_=i!==f,v=null,y=d-1,b=g-1;if(_&&(d?(v=a[y].K.nextSibling,g||f.insertBefore(i,v)):g&&(v=i.nextSibling,i.remove())),!m){d&&(a.forEach(_?Re:Fe),_||(f.textContent=``));for(let e of u)ze(e,f,v);return}if(p)p.forEach(Re);else for(let e=g;e<d;e++)Re(a[e]);for(;y>=h&&b>=h&&a[y]===u[b];)y--,b--;if(y+1<d&&(v=a[y+1].S),h>y||h>b){for(let e=h;e<=b;e++)ze(u[e],f,v);return}let x=b-h+1,S=Array(x),C=Array(x),ee=[],te=-1,ne,w,re;for(let e=x;e--;)S[e]=u[h+e].I??-1;for(let e=0;e<x;e++)if(~S[e]){if(te<0||S[ee[te]]<S[e])~te&&(C[e]=ee[te]),ee[++te]=e;else{for(ne=0,w=te;ne<w;)re=(ne+w)/2|0,S[ee[re]]<S[e]?ne=re+1:w=re;S[e]<S[ee[ne]]&&(ne>0&&(C[e]=ee[ne-1]),ee[ne]=e)}}for(w=ee[te],ne=te+1;ne-->0;)ee[ne]=w,w=C[w];for(let e=x;e--;)~te&&e===ee[te]?te--:ze(u[h+e],f,v),v=u[h+e].S}})(([e,t],n)=>{t||=Qt,typeof t==`string`?be(e,(e,r)=>n(e[t],[e,r])):be(e,(e,r)=>n(t(e,r),[e,r]))});function fe(e,t){return t?e:``}function pe(e,t){return t||t===0?me(e)+`:`+me(t+``):``}function me(e){return n.test(e)?e.replace(n,r):e}function he(e){return/^on[A-Z-]/.test(e)}function ge(e){return e[2]===`-`?e.slice(3):e.slice(2).toLowerCase()}function _e(e){return e!=null&&e!==!1}function ve(e){if(e){if(typeof e==`string`)return e;let t=e.content||e.default||e;if(`a`in t)return t}}function ye(e){return o=1,e}function be(e,t){if(e){let n=0;for(let r of e)t(r,n++)}}function xe(e,t,n,r,i=e.L){let a;if(n>=0&&(a=e[n])){if(a.d=r,a.e===c||p&&a.f)return;a.e=c}else a={a:i*1e6+n,b:e,c:t,d:r,e:c},n>=0&&(e[n]=a);eee(a)}function eee(e){let t=u.push(e)-1;for(;t;){let n=t-1>>1,r=u[n];if(e.a-r.a>=0)break;u[t]=r,t=n}u[t]=e}function Se(e,t){l.push(t,e)}function Ce(){let e=l;try{s=1,we()}finally{c++,s=0,u=[],l=[]}d(e)}function we(){for(;u.length;){let e=u[0],t=u.pop();if(e!==t){let e=0,n=u.length>>1,r=(u[0]=t).a;for(;e<n;){let t=(e<<1)+1,n=t+1;if(n<u.length&&u[n].a-u[t].a<0&&(t=n),u[t].a-r>=0)break;u[e]=u[t],e=t}u[e]=t}f(e)}}function Te(e,t){let n=e.A?.[t];n&&(e.A[t]=void 0,s?Se(n,Oe):Oe(n))}function Ee(e,t){return De(e),((e.A||={})[t]||=new AbortController).signal}function De(e,t){let n=e.F;n&&(n.B||=new Set).add(e),t&&(e.Z||=[]).push(t)}function Oe(e){e.abort()}function ke(e){return e?Array.isArray(e)?e:[e]:[]}function Ae(e,t){if(e){if(Array.isArray(e))for(let n of e)t(n);else t(e)}}function je(e,t){return e?Array.isArray(e)?(e.push(t),e):[e,t]:t}function A(e,t,n){e[1+t]===void 0&&m(t,Me),e[1+t]=n||null}function Me(e){let t=!s&&e.target;for(;t;)t[1+e.type]?.(e,t),t=e.bubbles&&!e.cancelBubble&&t.parentNode}function tee(e,t){let n=h[t]||=document.createElementNS(t,`template`);return n.innerHTML=e,n.content||n}function Ne(e,t){let n={L:g++,H:c,F:t,$:e};return _?.push(n),n}function Pe(){return g++}function Fe(e){e.N?.D?.delete(e),v(e)}function Ie(e){e.Z?.forEach(Le,e);for(let t in e.A)Te(e,t)}function Le(e){e.delete(this)}function Re(e){Fe(e),Et(e.S,e.K)}function ze(e,t,n){Dt(t,n,e.S,e.K)}function Be(e){let t=new DocumentFragment;t.namespaceURI=e.S.parentNode.namespaceURI,Dt(t,null,e.S,e.K)}function Ve(){y||(y=1,queueMicrotask(He))}function He(){requestAnimationFrame(nee),Ce()}function nee(){b||(b=new MessageChannel,b.port1.onmessage=()=>{y=0,Ce()}),b.port2.postMessage(0)}function j(e,t){let n=a(e);return(r,i)=>(s?r.H===c&&(r[n]=i,t?.(r)):(r[n]!==i||!(n in r))&&(r[n]=i,t)&&(Ve(),xe(r,t,e)),i)}function Ue(e,t){let n=a(e),r=a(e+1),i=j(e,t);return(e,a,o)=>(s?(e[r]=o)&&(e[n]!==a||!(n in e))?(e[n]=a,t?.(e)):i(e,a):e[r]?e[r](a):i(e,a),a)}function M(e,t){return e=a(e),((n,r)=>{(n[e]!==r||!(e in n))&&(n[e]=r,t?.(n))})}function N(e,t,n=1,r=`L`){return r!==`L`&&(r=a(r)),i=>{i.H===c?~e in i?--i[~e]||t(i):i[~e]=n:xe(i,t,e,0,i[r])}}function We(e,t){e=a(e);let n=`A`+e,r=e=>{let r=ke(e[n]);r.length&&xe(e,()=>{for(let e of r)e.H>0&&e.H<c&&t(e)},-1,0,r[0].L)};return r._=t,r}function Ge(e,t,n,r){e=a(e),t=a(t),n!==`M`&&(n=a(n));let i=`A`+e,o=`O`+e,s=`_${t}`,l=e=>{let a=ke(e[i]);if(e.H<c&&a.length){let c=e[t];xe(e,()=>{let t=Ke(e,i,o,n);if(t&&s in t){let e=t.get(t[s]),n=t.get(c);e!==n&&(qe(e,r),qe(n,r))}else for(let t of ke(e[i]))qe(t,r);t&&(t[s]=c)},-1,0,a[0].L)}};return l._=r,l}function Ke(e,t,n,r){let i=e[n]||=new Map;if(!i.size)for(let a of ke(e[t])){let t=a.M??a[r];if(t===void 0)return e[n]=null;a.M=t,i.set(t,a)}return i}function qe(e,t){e&&e.H>0&&e.H<c&&t(e)}function P(e,t,n){e=a(e);let r=`A`+e,i=`D`+e,o=e=>{let a=e[r];a&&a.H>0&&a.H<c&&(e[i]||0)===t&&xe(a,n,-1)};return o._=n,o}function Je(e,t,n){let r=e[t]||=new Set,{size:i}=r;r.add(n).size!==i&&De(n,r)}function F(...e){let[t]=e,n=t.a,r=t.b;for(let t=e.length;t--;)e[t].c=t;return t=>{if(t[n])for(let i of t[n])i.H>0&&i.H<c&&xe(i,e[i[r]||0],-1)}}function I(e,t,n,r){e=a(e);let i=(e=>{e[i.b]=i.c,t(e),Je(n?n(e):e._,i.a,e)});return i.a=e,i.b=`C`+e,r&&R(r,i),i}function Ye(e,t,n){e[a(t)].T=t=>n(e,t)}function Xe({$:e}){let t=S.get(e)||0;return S.set(e,t+1),`c`+e.runtimeId+e.renderId+t.toString(36)}function L(e,t){return R(e,t),e=>{Se(e,t)}}function*Ze(e,t,n=t.length-1){if(e){if(Symbol.iterator in e)for(let r of e.values())yield*Ze(r,t,n);else{let r=e[t[n]];n?yield*Ze(r,t,n-1):yield typeof r==`function`?r():r}}}function Qe(...e){return e=e.map(e=>typeof e==`string`?e:a(e)),t=>{let n=()=>Ze(t,e).next().value;return n[Symbol.iterator]=()=>Ze(t,e),n}}function $e(e,...t){return R(e,Qe(...t))}function et(e,t,n){C=e,ee(0,t,n)}function tt(e=`M`){if(re)return;let t=self[e],n=t=>Object.defineProperty(self,e,t),r=t=>{n({value:re=(n=>{let r=re[n]=t[n]||t(n),i=r.w,a={},s=e=>a[e]||(+e?l(a[e]={L:+e}):c()),c=()=>a[0]||={runtimeId:e,renderId:n},l=e=>(e.H=1,e.$=c(),o&&e.G&&(e.F=s(e.G)),e),u=e=>{let t=e[0];for(let n=1;n<e.length;n++){let r=e[n];typeof r==`number`?t+=r:(t?l(Object.assign(a[t]||=(r.L=t,r),r)):Object.assign(c(),r),t++)}},d=((e,t)=>typeof e==`number`?t?w[t](s(e)):s(e):u(e)),f=(e=[],t=[],n=[],i=[],a)=>(o,c,l,u,d,f=_.parentNode,m=_,h=n.length,v=i.length)=>{for(y!==`[`&&(b[p()]=y===`)`||y===`}`?f:_,u=`A`+x,d=y!==`]`&&y!==`)`,p());o=+x;){if((l||=[]).push(c=s(o)),ot(c,c.F),(c.O=r.p?.[o])&&(c.O.m=r.m),d){for(;m.previousSibling&&~g.indexOf(m=m.previousSibling););c._??=b,c.K=c.S=m,y===`'`&&(c.a=m)}else a=je(a,c),u&&(b[u]=a,Ae(a,e=>e._??=b),a=e.pop()),m=t.pop(),f!==m.parentNode&&f.prepend(m),c.S=m,c.K=_.previousSibling===m?m:f.insertBefore(new Text,_);for(;h&&n[h-1].L>o;)h--,ot(n.pop(),c);for(;v&&i[v-1].L>o;){v--;let e=i.pop();e.F!==e&&(e.F=c)}p()}if(l){for(let e of l)n.push(e);d&&(b[u]=l.length>1?l.reverse():l[0])}y===`[`?(l||(e.push(a),a=void 0),t.push(_)):i.push(b)},p=()=>x=v.slice(S,(S=v.indexOf(` `,S)+1||v.length+1)-1),m=(e=[],t)=>{let n=0;for(;n<e.length;n++){let i=e[n];if(typeof i==`string`)for(S=0,v=i;p();)/\D/.test(x)?h=w[x]:t.push(h,s(x));else if(Array.isArray(i)){if(!(ae&&i.every(e=>ae.has(e)&&!r.b[e].length)))break}else if(ae&&typeof i==`number`)break;else{let e=i(d);Array.isArray(e)&&u(e)}}return e.splice(0,n),n},h,g,_,v,y,b,x,S,C,ee;return d._=w,r.m=e=>{if(m(r.r,e),ae&&r.b)for(let t=1;t;){t=0;for(let n of ae){let i=r.b[n];i&&m(i,e)&&(t=1)}}let t=0;for(_ of g=r.v)if(S=r.i.length,v=_.data,y=v[S++],b=s(p()),y===`*`){let e=_.previousSibling;b[p()]=e&&(e.nodeType<8||e.data)?e:_.parentNode.insertBefore(new Text,_)}else o?(C||=f())():r.b&&(g[t++]=_);return ie&&!ee&&_&&ie.set(ee=_.parentNode.insertBefore(new Text,_.nextSibling),[n,a]),g.length=t,e},r.w=()=>{i(),nt(r)},r})})};if(t){r(t);for(let e in t)nt(re(e))}else n({configurable:!0,set:r})}function nt(e){try{oe=1,d(e.m([]),1)}finally{oe=0}}function R(e,t){return w[e]=t}function rt(e,t){return R(e,e=>n=>t(e,n)),t}function it(e,t){return t=a(t),R(e,e=>()=>e[t])}function at(e,t,n,r){let i=Ne(e);return i._=t.e||n,ot(i,n?.F),t.b?.(i,r.namespaceURI),i}function ot(e,t){t&&(e.N=t,(t.D||=new Set).add(e)),e.F=e}function st(e,t,n,r){return ct(t,at(e,t,n,r))}function ct(e,t){return e.c&&xe(t,e.c,-1),t}function lt(e,t,n,r,i,a){n=n?n.replace(/[^\0-1]+$/,``):``,r=r?r._||r:void 0,i||=void 0;let o=t?(e,r)=>{((se[r]||={})[1+t]||=dt(t,r))(e,n)}:e=>{et(e.S=e.K=new Text,n,e)};return t=>({a:e,b:o,e:t,c:r,d:i,f:a})}function ut(e,t,n,r,i,a){return R(e,lt(e,t,n,r,i,a))}function dt(e,t){let{firstChild:n,lastChild:r}=tee(e,t),i=document.createElementNS(t,`t`);return Dt(i,null,n,r),n===r&&n.nodeType<8?(e,t)=>{et(e.S=e.K=n.cloneNode(!0),t,e)}:(e,t)=>{let n=i.cloneNode(!0);et(n.firstChild,t,e),e.S=n.firstChild,e.K=n.lastChild}}function ft(e){return e||e===0?e+``:``}function z(e,t,n){pt(e,t,wt(n))}function pt(e,t,n){e.getAttribute(t)!=n&&(n===void 0?e.removeAttribute(t):e.setAttribute(t,n))}function mt(e,t){pt(e,`class`,i(t,` `,fe)||void 0)}function ht(e,t){for(let n in t)B(e,n,t[n])}function B(e,t,n){e.classList.toggle(t,!!n)}function gt(e,t){pt(e,`style`,i(t,`;`,pe)||void 0)}function V(e,t){let n=ft(t);e.data!==n&&(e.data=n)}function _t(e,t,n,r){let i=e[t];for(let e=i.attributes.length;e--;){let{name:t}=i.attributes.item(e);n&&(t in n||yt(i,t,n))||i.removeAttribute(t)}bt(e,t,n,r)}function vt(e,t,n,r){_t(e,t,n,r),xt(e,t,n?.content)}function yt(e,t,n){return t===`checked`&&e.tagName===`INPUT`&&`checkedValue`in n}function bt(e,t,n,r){let i=e[t],a=e[`I`+t],o;for(let e in a)a[e]=0;r&&(e[`F`+t]=5,e[`E`+t]=0,n&&(o=r(e,t,n)));for(let r in n){let s=n[r];switch(r){case`class`:mt(i,s);break;case`style`:gt(i,s);break;default:he(r)?(a||=e[`I`+t]={})[ge(r)]=s:o?.test(r)||r===`content`&&i.tagName!==`META`||z(i,r,s)}}}function xt(e,t,n){let r=Ct(n);e[`D`+t]!==(e[`D`+t]=r?.a)&&(Xt(e,t,r,st),r?.f&&Je(r.e,r.f,e[`A`+t]));for(let n in r?.g)r.g[n](e[`A`+t],r.h[n])}function St(e,t){let n=e[t],r=e[`I`+t];D[e[`F`+t]]?.(e,t);for(let e in r)A(n,e,r[e])}function Ct(e){let t=ve(e);if(t&&t.a)return t}function wt(e){if(_e(e))return e===!0?``:e+``}function Tt(e,t,n=0){let r=`K`+n,i=e[r];i?(Object.assign(i,t),i.onUpdate?.()):(e[r]=t,Object.assign(t,t.onMount?.()),Ee(e,r).onabort=()=>t.onDestroy?.())}function Et(e,t){let n=t.nextSibling;for(;e!==n;){let t=e.nextSibling;e.remove(),e=t}}function Dt(e,t,n,r){if(e.isConnected)e.insertBefore(Ot(n,r),t);else{let i=r.nextSibling;for(;n!==i;){let r=n.nextSibling;e.insertBefore(n,t),n=r}}return e}function Ot(e,t){return e===t?e:Dt(new DocumentFragment,null,e,t)}function kt(e,t,n,r){if((t||t===0)&&(t!==n.length||/kw/.test(e))){let e=n.slice(0,t),i=n.slice(t);if(r.startsWith(e))return t;if(r.endsWith(i))return r.length-i.length;let a=e.match(T)?.length;for(;a&&T.test(r);)a--;return a?r.length:T.lastIndex}return-1}function At(e,t,n){let r=e[t],i=_e(n);if(r.defaultChecked!==i){let t=e.H<c?r.checked:i;r.defaultChecked=i,t!==i&&(r.checked=t)}}function jt(e,t,n,r){let i=e[t],a=_e(n);e[`E`+t]=r,e[`F`+t]=r?0:5,r&&e.H<c?i.checked=a:At(e,t,a)}function Mt(e,t){let n=e[t];Ht(n,Gt,()=>{let r=e[`E`+t];if(r){let e=n.checked;n.checked=!e,r(e),Ce()}})}function Nt(e,t,n){let r=e[t],i=wt(n)||``;if(r.defaultValue!==i){let t=e.H<c?r.value:i;r.defaultValue=i,It(r,t)}}function Pt(e,t,n,r,i=Nt){let a=e[t],o=wt(n)||``;e[`E`+t]=r,e[`G`+t]=o,e[`F`+t]=r?2:5,r&&e.H<c?It(a,o):i(e,t,o)}function Ft(e,t){let n=e[t];oe&&(e[`G`+t]=n.defaultValue),Ht(n,Wt,r=>{let i=e[`E`+t];i&&(E=r?.inputType,i(n.value),Ce(),It(n,e[`G`+t]),E=``)})}function It(e,t){if(e.value!==t){let n=kt(E,document.activeElement===e&&e.selectionStart,e.value,e.value=t);~n&&e.setSelectionRange(n,n)}}function Lt(e,t,n){let r,i=e[t],a=e.H<c,o=Array.isArray(n),s=o?n.map(Jt):Jt(n);l.unshift(()=>{for(let e of i.options){let t=o?s.includes(e.value):e.value===s;e.defaultSelected!==t&&(a&&(r??=Vt(i,o)),e.defaultSelected=t)}r!==void 0&&Bt(i,r,o)},e)}function Rt(e,t,n,r){let i=e[t],a=e.H<c,o=Array.isArray(n),s=e[`G`+t]=o?n.map(Jt):Jt(n);e[`E`+t]=r,e[`F`+t]=r?3:5,r&&a?l.unshift(()=>Bt(i,s,o),e):Lt(e,t,s)}function zt(e,t){let n=e[t],r=()=>{let r=e[`E`+t];if(r){let i=e[`G`+t],a=Array.isArray(i),o=Vt(n,a);Bt(n,i,a),r(o),Ce()}};if(oe){if(n.multiple){e[`G`+t]=[];for(let r of n.options)r.defaultSelected&&e[`G`+t].push(r.value)}else{e[`G`+t]=``;for(let r of n.options)if(r.defaultSelected){e[`G`+t]=r.value;break}}}Ht(n,Kt,r),iee(e,t,{childList:!0,subtree:!0},()=>{let i=e[`G`+t];(Array.isArray(i)?i.length!==n.selectedOptions.length||i.some((e,t)=>!i.includes(n.selectedOptions[t].value)):n.value!==i)&&r()})}function Bt(e,t,n){if(n)for(let n of e.options)n.selected=t.includes(n.value);else e.value=t}function Vt(e,t){return t?Array.from(e.selectedOptions,e=>e.value):e.value}function ree(e,t,n){e.H===c&&(e[t].open=_e(n))}function iee(e,t,n,r){(e[`N`+t]||=new MutationObserver(r)).observe(e[t],n)}function Ht(e,t,n){e._=n,m(`input`,aee),e.form&&m(`reset`,Ut),oe&&t(e)&&queueMicrotask(n)}function aee(e){e.target._?.(e)}function Ut(e){let t=[];for(let n of e.target.elements)n._&&qt(n)&&t.push(n._);requestAnimationFrame(()=>{if(!e.defaultPrevented)for(let e of t)e()})}function Wt(e){return e.value!==e.defaultValue}function Gt(e){return e.checked!==e.defaultChecked}function Kt(e){for(let t of e.options)if(t.selected!==t.defaultSelected)return!0}function qt(e){return e.options?Kt(e):Wt(e)||Gt(e)}function Jt(e){return wt(e)||``}function Yt(e){St(e,`a`)}function Xt(e,t,n,r){let i=e[t],a=e[`A`+t],o=i.nodeType>1?(a?.S||i).parentNode:i,s=e[`A`+t]=n&&r(e.$,n,e,o);i===o?(a&&(Fe(a),i.textContent=``),s&&ze(s,o,null)):a?(s?ze(s,o,a.S):o.insertBefore(i,a.S),Re(a)):s&&(ze(s,o,i),i.remove())}function Zt(e,t,n,r){let i=at(e,t,n,r);return typeof t==`string`?i.a=i.S=i.K=document.createElementNS(t===`svg`?`http://www.w3.org/2000/svg`:t===`math`?`http://www.w3.org/1998/Math/MathML`:r.namespaceURI,t):ct(t,i),i}function Qt(e,t){return t}var $t=[],en=Symbol();function tn(e){return e[Symbol.iterator]=nn,e[en]=$t,e}function*nn(){yield this,yield*this[en]}async function H(e,t){let n=await fetch(e,t),r;try{r=await n.json()}catch{throw Error(n.ok?`invalid response`:`HTTP ${n.status}`)}if(r&&typeof r==`object`&&r.error)throw Error(r.error);if(!n.ok)throw Error(`HTTP ${n.status}`);return r}var rn=[`workspaces.changed`,`sessions.changed`,`workspace.progress`,`review.changed`,`status.changed`],an=1e4,on=4e4,sn=8e3,cn=5e3,ln=6e4,un,dn,fn=null,pn,mn,hn,gn,_n=0;function vn(e){dn&&e!==dn&&location.reload(),dn=e}async function yn(){try{vn((await H(`/api/boot`)).boot)}catch{}}function bn(){clearTimeout(mn),clearTimeout(hn),hn=setTimeout(xn,on),_n&&(_n=0,clearInterval(gn),gn=void 0)}function xn(){Sn(),!_n&&(_n=Date.now(),gn=setInterval(()=>{document.visibilityState===`visible`&&(Date.now()-_n>ln&&(_n=Date.now(),wn()),Cn(),H(`/api/status`).then(e=>{un.dispatchEvent(new MessageEvent(`status.changed`,{data:e}))}).catch(()=>{}))},cn))}function Sn(){clearTimeout(mn),clearTimeout(hn),fn?.close(),fn=null}function Cn(){for(let e of[`workspaces.changed`,`sessions.changed`])un.dispatchEvent(new MessageEvent(e,{data:null}))}function wn(){if(fn)return;let e=fn=new EventSource(`/api/events`);clearTimeout(mn),mn=setTimeout(xn,sn),e.addEventListener(`hello`,e=>{bn(),vn(JSON.parse(e.data||`{}`).boot)}),e.addEventListener(`ping`,bn);for(let t of rn)e.addEventListener(t,e=>{bn(),un.dispatchEvent(new MessageEvent(t,{data:JSON.parse(e.data||`null`)}))})}function Tn(){return un||(un=new EventTarget,wn(),yn(),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`?(clearTimeout(pn),wn(),yn(),Cn()):(clearTimeout(pn),pn=setTimeout(()=>{_n||Sn()},an))})),un}var En=null,Dn=null,On=new EventTarget;function kn(e,t){On.addEventListener(`intent`,e,{signal:t})}function An(e,t){En={workspaceId:e,pr:t},On.dispatchEvent(new Event(`intent`))}function jn(e){if(En?.workspaceId!==e)return!1;let t=En.pr;return En=null,{pr:t}}function Mn(e,t){Dn=[e,t],On.dispatchEvent(new Event(`intent`))}function Nn(e){if(Dn?.[0]!==e)return null;let t=Dn[1];return Dn=null,t}function Pn(e){let t=!1,n=!1;return async()=>{if(t){n=!0;return}t=!0;try{do n=!1,await e();while(n)}finally{t=!1}}}var Fn=new Map,In=new Set,Ln;function Rn(){return typeof window>`u`?Promise.resolve():Ln??=(async()=>{try{let e=await(await fetch(`/api/prefs`)).json();for(let[t,n]of Object.entries(e))In.has(t)||Fn.set(t,n)}catch{}})()}function zn(e){return Fn.get(e)??null}function Bn(e,t){In.add(e),t===null?Fn.delete(e):Fn.set(e,t),Vn(e,t)}function Vn(e,t){return fetch(`/api/prefs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({key:e,value:t})}).catch(()=>{})}function Hn(){return zn(`last-workspace`)}function Un(e){Bn(`last-workspace`,e)}function Wn(){return zn(`side-nav`)!==`0`}function Gn(e){Bn(`side-nav`,e?`1`:`0`)}function Kn(e){return zn(`tab:${e}`)}function qn(e,t){Bn(`tab:${e}`,t)}function Jn(){return zn(`diff-tree`)!==`0`}function Yn(e){Bn(`diff-tree`,e?`1`:`0`)}function Xn(){return zn(`diff-uncommitted`)===`1`}function Zn(e){Bn(`diff-uncommitted`,e?`1`:`0`)}function Qn(){return typeof window<`u`&&`serviceWorker`in navigator&&`PushManager`in window}async function $n(){return Qn()?(await rr()).pushManager.getSubscription():null}async function er(){if(await Notification.requestPermission()!==`granted`)return!1;let e=await rr(),t=await e.pushManager.getSubscription();if(!t){let{publicKey:n}=await H(`/api/push`);t=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ir(n)})}return await H(`/api/push`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t.toJSON())}),!0}async function tr(){let e=await $n();e&&(await H(`/api/push?endpoint=${encodeURIComponent(e.endpoint)}`,{method:`DELETE`}).catch(()=>{}),await e.unsubscribe())}function nr(e){let t=()=>{document.visibilityState===`visible`&&navigator.clearAppBadge?.().catch(()=>{})};t(),document.addEventListener(`visibilitychange`,t,{signal:e})}async function rr(){return await navigator.serviceWorker.getRegistration()??navigator.serviceWorker.register(`/sw.js`)}function ir(e){let t=e.padEnd(e.length+(4-e.length%4)%4,`=`),n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(n,e=>e.charCodeAt(0))}function ar(){return typeof window<`u`&&window.matchMedia(`(pointer: coarse)`).matches}function or(){return typeof window<`u`&&window.matchMedia(`(max-width: 899px)`).matches}function sr(){return typeof navigator<`u`&&navigator.standalone===!0}function cr(e){if(!sr()||!/^https?:\/\//.test(e)){window.open(e,`_blank`,`noopener`);return}if(localStorage.getItem(`xSafariOk`)){location.href=`x-safari-${e}`;return}if(localStorage.getItem(`xSafariNo`)){window.open(e,`_blank`,`noopener`);return}let t=!1,n=()=>{document.visibilityState===`hidden`&&(t=!0,localStorage.setItem(`xSafariOk`,`1`))};document.addEventListener(`visibilitychange`,n),window.addEventListener(`pagehide`,n),setTimeout(()=>{document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pagehide`,n),!(t||document.visibilityState===`hidden`)&&(localStorage.setItem(`xSafariNo`,`1`),window.open(e,`_blank`,`noopener`))},1500),location.href=`x-safari-${e}`}function lr(e,t){if(!e)return-1;let n=e.toLowerCase(),r=t.toLowerCase(),i=r.lastIndexOf(`/`),a=r.slice(i+1),o=r.slice(0,Math.max(0,i)).includes(n)?5:0;return a===n?1e3+o:a.startsWith(n)?800+o:a.includes(n)?600+o:dr(n,a)?400+o:r.includes(n)?300:dr(n,r)?100:-1}function ur(e,t,n){return e?t.map(t=>({repo:t,score:lr(e,t.nameWithOwner)})).filter(({repo:e,score:t})=>!e.isArchived&&t>=0&&!n(e.nameWithOwner)).sort((e,t)=>t.score-e.score||e.repo.nameWithOwner.length-t.repo.nameWithOwner.length||e.repo.nameWithOwner.localeCompare(t.repo.nameWithOwner)).slice(0,8).map(({repo:e})=>e):[]}function dr(e,t){if(!e)return!0;let n=0,r=t.toLowerCase();for(let t of e.toLowerCase()){if(n=r.indexOf(t,n),n===-1)return!1;n++}return!0}function fr(e){return e?.working?`working`:e?.waiting?`waiting`:e?.agents?`idle`:`off`}function pr(e){return e?.phase===`working`?`working`:e?.phase===`waiting`?`waiting`:e?.alive?`idle`:`off`}var mr=`<svg viewBox="0 0 24 24" fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden=true><path></path></svg>`,hr=` D l`,gr=(e,t)=>{z(e.a,`width`,t),z(e.a,`height`,t)},_r=(e,t)=>gr(e,t??15),vr=(e,t)=>mt(e.a,[`icon`,t]),yr=(e,t)=>z(e.b,`d`,t),br=mr,xr=(e=>`/${e}&`)(hr);function Sr(e){yr(e.a,`M18 21C19.1046 21 20 20.1046 20 19C20 17.8954 19.1046 17 18 17C16.8954 17 16 17.8954 16 19C16 20.1046 16.8954 21 18 21Z M6 7C7.10457 7 8 6.10457 8 5C8 3.89543 7.10457 3 6 3C4.89543 3 4 3.89543 4 5C4 6.10457 4.89543 7 6 7Z M18 17V7C18 7 18 5 16 5H13 M6 7V17C6 17 6 19 8 19H11 M15.0005 7.50012L12.5005 5.00012L15.0005 2.50012 M8.5 16.5L11 19L8.5 21.5`)}var Cr=(e,t)=>_r(e.a,t),wr=(e,t)=>vr(e.a,t),Tr=mr,Er=(e=>`/${e}&`)(hr);function Dr(e){yr(e.a,`M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z M19.6224 10.3954L18.5247 7.7448L20 6L18 4L16.2647 5.48295L13.5578 4.36974L12.9353 2H10.981L10.3491 4.40113L7.70441 5.51596L6 4L4 6L5.45337 7.78885L4.3725 10.4463L2 11V13L4.40111 13.6555L5.51575 16.2997L4 18L6 20L7.79116 18.5403L10.397 19.6123L11 22H13L13.6045 19.6132L16.2551 18.5155C16.6969 18.8313 18 20 18 20L20 18L18.5159 16.2494L19.6139 13.598L21.9999 12.9772L22 11L19.6224 10.3954Z`)}var Or=(e,t)=>_r(e.a,t),kr=(e,t)=>vr(e.a,t),Ar=mr,jr=(e=>`/${e}&`)(hr);function Mr(e){yr(e.a,`M6 12H12M18 12H12M12 12V6M12 12V18`)}var Nr=(e,t)=>_r(e.a,t),Pr=(e,t)=>vr(e.a,t),Fr=`<!><!><!>`,Ir={claude:`M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z`,codex:`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`,grok:`M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815`,copilot:`M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z`,cursor:`M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z`},Lr=P(0,1,e=>_r(e.a,e._.d)),Rr=e=>{Lr._(e),zr._(e),yr(e.a,`M5 7L10 12L5 17 M13 17H20`)},zr=P(0,1,e=>vr(e.a,e._.f)),Br=P(0,0,e=>mt(e.a,[`icon`,e._.f])),Vr=e=>{Br._(e),Hr._(e),Ur._(e)},Hr=P(0,0,e=>{z(e.a,`width`,e._.g),z(e.a,`height`,e._.g)}),Ur=P(0,0,e=>z(e.b,`d`,e._.h)),Wr=M(6,Hr),Gr=M(3,e=>{Wr(e,e.d??15),Lr(e)}),Kr=O(0,`<svg viewBox="0 0 24 24" fill=currentColor fill-rule=evenodd aria-hidden=true><path></path></svg>`,` D `,Vr,mr,(e=>`/${e}&`)(hr),Rr),oee=M(7,e=>{Kr(e,+!e.h),Ur(e)}),qr=(e,t)=>oee(e,Ir[t]),Jr=M(5,e=>{Br(e),zr(e)}),see=`<!><!><div class=palette role=dialog aria-label=Workspaces><!><input autofocus placeholder="Jump to workspace…" aria-label="Filter workspaces"><ul class=rows></ul><!><div class=palette-foot><span></span><span class="dim hint">↑↓ navigate · ↵ open · ⌘1–9 switch · esc close</span><!></div></div>`,cee=`b%b D%b b b%bDc%m`,lee=(e,t)=>{z(e.a,`value`,t),V(e.b,t)},uee=(e,t)=>lee(e,t[0]),dee=(e,t)=>V(e.a,t),fee=(e,t)=>dee(e,t[0]?.worktree),Yr=P(5,0,e=>{z(e.a,`title`,`${e._.r} open PR${e._.r===1?``:`s`}`),V(e.b,e._.r),V(e.c,e._.r===1?``:`s`)}),pee=Yr,Xr=P(6,0,e=>z(e.a,`title`,e._.o.map(e=>`:${e.port} ${e.cmd}`).join(`
3
- `))),mee=e=>{Xr._(e),Zr._(e)},Zr=P(6,0,e=>V(e.b,e._.p)),Qr=N(2,e=>z(e.a,`title`,`${e._.l} running session${e._.l===1?``:`s`}${e._.m?` — ${e._.m} working`:``}${e._.n?` — ${e._.n} waiting on you`:``}`),2),$r=P(4,0,e=>{V(e.b,e._.l),Qr(e)}),ei=e=>{$r._(e),ti._(e),ni._(e)},ti=P(4,0,Qr),ni=P(4,0,Qr),ri=P(0,1,e=>V(e.a,e._.g)),ii=ri,ai=N(2,e=>V(e.b,e._.a3?`hide archived`:`archived (${e._.a6})`)),oi=P(5,0,ai),si=L(`j8`,e=>A(e.a,`click`,function(){Da(e._,!e._.a3)})),ci=e=>{oi._(e),li._(e),si(e)},li=P(5,0,ai),ui=N(1,e=>Rt(e,`a`,e._.o.preferredAgent,ao(e))),di=P(6,0,ui),fi=L(`j9`,e=>zt(e,`a`)),pi=e=>{di._(e),hi._(e),gi._(e),fi(e)},mi=k(0,`<option> </option>`,` D `,0,uee),hi=P(6,0,e=>mi(e,[e._.z,e=>e])),gi=P(6,0,ui),_i=L(`j5`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._.q(e._._.h,e.e)})),vi=e=>{e.b,Gr(e.b,14),Jr(e.b),_i(e)},yi=M(4,e=>{qr(e.b,e.e),V(e.c,e.e)}),bi=k(6,(e=>`<button>${e}<!></button>`)(Fr),(e=>` D/${e}&%l`)(`b%c`),vi,(e,t)=>yi(e,t[0])),xi=I(48,e=>bi(e,[[...e._._.z||[],`shell`],e=>e]),e=>e._._),Si=(e,t)=>{z(e.e,`popovertarget`,t),z(e.g,`id`,t)},Ci=L(`j6`,e=>{A(e.a,`click`,function(t){t.stopPropagation(),e._._.m(e._.h)}),A(e.c,`click`,function(t){t.stopPropagation(),e._._.n(e._.h)}),A(e.e,`click`,function(e){e.stopPropagation()}),A(e.g,`toggle`,function(t,n){if(t.newState===`open`){let t=e.e.getBoundingClientRect();n.style.top=`${t.bottom+4}px`,n.style.left=`${Math.max(8,t.right-n.offsetWidth)}px`}})}),wi=e=>{xi(e),Sr(e.b),Cr(e.b,13),wr(e.b),Dr(e.d),Or(e.d,13),kr(e.d),Mr(e.f),Nr(e.f,13),Pr(e.f),Si(e,Xe(e)),Ci(e)},Ti=O(2,`<span class="chip open">open</span>`),Ei=N(18,e=>Ti(e,e._.i===e._._.k?0:1)),Di=I(45,Ei,e=>e._._),Oi=e=>{Di(e),ji(e),Ni._(e),Pi._(e),Fi._(e),Ri._(e)},ki=(e,t)=>{mt(e.a,[`dot`,fr(t)]),Bi(e,t?.repos),Hi(e,t?.agents),Ui(e,t?.working),Wi(e,t?.waiting),Ki(e,t?.ports)},Ai=N(19,e=>ki(e,e._._.y[e._.i])),ji=I(47,Ai,e=>e._._),Mi=O(3,`<span class=chip>archived</span>`),Ni=P(0,2,e=>Mi(e,+!e._.f)),Pi=P(0,2,e=>{Ai(e),Ei(e)}),Fi=P(0,2,e=>V(e.b,e._.j)),Ii=k(7,`<span class=mono> </span>`,`D `,0,fee),Li=N(10,e=>Ii(e,[e.j||e._.k,`full_name`])),Ri=P(0,2,Li),zi=(e,t)=>Yi(e,t?.length),Bi=M(9,e=>{zi(e,(e.j||[]).flatMap(e=>e.prs||[])),Li(e)}),Vi=O(4,`<span class="chip stat"> </span>`,` D `,ei),Hi=M(11,e=>{Vi(e,+!e.l),$r(e)}),Ui=M(12,ti),Wi=M(13,ni),Gi=O(6,`<span class="chip stat">:<!></span>`,` Db%`,mee),Ki=M(14,e=>{qi(e,e.o?.length),Gi(e,+!(e.o||[]).length),Xr(e)}),qi=M(15,Zr),Ji=O(5,`<span class="chip stat"><!> PR<!></span>`,` D%c%`,pee),Yi=M(17,e=>{Ji(e,+!e.r),Yr(e)}),Xi=N(12,e=>ht(e.a,{hi:e.l===e._.ah,archived:e.e===`ws`&&e.f}),3),Zi=We(4,Xi),Qi=L(`j7`,e=>{A(e.a,`click`,function(){e._.ai(e.d)}),A(e.a,`mouseenter`,function(){Ea(e._,e.l)})}),$i=e=>{Zi._(e),Qi(e)},ea=O(0,`<span class=row-name>+ New workspace</span>`,0,0,`<span class="row-name cmd-row">▸ <!></span>`,`Db%`,ii,`<span class=row-name><span></span><span class=row-name-text> </span><!><!><span class=row-stats><!><!><!></span></span><span class=row-repos></span>`,`D bD l%b%bD%b%b%m `,Oi),ta=O(1,((e,t,n)=>`<button class=row-more title="Review changes">${e}</button><button class=row-more title="Manage workspace">${t}</button><button class=row-more title="New session">${n}</button><div popover=auto class=new-session-pop></div>`)(br,Tr,Ar),((e,t,n)=>` D/${e}&l D/${t}&l D/${n}&l b`)(xr,Er,jr),wi),na=M(4,e=>{ea(e,e.e===`new`?0:e.e===`cmd`?1:2),ta(e,e.e===`ws`?0:1),Xi(e)}),ra=M(5,e=>{Xi(e),Ni(e)}),ia=M(11,Xi),aa=(e,t)=>{oa(e,t[0]),ia(e,t[1])},oa=M(3,e=>{na(e,e.d?.kind),ra(e,e.d?.archived),sa(e,e.d?.label),ca(e,e.d?.ws)}),sa=M(6,ri),ca=M(7,e=>{la(e,e.h?.id),ua(e,e.h?.name),da(e,e.h?.repos)}),la=M(8,Pi),ua=M(9,Fi),da=M(10,Ri),fa=L(`j4`,e=>A(e.a,`click`,function(){e._.v?.()})),pa=k(4,`<li><div class=row-wrap><button class=row></button><!></div></li>`,`E b%`,$i,aa),ma=N(40,L(`j12`,e=>Tt(e,{onMount:function(){let t=new AbortController,n=e.ad.findIndex(t=>t.kind===`ws`&&t.ws.id===e.k);n>=0&&Ea(e,n),setTimeout(()=>e.d?.focus(),0);let r=t.signal;return document.addEventListener(`keydown`,t=>{document.querySelector(`:popover-open`)||t.key===`Escape`&&!e.u&&(t.preventDefault(),e.v?.())},{capture:!0,signal:r}),{abort:t}},onDestroy:function(){this.abort.abort()}})),3),ha=M(39,e=>{Ha(e,e.ad.length),pa(e,[e.ad,e=>e.kind===`new`?`new`:e.kind===`cmd`?`cmd:${e.label}`:e.ws.id]),ma(e)}),ga=N(38,e=>ha(e,[...e.a8(e.a4).map(e=>({kind:`ws`,ws:e})),...e.a3||e.a1?e.a8(e.a5).map(e=>({kind:`ws`,ws:e,archived:!0})):[],...e.ab,{kind:`new`}]),5),_a=M(34,ga),va=M(37,ga),ya=N(36,e=>va(e,!e.a1||!e.a9?[]:[{kind:`cmd`,label:`Review changes — ${e.a9?.name}`,run:()=>e.m(e.a9)},{kind:`cmd`,label:`Manage workspace — ${e.a9?.name}`,run:()=>e.n(e.a9)},{kind:`cmd`,label:`New ${e.p||`agent`} session — ${e.a9?.name}`,run:()=>e.q(e.a9,e.p||`claude`)}].filter(t=>t.kind===`cmd`&&dr(e.a1,t.label))),5),ba=O(5,`<button class="archived-link dim"> </button>`,` D `,ci),xa=N(33,e=>ba(e,e.a6&&!e.a1?0:1)),Sa=j(27,e=>{Pt(e,`d`,e.a1,so(e)),_a(e,oo(e)),ya(e),ga(e),xa(e)}),Ca=L(`j11`,e=>e.e.children[e.ah]?.scrollIntoView({block:`nearest`})),wa=M(43,e=>{Zi(e),Ca(e)}),Ta=N(42,e=>wa(e,Math.min(e.a2,e.af-1))),Ea=j(28,Ta),Da=j(29,e=>{ga(e),oi(e)}),Oa=L(`j10`,e=>{Ft(e,`d`),A(e.d,`keydown`,function(t){t.key===`ArrowDown`?(t.preventDefault(),Ea(e,Math.min(e.ah+1,e.ad.length-1))):t.key===`ArrowUp`?(t.preventDefault(),Ea(e,Math.max(e.ah-1,0))):t.key===`Enter`?(t.preventDefault(),e.ai(e.ad[e.ah])):t.key===`Escape`&&!e.u&&(t.preventDefault(),e.v?.())})});function ka(e){Sa(e,``),Ea(e,0),Da(e,!1),Oa(e)}var Aa=M(30,ga),ja=M(31,e=>{Fa(e,e.a5?.length),ga(e)}),Ma=M(35,ya),Na=N(11,e=>Ma(e,e.j.find(t=>t.id===e.k))),Pa=M(9,e=>{Qa(e,e.j?.length),Aa(e,e.j.filter(e=>e.status===`active`)),ja(e,e.j.filter(e=>e.status===`archived`)),Na(e)}),Fa=M(32,e=>{xa(e),li(e)}),Ia=F(Di),La=M(10,e=>{Na(e),ma(e),Ia(e)}),Ra=M(12,ya),za=M(13,ya),Ba=M(15,ya),Va=M(16,ya),Ha=M(41,Ta),Ua=M(44),Wa=N(19,e=>Ua(e,co(e))),Ga=M(17,Wa),Ka=M(18,Wa),qa=O(0,`<div class=palette-backdrop></div>`,` `,fa),Ja=O(2,`<div class="onboard dim"><p>A <strong>workspace</strong> checks out one or more repos as git worktrees on a shared branch and gives each agent session its own terminal. Create one to get started.</p><p>Pick your preferred agent below — new sessions and the quick-create button use it. GitHub access uses your <code>gh</code> login.</p></div>`),Ya=N(23,e=>Ja(e,e.u&&!e.w?0:1)),Xa=M(20,e=>{B(e.b,`inline`,e.u),qa(e,+!!e.u),ma(e),Ya(e)}),Za=M(21,ma),Qa=M(22,Ya),$a=O(6,`<label class=dim><select aria-label="Preferred agent"></select></label>`,`D `,pi),eo=M(14,e=>{Ba(e,e.o?.preferredAgent),no(e,e.o?.agents),$a(e,+!e.o),di(e)}),to=F(xi),no=M(25,e=>{to(e),hi(e)}),ro=M(24,F(ji)),io=M(26,gi);function ao(e){return function(t){e._.a0({...e._.o,preferredAgent:t}),H(`/api/settings`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({preferredAgent:t})}).catch(()=>{})}}function oo(e){return t=>t.filter(t=>dr(e.a1,t.name))}function so(e){return function(t){Sa(e,t),Ea(e,0)}}function co(e){return t=>{t&&(t.kind===`new`?e.r():t.kind===`cmd`?t.run():e.s(t.ws))}}R(`j1`,ao),R(`j2`,oo),R(`j0`,so),R(`j3`,co);var lo=mr,uo=(e=>`/${e}&`)(hr);function fo(e){yr(e.a,`M21.8883 13.5C21.1645 18.3113 17.013 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C16.1006 2 19.6248 4.46819 21.1679 8 M17 8H21.4C21.7314 8 22 7.73137 22 7.4V3`)}var po=(e,t)=>_r(e.a,t),mo=(e,t)=>vr(e.a,t),ho=`<div class=add-repo><input placeholder="Add a repo…" aria-label="Add a repo"><!><!></div>`,go=`D b%b%l`,_o=null,vo=L(`l7`,e=>A(e.a,`click`,function(){e._._._._._.z(e._._._.i,e.d)})),yo=M(3,e=>V(e.b,e.d)),bo=(e,t)=>yo(e,t[0]),xo=I(33,e=>Pt(e,`a`,e._._._._._.y,vs(e)),e=>e._._._._._),So=L(`l6`,e=>Ft(e,`a`)),Co=e=>{xo(e),So(e)},wo=k(1,`<li><button class=result-row><span class="repo-name mono"> </span></button></li>`,`D E `,vo,bo),To=(e,t)=>{No(e,t?.length),wo(e,[t,e=>e])},Eo=N(5,e=>To(e,(e._._._._.y?e._._._._.w.filter(t=>t.toLowerCase().includes(e._._._._.y.toLowerCase())):e._._._._.w).slice(0,12))),Do=I(31,Eo,e=>e._._._._),Oo=e=>{Do(e),Ao(e),jo(e)},ko=O(0,`<input placeholder="Filter branches…" aria-label="Filter branches" autofocus>`,` `,Co),Ao=I(32,e=>ko(e,e._._._._.x>8?0:1),e=>e._._._._),jo=I(33,Eo,e=>e._._._._),Mo=O(2,`<li><p class="dim empty-note">No branches match.</p></li>`),No=(e,t)=>Mo(e,+!!t),Po=O(0,`<p class="dim empty-note"><span class=spin></span> Loading branches…</p>`,0,0,`<!><!><ul class=branch-list><!><!></ul>`,`b%bD%b%`,Oo),Fo=I(31,e=>Po(e,+!!e._._._.w),e=>e._._._),Io=Fo,Lo=N(11,e=>B(e.a,`hi`,e.k===e._._.p)),Ro=I(28,Lo,e=>e._._),zo=L(`l8`,e=>{A(e.a,`mouseenter`,function(){as(e._._,e.k)}),A(e.b,`click`,function(){e._._.z(e.i)}),A(e.e,`click`,function(){e._._.a0(e.i)})}),Bo=e=>{Ro(e),Uo(e),Mr(e.c),Nr(e.c,12),Pr(e.c,`result-plus`),zo(e)},Vo=O(5,`<div class=branch-pick></div>`,` `,Io),Ho=N(9,e=>{B(e.e,`on`,e._._.u===e.i),Vo(e,e._._.u===e.i?0:1)}),Uo=I(30,Ho,e=>e._._),Wo=M(10,Lo),Go=M(8,e=>{V(e.d,e.i),z(e.e,`title`,`Pick a base branch for ${e.i}`),z(e.e,`aria-label`,`Pick a base branch for ${e.i}`),Ho(e)}),Ko=k(0,(e=>`<li><div class=result-wrap><button class=result-row>${e}<span class=repo-name> </span></button><button class=result-branch>⎇</button></div><!></li>`)(Ar),(e=>`D D D/${e}&D m l%l`)(jr),Bo,(e,t)=>{Go(e,t[0]?.nameWithOwner),Wo(e,t[1])}),qo=P(2,0,e=>Ko(e,[e._.r,`nameWithOwner`])),Jo=qo,Yo=P(2,1,e=>V(e.a,e._.m)),Xo=Yo,Zo=M(17,e=>{bee(e,e.r?.length),qo(e)}),Qo=N(14,e=>Zo(e,e.l&&e.m?ur(e.m,e.l?.repos,t=>e.i.has(t)):[]),2),$o=O(1,`<p class="dim empty-note">Loading repos…</p>`),es=N(13,e=>$o(e,e.m&&!e.l?0:1)),ts=O(2,`<ul class=repo-results></ul>`,` `,Jo,`<p class="dim empty-note">No repos match "<!>".</p>`,`Db%`,Xo),ns=N(19,e=>ts(e,e.s?0:e.m&&e.l?1:2),2),rs=j(11,e=>{Qo(e),es(e),ns(e)}),is=j(12,e=>{Pt(e,`a`,e.m,ys(e)),Qo(e),es(e),ns(e),Yo(e)}),as=j(15,F(Ro)),os=M(26),ss=N(21,e=>os(e,bs(e))),hee=F(Uo),cs=j(20,e=>{ss(e),hee(e)}),gee=F(Fo,Do),ls=j(22,e=>{xee(e,e.w?.length),gee(e)}),us=j(24,F(jo,xo)),_ee=L(`l9`,e=>{Ft(e,`a`),A(e.a,`keydown`,function(t){t.key===`ArrowDown`?(t.preventDefault(),as(e,Math.min(e.p+1,e.r?.length-1))):t.key===`ArrowUp`?(t.preventDefault(),as(e,Math.max(e.p-1,0))):t.key===`Enter`?(t.preventDefault(),e.r[e.p]&&e.z(e.r[e.p].nameWithOwner)):t.key===`Escape`&&e.m&&(t.preventDefault(),is(e,``))})});function ds(e){rs(e,null),is(e,``),as(e,0),cs(e,null),ls(e,null),us(e,``),_ee(e)}var vee=L(`l10`,e=>Tt(e,{onMount:function(){_o&&rs(e,_o),e.q(!1)}})),yee=M(16,e=>{x(e,xs(e)),vee(e)}),fs=N(7,e=>yee(e,Ss(e))),ps=M(5,fs),ms=M(6,e=>{fs(e),ss(e)}),bee=M(18,ns),hs=M(8,Qo),xee=M(23,F(Ao)),See=M(25),gs=M(9,e=>See(e,Cs(e))),_s=(e,t)=>z(e.a,`disabled`,t);function vs(e){return t=>{us(e._._._._._,t)}}function ys(e){return function(t){is(e,t),as(e,0)}}function bs(e){return async t=>{if(e.u===t){cs(e,null);return}cs(e,t),ls(e,null),us(e,``);try{let n=await H(`/api/repos/branches?repo=${encodeURIComponent(t)}`);e.u===t&&ls(e,n.branches)}catch(t){cs(e,null),e.g?.(String(t.message||t))}}}function xs(e){return()=>e.q(!0)}function Ss(e){return async t=>{t&&e.f?.(!0);try{let n=await H(`/api/repos${t?`?refresh`:``}`);_o=n,rs(e,n)}catch(t){e.g?.(String(t.message||t))}t&&e.f?.(!1)}}function Cs(e){return(t,n)=>{is(e,``),cs(e,null),e.j(t,n)}}R(`l1`,vs),R(`l0`,ys),R(`l5`,bs),R(`l2`,xs),R(`l3`,Ss),R(`l4`,Cs);var ws=`<div class=manage-backdrop></div><div role=dialog><div class=manage><!></div><!></div>`,Ts=` b E%l%l`,Es=de(2),Ds=L(`h0`,e=>A(e.a,`click`,function(){e._.h?.()})),Os=ue(0),ks=P(3,0,e=>Os(e,e._.n)),As=ks,js=N(15,L(`h1`,e=>Tt(e,{dismissable:e.o,onMount:function(){let t=new AbortController;return window.addEventListener(`keydown`,t=>{t.key!==`Escape`||!this.dismissable||t.target instanceof Element&&t.target.closest(`.palette:not(.inline)`)||t.target instanceof HTMLInputElement&&t.target.value||e.h?.()},{capture:!0,signal:t.signal}),{abort:t}},onDestroy:function(){this.abort.abort()}}))),Ms=M(14,js),Ns=(e,t)=>Ms(e,t!==!1),Ps=L(`h2`,e=>A(e.a,`click`,function(){e.o&&e.h?.()})),Fs=(e,t)=>mt(e.b,[`manage-view`,t]),Is=(e,t)=>z(e.b,`aria-label`,t),Ls=O(3,`<div class=manage-bar><!></div>`,`D%`,As,`<div class=manage-bar><button class="btn primary">Done</button></div>`,`D `,Ds),Rs=N(12,e=>Ls(e,e.l?0:e.h?1:2)),zs=M(7,e=>{Rs(e),js(e)}),Bs=M(11,e=>{Vs(e,e.l?.content),Rs(e)}),Vs=M(13,ks),Hs=ws,Us=(e=>`/${e}&`)(Ts),Ws=new Map,Gs=M(3,e=>{z(e.a,`title`,`Open http://${typeof location>`u`?`localhost`:location.hostname}:${e.d}`),V(e.b,e.d)}),Ks=L(`g23`,e=>A(e.a,`click`,function(){window.open(`http://${location.hostname}:${e.d}`,`_blank`,`noopener`)})),qs=(e,t)=>Gs(e,t[0]),Js=(e,t)=>V(e.a,t),Ys=(e,t)=>Js(e,t[0]),Xs=P(2,0,e=>V(e.a,e._.j)),Zs=Xs,Qs=P(0,0,e=>V(e.a,e._.e)),$s=Qs,ec=(e,t)=>z(e.a,`title`,t),tc=(e,t)=>V(e.b,t),nc=k(2,`<button class="chip port-link">:<!></button>`,` Db%`,Ks,qs),rc=(e,t)=>nc(e,[t,e=>String(e)]),ic=M(9,e=>z(e.d,`title`,`Kill ${e.j}`)),ac=L(`g24`,e=>A(e.d,`click`,function(){e._._._.ag(e.j)})),oc=(e,t)=>{ec(e,t[0]?.args),tc(e,t[0]?.cmd),rc(e,t[0]?.ports),ic(e,t[0]?.pid)},sc=P(6,0,e=>z(e.a,`title`,`Confirm #${e._.p} is done — remove from this list`)),cc=L(`g19`,e=>A(e.a,`click`,function(){e._._._._._.a8(e._._.g,e._.p)})),lc=O(6,`<button class=pr-dismiss>✓</button>`,` `,e=>{sc._(e),cc(e)}),uc=N(11,e=>V(e.b,e.j===`OPEN`&&e.k?`draft`:e.j.toLowerCase())),dc=O(2,`<span class="pr-state open" title=Approved>✓</span>`,0,0,`<span class="pr-state closed" title="Changes requested">✗</span>`),fc=N(13,e=>dc(e,e.j===`OPEN`&&e.m===`APPROVED`?0:e.j===`OPEN`&&e.m===`CHANGES_REQUESTED`?1:2)),pc=M(9,e=>{mt(e.a,[`pr-state`,e.j.toLowerCase()]),lc(e,+(e.j===`OPEN`)),uc(e),fc(e)}),mc=M(10,uc),hc=M(12,fc),gc=(e,t)=>z(e.d,`href`,t),_c=M(15,e=>{V(e.e,e.p),sc(e)}),vc=(e,t)=>V(e.f,t),yc=(e,t)=>{pc(e,t[0]?.state),mc(e,t[0]?.isDraft),hc(e,t[0]?.reviewDecision),gc(e,t[0]?.url),_c(e,t[0]?.number),vc(e,t[0]?.title)},bc=P(0,0,e=>V(e.b,e._.e)),xc=L(`g18`,e=>A(e.a,`click`,function(){e._._._.a7()})),Sc=e=>{bc._(e),xc(e)},Cc=I(54,e=>V(e.a,e._._.s),e=>e._._),wc=Cc,Tc=N(2,e=>{B(e.a,`armed`,e._._._.r===e._.h),V(e.b,e._._._.r===e._.h?`remove?`:`×`)}),Ec=N(3,e=>z(e.a,`title`,e._._._.r===e._.h?`Really remove ${e._.g}/? Uncommitted changes are lost.`:`Remove ${e._.g}/`),2),Dc=I(53,e=>{Tc(e),Ec(e)},e=>e._._._),Oc=L(`g21`,e=>A(e.a,`click`,function(){e._._._.r===e._.f?.full_name?(hu(e._._._,null),e._._._.ae(e._.f)):(hu(e._._._,e._.f?.full_name),setTimeout(()=>{hu(e._._._,null)},4e3))})),kc=e=>{Dc(e),Ac._(e),jc._(e),Oc(e)},Ac=P(3,1,Ec),jc=P(3,1,e=>{Tc(e),Ec(e)}),Mc=I(51,e=>z(e.a,`disabled`,!!e._._.p),e=>e._._),Nc=L(`g15`,e=>A(e.a,`click`,function(){e._._.af(`restore`)})),Pc=e=>{Mc(e),Nc(e)},Fc=I(51,e=>{z(e.a,`disabled`,!!e._._.p),V(e.b,e._._.p===`archive`?`Archiving…`:`Archive`)},e=>e._._),Ic=L(`g14`,e=>A(e.a,`click`,function(){e._._.af(`archive`)})),Lc=e=>{Fc(e),Ic(e)},Rc=I(50,e=>V(e.a,e._._.o),e=>e._._),zc=L(`g17`,e=>A(e.b,`click`,function(){uu(e._._,null)})),Bc=e=>{Rc(e),zc(e)},Vc=O(3,`<span class=spin></span>`,0,0,`<button class=cur-remove> </button>`,` D `,kc),Hc=N(8,e=>Vc(e,+!e._._.m.has(e.h))),Uc=I(48,Hc,e=>e._._),Wc=Uc,Gc=M(6,e=>{V(e.a,e.g),Ac(e)}),Kc=M(7,e=>{V(e.b,e.h),Hc(e),jc(e)}),qc=O(2,`<span class="cur-base mono" title="Base branch">⎇ <!></span>`,`Db%`,Zs),Jc=N(11,e=>qc(e,+(e.j===e.k))),Yc=M(9,e=>{Jc(e),Xs(e)}),Xc=M(10,Jc),Zc=(e,t)=>Qc(e,t[0]),Qc=M(5,e=>{Gc(e,e.f?.worktree),Kc(e,e.f?.full_name),Yc(e,e.f?.base_branch),Xc(e,e.f?.default_branch)}),$c=O(0,`<div class="pr-repo-name mono dim"> </div>`,`D `,$s),el=I(46,e=>$c(e,e._._._.k>1?0:1),e=>e._._._),tl=el,nl=k(1,`<li><span> </span><!><a class=pr-link target=_blank rel=noopener><span class="dim mono">#<!></span> </a><span class=pr-spacer></span><!></li>`,`D D l%b Eb%l lb%`,0,yc),rl=(e,t)=>nl(e,[t,`number`]),il=(e,t)=>{al(e,t[0]?.worktree),rl(e,t[0]?.prs),ol(e,t[0]?.full_name)},al=M(4,Qs),ol=M(6),sl=O(0,`<button class=btn title="Confirm every merged/closed PR is done — remove them from this list">Clear <!> finished</button>`,` Db%`,Sc),cl=M(4,e=>{sl(e,+!e.e),bc(e)}),ll=k(3,`<div class=pr-repo><!><ul class=pr-list></ul></div>`,`D%b `,tl,il),ul=I(45,e=>{cl(e,(e._._.j||[]).reduce((e,t)=>e+t.prs.filter(e=>e.state!==`OPEN`).length,0)),ll(e,[e._._.j.filter(e=>e.prs.length),`full_name`])},e=>e._._),dl=L(`g20`,e=>A(e.b,`click`,function(){e._._.a6()})),fl=e=>{ul(e),pl(e),fo(e.c),po(e.c,13),mo(e.c),dl(e)},pl=I(47,e=>{B(e.b,`spinning`,e._._.l),z(e.b,`disabled`,e._._.l)},e=>e._._),ml=k(0,`<li><span class="mono proc-cmd"><!><!></span><button class=proc-kill>×</button></li>`,`D D%b%l `,ac,oc),hl=I(44,e=>ml(e,[e._._.i,`pid`]),e=>e._._),gl=hl,_l=Qe(12),vl=I(43,e=>{B(e.e,`spinning`,e._.h),z(e.e,`disabled`,e._.h)}),yl=L(`g25`,e=>A(e.e,`click`,function(){_l(e)()})),bl=e=>{vl(e),Sl(e),wl(e),Dl(e),Al(e),Ml(e),Pl(e),Fl(e),Ll(e),Rl(e),zl(e),Bl(e),Vl(e),fo(e.f),po(e.f,13),mo(e.f),Ye(e,9,Hl),ds(e.j),ms(e.j,Yu(e)),ps(e.j,Ju(e)),_s(e.j),yl(e)},xl=O(11,`<section><h3>Processes</h3><ul class=procs></ul></section>`,`Db `,gl),Sl=I(44,e=>xl(e,e._.i&&e._.i?.length?0:1)),Cl=O(3,(e=>`<section><div class=repos-head><h3>Pull requests</h3><!><button class=icon-btn title="Refresh PRs">${e}</button></div><!></section>`)(lo),(e=>`Eb%b D/${e}&m%l`)(uo),fl),wl=I(45,e=>Cl(e,e._.j&&e._.j.some(e=>e.prs.length)?0:1)),Tl=k(7,`<li class="cur-repo pending"><span class=spin></span><span class="dim cur-full"> </span></li>`,`DbD `,0,Ys),El=N(13,e=>Tl(e,[[...e._.m].filter(t=>!e._.a9.has(t)),e=>e])),Dl=I(48,El),Ol=O(8,`<li class="dim empty-note">No repos yet — search below to add one.</li>`),kl=N(14,e=>Ol(e,!e._.a1&&!e._.n?0:1)),Al=I(49,kl),jl=O(2,`<p class=toast-error><!> <button>×</button></p>`,`D%c `,Bc),Ml=I(50,e=>jl(e,+!e._.o)),Nl=k(6,`<li class=cur-repo><span class="mono cur-worktree"><!>/</span><span class="dim cur-full"> </span><!><!></li>`,`E%lD l%b%`,Wc,Zc),Pl=I(55,e=>Nl(e,[e._.w,`full_name`])),Fl=I(56,e=>V(e.a,e._.x)),Il=N(15,e=>V(e.b,e._.z||e._.a0)),Ll=I(58,Il),Rl=I(59,Il),zl=I(60,kl),Bl=I(61,e=>{hs(e.j,e._.a9),El(e)}),Vl=I(62,e=>gs(e.j,Xu(e))),Hl=rt(`g22`,M(12)),Ul=lt(`g27`,((e,t)=>`<header class=manage-head><div><h2> </h2><p class="dim mono"> </p></div></header><!><!><section><div class=repos-head><h3>Repos</h3><button class=icon-btn title="Refresh repo list">${e}</button></div><ul class=cur-repos><!><!><!></ul>${t}</section><!><!>`)(lo,ho),((e,t)=>`F lD n%b%bEb D/${e}&mD%b%b%l0${t}&l%c`)(uo,go),bl,0,`B2`),Wl=O(1,`<span class="act-step dim"><span class=spin></span> </span>`,`Db `,wc),Gl=N(6,e=>Wl(e,e._.p&&e._.s?0:1)),Kl=N(5,e=>V(e.e,e._.p===`delete`?`Deleting…`:e._.q?`Really delete?`:`Delete`)),ql=I(51,e=>{z(e.a,`disabled`,!!e._.p),z(e.d,`disabled`,!!e._.p),Gl(e),Kl(e)}),Jl=L(`g16`,e=>{A(e.a,`click`,function(){e._.g?.()}),A(e.d,`click`,function(){e._.q?(mu(e._,!1),e._.af(`delete`)):(mu(e._,!0),setTimeout(()=>{mu(e._,!1)},4e3))})}),Yl=e=>{ql(e),Xl(e),Zl(e),$l(e),Jl(e)},Xl=I(52,e=>{B(e.d,`armed`,e._.q),Kl(e)}),Zl=I(54,Gl),Ql=O(2,`<button class=btn> </button>`,` D `,Lc,`<button class=btn>Restore</button>`,` `,Pc),$l=I(57,e=>Ql(e,e._.y===`active`?0:1)),eu=ut(`g26`,`<button class="btn primary">Done</button><!><div class=spacer></div><!><button class="btn danger"> </button>`,` b%c%b D `,Yl),tu=j(7,F(vl)),nu=j(11,F(pl)),ru=M(39,F(Vl)),iu=N(38,e=>ru(e,Zu(e)),3),au=M(40),ou=N(37,e=>au(e,Qu(e)),3),su=M(36,e=>{iu(e),ou(e)}),cu=F(Dl,Uc),lu=j(12,e=>{Eu(e,e.m?.size),su(e,$u(e)),iu(e),ou(e),cu(e)}),uu=j(14,F(Ml,Rc)),du=N(31,L(`g28`,e=>Tt(e,{busyCount:e.n,pendingAction:e.p,onMount:function(){let t=new AbortController,n=t.signal;return Tn().addEventListener(`workspace.progress`,t=>{(this.pendingAction||this.busyCount)&&t.data?.message&&t.data.op===e.u&&gu(e,t.data.message)},{signal:n}),e.a2(n),e.a3(n,!1).then(()=>e.a3(n,!0)),{abort:t}},onDestroy:function(){this.abort.abort()}})),4),fu=F(ql,Fc,Mc),pu=j(15,e=>{du(e),fu(e)}),mu=j(16,F(Xl)),hu=j(17,F(Dc)),gu=j(18,F(Zl,Cc));function _u(e){Ps(e.a),Bs(e.a,tn({content:eu(e)})),Es(e.a,Ul(e)),Ns(e.a),Fs(e.a),tu(e,!1),nu(e,!1),lu(e,new Set),uu(e,null),pu(e,null),mu(e,!1),hu(e,null),gu(e,null)}var vu=j(8,F(Sl,hl)),yu=M(33),bu=N(30,e=>yu(e,ed(e)),2),xu=F(wl,ul),Su=j(9,e=>{wu(e,e.j?.length),bu(e),xu(e)}),Cu=(e,t)=>{vu(e,Ws.get(`procs:${t}`)||null),Su(e,Ws.get(`prs:${t}`)||null)},wu=M(10,F(el)),Tu=F(Al),Eu=M(13,e=>{du(e),Tu(e)}),Du=M(19,e=>{Fu(e,e.t?.id),Ru(e,e.t?.repos),Vu(e,e.t?.name),Hu(e,e.t?.status),Uu(e,e.t?.display_path),Wu(e,e.t?.path),ou(e)}),Ou=M(42),ku=M(28,e=>{Ou(e,td(e)),du(e)}),Au=M(32),ju=M(29,e=>{Au(e,rd(e)),du(e),bu(e)}),Mu=M(34),Nu=M(41),Pu=N(21,e=>Nu(e,od(e))),Fu=M(20,e=>{ku(e,nd(e)),ju(e,id(e)),Mu(e,ad(e)),du(e),bu(e),iu(e),Pu(e)}),Iu=M(35,F(Bl)),Lu=F(Pl),Ru=M(22,e=>{zu(e,e.w?.length),Iu(e,new Set(e.w.map(e=>e.full_name))),Lu(e)}),zu=M(27,F(zl)),Bu=F(Fl),Vu=M(23,e=>{Is(e.a,`Manage ${e.x}`),Bu(e)}),Hu=M(24,F($l)),Uu=M(25,F(Ll)),Wu=M(26,F(Rl)),Gu=(e,t)=>{Cu(e,t?.id),Du(e,t)},Ku=M(5,e=>{iu(e),ou(e)}),qu=M(6,e=>{zs(e.a,sd(e)),Pu(e)});function Ju(e){return function(t){tu(e._,t)}}function Yu(e){return function(t){uu(e._,t)}}function Xu(e){return function(t,n){e._.ad(t,n)}}function Zu(e){return async(t,n)=>{if(!(!t||e.m.has(t))){uu(e,null),e.aa(t,!0);try{let r=await H(`/api/workspaces/${e.u}/repos`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t,baseBranch:n})});e.f?.(r)}catch(t){uu(e,String(t.message||t))}e.aa(t,!1)}}}function Qu(e){return async t=>{if(!e.m.has(t.full_name)){uu(e,null),e.aa(t.full_name,!0);try{await H(`/api/workspaces/${e.t?.id}/repos/${encodeURIComponent(t.worktree)}`,{method:`DELETE`}),e.f?.({...e.t,repos:(e.t?.repos).filter(e=>e.full_name!==t.full_name)})}catch(t){uu(e,String(t.message||t))}e.aa(t.full_name,!1)}}}function $u(e){return(t,n)=>{let r=new Set(e.m);n?r.add(t):r.delete(t),lu(e,r)}}function ed(e){return async()=>{for(let t of e.j||[])for(let n of t.prs)n.state!==`OPEN`&&await H(`/api/workspaces/${e.u}/prs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t.full_name,number:n.number})}).catch(()=>{});await e.a3(void 0,!1)}}function td(e){return async t=>{await fetch(`/api/procs/${t}`,{method:`DELETE`}),setTimeout(()=>e.a2(void 0),500)}}function nd(e){return async t=>{try{let n=await H(`/api/workspaces/${e.u}/procs`,{signal:t});vu(e,n),Ws.set(`procs:${e.u}`,n)}catch{}}}function rd(e){return async()=>{nu(e,!0),await e.a3(void 0,!0),nu(e,!1)}}function id(e){return async(t,n)=>{try{let r=await H(`/api/workspaces/${e.u}/prs${n?`?refresh`:``}`,{signal:t});Su(e,r),Ws.set(`prs:${e.u}`,r)}catch{}}}function ad(e){return async(t,n)=>{uu(e,null);try{let r=await H(`/api/workspaces/${e.u}/prs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t,number:n})});Su(e,r),Ws.set(`prs:${e.u}`,r)}catch(t){uu(e,String(t.message||t))}}}function od(e){return async t=>{uu(e,null),pu(e,t),gu(e,null);try{await H(`/api/workspaces/${e.u}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:t})}),t===`delete`&&e.g?.()}catch(t){uu(e,String(t.message||t))}finally{pu(e,null),gu(e,null)}}}function sd(e){return function(){e.g?.()}}R(`g13`,Ju),R(`g12`,Yu),R(`g11`,Xu),R(`g6`,Zu),R(`g7`,Qu),R(`g5`,$u),R(`g3`,ed),R(`g9`,td),R(`g0`,nd),R(`g2`,rd),R(`g1`,id),R(`g4`,ad),R(`g8`,od),R(`g10`,sd);var cd=ws,ld=(e=>`/${e}&`)(Ts),ud=P(1,0,e=>V(e.a,e._.g)),dd=ud,fd=O(1,`<span class=spin></span>`,0,0,`<span class=step-done>✓</span>`),pd=I(30,e=>{B(e.a,`active`,e.M===e._._._.m-1),fd(e,e.M===e._._._.m-1?0:1)},e=>e._._._),md=pd,hd=(e,t)=>V(e.c,t),gd=k(0,`<li><!><!></li>`,` D%b%`,md,(e,t)=>hd(e,t[0])),_d=I(29,e=>gd(e,[e._._.l]),e=>e._._),vd=_d,yd=I(28,e=>V(e.a,e._._.k),e=>e._._),bd=L(`i10`,e=>A(e.b,`click`,function(){ff(e._._,null)})),xd=e=>{yd(e),bd(e)},Sd=I(27,e=>z(e.c,`disabled`,e._._.j),e=>e._._),Cd=L(`i11`,e=>A(e.c,`click`,function(){e._._.v(e.f)})),wd=e=>{Sd(e),Cd(e)},Td=M(5,e=>{V(e.a,e.f),z(e.c,`title`,`Remove ${e.f}`)}),Ed=O(1,`<span class="cur-base mono" title="Base branch">⎇ <!></span>`,`Db%`,dd),Dd=M(6,e=>{Ed(e,+!e.g),ud(e)}),Od=(e,t)=>{Td(e,t[0]?.fullName),Dd(e,t[0]?.baseBranch)},kd=Qe(9),Ad=I(23,e=>Pt(e,`b`,e._.f,Tf(e))),jd=L(`i13`,e=>{Ft(e,`b`),A(e.c,`click`,function(){kd(e)()})}),Md=e=>{Ad(e),Nd(e),Fd(e),Ld(e),Bd(e),Hd(e),Ud(e),Wd(e),fo(e.d),po(e.d,13),mo(e.d),Ye(e,6,Gd),ds(e.g),ms(e.g,Df(e)),ps(e.g,Ef(e)),jd(e)},Nd=I(24,e=>{B(e.c,`spinning`,e._.g),z(e.c,`disabled`,e._.g)}),Pd=k(4,`<li class=cur-repo><span class=cur-full> </span><!><button class=cur-remove>×</button></li>`,`E l%b `,wd,Od),Fd=I(25,e=>{hs(e.g,new Set(e._.h.map(e=>e.fullName))),Pd(e,[e._.h,`fullName`])}),Id=O(5,`<li class="dim empty-note">No repos yet — search below to add one (or create empty).</li>`),Ld=I(26,e=>Id(e,+!!e._.i)),Rd=O(8,`<ul class=steps></ul>`,` `,vd),zd=N(10,e=>Rd(e,e._.j&&e._.m?0:1)),Bd=I(27,e=>{z(e.b,`disabled`,e._.j),_s(e.g,e._.j),zd(e)}),Vd=O(0,`<p class=toast-error><!> <button>×</button></p>`,`D%c `,xd),Hd=I(28,e=>Vd(e,+!e._.k)),Ud=I(30,zd),Wd=I(31,e=>gs(e.g,Of(e))),Gd=rt(`i12`,M(9)),Kd=lt(`i15`,((e,t)=>`<header class=manage-head><div><h2>New workspace</h2></div></header><!><label class=field><span>Name</span><input placeholder=my-feature autofocus></label><section><div class=repos-head><h3>Repos</h3><button class=icon-btn title="Refresh repo list">${e}</button></div><ul class=cur-repos><!><!></ul>${t}</section><!><!>`)(lo,ho),((e,t)=>`b%bDb lEb D/${e}&mD%b%l0${t}&l%c`)(uo,go),Md,0,`B2`),qd=N(3,e=>z(e.a,`disabled`,e._.j||!e._.f.trim())),Jd=I(23,qd),Yd=L(`i9`,e=>{A(e.a,`click`,function(){e._.w()}),A(e.c,`click`,function(){e._.e?.()})}),Xd=e=>{Jd(e),Zd(e),Yd(e)},Zd=I(27,e=>{V(e.b,e._.j?`Creating…`:`Create workspace`),z(e.c,`disabled`,e._.j),qd(e)}),Qd=ut(`i14`,`<button class="btn primary"> </button><div class=spacer></div><button class=btn>Cancel</button>`,` D lb `,Xd),$d=M(22),ef=N(19,e=>$d(e,kf(e)),5),tf=F(Jd,Ad),nf=j(5,e=>{ef(e),tf(e)}),rf=j(6,F(Nd)),af=M(20,F(Wd)),of=M(21),sf=F(Fd),cf=j(7,e=>{yf(e,e.h?.length),af(e,Af(e)),of(e,jf(e)),ef(e),sf(e)}),lf=N(18,L(`i16`,e=>Tt(e,{busy:e.j,onMount:function(){let t=new AbortController;return Tn().addEventListener(`workspace.progress`,t=>{this.busy&&t.data?.message&&e.r([t.data])},{signal:t.signal}),{abort:t}},onDestroy:function(){this.abort.abort()}}))),uf=F(Zd,Bd,Sd),df=j(9,e=>{Ns(e.a,!e.j),lf(e),uf(e)}),ff=j(10,F(Hd,yd)),pf=M(17,e=>{lf(e),ef(e)}),mf=N(16,e=>pf(e,Mf(e)),2),hf=F(_d),gf=j(11,e=>{bf(e,e.l?.length),mf(e),hf(e)}),_f=(e,t)=>{xf(e,t.op),Sf(e,t.last)};function vf(e){Ps(e.a),Bs(e.a,tn({content:Qd(e)})),Es(e.a,Kd(e)),Is(e.a,`New workspace`),Fs(e.a,`new-ws`),nf(e,``),rf(e,!1),cf(e,[]),df(e,!1),ff(e,null),gf(e,[]),_f(e,{last:0,op:``})}var yf=M(8,F(Ld)),bf=M(12,F(Ud,pd)),xf=M(14,e=>{mf(e),ef(e)}),Sf=M(15,e=>{mf(e),ef(e)}),Cf=M(3,ef),wf=M(4,e=>zs(e.a,Nf(e)));function Tf(e){return t=>{nf(e._,t)}}function Ef(e){return function(t){rf(e._,t)}}function Df(e){return function(t){ff(e._,t)}}function Of(e){return function(t,n){e._.u(t,n)}}function kf(e){return async()=>{df(e,!0),ff(e,null),gf(e,[]),e.o=Math.random().toString(36).slice(2,10);try{e.p=(await H(`/api/progress`)).seq}catch{}let t=setInterval(async()=>{try{let t=await H(`/api/progress?since=${e.p}&op=${e.o}`);e.r(t.messages)}catch{}},800);try{let t=await H(`/api/workspaces`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:e.f,repos:e.h,opId:e.o})});df(e,!1),e.d?.(t)}catch(t){df(e,!1),ff(e,String(t.message||t))}finally{clearInterval(t)}}}function Af(e){return(t,n)=>{!t||e.h.some(e=>e.fullName===t)||cf(e,e.h.concat({fullName:t,baseBranch:n}))}}function jf(e){return t=>{cf(e,e.h.filter(e=>e.fullName!==t))}}function Mf(e){return t=>{for(let n of t)n.op===e.o&&(n.seq&&n.seq<=e.p||(n.seq&&(e.p=n.seq),gf(e,e.l.concat(n.message))))}}function Nf(e){return function(){e.e?.()}}R(`i0`,Tf),R(`i8`,Ef),R(`i7`,Df),R(`i6`,Of),R(`i4`,kf),R(`i2`,Af),R(`i3`,jf),R(`i1`,Mf),R(`i5`,Nf);var Pf=mr,Ff=(e=>`/${e}&`)(hr);function If(e){yr(e.a,`M14.3632 5.65156L15.8431 4.17157C16.6242 3.39052 17.8905 3.39052 18.6716 4.17157L20.0858 5.58579C20.8668 6.36683 20.8668 7.63316 20.0858 8.41421L18.6058 9.8942M14.3632 5.65156L4.74749 15.2672C4.41542 15.5993 4.21079 16.0376 4.16947 16.5054L3.92738 19.2459C3.87261 19.8659 4.39148 20.3848 5.0115 20.33L7.75191 20.0879C8.21972 20.0466 8.65806 19.8419 8.99013 19.5099L18.6058 9.8942M14.3632 5.65156L18.6058 9.8942`)}var Lf=(e,t)=>_r(e.a,t),Rf=(e,t)=>vr(e.a,t),zf=`<!><!><!>`,Bf=N(9,e=>B(e.d,`armed`,e._._._._.w===e.i)),Vf=N(10,e=>z(e.d,`title`,e._._._._.w===e.i?`Really kill ${e.g}?`:`Kill ${e.g} (pid ${e.i})`),2),Hf=I(39,e=>{Bf(e),Vf(e)},e=>e._._._._),Uf=L(`m8`,e=>{A(e.b,`click`,function(){window.open(`http://${location.hostname}:${e.h}`,`_blank`,`noopener`)}),A(e.d,`click`,function(){e._._._._.w===e.i?(Sm(e._._._._,null),fetch(`/api/procs/${e.i}`,{method:`DELETE`}).catch(()=>{})):e._._._._.z(()=>{Sm(e._._._._,e.i)})})}),Wf=e=>{Hf(e),Uf(e)},Gf=M(6,e=>{z(e.a,`title`,e.g),Vf(e)}),Kf=M(7,e=>{z(e.b,`title`,`Open http://${typeof location>`u`?`localhost`:location.hostname}:${e.h}`),V(e.c,e.h)}),qf=M(8,e=>{Bf(e),Vf(e)}),Jf=(e,t)=>{Gf(e,t[0]?.cmd),Kf(e,t[0]?.port),qf(e,t[0]?.pid)},Yf=N(12,e=>V(e.b,e._._.c(e._.c))),Xf=I(3,Yf,e=>e._._),Zf=L(`m7`,e=>A(e.a,`click`,function(){e._._._._._.u?.(e._.e,e.l)})),Qf=e=>{Xf(e),$f._(e),tp._(e),Zf(e)},$f=We(0,Yf),ep=N(10,e=>z(e.a,`title`,`${e._.e} — ${e.j}${e.h===`APPROVED`?` (approved)`:e.h===`CHANGES_REQUESTED`?` (changes requested)`:``}`),2),tp=We(0,ep),np=N(8,e=>ht(e.a,{draft:e.g,rejected:e.h===`CHANGES_REQUESTED`})),rp=M(6,np),ip=M(7,e=>{V(e.d,e.h===`APPROVED`?` ✓`:e.h===`CHANGES_REQUESTED`?` ✗`:``),np(e),ep(e)}),ap=M(9,ep),op=M(11,e=>V(e.c,e.l)),sp=k(0,`<button class="chip pr"><!>#<!><!></button>`,` D%c%b%`,Qf,(e,t)=>{rp(e,t[0]?.isDraft),ip(e,t[0]?.reviewDecision),ap(e,t[0]?.title),op(e,t[0]?.number)}),cp=(e,t)=>sp(e,[t||[],`number`]),lp=(e,t)=>up(e,t[0]),up=M(2,e=>{cp(e,e.c?.prs),dp(e,e.c?.worktree),$f(e)}),dp=M(4,tp),fp=M(2,F(Xf)),pp=k(0,`<!><!><!>`,`b%`,0,lp),mp=I(6,e=>{fp(e,Jm(e)),pp(e,[e._._.c||[],`full_name`])},e=>e._._),hp=e=>{mp(e),_p(e)},gp=k(1,`<span class="chip port-chip"><button class=port-open>:<!></button><button class=port-kill>×</button></span>`,` D Db%l `,Wf,Jf),_p=I(7,e=>gp(e,[e._._.d||[],`port`]),e=>e._._),vp=N(11,e=>B(e.a,`current`,e.k===e._._._.q)),yp=I(37,vp,e=>e._._._),bp=L(`m6`,e=>{A(e.b,`click`,function(){e._._._.r?.(e.k)}),A(e.f,`click`,function(){e._._._.s?.(e.j)}),A(e.h,`click`,function(){e._._._.v===e.k?(xm(e._._._,null),e._._._.t?.(e.k)):e._._._.z(()=>{xm(e._._._,e.k)})})}),xp=e=>{yp(e),Cp(e),e.d,Gr(e.d,13),Jr(e.d,`sess-icon`),If(e.g),Lf(e.g,12),Rf(e.g),bp(e)},Sp=N(12,e=>{B(e.h,`armed`,e._._._.v===e.k),z(e.h,`title`,e._._._.v===e.k?`Really kill this session?`:`Kill session`)}),Cp=I(38,Sp,e=>e._._._),wp=M(10,e=>{vp(e),Sp(e)}),Tp=(e,t)=>mt(e.c,[`dot`,pr(t)]),Ep=N(16,e=>V(e.e,e.p||e.o)),Dp=M(14,e=>{qr(e.d,e.o),Ep(e)}),Op=M(15,Ep),kp=(e,t)=>Ap(e,t[0]),Ap=M(9,e=>{wp(e,e.j?.id),Tp(e,e.j?.state),Dp(e,e.j?.agent),Op(e,e.j?.title)}),jp=L(`m4`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._._.n?.(e.e)})),Mp=e=>{e.b,Gr(e.b,14),Jr(e.b),jp(e)},Np=M(4,e=>{qr(e.b,e.e),V(e.c,e.e)}),Pp=k(2,(e=>`<button>${e}<!></button>`)(Fr),(e=>` D/${e}&%l`)(`b%c`),Mp,(e,t)=>Np(e,t[0])),Fp=I(35,e=>Pp(e,[[...e._._._.o||[],`shell`],e=>e]),e=>e._._._),Ip=(e,t)=>{z(e.a,`popovertarget`,t),z(e.c,`id`,t)},Lp=L(`m5`,e=>A(e.c,`toggle`,function(t,n){if(t.newState===`open`){let t=e.a.getBoundingClientRect();n.style.top=`${t.bottom+4}px`,n.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-n.offsetWidth-8))}px`}})),Rp=e=>{Fp(e),e.b,qr(e.b,`shell`),Gr(e.b,12),Jr(e.b),Ip(e,Xe(e)),Lp(e)},zp=L(`m3`,e=>A(e.a,`click`,function(){e._._._.l?.()})),Bp=e=>{Sr(e.b),Cr(e.b,12),wr(e.b),zp(e)},Vp=I(31,e=>B(e.a,`current`,e._._.i),e=>e._._),Hp=L(`m9`,e=>{A(e.b,`click`,function(){e._._.j()}),A(e.f,`click`,function(){e._._.m?.()})}),Up=e=>{Vp(e),Gp(e),qp(e),Xp(e),Zp(e),em._(e),tm._(e),nm._(e),Dr(e.g),Or(e.g,12),kr(e.g),Hp(e)},Wp=O(4,(e=>`<button class="row-icon new-sess" title="Review changes">${e}</button>`)(br),(e=>` D/${e}&l`)(xr),Bp),Gp=I(33,e=>Wp(e,+!e._._.l),e=>e._._),Kp=O(7,(e=>`<button class="row-icon new-sess" title="New session">${e}</button><div popover=auto class=new-session-pop></div>`)(Fr),(e=>` D/${e}&l b`)(`b%c`),Rp),qp=I(34,e=>Kp(e,+!e._._.n),e=>e._._),Jp=k(8,((e,t)=>`<div class=side-sess><button class=side-sess-btn><span></span>${e}<!></button><button class=row-icon title="Rename session">${t}</button><button class=close>×</button></div>`)(Fr,Pf),((e,t)=>` D D b/${e}&%l D/${t}&l l`)(`b%c`,Ff),xp,kp),Yp=(e,t)=>Jp(e,[t.length>1?t:[],`id`]),Xp=I(36,e=>Yp(e,e._._.p||[]),e=>e._._),Zp=I(40,e=>V(e.d,e._._.a1),e=>e._._),Qp=O(9,`<div class=side-chips><!><!></div>`,`D%b%`,hp),$p=N(11,e=>Qp(e,(e._.c||[]).some(e=>(e.prs||[]).length)||(e._.d||[]).length?0:1)),em=P(0,1,$p),tm=P(0,1,$p),nm=P(0,1,e=>mt(e.c,[`dot`,e._.e])),rm=I(31,e=>B(e.a,`current`,e._._.i),e=>e._._),im=L(`m2`,e=>A(e.a,`click`,function(){e._._.j()})),am=e=>{rm(e),om(e),sm(e),cm._(e),im(e)},om=I(32,e=>V(e.b,(e._._.k??0)+1),e=>e._._),sm=I(40,e=>z(e.a,`title`,e._._.a1),e=>e._._),cm=P(0,0,e=>mt(e.c,[`dot`,e._.e])),lm=M(4,e=>{cm(e),nm(e)}),um=(e,t)=>{vm(e,t?.repos),bm(e,t?.ports),lm(e,fr(t))},dm=N(5,e=>um(e,e._.g[e._.e])),fm=P(0,0,dm),pm=e=>{fm._(e),mm._(e),gm._(e)},mm=P(0,0,dm),hm=O(0,`<button class="icon-btn rail-btn"> <span></span></button>`,` D b `,am,(e=>`<section class=side-ws><div class=side-ws-row><button class=side-ws-btn><span></span><span class=side-ws-name> </span></button><!><button class=row-icon title="Manage workspace">${e}</button><!></div><div class=side-sessions><!><!></div></section>`)(Tr),(e=>` E D bD m%b D/${e}&l%lD%b%m`)(Er),Up),gm=P(0,0,e=>hm(e,+!e._.h)),_m=F(mp),vm=M(2,e=>{em(e),_m(e)}),ym=F(_p),bm=M(3,e=>{tm(e),ym(e)}),xm=j(21,F(Cp)),Sm=j(22,F(Hf)),Cm=(e,t)=>Em(e,t.timer);function wm(e){xm(e,null),Sm(e,null),Cm(e,{timer:0})}var Tm=M(25),Em=M(24,e=>Tm(e,Ym(e))),Dm=O(0,`<!><!><!>`,`b%`,pm),Om=(e,t)=>{km(e,t?.name),Dm(e,+!t)},km=M(27,F(sm,Zp)),Am=N(5,e=>Om(e,e.d.find(t=>t.id===e.e))),jm=M(3,Am),Mm=M(4,e=>{Am(e),fm(e)}),Nm=M(6,mm),Pm=M(7,gm),Fm=M(8,F(rm,Vp)),Im=M(9),Lm=M(10,F(om)),Rm=M(11,F(Gp)),zm=M(12),Bm=M(13,F(qp)),Vm=M(14,F(Fp)),Hm=M(15,F(Xp)),Um=M(16,F(yp)),Wm=M(17),Gm=M(18),Km=M(19),qm=M(20);function Jm(e){return t=>{let n=e._._.c||[];if(n.length<2)return``;let r=t.full_name.split(`/`)[1];return n.some(e=>e.full_name!==t.full_name&&e.full_name.split(`/`)[1]===r)?t.full_name:r}}function Ym(e){return t=>{clearTimeout(e.y),t(),e.y=setTimeout(()=>{xm(e,null),Sm(e,null)},3500)}}R(`m1`,Jm),R(`m0`,Ym);var Cee=mr,wee=(e=>`/${e}&`)(hr);function Tee(e){yr(e.a,`M19 21L5 21C3.89543 21 3 20.1046 3 19L3 5C3 3.89543 3.89543 3 5 3L19 3C20.1046 3 21 3.89543 21 5L21 19C21 20.1046 20.1046 21 19 21Z M7.25 10L5.5 12L7.25 14 M9.5 21V3`)}var Eee=(e,t)=>_r(e.a,t),Dee=(e,t)=>vr(e.a,t),Xm=mr,Zm=(e=>`/${e}&`)(hr);function Qm(e){yr(e.a,`M19 21L5 21C3.89543 21 3 20.1046 3 19L3 5C3 3.89543 3.89543 3 5 3L19 3C20.1046 3 21 3.89543 21 5L21 19C21 20.1046 20.1046 21 19 21Z M9.5 21V3 M5.5 10L7.25 12L5.5 14`)}var $m=(e,t)=>_r(e.a,t),eh=(e,t)=>vr(e.a,t),Oee=mr,kee=(e=>`/${e}&`)(hr);function Aee(e){yr(e.a,`M18 8.4C18 6.70261 17.3679 5.07475 16.2426 3.87452C15.1174 2.67428 13.5913 2 12 2C10.4087 2 8.88258 2.67428 7.75736 3.87452C6.63214 5.07475 6 6.70261 6 8.4C6 15.8667 3 18 3 18H21C21 18 18 15.8667 18 8.4Z M13.73 21C13.5542 21.3031 13.3019 21.5547 12.9982 21.7295C12.6946 21.9044 12.3504 21.9965 12 21.9965C11.6496 21.9965 11.3054 21.9044 11.0018 21.7295C10.6982 21.5547 10.4458 21.3031 10.27 21`)}var jee=(e,t)=>_r(e.a,t),Mee=(e,t)=>vr(e.a,t),Nee=mr,Pee=(e=>`/${e}&`)(hr);function Fee(e){yr(e.a,`M3 12H6L9 3L15 21L18 12H21`)}var Iee=(e,t)=>_r(e.a,t),Lee=(e,t)=>vr(e.a,t),Ree=mr,zee=(e=>`/${e}&`)(hr);function Bee(e){yr(e.a,`M18 6H20M22 6H20M20 6V4M20 6V8 M21.4 20H2.6C2.26863 20 2 19.7314 2 19.4V11H21.4C21.7314 11 22 11.2686 22 11.6V19.4C22 19.7314 21.7314 20 21.4 20Z M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H14`)}var Vee=(e,t)=>_r(e.a,t),Hee=(e,t)=>vr(e.a,t),Uee=((e,t)=>`<!><!><aside class=side-nav><div class=side-list></div><!><div class=side-foot><button class="icon-btn nav-toggle"></button><div class=spacer></div><!><button class=icon-btn title=Usage>${e}</button><button class=icon-btn title="New workspace">${t}</button></div></aside>`)(Nee,Ree),Wee=((e,t)=>`b%b D b%bD c%b D/${e}&l D/${t}&n`)(Pee,zee),Gee=e=>{Qm(e.a),$m(e.a,15),eh(e.a)},Kee=e=>{Tee(e.a),Eee(e.a,15),Dee(e.a)},th=P(5,0,e=>{B(e.a,`on`,e._.an),z(e.a,`title`,e._.an?`Disable agent-waiting notifications`:`Notify when an agent is waiting`)}),qee=L(`n19`,e=>A(e.a,`click`,function(){e._.ap()})),Jee=e=>{th._(e),Aee(e.b),jee(e.b,15),Mee(e.b),qee(e)},Yee=L(`n16`,e=>A(e.a,`click`,function(){Pg(e._,!1)})),nh=N(7,e=>Rm(e.b,__(e)),4),rh=I(56,nh,e=>e._._),ih=L(`n18`,e=>{A(e.a,`mouseenter`,function(){e._.i()}),A(e.a,`mouseleave`,function(){e._.j()})}),ah=e=>{rh(e),oh(e),ch(e),lh(e),dh(e),fh(e),ph(e),gh(e),_h(e),vh(e),yh(e),bh(e),Sh._(e),wh._(e),Th._(e),wm(e.b),zm(e.b,v_(e)),Pm(e.b),Lm(e.b),ih(e)},oh=I(57,e=>Vm(e.b,e._._.a2),e=>e._._),sh=N(3,e=>Bm(e.b,y_(e))),ch=I(58,sh,e=>e._._),lh=I(59,nh,e=>e._._),uh=N(5,e=>Hm(e.b,e.c===e._._.ad&&e._._.a5?e._._.a5:e._._.as[e.c]?.sessions||[]),3),dh=I(60,uh,e=>e._._),fh=I(61,e=>Gm(e.b,e._._.a7),e=>e._._),ph=I(62,e=>Km(e.b,e._._.a8),e=>e._._),mh=N(4,e=>Fm(e.b,e.c===e._._.ad)),hh=N(6,e=>Um(e.b,e.c===e._._.ad&&e._._.ah===`term`?e._._.af:null),3),gh=I(63,e=>{Im(e.b,S_(e)),qm(e.b,x_(e)),Wm(e.b,b_(e)),mh(e),nh(e),uh(e),hh(e)},e=>e._._),_h=I(64,hh,e=>e._._),vh=I(65,e=>{nh(e),hh(e)},e=>e._._),yh=I(68,e=>jm(e.b,e._._.ar),e=>e._._),bh=I(69,e=>{Nm(e.b,e._._.as),uh(e)},e=>e._._),xh=M(2,e=>{Mm(e.b,e.c),mh(e),sh(e),nh(e),uh(e),hh(e)}),Sh=P(1,0,e=>xh(e,e._.d)),Ch=N(8,e=>gt(e.a,`top:${e._.e}px;left:${e._.f}px`)),wh=P(1,0,Ch),Th=P(1,0,Ch),Eh=N(4,e=>Fm(e.b,e.d===e._._.ad)),Dh=I(63,e=>{Im(e.b,C_(e)),Eh(e)},e=>e._._),Oh=L(`n17`,e=>{A(e.a,`mouseenter`,function(t,n){e._.i();let r=n.getBoundingClientRect();Lh(e._,{id:e.d,top:r.top,left:r.right+8})}),A(e.a,`mouseleave`,function(){e._.j()})}),kh=e=>{Dh(e),Ah(e),jh(e),wm(e.b),Pm(e.b,!0),Rm(e.b),zm(e.b),Bm(e.b),Vm(e.b),Hm(e.b),Um(e.b),Wm(e.b),Gm(e.b),Km(e.b),qm(e.b),Oh(e)},Ah=I(68,e=>jm(e.b,e._._.ar),e=>e._._),jh=I(69,e=>Nm(e.b,e._._.as),e=>e._._),Mh=(e,t)=>Lm(e.b,t),Nh=M(3,e=>{Mm(e.b,e.d),Eh(e)}),Ph=k(0,(e=>`<span>${e}</span>`)(zf),(e=>` D/${e}&l`)(`b%c`),kh,(e,t)=>{Nh(e,t[0]),Mh(e,t[1])}),Fh=P(3,0,e=>Ph(e,[e._.aq,e=>e])),Ih=O(1,(e=>`<div class=rail-pop>${e}</div>`)(zf),(e=>` D/${e}&l`)(`b%c`),ah),Lh=j(2,e=>{Bh(e,e.c?.id),Vh(e,e.c?.top),Hh(e,e.c?.left),Ih(e,+!e.c)}),Rh=(e,t)=>Gh(e,t.timer),zh=e=>{Fh._(e),Lh(e,null),Rh(e,{timer:0})},Bh=M(3,Sh),Vh=M(4,wh),Hh=M(5,Th),Uh=M(8),Wh=M(9),Gh=M(7,e=>{Uh(e,w_(e)),Wh(e,T_(e))}),Kh=N(7,e=>Rm(e.a,E_(e)),4),qh=We(2,Kh),Jh=e=>{qh._(e),Yh._(e),Zh._(e),Qh._(e),eg._(e),tg._(e),ng._(e),ig._(e),ag._(e),og._(e),sg._(e),cg._(e),wm(e.a),zm(e.a,D_(e)),Pm(e.a),Lm(e.a)},Yh=We(2,e=>Vm(e.a,e._.a2)),Xh=N(3,e=>Bm(e.a,O_(e))),Zh=We(2,Xh),Qh=We(2,Kh),$h=N(5,e=>Hm(e.a,e.c===e._.ad&&e._.a5?e._.a5:e._.as[e.c]?.sessions||[]),3),eg=We(2,$h),tg=We(2,e=>Gm(e.a,e._.a7)),ng=We(2,e=>Km(e.a,e._.a8)),rg=N(6,e=>Um(e.a,e.c===e._.ad&&e._.ah===`term`?e._.af:null),3),ig=Ge(2,39,2,e=>{Fm(e.a,e.c===e._.ad),Im(e.a,j_(e)),qm(e.a,A_(e)),Wm(e.a,k_(e)),Kh(e),$h(e),rg(e)}),ag=We(2,rg),og=We(2,e=>{Kh(e),rg(e)}),sg=We(2,e=>jm(e.a,e._.ar)),cg=We(2,e=>{Nm(e.a,e._.as),$h(e)}),lg=M(2,e=>{Mm(e.a,e.c),Xh(e),Kh(e),$h(e),rg(e)}),ug=(e,t)=>lg(e,t[0]),dg=F(Ah,yh),fg=M(53,e=>{sg(e),dg(e)}),pg=N(38,e=>fg(e,e.y||[e.ab])),mg=M(37,e=>{bg(e,e.ab?.id),pg(e)}),hg=k(2,(e=>`<!>${e}<!>`)(zf),(e=>`b/${e}&b`)(`b%c`),Jh,ug),gg=M(52,e=>{hg(e,[e.aq,e=>e]),Fh(e)}),_g=N(40,e=>gg(e,e.y?.length?e.y.filter(e=>e.status===`active`).map(e=>e.id):[e.ad])),vg=N(55,e=>e.as[e.ad]),yg=F(Dh,gh),bg=M(39,e=>{_g(e),vg(e),ig(e),yg(e)}),xg=mg,Sg=F(_h),Cg=Ue(41,e=>{ag(e),Sg(e)}),wg=N(15,e=>Cg(e,e.n,e.o)),Tg=M(13,wg),Eg=M(14,wg),Dg=F(vh),Og=Ue(43,e=>{z(e.b,`hidden`,e.ah===`diff`),og(e),Dg(e)}),kg=N(18,e=>Og(e,e.q,e.r)),Ag=M(16,kg),jg=M(17,kg),Mg=O(0,`<div class=drawer-backdrop></div>`,` `,Yee),Ng=N(48,e=>ht(e.b,{closed:!e.al,open:e.aj})),Pg=Ue(45,e=>{Mg(e,+!e.aj),Ng(e)}),Fg=N(21,e=>Pg(e,e.t,e.u)),Ig=M(19,Fg),Lg=M(20,Fg),Rg=O(3,`<div class=side-rail></div><!><!>`,` b%`,zh),zg=O(4,Cee,(e=>`/${e}&`)(wee),Kee,Xm,(e=>`/${e}&`)(Zm),Gee),Bg=j(47,e=>{z(e.e,`title`,e.al?`Collapse sidebar`:`Expand sidebar`),Rg(e,+!!e.al),zg(e,+!e.al),Ng(e)}),Vg=M(51),Hg=N(50,e=>Vg(e,M_(e))),Ug=j(49,e=>{Hg(e),th(e)}),Wg=O(5,(e=>`<button class="icon-btn notify-btn">${e}</button>`)(Oee),(e=>` D/${e}&l`)(kee),Jee),Gg=L(`n21`,e=>{Tt(e,{onMount:function(){Qn()&&$n().then(t=>{Ug(e,!!t)})}}),A(e.e,`click`,function(){Bg(e,!e.al),Gn(e.al)}),A(e.g,`click`,function(){Pg(e,!1),e.a9?.()}),A(e.i,`click`,function(){Pg(e,!1),e.aa?.()})});function Kg(e){Fee(e.h),Iee(e.h,15),Lee(e.h),Bee(e.j),Vee(e.j,16),Hee(e.j),Bg(e,Wn()),Ug(e,!1),Wg(e,+!Qn()),Gg(e)}var qg=M(22,Hg),Jg=M(23,L(`n20`,e=>{e.x&&Bg(e,Wn())})),Yg=M(24,e=>{_g(e),pg(e)}),Xg=F(jh,bh),Zg=M(54,e=>{vg(e),cg(e),Xg(e)}),Qg=(e,t)=>Zg(e,t||{}),$g=F(rh),e_=M(26,e=>{qh(e),$g(e)}),t_=M(27),n_=F(oh),r_=M(28,e=>{Yh(e),n_(e)}),i_=F(ch),a_=M(29,e=>{Zh(e),i_(e)}),o_=F(lh),s_=M(30,e=>{Qh(e),o_(e)}),c_=F(dh),l_=M(31,e=>{eg(e),c_(e)}),u_=M(32),d_=F(fh),f_=M(33,e=>{tg(e),d_(e)}),p_=F(ph),m_=M(34,e=>{ng(e),p_(e)}),h_=M(35),g_=M(36);function __(e){return function(){Lh(e._,null),e.c===e._._.ad?(Og(e._._,e._._.ah===`diff`?`term`:`diff`),e._._.ah===`diff`&&e._._.a4?.()):(An(e.c),e._._.a0?.(e.c))}}function v_(e){return function(){Lh(e._,null),e._._.a1?.(e.c)}}function y_(e){return function(t){Lh(e._,null),e._._.a3(e.c,t)}}function b_(e){return function(t){Lh(e._,null),e.c===e._._.ad?(Cg(e._._,t),Og(e._._,`term`)):e._._.a6?.(e.c,t)}}function x_(e){return function(t,n){Lh(e._,null);let r=`${t}/${n}`;e.c===e._._.ad?(Og(e._._,`diff`),e._._.a4?.(r)):(An(e.c,r),e._._.a0?.(e.c))}}function S_(e){return function(){Lh(e._,null),e.c!==e._._.ad&&e._._.a0?.(e.c)}}function C_(e){return function(){e.d!==e._._.ad&&e._._.a0?.(e.d)}}function w_(e){return()=>clearTimeout(e.h)}function T_(e){return()=>{clearTimeout(e.h),e.h=setTimeout(()=>{Lh(e,null)},150)}}function E_(e){return function(){Pg(e._,!1),e.c===e._.ad?(Og(e._,e._.ah===`diff`?`term`:`diff`),e._.ah===`diff`&&e._.a4?.()):(An(e.c),e._.a0?.(e.c))}}function D_(e){return function(){Pg(e._,!1),e._.a1?.(e.c)}}function O_(e){return function(t){Pg(e._,!1),e._.a3(e.c,t)}}function k_(e){return function(t){Pg(e._,!1),e.c===e._.ad?(Cg(e._,t),Og(e._,`term`)):e._.a6?.(e.c,t)}}function A_(e){return function(t,n){Pg(e._,!1);let r=`${t}/${n}`;e.c===e._.ad?(Og(e._,`diff`),e._.a4?.(r)):(An(e.c,r),e._.a0?.(e.c))}}function j_(e){return function(){e.c!==e._.ad&&(Pg(e._,!1),e._.a0?.(e.c))}}function M_(e){return async()=>{try{e.an?(await tr(),Ug(e,!1)):(Ug(e,await er()),e.an||e.w?.(`Notifications blocked — allow them for this site in browser/system settings.`))}catch(t){Ug(e,!1),e.w?.(`Notifications failed: ${String(t.message||t)}`)}}}R(`n13`,__),R(`n11`,v_),R(`n12`,y_),R(`n15`,b_),R(`n14`,x_),R(`n10`,S_),R(`n9`,C_),R(`n7`,w_),R(`n8`,T_),R(`n4`,E_),R(`n2`,D_),R(`n3`,O_),R(`n6`,k_),R(`n5`,A_),R(`n1`,j_),R(`n0`,M_);async function N_(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;top:-100px;opacity:0;`,document.body.append(t),t.focus(),t.select();let n=document.execCommand(`copy`);return t.remove(),n}}var P_=null;function F_(){return P_}function I_(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(L_(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function L_(e){if(!/[*?]/.test(e))return t=>dr(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=>dr(e,t)}}var R_=3;function z_(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(B_(e,n));for(let e of a){i++;let t=n?.files.find(t=>t.path===e.path),a=e.side===`deletions`?t?.old:t?.new,o=e.side===`deletions`?`Old`:`New`,s=e.line_start===e.line_end?`line ${e.line_start}`:`lines ${e.line_start}-${e.line_end}`;if(r.push(``),r.push(`${i}. **${e.path}** (${o} ${s})`),a!=null){let t=H_(a,e.line_start,e.line_end,e.side),n=U_(t);r.push(``),r.push(W_(`${n}diff\n${t}\n${n}`))}r.push(``),r.push(W_(e.text))}}return r.join(`
4
- `)}function B_(e,t){if(!t?.head)return`${e}/`;let n=V_(t.head),r=V_(t.baseSha),i=t.pr?.headRefName||t.branch||`HEAD`;return`${e}/${t.pr?` #${t.pr.number}`:``} — \`${i}\` ${n} vs \`${t.base}\` ${r}`}function V_(e,t=12){return e.slice(0,t)}function H_(e,t,n,r){let i=e.split(`
5
- `),a=Math.max(1,t-R_),o=Math.min(i.length,n+R_),s=r===`deletions`?`-`:`+`,c=[];for(let e=a;e<=o;e++){let r=e>=t&&e<=n?s:` `;c.push(`${r}${String(e).padStart(4)} | ${i[e-1]??``}`)}return c.join(`
6
- `)}function U_(e){let t=3,n=/`+/g,r;for(;r=n.exec(e);)t=Math.max(t,r[0].length+1);return"`".repeat(t)}function W_(e){return e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_Brh7taK_.js","assets/_RHQKbTNw.js","assets/_B6OKTJ3U.js","assets/_D0UH-qzF.js","assets/_-gyK8vJ-.js","assets/_rdXXJ91o.js","assets/_Dp25UBl7.js","assets/_DoNipARR.js","assets/_VdrzhuKU.js","assets/_l-4CNi-P.js","assets/_CzGoLHpy.js","assets/__Q8ATTST.js","assets/_BXeXVLqQ.js","assets/_BH3qAqXE.js","assets/_Ca6yBPZK2.js","assets/_DQxqrF2p2.js","assets/_CKHJpMi32.js","assets/_CpYNKFv52.js","assets/_bTVj8UrX2.js","assets/_kIpfj7zU2.js","assets/_gzcpVVnB2.js","assets/_xHfOHdoE2.js","assets/_BpWV4xDR2.js","assets/_Bw-xXnfr2.js","assets/_Ct7oMGlY2.js","assets/_CxVlY1q1.js","assets/_vvqUsxvZ.js","assets/_CCWd2cbl.js","assets/_DU_7z2vs.js","assets/_UABdeDPG.js","assets/_DDtfsPTV.js","assets/_CJfh1bA_.js","assets/_BtGc54QO.js","assets/_Gpz7cA9P.js","assets/_CCOa-67I.js","assets/_CLa87tfT.js","assets/_DmaZeTni.js","assets/_CnphyoYq.js","assets/_v0CL1jTB.js","assets/_DtW-KREB.js","assets/_BaHq4SXp.js","assets/_BYOwaDjH.js","assets/_CQJs3lWb.js","assets/_CYNrtFtB.js","assets/_DmIc4jLQ.js","assets/_CY8IvGdO2.js","assets/_CBce3t8t2.js","assets/_DYvRD3hg2.js","assets/_Dl-2e7rI2.js","assets/_woXpYk--.js","assets/_CTwY-w6f2.js","assets/_ioxvNBlq2.js","assets/_VpkJ9R4I2.js","assets/_LLhMP4fB2.js","assets/_BzmURZrG2.js","assets/_BMK2JGG-2.js","assets/_CNPd6AKz2.js","assets/_Dx-8-gkx.js","assets/_DLbMbJfH2.js","assets/_C8oCnwJJ2.js","assets/_DrB0wHeE.js","assets/_CXQQiNs1.js","assets/_9XtunSg7.js","assets/_BD3GuTLe.js","assets/_Cs2xR5zT.js","assets/_BsL8kuCs.js","assets/_B4U6RXlg.js","assets/_B8okAqG-.js","assets/_Cm86uuyb.js","assets/_B31BFjeo.js","assets/_DVTAwKKz.js","assets/_CvIA8snX.js","assets/_DWQbgPoS.js","assets/_DJMQeKeT.js","assets/_DH0HY4Nr.js","assets/_speyknRe2.js","assets/_BmaVzQYH2.js","assets/_DqKBuwfJ2.js","assets/_oqKa8noW.js","assets/_CnvKMtbv.js","assets/_IyjqRm3v.js","assets/_rLFTqkRN2.js","assets/_CacY0gHj2.js","assets/_B5eOa1yu.js","assets/_Dixweg8N.js","assets/_D1A_Heim2.js","assets/_O90oeIOV2.js","assets/_CqX4LQGj2.js","assets/_DOwzaHZ02.js","assets/_B3gFvitq2.js","assets/_Cfkwpbl82.js","assets/_BiFt_7mu2.js","assets/_CMLA9XwU2.js","assets/_Ne8qEUH82.js","assets/__WU9JTqk.js","assets/_CypNdMTQ.js","assets/_BOMR_lTT.js","assets/_BLA94hyL.js","assets/_Bj61d0ZC2.js","assets/_C0VVn7_H.js","assets/_BM315xPC.js","assets/_Cvrh5tZx2.js","assets/_CvPUh_B0.js","assets/_wyUUoFip.js","assets/_L8AbGenz.js","assets/_ByJddavk.js","assets/_BuU3dU-v.js","assets/_BP3KIWZr.js","assets/_B7X9man_.js","assets/_GlOqBOcg2.js","assets/_D8DKeNtk2.js","assets/_Dvy34Yg_2.js","assets/_DXjhrVim2.js","assets/_K6YjF5HA2.js","assets/_BCDnEeXi2.js","assets/_B6D30XZt.js"])))=>i.map(i=>d[i]);
2
+ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=/[\\;]/g,r=e=>e===`;`?`\\3B `:`\\\\`,i=function e(t,n,r){let i=``,a=``,o;if(t){if(typeof t!=`object`)i+=t;else if(Array.isArray(t))for(let s of t)o=e(s,n,r),o&&(i+=a+o,a=n);else for(let e in t)o=r(e,t[e]),o&&(i+=a+o,a=n)}return i},a=e=>(e+(e<26?10:e<962?334:11998)).toString(36),o,s,c=2,l=[],u=[],d=(e=>{for(let t=0;t<e.length;)e[t++](e[t++])}),f=e=>{(!o||e.b.F?.H!==0)&&e.c(e.b,e.d)},p,m=(e,t)=>t[1+e]||=(document.addEventListener(e,t,!0),1),h={},g=1e6,_,v=function e(t){t.H=0,t.D?.forEach(e),t.B?.forEach(Le)},y,b,x=(e,t)=>e.T?.(t),S=new WeakMap,C,ee=function e(t,n,r){let i,o,s=0,c=0;for(;t<n.length;)if(i=n.charCodeAt(t++),o=s,s=0,i===32)r[a(c++)]=C;else if(i===37||i===49)C.replaceWith(C=r[a(c++)]=new Text),i===49&&(r[a(c++)]=Fe());else if(i===38)return t;else if(i===47||i===48)t=e(t,n,r[a(c++)]=Pe(r.$,r.F)),i===48&&(r[a(c++)]=Fe());else if(i<92)for(i=25*o+i-67;i--;)te();else if(i<107)for(i=10*o+i-97;i--;)ne();else if(i<117){for(i=10*o+i-107;i--;)C=C.parentNode||C;ne()}else s=o*10+i-117},te=()=>{if(C.firstChild)return C=C.firstChild;for(;!C.nextSibling&&C.parentNode;)C=C.parentNode;ne()},ne=()=>C=C.nextSibling||C,w={},re,ie,ae,oe,se={},T=/[\p{L}\p{N}]/gu,E=``,D={},ce={},O=ye((e,...t)=>{e=a(e);let n=`D`+e,r=[],i=0;for(;i<t.length;)r.push(ut(``,t[i++],t[i++],t[i++])());return(t,i)=>{i!==(t[n]??(t[`A`+e]&&0))&&en(t,e,r[t[n]=i],ct)}}),le=ye((e,t,n)=>{e=a(e),t!==void 0&&(t=a(t)),n!==void 0&&(n=a(n));let r=`A`+e;return(i,a)=>{let o=i[e],s=o.nodeType===1,c=s?o:o.parentNode,l=i[r];l||(l=i[r]={},l.S=s?c.firstChild:i[t],l.K=s?c.lastChild:n===void 0?o.previousSibling:i[n]);let u=l.S;if(l.L&&u===l.K&&u.tagName===`T`){let e=u;e.firstChild||e.appendChild(new Text),l=i[r]={},l.S=u=e.firstChild,l.K=e.lastChild,e.replaceWith(...e.childNodes)}let d=s?!!c.firstChild:u.parentNode===c;a?d||Be(l,c,s?null:o):d&&(s&&(l.S=c.firstChild,l.K=c.lastChild),Ve(l))}}),ue=ye((e,t,n,r)=>{e=a(e);let i=`A`+e,o=`D`+e;return(a,s,c)=>{let l=ve(s);if(a[o]!==(a[o]=l?.a||l)||t&&!(l||a[i])){if(en(a,e,l||(t?t(a):void 0),tn),n&&(a[i].T=e=>n()(a,e)),typeof l==`string`){if(t){let e=t(a);en(a[i],`a`,e,ct),e.f&&Xe(e.e,e.f,a[i].Aa)}}else l?.f&&Xe(l.e,l.f,a[i])}if(l){let e=a[i],n=c?.();if(typeof l==`string`)(t?vt:yt)(e,`a`,(r?n[0]:n)||{},ce[e.a.tagName]),(e.Ia||e.Ea)&&Ce(e,$t);else{for(let t in l.g)l.g[t](e,l.h[t]);if(l.d){if(r)l.d(e,l._?n[0]:n);else{let r=t?{...n,content:t(a)}:n||{};l.d(e,l._?r:[r])}}}}}}),de=ye(e=>{e=a(e);let t=`A`+e,n=`D`+e;return(r,i)=>{if(r[n]!==(r[n]=i?.a||i)&&(en(r,e,i,ct),i?.f&&Xe(i.e,i.f,r[t])),i)for(let e in i.g)i.g[e](r[t],i.h[e])}}),k=ye(e=>(t,n,r,i,o)=>{t=a(t);let s=`A`+t,c=`O`+t,l=ut(``,n,r,i)();return(n,r)=>{let i=n[t],a=Ae(n[s]),u=n[s]=[];n[c]=null;let d=a.length,f=i.nodeType>1?i.parentNode||a[0]?.S.parentNode:i,p,m,h=0;e(r,(e,t)=>{let r=u.length,i=a[r],s=d&&(p||e!==(i?.M??r)?(p||=a.reduce((e,t,n)=>n<r?e:(t.I=n,e.set(t.M??n,t)),new Map)).get(e):i&&(h++,i));s?(m=!0,p?.delete(e)):s=ct(n.$,l,n,f),s.M=e,u.push(s),o?.(s,t)});let g=u.length,_=i!==f,v=null,y=d-1,b=g-1;if(_&&(d?(v=a[y].K.nextSibling,g||f.insertBefore(i,v)):g&&(v=i.nextSibling,i.remove())),!m){d&&(a.forEach(_?ze:Ie),_||(f.textContent=``));for(let e of u)Be(e,f,v);return}if(p)p.forEach(ze);else for(let e=g;e<d;e++)ze(a[e]);for(;y>=h&&b>=h&&a[y]===u[b];)y--,b--;if(y+1<d&&(v=a[y+1].S),h>y||h>b){for(let e=h;e<=b;e++)Be(u[e],f,v);return}let x=b-h+1,S=Array(x),C=Array(x),ee=[],te=-1,ne,w,re;for(let e=x;e--;)S[e]=u[h+e].I??-1;for(let e=0;e<x;e++)if(~S[e]){if(te<0||S[ee[te]]<S[e])~te&&(C[e]=ee[te]),ee[++te]=e;else{for(ne=0,w=te;ne<w;)re=(ne+w)/2|0,S[ee[re]]<S[e]?ne=re+1:w=re;S[e]<S[ee[ne]]&&(ne>0&&(C[e]=ee[ne-1]),ee[ne]=e)}}for(w=ee[te],ne=te+1;ne-->0;)ee[ne]=w,w=C[w];for(let e=x;e--;)~te&&e===ee[te]?te--:Be(u[h+e],f,v),v=u[h+e].S}})(([e,t],n)=>{t||=nn,typeof t==`string`?be(e,(e,r)=>n(e[t],[e,r])):be(e,(e,r)=>n(t(e,r),[e,r]))});function fe(e,t){return t?e:``}function pe(e,t){return t||t===0?me(e)+`:`+me(t+``):``}function me(e){return n.test(e)?e.replace(n,r):e}function he(e){return/^on[A-Z-]/.test(e)}function ge(e){return e[2]===`-`?e.slice(3):e.slice(2).toLowerCase()}function _e(e){return e!=null&&e!==!1}function ve(e){if(e){if(typeof e==`string`)return e;let t=e.content||e.default||e;if(`a`in t)return t}}function ye(e){return o=1,e}function be(e,t){if(e){let n=0;for(let r of e)t(r,n++)}}function xe(e,t,n,r,i=e.L){let a;if(n>=0&&(a=e[n])){if(a.d=r,a.e===c||p&&a.f)return;a.e=c}else a={a:i*1e6+n,b:e,c:t,d:r,e:c},n>=0&&(e[n]=a);Se(a)}function Se(e){let t=u.push(e)-1;for(;t;){let n=t-1>>1,r=u[n];if(e.a-r.a>=0)break;u[t]=r,t=n}u[t]=e}function Ce(e,t){l.push(t,e)}function we(){let e=l;try{s=1,Te()}finally{c++,s=0,u=[],l=[]}d(e)}function Te(){for(;u.length;){let e=u[0],t=u.pop();if(e!==t){let e=0,n=u.length>>1,r=(u[0]=t).a;for(;e<n;){let t=(e<<1)+1,n=t+1;if(n<u.length&&u[n].a-u[t].a<0&&(t=n),u[t].a-r>=0)break;u[e]=u[t],e=t}u[e]=t}f(e)}}function Ee(e,t){let n=e.A?.[t];n&&(e.A[t]=void 0,s?Ce(n,ke):ke(n))}function De(e,t){return Oe(e),((e.A||={})[t]||=new AbortController).signal}function Oe(e,t){let n=e.F;n&&(n.B||=new Set).add(e),t&&(e.Z||=[]).push(t)}function ke(e){e.abort()}function Ae(e){return e?Array.isArray(e)?e:[e]:[]}function je(e,t){if(e){if(Array.isArray(e))for(let n of e)t(n);else t(e)}}function eee(e,t){return e?Array.isArray(e)?(e.push(t),e):[e,t]:t}function A(e,t,n){e[1+t]===void 0&&m(t,Me),e[1+t]=n||null}function Me(e){let t=!s&&e.target;for(;t;)t[1+e.type]?.(e,t),t=e.bubbles&&!e.cancelBubble&&t.parentNode}function Ne(e,t){let n=h[t]||=document.createElementNS(t,`template`);return n.innerHTML=e,n.content||n}function Pe(e,t){let n={L:g++,H:c,F:t,$:e};return _?.push(n),n}function Fe(){return g++}function Ie(e){e.N?.D?.delete(e),v(e)}function Le(e){e.Z?.forEach(Re,e);for(let t in e.A)Ee(e,t)}function Re(e){e.delete(this)}function ze(e){Ie(e),Dt(e.S,e.K)}function Be(e,t,n){Ot(t,n,e.S,e.K)}function Ve(e){let t=new DocumentFragment;t.namespaceURI=e.S.parentNode.namespaceURI,Ot(t,null,e.S,e.K)}function He(){y||(y=1,queueMicrotask(Ue))}function Ue(){requestAnimationFrame(We),we()}function We(){b||(b=new MessageChannel,b.port1.onmessage=()=>{y=0,we()}),b.port2.postMessage(0)}function j(e,t){let n=a(e);return(r,i)=>(s?r.H===c&&(r[n]=i,t?.(r)):(r[n]!==i||!(n in r))&&(r[n]=i,t)&&(He(),xe(r,t,e)),i)}function Ge(e,t){let n=a(e),r=a(e+1),i=j(e,t);return(e,a,o)=>(s?(e[r]=o)&&(e[n]!==a||!(n in e))?(e[n]=a,t?.(e)):i(e,a):e[r]?e[r](a):i(e,a),a)}function M(e,t){return e=a(e),((n,r)=>{(n[e]!==r||!(e in n))&&(n[e]=r,t?.(n))})}function N(e,t,n=1,r=`L`){return r!==`L`&&(r=a(r)),i=>{i.H===c?~e in i?--i[~e]||t(i):i[~e]=n:xe(i,t,e,0,i[r])}}function Ke(e,t){e=a(e);let n=`A`+e,r=e=>{let r=Ae(e[n]);r.length&&xe(e,()=>{for(let e of r)e.H>0&&e.H<c&&t(e)},-1,0,r[0].L)};return r._=t,r}function qe(e,t,n,r){e=a(e),t=a(t),n!==`M`&&(n=a(n));let i=`A`+e,o=`O`+e,s=`_${t}`,l=e=>{let a=Ae(e[i]);if(e.H<c&&a.length){let c=e[t];xe(e,()=>{let t=Je(e,i,o,n);if(t&&s in t){let e=t.get(t[s]),n=t.get(c);e!==n&&(Ye(e,r),Ye(n,r))}else for(let t of Ae(e[i]))Ye(t,r);t&&(t[s]=c)},-1,0,a[0].L)}};return l._=r,l}function Je(e,t,n,r){let i=e[n]||=new Map;if(!i.size)for(let a of Ae(e[t])){let t=a.M??a[r];if(t===void 0)return e[n]=null;a.M=t,i.set(t,a)}return i}function Ye(e,t){e&&e.H>0&&e.H<c&&t(e)}function P(e,t,n){e=a(e);let r=`A`+e,i=`D`+e,o=e=>{let a=e[r];a&&a.H>0&&a.H<c&&(e[i]||0)===t&&xe(a,n,-1)};return o._=n,o}function Xe(e,t,n){let r=e[t]||=new Set,{size:i}=r;r.add(n).size!==i&&Oe(n,r)}function F(...e){let[t]=e,n=t.a,r=t.b;for(let t=e.length;t--;)e[t].c=t;return t=>{if(t[n])for(let i of t[n])i.H>0&&i.H<c&&xe(i,e[i[r]||0],-1)}}function I(e,t,n,r){e=a(e);let i=(e=>{e[i.b]=i.c,t(e),Xe(n?n(e):e._,i.a,e)});return i.a=e,i.b=`C`+e,r&&R(r,i),i}function Ze(e,t,n){e[a(t)].T=t=>n(e,t)}function Qe({$:e}){let t=S.get(e)||0;return S.set(e,t+1),`c`+e.runtimeId+e.renderId+t.toString(36)}function L(e,t){return R(e,t),e=>{Ce(e,t)}}function*$e(e,t,n=t.length-1){if(e){if(Symbol.iterator in e)for(let r of e.values())yield*$e(r,t,n);else{let r=e[t[n]];n?yield*$e(r,t,n-1):yield typeof r==`function`?r():r}}}function et(...e){return e=e.map(e=>typeof e==`string`?e:a(e)),t=>{let n=()=>$e(t,e).next().value;return n[Symbol.iterator]=()=>$e(t,e),n}}function tee(e,...t){return R(e,et(...t))}function tt(e,t,n){C=e,ee(0,t,n)}function nt(e=`M`){if(re)return;let t=self[e],n=t=>Object.defineProperty(self,e,t),r=t=>{n({value:re=(n=>{let r=re[n]=t[n]||t(n),i=r.w,a={},s=e=>a[e]||(+e?l(a[e]={L:+e}):c()),c=()=>a[0]||={runtimeId:e,renderId:n},l=e=>(e.H=1,e.$=c(),o&&e.G&&(e.F=s(e.G)),e),u=e=>{let t=e[0];for(let n=1;n<e.length;n++){let r=e[n];typeof r==`number`?t+=r:(t?l(Object.assign(a[t]||=(r.L=t,r),r)):Object.assign(c(),r),t++)}},d=((e,t)=>typeof e==`number`?t?w[t](s(e)):s(e):u(e)),f=(e=[],t=[],n=[],i=[],a)=>(o,c,l,u,d,f=_.parentNode,m=_,h=n.length,v=i.length)=>{for(y!==`[`&&(b[p()]=y===`)`||y===`}`?f:_,u=`A`+x,d=y!==`]`&&y!==`)`,p());o=+x;){if((l||=[]).push(c=s(o)),st(c,c.F),(c.O=r.p?.[o])&&(c.O.m=r.m),d){for(;m.previousSibling&&~g.indexOf(m=m.previousSibling););c._??=b,c.K=c.S=m,y===`'`&&(c.a=m)}else a=eee(a,c),u&&(b[u]=a,je(a,e=>e._??=b),a=e.pop()),m=t.pop(),f!==m.parentNode&&f.prepend(m),c.S=m,c.K=_.previousSibling===m?m:f.insertBefore(new Text,_);for(;h&&n[h-1].L>o;)h--,st(n.pop(),c);for(;v&&i[v-1].L>o;){v--;let e=i.pop();e.F!==e&&(e.F=c)}p()}if(l){for(let e of l)n.push(e);d&&(b[u]=l.length>1?l.reverse():l[0])}y===`[`?(l||(e.push(a),a=void 0),t.push(_)):i.push(b)},p=()=>x=v.slice(S,(S=v.indexOf(` `,S)+1||v.length+1)-1),m=(e=[],t)=>{let n=0;for(;n<e.length;n++){let i=e[n];if(typeof i==`string`)for(S=0,v=i;p();)/\D/.test(x)?h=w[x]:t.push(h,s(x));else if(Array.isArray(i)){if(!(ae&&i.every(e=>ae.has(e)&&!r.b[e].length)))break}else if(ae&&typeof i==`number`)break;else{let e=i(d);Array.isArray(e)&&u(e)}}return e.splice(0,n),n},h,g,_,v,y,b,x,S,C,ee;return d._=w,r.m=e=>{if(m(r.r,e),ae&&r.b)for(let t=1;t;){t=0;for(let n of ae){let i=r.b[n];i&&m(i,e)&&(t=1)}}let t=0;for(_ of g=r.v)if(S=r.i.length,v=_.data,y=v[S++],b=s(p()),y===`*`){let e=_.previousSibling;b[p()]=e&&(e.nodeType<8||e.data)?e:_.parentNode.insertBefore(new Text,_)}else o?(C||=f())():r.b&&(g[t++]=_);return ie&&!ee&&_&&ie.set(ee=_.parentNode.insertBefore(new Text,_.nextSibling),[n,a]),g.length=t,e},r.w=()=>{i(),rt(r)},r})})};if(t){r(t);for(let e in t)rt(re(e))}else n({configurable:!0,set:r})}function rt(e){try{oe=1,d(e.m([]),1)}finally{oe=0}}function R(e,t){return w[e]=t}function it(e,t){return R(e,e=>n=>t(e,n)),t}function at(e,t){return t=a(t),R(e,e=>()=>e[t])}function ot(e,t,n,r){let i=Pe(e);return i._=t.e||n,st(i,n?.F),t.b?.(i,r.namespaceURI),i}function st(e,t){t&&(e.N=t,(t.D||=new Set).add(e)),e.F=e}function ct(e,t,n,r){return lt(t,ot(e,t,n,r))}function lt(e,t){return e.c&&xe(t,e.c,-1),t}function ut(e,t,n,r,i,a){n=n?n.replace(/[^\0-1]+$/,``):``,r=r?r._||r:void 0,i||=void 0;let o=t?(e,r)=>{((se[r]||={})[1+t]||=ft(t,r))(e,n)}:e=>{tt(e.S=e.K=new Text,n,e)};return t=>({a:e,b:o,e:t,c:r,d:i,f:a})}function dt(e,t,n,r,i,a){return R(e,ut(e,t,n,r,i,a))}function ft(e,t){let{firstChild:n,lastChild:r}=Ne(e,t),i=document.createElementNS(t,`t`);return Ot(i,null,n,r),n===r&&n.nodeType<8?(e,t)=>{tt(e.S=e.K=n.cloneNode(!0),t,e)}:(e,t)=>{let n=i.cloneNode(!0);tt(n.firstChild,t,e),e.S=n.firstChild,e.K=n.lastChild}}function pt(e){return e||e===0?e+``:``}function z(e,t,n){mt(e,t,Tt(n))}function mt(e,t,n){e.getAttribute(t)!=n&&(n===void 0?e.removeAttribute(t):e.setAttribute(t,n))}function ht(e,t){mt(e,`class`,i(t,` `,fe)||void 0)}function gt(e,t){for(let n in t)B(e,n,t[n])}function B(e,t,n){e.classList.toggle(t,!!n)}function _t(e,t){mt(e,`style`,i(t,`;`,pe)||void 0)}function V(e,t){let n=pt(t);e.data!==n&&(e.data=n)}function vt(e,t,n,r){let i=e[t];for(let e=i.attributes.length;e--;){let{name:t}=i.attributes.item(e);n&&(t in n||bt(i,t,n))||i.removeAttribute(t)}xt(e,t,n,r)}function yt(e,t,n,r){vt(e,t,n,r),St(e,t,n?.content)}function bt(e,t,n){return t===`checked`&&e.tagName===`INPUT`&&`checkedValue`in n}function xt(e,t,n,r){let i=e[t],a=e[`I`+t],o;for(let e in a)a[e]=0;r&&(e[`F`+t]=5,e[`E`+t]=0,n&&(o=r(e,t,n)));for(let r in n){let s=n[r];switch(r){case`class`:ht(i,s);break;case`style`:_t(i,s);break;default:he(r)?(a||=e[`I`+t]={})[ge(r)]=s:o?.test(r)||r===`content`&&i.tagName!==`META`||z(i,r,s)}}}function St(e,t,n){let r=wt(n);e[`D`+t]!==(e[`D`+t]=r?.a)&&(en(e,t,r,ct),r?.f&&Xe(r.e,r.f,e[`A`+t]));for(let n in r?.g)r.g[n](e[`A`+t],r.h[n])}function Ct(e,t){let n=e[t],r=e[`I`+t];D[e[`F`+t]]?.(e,t);for(let e in r)A(n,e,r[e])}function wt(e){let t=ve(e);if(t&&t.a)return t}function Tt(e){if(_e(e))return e===!0?``:e+``}function Et(e,t,n=0){let r=`K`+n,i=e[r];i?(Object.assign(i,t),i.onUpdate?.()):(e[r]=t,Object.assign(t,t.onMount?.()),De(e,r).onabort=()=>t.onDestroy?.())}function Dt(e,t){let n=t.nextSibling;for(;e!==n;){let t=e.nextSibling;e.remove(),e=t}}function Ot(e,t,n,r){if(e.isConnected)e.insertBefore(kt(n,r),t);else{let i=r.nextSibling;for(;n!==i;){let r=n.nextSibling;e.insertBefore(n,t),n=r}}return e}function kt(e,t){return e===t?e:Ot(new DocumentFragment,null,e,t)}function At(e,t,n,r){if((t||t===0)&&(t!==n.length||/kw/.test(e))){let e=n.slice(0,t),i=n.slice(t);if(r.startsWith(e))return t;if(r.endsWith(i))return r.length-i.length;let a=e.match(T)?.length;for(;a&&T.test(r);)a--;return a?r.length:T.lastIndex}return-1}function jt(e,t,n){let r=e[t],i=_e(n);if(r.defaultChecked!==i){let t=e.H<c?r.checked:i;r.defaultChecked=i,t!==i&&(r.checked=t)}}function Mt(e,t,n,r){let i=e[t],a=_e(n);e[`E`+t]=r,e[`F`+t]=r?0:5,r&&e.H<c?i.checked=a:jt(e,t,a)}function Nt(e,t){let n=e[t];Gt(n,Yt,()=>{let r=e[`E`+t];if(r){let e=n.checked;n.checked=!e,r(e),we()}})}function Pt(e,t,n){let r=e[t],i=Tt(n)||``;if(r.defaultValue!==i){let t=e.H<c?r.value:i;r.defaultValue=i,Lt(r,t)}}function Ft(e,t,n,r,i=Pt){let a=e[t],o=Tt(n)||``;e[`E`+t]=r,e[`G`+t]=o,e[`F`+t]=r?2:5,r&&e.H<c?Lt(a,o):i(e,t,o)}function It(e,t){let n=e[t];oe&&(e[`G`+t]=n.defaultValue),Gt(n,Jt,r=>{let i=e[`E`+t];i&&(E=r?.inputType,i(n.value),we(),Lt(n,e[`G`+t]),E=``)})}function Lt(e,t){if(e.value!==t){let n=At(E,document.activeElement===e&&e.selectionStart,e.value,e.value=t);~n&&e.setSelectionRange(n,n)}}function Rt(e,t,n){let r,i=e[t],a=e.H<c,o=Array.isArray(n),s=o?n.map(Qt):Qt(n);l.unshift(()=>{for(let e of i.options){let t=o?s.includes(e.value):e.value===s;e.defaultSelected!==t&&(a&&(r??=Ht(i,o)),e.defaultSelected=t)}r!==void 0&&Vt(i,r,o)},e)}function zt(e,t,n,r){let i=e[t],a=e.H<c,o=Array.isArray(n),s=e[`G`+t]=o?n.map(Qt):Qt(n);e[`E`+t]=r,e[`F`+t]=r?3:5,r&&a?l.unshift(()=>Vt(i,s,o),e):Rt(e,t,s)}function Bt(e,t){let n=e[t],r=()=>{let r=e[`E`+t];if(r){let i=e[`G`+t],a=Array.isArray(i),o=Ht(n,a);Vt(n,i,a),r(o),we()}};if(oe){if(n.multiple){e[`G`+t]=[];for(let r of n.options)r.defaultSelected&&e[`G`+t].push(r.value)}else{e[`G`+t]=``;for(let r of n.options)if(r.defaultSelected){e[`G`+t]=r.value;break}}}Gt(n,Xt,r),Wt(e,t,{childList:!0,subtree:!0},()=>{let i=e[`G`+t];(Array.isArray(i)?i.length!==n.selectedOptions.length||i.some((e,t)=>!i.includes(n.selectedOptions[t].value)):n.value!==i)&&r()})}function Vt(e,t,n){if(n)for(let n of e.options)n.selected=t.includes(n.value);else e.value=t}function Ht(e,t){return t?Array.from(e.selectedOptions,e=>e.value):e.value}function Ut(e,t,n){e.H===c&&(e[t].open=_e(n))}function Wt(e,t,n,r){(e[`N`+t]||=new MutationObserver(r)).observe(e[t],n)}function Gt(e,t,n){e._=n,m(`input`,Kt),e.form&&m(`reset`,qt),oe&&t(e)&&queueMicrotask(n)}function Kt(e){e.target._?.(e)}function qt(e){let t=[];for(let n of e.target.elements)n._&&Zt(n)&&t.push(n._);requestAnimationFrame(()=>{if(!e.defaultPrevented)for(let e of t)e()})}function Jt(e){return e.value!==e.defaultValue}function Yt(e){return e.checked!==e.defaultChecked}function Xt(e){for(let t of e.options)if(t.selected!==t.defaultSelected)return!0}function Zt(e){return e.options?Xt(e):Jt(e)||Yt(e)}function Qt(e){return Tt(e)||``}function $t(e){Ct(e,`a`)}function en(e,t,n,r){let i=e[t],a=e[`A`+t],o=i.nodeType>1?(a?.S||i).parentNode:i,s=e[`A`+t]=n&&r(e.$,n,e,o);i===o?(a&&(Ie(a),i.textContent=``),s&&Be(s,o,null)):a?(s?Be(s,o,a.S):o.insertBefore(i,a.S),ze(a)):s&&(Be(s,o,i),i.remove())}function tn(e,t,n,r){let i=ot(e,t,n,r);return typeof t==`string`?i.a=i.S=i.K=document.createElementNS(t===`svg`?`http://www.w3.org/2000/svg`:t===`math`?`http://www.w3.org/1998/Math/MathML`:r.namespaceURI,t):lt(t,i),i}function nn(e,t){return t}var rn=[],an=Symbol();function on(e){return e[Symbol.iterator]=sn,e[an]=rn,e}function*sn(){yield this,yield*this[an]}async function H(e,t){let n=await fetch(e,t),r;try{r=await n.json()}catch{throw Error(n.ok?`invalid response`:`HTTP ${n.status}`)}if(r&&typeof r==`object`&&r.error)throw Error(r.error);if(!n.ok)throw Error(`HTTP ${n.status}`);return r}var cn=[`workspaces.changed`,`sessions.changed`,`workspace.progress`,`review.changed`,`status.changed`],ln=1e4,un=4e4,dn=8e3,fn=5e3,pn=6e4,mn,hn,gn=null,_n,vn,yn,bn,xn=0;function Sn(e){hn&&e!==hn&&location.reload(),hn=e}async function Cn(){try{Sn((await H(`/api/boot`)).boot)}catch{}}function wn(){clearTimeout(vn),clearTimeout(yn),yn=setTimeout(Tn,un),xn&&(xn=0,clearInterval(bn),bn=void 0)}function Tn(){En(),!xn&&(xn=Date.now(),bn=setInterval(()=>{document.visibilityState===`visible`&&(Date.now()-xn>pn&&(xn=Date.now(),On()),Dn(),H(`/api/status`).then(e=>{mn.dispatchEvent(new MessageEvent(`status.changed`,{data:e}))}).catch(()=>{}))},fn))}function En(){clearTimeout(vn),clearTimeout(yn),gn?.close(),gn=null}function Dn(){for(let e of[`workspaces.changed`,`sessions.changed`])mn.dispatchEvent(new MessageEvent(e,{data:null}))}function On(){if(gn)return;let e=gn=new EventSource(`/api/events`);clearTimeout(vn),vn=setTimeout(Tn,dn),e.addEventListener(`hello`,e=>{wn(),Sn(JSON.parse(e.data||`{}`).boot)}),e.addEventListener(`ping`,wn);for(let t of cn)e.addEventListener(t,e=>{wn(),mn.dispatchEvent(new MessageEvent(t,{data:JSON.parse(e.data||`null`)}))})}function kn(){return mn||(mn=new EventTarget,On(),Cn(),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`?(clearTimeout(_n),On(),Cn(),Dn()):(clearTimeout(_n),_n=setTimeout(()=>{xn||En()},ln))})),mn}var An=null,jn=null,Mn=new EventTarget;function Nn(e,t){Mn.addEventListener(`intent`,e,{signal:t})}function Pn(e,t){An={workspaceId:e,pr:t},Mn.dispatchEvent(new Event(`intent`))}function Fn(e){if(An?.workspaceId!==e)return!1;let t=An.pr;return An=null,{pr:t}}function In(e,t){jn=[e,t],Mn.dispatchEvent(new Event(`intent`))}function Ln(e){if(jn?.[0]!==e)return null;let t=jn[1];return jn=null,t}function Rn(e){let t=!1,n=!1;return async()=>{if(t){n=!0;return}t=!0;try{do n=!1,await e();while(n)}finally{t=!1}}}var zn=new Map,Bn=new Set,Vn;function Hn(){return typeof window>`u`?Promise.resolve():Vn??=(async()=>{try{let e=await(await fetch(`/api/prefs`)).json();for(let[t,n]of Object.entries(e))Bn.has(t)||zn.set(t,n)}catch{}})()}function Un(e){return zn.get(e)??null}function Wn(e,t){Bn.add(e),t===null?zn.delete(e):zn.set(e,t),nee(e,t)}function nee(e,t){return fetch(`/api/prefs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({key:e,value:t})}).catch(()=>{})}function ree(){return Un(`last-workspace`)}function Gn(e){Wn(`last-workspace`,e)}function Kn(){return Un(`side-nav`)!==`0`}function qn(e){Wn(`side-nav`,e?`1`:`0`)}function Jn(e){return Un(`tab:${e}`)}function Yn(e,t){Wn(`tab:${e}`,t)}function Xn(){return Un(`diff-tree`)!==`0`}function Zn(e){Wn(`diff-tree`,e?`1`:`0`)}function Qn(){return Un(`diff-uncommitted`)===`1`}function $n(e){Wn(`diff-uncommitted`,e?`1`:`0`)}function er(){return typeof window<`u`&&`serviceWorker`in navigator&&`PushManager`in window}async function tr(){return er()?(await ar()).pushManager.getSubscription():null}async function nr(){if(await Notification.requestPermission()!==`granted`)return!1;let e=await ar(),t=await e.pushManager.getSubscription();if(!t){let{publicKey:n}=await H(`/api/push`);t=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:or(n)})}return await H(`/api/push`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t.toJSON())}),!0}async function rr(){let e=await tr();e&&(await H(`/api/push?endpoint=${encodeURIComponent(e.endpoint)}`,{method:`DELETE`}).catch(()=>{}),await e.unsubscribe())}function ir(e){let t=()=>{document.visibilityState===`visible`&&navigator.clearAppBadge?.().catch(()=>{})};t(),document.addEventListener(`visibilitychange`,t,{signal:e})}async function ar(){return await navigator.serviceWorker.getRegistration()??navigator.serviceWorker.register(`/sw.js`)}function or(e){let t=e.padEnd(e.length+(4-e.length%4)%4,`=`),n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(n,e=>e.charCodeAt(0))}function sr(){return typeof window<`u`&&window.matchMedia(`(pointer: coarse)`).matches}function cr(){return typeof window<`u`&&window.matchMedia(`(max-width: 899px)`).matches}function lr(){return typeof navigator<`u`&&navigator.standalone===!0}function ur(e){if(!lr()||!/^https?:\/\//.test(e)){window.open(e,`_blank`,`noopener`);return}if(localStorage.getItem(`xSafariOk`)){location.href=`x-safari-${e}`;return}if(localStorage.getItem(`xSafariNo`)){window.open(e,`_blank`,`noopener`);return}let t=!1,n=()=>{document.visibilityState===`hidden`&&(t=!0,localStorage.setItem(`xSafariOk`,`1`))};document.addEventListener(`visibilitychange`,n),window.addEventListener(`pagehide`,n),setTimeout(()=>{document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pagehide`,n),!(t||document.visibilityState===`hidden`)&&(localStorage.setItem(`xSafariNo`,`1`),window.open(e,`_blank`,`noopener`))},1500),location.href=`x-safari-${e}`}function dr(e,t){if(!e)return-1;let n=e.toLowerCase(),r=t.toLowerCase(),i=r.lastIndexOf(`/`),a=r.slice(i+1),o=r.slice(0,Math.max(0,i)).includes(n)?5:0;return a===n?1e3+o:a.startsWith(n)?800+o:a.includes(n)?600+o:pr(n,a)?400+o:r.includes(n)?300:pr(n,r)?100:-1}function fr(e,t,n){return e?t.map(t=>({repo:t,score:dr(e,t.nameWithOwner)})).filter(({repo:e,score:t})=>!e.isArchived&&t>=0&&!n(e.nameWithOwner)).sort((e,t)=>t.score-e.score||e.repo.nameWithOwner.length-t.repo.nameWithOwner.length||e.repo.nameWithOwner.localeCompare(t.repo.nameWithOwner)).slice(0,8).map(({repo:e})=>e):[]}function pr(e,t){if(!e)return!0;let n=0,r=t.toLowerCase();for(let t of e.toLowerCase()){if(n=r.indexOf(t,n),n===-1)return!1;n++}return!0}function mr(e){return e?.working?`working`:e?.waiting?`waiting`:e?.agents?`idle`:`off`}function hr(e){return e?.phase===`working`?`working`:e?.phase===`waiting`?`waiting`:e?.alive?`idle`:`off`}var gr=`<svg viewBox="0 0 24 24" fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden=true><path></path></svg>`,_r=` D l`,vr=(e,t)=>{z(e.a,`width`,t),z(e.a,`height`,t)},yr=(e,t)=>vr(e,t??15),br=(e,t)=>ht(e.a,[`icon`,t]),xr=(e,t)=>z(e.b,`d`,t),Sr=gr,Cr=(e=>`/${e}&`)(_r);function wr(e){xr(e.a,`M18 21C19.1046 21 20 20.1046 20 19C20 17.8954 19.1046 17 18 17C16.8954 17 16 17.8954 16 19C16 20.1046 16.8954 21 18 21Z M6 7C7.10457 7 8 6.10457 8 5C8 3.89543 7.10457 3 6 3C4.89543 3 4 3.89543 4 5C4 6.10457 4.89543 7 6 7Z M18 17V7C18 7 18 5 16 5H13 M6 7V17C6 17 6 19 8 19H11 M15.0005 7.50012L12.5005 5.00012L15.0005 2.50012 M8.5 16.5L11 19L8.5 21.5`)}var Tr=(e,t)=>yr(e.a,t),Er=(e,t)=>br(e.a,t),Dr=gr,Or=(e=>`/${e}&`)(_r);function kr(e){xr(e.a,`M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z M19.6224 10.3954L18.5247 7.7448L20 6L18 4L16.2647 5.48295L13.5578 4.36974L12.9353 2H10.981L10.3491 4.40113L7.70441 5.51596L6 4L4 6L5.45337 7.78885L4.3725 10.4463L2 11V13L4.40111 13.6555L5.51575 16.2997L4 18L6 20L7.79116 18.5403L10.397 19.6123L11 22H13L13.6045 19.6132L16.2551 18.5155C16.6969 18.8313 18 20 18 20L20 18L18.5159 16.2494L19.6139 13.598L21.9999 12.9772L22 11L19.6224 10.3954Z`)}var Ar=(e,t)=>yr(e.a,t),jr=(e,t)=>br(e.a,t),Mr=gr,Nr=(e=>`/${e}&`)(_r);function Pr(e){xr(e.a,`M6 12H12M18 12H12M12 12V6M12 12V18`)}var Fr=(e,t)=>yr(e.a,t),Ir=(e,t)=>br(e.a,t),Lr=`<!><!><!>`,iee={claude:`M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z`,codex:`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`,grok:`M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815`,copilot:`M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z`,cursor:`M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z`},Rr=P(0,1,e=>yr(e.a,e._.d)),zr=e=>{Rr._(e),Br._(e),xr(e.a,`M5 7L10 12L5 17 M13 17H20`)},Br=P(0,1,e=>br(e.a,e._.f)),Vr=P(0,0,e=>ht(e.a,[`icon`,e._.f])),Hr=e=>{Vr._(e),Ur._(e),Wr._(e)},Ur=P(0,0,e=>{z(e.a,`width`,e._.g),z(e.a,`height`,e._.g)}),Wr=P(0,0,e=>z(e.b,`d`,e._.h)),Gr=M(6,Ur),Kr=M(3,e=>{Gr(e,e.d??15),Rr(e)}),qr=O(0,`<svg viewBox="0 0 24 24" fill=currentColor fill-rule=evenodd aria-hidden=true><path></path></svg>`,` D `,Hr,gr,(e=>`/${e}&`)(_r),zr),Jr=M(7,e=>{qr(e,+!e.h),Wr(e)}),Yr=(e,t)=>Jr(e,iee[t]),Xr=M(5,e=>{Vr(e),Br(e)}),Zr=`<!><!><div class=palette role=dialog aria-label=Workspaces><!><input autofocus placeholder="Jump to workspace…" aria-label="Filter workspaces"><ul class=rows></ul><!><div class=palette-foot><span></span><span class="dim hint">↑↓ navigate · ↵ open · ⌘1–9 switch · esc close</span><!></div></div>`,Qr=`b%b D%b b b%bDc%m`,$r=(e,t)=>{z(e.a,`value`,t),V(e.b,t)},ei=(e,t)=>$r(e,t[0]),ti=(e,t)=>V(e.a,t),ni=(e,t)=>ti(e,t[0]?.worktree),ri=P(5,0,e=>{z(e.a,`title`,`${e._.r} open PR${e._.r===1?``:`s`}`),V(e.b,e._.r),V(e.c,e._.r===1?``:`s`)}),ii=ri,ai=P(6,0,e=>z(e.a,`title`,e._.o.map(e=>`:${e.port} ${e.cmd}`).join(`
3
+ `))),oi=e=>{ai._(e),si._(e)},si=P(6,0,e=>V(e.b,e._.p)),ci=N(2,e=>z(e.a,`title`,`${e._.l} running session${e._.l===1?``:`s`}${e._.m?` — ${e._.m} working`:``}${e._.n?` — ${e._.n} waiting on you`:``}`),2),li=P(4,0,e=>{V(e.b,e._.l),ci(e)}),ui=e=>{li._(e),di._(e),fi._(e)},di=P(4,0,ci),fi=P(4,0,ci),pi=P(0,1,e=>V(e.a,e._.g)),mi=pi,hi=N(2,e=>V(e.b,e._.a3?`hide archived`:`archived (${e._.a6})`)),gi=P(5,0,hi),_i=L(`j8`,e=>A(e.a,`click`,function(){La(e._,!e._.a3)})),vi=e=>{gi._(e),yi._(e),_i(e)},yi=P(5,0,hi),bi=N(1,e=>zt(e,`a`,e._.o.preferredAgent,go(e))),xi=P(6,0,bi),Si=L(`j9`,e=>Bt(e,`a`)),Ci=e=>{xi._(e),Ti._(e),Ei._(e),Si(e)},wi=k(0,`<option> </option>`,` D `,0,ei),Ti=P(6,0,e=>wi(e,[e._.z,e=>e])),Ei=P(6,0,bi),Di=L(`j5`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._.q(e._._.h,e.e)})),Oi=e=>{e.b,Kr(e.b,14),Xr(e.b),Di(e)},ki=M(4,e=>{Yr(e.b,e.e),V(e.c,e.e)}),Ai=k(6,(e=>`<button>${e}<!></button>`)(Lr),(e=>` D/${e}&%l`)(`b%c`),Oi,(e,t)=>ki(e,t[0])),ji=I(48,e=>Ai(e,[[...e._._.z||[],`shell`],e=>e]),e=>e._._),Mi=(e,t)=>{z(e.e,`popovertarget`,t),z(e.g,`id`,t)},Ni=L(`j6`,e=>{A(e.a,`click`,function(t){t.stopPropagation(),e._._.m(e._.h)}),A(e.c,`click`,function(t){t.stopPropagation(),e._._.n(e._.h)}),A(e.e,`click`,function(e){e.stopPropagation()}),A(e.g,`toggle`,function(t,n){if(t.newState===`open`){let t=e.e.getBoundingClientRect();n.style.top=`${t.bottom+4}px`,n.style.left=`${Math.max(8,t.right-n.offsetWidth)}px`}})}),Pi=e=>{ji(e),wr(e.b),Tr(e.b,13),Er(e.b),kr(e.d),Ar(e.d,13),jr(e.d),Pr(e.f),Fr(e.f,13),Ir(e.f),Mi(e,Qe(e)),Ni(e)},Fi=O(2,`<span class="chip open">open</span>`),Ii=N(18,e=>Fi(e,e._.i===e._._.k?0:1)),Li=I(45,Ii,e=>e._._),Ri=e=>{Li(e),Vi(e),Ui._(e),Wi._(e),Gi._(e),Ji._(e)},zi=(e,t)=>{ht(e.a,[`dot`,mr(t)]),Xi(e,t?.repos),Qi(e,t?.agents),$i(e,t?.working),ea(e,t?.waiting),na(e,t?.ports)},Bi=N(19,e=>zi(e,e._._.y[e._.i])),Vi=I(47,Bi,e=>e._._),Hi=O(3,`<span class=chip>archived</span>`),Ui=P(0,2,e=>Hi(e,+!e._.f)),Wi=P(0,2,e=>{Bi(e),Ii(e)}),Gi=P(0,2,e=>V(e.b,e._.j)),Ki=k(7,`<span class=mono> </span>`,`D `,0,ni),qi=N(10,e=>Ki(e,[e.j||e._.k,`full_name`])),Ji=P(0,2,qi),Yi=(e,t)=>aa(e,t?.length),Xi=M(9,e=>{Yi(e,(e.j||[]).flatMap(e=>e.prs||[])),qi(e)}),Zi=O(4,`<span class="chip stat"> </span>`,` D `,ui),Qi=M(11,e=>{Zi(e,+!e.l),li(e)}),$i=M(12,di),ea=M(13,fi),ta=O(6,`<span class="chip stat">:<!></span>`,` Db%`,oi),na=M(14,e=>{ra(e,e.o?.length),ta(e,+!(e.o||[]).length),ai(e)}),ra=M(15,si),ia=O(5,`<span class="chip stat"><!> PR<!></span>`,` D%c%`,ii),aa=M(17,e=>{ia(e,+!e.r),ri(e)}),oa=N(12,e=>gt(e.a,{hi:e.l===e._.ah,archived:e.e===`ws`&&e.f}),3),sa=Ke(4,oa),ca=L(`j7`,e=>{A(e.a,`click`,function(){e._.ai(e.d)}),A(e.a,`mouseenter`,function(){Ia(e._,e.l)})}),la=e=>{sa._(e),ca(e)},ua=O(0,`<span class=row-name>+ New workspace</span>`,0,0,`<span class="row-name cmd-row">▸ <!></span>`,`Db%`,mi,`<span class=row-name><span></span><span class=row-name-text> </span><!><!><span class=row-stats><!><!><!></span></span><span class=row-repos></span>`,`D bD l%b%bD%b%b%m `,Ri),da=O(1,((e,t,n)=>`<button class=row-more title="Review changes">${e}</button><button class=row-more title="Manage workspace">${t}</button><button class=row-more title="New session">${n}</button><div popover=auto class=new-session-pop></div>`)(Sr,Dr,Mr),((e,t,n)=>` D/${e}&l D/${t}&l D/${n}&l b`)(Cr,Or,Nr),Pi),fa=M(4,e=>{ua(e,e.e===`new`?0:e.e===`cmd`?1:2),da(e,e.e===`ws`?0:1),oa(e)}),pa=M(5,e=>{oa(e),Ui(e)}),ma=M(11,oa),ha=(e,t)=>{ga(e,t[0]),ma(e,t[1])},ga=M(3,e=>{fa(e,e.d?.kind),pa(e,e.d?.archived),_a(e,e.d?.label),va(e,e.d?.ws)}),_a=M(6,pi),va=M(7,e=>{ya(e,e.h?.id),ba(e,e.h?.name),xa(e,e.h?.repos)}),ya=M(8,Wi),ba=M(9,Gi),xa=M(10,Ji),Sa=L(`j4`,e=>A(e.a,`click`,function(){e._.v?.()})),Ca=k(4,`<li><div class=row-wrap><button class=row></button><!></div></li>`,`E b%`,la,ha),wa=N(40,L(`j12`,e=>Et(e,{onMount:function(){let t=new AbortController,n=e.ad.findIndex(t=>t.kind===`ws`&&t.ws.id===e.k);n>=0&&Ia(e,n),setTimeout(()=>e.d?.focus(),0);let r=t.signal;return document.addEventListener(`keydown`,t=>{document.querySelector(`:popover-open`)||t.key===`Escape`&&!e.u&&(t.preventDefault(),e.v?.())},{capture:!0,signal:r}),{abort:t}},onDestroy:function(){this.abort.abort()}})),3),Ta=M(39,e=>{Qa(e,e.ad.length),Ca(e,[e.ad,e=>e.kind===`new`?`new`:e.kind===`cmd`?`cmd:${e.label}`:e.ws.id]),wa(e)}),Ea=N(38,e=>Ta(e,[...e.a8(e.a4).map(e=>({kind:`ws`,ws:e})),...e.a3||e.a1?e.a8(e.a5).map(e=>({kind:`ws`,ws:e,archived:!0})):[],...e.ab,{kind:`new`}]),5),Da=M(34,Ea),Oa=M(37,Ea),ka=N(36,e=>Oa(e,!e.a1||!e.a9?[]:[{kind:`cmd`,label:`Review changes — ${e.a9?.name}`,run:()=>e.m(e.a9)},{kind:`cmd`,label:`Manage workspace — ${e.a9?.name}`,run:()=>e.n(e.a9)},{kind:`cmd`,label:`New ${e.p||`agent`} session — ${e.a9?.name}`,run:()=>e.q(e.a9,e.p||`claude`)}].filter(t=>t.kind===`cmd`&&pr(e.a1,t.label))),5),Aa=O(5,`<button class="archived-link dim"> </button>`,` D `,vi),ja=N(33,e=>Aa(e,e.a6&&!e.a1?0:1)),Ma=j(27,e=>{Ft(e,`d`,e.a1,vo(e)),Da(e,_o(e)),ka(e),Ea(e),ja(e)}),Na=L(`j11`,e=>e.e.children[e.ah]?.scrollIntoView({block:`nearest`})),Pa=M(43,e=>{sa(e),Na(e)}),Fa=N(42,e=>Pa(e,Math.min(e.a2,e.af-1))),Ia=j(28,Fa),La=j(29,e=>{Ea(e),gi(e)}),Ra=L(`j10`,e=>{It(e,`d`),A(e.d,`keydown`,function(t){t.key===`ArrowDown`?(t.preventDefault(),Ia(e,Math.min(e.ah+1,e.ad.length-1))):t.key===`ArrowUp`?(t.preventDefault(),Ia(e,Math.max(e.ah-1,0))):t.key===`Enter`?(t.preventDefault(),e.ai(e.ad[e.ah])):t.key===`Escape`&&!e.u&&(t.preventDefault(),e.v?.())})});function za(e){Ma(e,``),Ia(e,0),La(e,!1),Ra(e)}var Ba=M(30,Ea),Va=M(31,e=>{Ga(e,e.a5?.length),Ea(e)}),Ha=M(35,ka),Ua=N(11,e=>Ha(e,e.j.find(t=>t.id===e.k))),Wa=M(9,e=>{co(e,e.j?.length),Ba(e,e.j.filter(e=>e.status===`active`)),Va(e,e.j.filter(e=>e.status===`archived`)),Ua(e)}),Ga=M(32,e=>{ja(e),yi(e)}),Ka=F(Li),qa=M(10,e=>{Ua(e),wa(e),Ka(e)}),Ja=M(12,ka),Ya=M(13,ka),Xa=M(15,ka),Za=M(16,ka),Qa=M(41,Fa),$a=M(44),eo=N(19,e=>$a(e,yo(e))),to=M(17,eo),no=M(18,eo),ro=O(0,`<div class=palette-backdrop></div>`,` `,Sa),io=O(2,`<div class="onboard dim"><p>A <strong>workspace</strong> checks out one or more repos as git worktrees on a shared branch and gives each agent session its own terminal. Create one to get started.</p><p>Pick your preferred agent below — new sessions and the quick-create button use it. GitHub access uses your <code>gh</code> login.</p></div>`),ao=N(23,e=>io(e,e.u&&!e.w?0:1)),oo=M(20,e=>{B(e.b,`inline`,e.u),ro(e,+!!e.u),wa(e),ao(e)}),so=M(21,wa),co=M(22,ao),lo=O(6,`<label class=dim><select aria-label="Preferred agent"></select></label>`,`D `,Ci),uo=M(14,e=>{Xa(e,e.o?.preferredAgent),po(e,e.o?.agents),lo(e,+!e.o),xi(e)}),fo=F(ji),po=M(25,e=>{fo(e),Ti(e)}),mo=M(24,F(Vi)),ho=M(26,Ei);function go(e){return function(t){e._.a0({...e._.o,preferredAgent:t}),H(`/api/settings`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({preferredAgent:t})}).catch(()=>{})}}function _o(e){return t=>t.filter(t=>pr(e.a1,t.name))}function vo(e){return function(t){Ma(e,t),Ia(e,0)}}function yo(e){return t=>{t&&(t.kind===`new`?e.r():t.kind===`cmd`?t.run():e.s(t.ws))}}R(`j1`,go),R(`j2`,_o),R(`j0`,vo),R(`j3`,yo);var bo=gr,xo=(e=>`/${e}&`)(_r);function So(e){xr(e.a,`M21.8883 13.5C21.1645 18.3113 17.013 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C16.1006 2 19.6248 4.46819 21.1679 8 M17 8H21.4C21.7314 8 22 7.73137 22 7.4V3`)}var Co=(e,t)=>yr(e.a,t),wo=(e,t)=>br(e.a,t),To=`<div class=add-repo><input placeholder="Add a repo…" aria-label="Add a repo"><!><!></div>`,Eo=`D b%b%l`,Do=null,aee=L(`l7`,e=>A(e.a,`click`,function(){e._._._._._.z(e._._._.i,e.d)})),oee=M(3,e=>V(e.b,e.d)),see=(e,t)=>oee(e,t[0]),Oo=I(33,e=>Ft(e,`a`,e._._._._._.y,Cs(e)),e=>e._._._._._),cee=L(`l6`,e=>It(e,`a`)),lee=e=>{Oo(e),cee(e)},uee=k(1,`<li><button class=result-row><span class="repo-name mono"> </span></button></li>`,`D E `,aee,see),dee=(e,t)=>{hee(e,t?.length),uee(e,[t,e=>e])},ko=N(5,e=>dee(e,(e._._._._.y?e._._._._.w.filter(t=>t.toLowerCase().includes(e._._._._.y.toLowerCase())):e._._._._.w).slice(0,12))),Ao=I(31,ko,e=>e._._._._),fee=e=>{Ao(e),jo(e),Mo(e)},pee=O(0,`<input placeholder="Filter branches…" aria-label="Filter branches" autofocus>`,` `,lee),jo=I(32,e=>pee(e,e._._._._.x>8?0:1),e=>e._._._._),Mo=I(33,ko,e=>e._._._._),mee=O(2,`<li><p class="dim empty-note">No branches match.</p></li>`),hee=(e,t)=>mee(e,+!!t),gee=O(0,`<p class="dim empty-note"><span class=spin></span> Loading branches…</p>`,0,0,`<!><!><ul class=branch-list><!><!></ul>`,`b%bD%b%`,fee),No=I(31,e=>gee(e,+!!e._._._.w),e=>e._._._),_ee=No,Po=N(11,e=>B(e.a,`hi`,e.k===e._._.p)),Fo=I(28,Po,e=>e._._),Io=L(`l8`,e=>{A(e.a,`mouseenter`,function(){ns(e._._,e.k)}),A(e.b,`click`,function(){e._._.z(e.i)}),A(e.e,`click`,function(){e._._.a0(e.i)})}),Lo=e=>{Fo(e),Bo(e),Pr(e.c),Fr(e.c,12),Ir(e.c,`result-plus`),Io(e)},Ro=O(5,`<div class=branch-pick></div>`,` `,_ee),zo=N(9,e=>{B(e.e,`on`,e._._.u===e.i),Ro(e,e._._.u===e.i?0:1)}),Bo=I(30,zo,e=>e._._),Vo=M(10,Po),Ho=M(8,e=>{V(e.d,e.i),z(e.e,`title`,`Pick a base branch for ${e.i}`),z(e.e,`aria-label`,`Pick a base branch for ${e.i}`),zo(e)}),Uo=k(0,(e=>`<li><div class=result-wrap><button class=result-row>${e}<span class=repo-name> </span></button><button class=result-branch>⎇</button></div><!></li>`)(Mr),(e=>`D D D/${e}&D m l%l`)(Nr),Lo,(e,t)=>{Ho(e,t[0]?.nameWithOwner),Vo(e,t[1])}),Wo=P(2,0,e=>Uo(e,[e._.r,`nameWithOwner`])),Go=Wo,Ko=P(2,1,e=>V(e.a,e._.m)),qo=Ko,Jo=M(17,e=>{_s(e,e.r?.length),Wo(e)}),Yo=N(14,e=>Jo(e,e.l&&e.m?fr(e.m,e.l?.repos,t=>e.i.has(t)):[]),2),Xo=O(1,`<p class="dim empty-note">Loading repos…</p>`),Zo=N(13,e=>Xo(e,e.m&&!e.l?0:1)),Qo=O(2,`<ul class=repo-results></ul>`,` `,Go,`<p class="dim empty-note">No repos match "<!>".</p>`,`Db%`,qo),$o=N(19,e=>Qo(e,e.s?0:e.m&&e.l?1:2),2),es=j(11,e=>{Yo(e),Zo(e),$o(e)}),ts=j(12,e=>{Ft(e,`a`,e.m,ws(e)),Yo(e),Zo(e),$o(e),Ko(e)}),ns=j(15,F(Fo)),rs=M(26),is=N(21,e=>rs(e,Ts(e))),as=F(Bo),os=j(20,e=>{is(e),as(e)}),ss=F(No,Ao),cs=j(22,e=>{ys(e,e.w?.length),ss(e)}),ls=j(24,F(Mo,Oo)),us=L(`l9`,e=>{It(e,`a`),A(e.a,`keydown`,function(t){t.key===`ArrowDown`?(t.preventDefault(),ns(e,Math.min(e.p+1,e.r?.length-1))):t.key===`ArrowUp`?(t.preventDefault(),ns(e,Math.max(e.p-1,0))):t.key===`Enter`?(t.preventDefault(),e.r[e.p]&&e.z(e.r[e.p].nameWithOwner)):t.key===`Escape`&&e.m&&(t.preventDefault(),ts(e,``))})});function ds(e){es(e,null),ts(e,``),ns(e,0),os(e,null),cs(e,null),ls(e,``),us(e)}var fs=L(`l10`,e=>Et(e,{onMount:function(){Do&&es(e,Do),e.q(!1)}})),ps=M(16,e=>{x(e,Es(e)),fs(e)}),ms=N(7,e=>ps(e,Ds(e))),hs=M(5,ms),gs=M(6,e=>{ms(e),is(e)}),_s=M(18,$o),vs=M(8,Yo),ys=M(23,F(jo)),bs=M(25),xs=M(9,e=>bs(e,Os(e))),Ss=(e,t)=>z(e.a,`disabled`,t);function Cs(e){return t=>{ls(e._._._._._,t)}}function ws(e){return function(t){ts(e,t),ns(e,0)}}function Ts(e){return async t=>{if(e.u===t){os(e,null);return}os(e,t),cs(e,null),ls(e,``);try{let n=await H(`/api/repos/branches?repo=${encodeURIComponent(t)}`);e.u===t&&cs(e,n.branches)}catch(t){os(e,null),e.g?.(String(t.message||t))}}}function Es(e){return()=>e.q(!0)}function Ds(e){return async t=>{t&&e.f?.(!0);try{let n=await H(`/api/repos${t?`?refresh`:``}`);Do=n,es(e,n)}catch(t){e.g?.(String(t.message||t))}t&&e.f?.(!1)}}function Os(e){return(t,n)=>{ts(e,``),os(e,null),e.j(t,n)}}R(`l1`,Cs),R(`l0`,ws),R(`l5`,Ts),R(`l2`,Es),R(`l3`,Ds),R(`l4`,Os);var ks=`<div class=manage-backdrop></div><div role=dialog><div class=manage><!></div><!></div>`,As=` b E%l%l`,js=de(2),Ms=L(`h0`,e=>A(e.a,`click`,function(){e._.h?.()})),Ns=ue(0),Ps=P(3,0,e=>Ns(e,e._.n)),Fs=Ps,Is=N(15,L(`h1`,e=>Et(e,{dismissable:e.o,onMount:function(){let t=new AbortController;return window.addEventListener(`keydown`,t=>{t.key!==`Escape`||!this.dismissable||t.target instanceof Element&&t.target.closest(`.palette:not(.inline)`)||t.target instanceof HTMLInputElement&&t.target.value||e.h?.()},{capture:!0,signal:t.signal}),{abort:t}},onDestroy:function(){this.abort.abort()}}))),Ls=M(14,Is),Rs=(e,t)=>Ls(e,t!==!1),zs=L(`h2`,e=>A(e.a,`click`,function(){e.o&&e.h?.()})),Bs=(e,t)=>ht(e.b,[`manage-view`,t]),Vs=(e,t)=>z(e.b,`aria-label`,t),Hs=O(3,`<div class=manage-bar><!></div>`,`D%`,Fs,`<div class=manage-bar><button class="btn primary">Done</button></div>`,`D `,Ms),Us=N(12,e=>Hs(e,e.l?0:e.h?1:2)),Ws=M(7,e=>{Us(e),Is(e)}),Gs=M(11,e=>{Ks(e,e.l?.content),Us(e)}),Ks=M(13,Ps),qs=ks,Js=(e=>`/${e}&`)(As),Ys=new Map,Xs=M(3,e=>{z(e.a,`title`,`Open http://${typeof location>`u`?`localhost`:location.hostname}:${e.d}`),V(e.b,e.d)}),Zs=L(`g23`,e=>A(e.a,`click`,function(){window.open(`http://${location.hostname}:${e.d}`,`_blank`,`noopener`)})),Qs=(e,t)=>Xs(e,t[0]),$s=(e,t)=>V(e.a,t),ec=(e,t)=>$s(e,t[0]),tc=P(2,0,e=>V(e.a,e._.j)),nc=tc,rc=P(0,0,e=>V(e.a,e._.e)),ic=rc,ac=(e,t)=>z(e.a,`title`,t),oc=(e,t)=>V(e.b,t),sc=k(2,`<button class="chip port-link">:<!></button>`,` Db%`,Zs,Qs),cc=(e,t)=>sc(e,[t,e=>String(e)]),lc=M(9,e=>z(e.d,`title`,`Kill ${e.j}`)),uc=L(`g24`,e=>A(e.d,`click`,function(){e._._._.ag(e.j)})),dc=(e,t)=>{ac(e,t[0]?.args),oc(e,t[0]?.cmd),cc(e,t[0]?.ports),lc(e,t[0]?.pid)},fc=P(6,0,e=>z(e.a,`title`,`Confirm #${e._.p} is done — remove from this list`)),pc=L(`g19`,e=>A(e.a,`click`,function(){e._._._._._.a8(e._._.g,e._.p)})),mc=O(6,`<button class=pr-dismiss>✓</button>`,` `,e=>{fc._(e),pc(e)}),hc=N(11,e=>V(e.b,e.j===`OPEN`&&e.k?`draft`:e.j.toLowerCase())),gc=O(2,`<span class="pr-state open" title=Approved>✓</span>`,0,0,`<span class="pr-state closed" title="Changes requested">✗</span>`),_c=N(13,e=>gc(e,e.j===`OPEN`&&e.m===`APPROVED`?0:e.j===`OPEN`&&e.m===`CHANGES_REQUESTED`?1:2)),vc=M(9,e=>{ht(e.a,[`pr-state`,e.j.toLowerCase()]),mc(e,+(e.j===`OPEN`)),hc(e),_c(e)}),yc=M(10,hc),bc=M(12,_c),xc=(e,t)=>z(e.d,`href`,t),Sc=M(15,e=>{V(e.e,e.p),fc(e)}),Cc=(e,t)=>V(e.f,t),wc=(e,t)=>{vc(e,t[0]?.state),yc(e,t[0]?.isDraft),bc(e,t[0]?.reviewDecision),xc(e,t[0]?.url),Sc(e,t[0]?.number),Cc(e,t[0]?.title)},Tc=P(0,0,e=>V(e.b,e._.e)),Ec=L(`g18`,e=>A(e.a,`click`,function(){e._._._.a7()})),Dc=e=>{Tc._(e),Ec(e)},Oc=I(54,e=>V(e.a,e._._.s),e=>e._._),kc=Oc,Ac=N(2,e=>{B(e.a,`armed`,e._._._.r===e._.h),V(e.b,e._._._.r===e._.h?`remove?`:`×`)}),jc=N(3,e=>z(e.a,`title`,e._._._.r===e._.h?`Really remove ${e._.g}/? Uncommitted changes are lost.`:`Remove ${e._.g}/`),2),Mc=I(53,e=>{Ac(e),jc(e)},e=>e._._._),Nc=L(`g21`,e=>A(e.a,`click`,function(){e._._._.r===e._.f?.full_name?(bu(e._._._,null),e._._._.ae(e._.f)):(bu(e._._._,e._.f?.full_name),setTimeout(()=>{bu(e._._._,null)},4e3))})),Pc=e=>{Mc(e),Fc._(e),Ic._(e),Nc(e)},Fc=P(3,1,jc),Ic=P(3,1,e=>{Ac(e),jc(e)}),Lc=I(51,e=>z(e.a,`disabled`,!!e._._.p),e=>e._._),Rc=L(`g15`,e=>A(e.a,`click`,function(){e._._.af(`restore`)})),zc=e=>{Lc(e),Rc(e)},Bc=I(51,e=>{z(e.a,`disabled`,!!e._._.p),V(e.b,e._._.p===`archive`?`Archiving…`:`Archive`)},e=>e._._),Vc=L(`g14`,e=>A(e.a,`click`,function(){e._._.af(`archive`)})),Hc=e=>{Bc(e),Vc(e)},Uc=I(50,e=>V(e.a,e._._.o),e=>e._._),Wc=L(`g17`,e=>A(e.b,`click`,function(){hu(e._._,null)})),Gc=e=>{Uc(e),Wc(e)},Kc=O(3,`<span class=spin></span>`,0,0,`<button class=cur-remove> </button>`,` D `,Pc),qc=N(8,e=>Kc(e,+!e._._.m.has(e.h))),Jc=I(48,qc,e=>e._._),Yc=Jc,Xc=M(6,e=>{V(e.a,e.g),Fc(e)}),Zc=M(7,e=>{V(e.b,e.h),qc(e),Ic(e)}),Qc=O(2,`<span class="cur-base mono" title="Base branch">⎇ <!></span>`,`Db%`,nc),$c=N(11,e=>Qc(e,+(e.j===e.k))),el=M(9,e=>{$c(e),tc(e)}),tl=M(10,$c),nl=(e,t)=>rl(e,t[0]),rl=M(5,e=>{Xc(e,e.f?.worktree),Zc(e,e.f?.full_name),el(e,e.f?.base_branch),tl(e,e.f?.default_branch)}),il=O(0,`<div class="pr-repo-name mono dim"> </div>`,`D `,ic),al=I(46,e=>il(e,e._._._.k>1?0:1),e=>e._._._),ol=al,sl=k(1,`<li><span> </span><!><a class=pr-link target=_blank rel=noopener><span class="dim mono">#<!></span> </a><span class=pr-spacer></span><!></li>`,`D D l%b Eb%l lb%`,0,wc),cl=(e,t)=>sl(e,[t,`number`]),ll=(e,t)=>{ul(e,t[0]?.worktree),cl(e,t[0]?.prs),dl(e,t[0]?.full_name)},ul=M(4,rc),dl=M(6),fl=O(0,`<button class=btn title="Confirm every merged/closed PR is done — remove them from this list">Clear <!> finished</button>`,` Db%`,Dc),pl=M(4,e=>{fl(e,+!e.e),Tc(e)}),ml=k(3,`<div class=pr-repo><!><ul class=pr-list></ul></div>`,`D%b `,ol,ll),hl=I(45,e=>{pl(e,(e._._.j||[]).reduce((e,t)=>e+t.prs.filter(e=>e.state!==`OPEN`).length,0)),ml(e,[e._._.j.filter(e=>e.prs.length),`full_name`])},e=>e._._),gl=L(`g20`,e=>A(e.b,`click`,function(){e._._.a6()})),_l=e=>{hl(e),vl(e),So(e.c),Co(e.c,13),wo(e.c),gl(e)},vl=I(47,e=>{B(e.b,`spinning`,e._._.l),z(e.b,`disabled`,e._._.l)},e=>e._._),yl=k(0,`<li><span class="mono proc-cmd"><!><!></span><button class=proc-kill>×</button></li>`,`D D%b%l `,uc,dc),bl=I(44,e=>yl(e,[e._._.i,`pid`]),e=>e._._),xl=bl,Sl=et(12),Cl=I(43,e=>{B(e.e,`spinning`,e._.h),z(e.e,`disabled`,e._.h)}),wl=L(`g25`,e=>A(e.e,`click`,function(){Sl(e)()})),Tl=e=>{Cl(e),Dl(e),kl(e),Ml(e),Fl(e),Ll(e),zl(e),Bl(e),Hl(e),Ul(e),Wl(e),Gl(e),Kl(e),So(e.f),Co(e.f,13),wo(e.f),Ze(e,9,ql),ds(e.j),gs(e.j,ed(e)),hs(e.j,$u(e)),Ss(e.j),wl(e)},El=O(11,`<section><h3>Processes</h3><ul class=procs></ul></section>`,`Db `,xl),Dl=I(44,e=>El(e,e._.i&&e._.i?.length?0:1)),Ol=O(3,(e=>`<section><div class=repos-head><h3>Pull requests</h3><!><button class=icon-btn title="Refresh PRs">${e}</button></div><!></section>`)(bo),(e=>`Eb%b D/${e}&m%l`)(xo),_l),kl=I(45,e=>Ol(e,e._.j&&e._.j.some(e=>e.prs.length)?0:1)),Al=k(7,`<li class="cur-repo pending"><span class=spin></span><span class="dim cur-full"> </span></li>`,`DbD `,0,ec),jl=N(13,e=>Al(e,[[...e._.m].filter(t=>!e._.a9.has(t)),e=>e])),Ml=I(48,jl),Nl=O(8,`<li class="dim empty-note">No repos yet — search below to add one.</li>`),Pl=N(14,e=>Nl(e,!e._.a1&&!e._.n?0:1)),Fl=I(49,Pl),Il=O(2,`<p class=toast-error><!> <button>×</button></p>`,`D%c `,Gc),Ll=I(50,e=>Il(e,+!e._.o)),Rl=k(6,`<li class=cur-repo><span class="mono cur-worktree"><!>/</span><span class="dim cur-full"> </span><!><!></li>`,`E%lD l%b%`,Yc,nl),zl=I(55,e=>Rl(e,[e._.w,`full_name`])),Bl=I(56,e=>V(e.a,e._.x)),Vl=N(15,e=>V(e.b,e._.z||e._.a0)),Hl=I(58,Vl),Ul=I(59,Vl),Wl=I(60,Pl),Gl=I(61,e=>{vs(e.j,e._.a9),jl(e)}),Kl=I(62,e=>xs(e.j,td(e))),ql=it(`g22`,M(12)),Jl=ut(`g27`,((e,t)=>`<header class=manage-head><div><h2> </h2><p class="dim mono"> </p></div></header><!><!><section><div class=repos-head><h3>Repos</h3><button class=icon-btn title="Refresh repo list">${e}</button></div><ul class=cur-repos><!><!><!></ul>${t}</section><!><!>`)(bo,To),((e,t)=>`F lD n%b%bEb D/${e}&mD%b%b%l0${t}&l%c`)(xo,Eo),Tl,0,`B2`),Yl=O(1,`<span class="act-step dim"><span class=spin></span> </span>`,`Db `,kc),Xl=N(6,e=>Yl(e,e._.p&&e._.s?0:1)),Zl=N(5,e=>V(e.e,e._.p===`delete`?`Deleting…`:e._.q?`Really delete?`:`Delete`)),Ql=I(51,e=>{z(e.a,`disabled`,!!e._.p),z(e.d,`disabled`,!!e._.p),Xl(e),Zl(e)}),$l=L(`g16`,e=>{A(e.a,`click`,function(){e._.g?.()}),A(e.d,`click`,function(){e._.q?(yu(e._,!1),e._.af(`delete`)):(yu(e._,!0),setTimeout(()=>{yu(e._,!1)},4e3))})}),eu=e=>{Ql(e),tu(e),nu(e),iu(e),$l(e)},tu=I(52,e=>{B(e.d,`armed`,e._.q),Zl(e)}),nu=I(54,Xl),ru=O(2,`<button class=btn> </button>`,` D `,Hc,`<button class=btn>Restore</button>`,` `,zc),iu=I(57,e=>ru(e,e._.y===`active`?0:1)),au=dt(`g26`,`<button class="btn primary">Done</button><!><div class=spacer></div><!><button class="btn danger"> </button>`,` b%c%b D `,eu),ou=j(7,F(Cl)),su=j(11,F(vl)),cu=M(39,F(Kl)),lu=N(38,e=>cu(e,nd(e)),3),uu=M(40),du=N(37,e=>uu(e,rd(e)),3),fu=M(36,e=>{lu(e),du(e)}),pu=F(Ml,Jc),mu=j(12,e=>{ju(e,e.m?.size),fu(e,id(e)),lu(e),du(e),pu(e)}),hu=j(14,F(Ll,Uc)),gu=N(31,L(`g28`,e=>Et(e,{busyCount:e.n,pendingAction:e.p,onMount:function(){let t=new AbortController,n=t.signal;return kn().addEventListener(`workspace.progress`,t=>{(this.pendingAction||this.busyCount)&&t.data?.message&&t.data.op===e.u&&xu(e,t.data.message)},{signal:n}),e.a2(n),e.a3(n,!1).then(()=>e.a3(n,!0)),{abort:t}},onDestroy:function(){this.abort.abort()}})),4),_u=F(Ql,Bc,Lc),vu=j(15,e=>{gu(e),_u(e)}),yu=j(16,F(tu)),bu=j(17,F(Mc)),xu=j(18,F(nu,Oc));function Su(e){zs(e.a),Gs(e.a,on({content:au(e)})),js(e.a,Jl(e)),Rs(e.a),Bs(e.a),ou(e,!1),su(e,!1),mu(e,new Set),hu(e,null),vu(e,null),yu(e,!1),bu(e,null),xu(e,null)}var Cu=j(8,F(Dl,bl)),wu=M(33),Tu=N(30,e=>wu(e,ad(e)),2),Eu=F(kl,hl),Du=j(9,e=>{ku(e,e.j?.length),Tu(e),Eu(e)}),Ou=(e,t)=>{Cu(e,Ys.get(`procs:${t}`)||null),Du(e,Ys.get(`prs:${t}`)||null)},ku=M(10,F(al)),Au=F(Fl),ju=M(13,e=>{gu(e),Au(e)}),Mu=M(19,e=>{Bu(e,e.t?.id),Uu(e,e.t?.repos),Ku(e,e.t?.name),qu(e,e.t?.status),Ju(e,e.t?.display_path),Yu(e,e.t?.path),du(e)}),Nu=M(42),Pu=M(28,e=>{Nu(e,od(e)),gu(e)}),Fu=M(32),Iu=M(29,e=>{Fu(e,cd(e)),gu(e),Tu(e)}),Lu=M(34),Ru=M(41),zu=N(21,e=>Ru(e,dd(e))),Bu=M(20,e=>{Pu(e,sd(e)),Iu(e,ld(e)),Lu(e,ud(e)),gu(e),Tu(e),lu(e),zu(e)}),Vu=M(35,F(Gl)),Hu=F(zl),Uu=M(22,e=>{Wu(e,e.w?.length),Vu(e,new Set(e.w.map(e=>e.full_name))),Hu(e)}),Wu=M(27,F(Wl)),Gu=F(Bl),Ku=M(23,e=>{Vs(e.a,`Manage ${e.x}`),Gu(e)}),qu=M(24,F(iu)),Ju=M(25,F(Hl)),Yu=M(26,F(Ul)),Xu=(e,t)=>{Ou(e,t?.id),Mu(e,t)},Zu=M(5,e=>{lu(e),du(e)}),Qu=M(6,e=>{Ws(e.a,fd(e)),zu(e)});function $u(e){return function(t){ou(e._,t)}}function ed(e){return function(t){hu(e._,t)}}function td(e){return function(t,n){e._.ad(t,n)}}function nd(e){return async(t,n)=>{if(!(!t||e.m.has(t))){hu(e,null),e.aa(t,!0);try{let r=await H(`/api/workspaces/${e.u}/repos`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t,baseBranch:n})});e.f?.(r)}catch(t){hu(e,String(t.message||t))}e.aa(t,!1)}}}function rd(e){return async t=>{if(!e.m.has(t.full_name)){hu(e,null),e.aa(t.full_name,!0);try{await H(`/api/workspaces/${e.t?.id}/repos/${encodeURIComponent(t.worktree)}`,{method:`DELETE`}),e.f?.({...e.t,repos:(e.t?.repos).filter(e=>e.full_name!==t.full_name)})}catch(t){hu(e,String(t.message||t))}e.aa(t.full_name,!1)}}}function id(e){return(t,n)=>{let r=new Set(e.m);n?r.add(t):r.delete(t),mu(e,r)}}function ad(e){return async()=>{for(let t of e.j||[])for(let n of t.prs)n.state!==`OPEN`&&await H(`/api/workspaces/${e.u}/prs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t.full_name,number:n.number})}).catch(()=>{});await e.a3(void 0,!1)}}function od(e){return async t=>{await fetch(`/api/procs/${t}`,{method:`DELETE`}),setTimeout(()=>e.a2(void 0),500)}}function sd(e){return async t=>{try{let n=await H(`/api/workspaces/${e.u}/procs`,{signal:t});Cu(e,n),Ys.set(`procs:${e.u}`,n)}catch{}}}function cd(e){return async()=>{su(e,!0),await e.a3(void 0,!0),su(e,!1)}}function ld(e){return async(t,n)=>{try{let r=await H(`/api/workspaces/${e.u}/prs${n?`?refresh`:``}`,{signal:t});Du(e,r),Ys.set(`prs:${e.u}`,r)}catch{}}}function ud(e){return async(t,n)=>{hu(e,null);try{let r=await H(`/api/workspaces/${e.u}/prs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t,number:n})});Du(e,r),Ys.set(`prs:${e.u}`,r)}catch(t){hu(e,String(t.message||t))}}}function dd(e){return async t=>{hu(e,null),vu(e,t),xu(e,null);try{await H(`/api/workspaces/${e.u}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:t})}),t===`delete`&&e.g?.()}catch(t){hu(e,String(t.message||t))}finally{vu(e,null),xu(e,null)}}}function fd(e){return function(){e.g?.()}}R(`g13`,$u),R(`g12`,ed),R(`g11`,td),R(`g6`,nd),R(`g7`,rd),R(`g5`,id),R(`g3`,ad),R(`g9`,od),R(`g0`,sd),R(`g2`,cd),R(`g1`,ld),R(`g4`,ud),R(`g8`,dd),R(`g10`,fd);var pd=ks,md=(e=>`/${e}&`)(As),hd=P(1,0,e=>V(e.a,e._.g)),gd=hd,_d=O(1,`<span class=spin></span>`,0,0,`<span class=step-done>✓</span>`),vd=I(30,e=>{B(e.a,`active`,e.M===e._._._.m-1),_d(e,e.M===e._._._.m-1?0:1)},e=>e._._._),yd=vd,bd=(e,t)=>V(e.c,t),xd=k(0,`<li><!><!></li>`,` D%b%`,yd,(e,t)=>bd(e,t[0])),Sd=I(29,e=>xd(e,[e._._.l]),e=>e._._),Cd=Sd,wd=I(28,e=>V(e.a,e._._.k),e=>e._._),Td=L(`i10`,e=>A(e.b,`click`,function(){_f(e._._,null)})),Ed=e=>{wd(e),Td(e)},Dd=I(27,e=>z(e.c,`disabled`,e._._.j),e=>e._._),Od=L(`i11`,e=>A(e.c,`click`,function(){e._._.v(e.f)})),kd=e=>{Dd(e),Od(e)},Ad=M(5,e=>{V(e.a,e.f),z(e.c,`title`,`Remove ${e.f}`)}),jd=O(1,`<span class="cur-base mono" title="Base branch">⎇ <!></span>`,`Db%`,gd),Md=M(6,e=>{jd(e,+!e.g),hd(e)}),Nd=(e,t)=>{Ad(e,t[0]?.fullName),Md(e,t[0]?.baseBranch)},Pd=et(9),Fd=I(23,e=>Ft(e,`b`,e._.f,Af(e))),Id=L(`i13`,e=>{It(e,`b`),A(e.c,`click`,function(){Pd(e)()})}),Ld=e=>{Fd(e),Rd(e),Bd(e),Hd(e),Gd(e),qd(e),Jd(e),Yd(e),So(e.d),Co(e.d,13),wo(e.d),Ze(e,6,Xd),ds(e.g),gs(e.g,Mf(e)),hs(e.g,jf(e)),Id(e)},Rd=I(24,e=>{B(e.c,`spinning`,e._.g),z(e.c,`disabled`,e._.g)}),zd=k(4,`<li class=cur-repo><span class=cur-full> </span><!><button class=cur-remove>×</button></li>`,`E l%b `,kd,Nd),Bd=I(25,e=>{vs(e.g,new Set(e._.h.map(e=>e.fullName))),zd(e,[e._.h,`fullName`])}),Vd=O(5,`<li class="dim empty-note">No repos yet — search below to add one (or create empty).</li>`),Hd=I(26,e=>Vd(e,+!!e._.i)),Ud=O(8,`<ul class=steps></ul>`,` `,Cd),Wd=N(10,e=>Ud(e,e._.j&&e._.m?0:1)),Gd=I(27,e=>{z(e.b,`disabled`,e._.j),Ss(e.g,e._.j),Wd(e)}),Kd=O(0,`<p class=toast-error><!> <button>×</button></p>`,`D%c `,Ed),qd=I(28,e=>Kd(e,+!e._.k)),Jd=I(30,Wd),Yd=I(31,e=>xs(e.g,Nf(e))),Xd=it(`i12`,M(9)),Zd=ut(`i15`,((e,t)=>`<header class=manage-head><div><h2>New workspace</h2></div></header><!><label class=field><span>Name</span><input placeholder=my-feature autofocus></label><section><div class=repos-head><h3>Repos</h3><button class=icon-btn title="Refresh repo list">${e}</button></div><ul class=cur-repos><!><!></ul>${t}</section><!><!>`)(bo,To),((e,t)=>`b%bDb lEb D/${e}&mD%b%l0${t}&l%c`)(xo,Eo),Ld,0,`B2`),Qd=N(3,e=>z(e.a,`disabled`,e._.j||!e._.f.trim())),$d=I(23,Qd),ef=L(`i9`,e=>{A(e.a,`click`,function(){e._.w()}),A(e.c,`click`,function(){e._.e?.()})}),tf=e=>{$d(e),nf(e),ef(e)},nf=I(27,e=>{V(e.b,e._.j?`Creating…`:`Create workspace`),z(e.c,`disabled`,e._.j),Qd(e)}),rf=dt(`i14`,`<button class="btn primary"> </button><div class=spacer></div><button class=btn>Cancel</button>`,` D lb `,tf),af=M(22),of=N(19,e=>af(e,Pf(e)),5),sf=F($d,Fd),cf=j(5,e=>{of(e),sf(e)}),lf=j(6,F(Rd)),uf=M(20,F(Yd)),df=M(21),ff=F(Bd),pf=j(7,e=>{wf(e,e.h?.length),uf(e,Ff(e)),df(e,If(e)),of(e),ff(e)}),mf=N(18,L(`i16`,e=>Et(e,{busy:e.j,onMount:function(){let t=new AbortController;return kn().addEventListener(`workspace.progress`,t=>{this.busy&&t.data?.message&&e.r([t.data])},{signal:t.signal}),{abort:t}},onDestroy:function(){this.abort.abort()}}))),hf=F(nf,Gd,Dd),gf=j(9,e=>{Rs(e.a,!e.j),mf(e),hf(e)}),_f=j(10,F(qd,wd)),vf=M(17,e=>{mf(e),of(e)}),yf=N(16,e=>vf(e,Lf(e)),2),bf=F(Sd),xf=j(11,e=>{Tf(e,e.l?.length),yf(e),bf(e)}),Sf=(e,t)=>{Ef(e,t.op),Df(e,t.last)};function Cf(e){zs(e.a),Gs(e.a,on({content:rf(e)})),js(e.a,Zd(e)),Vs(e.a,`New workspace`),Bs(e.a,`new-ws`),cf(e,``),lf(e,!1),pf(e,[]),gf(e,!1),_f(e,null),xf(e,[]),Sf(e,{last:0,op:``})}var wf=M(8,F(Hd)),Tf=M(12,F(Jd,vd)),Ef=M(14,e=>{yf(e),of(e)}),Df=M(15,e=>{yf(e),of(e)}),Of=M(3,of),kf=M(4,e=>Ws(e.a,Rf(e)));function Af(e){return t=>{cf(e._,t)}}function jf(e){return function(t){lf(e._,t)}}function Mf(e){return function(t){_f(e._,t)}}function Nf(e){return function(t,n){e._.u(t,n)}}function Pf(e){return async()=>{gf(e,!0),_f(e,null),xf(e,[]),e.o=Math.random().toString(36).slice(2,10);try{e.p=(await H(`/api/progress`)).seq}catch{}let t=setInterval(async()=>{try{let t=await H(`/api/progress?since=${e.p}&op=${e.o}`);e.r(t.messages)}catch{}},800);try{let t=await H(`/api/workspaces`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:e.f,repos:e.h,opId:e.o})});gf(e,!1),e.d?.(t)}catch(t){gf(e,!1),_f(e,String(t.message||t))}finally{clearInterval(t)}}}function Ff(e){return(t,n)=>{!t||e.h.some(e=>e.fullName===t)||pf(e,e.h.concat({fullName:t,baseBranch:n}))}}function If(e){return t=>{pf(e,e.h.filter(e=>e.fullName!==t))}}function Lf(e){return t=>{for(let n of t)n.op===e.o&&(n.seq&&n.seq<=e.p||(n.seq&&(e.p=n.seq),xf(e,e.l.concat(n.message))))}}function Rf(e){return function(){e.e?.()}}R(`i0`,Af),R(`i8`,jf),R(`i7`,Mf),R(`i6`,Nf),R(`i4`,Pf),R(`i2`,Ff),R(`i3`,If),R(`i1`,Lf),R(`i5`,Rf);var zf=gr,Bf=(e=>`/${e}&`)(_r);function Vf(e){xr(e.a,`M14.3632 5.65156L15.8431 4.17157C16.6242 3.39052 17.8905 3.39052 18.6716 4.17157L20.0858 5.58579C20.8668 6.36683 20.8668 7.63316 20.0858 8.41421L18.6058 9.8942M14.3632 5.65156L4.74749 15.2672C4.41542 15.5993 4.21079 16.0376 4.16947 16.5054L3.92738 19.2459C3.87261 19.8659 4.39148 20.3848 5.0115 20.33L7.75191 20.0879C8.21972 20.0466 8.65806 19.8419 8.99013 19.5099L18.6058 9.8942M14.3632 5.65156L18.6058 9.8942`)}var Hf=(e,t)=>yr(e.a,t),Uf=(e,t)=>br(e.a,t),Wf=`<!><!><!>`,Gf=N(9,e=>B(e.d,`armed`,e._._._._.w===e.i)),Kf=N(10,e=>z(e.d,`title`,e._._._._.w===e.i?`Really kill ${e.g}?`:`Kill ${e.g} (pid ${e.i})`),2),qf=I(39,e=>{Gf(e),Kf(e)},e=>e._._._._),Jf=L(`m8`,e=>{A(e.b,`click`,function(){window.open(`http://${location.hostname}:${e.h}`,`_blank`,`noopener`)}),A(e.d,`click`,function(){e._._._._.w===e.i?(pm(e._._._._,null),fetch(`/api/procs/${e.i}`,{method:`DELETE`}).catch(()=>{})):e._._._._.z(()=>{pm(e._._._._,e.i)})})}),Yf=e=>{qf(e),Jf(e)},Xf=M(6,e=>{z(e.a,`title`,e.g),Kf(e)}),Zf=M(7,e=>{z(e.b,`title`,`Open http://${typeof location>`u`?`localhost`:location.hostname}:${e.h}`),V(e.c,e.h)}),Qf=M(8,e=>{Gf(e),Kf(e)}),$f=(e,t)=>{Xf(e,t[0]?.cmd),Zf(e,t[0]?.port),Qf(e,t[0]?.pid)},ep=N(12,e=>V(e.b,e._._.c(e._.c))),tp=I(3,ep,e=>e._._),np=L(`m7`,e=>A(e.a,`click`,function(){e._._._._._.u?.(e._.e,e.l)})),rp=e=>{tp(e),ip._(e),op._(e),np(e)},ip=Ke(0,ep),ap=N(10,e=>z(e.a,`title`,`${e._.e} — ${e.j}${e.h===`APPROVED`?` (approved)`:e.h===`CHANGES_REQUESTED`?` (changes requested)`:``}`),2),op=Ke(0,ap),sp=N(8,e=>gt(e.a,{draft:e.g,rejected:e.h===`CHANGES_REQUESTED`})),cp=M(6,sp),lp=M(7,e=>{V(e.d,e.h===`APPROVED`?` ✓`:e.h===`CHANGES_REQUESTED`?` ✗`:``),sp(e),ap(e)}),up=M(9,ap),dp=M(11,e=>V(e.c,e.l)),fp=k(0,`<button class="chip pr"><!>#<!><!></button>`,` D%c%b%`,rp,(e,t)=>{cp(e,t[0]?.isDraft),lp(e,t[0]?.reviewDecision),up(e,t[0]?.title),dp(e,t[0]?.number)}),pp=(e,t)=>fp(e,[t||[],`number`]),mp=(e,t)=>hp(e,t[0]),hp=M(2,e=>{pp(e,e.c?.prs),gp(e,e.c?.worktree),ip(e)}),gp=M(4,op),_p=M(2,F(tp)),vp=k(0,`<!><!><!>`,`b%`,0,mp),yp=I(6,e=>{_p(e,zm(e)),vp(e,[e._._.c||[],`full_name`])},e=>e._._),bp=e=>{yp(e),Sp(e)},xp=k(1,`<span class="chip port-chip"><button class=port-open>:<!></button><button class=port-kill>×</button></span>`,` D Db%l `,Yf,$f),Sp=I(7,e=>xp(e,[e._._.d||[],`port`]),e=>e._._),Cp=N(11,e=>B(e.a,`current`,e.k===e._._._.q)),wp=I(37,Cp,e=>e._._._),Tp=L(`m6`,e=>{A(e.b,`click`,function(){e._._._.r?.(e.k)}),A(e.f,`click`,function(){e._._._.s?.(e.j)}),A(e.h,`click`,function(){e._._._.v===e.k?(fm(e._._._,null),e._._._.t?.(e.k)):e._._._.z(()=>{fm(e._._._,e.k)})})}),Ep=e=>{wp(e),Op(e),e.d,Kr(e.d,13),Xr(e.d,`sess-icon`),Vf(e.g),Hf(e.g,12),Uf(e.g),Tp(e)},Dp=N(12,e=>{B(e.h,`armed`,e._._._.v===e.k),z(e.h,`title`,e._._._.v===e.k?`Really kill this session?`:`Kill session`)}),Op=I(38,Dp,e=>e._._._),vee=M(10,e=>{Cp(e),Dp(e)}),yee=(e,t)=>ht(e.c,[`dot`,hr(t)]),kp=N(16,e=>V(e.e,e.p||e.o)),bee=M(14,e=>{Yr(e.d,e.o),kp(e)}),xee=M(15,kp),See=(e,t)=>Cee(e,t[0]),Cee=M(9,e=>{vee(e,e.j?.id),yee(e,e.j?.state),bee(e,e.j?.agent),xee(e,e.j?.title)}),wee=L(`m4`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._._.n?.(e.e)})),Tee=e=>{e.b,Kr(e.b,14),Xr(e.b),wee(e)},Eee=M(4,e=>{Yr(e.b,e.e),V(e.c,e.e)}),Dee=k(2,(e=>`<button>${e}<!></button>`)(Lr),(e=>` D/${e}&%l`)(`b%c`),Tee,(e,t)=>Eee(e,t[0])),Ap=I(35,e=>Dee(e,[[...e._._._.o||[],`shell`],e=>e]),e=>e._._._),Oee=(e,t)=>{z(e.a,`popovertarget`,t),z(e.c,`id`,t)},kee=L(`m5`,e=>A(e.c,`toggle`,function(t,n){if(t.newState===`open`){let t=e.a.getBoundingClientRect();n.style.top=`${t.bottom+4}px`,n.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-n.offsetWidth-8))}px`}})),jp=e=>{Ap(e),e.b,Yr(e.b,`shell`),Kr(e.b,12),Xr(e.b),Oee(e,Qe(e)),kee(e)},Mp=L(`m3`,e=>A(e.a,`click`,function(){e._._._.l?.()})),Np=e=>{wr(e.b),Tr(e.b,12),Er(e.b),Mp(e)},Pp=I(31,e=>B(e.a,`current`,e._._.i),e=>e._._),Fp=L(`m9`,e=>{A(e.b,`click`,function(){e._._.j()}),A(e.f,`click`,function(){e._._.m?.()})}),Ip=e=>{Pp(e),Rp(e),Bp(e),Up(e),Wp(e),qp._(e),Jp._(e),Yp._(e),kr(e.g),Ar(e.g,12),jr(e.g),Fp(e)},Lp=O(4,(e=>`<button class="row-icon new-sess" title="Review changes">${e}</button>`)(Sr),(e=>` D/${e}&l`)(Cr),Np),Rp=I(33,e=>Lp(e,+!e._._.l),e=>e._._),zp=O(7,(e=>`<button class="row-icon new-sess" title="New session">${e}</button><div popover=auto class=new-session-pop></div>`)(Lr),(e=>` D/${e}&l b`)(`b%c`),jp),Bp=I(34,e=>zp(e,+!e._._.n),e=>e._._),Vp=k(8,((e,t)=>`<div class=side-sess><button class=side-sess-btn><span></span>${e}<!></button><button class=row-icon title="Rename session">${t}</button><button class=close>×</button></div>`)(Lr,zf),((e,t)=>` D D b/${e}&%l D/${t}&l l`)(`b%c`,Bf),Ep,See),Hp=(e,t)=>Vp(e,[t.length>1?t:[],`id`]),Up=I(36,e=>Hp(e,e._._.p||[]),e=>e._._),Wp=I(40,e=>V(e.d,e._._.a1),e=>e._._),Gp=O(9,`<div class=side-chips><!><!></div>`,`D%b%`,bp),Kp=N(11,e=>Gp(e,(e._.c||[]).some(e=>(e.prs||[]).length)||(e._.d||[]).length?0:1)),qp=P(0,1,Kp),Jp=P(0,1,Kp),Yp=P(0,1,e=>ht(e.c,[`dot`,e._.e])),Xp=I(31,e=>B(e.a,`current`,e._._.i),e=>e._._),Aee=L(`m2`,e=>A(e.a,`click`,function(){e._._.j()})),jee=e=>{Xp(e),Zp(e),Qp(e),$p._(e),Aee(e)},Zp=I(32,e=>V(e.b,(e._._.k??0)+1),e=>e._._),Qp=I(40,e=>z(e.a,`title`,e._._.a1),e=>e._._),$p=P(0,0,e=>ht(e.c,[`dot`,e._.e])),em=M(4,e=>{$p(e),Yp(e)}),tm=(e,t)=>{lm(e,t?.repos),dm(e,t?.ports),em(e,mr(t))},nm=N(5,e=>tm(e,e._.g[e._.e])),rm=P(0,0,nm),im=e=>{rm._(e),am._(e),sm._(e)},am=P(0,0,nm),om=O(0,`<button class="icon-btn rail-btn"> <span></span></button>`,` D b `,jee,(e=>`<section class=side-ws><div class=side-ws-row><button class=side-ws-btn><span></span><span class=side-ws-name> </span></button><!><button class=row-icon title="Manage workspace">${e}</button><!></div><div class=side-sessions><!><!></div></section>`)(Dr),(e=>` E D bD m%b D/${e}&l%lD%b%m`)(Or),Ip),sm=P(0,0,e=>om(e,+!e._.h)),cm=F(yp),lm=M(2,e=>{qp(e),cm(e)}),um=F(Sp),dm=M(3,e=>{Jp(e),um(e)}),fm=j(21,F(Op)),pm=j(22,F(qf)),mm=(e,t)=>_m(e,t.timer);function hm(e){fm(e,null),pm(e,null),mm(e,{timer:0})}var gm=M(25),_m=M(24,e=>gm(e,Bm(e))),vm=O(0,`<!><!><!>`,`b%`,im),ym=(e,t)=>{bm(e,t?.name),vm(e,+!t)},bm=M(27,F(Qp,Wp)),xm=N(5,e=>ym(e,e.d.find(t=>t.id===e.e))),Sm=M(3,xm),Cm=M(4,e=>{xm(e),rm(e)}),wm=M(6,am),Tm=M(7,sm),Em=M(8,F(Xp,Pp)),Dm=M(9),Om=M(10,F(Zp)),km=M(11,F(Rp)),Am=M(12),jm=M(13,F(Bp)),Mm=M(14,F(Ap)),Nm=M(15,F(Up)),Pm=M(16,F(wp)),Fm=M(17),Im=M(18),Lm=M(19),Rm=M(20);function zm(e){return t=>{let n=e._._.c||[];if(n.length<2)return``;let r=t.full_name.split(`/`)[1];return n.some(e=>e.full_name!==t.full_name&&e.full_name.split(`/`)[1]===r)?t.full_name:r}}function Bm(e){return t=>{clearTimeout(e.y),t(),e.y=setTimeout(()=>{fm(e,null),pm(e,null)},3500)}}R(`m1`,zm),R(`m0`,Bm);var Vm=gr,Hm=(e=>`/${e}&`)(_r);function Um(e){xr(e.a,`M19 21L5 21C3.89543 21 3 20.1046 3 19L3 5C3 3.89543 3.89543 3 5 3L19 3C20.1046 3 21 3.89543 21 5L21 19C21 20.1046 20.1046 21 19 21Z M7.25 10L5.5 12L7.25 14 M9.5 21V3`)}var Wm=(e,t)=>yr(e.a,t),Gm=(e,t)=>br(e.a,t),Km=gr,qm=(e=>`/${e}&`)(_r);function Jm(e){xr(e.a,`M19 21L5 21C3.89543 21 3 20.1046 3 19L3 5C3 3.89543 3.89543 3 5 3L19 3C20.1046 3 21 3.89543 21 5L21 19C21 20.1046 20.1046 21 19 21Z M9.5 21V3 M5.5 10L7.25 12L5.5 14`)}var Ym=(e,t)=>yr(e.a,t),Xm=(e,t)=>br(e.a,t),Zm=gr,Qm=(e=>`/${e}&`)(_r);function $m(e){xr(e.a,`M18 8.4C18 6.70261 17.3679 5.07475 16.2426 3.87452C15.1174 2.67428 13.5913 2 12 2C10.4087 2 8.88258 2.67428 7.75736 3.87452C6.63214 5.07475 6 6.70261 6 8.4C6 15.8667 3 18 3 18H21C21 18 18 15.8667 18 8.4Z M13.73 21C13.5542 21.3031 13.3019 21.5547 12.9982 21.7295C12.6946 21.9044 12.3504 21.9965 12 21.9965C11.6496 21.9965 11.3054 21.9044 11.0018 21.7295C10.6982 21.5547 10.4458 21.3031 10.27 21`)}var eh=(e,t)=>yr(e.a,t),th=(e,t)=>br(e.a,t),nh=gr,rh=(e=>`/${e}&`)(_r);function ih(e){xr(e.a,`M3 12H6L9 3L15 21L18 12H21`)}var ah=(e,t)=>yr(e.a,t),oh=(e,t)=>br(e.a,t),sh=gr,ch=(e=>`/${e}&`)(_r);function lh(e){xr(e.a,`M18 6H20M22 6H20M20 6V4M20 6V8 M21.4 20H2.6C2.26863 20 2 19.7314 2 19.4V11H21.4C21.7314 11 22 11.2686 22 11.6V19.4C22 19.7314 21.7314 20 21.4 20Z M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H14`)}var uh=(e,t)=>yr(e.a,t),dh=(e,t)=>br(e.a,t),fh=((e,t)=>`<!><!><aside class=side-nav><div class=side-list></div><!><div class=side-foot><button class="icon-btn nav-toggle"></button><div class=spacer></div><!><button class=icon-btn title=Usage>${e}</button><button class=icon-btn title="New workspace">${t}</button></div></aside>`)(nh,sh),ph=((e,t)=>`b%b D b%bD c%b D/${e}&l D/${t}&n`)(rh,ch),mh=e=>{Jm(e.a),Ym(e.a,15),Xm(e.a)},hh=e=>{Um(e.a),Wm(e.a,15),Gm(e.a)},gh=P(5,0,e=>{B(e.a,`on`,e._.an),z(e.a,`title`,e._.an?`Disable agent-waiting notifications`:`Notify when an agent is waiting`)}),_h=L(`n19`,e=>A(e.a,`click`,function(){e._.ap()})),vh=e=>{gh._(e),$m(e.b),eh(e.b,15),th(e.b),_h(e)},yh=L(`n16`,e=>A(e.a,`click`,function(){Xg(e._,!1)})),bh=N(7,e=>km(e.b,N_(e)),4),xh=I(56,bh,e=>e._._),Sh=L(`n18`,e=>{A(e.a,`mouseenter`,function(){e._.i()}),A(e.a,`mouseleave`,function(){e._.j()})}),Ch=e=>{xh(e),wh(e),Eh(e),Dh(e),kh(e),Ah(e),jh(e),Ph(e),Fh(e),Ih(e),Lh(e),Rh(e),Bh._(e),Hh._(e),Uh._(e),hm(e.b),Am(e.b,P_(e)),Tm(e.b),Om(e.b),Sh(e)},wh=I(57,e=>Mm(e.b,e._._.a2),e=>e._._),Th=N(3,e=>jm(e.b,F_(e))),Eh=I(58,Th,e=>e._._),Dh=I(59,bh,e=>e._._),Oh=N(5,e=>Nm(e.b,e.c===e._._.ad&&e._._.a5?e._._.a5:e._._.as[e.c]?.sessions||[]),3),kh=I(60,Oh,e=>e._._),Ah=I(61,e=>Im(e.b,e._._.a7),e=>e._._),jh=I(62,e=>Lm(e.b,e._._.a8),e=>e._._),Mh=N(4,e=>Em(e.b,e.c===e._._.ad)),Nh=N(6,e=>Pm(e.b,e.c===e._._.ad&&e._._.ah===`term`?e._._.af:null),3),Ph=I(63,e=>{Dm(e.b,R_(e)),Rm(e.b,L_(e)),Fm(e.b,I_(e)),Mh(e),bh(e),Oh(e),Nh(e)},e=>e._._),Fh=I(64,Nh,e=>e._._),Ih=I(65,e=>{bh(e),Nh(e)},e=>e._._),Lh=I(68,e=>Sm(e.b,e._._.ar),e=>e._._),Rh=I(69,e=>{wm(e.b,e._._.as),Oh(e)},e=>e._._),zh=M(2,e=>{Cm(e.b,e.c),Mh(e),Th(e),bh(e),Oh(e),Nh(e)}),Bh=P(1,0,e=>zh(e,e._.d)),Vh=N(8,e=>_t(e.a,`top:${e._.e}px;left:${e._.f}px`)),Hh=P(1,0,Vh),Uh=P(1,0,Vh),Wh=N(4,e=>Em(e.b,e.d===e._._.ad)),Gh=I(63,e=>{Dm(e.b,z_(e)),Wh(e)},e=>e._._),Mee=L(`n17`,e=>{A(e.a,`mouseenter`,function(t,n){e._.i();let r=n.getBoundingClientRect();$h(e._,{id:e.d,top:r.top,left:r.right+8})}),A(e.a,`mouseleave`,function(){e._.j()})}),Nee=e=>{Gh(e),Kh(e),qh(e),hm(e.b),Tm(e.b,!0),km(e.b),Am(e.b),jm(e.b),Mm(e.b),Nm(e.b),Pm(e.b),Fm(e.b),Im(e.b),Lm(e.b),Rm(e.b),Mee(e)},Kh=I(68,e=>Sm(e.b,e._._.ar),e=>e._._),qh=I(69,e=>wm(e.b,e._._.as),e=>e._._),Jh=(e,t)=>Om(e.b,t),Yh=M(3,e=>{Cm(e.b,e.d),Wh(e)}),Xh=k(0,(e=>`<span>${e}</span>`)(Wf),(e=>` D/${e}&l`)(`b%c`),Nee,(e,t)=>{Yh(e,t[0]),Jh(e,t[1])}),Zh=P(3,0,e=>Xh(e,[e._.aq,e=>e])),Qh=O(1,(e=>`<div class=rail-pop>${e}</div>`)(Wf),(e=>` D/${e}&l`)(`b%c`),Ch),$h=j(2,e=>{ng(e,e.c?.id),rg(e,e.c?.top),ig(e,e.c?.left),Qh(e,+!e.c)}),eg=(e,t)=>sg(e,t.timer),tg=e=>{Zh._(e),$h(e,null),eg(e,{timer:0})},ng=M(3,Bh),rg=M(4,Hh),ig=M(5,Uh),ag=M(8),og=M(9),sg=M(7,e=>{ag(e,B_(e)),og(e,V_(e))}),cg=N(7,e=>km(e.a,H_(e)),4),lg=Ke(2,cg),ug=e=>{lg._(e),dg._(e),pg._(e),mg._(e),gg._(e),_g._(e),vg._(e),bg._(e),xg._(e),Sg._(e),Cg._(e),wg._(e),hm(e.a),Am(e.a,U_(e)),Tm(e.a),Om(e.a)},dg=Ke(2,e=>Mm(e.a,e._.a2)),fg=N(3,e=>jm(e.a,W_(e))),pg=Ke(2,fg),mg=Ke(2,cg),hg=N(5,e=>Nm(e.a,e.c===e._.ad&&e._.a5?e._.a5:e._.as[e.c]?.sessions||[]),3),gg=Ke(2,hg),_g=Ke(2,e=>Im(e.a,e._.a7)),vg=Ke(2,e=>Lm(e.a,e._.a8)),yg=N(6,e=>Pm(e.a,e.c===e._.ad&&e._.ah===`term`?e._.af:null),3),bg=qe(2,39,2,e=>{Em(e.a,e.c===e._.ad),Dm(e.a,q_(e)),Rm(e.a,K_(e)),Fm(e.a,G_(e)),cg(e),hg(e),yg(e)}),xg=Ke(2,yg),Sg=Ke(2,e=>{cg(e),yg(e)}),Cg=Ke(2,e=>Sm(e.a,e._.ar)),wg=Ke(2,e=>{wm(e.a,e._.as),hg(e)}),Tg=M(2,e=>{Cm(e.a,e.c),fg(e),cg(e),hg(e),yg(e)}),Eg=(e,t)=>Tg(e,t[0]),Dg=F(Kh,Lh),Og=M(53,e=>{Cg(e),Dg(e)}),kg=N(38,e=>Og(e,e.y||[e.ab])),Ag=M(37,e=>{Ig(e,e.ab?.id),kg(e)}),jg=k(2,(e=>`<!>${e}<!>`)(Wf),(e=>`b/${e}&b`)(`b%c`),ug,Eg),Mg=M(52,e=>{jg(e,[e.aq,e=>e]),Zh(e)}),Ng=N(40,e=>Mg(e,e.y?.length?e.y.filter(e=>e.status===`active`).map(e=>e.id):[e.ad])),Pg=N(55,e=>e.as[e.ad]),Fg=F(Gh,Ph),Ig=M(39,e=>{Ng(e),Pg(e),bg(e),Fg(e)}),Lg=Ag,Rg=F(Fh),zg=Ge(41,e=>{xg(e),Rg(e)}),Bg=N(15,e=>zg(e,e.n,e.o)),Vg=M(13,Bg),Hg=M(14,Bg),Ug=F(Ih),Wg=Ge(43,e=>{z(e.b,`hidden`,e.ah===`diff`),Sg(e),Ug(e)}),Gg=N(18,e=>Wg(e,e.q,e.r)),Kg=M(16,Gg),qg=M(17,Gg),Jg=O(0,`<div class=drawer-backdrop></div>`,` `,yh),Yg=N(48,e=>gt(e.b,{closed:!e.al,open:e.aj})),Xg=Ge(45,e=>{Jg(e,+!e.aj),Yg(e)}),Zg=N(21,e=>Xg(e,e.t,e.u)),Qg=M(19,Zg),$g=M(20,Zg),e_=O(3,`<div class=side-rail></div><!><!>`,` b%`,tg),t_=O(4,Vm,(e=>`/${e}&`)(Hm),hh,Km,(e=>`/${e}&`)(qm),mh),n_=j(47,e=>{z(e.e,`title`,e.al?`Collapse sidebar`:`Expand sidebar`),e_(e,+!!e.al),t_(e,+!e.al),Yg(e)}),r_=M(51),i_=N(50,e=>r_(e,J_(e))),a_=j(49,e=>{i_(e),gh(e)}),o_=O(5,(e=>`<button class="icon-btn notify-btn">${e}</button>`)(Zm),(e=>` D/${e}&l`)(Qm),vh),s_=L(`n21`,e=>{Et(e,{onMount:function(){er()&&tr().then(t=>{a_(e,!!t)})}}),A(e.e,`click`,function(){n_(e,!e.al),qn(e.al)}),A(e.g,`click`,function(){Xg(e,!1),e.a9?.()}),A(e.i,`click`,function(){Xg(e,!1),e.aa?.()})});function c_(e){ih(e.h),ah(e.h,15),oh(e.h),lh(e.j),uh(e.j,16),dh(e.j),n_(e,Kn()),a_(e,!1),o_(e,+!er()),s_(e)}var l_=M(22,i_),u_=M(23,L(`n20`,e=>{e.x&&n_(e,Kn())})),d_=M(24,e=>{Ng(e),kg(e)}),f_=F(qh,Rh),p_=M(54,e=>{Pg(e),wg(e),f_(e)}),m_=(e,t)=>p_(e,t||{}),h_=F(xh),g_=M(26,e=>{lg(e),h_(e)}),__=M(27),v_=F(wh),y_=M(28,e=>{dg(e),v_(e)}),b_=F(Eh),x_=M(29,e=>{pg(e),b_(e)}),S_=F(Dh),C_=M(30,e=>{mg(e),S_(e)}),w_=F(kh),T_=M(31,e=>{gg(e),w_(e)}),E_=M(32),D_=F(Ah),O_=M(33,e=>{_g(e),D_(e)}),k_=F(jh),A_=M(34,e=>{vg(e),k_(e)}),j_=M(35),M_=M(36);function N_(e){return function(){$h(e._,null),e.c===e._._.ad?(Wg(e._._,e._._.ah===`diff`?`term`:`diff`),e._._.ah===`diff`&&e._._.a4?.()):(Pn(e.c),e._._.a0?.(e.c))}}function P_(e){return function(){$h(e._,null),e._._.a1?.(e.c)}}function F_(e){return function(t){$h(e._,null),e._._.a3(e.c,t)}}function I_(e){return function(t){$h(e._,null),e.c===e._._.ad?(zg(e._._,t),Wg(e._._,`term`)):e._._.a6?.(e.c,t)}}function L_(e){return function(t,n){$h(e._,null);let r=`${t}/${n}`;e.c===e._._.ad?(Wg(e._._,`diff`),e._._.a4?.(r)):(Pn(e.c,r),e._._.a0?.(e.c))}}function R_(e){return function(){$h(e._,null),e.c!==e._._.ad&&e._._.a0?.(e.c)}}function z_(e){return function(){e.d!==e._._.ad&&e._._.a0?.(e.d)}}function B_(e){return()=>clearTimeout(e.h)}function V_(e){return()=>{clearTimeout(e.h),e.h=setTimeout(()=>{$h(e,null)},150)}}function H_(e){return function(){Xg(e._,!1),e.c===e._.ad?(Wg(e._,e._.ah===`diff`?`term`:`diff`),e._.ah===`diff`&&e._.a4?.()):(Pn(e.c),e._.a0?.(e.c))}}function U_(e){return function(){Xg(e._,!1),e._.a1?.(e.c)}}function W_(e){return function(t){Xg(e._,!1),e._.a3(e.c,t)}}function G_(e){return function(t){Xg(e._,!1),e.c===e._.ad?(zg(e._,t),Wg(e._,`term`)):e._.a6?.(e.c,t)}}function K_(e){return function(t,n){Xg(e._,!1);let r=`${t}/${n}`;e.c===e._.ad?(Wg(e._,`diff`),e._.a4?.(r)):(Pn(e.c,r),e._.a0?.(e.c))}}function q_(e){return function(){e.c!==e._.ad&&(Xg(e._,!1),e._.a0?.(e.c))}}function J_(e){return async()=>{try{e.an?(await rr(),a_(e,!1)):(a_(e,await nr()),e.an||e.w?.(`Notifications blocked — allow them for this site in browser/system settings.`))}catch(t){a_(e,!1),e.w?.(`Notifications failed: ${String(t.message||t)}`)}}}R(`n13`,N_),R(`n11`,P_),R(`n12`,F_),R(`n15`,I_),R(`n14`,L_),R(`n10`,R_),R(`n9`,z_),R(`n7`,B_),R(`n8`,V_),R(`n4`,H_),R(`n2`,U_),R(`n3`,W_),R(`n6`,G_),R(`n5`,K_),R(`n1`,q_),R(`n0`,J_);async function Y_(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;top:-100px;opacity:0;`,document.body.append(t),t.focus(),t.select();let n=document.execCommand(`copy`);return t.remove(),n}}var X_=null;function Z_(){return X_}function Q_(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($_(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function $_(e){if(!/[*?]/.test(e))return t=>pr(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=>pr(e,t)}}var ev=3;function tv(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(nv(e,n));for(let e of a){i++;let t=n?.files.find(t=>t.path===e.path),a=e.side===`deletions`?t?.old:t?.new,o=e.side===`deletions`?`Old`:`New`,s=e.line_start===e.line_end?`line ${e.line_start}`:`lines ${e.line_start}-${e.line_end}`;if(r.push(``),r.push(`${i}. **${e.path}** (${o} ${s})`),a!=null){let t=iv(a,e.line_start,e.line_end,e.side),n=av(t);r.push(``),r.push(ov(`${n}diff\n${t}\n${n}`))}r.push(``),r.push(ov(e.text))}}return r.join(`
4
+ `)}function nv(e,t){if(!t?.head)return`${e}/`;let n=rv(t.head),r=rv(t.baseSha),i=t.pr?.headRefName||t.branch||`HEAD`;return`${e}/${t.pr?` #${t.pr.number}`:``} — \`${i}\` ${n} vs \`${t.base}\` ${r}`}function rv(e,t=12){return e.slice(0,t)}function iv(e,t,n,r){let i=e.split(`
5
+ `),a=Math.max(1,t-ev),o=Math.min(i.length,n+ev),s=r===`deletions`?`-`:`+`,c=[];for(let e=a;e<=o;e++){let r=e>=t&&e<=n?s:` `;c.push(`${r}${String(e).padStart(4)} | ${i[e-1]??``}`)}return c.join(`
6
+ `)}function av(e){let t=3,n=/`+/g,r;for(;r=n.exec(e);)t=Math.max(t,r[0].length+1);return"`".repeat(t)}function ov(e){return e.split(`
7
7
  `).map(e=>e&&` ${e}`).join(`
8
- `)}function G_(e){let t={dirs:new Map,files:[]};for(let n of e){let e=n.path.split(`/`),r=e.pop(),i=t;for(let t of e){let e=i.dirs.get(t);e||(e={dirs:new Map,files:[]},i.dirs.set(t,e)),i=e}i.files.push({file:n,name:r})}let n=[],r=(e,t,i)=>{for(let[a,o]of[...e.dirs].sort(([e],[t])=>e.localeCompare(t))){let e=a,s=o;for(;s.dirs.size===1&&!s.files.length;){let[[t,n]]=s.dirs;e+=`/${t}`,s=n}let c=i?`${i}/${e}`:e;n.push({kind:`dir`,label:e,path:c,depth:t}),r(s,t+1,c)}for(let{file:r,name:i}of e.files)n.push({kind:`file`,file:r,name:i,depth:t})};return r(t,0,``),n}var K_=mr,q_=(e=>`/${e}&`)(hr);function J_(e){yr(e.a,`M15 6L9 12L15 18`)}var Y_=(e,t)=>_r(e.a,t),X_=(e,t)=>vr(e.a,t),Z_=mr,Q_=(e=>`/${e}&`)(hr);function $_(e){yr(e.a,`M17 17L21 21 M3 11C3 15.4183 6.58172 19 11 19C13.213 19 15.2161 18.1015 16.6644 16.6493C18.1077 15.2022 19 13.2053 19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11Z`)}var ev=(e,t)=>_r(e.a,t),tv=(e,t)=>vr(e.a,t),nv=`<div class=wrap><input class=file-filter type=search placeholder="Filter files… (globs, !excludes)" aria-label="Filter files"></div>`,rv=N(12,e=>Pt(e,`a`,e.f,gv(e))),iv=M(11,rv),av=N(10,e=>iv(e,_v(e)),2),ov=M(9,av),sv=N(8,e=>ov(e,vv(e)),2),cv=j(5,e=>{sv(e),rv(e)}),lv=(e,t)=>cv(e,t||``),uv=(e,t)=>fv(e,t.timer),dv=L(`f4`,e=>Tt(e,{onDestroy:function(){e.h&&clearTimeout(e.h)}})),fv=M(7,e=>{sv(e),av(e),dv(e)}),pv=L(`f3`,e=>{Ft(e,`a`),A(e.a,`keydown`,function(t){t.key===`Enter`&&e.j(),t.key===`Escape`&&e.f&&(t.preventDefault(),cv(e,``),e.l(``))})});function mv(e){uv(e,{timer:0}),pv(e)}var hv=M(4,e=>{sv(e),av(e)});function gv(e){return function(t){e.l(t)}}function _v(e){return t=>{if(cv(e,t),e.h&&clearTimeout(e.h),!t){e.h=0,e.e(``);return}e.h=setTimeout(e.j,150)}}function vv(e){return()=>{e.h&&=(clearTimeout(e.h),0),e.e(e.f)}}R(`f0`,gv),R(`f2`,_v),R(`f1`,vv);var yv=200,bv=40;function xv(e,t){let n=t.trim();if(!n)return[];let r=/[A-Z]/.test(n),i=r?n:n.toLowerCase(),a=[];for(let t of e){if(a.length>=yv)break;(r?t.path:t.path.toLowerCase()).includes(i)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path});let e=new Set;Sv(t,t.new,`additions`,i,r,e,a),Sv(t,t.old,`deletions`,i,r,e,a)}return a}function Sv(e,t,n,r,i,a,o){if(!t||o.length>=yv)return;let s=0,c=t.split(`
9
- `);for(let t=0;t<c.length;t++){if(o.length>=yv||s>=bv)return;let l=c[t],u=(i?l:l.toLowerCase()).indexOf(r);u<0||n===`deletions`&&a.has(l)||(n===`additions`&&a.add(l),s++,o.push({key:e.key,path:e.path,repo:e.repo,line:t+1,side:n,preview:Cv(l,u,r.length)}))}}function Cv(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 wv=`search-mark`,Tv=`mark.${wv}`,Ev=`mark.${wv}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${wv} *,mark.${wv} *::before,mark.${wv} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${wv}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,Dv={query:``,hit:null},Ov=new Map;function kv(e,t){Dv.query=e,Dv.hit=t;for(let[e,t]of Ov)Bv(e,Dv.query,Dv.hit?.key===t?Dv.hit:null);t&&requestAnimationFrame(()=>{for(let[e,n]of Ov)n===t.key&&Av(e,t)})}function Av(e,t){let n=e.querySelector(`diffs-container`)?.shadowRoot;if(!n)return;let r=n.querySelector(`mark.search-mark.active`);if(r){r.scrollIntoView({block:`center`});return}if(t.line<1)return;let i=[...n.querySelectorAll(`[data-line="${t.line}"]`)],a=t.side||`additions`;(i.find(e=>Fv(e)===a)??i[0])?.scrollIntoView({block:`center`})}function jv(e,t){let n=t&&Dv.hit?.key===t?Dv.hit:null;Bv(e,Dv.query,n),n&&requestAnimationFrame(()=>Av(e,n))}function Mv(e,t){return Ov.set(e,t),jv(e,t),()=>{Ov.delete(e)}}function Nv(e){jv(e,Ov.get(e))}function Pv(e){for(let t of[...e.querySelectorAll(Tv)]){let e=t.parentElement;t.replaceWith(...t.childNodes),e?.normalize()}}function Fv(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 Iv(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(Tv)||n.push(e);return n}function Lv(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 Rv(e,t,n,r,i){let a=Lv(e,t,n),o=Lv(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 zv(e,t,n,r){let i=Iv(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=Fv(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${wv} active`:wv;for(let e=c.length-1;e>=0;e--)Rv(i,a,c[e][0],c[e][1],d)}function Bv(e,t,n){let r=[e],i=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(Pv(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`))zv(t,s,o,n)}var Vv=`<div class=find-bar><input class=find-input type=search placeholder="Find in diffs" aria-label="Find in diffs"><span class=count> </span><button class=icon-btn title="Previous match">↑</button><button class=icon-btn title="Next match">↓</button><button class=icon-btn title="Close find">×</button></div>`,Hv=`D bD l b b l`,Uv=(e,t)=>sy(e,t?.length),Wv=N(12,e=>Uv(e,xv(e.h,e.l))),Gv=N(29,L(`d5`,e=>Tt(e,{onMount:function(){let t=new AbortController;return document.addEventListener(`keydown`,t=>{if(t.key===`Escape`){if(t.target instanceof HTMLTextAreaElement)return;t.preventDefault(),e.j();return}let n=t.metaKey||t.ctrlKey;(t.key===`F3`||n&&t.key.toLowerCase()===`g`)&&(t.preventDefault(),e.a2(t.shiftKey?-1:1))},{signal:t.signal}),e.w=e.k,setTimeout(()=>e.a?.focus(),0),{abort:t}},onUpdate:function(){if(e.k!==e.w){e.w=e.k;let t=e.a;t?.focus(),t?.select()}},onDestroy:function(){e.v&&clearTimeout(e.v),this.abort.abort(),kv(``,null),e.i({query:``,hit:null,keys:[]})}})),5),Kv=M(28,Gv),qv=N(25,e=>Kv(e,my(e)),3),Jv=N(27,e=>Pt(e,`a`,e.l,hy(e))),Yv=N(19,e=>V(e.b,e.l.trim()?e.q?`${e.s+1}/${e.q}`:`0/0`:``),2),Xv=j(11,e=>{Wv(e),qv(e),Jv(e),Yv(e)}),Zv=M(18,e=>{qv(e),Yv(e)}),Qv=N(17,e=>Zv(e,e.q?Math.min(e.n,e.q-1):-1)),$v=M(26,Jv),ey=N(24,e=>$v(e,gy(e)),2),ty=M(23,e=>{ey(e),qv(e)}),ny=N(14,e=>ty(e,_y(e)),2),ry=j(13,e=>{Qv(e),ny(e)}),iy=(e,t)=>{ly(e,t.timer),uy(e,t.tick)},ay=L(`d4`,e=>{Ft(e,`a`),A(e.a,`keydown`,function(t){t.key===`Enter`&&(t.preventDefault(),e.a2(t.shiftKey?-1:1))}),A(e.c,`click`,function(){e.a2(-1)}),A(e.d,`click`,function(){e.a2(1)}),A(e.e,`click`,function(){e.j()})});function oy(e){Xv(e,``),ry(e,0),iy(e,{timer:0,tick:0}),ay(e)}var sy=M(16,e=>{z(e.c,`disabled`,!e.q),z(e.d,`disabled`,!e.q),Qv(e),Yv(e)}),cy=M(7,e=>{Wv(e),ny(e),ey(e)}),ly=M(21,e=>{ey(e),qv(e),Gv(e)}),uy=M(22,Gv),dy=M(8,e=>{ny(e),Gv(e)}),fy=M(9,Gv),py=M(10,Gv);function my(e){return t=>{e.v&&=(clearTimeout(e.v),0),e.x(e.l,(e.s<0?0:e.s)+t)}}function hy(e){return function(t){e.a0(t)}}function gy(e){return t=>{Xv(e,t),ry(e,0),kv(t,xv(e.h,t)[0]??null),e.v&&clearTimeout(e.v),e.v=setTimeout(()=>{e.v=0,e.x(t,0)},80)}}function _y(e){return(t,n)=>{let r=xv(e.h,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){ry(e,0),kv(t,null),e.i({query:t,hit:null,keys:i});return}ry(e,(n%r.length+r.length)%r.length);let a=r[e.n];kv(t,a),e.i({query:t,hit:a,keys:i})}}R(`d3`,my),R(`d0`,hy),R(`d2`,gy),R(`d1`,_y);var vy=`diffs-container`,yy=/(?=^diff --git)/gm,by=/(?<=\n)/,xy=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Sy=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Cy=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,wy=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Ty=`header-prefix`,Ey=`header-filename-suffix`,Dy=`header-metadata`,Oy=`header-custom`,ky={dark:`pierre-dark`,light:`pierre-light`},Ay=`data-theme-css`,jy=`data-unsafe-css`,My=`data-diffs-scrollbar-measure`,Ny=`--diffs-scrollbar-gutter-measured`,Py=1e5,Fy=Object.freeze({fromStart:0,fromEnd:0}),Iy={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Ly={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Ry=new Set,zy=null;function By(e){Ry.add(e),zy??=requestAnimationFrame(Hy)}function Vy(e){Ry.delete(e)&&Ry.size===0&&zy!=null&&(cancelAnimationFrame(zy),zy=null)}function Hy(e){let t=new Set(Ry);Ry.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}zy=Ry.size>0?requestAnimationFrame(Hy):null}function Uy(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function Wy(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Gy(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Ky=new TextEncoder,qy=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Jy=/[\uD800-\uDFFF]/,Yy=1024,Xy=new Uint8Array(Yy);function Zy(){Xy.length!==Yy&&(Xy=new Uint8Array(Yy))}function Qy(e){if(e.length===0)return e;if(Jy.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Xy.length<t&&(Xy=new Uint8Array(t));let{written:n}=Ky.encodeInto(e,Xy);return qy.decode(Xy.subarray(0,n))}function $y(e,t){return e-(t===0?0:1)}function eb(e,t){return $y(e,t)+t}var tb=4096,nb=.5;function rb(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=ab(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}ib(t,e)}}function ib(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 ab(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)>tb)return null;let c=[];for(let t=0;t<n;t++)c.push(sb(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(sb(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+=cb(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*nb: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 ob=/\s+/g;function sb(e){return e.replace(ob,``)}function cb(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 lb(e,t){try{return ub(e,t)}finally{Zy()}}function ub(e,{cacheKey:t,isGitDiff:n=yy.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=vb(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=fb(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=hb(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?db(i.contents):[],deletionLines:!l&&r!=null&&i!=null?db(r.contents):[],cacheKey:bb(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(Cy),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=Qy(r.trim()),n!==r&&(c.prevName=Qy(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Sy:xy):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=Qy(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=Qy(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Qy(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Qy(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Qy(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Qy(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(wy)??[];t!=null&&(c.prevObjectId=Qy(t)),n!=null&&(c.newObjectId=Qy(n)),r!=null&&(c.mode=Qy(r))}e.startsWith(`rename from `)&&(c.prevName=Qy(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=Qy(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
8
+ `)}function sv(e){let t={dirs:new Map,files:[]};for(let n of e){let e=n.path.split(`/`),r=e.pop(),i=t;for(let t of e){let e=i.dirs.get(t);e||(e={dirs:new Map,files:[]},i.dirs.set(t,e)),i=e}i.files.push({file:n,name:r})}let n=[],r=(e,t,i)=>{for(let[a,o]of[...e.dirs].sort(([e],[t])=>e.localeCompare(t))){let e=a,s=o;for(;s.dirs.size===1&&!s.files.length;){let[[t,n]]=s.dirs;e+=`/${t}`,s=n}let c=i?`${i}/${e}`:e;n.push({kind:`dir`,label:e,path:c,depth:t}),r(s,t+1,c)}for(let{file:r,name:i}of e.files)n.push({kind:`file`,file:r,name:i,depth:t})};return r(t,0,``),n}var cv=gr,lv=(e=>`/${e}&`)(_r);function uv(e){xr(e.a,`M15 6L9 12L15 18`)}var dv=(e,t)=>yr(e.a,t),fv=(e,t)=>br(e.a,t),pv=gr,mv=(e=>`/${e}&`)(_r);function hv(e){xr(e.a,`M17 17L21 21 M3 11C3 15.4183 6.58172 19 11 19C13.213 19 15.2161 18.1015 16.6644 16.6493C18.1077 15.2022 19 13.2053 19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11Z`)}var gv=(e,t)=>yr(e.a,t),_v=(e,t)=>br(e.a,t),vv=`<div class=wrap><input class=file-filter type=search placeholder="Filter files… (globs, !excludes)" aria-label="Filter files"></div>`,yv=N(12,e=>Ft(e,`a`,e.f,Mv(e))),bv=M(11,yv),xv=N(10,e=>bv(e,Nv(e)),2),Sv=M(9,xv),Cv=N(8,e=>Sv(e,Pv(e)),2),wv=j(5,e=>{Cv(e),yv(e)}),Tv=(e,t)=>wv(e,t||``),Ev=(e,t)=>Ov(e,t.timer),Dv=L(`f4`,e=>Et(e,{onDestroy:function(){e.h&&clearTimeout(e.h)}})),Ov=M(7,e=>{Cv(e),xv(e),Dv(e)}),kv=L(`f3`,e=>{It(e,`a`),A(e.a,`keydown`,function(t){t.key===`Enter`&&e.j(),t.key===`Escape`&&e.f&&(t.preventDefault(),wv(e,``),e.l(``))})});function Av(e){Ev(e,{timer:0}),kv(e)}var jv=M(4,e=>{Cv(e),xv(e)});function Mv(e){return function(t){e.l(t)}}function Nv(e){return t=>{if(wv(e,t),e.h&&clearTimeout(e.h),!t){e.h=0,e.e(``);return}e.h=setTimeout(e.j,150)}}function Pv(e){return()=>{e.h&&=(clearTimeout(e.h),0),e.e(e.f)}}R(`f0`,Mv),R(`f2`,Nv),R(`f1`,Pv);var Fv=200,Iv=40;function Lv(e,t){let n=t.trim();if(!n)return[];let r=/[A-Z]/.test(n),i=r?n:n.toLowerCase(),a=[];for(let t of e){if(a.length>=Fv)break;(r?t.path:t.path.toLowerCase()).includes(i)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path});let e=new Set;Rv(t,t.new,`additions`,i,r,e,a),Rv(t,t.old,`deletions`,i,r,e,a)}return a}function Rv(e,t,n,r,i,a,o){if(!t||o.length>=Fv)return;let s=0,c=t.split(`
9
+ `);for(let t=0;t<c.length;t++){if(o.length>=Fv||s>=Iv)return;let l=c[t],u=(i?l:l.toLowerCase()).indexOf(r);u<0||n===`deletions`&&a.has(l)||(n===`additions`&&a.add(l),s++,o.push({key:e.key,path:e.path,repo:e.repo,line:t+1,side:n,preview:zv(l,u,r.length)}))}}function zv(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 Bv=`search-mark`,Vv=`mark.${Bv}`,Hv=`mark.${Bv}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${Bv} *,mark.${Bv} *::before,mark.${Bv} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${Bv}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,Uv={query:``,hit:null},Wv=new Map;function Gv(e,t){Uv.query=e,Uv.hit=t;for(let[e,t]of Wv)ny(e,Uv.query,Uv.hit?.key===t?Uv.hit:null);t&&requestAnimationFrame(()=>{for(let[e,n]of Wv)n===t.key&&Kv(e,t)})}function Kv(e,t){let n=e.querySelector(`diffs-container`)?.shadowRoot;if(!n)return;let r=n.querySelector(`mark.search-mark.active`);if(r){r.scrollIntoView({block:`center`});return}if(t.line<1)return;let i=[...n.querySelectorAll(`[data-line="${t.line}"]`)],a=t.side||`additions`;(i.find(e=>Zv(e)===a)??i[0])?.scrollIntoView({block:`center`})}function qv(e,t){let n=t&&Uv.hit?.key===t?Uv.hit:null;ny(e,Uv.query,n),n&&requestAnimationFrame(()=>Kv(e,n))}function Jv(e,t){return Wv.set(e,t),qv(e,t),()=>{Wv.delete(e)}}function Yv(e){qv(e,Wv.get(e))}function Xv(e){for(let t of[...e.querySelectorAll(Vv)]){let e=t.parentElement;t.replaceWith(...t.childNodes),e?.normalize()}}function Zv(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 Qv(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(Vv)||n.push(e);return n}function $v(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 ey(e,t,n,r,i){let a=$v(e,t,n),o=$v(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 ty(e,t,n,r){let i=Qv(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=Zv(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${Bv} active`:Bv;for(let e=c.length-1;e>=0;e--)ey(i,a,c[e][0],c[e][1],d)}function ny(e,t,n){let r=[e],i=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(Xv(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`))ty(t,s,o,n)}var ry=`<div class=find-bar><input class=find-input type=search placeholder="Find in diffs" aria-label="Find in diffs"><span class=count> </span><button class=icon-btn title="Previous match">↑</button><button class=icon-btn title="Next match">↓</button><button class=icon-btn title="Close find">×</button></div>`,iy=`D bD l b b l`,ay=(e,t)=>zee(e,t?.length),oy=N(12,e=>ay(e,Lv(e.h,e.l))),sy=N(29,L(`d5`,e=>Et(e,{onMount:function(){let t=new AbortController;return document.addEventListener(`keydown`,t=>{if(t.key===`Escape`){if(t.target instanceof HTMLTextAreaElement)return;t.preventDefault(),e.j();return}let n=t.metaKey||t.ctrlKey;(t.key===`F3`||n&&t.key.toLowerCase()===`g`)&&(t.preventDefault(),e.a2(t.shiftKey?-1:1))},{signal:t.signal}),e.w=e.k,setTimeout(()=>e.a?.focus(),0),{abort:t}},onUpdate:function(){if(e.k!==e.w){e.w=e.k;let t=e.a;t?.focus(),t?.select()}},onDestroy:function(){e.v&&clearTimeout(e.v),this.abort.abort(),Gv(``,null),e.i({query:``,hit:null,keys:[]})}})),5),cy=M(28,sy),ly=N(25,e=>cy(e,vy(e)),3),uy=N(27,e=>Ft(e,`a`,e.l,yy(e))),dy=N(19,e=>V(e.b,e.l.trim()?e.q?`${e.s+1}/${e.q}`:`0/0`:``),2),fy=j(11,e=>{oy(e),ly(e),uy(e),dy(e)}),py=M(18,e=>{ly(e),dy(e)}),my=N(17,e=>py(e,e.q?Math.min(e.n,e.q-1):-1)),Pee=M(26,uy),hy=N(24,e=>Pee(e,by(e)),2),Fee=M(23,e=>{hy(e),ly(e)}),gy=N(14,e=>Fee(e,xy(e)),2),_y=j(13,e=>{my(e),gy(e)}),Iee=(e,t)=>{Vee(e,t.timer),Hee(e,t.tick)},Lee=L(`d4`,e=>{It(e,`a`),A(e.a,`keydown`,function(t){t.key===`Enter`&&(t.preventDefault(),e.a2(t.shiftKey?-1:1))}),A(e.c,`click`,function(){e.a2(-1)}),A(e.d,`click`,function(){e.a2(1)}),A(e.e,`click`,function(){e.j()})});function Ree(e){fy(e,``),_y(e,0),Iee(e,{timer:0,tick:0}),Lee(e)}var zee=M(16,e=>{z(e.c,`disabled`,!e.q),z(e.d,`disabled`,!e.q),my(e),dy(e)}),Bee=M(7,e=>{oy(e),gy(e),hy(e)}),Vee=M(21,e=>{hy(e),ly(e),sy(e)}),Hee=M(22,sy),Uee=M(8,e=>{gy(e),sy(e)}),Wee=M(9,sy),Gee=M(10,sy);function vy(e){return t=>{e.v&&=(clearTimeout(e.v),0),e.x(e.l,(e.s<0?0:e.s)+t)}}function yy(e){return function(t){e.a0(t)}}function by(e){return t=>{fy(e,t),_y(e,0),Gv(t,Lv(e.h,t)[0]??null),e.v&&clearTimeout(e.v),e.v=setTimeout(()=>{e.v=0,e.x(t,0)},80)}}function xy(e){return(t,n)=>{let r=Lv(e.h,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){_y(e,0),Gv(t,null),e.i({query:t,hit:null,keys:i});return}_y(e,(n%r.length+r.length)%r.length);let a=r[e.n];Gv(t,a),e.i({query:t,hit:a,keys:i})}}R(`d3`,vy),R(`d0`,yy),R(`d2`,by),R(`d1`,xy);var Kee=`diffs-container`,qee=/(?=^diff --git)/gm,Jee=/(?<=\n)/,Yee=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Xee=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Zee=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Sy=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Cy=`header-prefix`,wy=`header-filename-suffix`,Ty=`header-metadata`,Ey=`header-custom`,Dy={dark:`pierre-dark`,light:`pierre-light`},Oy=`data-theme-css`,ky=`data-unsafe-css`,Ay=`data-diffs-scrollbar-measure`,jy=`--diffs-scrollbar-gutter-measured`,My=1e5,Ny=Object.freeze({fromStart:0,fromEnd:0}),Py={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Fy={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Iy=new Set,Ly=null;function Ry(e){Iy.add(e),Ly??=requestAnimationFrame(By)}function zy(e){Iy.delete(e)&&Iy.size===0&&Ly!=null&&(cancelAnimationFrame(Ly),Ly=null)}function By(e){let t=new Set(Iy);Iy.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}Ly=Iy.size>0?requestAnimationFrame(By):null}function Vy(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function Hy(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Uy(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Wy=new TextEncoder,Gy=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Ky=/[\uD800-\uDFFF]/,qy=1024,Jy=new Uint8Array(qy);function Yy(){Jy.length!==qy&&(Jy=new Uint8Array(qy))}function Xy(e){if(e.length===0)return e;if(Ky.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Jy.length<t&&(Jy=new Uint8Array(t));let{written:n}=Wy.encodeInto(e,Jy);return Gy.decode(Jy.subarray(0,n))}function Zy(e,t){return e-(t===0?0:1)}function Qy(e,t){return Zy(e,t)+t}var $y=4096,eb=.5;function tb(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=rb(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}nb(t,e)}}function nb(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 rb(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)>$y)return null;let c=[];for(let t=0;t<n;t++)c.push(ab(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(ab(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+=ob(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*eb: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 ib=/\s+/g;function ab(e){return e.replace(ib,``)}function ob(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 sb(e,t){try{return cb(e,t)}finally{Yy()}}function cb(e,{cacheKey:t,isGitDiff:n=qee.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=gb(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=ub(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=pb(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?lb(i.contents):[],deletionLines:!l&&r!=null&&i!=null?lb(r.contents):[],cacheKey:vb(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(Zee),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=Xy(r.trim()),n!==r&&(c.prevName=Xy(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Xee:Yee):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=Xy(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=Xy(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Xy(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Xy(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Xy(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Xy(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(Sy)??[];t!=null&&(c.prevObjectId=Xy(t)),n!=null&&(c.newObjectId=Xy(n)),r!=null&&(c.mode=Xy(r))}e.startsWith(`rename from `)&&(c.prevName=Xy(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=Xy(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
10
10
  `||s[s.length-1]===`\r`||s[s.length-1]===`\r
11
- `||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:bb(p.hunkContext),hunkSpecs:Qy(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(a&&pb(t)&&!mb(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}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=xb(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Sb(t);(g==null||g.type!==`change`)&&(g=Cb(`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=Sb(t);(g==null||g.type!==`change`)&&(g=Cb(`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=Sb(t);(g==null||g.type!==`context`)&&(g=Cb(`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]=Gy(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Gy(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max($y(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=eb(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=eb(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),rb(c),c}}function db(e){let t=fb(e);for(let e=0;e<t.length;e++)t[e]=Qy(t[e]);return t}function fb(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
12
- `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function pb(e){let t=e[0];return t===`+`||t===`-`||t===` `}function mb(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
13
- `&&n!==`\r`)return!1}return!0}function hb(e){if(!e.startsWith(`@@ -`))return;let t=4,n=gb(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=gb(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=gb(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=gb(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=_b(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function gb(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function _b(e){return e.endsWith(`\r
11
+ `||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:vb(p.hunkContext),hunkSpecs:Xy(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(a&&db(t)&&!fb(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}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=yb(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=bb(t);(g==null||g.type!==`change`)&&(g=xb(`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=bb(t);(g==null||g.type!==`change`)&&(g=xb(`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=bb(t);(g==null||g.type!==`context`)&&(g=xb(`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]=Uy(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Uy(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(Zy(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=Qy(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=Qy(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),tb(c),c}}function lb(e){let t=ub(e);for(let e=0;e<t.length;e++)t[e]=Xy(t[e]);return t}function ub(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
12
+ `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function db(e){let t=e[0];return t===`+`||t===`-`||t===` `}function fb(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
13
+ `&&n!==`\r`)return!1}return!0}function pb(e){if(!e.startsWith(`@@ -`))return;let t=4,n=mb(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=mb(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=mb(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=mb(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=hb(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function mb(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function hb(e){return e.endsWith(`\r
14
14
  `)?e.slice(0,-2):e.endsWith(`
15
- `)?e.slice(0,-1):e}function vb(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:yb(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=yb(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function yb(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function bb(e){return e==null?e:Qy(e)}function xb(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Sb(e){let t=e.slice(1);return Qy(t===``?`
16
- `:t)}function Cb(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var wb=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},Tb=new class extends wb{};function Eb(e,t,n){return Tb.diff(e,t,n)}function Db(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Ob(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function kb(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Ab(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function jb(e,t){return kb(e,t,``)}function Mb(e,t){return Ab(e,t,``)}function Nb(e,t){return t.slice(0,Pb(e,t))}function Pb(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Fb(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Ib(e,t){if(t)return Rb(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Lb(e,t){if(t)return Rb(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Rb(e,t){if(!t)return[Lb(e),Ib(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Fb(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var zb=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Bb=RegExp(`[${zb}]+|\\s+|[^${zb}]`,`ug`);new class extends wb{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Fb(e,r)}else n=e.match(Bb)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Vb(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Vb(n,i,r,null,t.intlSegmenter),e}};function Vb(e,t,n,r,i){if(t&&n){let[a,o]=Rb(t.value,i),[s,c]=Rb(n.value,i);if(e){let r=Db(a,s);e.value=Ab(e.value,s,r),t.value=jb(t.value,r),n.value=jb(n.value,r)}if(r){let e=Ob(o,c);r.value=kb(r.value,c,e),t.value=Mb(t.value,e),n.value=Mb(n.value,e)}}else if(n){if(e){let e=Lb(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Lb(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Lb(r.value,i),[a,o]=Rb(t.value,i),s=Db(n,a);t.value=jb(t.value,s);let c=Ob(jb(n,s),o);t.value=Mb(t.value,c),r.value=kb(r.value,n,c),e.value=Ab(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Lb(r.value,i),n=Nb(Ib(t.value,i),e);t.value=Mb(t.value,n)}else if(e){let n=Nb(Ib(e.value,i),Lb(t.value,i));t.value=jb(t.value,n)}}var Hb=new class extends wb{tokenize(e){let t=RegExp(`(\\r?\\n)|[${zb}]+|[^\\S\\n\\r]+|[^${zb}]`,`ug`);return e.match(t)||[]}};function Ub(e,t,n){return Hb.diff(e,t,n)}var Wb=new class extends wb{constructor(){super(...arguments),this.tokenize=Kb}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
15
+ `)?e.slice(0,-1):e}function gb(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:_b(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=_b(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function _b(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function vb(e){return e==null?e:Xy(e)}function yb(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function bb(e){let t=e.slice(1);return Xy(t===``?`
16
+ `:t)}function xb(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var Sb=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},Cb=new class extends Sb{};function wb(e,t,n){return Cb.diff(e,t,n)}function Tb(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Eb(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Db(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Ob(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function kb(e,t){return Db(e,t,``)}function Ab(e,t){return Ob(e,t,``)}function jb(e,t){return t.slice(0,Mb(e,t))}function Mb(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Nb(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Pb(e,t){if(t)return Ib(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Fb(e,t){if(t)return Ib(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Ib(e,t){if(!t)return[Fb(e),Pb(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Nb(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Lb=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Rb=RegExp(`[${Lb}]+|\\s+|[^${Lb}]`,`ug`);new class extends Sb{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Nb(e,r)}else n=e.match(Rb)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&zb(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&zb(n,i,r,null,t.intlSegmenter),e}};function zb(e,t,n,r,i){if(t&&n){let[a,o]=Ib(t.value,i),[s,c]=Ib(n.value,i);if(e){let r=Tb(a,s);e.value=Ob(e.value,s,r),t.value=kb(t.value,r),n.value=kb(n.value,r)}if(r){let e=Eb(o,c);r.value=Db(r.value,c,e),t.value=Ab(t.value,e),n.value=Ab(n.value,e)}}else if(n){if(e){let e=Fb(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Fb(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Fb(r.value,i),[a,o]=Ib(t.value,i),s=Tb(n,a);t.value=kb(t.value,s);let c=Eb(kb(n,s),o);t.value=Ab(t.value,c),r.value=Db(r.value,n,c),e.value=Ob(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Fb(r.value,i),n=jb(Pb(t.value,i),e);t.value=Ab(t.value,n)}else if(e){let n=jb(Pb(e.value,i),Fb(t.value,i));t.value=kb(t.value,n)}}var Bb=new class extends Sb{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Lb}]+|[^\\S\\n\\r]+|[^${Lb}]`,`ug`);return e.match(t)||[]}};function Vb(e,t,n){return Bb.diff(e,t,n)}var Hb=new class extends Sb{constructor(){super(...arguments),this.tokenize=Wb}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
17
17
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
18
18
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
19
19
  `)&&(e=e.slice(0,-1)),t.endsWith(`
20
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Gb(e,t,n){return Wb.diff(e,t,n)}function Kb(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
21
- `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function qb(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Jb(e){if(!qb(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var Yb={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Xb(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;Gb(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Gb(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||$b(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
22
- `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Zb(e,t){if(t||=Yb,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Zb(e,t)).join(`
23
- `)}let n=[];if(e.isGit){if(t=Yb,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Jb(r)+` `+Jb(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Jb((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Jb((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Jb((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Jb((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Jb(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Jb(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
20
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Ub(e,t,n){return Hb.diff(e,t,n)}function Wb(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
21
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Gb(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Kb(e){if(!Gb(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var qb={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Jb(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;Ub(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Ub(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||Zb(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
22
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Yb(e,t){if(t||=qb,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Yb(e,t)).join(`
23
+ `)}let n=[];if(e.isGit){if(t=qb,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Kb(r)+` `+Kb(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Kb((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Kb((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Kb((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Kb((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Kb(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Kb(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
24
24
  `)+`
25
- `}function Qb(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Xb(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Zb(e,o.headerOptions):void 0)}}))}else{let s=Xb(e,t,n,r,i,a,o);return s?Zb(s,o?.headerOptions):void 0}}function $b(e){let t=e.endsWith(`
25
+ `}function Xb(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Jb(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Yb(e,o.headerOptions):void 0)}}))}else{let s=Jb(e,t,n,r,i,a,o);return s?Yb(s,o?.headerOptions):void 0}}function Zb(e){let t=e.endsWith(`
26
26
  `),n=e.split(`
27
27
  `).map(e=>e+`
28
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var ex=`/dev/null`;function tx(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??nx(),a=t??nx(),o=lb(Qb(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),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 nx(){return{name:ex,contents:``}}function rx(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function ix(e){return{type:`text`,value:e}}function U({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function ax({name:e,width:t=16,height:n=16,properties:r}){return U({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[U({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function ox(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function sx(e){return U({tagName:`div`,properties:{"data-gutter":``},children:e})}function cx(e,t,n,r={}){return U({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[U({tagName:`span`,properties:{"data-line-number-content":``},children:[ix(`${t}`)]})]})}function lx(e,t,n){return U({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function ux(){return U({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[ax({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function dx(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function fx(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var px=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],mx=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};mx.prototype.normal={},mx.prototype.property={},mx.prototype.space=void 0;function hx(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new mx(n,r,t)}function gx(e){return e.toLowerCase()}var _x=class{constructor(e,t){this.attribute=t,this.property=e}};_x.prototype.attribute=``,_x.prototype.booleanish=!1,_x.prototype.boolean=!1,_x.prototype.commaOrSpaceSeparated=!1,_x.prototype.commaSeparated=!1,_x.prototype.defined=!1,_x.prototype.mustUseProperty=!1,_x.prototype.number=!1,_x.prototype.overloadedBoolean=!1,_x.prototype.property=``,_x.prototype.spaceSeparated=!1,_x.prototype.space=void 0;var vx=t({boolean:()=>W,booleanish:()=>bx,commaOrSpaceSeparated:()=>wx,commaSeparated:()=>Cx,number:()=>G,overloadedBoolean:()=>xx,spaceSeparated:()=>Sx}),yx=0,W=Tx(),bx=Tx(),xx=Tx(),G=Tx(),Sx=Tx(),Cx=Tx(),wx=Tx();function Tx(){return 2**++yx}var Ex=Object.keys(vx),Dx=class extends _x{constructor(e,t,n,r){let i=-1;if(super(e,t),Ox(this,`space`,r),typeof n==`number`)for(;++i<Ex.length;){let e=Ex[i];Ox(this,Ex[i],(n&vx[e])===vx[e])}}};Dx.prototype.defined=!0;function Ox(e,t,n){n&&(e[t]=n)}function kx(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Dx(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[gx(r)]=r,n[gx(a.attribute)]=r}return new mx(t,n,e.space)}var Ax=kx({properties:{ariaActiveDescendant:null,ariaAtomic:bx,ariaAutoComplete:null,ariaBusy:bx,ariaChecked:bx,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:Sx,ariaCurrent:null,ariaDescribedBy:Sx,ariaDetails:null,ariaDisabled:bx,ariaDropEffect:Sx,ariaErrorMessage:null,ariaExpanded:bx,ariaFlowTo:Sx,ariaGrabbed:bx,ariaHasPopup:null,ariaHidden:bx,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Sx,ariaLevel:G,ariaLive:null,ariaModal:bx,ariaMultiLine:bx,ariaMultiSelectable:bx,ariaOrientation:null,ariaOwns:Sx,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:bx,ariaReadOnly:bx,ariaRelevant:null,ariaRequired:bx,ariaRoleDescription:Sx,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:bx,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 jx(e,t){return t in e?e[t]:t}function Mx(e,t){return jx(e,t.toLowerCase())}var Nx=kx({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Cx,acceptCharset:Sx,accessKey:Sx,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alpha:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:Sx,autoFocus:W,autoPlay:W,blocking:Sx,capture:null,charSet:null,checked:W,cite:null,className:Sx,closedBy:null,colorSpace:null,cols:G,colSpan:G,command:null,commandFor:null,content:null,contentEditable:bx,controls:W,controlsList:Sx,coords:G|Cx,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:xx,draggable:bx,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:Sx,height:G,hidden:xx,high:G,href:null,hrefLang:null,htmlFor:Sx,httpEquiv:Sx,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:Sx,itemRef:Sx,itemScope:W,itemType:Sx,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:Sx,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:Sx,required:W,reversed:W,rows:G,rowSpan:G,sandbox:Sx,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:bx,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:bx,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Sx,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:bx,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:Cx,part:Sx,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:Mx}),Px=kx({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:wx,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:Sx,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:Cx,g2:Cx,glyphName:Cx,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:wx,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:Sx,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wx,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wx,rev:wx,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wx,requiredFeatures:wx,requiredFonts:wx,requiredFormats:wx,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:wx,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:wx,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:wx,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:jx}),Fx=kx({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()}}),Ix=kx({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Mx}),Lx=kx({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Rx=/[A-Z]/g,zx=/-[a-z]/g,Bx=/^data[-\w.:]+$/i;function Vx(e,t){let n=gx(t),r=t,i=_x;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Bx.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(zx,Ux);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!zx.test(e)){let n=e.replace(Rx,Hx);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Dx}return new i(r,t)}function Hx(e){return`-`+e.toLowerCase()}function Ux(e){return e.charAt(1).toUpperCase()}var Wx=hx([Ax,Nx,Fx,Ix,Lx],`html`),Gx=hx([Ax,Px,Fx,Ix,Lx],`svg`),Kx={}.hasOwnProperty;function qx(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Kx.call(t,e)){let n=String(t[e]);i=Kx.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 Jx=/["&'<>`]/g,Yx=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Xx=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Zx=/[|\\{}()[\]^$+*?.]/g,Qx=new WeakMap;function $x(e,t){if(e=e.replace(t.subset?eS(t.subset):Jx,r),t.subset||t.escapeOnly)return e;return e.replace(Yx,n).replace(Xx,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 eS(e){let t=Qx.get(e);return t||(t=tS(e),Qx.set(e,t)),t}function tS(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Zx,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var nS=/[\dA-Fa-f]/;function rS(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!nS.test(String.fromCharCode(t))?r:r+`;`}var iS=/\d/;function aS(e,t,n){let r=`&#`+String(e);return n&&t&&!iS.test(String.fromCharCode(t))?r:r+`;`}var oS=`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(`.`),sS={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:`€`},cS=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],lS={}.hasOwnProperty,uS={},dS;for(dS in sS)lS.call(sS,dS)&&(uS[sS[dS]]=dS);var fS=/[^\dA-Za-z]/;function pS(e,t,n,r){let i=String.fromCharCode(e);if(lS.call(uS,i)){let e=uS[i],a=`&`+e;return n&&oS.includes(e)&&!cS.includes(e)&&(!r||t&&t!==61&&fS.test(String.fromCharCode(t)))?a:a+`;`}return``}function mS(e,t,n){let r=rS(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=pS(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=aS(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function hS(e,t){return $x(e,Object.assign({format:mS},t))}var gS=/^>|^->|<!--|-->|--!>|<!-$/g,_S=[`>`],vS=[`<`,`>`];function yS(e,t,n,r){return r.settings.bogusComments?`<?`+hS(e.value,Object.assign({},r.settings.characterReferences,{subset:_S}))+`>`:`<!--`+e.value.replace(gS,i)+`-->`;function i(e){return hS(e,Object.assign({},r.settings.characterReferences,{subset:vS}))}}function bS(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function xS(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 SS(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function CS(e){return e.join(` `).trim()}var wS=/[ \t\n\f\r]/g;function TS(e){return typeof e==`object`?e.type===`text`&&ES(e.value):ES(e)}function ES(e){return e.replace(wS,``)===``}var DS=AS(1),OS=AS(-1),kS=[];function AS(e){return t;function t(t,n,r){let i=t?t.children:kS,a=(n||0)+e,o=i[a];if(!r)for(;o&&TS(o);)a+=e,o=i[a];return o}}var jS={}.hasOwnProperty;function MS(e){return t;function t(t,n,r){return jS.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var NS=MS({body:IS,caption:PS,colgroup:PS,dd:BS,dt:zS,head:PS,html:FS,li:RS,optgroup:HS,option:US,p:LS,rp:VS,rt:VS,tbody:GS,td:JS,tfoot:KS,th:JS,thead:WS,tr:qS});function PS(e,t,n){let r=DS(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&TS(r.value.charAt(0)))}function FS(e,t,n){let r=DS(n,t);return!r||r.type!==`comment`}function IS(e,t,n){let r=DS(n,t);return!r||r.type!==`comment`}function LS(e,t,n){let r=DS(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 RS(e,t,n){let r=DS(n,t);return!r||r.type===`element`&&r.tagName===`li`}function zS(e,t,n){let r=DS(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function BS(e,t,n){let r=DS(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function VS(e,t,n){let r=DS(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function HS(e,t,n){let r=DS(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function US(e,t,n){let r=DS(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function WS(e,t,n){let r=DS(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function GS(e,t,n){let r=DS(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function KS(e,t,n){return!DS(n,t)}function qS(e,t,n){let r=DS(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function JS(e,t,n){let r=DS(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var YS=MS({body:QS,colgroup:$S,head:ZS,html:XS,tbody:eC});function XS(e){let t=DS(e,-1);return!t||t.type!==`comment`}function ZS(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 QS(e){let t=DS(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&TS(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function $S(e,t,n){let r=OS(n,t),i=DS(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&NS(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function eC(e,t,n){let r=OS(n,t),i=DS(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&NS(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var tC={name:[[`
28
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var Qb=`/dev/null`;function $b(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??ex(),a=t??ex(),o=sb(Xb(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),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 ex(){return{name:Qb,contents:``}}function tx(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function nx(e){return{type:`text`,value:e}}function U({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function rx({name:e,width:t=16,height:n=16,properties:r}){return U({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[U({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function ix(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function ax(e){return U({tagName:`div`,properties:{"data-gutter":``},children:e})}function ox(e,t,n,r={}){return U({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[U({tagName:`span`,properties:{"data-line-number-content":``},children:[nx(`${t}`)]})]})}function sx(e,t,n){return U({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function cx(){return U({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[rx({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function lx(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function ux(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var dx=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],fx=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};fx.prototype.normal={},fx.prototype.property={},fx.prototype.space=void 0;function px(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new fx(n,r,t)}function mx(e){return e.toLowerCase()}var hx=class{constructor(e,t){this.attribute=t,this.property=e}};hx.prototype.attribute=``,hx.prototype.booleanish=!1,hx.prototype.boolean=!1,hx.prototype.commaOrSpaceSeparated=!1,hx.prototype.commaSeparated=!1,hx.prototype.defined=!1,hx.prototype.mustUseProperty=!1,hx.prototype.number=!1,hx.prototype.overloadedBoolean=!1,hx.prototype.property=``,hx.prototype.spaceSeparated=!1,hx.prototype.space=void 0;var gx=t({boolean:()=>W,booleanish:()=>vx,commaOrSpaceSeparated:()=>Sx,commaSeparated:()=>xx,number:()=>G,overloadedBoolean:()=>yx,spaceSeparated:()=>bx}),_x=0,W=Cx(),vx=Cx(),yx=Cx(),G=Cx(),bx=Cx(),xx=Cx(),Sx=Cx();function Cx(){return 2**++_x}var wx=Object.keys(gx),Tx=class extends hx{constructor(e,t,n,r){let i=-1;if(super(e,t),Ex(this,`space`,r),typeof n==`number`)for(;++i<wx.length;){let e=wx[i];Ex(this,wx[i],(n&gx[e])===gx[e])}}};Tx.prototype.defined=!0;function Ex(e,t,n){n&&(e[t]=n)}function Dx(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Tx(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[mx(r)]=r,n[mx(a.attribute)]=r}return new fx(t,n,e.space)}var Ox=Dx({properties:{ariaActiveDescendant:null,ariaAtomic:vx,ariaAutoComplete:null,ariaBusy:vx,ariaChecked:vx,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:bx,ariaCurrent:null,ariaDescribedBy:bx,ariaDetails:null,ariaDisabled:vx,ariaDropEffect:bx,ariaErrorMessage:null,ariaExpanded:vx,ariaFlowTo:bx,ariaGrabbed:vx,ariaHasPopup:null,ariaHidden:vx,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:bx,ariaLevel:G,ariaLive:null,ariaModal:vx,ariaMultiLine:vx,ariaMultiSelectable:vx,ariaOrientation:null,ariaOwns:bx,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:vx,ariaReadOnly:vx,ariaRelevant:null,ariaRequired:vx,ariaRoleDescription:bx,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:vx,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 kx(e,t){return t in e?e[t]:t}function Ax(e,t){return kx(e,t.toLowerCase())}var jx=Dx({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:xx,acceptCharset:bx,accessKey:bx,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alpha:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:bx,autoFocus:W,autoPlay:W,blocking:bx,capture:null,charSet:null,checked:W,cite:null,className:bx,closedBy:null,colorSpace:null,cols:G,colSpan:G,command:null,commandFor:null,content:null,contentEditable:vx,controls:W,controlsList:bx,coords:G|xx,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:yx,draggable:vx,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:bx,height:G,hidden:yx,high:G,href:null,hrefLang:null,htmlFor:bx,httpEquiv:bx,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:bx,itemRef:bx,itemScope:W,itemType:bx,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:bx,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:bx,required:W,reversed:W,rows:G,rowSpan:G,sandbox:bx,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:vx,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:vx,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:bx,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:vx,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:xx,part:bx,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:Ax}),Mx=Dx({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:Sx,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:bx,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:xx,g2:xx,glyphName:xx,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:Sx,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:bx,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Sx,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Sx,rev:Sx,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Sx,requiredFeatures:Sx,requiredFonts:Sx,requiredFormats:Sx,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:Sx,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:Sx,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:Sx,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:kx}),Nx=Dx({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()}}),Px=Dx({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Ax}),Fx=Dx({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Ix=/[A-Z]/g,Lx=/-[a-z]/g,Rx=/^data[-\w.:]+$/i;function zx(e,t){let n=mx(t),r=t,i=hx;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Rx.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Lx,Vx);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Lx.test(e)){let n=e.replace(Ix,Bx);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Tx}return new i(r,t)}function Bx(e){return`-`+e.toLowerCase()}function Vx(e){return e.charAt(1).toUpperCase()}var Hx=px([Ox,jx,Nx,Px,Fx],`html`),Ux=px([Ox,Mx,Nx,Px,Fx],`svg`),Wx={}.hasOwnProperty;function Gx(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Wx.call(t,e)){let n=String(t[e]);i=Wx.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 Kx=/["&'<>`]/g,qx=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Jx=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Yx=/[|\\{}()[\]^$+*?.]/g,Xx=new WeakMap;function Zx(e,t){if(e=e.replace(t.subset?Qx(t.subset):Kx,r),t.subset||t.escapeOnly)return e;return e.replace(qx,n).replace(Jx,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 Qx(e){let t=Xx.get(e);return t||(t=$x(e),Xx.set(e,t)),t}function $x(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Yx,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var eS=/[\dA-Fa-f]/;function tS(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!eS.test(String.fromCharCode(t))?r:r+`;`}var nS=/\d/;function rS(e,t,n){let r=`&#`+String(e);return n&&t&&!nS.test(String.fromCharCode(t))?r:r+`;`}var iS=`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(`.`),aS={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:`€`},oS=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],sS={}.hasOwnProperty,cS={},lS;for(lS in aS)sS.call(aS,lS)&&(cS[aS[lS]]=lS);var uS=/[^\dA-Za-z]/;function dS(e,t,n,r){let i=String.fromCharCode(e);if(sS.call(cS,i)){let e=cS[i],a=`&`+e;return n&&iS.includes(e)&&!oS.includes(e)&&(!r||t&&t!==61&&uS.test(String.fromCharCode(t)))?a:a+`;`}return``}function fS(e,t,n){let r=tS(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=dS(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=rS(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function pS(e,t){return Zx(e,Object.assign({format:fS},t))}var mS=/^>|^->|<!--|-->|--!>|<!-$/g,hS=[`>`],gS=[`<`,`>`];function _S(e,t,n,r){return r.settings.bogusComments?`<?`+pS(e.value,Object.assign({},r.settings.characterReferences,{subset:hS}))+`>`:`<!--`+e.value.replace(mS,i)+`-->`;function i(e){return pS(e,Object.assign({},r.settings.characterReferences,{subset:gS}))}}function vS(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function yS(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 bS(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function xS(e){return e.join(` `).trim()}var SS=/[ \t\n\f\r]/g;function CS(e){return typeof e==`object`?e.type===`text`&&wS(e.value):wS(e)}function wS(e){return e.replace(SS,``)===``}var TS=OS(1),ES=OS(-1),DS=[];function OS(e){return t;function t(t,n,r){let i=t?t.children:DS,a=(n||0)+e,o=i[a];if(!r)for(;o&&CS(o);)a+=e,o=i[a];return o}}var kS={}.hasOwnProperty;function AS(e){return t;function t(t,n,r){return kS.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var jS=AS({body:PS,caption:MS,colgroup:MS,dd:RS,dt:LS,head:MS,html:NS,li:IS,optgroup:BS,option:VS,p:FS,rp:zS,rt:zS,tbody:US,td:KS,tfoot:WS,th:KS,thead:HS,tr:GS});function MS(e,t,n){let r=TS(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&CS(r.value.charAt(0)))}function NS(e,t,n){let r=TS(n,t);return!r||r.type!==`comment`}function PS(e,t,n){let r=TS(n,t);return!r||r.type!==`comment`}function FS(e,t,n){let r=TS(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 IS(e,t,n){let r=TS(n,t);return!r||r.type===`element`&&r.tagName===`li`}function LS(e,t,n){let r=TS(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function RS(e,t,n){let r=TS(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function zS(e,t,n){let r=TS(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function BS(e,t,n){let r=TS(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function VS(e,t,n){let r=TS(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function HS(e,t,n){let r=TS(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function US(e,t,n){let r=TS(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function WS(e,t,n){return!TS(n,t)}function GS(e,t,n){let r=TS(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function KS(e,t,n){let r=TS(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var qS=AS({body:XS,colgroup:ZS,head:YS,html:JS,tbody:QS});function JS(e){let t=TS(e,-1);return!t||t.type!==`comment`}function YS(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 XS(e){let t=TS(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&CS(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function ZS(e,t,n){let r=ES(n,t),i=TS(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&jS(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function QS(e,t,n){let r=ES(n,t),i=TS(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&jS(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var $S={name:[[`
29
29
  \f\r &/=>`.split(``),`
30
30
  \f\r "&'/=>\``.split(``)],[`\0
31
31
  \f\r "&'/<=>`.split(``),`\0
@@ -33,12 +33,12 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
33
33
  \f\r &>`.split(``),`\0
34
34
  \f\r "&'<=>\``.split(``)],[`\0
35
35
  \f\r "&'<=>\``.split(``),`\0
36
- \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function nC(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Gx);let l=rC(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!YS(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!NS(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function rC(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=iC(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function iC(e,t,n){let r=Vx(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=hS(r.attribute,Object.assign({},e.settings.characterReferences,{subset:tC.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?SS:CS)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=hS(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:tC.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&xS(n,o)>xS(n,e.alternative)&&(o=e.alternative),s=o+hS(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?tC.single:tC.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var aC=[`<`,`&`];function oC(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:hS(e.value,Object.assign({},r.settings.characterReferences,{subset:aC}))}function sC(e,t,n,r){return r.settings.allowDangerousHtml?e.value:oC(e,t,n,r)}function cC(e,t,n,r){return r.all(e)}var lC=qx(`type`,{invalid:uC,unknown:dC,handlers:{comment:yS,doctype:bS,element:nC,raw:sC,root:cC,text:oC}});function uC(e){throw Error("Expected node, not `"+e+"`")}function dC(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var fC={},pC={},mC=[];function hC(e,t){let n=t||fC,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:gC,all:_C,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||px,characterReferences:n.characterReferences||pC,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Gx:Wx,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function gC(e,t,n){return lC(e,t,n,this)}function _C(e){let t=[],n=e&&e.children||mC,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var vC=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),Vy(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||Wy(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&fx(e.composedPath())||(LC(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(LC(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(LC(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){LC(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();LC(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);LC(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=CC(i)&&this.hoveredLine?.lineElement===i.lineElement;SC(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),SC(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),CC(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(TC(i)&&p!=null){p(i);break}if(wC(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!CC(i))break;SC(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,LC(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),LC(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),LC(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();fx(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(dx(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=hC(ux());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);xC(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(OC(t));if(xC(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(xC(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(xC(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&fx(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=OC(e);if(t&&fx(n))return;let r=kC(e);return r==null?this.pathFromAnnotationSlot(e):OC(r)}pathFromAnnotationSlot(e){let t=jC(AC(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:OC(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=MC(t)?t:MC(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Wy(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,By(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{Vy(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!PC(this.renderedSelectedLinesState,n),i=!PC(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);EC(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=IC(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=IC(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:DC(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:DC(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:FC(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:FC(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function yC({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:bC({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function bC({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function xC(e){return e!=null&&`kind`in e&&e.kind===`line`}function SC(e){return e!=null&&`kind`in e&&e.kind===`token`}function CC(e){return xC(e)||SC(e)}function wC(e){return`type`in e&&e.type===`line-info`}function TC(e){return`kind`in e&&e.kind===`merge-conflict-action`}function EC(e){return e===`current`||e===`incoming`||e===`both`}function DC(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function OC(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function kC(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function AC(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function jC(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function MC(e){return e!=null&&typeof e.elementFromPoint==`function`}function NC(e,t){return e===t||Wy(e??void 0,t??void 0)}function PC(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&NC(e?.range??null,t.range)}function FC(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function IC(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function LC(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var RC=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),VC(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?WC(t):GC(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:zC(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:BC(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&HC(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function zC(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function BC(e){return Math.max(Math.ceil(e),0)}function VC(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?HC(e,{codeWidthChanged:!0,numberWidthChanged:!0}):UC(e))}function HC(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function UC(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function WC(e){e.codeElement.isConnected&&UC(e)}function GC(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}var KC=new Map,qC=new Map,JC=new Map,YC=new Set;function XC(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!YC.has(t))return!1;return!0}function ZC(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(YC.has(n.name))continue;let e=KC.get(n.name);e??(e=n,KC.set(n.name,e)),YC.add(e.name),t.loadLanguageSync(e.data)}}function QC(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var $C=Object.defineProperty,ew=Object.getOwnPropertyDescriptor,tw=Object.getOwnPropertyNames,nw=Object.prototype.hasOwnProperty,rw=(e,t)=>{let n={};for(var r in e)$C(n,r,{get:e[r],enumerable:!0});return t||$C(n,Symbol.toStringTag,{value:`Module`}),n},iw=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=tw(t),a=0,o=i.length,s;a<o;a++)s=i[a],!nw.call(e,s)&&s!==n&&$C(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ew(t,s))||r.enumerable});return e},aw=(e,t,n)=>(iw(e,t,`default`),n&&iw(n,t,`default`)),ow=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),sw=function(e){return`/`+e},cw={},K=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=sw(t,n),t=s(t),t in cw)return;cw[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ow,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},lw=[{id:`abap`,name:`ABAP`,import:(()=>K(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>K(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>K(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>K(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>K(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>K(()=>import(`./_DE0OXEWX.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>K(()=>import(`./_CY9fvXvg.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>K(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>K(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>K(()=>import(`./_YFy-LCwd.js`),__vite__mapDeps([6,2,3,1,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>K(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>K(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>K(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>K(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>K(()=>import(`./_CIBWjTJ8.js`),__vite__mapDeps([10,2,3,9,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>K(()=>import(`./_BWXHIvNe2.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>K(()=>import(`./_B7ZEbQpA2.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>K(()=>import(`./_qdxAdBWQ2.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>K(()=>import(`./_D-usSTwE2.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>K(()=>import(`./_DKpUyyne2.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>K(()=>import(`./_Ci_nEsc72.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>K(()=>import(`./_CUHmPFLl2.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>K(()=>import(`./_CYIUgYqB2.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>K(()=>import(`./_BaqI91VC2.js`),__vite__mapDeps([14,2,3,1,7,8,9,15,16])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>K(()=>import(`./_CpYNKFv52.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>K(()=>import(`./_DIBiig5O2.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>K(()=>import(`./_D0apG41V2.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>K(()=>import(`./_CQ2zXKGN2.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>K(()=>import(`./_kIpfj7zU2.js`),__vite__mapDeps([19,20])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>K(()=>import(`./_JivX8J_W2.js`),__vite__mapDeps([21,22])))},{id:`clarity`,name:`Clarity`,import:(()=>K(()=>import(`./_CtfBBspg2.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>K(()=>import(`./_DqKBuwfJ2.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>K(()=>import(`./_Bj61d0ZC2.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>K(()=>import(`./_isfb253p2.js`),__vite__mapDeps([23,1,2,3,8])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>K(()=>import(`./_C8r90Shi2.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>K(()=>import(`./_oeQT6MSM2.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>K(()=>import(`./_BJO73Smt2.js`),__vite__mapDeps([24,2])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>K(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>K(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>K(()=>import(`./_DqMqiyah.js`).then(e=>e.n),__vite__mapDeps([25,26,27,22])))},{id:`crystal`,name:`Crystal`,import:(()=>K(()=>import(`./_BFytbAm5.js`),__vite__mapDeps([28,2,3,1,16,22,29])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>K(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>K(()=>import(`./_CnYv5yOJ.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>K(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>K(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>K(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>K(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>K(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>K(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>K(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>K(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>K(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>K(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>K(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>K(()=>import(`./_BJIyZxK0.js`),__vite__mapDeps([30,1,2,3,11,15])))},{id:`elixir`,name:`Elixir`,import:(()=>K(()=>import(`./_DLrpVVOP.js`),__vite__mapDeps([31,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>K(()=>import(`./_CDE_l3Ah.js`),__vite__mapDeps([32,27,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>K(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>K(()=>import(`./_C2Swe4f0.js`),__vite__mapDeps([33,1,2,3,34,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>K(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([40,41])))},{id:`fennel`,name:`Fennel`,import:(()=>K(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>K(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>K(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>K(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([42,43])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>K(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>K(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([44,41])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>K(()=>import(`./_CY8IvGdO2.js`),__vite__mapDeps([45,46,47])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>K(()=>import(`./_DYvRD3hg2.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>K(()=>import(`./_CBce3t8t2.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>K(()=>import(`./_CV2tkWYe2.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>K(()=>import(`./_DExj1W_82.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>K(()=>import(`./_Dl-2e7rI2.js`),__vite__mapDeps([48,49])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>K(()=>import(`./_YzHkI38Y2.js`),__vite__mapDeps([50,29])))},{id:`gleam`,name:`Gleam`,import:(()=>K(()=>import(`./_CSRkHgEL2.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>K(()=>import(`./_BZ6_GIpc2.js`),__vite__mapDeps([51,2,3,1,11])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>K(()=>import(`./_DSiCqz1P2.js`),__vite__mapDeps([52,2,3,1,11])))},{id:`glsl`,name:`GLSL`,import:(()=>K(()=>import(`./_DTYxR8JQ.js`).then(e=>e.n),__vite__mapDeps([27,22])))},{id:`gn`,name:`GN`,import:(()=>K(()=>import(`./_ilITqXS62.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>K(()=>import(`./_7GGW24-e2.js`),[]))},{id:`go`,name:`Go`,import:(()=>K(()=>import(`./_rLFTqkRN2.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>K(()=>import(`./_zWA2RsS1.js`).then(e=>e.n),__vite__mapDeps([36,2,11,13,37])))},{id:`groovy`,name:`Groovy`,import:(()=>K(()=>import(`./_CacY0gHj2.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>K(()=>import(`./_kSqeI-Mv2.js`),__vite__mapDeps([53,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>K(()=>import(`./_tY5zLQZp.js`).then(e=>e.n),__vite__mapDeps([35,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>K(()=>import(`./_r4jzjyPa2.js`),__vite__mapDeps([54,2,3,1,39])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>K(()=>import(`./_D8IpX4py2.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>K(()=>import(`./_C8oCnwJJ2.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>K(()=>import(`./_Dh228itO2.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>K(()=>import(`./_CxZEssPk2.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>K(()=>import(`./_Cvrh5tZx2.js`),[]))},{id:`html`,name:`HTML`,import:(()=>K(()=>import(`./_Bit2YbJH.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>K(()=>import(`./_BwTiY7vg2.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>K(()=>import(`./_B60B9ttT2.js`),__vite__mapDeps([55,7,8,9,29,36,2,11,13,37])))},{id:`hurl`,name:`Hurl`,import:(()=>K(()=>import(`./_D69Y468R2.js`),__vite__mapDeps([56,7,8,57,36,2,11,13,37])))},{id:`hxml`,name:`HXML`,import:(()=>K(()=>import(`./_DLbMbJfH2.js`),__vite__mapDeps([58,59])))},{id:`hy`,name:`Hy`,import:(()=>K(()=>import(`./_CZbG8q4J2.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>K(()=>import(`./_DsUTQ-LC2.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>K(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>K(()=>import(`./_DWZwPPmf.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>K(()=>import(`./_DGzOveRF.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>K(()=>import(`./_CAf6rM7T.js`),__vite__mapDeps([60,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>K(()=>import(`./_CRfCwzvc.js`),__vite__mapDeps([61,2])))},{id:`json`,name:`JSON`,import:(()=>K(()=>import(`./_Cay9-_-u.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>K(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>K(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>K(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>K(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>K(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>K(()=>import(`./_DRFrNohk.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>K(()=>import(`./_BGcQuwom.js`),__vite__mapDeps([62,2,16,20,25,26,27,22,63])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>K(()=>import(`./_N_MncSgy.js`),__vite__mapDeps([64,2,11,20,29,34,3,1,7,8,16,22,25,26,27,35,36,13,37,38,39,65])))},{id:`kdl`,name:`KDL`,import:(()=>K(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>K(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>K(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>K(()=>import(`./_BUNsdM7N.js`),__vite__mapDeps([66,67,63])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>K(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>K(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>K(()=>import(`./_ChU_0Gs7.js`),__vite__mapDeps([68,2,3,1,9])))},{id:`llvm`,name:`LLVM IR`,import:(()=>K(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>K(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>K(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>K(()=>import(`./_CdQVpQAM.js`).then(e=>e.n),__vite__mapDeps([38,22])))},{id:`luau`,name:`Luau`,import:(()=>K(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>K(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>K(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>K(()=>import(`./_COjvApw5.js`),__vite__mapDeps([69,3,5,11,70])))},{id:`matlab`,name:`MATLAB`,import:(()=>K(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>K(()=>import(`./_DV3zDssv.js`),__vite__mapDeps([71,15,1,2,3,39,41])))},{id:`mdx`,name:`MDX`,import:(()=>K(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>K(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>K(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>K(()=>import(`./_CFuIV2fl.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>K(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>K(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>K(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>K(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([72,73])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>K(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>K(()=>import(`./_BKAMvBgJ.js`),__vite__mapDeps([74,38,22])))},{id:`nim`,name:`Nim`,import:(()=>K(()=>import(`./_CCC02X-42.js`),__vite__mapDeps([75,2,3,1,7,8,22,27,41])))},{id:`nix`,name:`Nix`,import:(()=>K(()=>import(`./_IvuFDN5E2.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>K(()=>import(`./_CjNLYCLg2.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>K(()=>import(`./_DHYfO66s2.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>K(()=>import(`./_D1A_Heim2.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>K(()=>import(`./_BsSzOQcm2.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>K(()=>import(`./_O90oeIOV2.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>K(()=>import(`./_B1RWQWA52.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>K(()=>import(`./_BUDT5pXO2.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>K(()=>import(`./_DCcYmQ_s2.js`),__vite__mapDeps([76,2,3,1,5,8,7,9,11,13,16,22,20,77,24,26,25,27,29,78,79,49,80,31,38,39,34,35,36,37,41,40,48,50,81,82,83,63,65,66,67,70,84,75,85,86,87,88,89,90,91,92,93])))},{id:`pascal`,name:`Pascal`,import:(()=>K(()=>import(`./_4ZHwLPI52.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>K(()=>import(`./_CToEE4-R.js`),__vite__mapDeps([65,2,3,1,7,8,16])))},{id:`php`,name:`PHP`,import:(()=>K(()=>import(`./_VdtJ_5pb2.js`),__vite__mapDeps([87,2,3,1,7,8,9,16])))},{id:`pkl`,name:`Pkl`,import:(()=>K(()=>import(`./_ot-7Btpt2.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>K(()=>import(`./_DGHpHOYJ2.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>K(()=>import(`./_BiJDBrnU2.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>K(()=>import(`./_C7UOKdEL2.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>K(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>K(()=>import(`./_DNMTfnFr2.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>K(()=>import(`./_CCSX75yM2.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>K(()=>import(`./_DMgNhnYS2.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>K(()=>import(`./_iXnhIJG72.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>K(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>K(()=>import(`./_vIlLN3ua.js`),__vite__mapDeps([94,2,3,1])))},{id:`puppet`,name:`Puppet`,import:(()=>K(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>K(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>K(()=>import(`./_gzcpVVnB2.js`),[]))},{id:`qml`,name:`QML`,import:(()=>K(()=>import(`./_Z_ClK8ZW.js`),__vite__mapDeps([95,2])))},{id:`qmldir`,name:`QML Directory`,import:(()=>K(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>K(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>K(()=>import(`./_AvFmZM6P.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>K(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>K(()=>import(`./_B3gFvitq2.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>K(()=>import(`./_CaEMsx56.js`),__vite__mapDeps([96,1,2,3,78])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>K(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>K(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>K(()=>import(`./_DeeBFErP.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>K(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>K(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>K(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>K(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>K(()=>import(`./_Dou03otF.js`),__vite__mapDeps([97,2,15,1,3,20,98,25,26,27,22,29,39,34,7,8,16,35,36,11,13,37,38])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>K(()=>import(`./_CEW9INI2.js`),__vite__mapDeps([34,2,3,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>K(()=>import(`./_Cfkwpbl82.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>K(()=>import(`./_CL0s7Kya.js`),__vite__mapDeps([99,16])))},{id:`sass`,name:`Sass`,import:(()=>K(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>K(()=>import(`./_BiFt_7mu2.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>K(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>K(()=>import(`./_HN4GzXai.js`).then(e=>e.n),__vite__mapDeps([5,3])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>K(()=>import(`./_bTVj8UrX2.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>K(()=>import(`./_BM315xPC.js`),__vite__mapDeps([100,101])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>K(()=>import(`./_Dnj_upFW.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>K(()=>import(`./_CVbLeR5M.js`),__vite__mapDeps([102,29])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>K(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>K(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>K(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>K(()=>import(`./_BAif6Kkv.js`),__vite__mapDeps([103,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>K(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([104,105])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>K(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>K(()=>import(`./_77Fyk0IZ2.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>K(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>K(()=>import(`./_K3UNrLtV.js`),__vite__mapDeps([106,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>K(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>K(()=>import(`./_CG7XKeSB.js`),__vite__mapDeps([107,2])))},{id:`svelte`,name:`Svelte`,import:(()=>K(()=>import(`./_CbL7aWfv.js`),__vite__mapDeps([108,2,3,11,12])))},{id:`swift`,name:`Swift`,import:(()=>K(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>K(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>K(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>K(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>K(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>K(()=>import(`./_CZd0xW_V2.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>K(()=>import(`./_tv3y18472.js`),__vite__mapDeps([109,2,3,81])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>K(()=>import(`./_DswuEJGm2.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>K(()=>import(`./_C2iaQ953.js`).then(e=>e.n),__vite__mapDeps([67,63])))},{id:`toml`,name:`TOML`,import:(()=>K(()=>import(`./_CcmNWLt02.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>K(()=>import(`./_Db3F1ZqM2.js`),__vite__mapDeps([110,2,3,1,7,8,11,16,27,22])))},{id:`tsv`,name:`TSV`,import:(()=>K(()=>import(`./_sltzmVWM2.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>K(()=>import(`./_CNDu3El-.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>K(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>K(()=>import(`./_Dy1d23fd2.js`),__vite__mapDeps([111,2,3,5,20,34,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39,87,9])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>K(()=>import(`./_DLs3aRaJ.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>K(()=>import(`./_BRdr0IET2.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>K(()=>import(`./_DI99ib-x2.js`),[]))},{id:`v`,name:`V`,import:(()=>K(()=>import(`./_DBj4K9d_2.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>K(()=>import(`./_zf12oZj62.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>K(()=>import(`./_DOwzaHZ02.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>K(()=>import(`./_B2gwz-sJ2.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>K(()=>import(`./_BroJfC0k2.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>K(()=>import(`./_DvXPmvsu2.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>K(()=>import(`./_CvNx2YfP2.js`),__vite__mapDeps([112,2,3,1,9,11,15])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>K(()=>import(`./_BsE1kvV-2.js`),__vite__mapDeps([113,2])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>K(()=>import(`./_Dp01MMO42.js`),__vite__mapDeps([114,2,3,5,12,70,115])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>K(()=>import(`./_CgoNMtux2.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>K(()=>import(`./_ByWQv1Qj2.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>K(()=>import(`./_C8pVoKbM2.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>K(()=>import(`./_BsKzXJz42.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>K(()=>import(`./_ClFFjSW22.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>K(()=>import(`./_DdvCle-K2.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>K(()=>import(`./_DLL8P-h_2.js`),[]))},{id:`xml`,name:`XML`,import:(()=>K(()=>import(`./_7VADVuOA.js`).then(e=>e.n),__vite__mapDeps([7,8])))},{id:`xsl`,name:`XSL`,import:(()=>K(()=>import(`./_DdoBNw7O2.js`),__vite__mapDeps([93,7,8])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>K(()=>import(`./_C6p3UjM0.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>K(()=>import(`./_BnlCZFoB2.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>K(()=>import(`./_CMLA9XwU2.js`),[]))}],uw=Object.fromEntries(lw.map(e=>[e.id,e.import])),dw=Object.fromEntries(lw.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),fw={...uw,...dw},pw=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>K(()=>import(`./_vGVdxbeo2.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>K(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>K(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>K(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>K(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>K(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>K(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>K(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>K(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>K(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>K(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>K(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>K(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>K(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>K(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>K(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>K(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>K(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>K(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>K(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>K(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>K(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>K(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>K(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>K(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>K(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>K(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>K(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>K(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>K(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>K(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>K(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>K(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>K(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>K(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>K(()=>import(`./_Bm3Qr25_2.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>K(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>K(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>K(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>K(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>K(()=>import(`./_BSWPekZh2.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>K(()=>import(`./_DDpmG2fV2.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>K(()=>import(`./_B_bV9PQ92.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>K(()=>import(`./_DhmEMT882.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>K(()=>import(`./_eJ-hLW7d2.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>K(()=>import(`./_Cb4Vim4T2.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>K(()=>import(`./_CLwyXe_n2.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>K(()=>import(`./_D7Lr4KcI2.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>K(()=>import(`./_DQwYfKfQ2.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>K(()=>import(`./_DRFjx7u42.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>K(()=>import(`./_DX1BQOs82.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>K(()=>import(`./_aMsaMD1D2.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>K(()=>import(`./_8PwUyIlP2.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>K(()=>import(`./_DO-qXg-I2.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>K(()=>import(`./_DnToyrRv2.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>K(()=>import(`./_B2OO5cIa2.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>K(()=>import(`./_4G7pJPwS2.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>K(()=>import(`./_UdsmMDCL2.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>K(()=>import(`./_C1IUL_tW2.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>K(()=>import(`./_nFMaYfgc2.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>K(()=>import(`./_oM2G3aXe2.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>K(()=>import(`./_DdrHHSXu2.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>K(()=>import(`./_fwtXNY1n2.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>K(()=>import(`./_BZCL-v6S2.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>K(()=>import(`./_VbXTXTou2.js`),[]))}].map(e=>[e.id,e.import])),mw=t({createOnigurumaEngine:()=>Hw,getDefaultWasmLoader:()=>Vw,loadWasm:()=>Fw,setDefaultWasmLoader:()=>Bw}),hw=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function gw(){return 2147483648}function _w(){return typeof performance<`u`?performance.now():Date.now()}var vw=(e,t)=>e+(t-e%t)%t;async function yw(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=gw();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,vw(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:_w,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 bw=Object.defineProperty,xw=(e,t,n)=>t in e?bw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sw=(e,t,n)=>xw(e,typeof t==`symbol`?t:t+``,n),Cw=null;function ww(e){throw new hw(e.UTF8ToString(e.getLastOnigError()))}var Tw=class e{constructor(t){Sw(this,`utf16Length`),Sw(this,`utf8Length`),Sw(this,`utf16Value`),Sw(this,`utf8Value`),Sw(this,`utf16OffsetToUtf8`),Sw(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}},Ew=class e{constructor(t){if(Sw(this,`id`,++e.LAST_ID),Sw(this,`_onigBinding`),Sw(this,`content`),Sw(this,`utf16Length`),Sw(this,`utf8Length`),Sw(this,`utf16OffsetToUtf8`),Sw(this,`utf8OffsetToUtf16`),Sw(this,`ptr`),!Cw)throw new hw(`Must invoke loadWasm first.`);this._onigBinding=Cw,this.content=t;let n=new Tw(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Cw.omalloc(1e4),e._sharedPtrInUse=!0,Cw.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Cw)}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)}};Sw(Ew,`LAST_ID`,0),Sw(Ew,`_sharedPtr`,0),Sw(Ew,`_sharedPtrInUse`,!1);var Dw=Ew,Ow=class{constructor(e){if(Sw(this,`_onigBinding`),Sw(this,`_ptr`),!Cw)throw new hw(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Tw(e[r]);t[r]=i.createString(Cw),n[r]=i.utf8Length}let r=Cw.omalloc(4*e.length);Cw.HEAPU32.set(t,r/4);let i=Cw.omalloc(4*e.length);Cw.HEAPU32.set(n,i/4);let a=Cw.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)Cw.ofree(t[n]);Cw.ofree(i),Cw.ofree(r),a===0&&ww(Cw),this._onigBinding=Cw,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 Dw(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 kw(e){return typeof e.instantiator==`function`}function Aw(e){return typeof e.default==`function`}function jw(e){return e.data!==void 0}function Mw(e){return typeof Response<`u`&&e instanceof Response}function Nw(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 Pw;function Fw(e){if(Pw)return Pw;async function t(){Cw=await yw(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),kw(n)?n=await n.instantiator(t):Aw(n)?n=await n.default(t):(jw(n)&&(n=n.data),Mw(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Lw(n)(t):await Rw(n)(t):Nw(n)||n instanceof WebAssembly.Module?n=await Iw(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Iw(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Pw=t(),Pw}function Iw(e){return t=>WebAssembly.instantiate(e,t)}function Lw(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Rw(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var zw;function Bw(e){zw=e}function Vw(){return zw}async function Hw(e){return e&&await Fw(e),{createScanner(e){return new Ow(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Dw(e)}}}var Uw=rw({});aw(Uw,mw);var Ww=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Gw(e){return Kw(e)}function Kw(e){return Array.isArray(e)?qw(e):e instanceof RegExp?e:typeof e==`object`?Jw(e):e}function qw(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Kw(e[n]);return t}function Jw(e){let t={};for(let n in e)t[n]=Kw(e[n]);return t}function Yw(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Xw(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Xw(e.substring(0,e.length-1)):e.substr(~t+1)}var Zw=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Qw=class{static hasCaptures(e){return e!==null&&(Zw.lastIndex=0,Zw.test(e))}static replaceCaptures(e,t,n){return e.replace(Zw,(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 $w(e,t){return e<t?-1:+(e>t)}function eT(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=$w(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function tT(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 nT(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var rT=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}},iT=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(lT(e),t)}static createFromParsedTheme(e,t){return fT(e,t)}_cachedMatchRoot=new rT(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=>oT(e.parent,t.parentScopes));return n?new cT(n.fontStyle,n.foreground,n.background):null}},aT=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 oT(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&&!sT(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function sT(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var cT=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function lT(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`&&tT(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&tT(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 uT(l,u,e,o,s,c)}}return n}var uT=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}},dT=(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))(dT||{});function fT(e,t){e.sort((e,t)=>{let n=$w(e.scope,t.scope);return n!==0||(n=eT(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 pT(t),o=new cT(n,a.getId(r),a.getId(i)),s=new gT(new hT(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 iT(a,o,s)}var pT=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)}},mT=Object.freeze([]),hT=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||mT,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)}},gT=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(),hT.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(eT(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 hT(e,t,n,r,i))}},_T=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=yT(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 vT(e){return e}function yT(e){return e}function bT(e,t){let n=[],r=ST(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(xT(i)){let e=[];do e.push(i),i=r.next();while(xT(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 xT(e){return!!e&&!!e.match(/[\w\.:]+/)}function ST(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 CT(e){typeof e.dispose==`function`&&e.dispose()}var wT=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},TT=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},ET=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))}},DT=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new wT(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new ET;for(let n of e)OT(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof wT){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 OT(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 wT?AT({baseGrammar:a,selfGrammar:i},r):kT(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 wT(e))}function kT(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];jT([r],t,n)}}function AT(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&jT(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&jT(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function jT(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Yw({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&jT(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=LT(i);switch(a.kind){case 0:AT({...t,selfGrammar:t.baseGrammar},n);break;case 1:AT(t,n);break;case 2:kT(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?kT(a.ruleName,i,n):AT(i,n)}else a.kind===4?n.add(new TT(a.scopeName,a.ruleName)):n.add(new wT(a.scopeName))}}}var MT=class{kind=0},NT=class{kind=1},PT=class{constructor(e){this.ruleName=e}kind=2},FT=class{constructor(e){this.scopeName=e}kind=3},IT=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function LT(e){if(e===`$base`)return new MT;if(e===`$self`)return new NT;let t=e.indexOf(`#`);return t===-1?new FT(e):t===0?new PT(e.substring(1)):new IT(e.substring(0,t),e.substring(t+1))}var RT=/\\(\d+)/,zT=/\\(\d+)/g,BT=-1,VT=-2;function HT(e){return e}function UT(e){return e}var WT=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Qw.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Qw.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Xw(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:Qw.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Qw.replaceCaptures(this._contentName,e,t)}},GT=class extends WT{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!`)}},KT=class extends WT{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new ZT(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 QT,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qT=class extends WT{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 QT,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},JT=class extends WT{_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 ZT(i,this.id),this.beginCaptures=a,this._end=new ZT(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 QT;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}},YT=class extends WT{_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 ZT(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new ZT(o,VT),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 QT;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 QT,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},XT=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new GT(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new KT(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Yw({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new qT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new YT(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 JT(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=LT(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 qT||e instanceof JT||e instanceof YT)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},ZT=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`&&RT.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 zT.lastIndex=0,this.source.replace(zT,(e,t)=>nT(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}},QT=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 $T(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 $T(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},$T=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(`
37
- `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},eE=class{constructor(e,t){this.languageId=e,this.tokenType=t}},tE=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new eE(e,8),this._embeddedLanguagesMatcher=new nE(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 eE(0,0);_getBasicScopeAttributes=new rT(e=>new eE(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/},nE=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])=>nT(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 rE=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function iE(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=aE(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 rE(i,!0);f()}return new rE(i,!1);function f(){let o=oE(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===BT){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),dE(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 JT){let r=o;dE(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 YT){let r=o;dE(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(dE(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 aE(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 YT&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=uE(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==VT){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),dE(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 oE(e,t,n,r,i,a){let o=sE(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=cE(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 sE(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=lE(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 cE(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}=lE(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 lE(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function uE(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function dE(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));iE(e,p,n&&d.start===0,d.start,f,i,!1,0),CT(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 fE(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var fE=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function pE(e,t,n,r,i,a,o,s){return new _E(e,t,n,r,i,a,o,s)}function mE(e,t,n,r,i){let a=bT(t,hE),o=XT.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 hE(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(gE(t[r],e))return n=r+1,!0;return!1})}function gE(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 _E=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new tE(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=vE(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=bT(e,hE);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)mE(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&&mE(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(HT(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[UT(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]=vE(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=XT.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===bE.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=_T.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?yE.createRootAndLookUpScopeName(a,r,this):yE.createRoot(`unknown`,r),t=new bE(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
38
- `;let a=this.createOnigString(e),o=a.content.length,s=new SE(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=iE(this,a,i,0,t,s,!0,r);return CT(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function vE(e,t){return e=Gw(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 yE=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=aT.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new aT(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new aT(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(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),_T.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}},bE=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)?yE.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(!0)}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:UT(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=yE.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,HT(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,yE.fromExtension(r,n.contentNameScopesList))}},xE=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):bT(e,hE).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>bT(e,hE).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}},SE=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=_T.set(n,0,vT(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=_T.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}},CE=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,pE(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},wE=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new CE(iT.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(iT.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 xE(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new DT(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)}},TE=bE.NULL;function EE(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 DE(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function OE(e){return Array.isArray(e)?e:[e]}async function kE(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function AE(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function jE(e){return e===`ansi`||AE(e)}function ME(e){return e===`none`}function NE(e){return ME(e)}var PE=/(\r?\n)/g;function FE(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(PE),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 IE={light:`#333333`,dark:`#bbbbbb`},LE={light:`#fffffe`,dark:`#1e1e1e`},RE=`__shiki_resolved`;function zE(e){if(e?.[RE])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`?IE.light:IE.dark,n||=t.type===`light`?LE.light:LE.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,RE,{enumerable:!1,writable:!1,value:!0}),t}async function BE(e){return[...new Set((await Promise.all(e.filter(e=>!jE(e)).map(async e=>await kE(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function VE(e){return(await Promise.all(e.map(async e=>NE(e)?null:zE(await kE(e))))).filter(e=>!!e)}function HE(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 Ww(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var UE=class extends wE{_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=zE(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=iT.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=HE(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 Ww(`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))}},WE=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}},GE=0;function KE(e){GE+=1,e.warnings!==!1&&GE>=10&&GE%10==0&&console.warn(`[Shiki] ${GE} 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 Ww("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(zE),i=new UE(new WE(e.engine,n),r,n,e.langAlias),a;function o(t){return HE(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Ww(`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 Ww(`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 BE(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await VE(e))}function g(){if(t)throw new Ww(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--GE)}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 qE(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([VE(e.themes||[]),BE(e.langs||[]),e.engine]);return KE({...e,themes:t,langs:n,engine:r})}var JE=new WeakMap;function YE(e,t){JE.set(e,t)}function XE(e){return JE.get(e)}var ZE=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(OE(n).map(e=>[e,TE])),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 QE(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function QE(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 $E(e,t){if(!(e instanceof ZE))throw new Ww(`Invalid grammar state`);return e.getInternalStack(t)}var eD=/,/,tD=/ /;function nD(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(AE(e.resolveLangAlias(n.lang||`text`))||ME(r))return FE(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 Ww(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Ww(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return iD(t,o,i,a,n)}function rD(...e){if(e.length===2)return XE(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(AE(i)||ME(a))throw new Ww(`Plain language does not have grammar state`);if(i===`ansi`)throw new Ww(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new ZE(aD(n,c,o,s,r).stateStack,c.name,o.name)}function iD(e,t,n,r,i){let a=aD(e,t,n,r,i),o=new ZE(a.stateStack,t.name,n.name);return YE(a.tokens,o),a.tokens}function aD(e,t,n,r,i){let a=EE(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=FE(e),u=i.grammarState?$E(i.grammarState,n.name)??TE:i.grammarContextCode==null?TE:aD(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=DE(r[_T.getForeground(s)],a),u=_T.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=_T.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(eD).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(tD))})}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`?oD(t.scopes):sD(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function oD(e){return e.map(e=>({scopeName:e}))}function sD(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:uD(e,i,t.slice(0,r))}}return n}function cD(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function lD(e,t,n){if(!cD(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)cD(e[r],n[i])&&--r,--i;return r===-1}function uD(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(lD(e,t,n)){r.push(a);break}return r}function dD(e,t,n,r=nD){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:XE(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=fD(...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 ZE(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&YE(s,c),s}function fD(...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 pD=/\s+/g;function mD(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(pD)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(pD);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var hD=/:?lang=["']([^"']+)["']/g,gD=/(?:```|~~~)([\w-]+)/g,_D=/\\begin\{([\w-]+)\}/g,vD=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,yD=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function bD(e){let t=FE(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function xD(e,t,n){let r=new Set;for(let t of e.matchAll(hD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(gD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(_D)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(vD)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(yD.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var SD=[`color`,`background-color`];function CD(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function wD(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function TD(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=wD(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return CD(e,a)})):e}function ED(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>DD(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&SD.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new Ww('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function DD(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&dT.Italic&&(t[`font-style`]=`italic`),e.fontStyle&dT.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&dT.Underline&&n.push(`underline`),e.fontStyle&dT.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function OD(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function kD(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=bD(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new Ww(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new Ww(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new Ww(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));AD(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return TD(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new Ww(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=jD(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new Ww(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new Ww(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&mD(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function AD(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new Ww(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new Ww(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function jD(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(jD).join(``):``}var MD=[kD()];function ND(e){let t=PD(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...MD]}function PD(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var FD=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],ID={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function LD(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function RD(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function zD(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)ID[r]&&t.push({type:`setDecoration`,value:ID[r]});else if(r<=29){let e=ID[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:FD[r-30]}});else if(r===38){let n=RD(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:FD[r-40]}});else if(r===48){let n=RD(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:FD[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:FD[r-100+8]}})}}return t}function BD(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=LD(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=zD(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var VD={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function HD(e=VD){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<FD.length;e++)r.push(t(FD[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var UD=/#([0-9a-f]{3,8})/i,WD=/var\((--[\w-]+-ansi-[\w-]+)\)/,GD={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function KD(e,t,n){let r=EE(e,n),i=FE(t),a=HD(Object.fromEntries(FD.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||GD[t]]}))),o=BD();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=DE(i,r),o=DE(o,r),n.decorations.has(`dim`)&&(i=qD(i));let s=dT.None;return n.decorations.has(`bold`)&&(s|=dT.Bold),n.decorations.has(`italic`)&&(s|=dT.Italic),n.decorations.has(`underline`)&&(s|=dT.Underline),n.decorations.has(`strikethrough`)&&(s|=dT.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function qD(e){let t=e.match(UD);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(WD);return n?`var(${n[1]}-dim)`:e}function JD(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!AE(r)&&!ME(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return KD(r,t,n)}return nD(e,t,n)}function YD(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new Ww("`themes` option must not be empty");let p=dD(e,t,n,JD);if(c=XE(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new Ww(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>ED(e,h,u,l,d))),c&&YE(a,c);let g=f.map(e=>EE(e.theme,n));i=XD(f,m,g,u,l,`fg`,d),r=XD(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=EE(n.theme,n);a=JD(e,t,n);let l=e.getTheme(n.theme);r=DE(l.bg,s),i=DE(l.fg,s),o=l.name,c=XE(a)}else throw new Ww("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function XD(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=DE(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new Ww('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${DE(t[r][a],n[r])||`inherit`}, ${DE(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var ZD=/^\s+$/,QD=/^(\s*)(.*?)(\s*)$/;function $D(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>$D(e,t,n),codeToTokens:(t,n)=>YD(e,t,n)}){let i=t;for(let e of ND(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=YD(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=tO(a):d===`never`&&(a=nO(a)),f&&(a=rO(a));let p={...r,get source(){return i}};for(let e of ND(n))a=e.tokens?.call(p,a)||a;return eO(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function eO(e,t,n,r=XE(e)){let i=ND(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:mD,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
39
- `}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=OD(a.htmlStyle||DD(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&YE(m,r),m}function tO(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&dT.Underline||i.fontStyle&dT.Strikethrough));o&&ZD.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function nO(e){return e.map(e=>e.flatMap(e=>{if(ZD.test(e.content))return e;let t=e.content.match(QD);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function rO(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=OD(e.htmlStyle||DD(e)),i=OD(n.htmlStyle||DD(n)),a=e.fontStyle&&(e.fontStyle&dT.Underline||e.fontStyle&dT.Strikethrough),o=n.fontStyle&&(n.fontStyle&dT.Underline||n.fontStyle&dT.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var iO=hC;function aO(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>$D(e,t,n),codeToTokens:(t,n)=>YD(e,t,n)},i=iO($D(e,t,n,r));for(let e of ND(n))i=e.postprocess?.call(r,i,n)||i;return i}async function oO(e){let t=await qE(e);return{getLastGrammarState:(...e)=>rD(t,...e),codeToTokensBase:(e,n)=>JD(t,e,n),codeToTokensWithThemes:(e,n)=>dD(t,e,n),codeToTokens:(e,n)=>YD(t,e,n),codeToHast:(e,n)=>$D(t,e,n),codeToHtml:(e,n)=>aO(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function sO(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,jE(n))return[];let r=t[n];if(!r)throw new Ww(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(NE(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new Ww(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await oO({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function cO(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function lO(e,t){let n=cO(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var uO=sO({langs:fw,themes:pw,engine:()=>(0,Uw.createOnigurumaEngine)(K(()=>import(`./_BnjxR4X6.js`),[]))}),{codeToHtml:Xee,codeToHast:Zee,codeToTokens:Qee,codeToTokensBase:$ee,codeToTokensWithThemes:ete,getSingletonHighlighter:tte,getLastGrammarState:nte}=lO(uO,{guessEmbeddedLanguages:xD}),dO=4294967295,fO=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:dO,end:dO,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function pO(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function mO(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var hO=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),gO=String.raw;function _O(e,t){if(e==null)throw Error(t??`Value expected`);return e}var vO=gO`\[\^?`,yO=`c.? | C(?:-.?)?|${gO`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${gO`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${gO`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${gO`o\{[^\}]*\}?`}|${gO`\d{1,3}`}`,bO=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,xO=new RegExp(gO`
36
+ \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function eC(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Ux);let l=tC(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!qS(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!jS(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function tC(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=nC(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function nC(e,t,n){let r=zx(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=pS(r.attribute,Object.assign({},e.settings.characterReferences,{subset:$S.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?bS:xS)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=pS(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:$S.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&yS(n,o)>yS(n,e.alternative)&&(o=e.alternative),s=o+pS(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?$S.single:$S.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var rC=[`<`,`&`];function iC(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:pS(e.value,Object.assign({},r.settings.characterReferences,{subset:rC}))}function aC(e,t,n,r){return r.settings.allowDangerousHtml?e.value:iC(e,t,n,r)}function oC(e,t,n,r){return r.all(e)}var sC=Gx(`type`,{invalid:cC,unknown:lC,handlers:{comment:_S,doctype:vS,element:eC,raw:aC,root:oC,text:iC}});function cC(e){throw Error("Expected node, not `"+e+"`")}function lC(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var uC={},dC={},fC=[];function pC(e,t){let n=t||uC,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:mC,all:hC,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||dx,characterReferences:n.characterReferences||dC,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Ux:Hx,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function mC(e,t,n){return sC(e,t,n,this)}function hC(e){let t=[],n=e&&e.children||fC,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var gC=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),zy(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||Hy(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&ux(e.composedPath())||(FC(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(FC(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(FC(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){FC(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();FC(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);FC(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=xC(i)&&this.hoveredLine?.lineElement===i.lineElement;bC(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),bC(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),xC(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(CC(i)&&p!=null){p(i);break}if(SC(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!xC(i))break;bC(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,FC(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),FC(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),FC(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();ux(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(lx(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=pC(cx());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);yC(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(EC(t));if(yC(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(yC(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(yC(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&ux(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=EC(e);if(t&&ux(n))return;let r=DC(e);return r==null?this.pathFromAnnotationSlot(e):EC(r)}pathFromAnnotationSlot(e){let t=kC(OC(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:EC(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=AC(t)?t:AC(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Hy(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,Ry(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{zy(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!MC(this.renderedSelectedLinesState,n),i=!MC(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);wC(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=PC(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=PC(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:TC(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:TC(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:NC(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:NC(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function _C({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:vC({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function vC({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function yC(e){return e!=null&&`kind`in e&&e.kind===`line`}function bC(e){return e!=null&&`kind`in e&&e.kind===`token`}function xC(e){return yC(e)||bC(e)}function SC(e){return`type`in e&&e.type===`line-info`}function CC(e){return`kind`in e&&e.kind===`merge-conflict-action`}function wC(e){return e===`current`||e===`incoming`||e===`both`}function TC(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function EC(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function DC(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function OC(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function kC(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function AC(e){return e!=null&&typeof e.elementFromPoint==`function`}function jC(e,t){return e===t||Hy(e??void 0,t??void 0)}function MC(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&jC(e?.range??null,t.range)}function NC(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function PC(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function FC(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var IC=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),zC(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?HC(t):UC(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:LC(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:RC(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&BC(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function LC(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function RC(e){return Math.max(Math.ceil(e),0)}function zC(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?BC(e,{codeWidthChanged:!0,numberWidthChanged:!0}):VC(e))}function BC(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function VC(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function HC(e){e.codeElement.isConnected&&VC(e)}function UC(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}var WC=new Map,GC=new Map,KC=new Map,qC=new Set;function JC(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!qC.has(t))return!1;return!0}function YC(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(qC.has(n.name))continue;let e=WC.get(n.name);e??(e=n,WC.set(n.name,e)),qC.add(e.name),t.loadLanguageSync(e.data)}}function XC(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var ZC=Object.defineProperty,QC=Object.getOwnPropertyDescriptor,$C=Object.getOwnPropertyNames,ew=Object.prototype.hasOwnProperty,tw=(e,t)=>{let n={};for(var r in e)ZC(n,r,{get:e[r],enumerable:!0});return t||ZC(n,Symbol.toStringTag,{value:`Module`}),n},nw=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=$C(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ew.call(e,s)&&s!==n&&ZC(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=QC(t,s))||r.enumerable});return e},rw=(e,t,n)=>(nw(e,t,`default`),n&&nw(n,t,`default`)),iw=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),aw=function(e){return`/`+e},ow={},K=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=aw(t,n),t=s(t),t in ow)return;ow[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:iw,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},sw=[{id:`abap`,name:`ABAP`,import:(()=>K(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>K(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>K(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>K(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>K(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>K(()=>import(`./_Brh7taK_.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>K(()=>import(`./_-gyK8vJ-.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>K(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>K(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>K(()=>import(`./_Dp25UBl7.js`),__vite__mapDeps([6,2,3,1,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>K(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>K(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>K(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>K(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>K(()=>import(`./_CzGoLHpy.js`),__vite__mapDeps([10,2,3,9,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>K(()=>import(`./_BWXHIvNe2.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>K(()=>import(`./_B7ZEbQpA2.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>K(()=>import(`./_qdxAdBWQ2.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>K(()=>import(`./_D-usSTwE2.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>K(()=>import(`./_DKpUyyne2.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>K(()=>import(`./_Ci_nEsc72.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>K(()=>import(`./_CUHmPFLl2.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>K(()=>import(`./_CYIUgYqB2.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>K(()=>import(`./_Ca6yBPZK2.js`),__vite__mapDeps([14,2,3,1,7,8,9,15,16])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>K(()=>import(`./_CpYNKFv52.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>K(()=>import(`./_BpWV4xDR2.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>K(()=>import(`./_D0apG41V2.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>K(()=>import(`./_CQ2zXKGN2.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>K(()=>import(`./_kIpfj7zU2.js`),__vite__mapDeps([19,20])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>K(()=>import(`./_xHfOHdoE2.js`),__vite__mapDeps([21,22])))},{id:`clarity`,name:`Clarity`,import:(()=>K(()=>import(`./_CtfBBspg2.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>K(()=>import(`./_DqKBuwfJ2.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>K(()=>import(`./_Bj61d0ZC2.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>K(()=>import(`./_Bw-xXnfr2.js`),__vite__mapDeps([23,1,2,3,8])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>K(()=>import(`./_C8r90Shi2.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>K(()=>import(`./_oeQT6MSM2.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>K(()=>import(`./_Ct7oMGlY2.js`),__vite__mapDeps([24,2])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>K(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>K(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>K(()=>import(`./_CxVlY1q1.js`).then(e=>e.n),__vite__mapDeps([25,26,27,22])))},{id:`crystal`,name:`Crystal`,import:(()=>K(()=>import(`./_DU_7z2vs.js`),__vite__mapDeps([28,2,3,1,16,22,29])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>K(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>K(()=>import(`./_D0UH-qzF.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>K(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>K(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>K(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>K(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>K(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>K(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>K(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>K(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>K(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>K(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>K(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>K(()=>import(`./_DDtfsPTV.js`),__vite__mapDeps([30,1,2,3,11,15])))},{id:`elixir`,name:`Elixir`,import:(()=>K(()=>import(`./_CJfh1bA_.js`),__vite__mapDeps([31,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>K(()=>import(`./_BtGc54QO.js`),__vite__mapDeps([32,27,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>K(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>K(()=>import(`./_Gpz7cA9P.js`),__vite__mapDeps([33,1,2,3,34,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>K(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([40,41])))},{id:`fennel`,name:`Fennel`,import:(()=>K(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>K(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>K(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>K(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([42,43])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>K(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>K(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([44,41])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>K(()=>import(`./_CY8IvGdO2.js`),__vite__mapDeps([45,46,47])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>K(()=>import(`./_DYvRD3hg2.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>K(()=>import(`./_CBce3t8t2.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>K(()=>import(`./_CV2tkWYe2.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>K(()=>import(`./_DExj1W_82.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>K(()=>import(`./_Dl-2e7rI2.js`),__vite__mapDeps([48,49])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>K(()=>import(`./_CTwY-w6f2.js`),__vite__mapDeps([50,29])))},{id:`gleam`,name:`Gleam`,import:(()=>K(()=>import(`./_CSRkHgEL2.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>K(()=>import(`./_ioxvNBlq2.js`),__vite__mapDeps([51,2,3,1,11])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>K(()=>import(`./_VpkJ9R4I2.js`),__vite__mapDeps([52,2,3,1,11])))},{id:`glsl`,name:`GLSL`,import:(()=>K(()=>import(`./_CCWd2cbl.js`).then(e=>e.n),__vite__mapDeps([27,22])))},{id:`gn`,name:`GN`,import:(()=>K(()=>import(`./_ilITqXS62.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>K(()=>import(`./_7GGW24-e2.js`),[]))},{id:`go`,name:`Go`,import:(()=>K(()=>import(`./_rLFTqkRN2.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>K(()=>import(`./_DmaZeTni.js`).then(e=>e.n),__vite__mapDeps([36,2,11,13,37])))},{id:`groovy`,name:`Groovy`,import:(()=>K(()=>import(`./_CacY0gHj2.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>K(()=>import(`./_LLhMP4fB2.js`),__vite__mapDeps([53,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>K(()=>import(`./_CLa87tfT.js`).then(e=>e.n),__vite__mapDeps([35,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>K(()=>import(`./_BzmURZrG2.js`),__vite__mapDeps([54,2,3,1,39])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>K(()=>import(`./_D8IpX4py2.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>K(()=>import(`./_C8oCnwJJ2.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>K(()=>import(`./_Dh228itO2.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>K(()=>import(`./_CxZEssPk2.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>K(()=>import(`./_Cvrh5tZx2.js`),[]))},{id:`html`,name:`HTML`,import:(()=>K(()=>import(`./_RHQKbTNw.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>K(()=>import(`./_DQxqrF2p2.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>K(()=>import(`./_BMK2JGG-2.js`),__vite__mapDeps([55,7,8,9,29,36,2,11,13,37])))},{id:`hurl`,name:`Hurl`,import:(()=>K(()=>import(`./_CNPd6AKz2.js`),__vite__mapDeps([56,7,8,57,36,2,11,13,37])))},{id:`hxml`,name:`HXML`,import:(()=>K(()=>import(`./_DLbMbJfH2.js`),__vite__mapDeps([58,59])))},{id:`hy`,name:`Hy`,import:(()=>K(()=>import(`./_CZbG8q4J2.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>K(()=>import(`./_DsUTQ-LC2.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>K(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>K(()=>import(`./_VdrzhuKU.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>K(()=>import(`./_B6OKTJ3U.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>K(()=>import(`./_DrB0wHeE.js`),__vite__mapDeps([60,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>K(()=>import(`./_CXQQiNs1.js`),__vite__mapDeps([61,2])))},{id:`json`,name:`JSON`,import:(()=>K(()=>import(`./_l-4CNi-P.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>K(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>K(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>K(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>K(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>K(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>K(()=>import(`./_CnphyoYq.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>K(()=>import(`./_9XtunSg7.js`),__vite__mapDeps([62,2,16,20,25,26,27,22,63])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>K(()=>import(`./_Cs2xR5zT.js`),__vite__mapDeps([64,2,11,20,29,34,3,1,7,8,16,22,25,26,27,35,36,13,37,38,39,65])))},{id:`kdl`,name:`KDL`,import:(()=>K(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>K(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>K(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>K(()=>import(`./_B4U6RXlg.js`),__vite__mapDeps([66,67,63])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>K(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>K(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>K(()=>import(`./_Cm86uuyb.js`),__vite__mapDeps([68,2,3,1,9])))},{id:`llvm`,name:`LLVM IR`,import:(()=>K(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>K(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>K(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>K(()=>import(`./_v0CL1jTB.js`).then(e=>e.n),__vite__mapDeps([38,22])))},{id:`luau`,name:`Luau`,import:(()=>K(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>K(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>K(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>K(()=>import(`./_B31BFjeo.js`),__vite__mapDeps([69,3,5,11,70])))},{id:`matlab`,name:`MATLAB`,import:(()=>K(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>K(()=>import(`./_CvIA8snX.js`),__vite__mapDeps([71,15,1,2,3,39,41])))},{id:`mdx`,name:`MDX`,import:(()=>K(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>K(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>K(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>K(()=>import(`./_CFuIV2fl.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>K(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>K(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>K(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>K(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([72,73])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>K(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>K(()=>import(`./_DH0HY4Nr.js`),__vite__mapDeps([74,38,22])))},{id:`nim`,name:`Nim`,import:(()=>K(()=>import(`./_speyknRe2.js`),__vite__mapDeps([75,2,3,1,7,8,22,27,41])))},{id:`nix`,name:`Nix`,import:(()=>K(()=>import(`./_IvuFDN5E2.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>K(()=>import(`./_CjNLYCLg2.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>K(()=>import(`./_DHYfO66s2.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>K(()=>import(`./_D1A_Heim2.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>K(()=>import(`./_BsSzOQcm2.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>K(()=>import(`./_O90oeIOV2.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>K(()=>import(`./_B1RWQWA52.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>K(()=>import(`./_BUDT5pXO2.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>K(()=>import(`./_BmaVzQYH2.js`),__vite__mapDeps([76,2,3,1,5,8,7,9,11,13,16,22,20,77,24,26,25,27,29,78,79,49,80,31,38,39,34,35,36,37,41,40,48,50,81,82,83,63,65,66,67,70,84,75,85,86,87,88,89,90,91,92,93])))},{id:`pascal`,name:`Pascal`,import:(()=>K(()=>import(`./_4ZHwLPI52.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>K(()=>import(`./_BsL8kuCs.js`),__vite__mapDeps([65,2,3,1,7,8,16])))},{id:`php`,name:`PHP`,import:(()=>K(()=>import(`./_CqX4LQGj2.js`),__vite__mapDeps([87,2,3,1,7,8,9,16])))},{id:`pkl`,name:`Pkl`,import:(()=>K(()=>import(`./_ot-7Btpt2.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>K(()=>import(`./_DGHpHOYJ2.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>K(()=>import(`./_BiJDBrnU2.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>K(()=>import(`./_C7UOKdEL2.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>K(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>K(()=>import(`./_DNMTfnFr2.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>K(()=>import(`./_CCSX75yM2.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>K(()=>import(`./_DMgNhnYS2.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>K(()=>import(`./_iXnhIJG72.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>K(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>K(()=>import(`./__WU9JTqk.js`),__vite__mapDeps([94,2,3,1])))},{id:`puppet`,name:`Puppet`,import:(()=>K(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>K(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>K(()=>import(`./_gzcpVVnB2.js`),[]))},{id:`qml`,name:`QML`,import:(()=>K(()=>import(`./_CypNdMTQ.js`),__vite__mapDeps([95,2])))},{id:`qmldir`,name:`QML Directory`,import:(()=>K(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>K(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>K(()=>import(`./_BD3GuTLe.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>K(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>K(()=>import(`./_B3gFvitq2.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>K(()=>import(`./_BOMR_lTT.js`),__vite__mapDeps([96,1,2,3,78])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>K(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>K(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>K(()=>import(`./_vvqUsxvZ.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>K(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>K(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>K(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>K(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>K(()=>import(`./_BLA94hyL.js`),__vite__mapDeps([97,2,15,1,3,20,98,25,26,27,22,29,39,34,7,8,16,35,36,11,13,37,38])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>K(()=>import(`./_CCOa-67I.js`),__vite__mapDeps([34,2,3,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>K(()=>import(`./_Cfkwpbl82.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>K(()=>import(`./_C0VVn7_H.js`),__vite__mapDeps([99,16])))},{id:`sass`,name:`Sass`,import:(()=>K(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>K(()=>import(`./_BiFt_7mu2.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>K(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>K(()=>import(`./_rdXXJ91o.js`).then(e=>e.n),__vite__mapDeps([5,3])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>K(()=>import(`./_bTVj8UrX2.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>K(()=>import(`./_BM315xPC.js`),__vite__mapDeps([100,101])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>K(()=>import(`./_UABdeDPG.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>K(()=>import(`./_CvPUh_B0.js`),__vite__mapDeps([102,29])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>K(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>K(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>K(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>K(()=>import(`./_wyUUoFip.js`),__vite__mapDeps([103,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>K(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([104,105])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>K(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>K(()=>import(`./_CKHJpMi32.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>K(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>K(()=>import(`./_BuU3dU-v.js`),__vite__mapDeps([106,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>K(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>K(()=>import(`./_BP3KIWZr.js`),__vite__mapDeps([107,2])))},{id:`svelte`,name:`Svelte`,import:(()=>K(()=>import(`./_B7X9man_.js`),__vite__mapDeps([108,2,3,11,12])))},{id:`swift`,name:`Swift`,import:(()=>K(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>K(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>K(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>K(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>K(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>K(()=>import(`./_CZd0xW_V2.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>K(()=>import(`./_GlOqBOcg2.js`),__vite__mapDeps([109,2,3,81])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>K(()=>import(`./_DswuEJGm2.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>K(()=>import(`./_B8okAqG-.js`).then(e=>e.n),__vite__mapDeps([67,63])))},{id:`toml`,name:`TOML`,import:(()=>K(()=>import(`./_CcmNWLt02.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>K(()=>import(`./_D8DKeNtk2.js`),__vite__mapDeps([110,2,3,1,7,8,11,16,27,22])))},{id:`tsv`,name:`TSV`,import:(()=>K(()=>import(`./_sltzmVWM2.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>K(()=>import(`./_BH3qAqXE.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>K(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>K(()=>import(`./_Dvy34Yg_2.js`),__vite__mapDeps([111,2,3,5,20,34,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39,87,9])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>K(()=>import(`./__Q8ATTST.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>K(()=>import(`./_BRdr0IET2.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>K(()=>import(`./_DI99ib-x2.js`),[]))},{id:`v`,name:`V`,import:(()=>K(()=>import(`./_DBj4K9d_2.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>K(()=>import(`./_zf12oZj62.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>K(()=>import(`./_DOwzaHZ02.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>K(()=>import(`./_B2gwz-sJ2.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>K(()=>import(`./_BroJfC0k2.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>K(()=>import(`./_DvXPmvsu2.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>K(()=>import(`./_DXjhrVim2.js`),__vite__mapDeps([112,2,3,1,9,11,15])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>K(()=>import(`./_K6YjF5HA2.js`),__vite__mapDeps([113,2])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>K(()=>import(`./_BCDnEeXi2.js`),__vite__mapDeps([114,2,3,5,12,70,115])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>K(()=>import(`./_CgoNMtux2.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>K(()=>import(`./_ByWQv1Qj2.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>K(()=>import(`./_C8pVoKbM2.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>K(()=>import(`./_BsKzXJz42.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>K(()=>import(`./_ClFFjSW22.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>K(()=>import(`./_DdvCle-K2.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>K(()=>import(`./_DLL8P-h_2.js`),[]))},{id:`xml`,name:`XML`,import:(()=>K(()=>import(`./_DoNipARR.js`).then(e=>e.n),__vite__mapDeps([7,8])))},{id:`xsl`,name:`XSL`,import:(()=>K(()=>import(`./_Ne8qEUH82.js`),__vite__mapDeps([93,7,8])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>K(()=>import(`./_DtW-KREB.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>K(()=>import(`./_BnlCZFoB2.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>K(()=>import(`./_CMLA9XwU2.js`),[]))}],cw=Object.fromEntries(sw.map(e=>[e.id,e.import])),lw=Object.fromEntries(sw.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),uw={...cw,...lw},dw=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>K(()=>import(`./_vGVdxbeo2.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>K(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>K(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>K(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>K(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>K(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>K(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>K(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>K(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>K(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>K(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>K(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>K(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>K(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>K(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>K(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>K(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>K(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>K(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>K(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>K(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>K(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>K(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>K(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>K(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>K(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>K(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>K(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>K(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>K(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>K(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>K(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>K(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>K(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>K(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>K(()=>import(`./_Bm3Qr25_2.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>K(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>K(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>K(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>K(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>K(()=>import(`./_BSWPekZh2.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>K(()=>import(`./_DDpmG2fV2.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>K(()=>import(`./_B_bV9PQ92.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>K(()=>import(`./_DhmEMT882.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>K(()=>import(`./_eJ-hLW7d2.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>K(()=>import(`./_Cb4Vim4T2.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>K(()=>import(`./_CLwyXe_n2.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>K(()=>import(`./_D7Lr4KcI2.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>K(()=>import(`./_DQwYfKfQ2.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>K(()=>import(`./_DRFjx7u42.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>K(()=>import(`./_DX1BQOs82.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>K(()=>import(`./_aMsaMD1D2.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>K(()=>import(`./_8PwUyIlP2.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>K(()=>import(`./_DO-qXg-I2.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>K(()=>import(`./_DnToyrRv2.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>K(()=>import(`./_B2OO5cIa2.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>K(()=>import(`./_4G7pJPwS2.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>K(()=>import(`./_UdsmMDCL2.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>K(()=>import(`./_C1IUL_tW2.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>K(()=>import(`./_nFMaYfgc2.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>K(()=>import(`./_oM2G3aXe2.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>K(()=>import(`./_DdrHHSXu2.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>K(()=>import(`./_fwtXNY1n2.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>K(()=>import(`./_BZCL-v6S2.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>K(()=>import(`./_VbXTXTou2.js`),[]))}].map(e=>[e.id,e.import])),fw=t({createOnigurumaEngine:()=>Bw,getDefaultWasmLoader:()=>zw,loadWasm:()=>Nw,setDefaultWasmLoader:()=>Rw}),pw=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function mw(){return 2147483648}function hw(){return typeof performance<`u`?performance.now():Date.now()}var gw=(e,t)=>e+(t-e%t)%t;async function _w(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=mw();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,gw(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:hw,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 vw=Object.defineProperty,yw=(e,t,n)=>t in e?vw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bw=(e,t,n)=>yw(e,typeof t==`symbol`?t:t+``,n),xw=null;function Sw(e){throw new pw(e.UTF8ToString(e.getLastOnigError()))}var Cw=class e{constructor(t){bw(this,`utf16Length`),bw(this,`utf8Length`),bw(this,`utf16Value`),bw(this,`utf8Value`),bw(this,`utf16OffsetToUtf8`),bw(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}},ww=class e{constructor(t){if(bw(this,`id`,++e.LAST_ID),bw(this,`_onigBinding`),bw(this,`content`),bw(this,`utf16Length`),bw(this,`utf8Length`),bw(this,`utf16OffsetToUtf8`),bw(this,`utf8OffsetToUtf16`),bw(this,`ptr`),!xw)throw new pw(`Must invoke loadWasm first.`);this._onigBinding=xw,this.content=t;let n=new Cw(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=xw.omalloc(1e4),e._sharedPtrInUse=!0,xw.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(xw)}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)}};bw(ww,`LAST_ID`,0),bw(ww,`_sharedPtr`,0),bw(ww,`_sharedPtrInUse`,!1);var Tw=ww,Ew=class{constructor(e){if(bw(this,`_onigBinding`),bw(this,`_ptr`),!xw)throw new pw(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Cw(e[r]);t[r]=i.createString(xw),n[r]=i.utf8Length}let r=xw.omalloc(4*e.length);xw.HEAPU32.set(t,r/4);let i=xw.omalloc(4*e.length);xw.HEAPU32.set(n,i/4);let a=xw.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)xw.ofree(t[n]);xw.ofree(i),xw.ofree(r),a===0&&Sw(xw),this._onigBinding=xw,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 Tw(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 Dw(e){return typeof e.instantiator==`function`}function Ow(e){return typeof e.default==`function`}function kw(e){return e.data!==void 0}function Aw(e){return typeof Response<`u`&&e instanceof Response}function jw(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 Mw;function Nw(e){if(Mw)return Mw;async function t(){xw=await _w(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Dw(n)?n=await n.instantiator(t):Ow(n)?n=await n.default(t):(kw(n)&&(n=n.data),Aw(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Fw(n)(t):await Iw(n)(t):jw(n)||n instanceof WebAssembly.Module?n=await Pw(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Pw(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Mw=t(),Mw}function Pw(e){return t=>WebAssembly.instantiate(e,t)}function Fw(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Iw(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Lw;function Rw(e){Lw=e}function zw(){return Lw}async function Bw(e){return e&&await Nw(e),{createScanner(e){return new Ew(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Tw(e)}}}var Vw=tw({});rw(Vw,fw);var Hw=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Uw(e){return Ww(e)}function Ww(e){return Array.isArray(e)?Gw(e):e instanceof RegExp?e:typeof e==`object`?Kw(e):e}function Gw(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Ww(e[n]);return t}function Kw(e){let t={};for(let n in e)t[n]=Ww(e[n]);return t}function qw(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Jw(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Jw(e.substring(0,e.length-1)):e.substr(~t+1)}var Yw=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Xw=class{static hasCaptures(e){return e!==null&&(Yw.lastIndex=0,Yw.test(e))}static replaceCaptures(e,t,n){return e.replace(Yw,(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 Zw(e,t){return e<t?-1:+(e>t)}function Qw(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=Zw(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function $w(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 eT(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var tT=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}},nT=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(sT(e),t)}static createFromParsedTheme(e,t){return uT(e,t)}_cachedMatchRoot=new tT(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=>iT(e.parent,t.parentScopes));return n?new oT(n.fontStyle,n.foreground,n.background):null}},rT=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 iT(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&&!aT(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function aT(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var oT=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function sT(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`&&$w(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&$w(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 cT(l,u,e,o,s,c)}}return n}var cT=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}},lT=(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))(lT||{});function uT(e,t){e.sort((e,t)=>{let n=Zw(e.scope,t.scope);return n!==0||(n=Qw(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 dT(t),o=new oT(n,a.getId(r),a.getId(i)),s=new mT(new pT(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 nT(a,o,s)}var dT=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)}},fT=Object.freeze([]),pT=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||fT,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)}},mT=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(),pT.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(Qw(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 pT(e,t,n,r,i))}},hT=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=_T(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 gT(e){return e}function _T(e){return e}function vT(e,t){let n=[],r=bT(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(yT(i)){let e=[];do e.push(i),i=r.next();while(yT(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 yT(e){return!!e&&!!e.match(/[\w\.:]+/)}function bT(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 xT(e){typeof e.dispose==`function`&&e.dispose()}var ST=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},CT=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},wT=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))}},TT=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new ST(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new wT;for(let n of e)ET(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof ST){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 ET(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 ST?OT({baseGrammar:a,selfGrammar:i},r):DT(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 ST(e))}function DT(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];kT([r],t,n)}}function OT(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&kT(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&kT(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function kT(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?qw({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&kT(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=FT(i);switch(a.kind){case 0:OT({...t,selfGrammar:t.baseGrammar},n);break;case 1:OT(t,n);break;case 2:DT(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?DT(a.ruleName,i,n):OT(i,n)}else a.kind===4?n.add(new CT(a.scopeName,a.ruleName)):n.add(new ST(a.scopeName))}}}var AT=class{kind=0},jT=class{kind=1},MT=class{constructor(e){this.ruleName=e}kind=2},NT=class{constructor(e){this.scopeName=e}kind=3},PT=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function FT(e){if(e===`$base`)return new AT;if(e===`$self`)return new jT;let t=e.indexOf(`#`);return t===-1?new NT(e):t===0?new MT(e.substring(1)):new PT(e.substring(0,t),e.substring(t+1))}var IT=/\\(\d+)/,LT=/\\(\d+)/g,RT=-1,zT=-2;function BT(e){return e}function VT(e){return e}var HT=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Xw.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Xw.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Jw(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:Xw.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Xw.replaceCaptures(this._contentName,e,t)}},UT=class extends HT{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!`)}},WT=class extends HT{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new YT(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 XT,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},GT=class extends HT{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 XT,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},KT=class extends HT{_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 YT(i,this.id),this.beginCaptures=a,this._end=new YT(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 XT;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}},qT=class extends HT{_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 YT(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new YT(o,zT),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 XT;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 XT,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},JT=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new UT(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new WT(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=qw({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new GT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new qT(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 KT(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=FT(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 GT||e instanceof KT||e instanceof qT)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},YT=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`&&IT.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 LT.lastIndex=0,this.source.replace(LT,(e,t)=>eT(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}},XT=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 ZT(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 ZT(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},ZT=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(`
37
+ `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},QT=class{constructor(e,t){this.languageId=e,this.tokenType=t}},$T=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new QT(e,8),this._embeddedLanguagesMatcher=new eE(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 QT(0,0);_getBasicScopeAttributes=new tT(e=>new QT(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/},eE=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])=>eT(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 tE=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function nE(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=rE(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 tE(i,!0);f()}return new tE(i,!1);function f(){let o=iE(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===RT){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),lE(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 KT){let r=o;lE(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 qT){let r=o;lE(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(lE(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 rE(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 qT&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=cE(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==zT){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),lE(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 iE(e,t,n,r,i,a){let o=aE(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=oE(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 aE(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=sE(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 oE(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}=sE(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 sE(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function cE(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function lE(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));nE(e,p,n&&d.start===0,d.start,f,i,!1,0),xT(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 uE(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var uE=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function dE(e,t,n,r,i,a,o,s){return new hE(e,t,n,r,i,a,o,s)}function fE(e,t,n,r,i){let a=vT(t,pE),o=JT.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 pE(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(mE(t[r],e))return n=r+1,!0;return!1})}function mE(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 hE=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new $T(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=gE(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=vT(e,pE);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)fE(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&&fE(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(BT(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[VT(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]=gE(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=JT.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===vE.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=hT.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?_E.createRootAndLookUpScopeName(a,r,this):_E.createRoot(`unknown`,r),t=new vE(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
38
+ `;let a=this.createOnigString(e),o=a.content.length,s=new bE(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=nE(this,a,i,0,t,s,!0,r);return xT(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function gE(e,t){return e=Uw(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 _E=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=rT.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new rT(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new rT(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(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),hT.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}},vE=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)?_E.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(!0)}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:VT(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=_E.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,BT(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,_E.fromExtension(r,n.contentNameScopesList))}},yE=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):vT(e,pE).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>vT(e,pE).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}},bE=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=hT.set(n,0,gT(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=hT.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}},xE=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,dE(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},SE=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new xE(nT.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(nT.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 yE(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new TT(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)}},CE=vE.NULL;function wE(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 TE(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function EE(e){return Array.isArray(e)?e:[e]}async function DE(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function OE(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function kE(e){return e===`ansi`||OE(e)}function AE(e){return e===`none`}function jE(e){return AE(e)}var ME=/(\r?\n)/g;function NE(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(ME),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 PE={light:`#333333`,dark:`#bbbbbb`},FE={light:`#fffffe`,dark:`#1e1e1e`},IE=`__shiki_resolved`;function LE(e){if(e?.[IE])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`?PE.light:PE.dark,n||=t.type===`light`?FE.light:FE.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,IE,{enumerable:!1,writable:!1,value:!0}),t}async function RE(e){return[...new Set((await Promise.all(e.filter(e=>!kE(e)).map(async e=>await DE(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function zE(e){return(await Promise.all(e.map(async e=>jE(e)?null:LE(await DE(e))))).filter(e=>!!e)}function BE(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 Hw(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var VE=class extends SE{_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=LE(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=nT.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=BE(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 Hw(`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))}},HE=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}},UE=0;function WE(e){UE+=1,e.warnings!==!1&&UE>=10&&UE%10==0&&console.warn(`[Shiki] ${UE} 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 Hw("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(LE),i=new VE(new HE(e.engine,n),r,n,e.langAlias),a;function o(t){return BE(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Hw(`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 Hw(`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 RE(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await zE(e))}function g(){if(t)throw new Hw(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--UE)}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 GE(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([zE(e.themes||[]),RE(e.langs||[]),e.engine]);return WE({...e,themes:t,langs:n,engine:r})}var KE=new WeakMap;function qE(e,t){KE.set(e,t)}function JE(e){return KE.get(e)}var YE=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(EE(n).map(e=>[e,CE])),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 XE(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function XE(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 ZE(e,t){if(!(e instanceof YE))throw new Hw(`Invalid grammar state`);return e.getInternalStack(t)}var QE=/,/,$E=/ /;function eD(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(OE(e.resolveLangAlias(n.lang||`text`))||AE(r))return NE(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 Hw(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Hw(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return nD(t,o,i,a,n)}function tD(...e){if(e.length===2)return JE(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(OE(i)||AE(a))throw new Hw(`Plain language does not have grammar state`);if(i===`ansi`)throw new Hw(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new YE(rD(n,c,o,s,r).stateStack,c.name,o.name)}function nD(e,t,n,r,i){let a=rD(e,t,n,r,i),o=new YE(a.stateStack,t.name,n.name);return qE(a.tokens,o),a.tokens}function rD(e,t,n,r,i){let a=wE(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=NE(e),u=i.grammarState?ZE(i.grammarState,n.name)??CE:i.grammarContextCode==null?CE:rD(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=TE(r[hT.getForeground(s)],a),u=hT.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=hT.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(QE).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split($E))})}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`?iD(t.scopes):aD(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function iD(e){return e.map(e=>({scopeName:e}))}function aD(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:cD(e,i,t.slice(0,r))}}return n}function oD(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function sD(e,t,n){if(!oD(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)oD(e[r],n[i])&&--r,--i;return r===-1}function cD(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(sD(e,t,n)){r.push(a);break}return r}function lD(e,t,n,r=eD){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:JE(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=uD(...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 YE(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&qE(s,c),s}function uD(...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 dD=/\s+/g;function fD(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(dD)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(dD);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var pD=/:?lang=["']([^"']+)["']/g,mD=/(?:```|~~~)([\w-]+)/g,hD=/\\begin\{([\w-]+)\}/g,gD=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,_D=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function vD(e){let t=NE(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function yD(e,t,n){let r=new Set;for(let t of e.matchAll(pD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(mD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(hD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(gD)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(_D.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var bD=[`color`,`background-color`];function xD(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function SD(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function CD(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=SD(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return xD(e,a)})):e}function wD(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>TD(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&bD.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new Hw('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function TD(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&lT.Italic&&(t[`font-style`]=`italic`),e.fontStyle&lT.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&lT.Underline&&n.push(`underline`),e.fontStyle&lT.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function ED(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function DD(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=vD(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new Hw(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new Hw(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new Hw(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));OD(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return CD(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new Hw(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=kD(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new Hw(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new Hw(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&fD(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function OD(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new Hw(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new Hw(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function kD(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(kD).join(``):``}var AD=[DD()];function jD(e){let t=MD(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...AD]}function MD(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var ND=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],PD={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function FD(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function ID(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function LD(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)PD[r]&&t.push({type:`setDecoration`,value:PD[r]});else if(r<=29){let e=PD[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:ND[r-30]}});else if(r===38){let n=ID(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:ND[r-40]}});else if(r===48){let n=ID(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:ND[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:ND[r-100+8]}})}}return t}function RD(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=FD(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=LD(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var zD={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function BD(e=zD){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<ND.length;e++)r.push(t(ND[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var VD=/#([0-9a-f]{3,8})/i,HD=/var\((--[\w-]+-ansi-[\w-]+)\)/,UD={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function WD(e,t,n){let r=wE(e,n),i=NE(t),a=BD(Object.fromEntries(ND.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||UD[t]]}))),o=RD();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=TE(i,r),o=TE(o,r),n.decorations.has(`dim`)&&(i=GD(i));let s=lT.None;return n.decorations.has(`bold`)&&(s|=lT.Bold),n.decorations.has(`italic`)&&(s|=lT.Italic),n.decorations.has(`underline`)&&(s|=lT.Underline),n.decorations.has(`strikethrough`)&&(s|=lT.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function GD(e){let t=e.match(VD);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(HD);return n?`var(${n[1]}-dim)`:e}function KD(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!OE(r)&&!AE(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return WD(r,t,n)}return eD(e,t,n)}function qD(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new Hw("`themes` option must not be empty");let p=lD(e,t,n,KD);if(c=JE(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new Hw(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>wD(e,h,u,l,d))),c&&qE(a,c);let g=f.map(e=>wE(e.theme,n));i=JD(f,m,g,u,l,`fg`,d),r=JD(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=wE(n.theme,n);a=KD(e,t,n);let l=e.getTheme(n.theme);r=TE(l.bg,s),i=TE(l.fg,s),o=l.name,c=JE(a)}else throw new Hw("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function JD(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=TE(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new Hw('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${TE(t[r][a],n[r])||`inherit`}, ${TE(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var YD=/^\s+$/,XD=/^(\s*)(.*?)(\s*)$/;function ZD(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>ZD(e,t,n),codeToTokens:(t,n)=>qD(e,t,n)}){let i=t;for(let e of jD(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=qD(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=$D(a):d===`never`&&(a=eO(a)),f&&(a=tO(a));let p={...r,get source(){return i}};for(let e of jD(n))a=e.tokens?.call(p,a)||a;return QD(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function QD(e,t,n,r=JE(e)){let i=jD(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:fD,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
39
+ `}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=ED(a.htmlStyle||TD(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&qE(m,r),m}function $D(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&lT.Underline||i.fontStyle&lT.Strikethrough));o&&YD.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function eO(e){return e.map(e=>e.flatMap(e=>{if(YD.test(e.content))return e;let t=e.content.match(XD);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function tO(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=ED(e.htmlStyle||TD(e)),i=ED(n.htmlStyle||TD(n)),a=e.fontStyle&&(e.fontStyle&lT.Underline||e.fontStyle&lT.Strikethrough),o=n.fontStyle&&(n.fontStyle&lT.Underline||n.fontStyle&lT.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var nO=pC;function rO(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>ZD(e,t,n),codeToTokens:(t,n)=>qD(e,t,n)},i=nO(ZD(e,t,n,r));for(let e of jD(n))i=e.postprocess?.call(r,i,n)||i;return i}async function iO(e){let t=await GE(e);return{getLastGrammarState:(...e)=>tD(t,...e),codeToTokensBase:(e,n)=>KD(t,e,n),codeToTokensWithThemes:(e,n)=>lD(t,e,n),codeToTokens:(e,n)=>qD(t,e,n),codeToHast:(e,n)=>ZD(t,e,n),codeToHtml:(e,n)=>rO(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function aO(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,kE(n))return[];let r=t[n];if(!r)throw new Hw(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(jE(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new Hw(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await iO({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function oO(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function sO(e,t){let n=oO(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var cO=aO({langs:uw,themes:dw,engine:()=>(0,Vw.createOnigurumaEngine)(K(()=>import(`./_BnjxR4X6.js`),[]))}),{codeToHtml:Qee,codeToHast:$ee,codeToTokens:ete,codeToTokensBase:tte,codeToTokensWithThemes:nte,getSingletonHighlighter:rte,getLastGrammarState:ite}=sO(cO,{guessEmbeddedLanguages:yD}),lO=4294967295,uO=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:lO,end:lO,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function dO(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function fO(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var pO=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),mO=String.raw;function hO(e,t){if(e==null)throw Error(t??`Value expected`);return e}var gO=mO`\[\^?`,_O=`c.? | C(?:-.?)?|${mO`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${mO`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${mO`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${mO`o\{[^\}]*\}?`}|${mO`\d{1,3}`}`,vO=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,yO=new RegExp(mO`
40
40
  \\ (?:
41
- ${yO}
41
+ ${_O}
42
42
  | [gk]<[^>]*>?
43
43
  | [gk]'[^']*'?
44
44
  | .
@@ -55,20 +55,20 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
55
55
  )?
56
56
  | \*[^\)]*\)?
57
57
  )?
58
- | (?:${bO.source})+
59
- | ${vO}
58
+ | (?:${vO.source})+
59
+ | ${gO}
60
60
  | .
61
- `.replace(/\s+/g,``),`gsu`),SO=new RegExp(gO`
61
+ `.replace(/\s+/g,``),`gsu`),bO=new RegExp(mO`
62
62
  \\ (?:
63
- ${yO}
63
+ ${_O}
64
64
  | .
65
65
  )
66
66
  | \[:(?:\^?\p{Alpha}+|\^):\]
67
- | ${vO}
67
+ | ${gO}
68
68
  | &&
69
69
  | .
70
- `.replace(/\s+/g,``),`gsu`);function CO(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=$O(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(xO.lastIndex=0;s=xO.exec(e);){let t=wO(a,e,s[0],xO.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(xO.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?tk(e,u):e).flat(),flags:r}}function wO(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=TO(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:kO(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:UO(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:AO(n)}}if(a===`K`)return{token:LO(`keep`,n)};if(a===`N`||a===`R`)return{token:IO(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:IO(`any`,n)};if(a===`X`)return{token:IO(`text_segment`,n)};let e=DO(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:JO(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:qO(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:BO(`group`,n)};if(n===`(?>`)return{token:BO(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:BO(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:BO(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:BO(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:zO(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
71
- `,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:IO(`dot`,n)}:n===`^`||n===`$`?{token:kO(e.singleline?{"^":gO`\A`,$:gO`\Z`}[n]:n,n)}:n===`|`?{token:OO(n)}:bO.test(n)?{tokens:nk(n)}:{token:jO(pO(n),n)}}function TO(e,t,n){let r=[FO(t[1]===`^`,t)],i=1,a;for(SO.lastIndex=n;a=SO.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(FO(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(jO(93,e));else if(i--,r.push(MO(e)),!i)break}else{let t=EO(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:SO.lastIndex||e.length}}function EO(e){if(e[0]===`\\`)return DO(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!hO.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return IO(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?NO(e):e===`&&`?PO(e):jO(pO(e),e)}function DO(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return KO(e);if(`dDhHsSwW`.includes(n))return XO(e);if(e.startsWith(gO`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return ZO(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return jO(pO(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return jO(ek(e),e);if(GO.has(n))return jO(GO.get(n),e);if(/\d/.test(n))return RO(t,e);if(e===`\\`)throw Error(gO`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return jO(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function OO(e){return{type:`Alternator`,raw:e}}function kO(e,t){return{type:`Assertion`,kind:e,raw:t}}function AO(e){return{type:`Backreference`,raw:e}}function jO(e,t){return{type:`Character`,value:e,raw:t}}function MO(e){return{type:`CharacterClassClose`,raw:e}}function NO(e){return{type:`CharacterClassHyphen`,raw:e}}function PO(e){return{type:`CharacterClassIntersector`,raw:e}}function FO(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function IO(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function LO(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:_O(n.flags),raw:t}}function RO(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function zO(e){return{type:`GroupClose`,raw:e}}function BO(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function VO(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function HO(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function UO(e){return{type:`Subroutine`,raw:e}}var WO=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),GO=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function KO(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return jO(pO(t.toUpperCase())-64,e)}function qO(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=QO(n),o=QO(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),LO(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,BO(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function JO(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=WO.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return VO(l,r??null,i?.split(`,`)??null,e)}function YO(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return HO(t,n,r,e)}function XO(e){let t=e[1].toLowerCase();return IO({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function ZO(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return IO(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function QO(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function $O(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function ek(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function tk(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[AO(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(gO`Octal encoded byte above 177 unsupported "${n}"`)}else r=pO(t);a.push(jO(r,(e===0?`\\`:``)+t))}return a}function nk(e){let t=[],n=new RegExp(bO,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(YO(e.slice(0,-1)));continue}}}t.push(YO(e))}return t}function rk(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function ik(e){return ak.has(e.type)}var ak=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function ok(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=CO(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return gk();case`Assertion`:return sk(n);case`Backreference`:return ck(n,a);case`Character`:return bk(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return lk(n,a,t);case`CharacterClassOpen`:return uk(n,a,t);case`CharacterSet`:return dk(n,a);case`Directive`:return wk(n.kind,{flags:n.flags});case`GroupOpen`:return fk(n,a,t);case`NamedCallout`:return Ok(n.kind,n.tag,n.arguments);case`Quantifier`:return pk(n,a);case`Subroutine`:return mk(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=jk(Tk(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(gO`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(gO`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function sk({kind:e}){return _k(_O({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===gO`\B`||e===gO`\Y`})}function ck({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,vk(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return vk(r)}return i(+r)}function lk(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),Sk(o,e);throw Error(`Invalid character class range`)}return bk(pO(`-`))}function uk({negate:e},t,n){let{tokens:r,walk:i}=t,a=[xk()],o=r[t.nextIndex],s=Hk(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(xk()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=Hk(r[t.nextIndex],o)}let c=xk({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function dk({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=Vk(n);if(hO.has(r)&&!o?.has(r))e=`posix`,n=r;else return Nk(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?kk(n,{negate:t}):Ck(e,{negate:t})}function fk(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=Pk(e),l=c.type===`AbsenceFunction`,u=Rk(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&mO(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=Uk(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(gk()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(Lk(t)||t.type===`CapturingGroup`)throw Error(e)}else if(Lk(t)||Rk(t)&&t.negate)throw Error(e)}}f=Uk(r[t.nextIndex])}return t.nextIndex++,c}function pk({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!ik(a))throw Error(`Quantifier requires a repeatable token`);let o=Ak(e,t,n,a);return i.body.pop(),o}function mk({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=Mk(i);return r.push(o),o}function hk(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:Fk(t?.body)}}function gk(e){return{type:`Alternative`,body:Ik(e?.body)}}function _k(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function vk(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function yk(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!zk(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Fk(t?.body)}}function bk(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function xk(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:Ik(e?.body)}}function Sk(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function Ck(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function wk(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:_O(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function Tk(e){return{type:`Flags`,...e}}function Ek(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:Fk(e?.body)}}function Dk(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:Fk(e?.body)}}function Ok(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function kk(e,t){let n=!!t?.negate;if(!hO.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function Ak(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function jk(e,t){return{type:`Regex`,body:Fk(t?.body),flags:e}}function Mk(e){return{type:`Subroutine`,ref:e}}function Nk(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(Vk(e));if(!r){if(n.normalizeUnknownPropertyNames)r=Bk(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(gO`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function Pk({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return hk(`repeater`);case`atomic`:return Ek({atomic:!0});case`capturing`:return yk(i,{name:n});case`group`:return Ek({flags:e});case`lookahead`:case`lookbehind`:return Dk({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function Fk(e){if(e===void 0)e=[gk()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function Ik(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function Lk(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function Rk(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function zk(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Bk(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function Vk(e){return e.replace(/[- _]+/g,``).toLowerCase()}function Hk(e,t){let n=t;return _O(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function Uk(e){return _O(e,`Unclosed group`)}function Wk(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){Gk(c).splice(Math.max(0,Kk(s)+l),1),l--,u=!0},removeAllNextSiblings(){return Gk(c).splice(Kk(s)+1)},removeAllPrevSiblings(){let e=Kk(s)+l;return l-=e,Gk(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,Kk(s)+l)]=e:_O(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(Gk(c).splice(Math.max(0,Kk(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,Kk(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function Gk(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function Kk(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var qk=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Jk(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Yk(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Xk=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function Zk(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===Xk.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?Xk.CHAR_CLASS:Xk.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function Qk(e,t,n,r){Zk(e,t,n,r)}function rte(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===Xk.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function $k(e,t,n){return!!rte(e,t,0,n)}function ite(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var eA=new RegExp(String.raw`(?<noncapturingStart>${qk})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function ate(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(eA.lastIndex=Number.isNaN(c)?0:c+7;f=eA.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),Jk(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=Zk(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},Xk.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var tA=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,nA=new RegExp(String.raw`
70
+ `.replace(/\s+/g,``),`gsu`);function xO(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=ZO(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(yO.lastIndex=0;s=yO.exec(e);){let t=SO(a,e,s[0],yO.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(yO.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?$O(e,u):e).flat(),flags:r}}function SO(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=CO(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:DO(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:VO(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:OO(n)}}if(a===`K`)return{token:FO(`keep`,n)};if(a===`N`||a===`R`)return{token:PO(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:PO(`any`,n)};if(a===`X`)return{token:PO(`text_segment`,n)};let e=TO(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:KO(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:GO(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:RO(`group`,n)};if(n===`(?>`)return{token:RO(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:RO(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:RO(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:RO(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:LO(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
71
+ `,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:PO(`dot`,n)}:n===`^`||n===`$`?{token:DO(e.singleline?{"^":mO`\A`,$:mO`\Z`}[n]:n,n)}:n===`|`?{token:EO(n)}:vO.test(n)?{tokens:ek(n)}:{token:kO(dO(n),n)}}function CO(e,t,n){let r=[NO(t[1]===`^`,t)],i=1,a;for(bO.lastIndex=n;a=bO.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(NO(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(kO(93,e));else if(i--,r.push(AO(e)),!i)break}else{let t=wO(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:bO.lastIndex||e.length}}function wO(e){if(e[0]===`\\`)return TO(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!pO.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return PO(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?jO(e):e===`&&`?MO(e):kO(dO(e),e)}function TO(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return WO(e);if(`dDhHsSwW`.includes(n))return JO(e);if(e.startsWith(mO`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return YO(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return kO(dO(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return kO(QO(e),e);if(UO.has(n))return kO(UO.get(n),e);if(/\d/.test(n))return IO(t,e);if(e===`\\`)throw Error(mO`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return kO(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function EO(e){return{type:`Alternator`,raw:e}}function DO(e,t){return{type:`Assertion`,kind:e,raw:t}}function OO(e){return{type:`Backreference`,raw:e}}function kO(e,t){return{type:`Character`,value:e,raw:t}}function AO(e){return{type:`CharacterClassClose`,raw:e}}function jO(e){return{type:`CharacterClassHyphen`,raw:e}}function MO(e){return{type:`CharacterClassIntersector`,raw:e}}function NO(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function PO(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function FO(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:hO(n.flags),raw:t}}function IO(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function LO(e){return{type:`GroupClose`,raw:e}}function RO(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function zO(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function BO(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function VO(e){return{type:`Subroutine`,raw:e}}var HO=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),UO=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function WO(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return kO(dO(t.toUpperCase())-64,e)}function GO(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=XO(n),o=XO(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),FO(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,RO(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function KO(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=HO.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return zO(l,r??null,i?.split(`,`)??null,e)}function qO(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return BO(t,n,r,e)}function JO(e){let t=e[1].toLowerCase();return PO({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function YO(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return PO(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function XO(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function ZO(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function QO(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function $O(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[OO(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(mO`Octal encoded byte above 177 unsupported "${n}"`)}else r=dO(t);a.push(kO(r,(e===0?`\\`:``)+t))}return a}function ek(e){let t=[],n=new RegExp(vO,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(qO(e.slice(0,-1)));continue}}}t.push(qO(e))}return t}function tk(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function nk(e){return rk.has(e.type)}var rk=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function ik(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=xO(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return mk();case`Assertion`:return ak(n);case`Backreference`:return ok(n,a);case`Character`:return vk(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return sk(n,a,t);case`CharacterClassOpen`:return ck(n,a,t);case`CharacterSet`:return lk(n,a);case`Directive`:return Sk(n.kind,{flags:n.flags});case`GroupOpen`:return uk(n,a,t);case`NamedCallout`:return Ek(n.kind,n.tag,n.arguments);case`Quantifier`:return dk(n,a);case`Subroutine`:return fk(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=kk(Ck(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(mO`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(mO`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function ak({kind:e}){return hk(hO({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===mO`\B`||e===mO`\Y`})}function ok({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,gk(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return gk(r)}return i(+r)}function sk(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),bk(o,e);throw Error(`Invalid character class range`)}return vk(dO(`-`))}function ck({negate:e},t,n){let{tokens:r,walk:i}=t,a=[yk()],o=r[t.nextIndex],s=Bk(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(yk()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=Bk(r[t.nextIndex],o)}let c=yk({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function lk({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=zk(n);if(pO.has(r)&&!o?.has(r))e=`posix`,n=r;else return jk(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?Dk(n,{negate:t}):xk(e,{negate:t})}function uk(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=Mk(e),l=c.type===`AbsenceFunction`,u=Ik(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&fO(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=Vk(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(mk()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(Fk(t)||t.type===`CapturingGroup`)throw Error(e)}else if(Fk(t)||Ik(t)&&t.negate)throw Error(e)}}f=Vk(r[t.nextIndex])}return t.nextIndex++,c}function dk({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!nk(a))throw Error(`Quantifier requires a repeatable token`);let o=Ok(e,t,n,a);return i.body.pop(),o}function fk({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=Ak(i);return r.push(o),o}function pk(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:Nk(t?.body)}}function mk(e){return{type:`Alternative`,body:Pk(e?.body)}}function hk(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function gk(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function _k(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!Lk(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Nk(t?.body)}}function vk(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function yk(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:Pk(e?.body)}}function bk(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function xk(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function Sk(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:hO(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function Ck(e){return{type:`Flags`,...e}}function wk(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:Nk(e?.body)}}function Tk(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:Nk(e?.body)}}function Ek(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function Dk(e,t){let n=!!t?.negate;if(!pO.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function Ok(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function kk(e,t){return{type:`Regex`,body:Nk(t?.body),flags:e}}function Ak(e){return{type:`Subroutine`,ref:e}}function jk(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(zk(e));if(!r){if(n.normalizeUnknownPropertyNames)r=Rk(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(mO`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function Mk({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return pk(`repeater`);case`atomic`:return wk({atomic:!0});case`capturing`:return _k(i,{name:n});case`group`:return wk({flags:e});case`lookahead`:case`lookbehind`:return Tk({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function Nk(e){if(e===void 0)e=[mk()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function Pk(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function Fk(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function Ik(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function Lk(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Rk(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function zk(e){return e.replace(/[- _]+/g,``).toLowerCase()}function Bk(e,t){let n=t;return hO(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function Vk(e){return hO(e,`Unclosed group`)}function Hk(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){Uk(c).splice(Math.max(0,Wk(s)+l),1),l--,u=!0},removeAllNextSiblings(){return Uk(c).splice(Wk(s)+1)},removeAllPrevSiblings(){let e=Wk(s)+l;return l-=e,Uk(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,Wk(s)+l)]=e:hO(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(Uk(c).splice(Math.max(0,Wk(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,Wk(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function Uk(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function Wk(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var Gk=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Kk(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function qk(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Jk=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function Yk(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===Jk.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?Jk.CHAR_CLASS:Jk.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function Xk(e,t,n,r){Yk(e,t,n,r)}function Zk(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===Jk.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function Qk(e,t,n){return!!Zk(e,t,0,n)}function $k(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var eA=new RegExp(String.raw`(?<noncapturingStart>${Gk})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function tA(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(eA.lastIndex=Number.isNaN(c)?0:c+7;f=eA.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),Kk(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=Yk(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},Jk.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var nA=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,rA=new RegExp(String.raw`
72
72
  \\(?: \d+
73
73
  | c[A-Za-z]
74
74
  | [gk]<[^>]+>
@@ -81,9 +81,9 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
81
81
  | [A-Za-z\-]+:
82
82
  | \(DEFINE\)
83
83
  ))?
84
- | (?<qBase>${tA})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
84
+ | (?<qBase>${nA})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
85
85
  | \\?.
86
- `.replace(/\s+/g,``),`gsu`);function ote(e){if(!RegExp(`${tA}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(nA.lastIndex=0;o=nA.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Yk(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}nA.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var rA=String.raw,iA=rA`\(\?R=(?<rDepth>[^\)]+)\)|${rA`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,aA=rA`\(\?<(?![=!])(?<captureName>[^>]+)>`,oA=rA`${aA}|(?<unnamed>\()(?!\?)`,sA=new RegExp(rA`${aA}|${iA}|\(\?|\\?.`,`gsu`),cA=`Cannot use multiple overlapping recursions`;function ste(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(iA,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&$k(e,rA`\(\?\(DEFINE\)`,Xk.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=$k(e,rA`\\[1-9]`,Xk.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(sA.lastIndex=0;f=sA.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(lA(m),l)throw Error(cA);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(sA.lastIndex);if($k(s,iA,Xk.DEFAULT))throw Error(cA);let c=m-1;e=uA(t,s,c,!1,n,a,d),i=fA(i,t,c,a.length,0,d);break}if(h){lA(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(cA);break}if(!u)throw Error(rA`Recursive \g cannot be used outside the referenced group "${r===`external`?h:rA`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=ite(e,p);if(o&&$k(m,rA`${aA}|\((?!\?)`,Xk.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=uA(_,v,b,!0,n,a,d);i=fA(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,sA.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),sA.lastIndex),s.set(p,sA.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),sA.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function lA(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function uA(e,t,n,r,i,a,o){let s=new Set;r&&Qk(e+t,aA,({groups:{captureName:e}})=>{s.add(e)},Xk.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${dA(`(?:${e}`,`forward`,...c)}(?:)${dA(`${t})`,`backward`,...c)}${t}`}function dA(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Zk(e,rA`${oA}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),cte(i,n),s?e:`(?<${t}${l}>`}return rA`\k<${c}${l}>`},Xk.DEFAULT)}return c}function cte(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function fA(e,t,n,r,i,a){if(e.size&&r){let o=0;Qk(t,oA,()=>o++,Xk.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var pA=String.fromCodePoint,q=String.raw,mA={},hA=globalThis.RegExp;mA.flagGroups=(()=>{try{new hA(`(?i:)`)}catch{return!1}return!0})(),mA.unicodeSets=(()=>{try{new hA(`[[]]`,`v`)}catch{return!1}return!0})(),mA.bugFlagVLiteralHyphenIsRange=mA.unicodeSets?(()=>{try{new hA(q`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,mA.bugNestedClassIgnoresNegation=mA.unicodeSets&&new hA(`[[^a]]`,`v`).test(`a`);function gA(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function _A(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function vA(e,t){return yA[e]>=yA[t]}function lte(e,t){if(e==null)throw Error(t??`Value expected`);return e}var yA={ES2025:2025,ES2024:2024,ES2018:2018},ute={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function bA(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!ute[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=mA.flagGroups?`ES2025`:mA.unicodeSets?`ES2024`:`ES2018`),t}var dte=`[ -\r ]`,fte=new Set([pA(304),pA(305)]),xA=q`[\p{L}\p{M}\p{N}\p{Pc}]`;function SA(e){if(fte.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=hte.get(n),a=pte.get(n),o=mte.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var CA=new Map(`C Other
86
+ `.replace(/\s+/g,``),`gsu`);function iA(e){if(!RegExp(`${nA}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(rA.lastIndex=0;o=rA.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=qk(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}rA.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var aA=String.raw,oA=aA`\(\?R=(?<rDepth>[^\)]+)\)|${aA`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,sA=aA`\(\?<(?![=!])(?<captureName>[^>]+)>`,cA=aA`${sA}|(?<unnamed>\()(?!\?)`,lA=new RegExp(aA`${sA}|${oA}|\(\?|\\?.`,`gsu`),uA=`Cannot use multiple overlapping recursions`;function ate(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(oA,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Qk(e,aA`\(\?\(DEFINE\)`,Jk.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Qk(e,aA`\\[1-9]`,Jk.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(lA.lastIndex=0;f=lA.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(dA(m),l)throw Error(uA);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(lA.lastIndex);if(Qk(s,oA,Jk.DEFAULT))throw Error(uA);let c=m-1;e=fA(t,s,c,!1,n,a,d),i=mA(i,t,c,a.length,0,d);break}if(h){dA(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(uA);break}if(!u)throw Error(aA`Recursive \g cannot be used outside the referenced group "${r===`external`?h:aA`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=$k(e,p);if(o&&Qk(m,aA`${sA}|\((?!\?)`,Jk.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=fA(_,v,b,!0,n,a,d);i=mA(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,lA.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),lA.lastIndex),s.set(p,lA.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),lA.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function dA(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function fA(e,t,n,r,i,a,o){let s=new Set;r&&Xk(e+t,sA,({groups:{captureName:e}})=>{s.add(e)},Jk.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${pA(`(?:${e}`,`forward`,...c)}(?:)${pA(`${t})`,`backward`,...c)}${t}`}function pA(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Yk(e,aA`${cA}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),ote(i,n),s?e:`(?<${t}${l}>`}return aA`\k<${c}${l}>`},Jk.DEFAULT)}return c}function ote(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function mA(e,t,n,r,i,a){if(e.size&&r){let o=0;Xk(t,cA,()=>o++,Jk.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var hA=String.fromCodePoint,q=String.raw,gA={},_A=globalThis.RegExp;gA.flagGroups=(()=>{try{new _A(`(?i:)`)}catch{return!1}return!0})(),gA.unicodeSets=(()=>{try{new _A(`[[]]`,`v`)}catch{return!1}return!0})(),gA.bugFlagVLiteralHyphenIsRange=gA.unicodeSets?(()=>{try{new _A(q`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,gA.bugNestedClassIgnoresNegation=gA.unicodeSets&&new _A(`[[^a]]`,`v`).test(`a`);function vA(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function yA(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function bA(e,t){return xA[e]>=xA[t]}function ste(e,t){if(e==null)throw Error(t??`Value expected`);return e}var xA={ES2025:2025,ES2024:2024,ES2018:2018},cte={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function SA(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!cte[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=gA.flagGroups?`ES2025`:gA.unicodeSets?`ES2024`:`ES2018`),t}var lte=`[ -\r ]`,ute=new Set([hA(304),hA(305)]),CA=q`[\p{L}\p{M}\p{N}\p{Pc}]`;function wA(e){if(ute.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=pte.get(n),a=dte.get(n),o=fte.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var TA=new Map(`C Other
87
87
  Cc Control cntrl
88
88
  Cf Format
89
89
  Cn Unassigned
@@ -173,11 +173,11 @@ Uppercase Upper
173
173
  Variation_Selector VS
174
174
  White_Space space
175
175
  XID_Continue XIDC
176
- XID_Start XIDS`.split(/\s/).map(e=>[Vk(e),e])),pte=new Map([[`s`,pA(383)],[pA(383),`s`]]),mte=new Map([[pA(223),pA(7838)],[pA(107),pA(8490)],[pA(229),pA(8491)],[pA(969),pA(8486)]]),hte=new Map([wA(453),wA(456),wA(459),wA(498),...TA(8072,8079),...TA(8088,8095),...TA(8104,8111),wA(8124),wA(8140),wA(8188)]),gte=new Map([[`alnum`,q`[\p{Alpha}\p{Nd}]`],[`alpha`,q`\p{Alpha}`],[`ascii`,q`\p{ASCII}`],[`blank`,q`[\p{Zs}\t]`],[`cntrl`,q`\p{Cc}`],[`digit`,q`\p{Nd}`],[`graph`,q`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,q`\p{Lower}`],[`print`,q`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,q`[\p{P}\p{S}]`],[`space`,q`\p{space}`],[`upper`,q`\p{Upper}`],[`word`,q`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,q`\p{AHex}`]]);function _te(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function wA(e){let t=pA(e);return[t.toLowerCase(),t]}function TA(e,t){return _te(e,t).map(e=>wA(e))}var EA=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function vte(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};DA(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:vA(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Wk(e,yte,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Wk(e,bte,a),Wk(e,xte,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var yte={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=Ek();e.body[0].body.push(Dk({negate:!0,body:r}),Nk(`Any`));let i=Ek();i.body[0].body.push(Ak(`greedy`,0,1/0,e)),n(zA(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];_A(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=jA(t.get(e));if(n){let t=Ek({flags:n});t.body[0].body=e.body,e.body=[zA(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(zA(Dk({body:[gk({body:[_k(`string_end`)]}),gk({body:[bk(10)]})]}),t));else if(c===`line_start`)o(zA(IA(q`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&Dte(e))o(zA(Dk({negate:!0}),t));else if(d)throw Error(q`Uses "\G" in a way that requires a subclass`);else o(RA(_k(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(zA(IA(q`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${xA})(?!${xA})|(?<!${xA})(?=${xA}))`,n=`(?:(?<=${xA})(?=${xA})|(?<!${xA})(?!${xA}))`;o(zA(IA(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!FA(n)&&(n=AA(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!FA(r)&&(r=AA(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(zA(xk({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(RA(Ck(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(zA(LA(IA(dte),l),t));return}if(s&&(c===`word`||u===`word`)){n(RA(Ck(`word`,{negate:l}),t));return}if(c===`any`)n(RA(Nk(`Any`),t));else if(c===`digit`)n(RA(Nk(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(q`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=q`\p{RI}{2}|${e}(?:\u200D${e})*`;n(zA(IA(q`(?>\r\n|${i?q`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(RA(Nk(`AHex`,{negate:l}),t));else if(c===`newline`)n(zA(IA(l?`[^
176
+ XID_Start XIDS`.split(/\s/).map(e=>[zk(e),e])),dte=new Map([[`s`,hA(383)],[hA(383),`s`]]),fte=new Map([[hA(223),hA(7838)],[hA(107),hA(8490)],[hA(229),hA(8491)],[hA(969),hA(8486)]]),pte=new Map([EA(453),EA(456),EA(459),EA(498),...DA(8072,8079),...DA(8088,8095),...DA(8104,8111),EA(8124),EA(8140),EA(8188)]),mte=new Map([[`alnum`,q`[\p{Alpha}\p{Nd}]`],[`alpha`,q`\p{Alpha}`],[`ascii`,q`\p{ASCII}`],[`blank`,q`[\p{Zs}\t]`],[`cntrl`,q`\p{Cc}`],[`digit`,q`\p{Nd}`],[`graph`,q`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,q`\p{Lower}`],[`print`,q`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,q`[\p{P}\p{S}]`],[`space`,q`\p{space}`],[`upper`,q`\p{Upper}`],[`word`,q`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,q`\p{AHex}`]]);function hte(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function EA(e){let t=hA(e);return[t.toLowerCase(),t]}function DA(e,t){return hte(e,t).map(e=>EA(e))}var OA=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function gte(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};kA(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:bA(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Hk(e,_te,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Hk(e,vte,a),Hk(e,yte,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var _te={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=wk();e.body[0].body.push(Tk({negate:!0,body:r}),jk(`Any`));let i=wk();i.body[0].body.push(Ok(`greedy`,0,1/0,e)),n(VA(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];yA(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=NA(t.get(e));if(n){let t=wk({flags:n});t.body[0].body=e.body,e.body=[VA(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(VA(Tk({body:[mk({body:[hk(`string_end`)]}),mk({body:[vk(10)]})]}),t));else if(c===`line_start`)o(VA(RA(q`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&Tte(e))o(VA(Tk({negate:!0}),t));else if(d)throw Error(q`Uses "\G" in a way that requires a subclass`);else o(BA(hk(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(VA(RA(q`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${CA})(?!${CA})|(?<!${CA})(?=${CA}))`,n=`(?:(?<=${CA})(?=${CA})|(?<!${CA})(?!${CA}))`;o(VA(RA(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!LA(n)&&(n=MA(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!LA(r)&&(r=MA(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(VA(yk({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(BA(xk(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(VA(zA(RA(lte),l),t));return}if(s&&(c===`word`||u===`word`)){n(BA(xk(`word`,{negate:l}),t));return}if(c===`any`)n(BA(jk(`Any`),t));else if(c===`digit`)n(BA(jk(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(q`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=q`\p{RI}{2}|${e}(?:\u200D${e})*`;n(VA(RA(q`(?>\r\n|${i?q`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(BA(jk(`AHex`,{negate:l}),t));else if(c===`newline`)n(VA(RA(l?`[^
177
177
  ]`:`(?>\r
178
178
  ?|[
179
- \v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${pA(e.codePointAt(0)-1)}${pA(e.codePointAt(2)+1)}-\u{10FFFF}`),n(zA(IA(`[${e}]`),t))}else n(zA(LA(IA(gte.get(u)),l),t))}else if(c===`property`)CA.has(Vk(u))||(e.key=`sc`);else if(c===`space`)n(RA(Nk(`space`,{negate:l}),t));else if(c===`word`)n(zA(LA(IA(xA),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=Ek({flags:c});e.body[0].body=o(),i(zA(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&rk(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(q`Uses "\K" in a way that's unsupported`);let o=Dk({behind:!0});o.body[0].body=a(),i(zA(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(zA(Dk({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=Ek();t.body[0].body.push(e.body),e.body=zA(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=NA(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(q`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!FA(n)&&(n=AA(n,t),e.ref=n)}},bte={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=RA(kA(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&_A(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=_A(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=gA(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?kA(0):OA(o,r.groupOriginByCopy,null),l=c;if(!s){let e=jA(wte(o,e=>e.type===`Group`&&!!e.flags)),t=e?gA(r.globalFlags,e):r.globalFlags;Ste(t,r.currentFlags)||(l=Ek({flags:Tte(t)}),l.body[0].body.push(c))}n(zA(l,t),{traverse:!s})}},xte={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Cte(t,e));i.length?i.length>1?n(zA(Ek({atomic:!0,body:i.reverse().map(e=>gk({body:[vk(e.number)]}))}),t)):e.ref=i[0].number:n(zA(Dk({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=yk();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function DA(e){Wk(e,{"*"({node:e,parent:t}){e.parent=t}})}function Ste(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Cte(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=MA(n.parent);for(let r of t){if(r===n)break;if(r===e||PA(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function OA(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=OA(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function kA(e){let t=Mk(e);return t.isRecursive=!0,t}function wte(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function AA(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function jA(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Tte({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function MA(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function NA(e){let t=e.find(e=>e.kind===`search_start`||Ote(e,{negate:!1})||!Ete(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=NA(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function PA(e,t){let n=MA(e)??[];for(let e of n)if(e===t||PA(e,t))return!0;return!1}function Ete({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function Dte(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function Ote(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&rk(e.body[0],{type:`Assertion`,kind:`search_start`})}function FA(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function IA(e,t){let n=ok(e,{...t,unicodePropertyMap:CA}).body;return n.length>1||n[0].body.length>1?Ek({body:n}):n[0].body[0]}function LA(e,t){return e.negate=t,e}function RA(e,t){return e.parent=t,e}function zA(e,t){return DA(e),e.parent=t,e}function kte(e,t){let n=bA(t),r=vA(n.target,`ES2024`),i=vA(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];Wk(e,Ate,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,lte(jte[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&_A(f._captureTransfers,e.transferTo,[]).push(t)}),f}var Ate={"*":{enter({node:e},t){if(WA(e)){let n=t.getCurrentModI();t.pushModI(e.flags?gA({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){WA(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){VA(pA(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),HA(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&EA.has(e.value)&&t.setHasCasedChar()}},jte={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?q`\B`:q`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=pA(e),r=UA(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&VA(n)){let e=SA(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);mA.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(GA)&&(o=[bk(45),...o.filter(e=>!GA(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||mA.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=Ek(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=gk({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(mA.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=UA(n,i),o=UA(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ite(HA(e)).forEach(e=>{s.add(Array.isArray(e)?`${UA(e[0],i)}-${UA(e[1],i)}`:UA(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:q`[^\n]`;if(e===`digit`)return t?q`\D`:q`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&EA.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?q`\P`:q`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?q`\W`:q`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=gA(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${Lte(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+Rte(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:q`\g<${t}&R=${r}>`}},Mte=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),Nte=new Set([`-`,`\\`,`]`,`^`,`[`]),Pte=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),BA=new Map([[9,q`\t`],[10,q`\n`],[11,q`\v`],[12,q`\f`],[13,q`\r`],[8232,q`\u2028`],[8233,q`\u2029`],[65279,q`\uFEFF`]]),Fte=/^\p{Cased}$/u;function VA(e){return Fte.test(e)}function HA(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=pA(e);if(!VA(t))continue;let o=SA(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function UA(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(BA.has(e))return BA.get(e);if(e<32||e>126&&e<160||e>262143||t&&zte(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?Pte:Nte:Mte,a=pA(e);return(i.has(a)?`\\`:``)+a}function Ite(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function Lte(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function Rte({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function WA({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function zte(e){return e>47&&e<58}function GA({type:e,value:t}){return e===`Character`&&t===45}var Bte=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=Hte(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Vte(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=Ute(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function Vte(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function Hte(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)_A(n,t,{}).transferTo=e;return n}function Ute(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function Wte(e,t){let n=Gte(e,t);return n.options?new Bte(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Gte(e,t){let n=bA(t),r=vte(ok(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:CA}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=kte(r,n),a=ste(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=ate(ote(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function Kte(e,t){return Wte(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function qte(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>Kte(e,{target:t.target}),{createScanner(e){return new fO(e,t)},createString(e){return{content:e}}}}async function Jte(e){if(QC())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=qC.get(e);if(t!=null)return t;try{let t=JC.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(fw,e)&&(t=fw[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return KC.has(e)||KC.set(e,n),n});return qC.set(e,n),await n}finally{qC.delete(e)}}function Yte(e){return KC.get(e)??Jte(e)}var KA=new Set;function qA(e){let t=[],n=new Set;for(let r of JA(e.themes)){let e=ZA(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return qA({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return qA({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function JA(e){return YA(e)?[e]:e}function YA(e){return ZA(e)||XA(e)}function XA(e){return typeof e.name==`string`&&typeof e.load==`function`}function ZA(e){return typeof e.getThemes==`function`}function QA(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var $A=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},ej=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},tj=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function nj(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new $A(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new ej(i));let c=r,l=s().then(e=>{let a=QA(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new tj(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var rj=nj();function ij(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=rj.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,rj.getResolvedTheme(n)??rj.seedResolvedTheme(n,e);KA.has(n)||(KA.add(n),t.loadThemeSync(e))}}function aj({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:oj(t)}}function oj(e){return async()=>zE(QA(await e()))}var sj=`pierre`,cj=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],lj=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],uj=[...lj,...cj],dj=new Set(lj);function fj(e){return dj.has(e)?`light`:`dark`}var pj={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},mj={"pierre-dark":()=>K(()=>import(`./_CpLgRqie.js`),[]),"pierre-dark-soft":()=>K(()=>import(`./_kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>K(()=>import(`./_CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>K(()=>import(`./_B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>K(()=>import(`./_CpjhbsIL.js`),[]),"pierre-light":()=>K(()=>import(`./_CoaEpmwp.js`),[]),"pierre-light-soft":()=>K(()=>import(`./_lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>K(()=>import(`./_D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>K(()=>import(`./_0fSaH845.js`),[]),"pierre-light-tritanopia":()=>K(()=>import(`./_CEbqgOJL.js`),[])};function hj(e){return aj({name:e,collection:sj,colorScheme:fj(e),displayName:pj[e],load:mj[e]})}var gj=qA({themes:uj.map(e=>hj(e))}),_j=`shiki`,vj=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],yj=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),bj=new Set(vj);function xj(e){return bj.has(e)?`light`:`dark`}var Sj={andromeeda:()=>K(()=>import(`./_vGVdxbeo2.js`),[]),"aurora-x":()=>K(()=>import(`./_CDeNXAV0.js`),[]),"ayu-dark":()=>K(()=>import(`./_DluEY0Gj.js`),[]),"ayu-light":()=>K(()=>import(`./_C3h-C4tm.js`),[]),"ayu-mirage":()=>K(()=>import(`./_Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>K(()=>import(`./_C9Q5zVZY.js`),[]),"catppuccin-latte":()=>K(()=>import(`./_CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>K(()=>import(`./_R8nAf1vR.js`),[]),"catppuccin-mocha":()=>K(()=>import(`./_DjuaAJKi.js`),[]),"dark-plus":()=>K(()=>import(`./_Cs2F2srj.js`),[]),dracula:()=>K(()=>import(`./_BHWKrbxM.js`),[]),"dracula-soft":()=>K(()=>import(`./_5eyTD99u.js`),[]),"everforest-dark":()=>K(()=>import(`./_sB-x3p7T.js`),[]),"everforest-light":()=>K(()=>import(`./_Df2xbC6M.js`),[]),"github-dark":()=>K(()=>import(`./_C-LZuMrd.js`),[]),"github-dark-default":()=>K(()=>import(`./_DXG-b-1a.js`),[]),"github-dark-dimmed":()=>K(()=>import(`./_Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>K(()=>import(`./_B_tTalzw.js`),[]),"github-light":()=>K(()=>import(`./_EUqPIrTm.js`),[]),"github-light-default":()=>K(()=>import(`./_BXViO-2h.js`),[]),"github-light-high-contrast":()=>K(()=>import(`./_B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>K(()=>import(`./_C820rvS2.js`),[]),"gruvbox-dark-medium":()=>K(()=>import(`./_BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>K(()=>import(`./_MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>K(()=>import(`./_BC_s9l72.js`),[]),"gruvbox-light-medium":()=>K(()=>import(`./_BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>K(()=>import(`./_BSMLrYjP.js`),[]),horizon:()=>K(()=>import(`./_CE9ld1lL.js`),[]),"horizon-bright":()=>K(()=>import(`./_DSNQnXHK.js`),[]),houston:()=>K(()=>import(`./_CsvMBhTu.js`),[]),"kanagawa-dragon":()=>K(()=>import(`./_Bozd7klA.js`),[]),"kanagawa-lotus":()=>K(()=>import(`./_BmuOG9ZW.js`),[]),"kanagawa-wave":()=>K(()=>import(`./_BML5mF2J.js`),[]),laserwave:()=>K(()=>import(`./_C_8bwKvT.js`),[]),"light-plus":()=>K(()=>import(`./_DVQuIRkW.js`),[]),"material-theme":()=>K(()=>import(`./_Bm3Qr25_2.js`),[]),"material-theme-darker":()=>K(()=>import(`./_2IIEA8gg.js`),[]),"material-theme-lighter":()=>K(()=>import(`./_uhdI0v04.js`),[]),"material-theme-ocean":()=>K(()=>import(`./_CHQ94UKr.js`),[]),"material-theme-palenight":()=>K(()=>import(`./_B5W6OYN7.js`),[]),"min-dark":()=>K(()=>import(`./_BSWPekZh2.js`),[]),"min-light":()=>K(()=>import(`./_DDpmG2fV2.js`),[]),monokai:()=>K(()=>import(`./_B_bV9PQ92.js`),[]),"night-owl":()=>K(()=>import(`./_DhmEMT882.js`),[]),"night-owl-light":()=>K(()=>import(`./_eJ-hLW7d2.js`),[]),nord:()=>K(()=>import(`./_Cb4Vim4T2.js`),[]),"one-dark-pro":()=>K(()=>import(`./_CLwyXe_n2.js`),[]),"one-light":()=>K(()=>import(`./_D7Lr4KcI2.js`),[]),plastic:()=>K(()=>import(`./_DQwYfKfQ2.js`),[]),poimandres:()=>K(()=>import(`./_DRFjx7u42.js`),[]),red:()=>K(()=>import(`./_DX1BQOs82.js`),[]),"rose-pine":()=>K(()=>import(`./_aMsaMD1D2.js`),[]),"rose-pine-dawn":()=>K(()=>import(`./_8PwUyIlP2.js`),[]),"rose-pine-moon":()=>K(()=>import(`./_DO-qXg-I2.js`),[]),"slack-dark":()=>K(()=>import(`./_DnToyrRv2.js`),[]),"slack-ochin":()=>K(()=>import(`./_B2OO5cIa2.js`),[]),"snazzy-light":()=>K(()=>import(`./_4G7pJPwS2.js`),[]),"solarized-dark":()=>K(()=>import(`./_UdsmMDCL2.js`),[]),"solarized-light":()=>K(()=>import(`./_C1IUL_tW2.js`),[]),"synthwave-84":()=>K(()=>import(`./_nFMaYfgc2.js`),[]),"tokyo-night":()=>K(()=>import(`./_oM2G3aXe2.js`),[]),vesper:()=>K(()=>import(`./_DdrHHSXu2.js`),[]),"vitesse-black":()=>K(()=>import(`./_fwtXNY1n2.js`),[]),"vitesse-dark":()=>K(()=>import(`./_BZCL-v6S2.js`),[]),"vitesse-light":()=>K(()=>import(`./_VbXTXTou2.js`),[])};function Cj(e){return aj({name:e,collection:_j,colorScheme:xj(e),load:Sj[e]})}var wj=qA({themes:Object.freeze([...vj.map(e=>Cj(e)),...yj.map(e=>Cj(e))])});function Tj(e){if(QC())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(rj.hasRegisteredTheme(e))return;let t=wj.getTheme(e);if(t!=null){rj.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function Ej(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Dj(e){Tj(e);let t=await rj.resolveTheme(e);return Ej(e,t),t}function Oj(e){return rj.getResolvedTheme(e)??Dj(e)}var kj;async function Aj({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){kj??=uO({themes:[],langs:[`text`],engine:n===`shiki-wasm`?Hw(K(()=>import(`./_BnjxR4X6.js`),[])):qte()});let r=Mj(kj)?await kj:kj;kj=r;let i=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=Yte(e);`then`in t?i.push(t):ZC(t,r)}let a=[];for(let t of e){let e=Oj(t);`then`in e?a.push(e):ij(e,kj)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{ZC(e,r)}),Promise.all(a).then(e=>{ij(e,r)})]),r}function jj(){if(kj!=null&&!(`then`in kj))return kj}function Mj(e=kj){return e!=null&&`then`in e}for(let e of gj.getThemes())rj.registerThemeIfAbsent(e.name,e.load);function Nj(e=ky){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Pj(e){for(let t of Nj(e))if(!KA.has(t))return!1;return!0}function Fj(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function Ij(e){return U({tagName:`div`,children:[U({tagName:`div`,children:e.annotations?.map(e=>U({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Lj(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function Rj({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return U({tagName:`div`,children:[t===`custom`?U({tagName:`slot`,properties:{name:Oy}}):zj({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[Bj(r)]],properties:i})}function zj({name:e,prevName:t,iconType:n}){let r=[U({tagName:`slot`,properties:{name:Ty}}),ax({name:Lj(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[ix(t)]})],properties:{"data-prev-name":``}})),r.push(ax({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[ix(e)]})],properties:{"data-title":``}})),r.push(U({tagName:`slot`,properties:{name:Ey}})),U({tagName:`div`,children:r,properties:{"data-header-content":``}})}function Bj(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(U({tagName:`span`,children:[ix(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(U({tagName:`span`,children:[ix(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(U({tagName:`slot`,properties:{name:Dy}})),U({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Vj(e){return U({tagName:`pre`,properties:Hj(e)})}function Hj({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var Uj=new Map,Wj={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Gj(e){if(Uj.has(e))return Uj.get(e)??`text`;if(Wj[e]!=null)return Wj[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Uj.has(t[1]))return Uj.get(t[1])??`text`;if(Wj[t[1]]!=null)return Wj[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Uj.has(n)?Uj.get(n)??`text`:Wj[n]??`text`}function Kj(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:Nj(t),preferredHighlighter:n}}function qj(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Jj(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(ix(`
180
- `)),e}var Yj=Symbol(`no-token`),Xj=Symbol(`multiple-tokens`);function Zj(e){let t=Qj(e);if(t!=null)return t;let n=Yj,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){eM(e,a);for(let t of e.children)$j(t)}else $j(e);r.push(e),i=[],a=void 0;return}for(let e of i)$j(e);r.push(U({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Yj){if(e===Xj){n=Xj;return}if(n===Yj){n=e;return}n!==e&&(n=Xj)}};for(let t of e.children){let e=t.type===`element`?Zj(t):Yj;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function Qj(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function $j(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)$j(t)}}function eM(e,t){e.properties[`data-char`]=t}function tM(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+nM(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function nM(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function rM(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=ox(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Zj(a),i.push(Jj(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(aM,iM),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:iM}}var iM=tM({classPrefix:`hl-`}),aM={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function oM(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var sM=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,cM=/^0(?:\.0+)?%?$/;function lM(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function uM(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function dM(e){if(e==null)return null;let t=uM(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function fM(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||sM.test(t))return!0;let n=lM(t);return n!=null&&cM.test(n)}function pM(e,t,n){if(t==null||n==null)return!1;let r=dM(e),i=dM(t),a=dM(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var mM=new WeakMap;function hM(e){let t=mM.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;gM(r,`editor.background`,i),gM(r,`editor.foreground`,a),gM(r,`sideBar.background`,o),gM(r,`sideBar.foreground`,s),gM(r,`input.background`,n[`input.background`]??o),gM(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),gM(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),gM(r,`gitDecoration.addedResourceForeground`,_M(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),gM(r,`gitDecoration.modifiedResourceForeground`,_M(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),gM(r,`gitDecoration.deletedResourceForeground`,_M(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(fM(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(fM(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(vM(l,o)||pM(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return mM.set(e,u),u}function gM(e,t,n){n!=null&&n!==``&&(e[t]=n)}function _M(...e){for(let t of e)if(t!=null&&t!==``)return t}function vM(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function yM({theme:e=ky,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=hM(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${oM(`global`)}fg:${a.fg};`,r+=`${oM(`global`)}bg:${a.bg};`,r+=bM(i,n)}else{let n=t.getTheme(e.dark),i=hM(n);r+=`${oM(`global`)}dark:${i.fg};`,r+=`${oM(`global`)}dark-bg:${i.bg};`,r+=bM(n,`dark`),n=t.getTheme(e.light),i=hM(n),r+=`${oM(`global`)}light:${i.fg};`,r+=`${oM(`global`)}light-bg:${i.bg};`,r+=bM(n,`light`)}return r}function bM(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${oM(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${oM(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${oM(`global`)}${t}modified-color:${a};`),n}function xM(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}function SM(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function CM(e){return e.startingLine===0&&e.totalLines>0}function wM(e,t){return e.endsWith(`\r
179
+ \v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${hA(e.codePointAt(0)-1)}${hA(e.codePointAt(2)+1)}-\u{10FFFF}`),n(VA(RA(`[${e}]`),t))}else n(VA(zA(RA(mte.get(u)),l),t))}else if(c===`property`)TA.has(zk(u))||(e.key=`sc`);else if(c===`space`)n(BA(jk(`space`,{negate:l}),t));else if(c===`word`)n(VA(zA(RA(CA),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=wk({flags:c});e.body[0].body=o(),i(VA(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&tk(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(q`Uses "\K" in a way that's unsupported`);let o=Tk({behind:!0});o.body[0].body=a(),i(VA(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(VA(Tk({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=wk();t.body[0].body.push(e.body),e.body=VA(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=FA(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(q`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!LA(n)&&(n=MA(n,t),e.ref=n)}},vte={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=BA(jA(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&yA(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=yA(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=vA(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?jA(0):AA(o,r.groupOriginByCopy,null),l=c;if(!s){let e=NA(Ste(o,e=>e.type===`Group`&&!!e.flags)),t=e?vA(r.globalFlags,e):r.globalFlags;bte(t,r.currentFlags)||(l=wk({flags:Cte(t)}),l.body[0].body.push(c))}n(VA(l,t),{traverse:!s})}},yte={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>xte(t,e));i.length?i.length>1?n(VA(wk({atomic:!0,body:i.reverse().map(e=>mk({body:[gk(e.number)]}))}),t)):e.ref=i[0].number:n(VA(Tk({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=_k();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function kA(e){Hk(e,{"*"({node:e,parent:t}){e.parent=t}})}function bte(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function xte(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=PA(n.parent);for(let r of t){if(r===n)break;if(r===e||IA(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function AA(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=AA(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function jA(e){let t=Ak(e);return t.isRecursive=!0,t}function Ste(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function MA(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function NA(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Cte({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function PA(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function FA(e){let t=e.find(e=>e.kind===`search_start`||Ete(e,{negate:!1})||!wte(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=FA(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function IA(e,t){let n=PA(e)??[];for(let e of n)if(e===t||IA(e,t))return!0;return!1}function wte({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function Tte(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function Ete(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&tk(e.body[0],{type:`Assertion`,kind:`search_start`})}function LA(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function RA(e,t){let n=ik(e,{...t,unicodePropertyMap:TA}).body;return n.length>1||n[0].body.length>1?wk({body:n}):n[0].body[0]}function zA(e,t){return e.negate=t,e}function BA(e,t){return e.parent=t,e}function VA(e,t){return kA(e),e.parent=t,e}function Dte(e,t){let n=SA(t),r=bA(n.target,`ES2024`),i=bA(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];Hk(e,Ote,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,ste(kte[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&yA(f._captureTransfers,e.transferTo,[]).push(t)}),f}var Ote={"*":{enter({node:e},t){if(KA(e)){let n=t.getCurrentModI();t.pushModI(e.flags?vA({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){KA(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){UA(hA(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),WA(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&OA.has(e.value)&&t.setHasCasedChar()}},kte={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?q`\B`:q`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=hA(e),r=GA(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&UA(n)){let e=wA(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);gA.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(qA)&&(o=[vk(45),...o.filter(e=>!qA(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||gA.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=wk(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=mk({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(gA.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=GA(n,i),o=GA(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Pte(WA(e)).forEach(e=>{s.add(Array.isArray(e)?`${GA(e[0],i)}-${GA(e[1],i)}`:GA(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:q`[^\n]`;if(e===`digit`)return t?q`\D`:q`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&OA.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?q`\P`:q`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?q`\W`:q`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=vA(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${Fte(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+Ite(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:q`\g<${t}&R=${r}>`}},Ate=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),jte=new Set([`-`,`\\`,`]`,`^`,`[`]),Mte=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),HA=new Map([[9,q`\t`],[10,q`\n`],[11,q`\v`],[12,q`\f`],[13,q`\r`],[8232,q`\u2028`],[8233,q`\u2029`],[65279,q`\uFEFF`]]),Nte=/^\p{Cased}$/u;function UA(e){return Nte.test(e)}function WA(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=hA(e);if(!UA(t))continue;let o=wA(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function GA(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(HA.has(e))return HA.get(e);if(e<32||e>126&&e<160||e>262143||t&&Lte(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?Mte:jte:Ate,a=hA(e);return(i.has(a)?`\\`:``)+a}function Pte(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function Fte(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function Ite({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function KA({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function Lte(e){return e>47&&e<58}function qA({type:e,value:t}){return e===`Character`&&t===45}var Rte=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=Bte(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(zte(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=Vte(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function zte(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function Bte(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)yA(n,t,{}).transferTo=e;return n}function Vte(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function Hte(e,t){let n=Ute(e,t);return n.options?new Rte(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Ute(e,t){let n=SA(t),r=gte(ik(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:TA}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Dte(r,n),a=ate(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=tA(iA(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function Wte(e,t){return Hte(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function Gte(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>Wte(e,{target:t.target}),{createScanner(e){return new uO(e,t)},createString(e){return{content:e}}}}async function Kte(e){if(XC())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=GC.get(e);if(t!=null)return t;try{let t=KC.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(uw,e)&&(t=uw[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return WC.has(e)||WC.set(e,n),n});return GC.set(e,n),await n}finally{GC.delete(e)}}function qte(e){return WC.get(e)??Kte(e)}var JA=new Set;function YA(e){let t=[],n=new Set;for(let r of Jte(e.themes)){let e=ZA(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return YA({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return YA({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Jte(e){return Yte(e)?[e]:e}function Yte(e){return ZA(e)||XA(e)}function XA(e){return typeof e.name==`string`&&typeof e.load==`function`}function ZA(e){return typeof e.getThemes==`function`}function QA(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var $A=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},ej=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},tj=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function nj(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new $A(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new ej(i));let c=r,l=s().then(e=>{let a=QA(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new tj(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var rj=nj();function ij(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=rj.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,rj.getResolvedTheme(n)??rj.seedResolvedTheme(n,e);JA.has(n)||(JA.add(n),t.loadThemeSync(e))}}function aj({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:oj(t)}}function oj(e){return async()=>LE(QA(await e()))}var sj=`pierre`,cj=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],lj=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],uj=[...lj,...cj],dj=new Set(lj);function fj(e){return dj.has(e)?`light`:`dark`}var pj={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},mj={"pierre-dark":()=>K(()=>import(`./_CpLgRqie.js`),[]),"pierre-dark-soft":()=>K(()=>import(`./_kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>K(()=>import(`./_CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>K(()=>import(`./_B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>K(()=>import(`./_CpjhbsIL.js`),[]),"pierre-light":()=>K(()=>import(`./_CoaEpmwp.js`),[]),"pierre-light-soft":()=>K(()=>import(`./_lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>K(()=>import(`./_D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>K(()=>import(`./_0fSaH845.js`),[]),"pierre-light-tritanopia":()=>K(()=>import(`./_CEbqgOJL.js`),[])};function hj(e){return aj({name:e,collection:sj,colorScheme:fj(e),displayName:pj[e],load:mj[e]})}var gj=YA({themes:uj.map(e=>hj(e))}),_j=`shiki`,vj=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],yj=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),bj=new Set(vj);function xj(e){return bj.has(e)?`light`:`dark`}var Sj={andromeeda:()=>K(()=>import(`./_vGVdxbeo2.js`),[]),"aurora-x":()=>K(()=>import(`./_CDeNXAV0.js`),[]),"ayu-dark":()=>K(()=>import(`./_DluEY0Gj.js`),[]),"ayu-light":()=>K(()=>import(`./_C3h-C4tm.js`),[]),"ayu-mirage":()=>K(()=>import(`./_Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>K(()=>import(`./_C9Q5zVZY.js`),[]),"catppuccin-latte":()=>K(()=>import(`./_CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>K(()=>import(`./_R8nAf1vR.js`),[]),"catppuccin-mocha":()=>K(()=>import(`./_DjuaAJKi.js`),[]),"dark-plus":()=>K(()=>import(`./_Cs2F2srj.js`),[]),dracula:()=>K(()=>import(`./_BHWKrbxM.js`),[]),"dracula-soft":()=>K(()=>import(`./_5eyTD99u.js`),[]),"everforest-dark":()=>K(()=>import(`./_sB-x3p7T.js`),[]),"everforest-light":()=>K(()=>import(`./_Df2xbC6M.js`),[]),"github-dark":()=>K(()=>import(`./_C-LZuMrd.js`),[]),"github-dark-default":()=>K(()=>import(`./_DXG-b-1a.js`),[]),"github-dark-dimmed":()=>K(()=>import(`./_Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>K(()=>import(`./_B_tTalzw.js`),[]),"github-light":()=>K(()=>import(`./_EUqPIrTm.js`),[]),"github-light-default":()=>K(()=>import(`./_BXViO-2h.js`),[]),"github-light-high-contrast":()=>K(()=>import(`./_B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>K(()=>import(`./_C820rvS2.js`),[]),"gruvbox-dark-medium":()=>K(()=>import(`./_BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>K(()=>import(`./_MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>K(()=>import(`./_BC_s9l72.js`),[]),"gruvbox-light-medium":()=>K(()=>import(`./_BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>K(()=>import(`./_BSMLrYjP.js`),[]),horizon:()=>K(()=>import(`./_CE9ld1lL.js`),[]),"horizon-bright":()=>K(()=>import(`./_DSNQnXHK.js`),[]),houston:()=>K(()=>import(`./_CsvMBhTu.js`),[]),"kanagawa-dragon":()=>K(()=>import(`./_Bozd7klA.js`),[]),"kanagawa-lotus":()=>K(()=>import(`./_BmuOG9ZW.js`),[]),"kanagawa-wave":()=>K(()=>import(`./_BML5mF2J.js`),[]),laserwave:()=>K(()=>import(`./_C_8bwKvT.js`),[]),"light-plus":()=>K(()=>import(`./_DVQuIRkW.js`),[]),"material-theme":()=>K(()=>import(`./_Bm3Qr25_2.js`),[]),"material-theme-darker":()=>K(()=>import(`./_2IIEA8gg.js`),[]),"material-theme-lighter":()=>K(()=>import(`./_uhdI0v04.js`),[]),"material-theme-ocean":()=>K(()=>import(`./_CHQ94UKr.js`),[]),"material-theme-palenight":()=>K(()=>import(`./_B5W6OYN7.js`),[]),"min-dark":()=>K(()=>import(`./_BSWPekZh2.js`),[]),"min-light":()=>K(()=>import(`./_DDpmG2fV2.js`),[]),monokai:()=>K(()=>import(`./_B_bV9PQ92.js`),[]),"night-owl":()=>K(()=>import(`./_DhmEMT882.js`),[]),"night-owl-light":()=>K(()=>import(`./_eJ-hLW7d2.js`),[]),nord:()=>K(()=>import(`./_Cb4Vim4T2.js`),[]),"one-dark-pro":()=>K(()=>import(`./_CLwyXe_n2.js`),[]),"one-light":()=>K(()=>import(`./_D7Lr4KcI2.js`),[]),plastic:()=>K(()=>import(`./_DQwYfKfQ2.js`),[]),poimandres:()=>K(()=>import(`./_DRFjx7u42.js`),[]),red:()=>K(()=>import(`./_DX1BQOs82.js`),[]),"rose-pine":()=>K(()=>import(`./_aMsaMD1D2.js`),[]),"rose-pine-dawn":()=>K(()=>import(`./_8PwUyIlP2.js`),[]),"rose-pine-moon":()=>K(()=>import(`./_DO-qXg-I2.js`),[]),"slack-dark":()=>K(()=>import(`./_DnToyrRv2.js`),[]),"slack-ochin":()=>K(()=>import(`./_B2OO5cIa2.js`),[]),"snazzy-light":()=>K(()=>import(`./_4G7pJPwS2.js`),[]),"solarized-dark":()=>K(()=>import(`./_UdsmMDCL2.js`),[]),"solarized-light":()=>K(()=>import(`./_C1IUL_tW2.js`),[]),"synthwave-84":()=>K(()=>import(`./_nFMaYfgc2.js`),[]),"tokyo-night":()=>K(()=>import(`./_oM2G3aXe2.js`),[]),vesper:()=>K(()=>import(`./_DdrHHSXu2.js`),[]),"vitesse-black":()=>K(()=>import(`./_fwtXNY1n2.js`),[]),"vitesse-dark":()=>K(()=>import(`./_BZCL-v6S2.js`),[]),"vitesse-light":()=>K(()=>import(`./_VbXTXTou2.js`),[])};function Cj(e){return aj({name:e,collection:_j,colorScheme:xj(e),load:Sj[e]})}var wj=YA({themes:Object.freeze([...vj.map(e=>Cj(e)),...yj.map(e=>Cj(e))])});function Tj(e){if(XC())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(rj.hasRegisteredTheme(e))return;let t=wj.getTheme(e);if(t!=null){rj.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function Ej(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Dj(e){Tj(e);let t=await rj.resolveTheme(e);return Ej(e,t),t}function Oj(e){return rj.getResolvedTheme(e)??Dj(e)}var kj;async function Aj({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){kj??=cO({themes:[],langs:[`text`],engine:n===`shiki-wasm`?Bw(K(()=>import(`./_BnjxR4X6.js`),[])):Gte()});let r=Mj(kj)?await kj:kj;kj=r;let i=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=qte(e);`then`in t?i.push(t):YC(t,r)}let a=[];for(let t of e){let e=Oj(t);`then`in e?a.push(e):ij(e,kj)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{YC(e,r)}),Promise.all(a).then(e=>{ij(e,r)})]),r}function jj(){if(kj!=null&&!(`then`in kj))return kj}function Mj(e=kj){return e!=null&&`then`in e}for(let e of gj.getThemes())rj.registerThemeIfAbsent(e.name,e.load);function Nj(e=Dy){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Pj(e){for(let t of Nj(e))if(!JA.has(t))return!1;return!0}function Fj(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function Ij(e){return U({tagName:`div`,children:[U({tagName:`div`,children:e.annotations?.map(e=>U({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Lj(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function Rj({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return U({tagName:`div`,children:[t===`custom`?U({tagName:`slot`,properties:{name:Ey}}):zj({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[Bj(r)]],properties:i})}function zj({name:e,prevName:t,iconType:n}){let r=[U({tagName:`slot`,properties:{name:Cy}}),rx({name:Lj(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[nx(t)]})],properties:{"data-prev-name":``}})),r.push(rx({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[nx(e)]})],properties:{"data-title":``}})),r.push(U({tagName:`slot`,properties:{name:wy}})),U({tagName:`div`,children:r,properties:{"data-header-content":``}})}function Bj(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(U({tagName:`span`,children:[nx(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(U({tagName:`span`,children:[nx(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(U({tagName:`slot`,properties:{name:Ty}})),U({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Vj(e){return U({tagName:`pre`,properties:Hj(e)})}function Hj({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var Uj=new Map,Wj={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Gj(e){if(Uj.has(e))return Uj.get(e)??`text`;if(Wj[e]!=null)return Wj[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Uj.has(t[1]))return Uj.get(t[1])??`text`;if(Wj[t[1]]!=null)return Wj[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Uj.has(n)?Uj.get(n)??`text`:Wj[n]??`text`}function Kj(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:Nj(t),preferredHighlighter:n}}function qj(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Jj(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(nx(`
180
+ `)),e}var Yj=Symbol(`no-token`),Xj=Symbol(`multiple-tokens`);function Zj(e){let t=Qj(e);if(t!=null)return t;let n=Yj,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){eM(e,a);for(let t of e.children)$j(t)}else $j(e);r.push(e),i=[],a=void 0;return}for(let e of i)$j(e);r.push(U({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Yj){if(e===Xj){n=Xj;return}if(n===Yj){n=e;return}n!==e&&(n=Xj)}};for(let t of e.children){let e=t.type===`element`?Zj(t):Yj;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function Qj(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function $j(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)$j(t)}}function eM(e,t){e.properties[`data-char`]=t}function tM(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+nM(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function nM(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function rM(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=ix(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Zj(a),i.push(Jj(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(aM,iM),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:iM}}var iM=tM({classPrefix:`hl-`}),aM={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function oM(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var sM=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,cM=/^0(?:\.0+)?%?$/;function lM(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function uM(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function dM(e){if(e==null)return null;let t=uM(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function fM(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||sM.test(t))return!0;let n=lM(t);return n!=null&&cM.test(n)}function pM(e,t,n){if(t==null||n==null)return!1;let r=dM(e),i=dM(t),a=dM(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var mM=new WeakMap;function hM(e){let t=mM.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;gM(r,`editor.background`,i),gM(r,`editor.foreground`,a),gM(r,`sideBar.background`,o),gM(r,`sideBar.foreground`,s),gM(r,`input.background`,n[`input.background`]??o),gM(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),gM(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),gM(r,`gitDecoration.addedResourceForeground`,_M(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),gM(r,`gitDecoration.modifiedResourceForeground`,_M(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),gM(r,`gitDecoration.deletedResourceForeground`,_M(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(fM(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(fM(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(vM(l,o)||pM(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return mM.set(e,u),u}function gM(e,t,n){n!=null&&n!==``&&(e[t]=n)}function _M(...e){for(let t of e)if(t!=null&&t!==``)return t}function vM(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function yM({theme:e=Dy,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=hM(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${oM(`global`)}fg:${a.fg};`,r+=`${oM(`global`)}bg:${a.bg};`,r+=bM(i,n)}else{let n=t.getTheme(e.dark),i=hM(n);r+=`${oM(`global`)}dark:${i.fg};`,r+=`${oM(`global`)}dark-bg:${i.bg};`,r+=bM(n,`dark`),n=t.getTheme(e.light),i=hM(n),r+=`${oM(`global`)}light:${i.fg};`,r+=`${oM(`global`)}light-bg:${i.bg};`,r+=bM(n,`light`)}return r}function bM(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${oM(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${oM(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${oM(`global`)}${t}modified-color:${a};`),n}function xM(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}function SM(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function CM(e){return e.startingLine===0&&e.totalLines>0}function wM(e,t){return e.endsWith(`\r
181
181
  `)?t+`\r
182
182
  `:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
183
183
  `)?t+`
@@ -233,7 +233,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[Vk(e),e])),pte=new Map([[`s`,pA(383)],[pA(38
233
233
  <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
234
234
  <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
235
235
  </symbol>
236
- </svg>`;function DM(e,t){return e==null||t==null?e===t:kM(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var OM={};function kM(e=OM,t=OM){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function AM(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function jM(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function MM(){let e=document.createElement(`style`);return e.setAttribute(jy,``),e}var NM=`@layer base {
236
+ </svg>`;function DM(e,t){return e==null||t==null?e===t:kM(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var OM={};function kM(e=OM,t=OM){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function AM(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function jM(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function MM(){let e=document.createElement(`style`);return e.setAttribute(ky,``),e}var NM=`@layer base {
237
237
  :host {
238
238
  --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
239
239
  "Courier New", monospace;
@@ -1511,7 +1511,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[Vk(e),e])),pte=new Map([[`s`,pA(383)],[pA(38
1511
1511
  }
1512
1512
 
1513
1513
  @layer theme, rendered, unsafe;
1514
- `,PM;function FM(e){if(PM!=null)return PM;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(My,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),PM=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),PM}function IM(e){return`${Ny}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var LM=`@layer base, theme, rendered, unsafe;`,RM=RegExp(`${HM(Ny)}\\s*:\\s*[^;]+;`);function zM(e){return`${LM}
1514
+ `,PM;function FM(e){if(PM!=null)return PM;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(Ay,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),PM=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),PM}function IM(e){return`${jy}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var LM=`@layer base, theme, rendered, unsafe;`,RM=RegExp(`${HM(jy)}\\s*:\\s*[^;]+;`);function zM(e){return`${LM}
1515
1515
  @layer unsafe {
1516
1516
  ${e}
1517
1517
  }`}function BM(e,t=`system`,n){return`${LM}
@@ -1521,15 +1521,15 @@ XID_Start XIDS`.split(/\s/).map(e=>[Vk(e),e])),pte=new Map([[`s`,pA(383)],[pA(38
1521
1521
  ${IM(n)}
1522
1522
  ${e}
1523
1523
  }
1524
- }`}function VM(e,t){let n=IM(t);return e.replace(RM,n)}function HM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function UM({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 WM(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function GM(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 KM(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function qM(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function JM(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 YM({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=XM(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function XM(){let e=document.createElement(`style`);return e.setAttribute(Ay,``),e}var ZM=void 0;function QM(){return ZM??=`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(NM)),t.adoptedStyleSheets=[e]}connectedCallback(){FM(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(vy,t)}function $M(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function eN(e){return{...e,hunks:e.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function tN(e){return e===``?[]:e.split(by)}function nN(e,t,n){let r=e===`clone`?eN(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return rN(r,aN(r,n),oN(r,n));case`rename-pure`:{let e=oN(r,n);sN(r,n);let t=tN(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,lN(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function rN(e,t,n){let r=tN(t.contents),i=tN(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=iN(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,lN(e,t,n),e}function iN(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($y(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=eb(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=eb(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function aN(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function oN(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function sN(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function cN(e,t,n){return e.cacheKey==null?uN(t,n):`${e.cacheKey}:hydrated`}function lN(e,t,n){let r=cN(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function uN(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var dN=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 fN(e,t){return Uy(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function pN(e){return U({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function mN(e){return U({tagName:`div`,children:[U({tagName:`span`,children:[ix(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function hN(e){return U({tagName:`div`,children:[ax({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 gN({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(U({tagName:`div`,children:[ix(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(hN(`up`)),s++),o||(e.push(hN(`down`)),s++)):(e.push(hN(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(U({tagName:`div`,children:[U({tagName:`span`,children:[ix(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(U({tagName:`div`,children:[ix(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(U({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(U({tagName:`slot`,properties:{name:i}})),U({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 _N(e,t){return`hunk-separator-${e}-${t}`}function vN(e){let t=e.at(-1);return t==null?0:Math.max(eb(t.additionStart,t.additionCount),eb(t.deletionStart,t.deletionCount))}function yN(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function bN({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 xN({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 SN(e){return[$y(e.additionStart,e.additionCount)+1,eb(e.additionStart,e.additionCount)+1]}function CN({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 wN(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-eb(t.additionStart,t.additionCount),r=e.deletionLines.length-eb(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function TN({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-eb(n.additionStart,n.additionCount),i=e.deletionLines.length-eb(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 EN({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=TN({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 DN({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]=SN(a);if(t<o){let s=CN({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=EN({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]=SN(a);return t<o+i.fromStart||t>=o+i.rangeSize}function ON({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]=SN(n),l=CN({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=EN({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 kN({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=AN({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=$y(r.deletionStart,r.deletionCount),s=$y(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=CN({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?EN({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(NN(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,NN(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(NN(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=PN(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(FN({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(NN(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 AN({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=jN({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 jN({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=CN({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?EN({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 MN(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 NN(e,t,n,r,i,a){let[o,s]=MN(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 PN(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 FN({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,ne=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:ee}:void 0;if(te==null&&ne!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:ne};if(te!=null&&ne==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:void 0};if(te==null||ne==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:ne}}var IN={forcePlainText:!1};function LN(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=IN){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=yM({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)??zN();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)}kN({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&&RN({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}=BN({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 f.deletionLines.push(...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 f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function RN({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Gy(e),t=Gy(t),e.length>s||t.length>s))return;let c=o===`char`?Eb(e,t):Ub(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?(xN({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),xN({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?xN({item:e,arr:l,enableJoin:d,isLastItem:t}):xN({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(bN({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(bN({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function zN(){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 BN({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=ky,...l}}){let u=s??Gj(e.name),d=s??Gj(t.name),{state:f,transformers:p}=rM(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:oM(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:oM(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,xM(i.codeToHast(Gy(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,xM(i.codeToHast(Gy(t.contents),m)))}}function VN(e,t){let n=tx({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 HN(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 UN(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function WN(e,t){return t.length>0&&t.length<e.deletionLines.length&&UN(t)}function GN(e,t,n){let r=e.deletionLines.join(``),i=HN(t.length,r),a=tx({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 KN(e,t){return GN(e,[``],t)}function qN(e,t){if(e.additionLines.length===0)return KN(e,t);if(WN(e,e.additionLines))return GN(e,e.additionLines,t);let n=e.additionLines,r=VN(e,t);return YN(r,n),r}function JN(e){return e.length>1&&e.at(-1)===``}function YN(e,t){if(!JN(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&&eb(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,aP(e);return}}}function XN(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return ZN(e,VN(e,n));let r=Array.from(t);if(r.length===0)return ZN(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||Gy(r)===Gy(i))return ZN(e,VN(e,n))}let i=QN(e,r);if(i.size===0)return ZN(e,VN(e,n));for(let t of i)if(!eP(e,t,n))return ZN(e,VN(e,n));return aP(e),wN(e)?ZN(e,VN(e,n)):ZN(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function ZN(e,t){return Object.assign(e,t),t}function QN(e,t){let n=new Set;for(let r of t){let t=$N(e,r);if(t==null)return new Set;n.add(t)}return n}function $N(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 eP(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=tx({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:(nP(r,s),tP(e,t),!0)}function tP(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(`
1524
+ }`}function VM(e,t){let n=IM(t);return e.replace(RM,n)}function HM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function UM({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 WM(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function GM(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 KM(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function qM(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function JM(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 YM({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=XM(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function XM(){let e=document.createElement(`style`);return e.setAttribute(Oy,``),e}var ZM=void 0;function QM(){return ZM??=`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(NM)),t.adoptedStyleSheets=[e]}connectedCallback(){FM(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(Kee,t)}function $M(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function eN(e){return{...e,hunks:e.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function tN(e){return e===``?[]:e.split(Jee)}function nN(e,t,n){let r=e===`clone`?eN(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return rN(r,aN(r,n),oN(r,n));case`rename-pure`:{let e=oN(r,n);sN(r,n);let t=tN(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,lN(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function rN(e,t,n){let r=tN(t.contents),i=tN(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=iN(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,lN(e,t,n),e}function iN(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(Zy(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=Qy(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=Qy(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function aN(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function oN(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function sN(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function cN(e,t,n){return e.cacheKey==null?uN(t,n):`${e.cacheKey}:hydrated`}function lN(e,t,n){let r=cN(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function uN(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var dN=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 fN(e,t){return Vy(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function pN(e){return U({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function mN(e){return U({tagName:`div`,children:[U({tagName:`span`,children:[nx(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function hN(e){return U({tagName:`div`,children:[rx({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 gN({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(U({tagName:`div`,children:[nx(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(hN(`up`)),s++),o||(e.push(hN(`down`)),s++)):(e.push(hN(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(U({tagName:`div`,children:[U({tagName:`span`,children:[nx(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(U({tagName:`div`,children:[nx(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(U({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(U({tagName:`slot`,properties:{name:i}})),U({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 _N(e,t){return`hunk-separator-${e}-${t}`}function vN(e){let t=e.at(-1);return t==null?0:Math.max(Qy(t.additionStart,t.additionCount),Qy(t.deletionStart,t.deletionCount))}function yN(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function bN({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 xN({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 SN(e){return[Zy(e.additionStart,e.additionCount)+1,Qy(e.additionStart,e.additionCount)+1]}function CN({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 wN(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-Qy(t.additionStart,t.additionCount),r=e.deletionLines.length-Qy(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function TN({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-Qy(n.additionStart,n.additionCount),i=e.deletionLines.length-Qy(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 EN({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=TN({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 DN({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]=SN(a);if(t<o){let s=CN({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=EN({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]=SN(a);return t<o+i.fromStart||t>=o+i.rangeSize}function ON({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]=SN(n),l=CN({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=EN({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 kN({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=AN({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=Zy(r.deletionStart,r.deletionCount),s=Zy(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=CN({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?EN({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(NN(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,NN(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(NN(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=PN(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(FN({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(NN(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 AN({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=jN({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 jN({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=CN({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?EN({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 MN(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 NN(e,t,n,r,i,a){let[o,s]=MN(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 PN(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 FN({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,ne=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:ee}:void 0;if(te==null&&ne!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:ne};if(te!=null&&ne==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:void 0};if(te==null||ne==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:ne}}var IN={forcePlainText:!1};function LN(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=IN){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=yM({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)??zN();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)}kN({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&&RN({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}=BN({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 f.deletionLines.push(...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 f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function RN({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Uy(e),t=Uy(t),e.length>s||t.length>s))return;let c=o===`char`?wb(e,t):Vb(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?(xN({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),xN({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?xN({item:e,arr:l,enableJoin:d,isLastItem:t}):xN({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(bN({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(bN({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function zN(){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 BN({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=Dy,...l}}){let u=s??Gj(e.name),d=s??Gj(t.name),{state:f,transformers:p}=rM(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:oM(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:oM(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,xM(i.codeToHast(Uy(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,xM(i.codeToHast(Uy(t.contents),m)))}}function VN(e,t){let n=$b({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 HN(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 UN(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function WN(e,t){return t.length>0&&t.length<e.deletionLines.length&&UN(t)}function GN(e,t,n){let r=e.deletionLines.join(``),i=HN(t.length,r),a=$b({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 KN(e,t){return GN(e,[``],t)}function qN(e,t){if(e.additionLines.length===0)return KN(e,t);if(WN(e,e.additionLines))return GN(e,e.additionLines,t);let n=e.additionLines,r=VN(e,t);return YN(r,n),r}function JN(e){return e.length>1&&e.at(-1)===``}function YN(e,t){if(!JN(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&&Qy(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,aP(e);return}}}function XN(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return ZN(e,VN(e,n));let r=Array.from(t);if(r.length===0)return ZN(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||Uy(r)===Uy(i))return ZN(e,VN(e,n))}let i=QN(e,r);if(i.size===0)return ZN(e,VN(e,n));for(let t of i)if(!eP(e,t,n))return ZN(e,VN(e,n));return aP(e),wN(e)?ZN(e,VN(e,n)):ZN(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function ZN(e,t){return Object.assign(e,t),t}function QN(e,t){let n=new Set;for(let r of t){let t=$N(e,r);if(t==null)return new Set;n.add(t)}return n}function $N(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 eP(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=$b({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:(nP(r,s),tP(e,t),!0)}function tP(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(`
1525
1525
  `),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
1526
- `)}function nP(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>rP(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,iP(e)}function rP(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function iP(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 aP(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max($y(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,iP(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=eb(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-eb(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var oP=new WeakMap;function sP(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function cP(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 lP(e,t){let n=e.hunks,r=e.additionLines,i=sP(r),a=i===r?e:{...e,additionLines:i},o=yP(n,vP(a,t),e.deletionLines.length),s=SP(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,MP(e),YN(e,r),TP(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function uP(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<OP(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:OP(r);if(i==null||t<i||o!=null&&o!==s)return lP(e,n);o=s}if(o!=null){if(dP(e,i,o,r,n)){e.editSessionDirty=!0;return}return lP(e,n)}}function dP(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=fP(e),o=e.hunks[n];if(o.hunkContent.some(pP))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 fP(e){let t=oP.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return oP.set(e,{lines:e.deletionLines,set:n}),n}function pP(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function mP(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 hP(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=CN({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=kP(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=EN({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=kP(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function gP(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=kP(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,kP(i)+i.deletionCount,e.deletionLines.length),n}function _P(e,t){return e.editSessionDirty===!0&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?VN(e,t):qN(e,t)),!0)}function vP(e,t){if(cP(e.deletionLines,e.additionLines)==null)return[];let n=tx({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=rP(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 yP(e,t,n){let r=e.map((e,t)=>{let n=kP(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&&bP(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=xP(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 bP(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function xP(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 SP(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`);wP(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`);wP(s,c,i,r),r+=c,i+=c,n.push(CP(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 CP(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:AP(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:jP(t.additionStart,r),deletionStart:AP(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:jP(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${AP(t.deletionStart,i)},${i} +${AP(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return iP(s),s}function wP(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function TP(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(kP(r)!==kP(i)||r.deletionCount!==i.deletionCount||OP(r)!==OP(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!EP(r,i))return!0}return!1}function EP(e,t){let n=DP(e),r=DP(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*DP(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 OP(e){return $y(e.additionStart,e.additionCount)}function kP(e){return $y(e.deletionStart,e.deletionCount)}function AP(e,t){return t===0?e:e+1}function jP(e,t){return t===0?e-1:e}function MP(e){aP(e);for(let t=0;t<e.hunks.length;t++)tP(e,t)}function NP(e){let t=e.lang??Gj(e.name),n=e.lang??(e.prevName==null?`text`:Gj(e.prevName));return t===`text`&&n===`text`}var PP=-1,FP=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++PP}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;editSessionActive=!1;constructor(e={theme:ky},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Pj(e.theme??ky)?jj():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(){this.editSessionActive=!0;let e=this.diffCache;e!=null&&!e.isPartial&&e.additionLines.length===0&&(Object.assign(e,KN(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{renderCache:e}=this;if(e==null||NP(e.diff)||XP(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);fN(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}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)??Fy}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){if(this.renderCache==null)return!1;let{result:r,diff:i}=this.renderCache;if(r==null)return!1;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[],s=new Map;for(let[t,n]of e){let e=a[t]?.properties??{},r=n.map(e=>e[2]).join(``),c=t<i.additionLines.length,l=c?i.additionLines[t]??``:``,u=Gy(l);c&&(i.additionLines[t]=wM(l,r),u!==r&&(o.push(t),s.set(t,l))),a[t]={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}]})}}let c=!1;if(o.length>0){if(this.editSessionActive&&!i.isPartial){if(!n){if(i.additionLines.length<=1&&i.additionLines.join(``)===``)Object.assign(i,KN(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else if(WN(i,i.additionLines))Object.assign(i,GN(i,i.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else{let e=uP(i,o,this.options.parseDiffOptions,s);this.applyExpansionRemap(e),c=e!=null}}}else Object.assign(i,XN(i,o,this.options.parseDiffOptions))}return r.baseThemeType=t,this.renderCache.isDirty=!0,c}applyExpansionRemap(e){e!=null&&(this.expandedHunks=mP(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:r}=t;t.additionLines=qP(e,r),n.code.additionLines=GP(r,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join(``)===``?(Object.assign(t,KN(t,this.options.parseDiffOptions)),n.code.additionLines[0]=KP(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,qN(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(WN(e,n)){Object.assign(e,GN(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(lP(e,t))}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=>Ij(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=ky,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=Py,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 Aj(Kj(this.computedLang,{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=XP(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!fN(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!NP(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.computedLang=e.lang??Gj(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??ky}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||!$M(e,n.diff)||!fN(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Iy){if(e==null)return;let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},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||NP(e)||XP(e,this.getTokenizeMaxLength()),l=!$M(e,this.renderCache.diff),u=!Fj(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!l&&yN(t);o&&(this.renderCache.highlightPending=!0),!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,yN(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??Gj(e.name);let t=this.highlighter!=null&&Pj(i.theme),n=this.highlighter!=null&&XC(this.computedLang),r=!c&&n;if(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.renderCache!=null&&(this.renderCache.highlighted=!1),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=Iy){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 Vj({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=XP(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Gj(e.name);let n=this.highlighter!=null&&Pj(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&XC(this.computedLang);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=LN(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(kN({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]=KP(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){if(this.renderCache==null)return;let i=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!fN(this.renderCache.options,n)||!$M(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!fN(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&$M(e,n.diff)&&fN(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;this.diff=e;let f=a===`unified`,p=ZP(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:sx(),deletionsGutterAST:sx(),additionsGutterAST:sx(),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=TN({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`,lx(void 0,`buffer`,this.size)),h?.push(pN(this.size))):(x.pushToGutter(`deletions`,lx(void 0,`buffer`,this.size)),g?.push(pN(this.size))),this.size=0,this.side=void 0}}},ee=(e,t,n,r,i)=>{x.pushToGutter(e,cx(t,n,r,i))};function te(e){C.flush(),a===`unified`?HP(`unified`,e,x):(HP(`deletions`,e,x),HP(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),kN({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&&zP(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=UP(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=UP(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),VP({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&&zP(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&BP(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=UP(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=UP(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)}VP({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&BP(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),ne=_?n.noEOFCRDeletions:!1,w=_?n.noEOFCRAdditions:!1,re=(s?.noEOFCR??!1)||ne,ie=(o?.noEOFCR??!1)||w;if(ie||re){if(a===`split`&&C.flush(),re){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(mN(e)),x.pushToGutter(`unified`,lx(e,`metadata`,1))):(x.deletionsContentAST.push(mN(e)),x.pushToGutter(`deletions`,lx(e,`metadata`,1)),ie||(x.pushToGutter(`additions`,lx(void 0,`buffer`,1)),x.additionsContentAST.push(pN(1))))}if(ie){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(mN(e)),x.pushToGutter(`unified`,lx(e,`metadata`,1))):(x.additionsContentAST.push(mN(e)),x.pushToGutter(`additions`,lx(e,`metadata`,1)),re||(x.pushToGutter(`deletions`,lx(void 0,`buffer`,1)),x.deletionsContentAST.push(pN(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 ne=Math.max(vN(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,re=!f&&e.type!==`deleted`,ie=!f&&e.type!==`new`,ae=x.rowCount>0||w;h=re&&ae?h:void 0,g=ie&&ae?g:void 0,_=f&&ae?_:void 0;let oe=this.createPreElement(g!=null&&h!=null,ne);return{unifiedGutterAST:f&&ae?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:ie&&ae?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:re&&ae?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:oe,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:ne,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=sx(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,TM(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(U({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(U({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(U({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return hC(this.renderFullAST(e,t))}renderPartialHTML(e,t){return hC(t==null?e:U({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(!CM(n))return;let i=e.type===`new`?[]:IP(SM(this.deletionAnnotations)),a=e.type===`deleted`?[]:IP(SM(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){VP({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}VP({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(qj(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(qj(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}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return Rj({fileOrDiff:e,mode:t,stickyHeader:n})}};function IP(e){return e?.map(e=>qj(e))??[]}var LP=new Intl.PluralRules(`en-US`);function RP(e){return`${e} unmodified line${LP.select(e)===`one`?``:`s`}`}function zP(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function BP(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 VP({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`,lx(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`,lx(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`,lx(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function HP(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,gN({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(gN({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,gN({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(gN({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=_N(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?RP(n):`More unchanged context may be available`;c.pushToGutter(e,gN({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(gN({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 UP(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function WP(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function GP(e,t,n,r){let i=WP(e),a=WP(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 r=e.length;r<t.length;r++)l[r]??=n[r];for(let e=s;e<t.length;e++)l[e]??=KP(e,r.getLineText(e));return l}function KP(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 qP(e,t){let n=[],r=YP(t);for(let t=0;t<e.lineCount;t++){let i=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!JP(i)?i+r:i)}return n}function JP(e){return e.endsWith(`
1526
+ `)}function nP(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>rP(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,iP(e)}function rP(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function iP(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 aP(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Zy(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,iP(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=Qy(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-Qy(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var oP=new WeakMap;function sP(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function cP(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 lP(e,t){let n=e.hunks,r=e.additionLines,i=sP(r),a=i===r?e:{...e,additionLines:i},o=yP(n,vP(a,t),e.deletionLines.length),s=SP(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,MP(e),YN(e,r),TP(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function uP(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<OP(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:OP(r);if(i==null||t<i||o!=null&&o!==s)return lP(e,n);o=s}if(o!=null){if(dP(e,i,o,r,n)){e.editSessionDirty=!0;return}return lP(e,n)}}function dP(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=fP(e),o=e.hunks[n];if(o.hunkContent.some(pP))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 fP(e){let t=oP.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return oP.set(e,{lines:e.deletionLines,set:n}),n}function pP(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function mP(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 hP(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=CN({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=kP(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=EN({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=kP(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function gP(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=kP(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,kP(i)+i.deletionCount,e.deletionLines.length),n}function _P(e,t){return e.editSessionDirty===!0&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?VN(e,t):qN(e,t)),!0)}function vP(e,t){if(cP(e.deletionLines,e.additionLines)==null)return[];let n=$b({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=rP(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 yP(e,t,n){let r=e.map((e,t)=>{let n=kP(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&&bP(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=xP(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 bP(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function xP(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 SP(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`);wP(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`);wP(s,c,i,r),r+=c,i+=c,n.push(CP(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 CP(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:AP(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:jP(t.additionStart,r),deletionStart:AP(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:jP(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${AP(t.deletionStart,i)},${i} +${AP(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return iP(s),s}function wP(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function TP(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(kP(r)!==kP(i)||r.deletionCount!==i.deletionCount||OP(r)!==OP(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!EP(r,i))return!0}return!1}function EP(e,t){let n=DP(e),r=DP(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*DP(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 OP(e){return Zy(e.additionStart,e.additionCount)}function kP(e){return Zy(e.deletionStart,e.deletionCount)}function AP(e,t){return t===0?e:e+1}function jP(e,t){return t===0?e-1:e}function MP(e){aP(e);for(let t=0;t<e.hunks.length;t++)tP(e,t)}function NP(e){let t=e.lang??Gj(e.name),n=e.lang??(e.prevName==null?`text`:Gj(e.prevName));return t===`text`&&n===`text`}var PP=-1,FP=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++PP}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;editSessionActive=!1;constructor(e={theme:Dy},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Pj(e.theme??Dy)?jj():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(){this.editSessionActive=!0;let e=this.diffCache;e!=null&&!e.isPartial&&e.additionLines.length===0&&(Object.assign(e,KN(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{renderCache:e}=this;if(e==null||NP(e.diff)||XP(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);fN(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}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)??Ny}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){if(this.renderCache==null)return!1;let{result:r,diff:i}=this.renderCache;if(r==null)return!1;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[],s=new Map;for(let[t,n]of e){let e=a[t]?.properties??{},r=n.map(e=>e[2]).join(``),c=t<i.additionLines.length,l=c?i.additionLines[t]??``:``,u=Uy(l);c&&(i.additionLines[t]=wM(l,r),u!==r&&(o.push(t),s.set(t,l))),a[t]={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}]})}}let c=!1;if(o.length>0){if(this.editSessionActive&&!i.isPartial){if(!n){if(i.additionLines.length<=1&&i.additionLines.join(``)===``)Object.assign(i,KN(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else if(WN(i,i.additionLines))Object.assign(i,GN(i,i.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else{let e=uP(i,o,this.options.parseDiffOptions,s);this.applyExpansionRemap(e),c=e!=null}}}else Object.assign(i,XN(i,o,this.options.parseDiffOptions))}return r.baseThemeType=t,this.renderCache.isDirty=!0,c}applyExpansionRemap(e){e!=null&&(this.expandedHunks=mP(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:r}=t;t.additionLines=qP(e,r),n.code.additionLines=GP(r,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join(``)===``?(Object.assign(t,KN(t,this.options.parseDiffOptions)),n.code.additionLines[0]=KP(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,qN(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(WN(e,n)){Object.assign(e,GN(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(lP(e,t))}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=>Ij(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=Dy,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=My,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 Aj(Kj(this.computedLang,{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=XP(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!fN(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!NP(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.computedLang=e.lang??Gj(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Dy}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||!$M(e,n.diff)||!fN(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Py){if(e==null)return;let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},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||NP(e)||XP(e,this.getTokenizeMaxLength()),l=!$M(e,this.renderCache.diff),u=!Fj(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!l&&yN(t);o&&(this.renderCache.highlightPending=!0),!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,yN(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??Gj(e.name);let t=this.highlighter!=null&&Pj(i.theme),n=this.highlighter!=null&&JC(this.computedLang),r=!c&&n;if(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.renderCache!=null&&(this.renderCache.highlighted=!1),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=Py){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 Vj({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=XP(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Gj(e.name);let n=this.highlighter!=null&&Pj(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&JC(this.computedLang);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=LN(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(kN({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]=KP(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){if(this.renderCache==null)return;let i=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!fN(this.renderCache.options,n)||!$M(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!fN(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&$M(e,n.diff)&&fN(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;this.diff=e;let f=a===`unified`,p=ZP(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:ax(),deletionsGutterAST:ax(),additionsGutterAST:ax(),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=TN({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`,sx(void 0,`buffer`,this.size)),h?.push(pN(this.size))):(x.pushToGutter(`deletions`,sx(void 0,`buffer`,this.size)),g?.push(pN(this.size))),this.size=0,this.side=void 0}}},ee=(e,t,n,r,i)=>{x.pushToGutter(e,ox(t,n,r,i))};function te(e){C.flush(),a===`unified`?HP(`unified`,e,x):(HP(`deletions`,e,x),HP(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),kN({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&&zP(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=UP(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=UP(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),VP({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&&zP(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&BP(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=UP(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=UP(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)}VP({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&BP(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),ne=_?n.noEOFCRDeletions:!1,w=_?n.noEOFCRAdditions:!1,re=(s?.noEOFCR??!1)||ne,ie=(o?.noEOFCR??!1)||w;if(ie||re){if(a===`split`&&C.flush(),re){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(mN(e)),x.pushToGutter(`unified`,sx(e,`metadata`,1))):(x.deletionsContentAST.push(mN(e)),x.pushToGutter(`deletions`,sx(e,`metadata`,1)),ie||(x.pushToGutter(`additions`,sx(void 0,`buffer`,1)),x.additionsContentAST.push(pN(1))))}if(ie){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(mN(e)),x.pushToGutter(`unified`,sx(e,`metadata`,1))):(x.additionsContentAST.push(mN(e)),x.pushToGutter(`additions`,sx(e,`metadata`,1)),re||(x.pushToGutter(`deletions`,sx(void 0,`buffer`,1)),x.deletionsContentAST.push(pN(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 ne=Math.max(vN(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,re=!f&&e.type!==`deleted`,ie=!f&&e.type!==`new`,ae=x.rowCount>0||w;h=re&&ae?h:void 0,g=ie&&ae?g:void 0,_=f&&ae?_:void 0;let oe=this.createPreElement(g!=null&&h!=null,ne);return{unifiedGutterAST:f&&ae?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:ie&&ae?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:re&&ae?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:oe,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:ne,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=ax(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,TM(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(U({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(U({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(U({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return pC(this.renderFullAST(e,t))}renderPartialHTML(e,t){return pC(t==null?e:U({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(!CM(n))return;let i=e.type===`new`?[]:IP(SM(this.deletionAnnotations)),a=e.type===`deleted`?[]:IP(SM(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){VP({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}VP({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(qj(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(qj(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}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return Rj({fileOrDiff:e,mode:t,stickyHeader:n})}};function IP(e){return e?.map(e=>qj(e))??[]}var LP=new Intl.PluralRules(`en-US`);function RP(e){return`${e} unmodified line${LP.select(e)===`one`?``:`s`}`}function zP(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function BP(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 VP({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`,sx(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`,sx(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`,sx(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function HP(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,gN({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(gN({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,gN({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(gN({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=_N(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?RP(n):`More unchanged context may be available`;c.pushToGutter(e,gN({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(gN({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 UP(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function WP(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function GP(e,t,n,r){let i=WP(e),a=WP(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 r=e.length;r<t.length;r++)l[r]??=n[r];for(let e=s;e<t.length;e++)l[e]??=KP(e,r.getLineText(e));return l}function KP(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 qP(e,t){let n=[],r=YP(t);for(let t=0;t<e.lineCount;t++){let i=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!JP(i)?i+r:i)}return n}function JP(e){return e.endsWith(`
1527
1527
  `)||e.endsWith(`\r`)}function YP(e){for(let t of e){if(t.endsWith(`\r
1528
1528
  `))return`\r
1529
1529
  `;if(t.endsWith(`
1530
1530
  `))return`
1531
1531
  `;if(t.endsWith(`\r`))return`\r`}return`
1532
- `}function XP(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function ZP(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function QP(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function $P(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 eF(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function tF({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 nF(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:qM(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 rF(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var iF=-1,aF=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++iF}`;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;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:ky},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new RC,this.scrollSyncManager=new dN,this.interactionManager=new vC(`diff`,yC(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()};getHunksRendererOptions(e){return nF(e)}createHunksRenderer(e){return new FP(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=$y(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`){if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}c+=n.lines,l+=n.lines,u+=n.lines}else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(yC(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&&!Uy(this.appliedThemeCSS.theme,this.options.theme??ky)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}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.lineAnnotations.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){Vy(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(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,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.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),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.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=tF(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),lF(this.pre,sF({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||uF(this.headerElement,cF({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),WM(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?tx(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(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;e==null||t==null||!rF(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}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)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(nN(`merge`,e,t),this.setHydratedState(t),await eF(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}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}){let l=tF(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),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=_&&(!oF(u,this.deletionFile)||!oF(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)&&i!==this.lineAnnotations;if(!f&&Fj(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=tx(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(_P(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:ee=!1}=this.options;if(ee&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,Ly);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),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.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}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)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||yN(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return kN({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}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=hP(e,this.hunksRenderer.getExpandedHunksMap(),t);return _P(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(gP(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!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))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return DN({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return ON({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{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]=SN(o);if(e<s){let c=CN({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=EN({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]=SN(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(){By(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.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||NP(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.lastRenderedHeaderHTML=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||!$P(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;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${qj(r)}`,a=this.annotationCache.get(i);if(a==null||!QP(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:AM(qj(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}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=jM();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.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:KM(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):KM(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=EM;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){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??hC(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||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Oy,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Ty,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Ey,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Dy,u),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}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??=MM(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=zM(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??ky,s=typeof o==`string`?o:{...o},c=FM(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=YM({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:BM(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=VM(this.themeCSSStyle.textContent??``,FM(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&QM()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?JM(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=dF(t[0]),a=dF(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=hC(i),r.content.innerHTML=hC(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=UM({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=UM({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=UM({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({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!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(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=dF(r?.[0]),a=dF(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)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=dF(n?.[0]),i=dF(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=hC(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?JM(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=dF(t[0]),i=dF(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};DM(u,this.appliedPreAttributes)||(GM(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 oF(e,t){return e==null||t==null?e==null&&t==null:rx(e,t)}function sF({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function cF({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function lF(e,t,n=!1){return!n&&e==null&&t}function uF(e,t,n=!1){return e==null&&t&&!n}function dF(e){if(e!=null&&e.type===`element`)return e.children??[]}function fF(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`.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 pF=`<div class=diff-file></div>`,mF=`background:var(--panel);border-block:1px solid var(--border);padding:.5rem .75rem;font-family:system-ui,sans-serif;font-size:.85rem;display:flex;flex-direction:column;gap:.35rem;`,hF=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;`,gF=new CSSStyleSheet;gF.replaceSync(`:host { display: block; max-width: 100%; overflow-x: auto; } @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } [data-column-number], [data-gutter-utility-slot] { touch-action: none !important; } }`+Ev);var _F=it(`c0`,0),vF=N(11,L(`c1`,e=>Tt(e,{file:e.d,comments:e.e,draft:e.f,onMount:function(){let t=t=>{if(!t)return;let n=document.createElement(`div`);n.style.cssText=mF;let r=document.createElement(`p`);r.textContent=t.text,r.style.cssText=`margin:0;white-space:pre-wrap;`;let i=document.createElement(`button`);return i.textContent=`remove`,i.style.cssText=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;align-self:flex-start;font-size:.75rem;opacity:.7;`,i.onclick=()=>e.g?.(t.id),n.append(r,i),n},n=()=>{let t=document.createElement(`div`);t.style.cssText=mF;let n=document.createElement(`textarea`);n.placeholder=`Leave a comment…`,n.rows=3,n.style.cssText=`font:inherit;width:100%;resize:vertical;border:1px solid var(--border);border-radius:var(--radius);padding:.4rem .5rem;background:inherit;color:inherit;`+(ar()?`font-size:16px;`:``);let r=document.createElement(`button`);r.textContent=`Comment`,r.style.cssText=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;background:var(--accent);color:light-dark(#fff,#10131f);border-color:transparent;`;let i=document.createElement(`button`);i.textContent=`Cancel`,i.style.cssText=hF,r.onclick=()=>{n.value.trim()&&e.h?.(n.value)},i.onclick=()=>e.i?.(),n.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&r.onclick(),e.key===`Escape`&&i.onclick()};let a=document.createElement(`div`);a.style.cssText=`display:flex;gap:.4rem;`,a.append(r,i),t.append(n,a);let o=()=>n.scrollIntoView({block:`center`,behavior:`smooth`});return n.addEventListener(`focus`,()=>{let e=window.visualViewport;e&&(e.addEventListener(`resize`,o),n.addEventListener(`blur`,()=>e.removeEventListener(`resize`,o),{once:!0}))}),setTimeout(()=>{n.scrollIntoView({block:`center`,behavior:`instant`}),n.focus()},0),t},r=new Map,i,a={draft:!0},o,s=new aF({diffStyle:or()?`unified`:`split`,disableFileHeader:!0,enableLineSelection:!0,onLineSelectionEnd(t){if(!t)return;let n=t.endSide!=null&&t.endSide!==t.side;e.j?.({side:t.side,start:t.start,end:n?t.start:t.end})},renderAnnotation(e){let r=e.metadata||{};return r.draft?o??=n():t(r.comment)}}),c=()=>{let t=[],n=new Map;for(let i of e.e||[]){let e=r.get(i.id)||{comment:i};n.set(i.id,e),t.push({side:i.side,lineNumber:i.line_end,metadata:e})}return r=n,e.f&&(i!==e.f&&(i=e.f,a={draft:!0},o=void 0),t.push({side:e.f.side,lineNumber:e.f.end,metadata:a})),t},l=()=>{let t=e.a.querySelector(`diffs-container`)?.shadowRoot;t&&!t.adoptedStyleSheets.includes(gF)&&(t.adoptedStyleSheets=[...t.adoptedStyleSheets,gF])},u=()=>{if(e.d.old==null&&e.d.new==null){e.k?.(`could not read ${e.d.path}`);return}let t=s.render({containerWrapper:e.a,oldFile:e.d.old==null?null:{name:e.d.oldPath||e.d.path,contents:e.d.old},newFile:e.d.new==null?null:{name:e.d.path,contents:e.d.new},lineAnnotations:c()});Promise.resolve(t).then(()=>{l(),Nv(e.a)}).catch(t=>e.k?.(`diff render: ${t}`))};u();let d=new AbortController;return ar()&&fF(_F(e),d.signal),{instance:s,render:u,dragAbort:d,unregSearch:Mv(e.a,e.d.key),shownFile:e.d,shownComments:e.e,shownDraft:e.f}},onUpdate:function(){(this.file!==this.shownFile||this.comments!==this.shownComments||this.draft!==this.shownDraft)&&(this.shownFile=this.file,this.shownComments=this.comments,this.shownDraft=this.draft,this.render())},onDestroy:function(){this.unregSearch(),this.dragAbort.abort(),this.instance.cleanUp?.()}})),7),yF=M(3,vF),bF=M(4,vF),xF=M(5,vF),SF=M(6,vF),CF=M(7,vF),wF=M(8,vF),TF=M(9,vF),EF=M(10,vF),DF=((e,t,n,r)=>`<div class=diff-view><aside class=tree></aside><div class=diff-col><div class=diff-head><!><span class="dim diff-stats"><!> file<!> changed <!><!></span><span class=head-actions></span><!></div><div class=diff-tools><button class="icon-btn tree-toggle">${e}</button><button class=icon-btn title="Refresh diff">${t}</button><button class="btn files-btn" title="Jump to file">Files (<!>)</button><button class="btn find-btn" title="Find in the review (⌘/Ctrl+F)">${n}<span class=find-label>Find</span></button><label class=two-dot title="Include uncommitted and untracked files in the review. Off by default — the review is commit-to-commit."><input type=checkbox> include uncommitted</label>${r}</div><!><div class=diff-main><!><!><!><!><!><!><!><!></div></div><!></div>`)(Xm,lo,Z_,nv),OF=((e,t,n,r)=>`D bE%bD%c%c%b%l b%lD D/${e}&l D/${t}&l Db%l D/${n}&lD l/${r}&l%b D%b%b%b%b%b%b%b%m%l`)(Zm,uo,Q_,`D l`),kF=P(5,0,e=>V(e.a,e._.x)),AF=kF,jF=N(2,e=>z(e.a,`title`,`checked out ${e._._._.q} ${e._._._.r}`)),MF=I(34,e=>{V(e.b,e._._._.q),jF(e)},e=>e._._._),NF=e=>{MF(e),PF(e)},PF=I(35,jF,e=>e._._._),FF=I(26,e=>V(e.b,e._._._.i),e=>e._._._),IF=e=>{FF(e),LF(e),zF(e),BF(e),VF(e),HF(e),UF(e)},LF=I(27,e=>z(e.a,`href`,`${e._._._.j}/files`),e=>e._._._),RF=N(3,e=>z(e.a,`title`,`${e._._._.k} — ${e._._._.l} ${e._._._.m} vs ${e._._._.n} ${e._._._.o}`),4),zF=I(28,e=>{V(e.c,e._._._.k),RF(e)},e=>e._._._),BF=I(29,RF,e=>e._._._),VF=I(30,RF,e=>e._._._),HF=I(31,RF,e=>e._._._),UF=I(32,RF,e=>e._._._),WF=N(2,e=>z(e.a,`title`,`checked out ${e._._._.q} ${e._._._.r}`)),GF=I(34,e=>{V(e.b,e._._._.q),WF(e)},e=>e._._._),KF=e=>{GF(e),qF(e)},qF=I(35,WF,e=>e._._._),JF=I(33,e=>V(e.a,e._._._.p),e=>e._._._),YF=JF,XF=I(26,e=>V(e.b,e._._._.i),e=>e._._._),ZF=L(`e38`,e=>A(e.a,`click`,function(e){e.stopPropagation()})),QF=e=>{XF(e),$F(e),tI(e),nI(e),rI(e),iI(e),aI(e),ZF(e)},$F=I(27,e=>z(e.a,`href`,`${e._._._.j}/files`),e=>e._._._),eI=N(3,e=>z(e.a,`title`,`${e._._._.k} — ${e._._._.l} ${e._._._.m} vs ${e._._._.n} ${e._._._.o}`),4),tI=I(28,e=>{V(e.c,e._._._.k),eI(e)},e=>e._._._),nI=I(29,eI,e=>e._._._),rI=I(30,eI,e=>e._._._),iI=I(31,eI,e=>e._._._),aI=I(32,eI,e=>e._._._),oI=(e,t)=>V(e.a,t),sI=(e,t)=>V(e.b,t),cI=(e,t)=>V(e.c,t),lI=(e,t)=>V(e.d,V_(t)),uI=(e,t)=>V(e.e,V_(t)),dI=(e,t)=>{oI(e,t[0]?.worktree),sI(e,t[0]?.pr?.number),cI(e,t[0]?.pr?.headRefName),uI(e,t[0]?.pr?.headRefOid),lI(e,t[0]?.head)},fI=(e,t)=>z(e.a,`value`,t),pI=N(7,e=>V(e.b,e.f||e.g)),mI=M(5,pI),hI=M(6,pI),gI=(e,t)=>{fI(e,t[0]?.id),mI(e,t[0]?.title),hI(e,t[0]?.agent)},_I=O(5,`<span class=chip>local <!></span>`,` Db%`,NF),vI=N(6,e=>_I(e,+!e._._._.c3(e._._.c))),yI=I(147,vI,e=>e._._._),bI=e=>{yI(e),xI(e),TI(e),EI(e),OI(e),kI(e),AI(e)},xI=I(22,vI,e=>e._._),SI=O(0,`<a class="chip pr" target=_blank rel=noopener>#<!></a><span class=dim> </span>`,` Db%lD `,IF),CI=N(9,e=>z(e.b,`title`,`${e._._.g?`PR head`:`checked out`} ${e._._.g?e._._.g.headRefName:e._._.q} ${e._._.m}`),2),wI=N(7,e=>V(e.c,e._._.g?e._._.g.headRefName:e._._.q)),TI=I(24,e=>{SI(e,+!e._._.g),CI(e),wI(e)},e=>e._._),EI=I(30,CI,e=>e._._),DI=N(8,e=>z(e.d,`title`,`${e._._.n} ${e._._.o}`)),OI=I(31,e=>{V(e.e,e._._.n),DI(e)},e=>e._._),kI=I(32,DI,e=>e._._),AI=I(34,e=>{CI(e),wI(e)},e=>e._._),jI=P(26,0,e=>V(e.a,e._.bj.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`)),MI=jI,NI=I(137,L(`e40`,e=>Tt(e,{onMount:function(){e._._._._._._.be(e.a,()=>{$L(e._,!0)})}})),e=>e._._._._._._),PI=N(9,e=>{B(e.a,`closed`,e._._._.b7.has(e._._.d)),V(e.b,e._._._.b7.has(e._._.d)?`▸`:`▾`)}),FI=I(136,PI,e=>e._._._),II=L(`e39`,e=>A(e.a,`click`,function(){e._._._.b9(e._._.d)})),LI=e=>{FI(e),BI(e),VI(e),HI(e),KI(e),qI(e),JI(e),XI(e),ZI(e),QI(e),II(e)},RI=O(8,`<span class=chip>local <!></span>`,` Db%`,KF),zI=N(10,e=>RI(e,+!e._._._.c3(e._._.c))),BI=I(147,zI,e=>e._._._),VI=I(22,zI,e=>e._._),HI=I(23,PI,e=>e._._),UI=O(3,`<a class="chip pr" target=_blank rel=noopener>#<!></a><span class=dim> </span>`,` Db%lD `,QF,`<span class=dim> </span>`,`D `,YF),WI=N(13,e=>z(e.e,`title`,`${e._._.g?`PR head`:`checked out`} ${e._._.g?e._._.g.headRefName:e._._.q} ${e._._.m}`),2),GI=N(11,e=>V(e.f,e._._.g?e._._.g.headRefName:e._._.q)),KI=I(24,e=>{UI(e,+!e._._.g),WI(e),GI(e)},e=>e._._),qI=I(25,e=>V(e.c,e._._.h),e=>e._._),JI=I(30,WI,e=>e._._),YI=N(12,e=>z(e.g,`title`,`${e._._.n} ${e._._.o}`)),XI=I(31,e=>{V(e.h,e._._.n),YI(e)},e=>e._._),ZI=I(32,YI,e=>e._._),QI=I(34,e=>{WI(e),GI(e)},e=>e._._),$I=N(3,e=>{B(e.a,`closed`,e._._._._.b6.has(e._._.c(e._.e))),V(e.b,e._._._._.b6.has(e._._.c(e._.e))?`▸`:`▾`)},2),eL=I(135,$I,e=>e._._._._),tL=L(`e29`,e=>A(e.a,`click`,function(){let t=new Set(e._._._._.b6);t.delete(e._._.c(e._.e))||t.add(e._._.c(e._.e)),fH(e._._._._,t)})),nL=e=>{eL(e),rL(e),iL._(e),aL._(e),oL._(e),tL(e)},rL=I(7,$I,e=>e._._),iL=P(0,0,e=>{z(e.a,`title`,e._.e),$I(e)}),aL=P(0,0,e=>gt(e.a,`padding-left:${.35+e._.f*.75}rem`)),oL=P(0,0,e=>V(e.c,e._.g)),sL=P(18,0,e=>py(e.a,e._.az)),cL=e=>{sL._(e),lL._(e),uL._(e),oy(e.a),fy(e.a,QH(e))},lL=P(18,0,e=>cy(e.a,e._.bq)),uL=P(18,0,e=>dy(e.a,$H(e))),dL=We(24,e=>V(e.g,e._.au?`, plus uncommitted`:``)),fL=dL,pL=(e,t)=>V(e.a,t),mL=(e,t)=>V(e.b,t),hL=(e,t)=>V(e.c,V_(t)),gL=(e,t)=>V(e.d,t),_L=(e,t)=>V(e.e,V_(t)),vL=(e,t)=>V(e.f,t),yL=(e,t)=>{pL(e,t[0]?.worktree),mL(e,t[0]?.pr?.number),gL(e,t[0]?.pr?.headRefName),hL(e,t[0]?.head),_L(e,t[0]?.localHead),vL(e,t[0]?.branch)},bL=We(22,e=>V(e.d,e._.au?` — showing uncommitted changes only`:``)),xL=bL,SL=(e,t)=>V(e.a,t),CL=(e,t)=>V(e.b,t?` #${t?.number}`:``),wL=(e,t)=>V(e.c,t),TL=(e,t)=>{SL(e,t[0]?.worktree),CL(e,t[0]?.pr),wL(e,t[0]?.base)},EL=We(21,e=>V(e.c,e._.au?` — showing uncommitted changes only`:``)),DL=EL,OL=(e,t)=>V(e.a,t),kL=(e,t)=>V(e.b,t),AL=(e,t)=>{OL(e,t[0]?.worktree),kL(e,t[0]?.base)},jL=N(1,e=>V(e.a,e._.b1.trim()?`No matches in diffs.`:`No files match "${e._.at}".`)),ML=P(26,1,jL),NL=e=>{ML._(e),PL._(e)},PL=P(26,1,jL),FL=P(23,0,e=>{z(e.b,`disabled`,e._.an),V(e.c,e._.an?`Reloading…`:`Reload`)}),IL=L(`e37`,e=>{A(e.b,`click`,function(){e._.c9()}),A(e.d,`click`,function(){e._.c8()})}),LL=e=>{FL._(e),zL._(e),IL(e)},RL=k(0,`<!> #<!>: origin/<!> is <!>, GitHub last saw <!>.`,`%c%c%c%c%`,0,dI),zL=P(23,0,e=>RL(e,[e._.c5,`id`])),BL=P(20,0,e=>V(e.a,e._.am)),VL=L(`e36`,e=>A(e.b,`click`,function(){zV(e._,null)})),HL=e=>{BL._(e),VL(e)},UL=N(1,e=>xF(e.a,e._._._._._._.ak&&e._._._._._._.ak?.key===e._._.l?e._._._._._._.ak:null)),WL=I(124,UL,e=>e._._._._._._),GL=e=>{WL(e),qL(e),JL(e),YL(e),XL(e),ZL(e),e.a,wF(e.a,tU(e)),EF(e.a,eU(e))},KL=N(2,e=>CF(e.a,nU(e))),qL=I(150,KL,e=>e._._._._._._),JL=I(151,e=>SF(e.a,rU(e)),e=>e._._._._._._),YL=I(26,e=>{yF(e.a,e._._.k),KL(e)},e=>e._._),XL=I(27,e=>{TF(e.a,iU(e)),UL(e)},e=>e._._),ZL=I(28,e=>bF(e.a,e._._.w),e=>e._._),QL=O(0,`<div class=diff-wait></div>`,` `,NI,pF,(e=>`/${e}&`)(` b`),GL),$L=j(1,e=>QL(e,+!!e.b)),eR=e=>$L(e,!1),tR=O(6,`<span class=dim>✓</span>`),nR=N(10,e=>{B(e.a,`seen`,e._._.ah.has(e.j)),tR(e,+!e._._.ah.has(e.j))}),rR=I(122,nR,e=>e._._),iR=L(`e42`,e=>A(e.a,`click`,function(){iH(e._._,!1),e._._.ci(e.j)})),aR=e=>{rR(e),cR(e),iR(e)},oR=O(5,`<span>💬</span>`),sR=N(11,e=>oR(e,+!e._._.c1.has(e.j))),cR=I(146,sR,e=>e._._),lR=M(9,e=>{z(e.d,`title`,e.j),V(e.e,e.j),nR(e),sR(e)}),uR=(e,t)=>{mt(e.b,[`status`,t]),V(e.c,t)},dR=(e,t)=>{lR(e,t[0]?.key),uR(e,t[0]?.status)},fR=P(28,0,e=>V(e.b,e._.aj)),pR=L(`e43`,e=>{A(e.a,`click`,function(){iH(e._,!1)}),A(e.d,`click`,function(){iH(e._,!1)})}),mR=e=>{fR._(e),hR._(e),_R._(e),pR(e)},hR=P(28,0,e=>V(e.c,e._.bn)),gR=k(4,`<button class="sheet-file mono"><span> </span><span class=sheet-path><bdi> </bdi></span><!><!></button>`,` D D l E m%b%`,aR,dR),_R=P(28,0,e=>gR(e,[e._.bt,`key`])),vR=O(8,`<p class="dim diff-pad">binary file</p>`,0,0,`<p class="dim diff-pad">file too large to display</p>`,0,0,`<p class="dim diff-pad">file could not be read</p>`,0,0,`<!><!><!>`,`b%`,eR),yR=N(25,e=>vR(e,e.s?0:e.t?1:e.u==null&&e.v==null?2:e.y?3:4),4),bR=j(24,e=>{ree(e,`a`,e.y),yR(e)}),xR=N(12,e=>bR(e,!e._._._._.ah.has(e.l))),SR=N(15,e=>jt(e,`h`,e._._._._.ah.has(e.l),aU(e)),2),CR=I(122,e=>{xR(e),SR(e)},e=>e._._._._),wR=L(`e41`,e=>{A(e.a,`toggle`,function(t,n){if(bR(e,n.open),!n.open){let e=n.closest(`.diff-main`);if(e){let t=n.getBoundingClientRect().top-e.getBoundingClientRect().top;t<0&&(e.scrollTop+=t)}}}),A(e.g,`click`,function(e){e.stopPropagation()}),Mt(e,`h`)}),TR=e=>{CR(e),DR(e),jR(e),MR(e),wR(e)},ER=N(13,e=>z(e.a,`hidden`,!e._._._._.bx.has(e.l))),DR=I(143,ER,e=>e._._._._),OR=F(ZL),kR=M(22,e=>{PR(e,e.w.length),OR(e)}),AR=N(14,e=>kR(e,e._._._._.c1.get(e.l)||[])),jR=I(146,AR,e=>e._._._._),MR=I(149,SR,e=>e._._._._),NR=O(5,`<span class=chip>💬 <!></span>`,`Db%`,AF),PR=M(23,e=>{NR(e,+!e.x),kF(e)}),FR=F(XL),IR=M(11,e=>{z(e.a,`data-key`,e.l),AR(e),xR(e),ER(e),SR(e),FR(e)}),LR=(e,t)=>{mt(e.b,[`status`,t]),V(e.c,t)},RR=(e,t)=>{z(e.d,`title`,t),V(e.e,t)},zR=M(18,yR),BR=M(19,yR),VR=M(20,yR),HR=M(21,yR),UR=(e,t)=>GR(e,t[0]),WR=F(YL),GR=M(10,e=>{IR(e,e.k?.key),LR(e,e.k?.status),RR(e,e.k?.path),zR(e,e.k?.binary),BR(e,e.k?.tooLarge),VR(e,e.k?.old),HR(e,e.k?.new),WR(e)}),KR=k(0,`<details class=file><summary><span> </span><span class=path><bdi> </bdi></span><!><label class=viewed><input type=checkbox><span class=dim>viewed</span></label></summary><!></details>`,` E D l E m%b D m%`,TR,UR),qR=I(36,e=>KR(e,[e._._.s,`key`]),e=>e._._),JR=qR,YR=N(4,e=>z(e.a,`hidden`,!e._.v&&e._._.b5!==e._.d),2),XR=I(134,YR,e=>e._._),ZR=e=>{XR(e),ez(e),nz(e),rz._(e),az._(e),oz._(e),sz._(e)},QR=O(2,`<div class=files></div>`,` `,JR),$R=N(5,e=>QR(e,e._._.bl>1&&e._._.b7.has(e._.d)?1:0),2),ez=I(136,$R,e=>e._._),tz=O(1,`<button class=repo-sep><span class=tree-chev> </span><span class=mono> </span><!><span class="chip lane">on <!></span><span class=chip>vs <!></span><!></button>`,` E lD l%b Db%l Db%l%`,LI,`<p class=repo-meta><!><span class="chip lane">on <!></span><span class=chip>vs <!></span><!></p>`,`D%b Db%l Db%l%`,bI),nz=I(139,e=>{tz(e,e._._.bl>1?0:1),$R(e)},e=>e._._),rz=P(0,0,e=>{YR(e),$R(e)}),iz=N(3,e=>z(e.a,`data-pr`,e._.g?`${e._.h}/${e._.g.number}`:void 0)),az=P(0,0,iz),oz=P(0,0,iz),sz=P(0,0,YR),cz=F(qR),lz=M(18,e=>{_z(e,e.s.length),cz(e)}),uz=N(4,e=>lz(e,e._.by.get(e.d)||[])),dz=We(27,uz),fz=e=>{dz._(e),hz._(e)},pz=(e,t)=>bz(e,t.length),mz=N(5,e=>pz(e,e._.bz.get(e.d)||[])),hz=We(27,mz),gz=O(0,`<section class=repo-section><!><!></section>`,` D%b%`,ZR),_z=(e,t)=>gz(e,+!t),vz=F(HI),yz=M(3,e=>{uz(e),mz(e),rz(e),vz(e)}),bz=M(21,sz),xz=(e,t)=>Cz(e,t[0]),Sz=F(VI,xI),Cz=M(2,e=>{yz(e,e.c?.id),Tz(e,e.c?.pr),jz(e,e.c?.worktree),Mz(e,e.c?.head),Nz(e,e.c?.base),Pz(e,e.c?.baseSha),Fz(e,e.c?.full_name),Iz(e,e.c?.branch),Lz(e,e.c?.localHead),Sz(e)}),wz=F(KI,TI),Tz=M(6,e=>{Ez(e,e.g?.number),Dz(e,e.g?.url),Oz(e,e.g?.title),kz(e,e.g?.headRefName),az(e),wz(e)}),Ez=M(8,F(XF,FF)),Dz=M(9,F($F,LF)),Oz=M(10,F(tI,zF)),kz=M(11,F(nI,BF)),Az=F(qI),jz=M(7,e=>{oz(e),Az(e)}),Mz=M(12,F(JI,EI,rI,VF)),Nz=M(13,F(XI,OI,iI,HF)),Pz=M(14,F(ZI,kI,aI,UF)),Fz=M(15,F(JF)),Iz=M(16,F(QI,AI,GF,MF)),Lz=M(17,F(qF,PF)),Rz=N(5,e=>B(e.a,`seen`,e._._._._.ah.has(e._.i))),zz=I(122,Rz,e=>e._._._._),Bz=L(`e30`,e=>A(e.a,`click`,function(){e._._._._.ci(e._.i)})),Vz=e=>{zz(e),Wz(e),Gz._(e),Kz._(e),qz._(e),Jz._(e),Yz._(e),Bz(e)},Hz=O(4,`<span class=tree-note>💬</span>`),Uz=N(6,e=>Hz(e,+!e._._._._.c1.has(e._.i))),Wz=I(146,Uz,e=>e._._._._),Gz=P(0,1,e=>gt(e.a,`padding-left:${.5+e._.f*.75}rem`)),Kz=P(0,1,e=>{Rz(e),Uz(e)}),qz=P(0,1,e=>z(e.a,`title`,e._.j)),Jz=P(0,1,e=>{mt(e.b,[`status`,e._.k]),V(e.c,e._.k)}),Yz=P(0,1,e=>V(e.d,e._.l)),Xz=O(0,`<button class="tree-dir dim mono"><span class=tree-chev> </span><!>/</button>`,` E l%`,nL,`<button class="tree-file mono"><span> </span><span class=tree-file-name> </span><!></button>`,` D D lD l%`,Vz),Zz=N(3,e=>Xz(e,!e._.f(e.c)&&e.c?.kind===`dir`?0:!e._.f(e.c)&&e.c?.kind!==`dir`?1:2)),Qz=We(0,Zz),$z=Qz,eB=M(2,e=>{nB(e,e.c?.path),rB(e,e.c?.depth),iB(e,e.c?.label),aB(e,e.c?.file?.key),oB(e,e.c?.file?.path),sB(e,e.c?.file?.status),cB(e,e.c?.name),Zz(e)}),tB=(e,t)=>eB(e,t[0]),nB=M(4,iL),rB=M(5,e=>{Gz(e),aL(e)}),iB=M(6,oL),aB=M(8,Kz),oB=M(9,qz),sB=M(10,Jz),cB=M(11,Yz),lB=M(5,Qz),uB=N(4,e=>lB(e,oU(e)),2),dB=I(135,uB,e=>e._._),fB=M(3,uB),pB=e=>{dB(e),_B(e),yB._(e),fB(e,sU)},mB=k(0,`<!><!><!>`,`b%`,$z,tB),hB=(e,t)=>mB(e,[t,e=>e.kind===`dir`?`d:${e.path}`:e.file.key]),gB=N(6,e=>hB(e,G_(e._._.bz.get(e._.g)||[]))),_B=I(145,gB,e=>e._._),vB=M(2,F(rL)),yB=P(3,0,e=>{vB(e,cU(e)),gB(e),uB(e)}),bB=O(3,`<!><!><!>`,`b%`,pB),xB=N(7,e=>{B(e.a,`closed`,e._.b7.has(e.g)),V(e.b,e._.b7.has(e.g)?`▸`:`▾`),bB(e,+!!e._.b7.has(e.g))}),SB=We(0,xB),CB=L(`e31`,e=>A(e.a,`click`,function(){e._.b9(e.g)})),wB=e=>{SB._(e),CB(e)},TB=M(6,e=>{xB(e),yB(e)}),EB=N(10,e=>V(e.c,e.i?`${e.j} #${e.i.number}`:e.j)),DB=M(8,EB),OB=M(9,EB),kB=(e,t)=>{TB(e,t[0]?.id),DB(e,t[0]?.pr),OB(e,t[0]?.worktree)},AB=k(2,`<option> </option>`,` D `,0,gI),jB=I(119,e=>AB(e,[e._._.a8,`id`]),e=>e._._),MB=L(`e34`,e=>{A(e.a,`click`,function(){e._._.ch(e._._.c2)}),zt(e,`c`)}),NB=e=>{jB(e),PB(e),FB(e),MB(e)},PB=I(128,e=>{z(e.a,`disabled`,e._._.aq),V(e.b,e._._.aq?`Sending…`:`Send to`),z(e.c,`disabled`,e._._.aq)},e=>e._._),FB=I(129,e=>Rt(e,`c`,e._._.ar,lU(e)),e=>e._._),IB=N(2,e=>V(e.b,e._._.aq?`Sending…`:`Send to ${e._._.ac||e._._.ad}`),2),LB=I(120,IB,e=>e._._),RB=L(`e33`,e=>A(e.a,`click`,function(){e._._.ch(e._._.c2)})),zB=e=>{LB(e),BB(e),VB(e),RB(e)},BB=I(121,IB,e=>e._._),VB=I(128,e=>{z(e.a,`disabled`,e._._.aq),IB(e)},e=>e._._),HB=O(2,`<button class="btn primary"> </button>`,` D `,zB,`<span class="split-btn primary"><button> </button><select aria-label="Send comments to session"></select></span>`,`D D l `,NB),UB=P(6,0,e=>HB(e,(e._.a8||[]).length===1?0:(e._.a8||[]).length?1:2)),WB=L(`e35`,e=>A(e.a,`click`,function(){e._.cg()})),GB=e=>{UB._(e),KB._(e),WB(e)},KB=P(6,0,e=>V(e.b,e._.ap?`Copied ✓`:`Copy`)),qB=L(`e32`,e=>A(e.a,`click`,function(){e._.ab?.()})),JB=e=>{J_(e.b),Y_(e.b,14),X_(e.b),qB(e)},YB=M(95,F(DR)),XB=k(0,`<div class=tree-repo><button class="tree-repo-name mono"><span class=tree-chev> </span> </button><!></div>`,`D E l l%`,wB,kB),ZB=N(98,e=>XB(e,[e.bj.filter(t=>e.bz.get(t.id)?.length),`id`])),QB=F(_B),$B=M(97,e=>{ZB(e),QB(e),hz(e)}),eV=N(92,e=>$B(e,new Map(e.bj.map(t=>[t.id,e.bt.filter(e=>e.repo===t.id)])))),tV=M(91,e=>{HH(e,e.bt?.length),YB(e,new Set(e.bt.map(e=>e.key))),eV(e),_R(e)}),nV=N(90,e=>tV(e,e.br?e.bq.filter(t=>e.br.has(t.key)||t.key===e.b4):e.bq),2),rV=M(88,e=>{nV(e),lL(e)}),iV=N(87,e=>rV(e,e.bm.filter(t=>e.bo(t.key)))),aV=M(84,e=>{VH(e,e.bm?.length),iV(e)}),oV=k(21,`<p class=toast-error><!>: base <!> not found<!>.</p>`,`D%c%c%`,DL,AL),sV=k(22,`<p class=dim><!><!>: already in <!><!>.</p>`,`D%b%c%b%`,xL,TL),cV=k(27,`<!><!><!>`,`b%`,fz,xz),lV=M(106),uV=N(104,e=>lV(e,uU(e))),dV=M(103,e=>{KH(e,e.c5?.length),uV(e),zL(e)}),fV=N(82,e=>dV(e,e.bj.filter(t=>t.githubDrift&&!e.b8.has(t.id)))),pV=k(24,`<p class=dim><!> #<!>: this view is <!> (<!>). Local is <!> (<!><!>).</p>`,`D%c%c%c%c%c%b%`,fL,yL),mV=N(102,e=>pV(e,[e.bj.filter(e.c3),`id`])),hV=M(81,e=>{BH(e,e.bj.length),aV(e,e.bj.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.worktree}/${t.path}`})))),oV(e,[e.bj.filter(e=>e.baseMissing),`id`]),sV(e,[e.bj.filter(e=>e.contained&&e.files.length),`id`]),cV(e,[e.bj,`id`]),eV(e),fV(e),ZB(e),mV(e),jI(e)}),gV=M(96,dz),_V=e=>{gV(e,new Map(e.bj.map(t=>[t.id,e.bm.filter(e=>e.repo===t.id)])))},vV=M(114),yV=N(112,e=>vV(e,dU(e)),2),bV=M(115),xV=N(113,e=>bV(e,fU(e)),3),SV=O(25,`<div class=diff-skel><p class=dim><span class=spin></span>Loading diff…</p><div class=skel-row></div><div class=skel-row></div><div class=skel-row></div></div>`),CV=N(50,e=>SV(e,!e.ae&&e.an?0:1)),wV=O(26,`<p class="dim center-pad"> </p>`,`D `,MI,`<p class="dim center-pad"> </p>`,`D `,NL),TV=N(94,e=>wV(e,e.ae&&!e.bn?0:e.ae&&!e.bv&&!e.b3?1:2),3),EV=j(40,e=>{hV(e,e.ae||[]),_V(e),yV(e),xV(e),CV(e),TV(e)}),DV=M(99,F(Wz,jR,cR)),OV=M(110,F(JL)),kV=M(109,F(qL)),AV=N(47,e=>kV(e,mU(e)),2),jV=j(41,e=>{wH(e,e.af?.length),DV(e,(()=>{let t=new Map;for(let n of e.af){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),OV(e,pU(e)),AV(e),yV(e),xV(e)}),MV=M(108,F(MR)),NV=N(44,e=>MV(e,hU(e))),PV=F(zz,CR,rR),FV=j(43,e=>{TH(e,e.ah?.size),NV(e),PV(e)}),IV=F(WL),LV=j(46,e=>{AV(e),IV(e)}),RV=O(20,`<p class=toast-error><!> <button>×</button></p>`,`D%c `,HL),zV=j(48,e=>{RV(e,+!e.am),BL(e)}),BV=O(7,`<span class="refresh-chip dim"><span class=spin></span>Refreshing…</span>`),VV=j(49,e=>{B(e.k,`spinning`,e.an),z(e.k,`disabled`,e.an),BV(e,+!e.an),CV(e),FL(e)}),HV=j(51,KB),UV=j(52,F(VB,PB)),WV=M(100),GV=N(54,e=>WV(e,(e.a8||[]).some(t=>t.id===e.ar)?e.ar:e.a8?.[0]?.id??null)),KV=F(FB),qV=j(53,e=>{GV(e),KV(e)}),JV=M(86,iV),YV=j(55,e=>{lv(e.r,e.at),JV(e,I_(e.at)),ML(e)}),XV=N(80,L(`e45`,e=>Tt(e,{active:e.a7,load:e.bf,onMount:function(){let t=new AbortController,n={abort:t,loaded:!1,lastPr:e.a5||``,start:()=>{this.active&&!n.loaded&&(n.loaded=!0,this.load())}};return Tn().addEventListener(`review.changed`,t=>{n.loaded&&t.data?.workspaceId===e.a6&&e.bh()},{signal:t.signal}),window.addEventListener(`keydown`,t=>{this.active&&(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||t.target?.closest?.(`.palette`)||(t.preventDefault(),oH(e,!0),cH(e,e.az+1))))},{capture:!0,signal:t.signal}),n.start(),n},onUpdate:function(){this.start();let t=e.a5||``;this.loaded&&t!==this.lastPr&&(this.lastPr=t,this.load())},onDestroy:function(){this.abort.abort()}})),5),ZV=M(107),QV=N(78,e=>ZV(e,gU(e))),$V=M(77,e=>{XV(e),QV(e)}),eH=N(57,e=>$V(e,_U(e)),2),tH=j(56,e=>{At(e,`q`,e.au),eH(e),QV(e),EL(e),bL(e),dL(e)}),nH=j(58,e=>{B(e.a,`closed`,!e.aw),B(e.i,`on`,e.aw),z(e.i,`title`,e.aw?`Hide file tree`:`Show file tree`)}),rH=O(28,`<div class=sheet-backdrop></div><div class=file-sheet role=dialog aria-label="Jump to file"><div class=sheet-head><strong>Files</strong><span class=dim><!>/<!> viewed</span><button class=icon-btn title=Close>×</button></div><div class=sheet-list></div></div>`,` bEbD%c%l l `,mR),iH=j(59,e=>rH(e,+!e.ax)),aH=O(18,Vv,(e=>`/${e}&`)(Hv),cL),oH=j(60,e=>{B(e.o,`on`,e.ay),aH(e,+!e.ay)}),sH=M(117),cH=j(61,e=>{sH(e,vU(e)),XV(e),sL(e)}),lH=M(89,nV),uH=e=>{lH(e,e.b1.trim()?new Set(e.b2):null)},dH=j(62,e=>{EH(e,e.b0?.query),DH(e,e.b0?.keys),OH(e,e.b0?.hit),uH(e)}),fH=j(68,F(dB,eL)),pH=M(71),mH=F(ez,FI),hH=j(69,e=>{pH(e,yU(e)),SB(e),mH(e)}),gH=j(70,e=>{fV(e),uV(e)}),_H=(e,t)=>{NH(e,t.cbs),PH(e,t.io)},vH=M(101,mV),yH=M(118),bH=M(116,e=>yH(e,xU(e))),xH=L(`e44`,e=>{A(e.i,`click`,function(){nH(e,!e.aw),Yn(e.aw)}),A(e.k,`click`,function(){e.c9()}),A(e.m,`click`,function(){iH(e,!0)}),A(e.o,`click`,function(){e.cj()}),A(e.q,`change`,function(t){tH(e,t.target.checked),Zn(e.au),e.bf(e.au)})});function SH(e){Qm(e.j),$m(e.j,14),eh(e.j),fo(e.l),po(e.l,14),mo(e.l),$_(e.p),ev(e.p,14),tv(e.p),mv(e.r),hv(e.r,CU(e)),EV(e,null),jV(e,[]),FV(e,new Set),LV(e,null),zV(e,null),VV(e,!1),HV(e,!1),UV(e,!1),qV(e,null),YV(e,``),tH(e,Xn()),nH(e,Jn()),iH(e,!1),oH(e,!1),cH(e,0),dH(e,{query:``,hit:null,keys:[]}),fH(e,new Set),hH(e,new Set),gH(e,new Set),_H(e,{io:null,cbs:null}),vH(e,bU),bH(e,SU(e)),xH(e)}var CH=O(6,`<button class=btn title="Copy comments as markdown"> </button><!><!>`,` D l%`,GB),wH=M(42,e=>{V(e.f,e.ag?`· ${ft(e.ag)} comment${ft(e.ag===1?``:`s`)}`:``),CH(e,+!e.ag)}),TH=M(45,e=>{V(e.e,e.aj?` · ${ft(e.aj)} viewed`:``),fR(e)}),EH=M(63,PL),DH=M(64),OH=M(65,e=>{kH(e,e.b3?.key),AH(e,e.b3?.repo),TV(e)}),kH=M(66,nV),AH=M(67,F(XR)),jH=M(76),MH=N(75,e=>jH(e,wU(e))),NH=M(73,MH),PH=M(74,MH),FH=M(31,e=>{eH(e),XV(e)}),IH=M(79,XV),LH=M(111,e=>{yV(e),xV(e)}),RH=M(32,e=>{IH(e,TU(e)),LH(e,EU(e)),eH(e),XV(e),NV(e),AV(e)}),zH=M(33,XV),BH=M(83,F(nz)),VH=M(85,e=>{V(e.c,e.bn),V(e.d,e.bn===1?``:`s`),TV(e),hR(e)}),HH=M(93,e=>{V(e.n,e.bv),TV(e)}),UH=F(jB),WH=M(34,e=>{XH(e,e.a8?.[0]?.title),ZH(e,e.a8?.[0]?.agent),GV(e),UB(e),UH(e)}),GH=O(23,`<p class=toast-error><!><button class=btn> </button><button title=Dismiss>×</button></p>`,`D%b D l `,LL),KH=(e,t)=>GH(e,+!t),qH=M(36,xV),JH=O(1,(e=>`<button class=icon-btn title="Back to terminal">${e}</button>`)(K_),(e=>` D/${e}&l`)(q_),JB),YH=M(37,e=>JH(e,+!e.ab)),XH=M(38,F(LB)),ZH=M(39,F(BB));function QH(e){return function(){oH(e._,!1),dH(e._,{query:``,hit:null,keys:[]})}}function $H(e){return function(t){e._.ck(t)}}function eU(e){return function(t){zV(e._._._._._._,t)}}function tU(e){return function(){LV(e._._._._._._,null)}}function nU(e){return function(t){e._._._._._._.cb(e._._.k,t)}}function rU(e){return function(t){e._._._._._._.cc(t)}}function iU(e){return function(t){LV(e._._._._._._,{key:e._._.l,side:t.side||`additions`,start:Math.min(t.start,t.end),end:Math.max(t.start,t.end)})}}function aU(e){return function(){e._._._._.ca(e.l)}}function oU(e){return t=>{let n=e.d(t);for(let r of e._._.b6){let[i,a]=[r.slice(0,r.indexOf(`/`)),r.slice(r.indexOf(`/`)+1)];if(i===e._.g&&(t.kind!==`dir`||t.path!==a)&&(n===a||n.startsWith(`${a}/`)))return!0}return!1}}function sU(e){return e.kind===`dir`?e.path:e.file.path.includes(`/`)?e.file.path.slice(0,e.file.path.lastIndexOf(`/`)):``}function cU(e){return t=>`${e._.g}/${t}`}function lU(e){return t=>{qV(e._._,t)}}function uU(e){return()=>{gH(e,new Set([...e.b8,...e.c5.map(e=>e.id)]))}}function dU(e){return async()=>{if(!await N_(z_(e.af,e.ae))){zV(e,`Copy failed — clipboard needs HTTPS on this browser.`);return}HV(e,!0),setTimeout(()=>{HV(e,!1)},1500),await e.cd()}}function fU(e){return async t=>{if(t){UV(e,!0);try{await H(`/api/sessions/${t}/send`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:`Please address this review feedback, then summarize what you changed.\n\n${z_(e.af,e.ae)}`,...F_()||{}})}),UV(e,!1),await e.cd(),e.aa?.(t)}catch(t){zV(e,String(t.message||t)),UV(e,!1)}}}}function pU(e){return async t=>{jV(e,e.af.filter(e=>e.id!==t)),await fetch(`/api/review-comments/${t}`,{method:`DELETE`})}}function mU(e){return async(t,n)=>{let r=e.ak;LV(e,null);try{let i=await H(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:t.repo,path:t.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim()})});jV(e,e.af.concat(i))}catch(t){zV(e,String(t.message||t))}}}function hU(e){return t=>{let n=new Set(e.ah),r=!n.has(t);r?n.add(t):n.delete(t),FV(e,n),fetch(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`viewed`,key:t,viewed:r})}).catch(()=>{zV(e,`Saving viewed state failed — it may reset on reload.`)})}}function gU(e){return()=>(gH(e,new Set),e.bf(e.au,!0))}function _U(e){return async(t=e.au,n=!1)=>{VV(e,!0),zV(e,null);try{let r=new URLSearchParams;t&&r.set(`uncommitted`,`1`),e.a5&&r.set(`pr`,e.a5),n&&r.set(`refresh`,`1`);let i=r.size?`?${r}`:``,[a,o]=await Promise.all([H(`/api/workspaces/${e.a6}/diff${i}`),H(`/api/workspaces/${e.a6}/review`)]);EV(e,a),jV(e,o.comments||[]),FV(e,new Set(o.viewed||[]))}catch(t){zV(e,String(t.message||t))}VV(e,!1)}}function vU(e){return()=>{oH(e,!0),cH(e,e.az+1)}}function yU(e){return t=>{let n=new Set(e.b7);n.delete(t)||n.add(t),hH(e,n)}}function bU(e){return!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)}function xU(e){return t=>{dH(e,t),t.hit&&setTimeout(()=>e.ci(t.hit.key),0)}}function SU(e){return t=>{let n=e.t.querySelector(`details[data-key="${CSS.escape(t)}"]`);n&&(n.open=!0,n.scrollIntoView({block:`start`}))}}function CU(e){return function(t){YV(e,t)}}function wU(e){return(t,n)=>{e.bb??=new WeakMap,e.bc??=new IntersectionObserver(t=>{for(let n of t)n.isIntersecting&&(e.bc.unobserve(n.target),e.bb.get(n.target)?.())},{rootMargin:`600px 0px`}),e.bb.set(t,n),e.bc.observe(t)}}function TU(e){return async()=>{try{let t=await H(`/api/workspaces/${e.a6}/review`);jV(e,t.comments||[]),FV(e,new Set(t.viewed||[]))}catch{}}}function EU(e){return async()=>{jV(e,[]),LV(e,null),await fetch(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})})}}R(`e23`,QH),R(`e22`,$H),R(`e28`,eU),R(`e26`,tU),R(`e25`,nU),R(`e27`,rU),R(`e24`,iU),R(`e1`,aU),R(`e20`,oU),R(`e19`,sU),R(`e18`,cU),R(`e0`,lU),R(`e7`,uU),R(`e13`,dU),R(`e14`,fU),R(`e11`,pU),R(`e10`,mU),R(`e9`,hU),R(`e8`,gU),R(`e4`,_U),R(`e16`,vU),R(`e2`,yU),R(`e6`,bU),R(`e17`,xU),R(`e15`,SU),R(`e21`,CU),R(`e3`,wU),R(`e5`,TU),R(`e12`,EU);var DU=Object.defineProperty,OU=Object.getOwnPropertyDescriptor,kU=(e,t)=>{for(var n in t)DU(e,n,{get:t[n],enumerable:!0})},AU=(e,t,n,r)=>{for(var i=r>1?void 0:r?OU(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&DU(t,n,i),i},J=(e,t)=>(n,r)=>t(n,r,e),jU=`Terminal input`,MU={get:()=>jU,set:e=>jU=e},NU=`Too much output to announce, navigate to rows manually to read`,PU={get:()=>NU,set:e=>NU=e};function FU(e){return e.replace(/\r?\n/g,`\r`)}function IU(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function LU(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function RU(e,t,n,r){e.stopPropagation(),e.clipboardData&&zU(e.clipboardData.getData(`text/plain`),t,n,r)}function zU(e,t,n,r){e=FU(e),e=IU(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function BU(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function VU(e,t,n,r,i){BU(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function HU(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function UU(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var WU=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},GU=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},KU=``,qU=` `,JU=class e{constructor(){this.fg=0,this.bg=0,this.extended=new YU}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},YU=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},XU=class e extends JU{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new YU,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?HU(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ZU=`di$target`,QU=`di$dependencies`,$U=new Map;function eW(e){return e[QU]||[]}function tW(e){if($U.has(e))return $U.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);nW(t,e,r)};return t._id=e,$U.set(e,t),t}function nW(e,t,n){t[ZU]===t?t[QU].push({id:e,index:n}):(t[QU]=[{id:e,index:n}],t[ZU]=t)}var rW=tW(`BufferService`),iW=tW(`CoreMouseService`),aW=tW(`CoreService`),oW=tW(`CharsetService`),sW=tW(`InstantiationService`),cW=tW(`LogService`),lW=tW(`OptionsService`),uW=tW(`OscLinkService`),dW=tW(`UnicodeService`),fW=tW(`DecorationService`),pW=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new XU,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):mW(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};pW=AU([J(0,rW),J(1,lW),J(2,uW)],pW);function mW(e,t){if(confirm(`Do you want to navigate to ${t}?
1532
+ `}function XP(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function ZP(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function QP(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function $P(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 eF(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function tF({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 nF(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:qM(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 rF(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var iF=-1,aF=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++iF}`;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;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:Dy},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new IC,this.scrollSyncManager=new dN,this.interactionManager=new gC(`diff`,_C(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()};getHunksRendererOptions(e){return nF(e)}createHunksRenderer(e){return new FP(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=Zy(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`){if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}c+=n.lines,l+=n.lines,u+=n.lines}else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(_C(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&&!Vy(this.appliedThemeCSS.theme,this.options.theme??Dy)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}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.lineAnnotations.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){zy(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(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,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.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),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.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=tF(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),lF(this.pre,sF({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||uF(this.headerElement,cF({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),WM(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?$b(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(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;e==null||t==null||!rF(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}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)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(nN(`merge`,e,t),this.setHydratedState(t),await eF(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}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}){let l=tF(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),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=_&&(!oF(u,this.deletionFile)||!oF(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)&&i!==this.lineAnnotations;if(!f&&Fj(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=$b(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(_P(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:ee=!1}=this.options;if(ee&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,Fy);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),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.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}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)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||yN(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return kN({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}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=hP(e,this.hunksRenderer.getExpandedHunksMap(),t);return _P(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(gP(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!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))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return DN({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return ON({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{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]=SN(o);if(e<s){let c=CN({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=EN({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]=SN(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(){Ry(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.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||NP(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.lastRenderedHeaderHTML=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||!$P(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;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${qj(r)}`,a=this.annotationCache.get(i);if(a==null||!QP(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:AM(qj(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}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=jM();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.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:KM(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):KM(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=EM;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){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??pC(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||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Ey,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Cy,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,wy,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Ty,u),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}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??=MM(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=zM(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??Dy,s=typeof o==`string`?o:{...o},c=FM(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=YM({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:BM(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=VM(this.themeCSSStyle.textContent??``,FM(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&QM()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?JM(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=dF(t[0]),a=dF(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=pC(i),r.content.innerHTML=pC(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=UM({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=UM({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=UM({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({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!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(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=dF(r?.[0]),a=dF(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)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=dF(n?.[0]),i=dF(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=pC(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?JM(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=dF(t[0]),i=dF(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};DM(u,this.appliedPreAttributes)||(GM(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 oF(e,t){return e==null||t==null?e==null&&t==null:tx(e,t)}function sF({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function cF({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function lF(e,t,n=!1){return!n&&e==null&&t}function uF(e,t,n=!1){return e==null&&t&&!n}function dF(e){if(e!=null&&e.type===`element`)return e.children??[]}function fF(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`.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 pF=`<div class=diff-file></div>`,mF=`background:var(--panel);border-block:1px solid var(--border);padding:.5rem .75rem;font-family:system-ui,sans-serif;font-size:.85rem;display:flex;flex-direction:column;gap:.35rem;`,hF=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;`,gF=new CSSStyleSheet;gF.replaceSync(`:host { display: block; max-width: 100%; overflow-x: auto; } @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } [data-column-number], [data-gutter-utility-slot] { touch-action: none !important; } }`+Hv);var _F=at(`c0`,0),vF=N(11,L(`c1`,e=>Et(e,{file:e.d,comments:e.e,draft:e.f,onMount:function(){let t=t=>{if(!t)return;let n=document.createElement(`div`);n.style.cssText=mF;let r=document.createElement(`p`);r.textContent=t.text,r.style.cssText=`margin:0;white-space:pre-wrap;`;let i=document.createElement(`button`);return i.textContent=`remove`,i.style.cssText=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;align-self:flex-start;font-size:.75rem;opacity:.7;`,i.onclick=()=>e.g?.(t.id),n.append(r,i),n},n=()=>{let t=document.createElement(`div`);t.style.cssText=mF;let n=document.createElement(`textarea`);n.placeholder=`Leave a comment…`,n.rows=3,n.style.cssText=`font:inherit;width:100%;resize:vertical;border:1px solid var(--border);border-radius:var(--radius);padding:.4rem .5rem;background:inherit;color:inherit;`+(sr()?`font-size:16px;`:``);let r=document.createElement(`button`);r.textContent=`Comment`,r.style.cssText=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;background:var(--accent);color:light-dark(#fff,#10131f);border-color:transparent;`;let i=document.createElement(`button`);i.textContent=`Cancel`,i.style.cssText=hF,r.onclick=()=>{n.value.trim()&&e.h?.(n.value)},i.onclick=()=>e.i?.(),n.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&r.onclick(),e.key===`Escape`&&i.onclick()};let a=document.createElement(`div`);a.style.cssText=`display:flex;gap:.4rem;`,a.append(r,i),t.append(n,a);let o=()=>n.scrollIntoView({block:`center`,behavior:`smooth`});return n.addEventListener(`focus`,()=>{let e=window.visualViewport;e&&(e.addEventListener(`resize`,o),n.addEventListener(`blur`,()=>e.removeEventListener(`resize`,o),{once:!0}))}),setTimeout(()=>{n.scrollIntoView({block:`center`,behavior:`instant`}),n.focus()},0),t},r=new Map,i,a={draft:!0},o,s=new aF({diffStyle:cr()?`unified`:`split`,disableFileHeader:!0,enableLineSelection:!0,onLineSelectionEnd(t){if(!t)return;let n=t.endSide!=null&&t.endSide!==t.side;e.j?.({side:t.side,start:t.start,end:n?t.start:t.end})},renderAnnotation(e){let r=e.metadata||{};return r.draft?o??=n():t(r.comment)}}),c=()=>{let t=[],n=new Map;for(let i of e.e||[]){let e=r.get(i.id)||{comment:i};n.set(i.id,e),t.push({side:i.side,lineNumber:i.line_end,metadata:e})}return r=n,e.f&&(i!==e.f&&(i=e.f,a={draft:!0},o=void 0),t.push({side:e.f.side,lineNumber:e.f.end,metadata:a})),t},l=()=>{let t=e.a.querySelector(`diffs-container`)?.shadowRoot;t&&!t.adoptedStyleSheets.includes(gF)&&(t.adoptedStyleSheets=[...t.adoptedStyleSheets,gF])},u=()=>{if(e.d.old==null&&e.d.new==null){e.k?.(`could not read ${e.d.path}`);return}let t=s.render({containerWrapper:e.a,oldFile:e.d.old==null?null:{name:e.d.oldPath||e.d.path,contents:e.d.old},newFile:e.d.new==null?null:{name:e.d.path,contents:e.d.new},lineAnnotations:c()});Promise.resolve(t).then(()=>{l(),Yv(e.a)}).catch(t=>e.k?.(`diff render: ${t}`))};u();let d=new AbortController;return sr()&&fF(_F(e),d.signal),{instance:s,render:u,dragAbort:d,unregSearch:Jv(e.a,e.d.key),shownFile:e.d,shownComments:e.e,shownDraft:e.f}},onUpdate:function(){(this.file!==this.shownFile||this.comments!==this.shownComments||this.draft!==this.shownDraft)&&(this.shownFile=this.file,this.shownComments=this.comments,this.shownDraft=this.draft,this.render())},onDestroy:function(){this.unregSearch(),this.dragAbort.abort(),this.instance.cleanUp?.()}})),7),yF=M(3,vF),bF=M(4,vF),xF=M(5,vF),SF=M(6,vF),CF=M(7,vF),wF=M(8,vF),TF=M(9,vF),EF=M(10,vF),DF=((e,t,n,r)=>`<div class=diff-view><aside class=tree></aside><div class=diff-col><div class=diff-head><!><span class="dim diff-stats"><!> file<!> changed <!><!></span><span class=head-actions></span><!></div><div class=diff-tools><button class="icon-btn tree-toggle">${e}</button><button class=icon-btn title="Refresh diff">${t}</button><button class="btn files-btn" title="Jump to file">Files (<!>)</button><button class="btn find-btn" title="Find in the review (⌘/Ctrl+F)">${n}<span class=find-label>Find</span></button><label class=two-dot title="Include uncommitted and untracked files in the review. Off by default — the review is commit-to-commit."><input type=checkbox> include uncommitted</label>${r}</div><!><div class=diff-main><!><!><!><!><!><!><!><!></div></div><!></div>`)(Km,bo,pv,vv),OF=((e,t,n,r)=>`D bE%bD%c%c%b%l b%lD D/${e}&l D/${t}&l Db%l D/${n}&lD l/${r}&l%b D%b%b%b%b%b%b%b%m%l`)(qm,xo,mv,`D l`),kF=P(5,0,e=>V(e.a,e._.x)),AF=kF,jF=N(2,e=>z(e.a,`title`,`checked out ${e._._._.q} ${e._._._.r}`)),MF=I(34,e=>{V(e.b,e._._._.q),jF(e)},e=>e._._._),NF=e=>{MF(e),PF(e)},PF=I(35,jF,e=>e._._._),FF=I(26,e=>V(e.b,e._._._.i),e=>e._._._),IF=e=>{FF(e),LF(e),zF(e),BF(e),VF(e),HF(e),UF(e)},LF=I(27,e=>z(e.a,`href`,`${e._._._.j}/files`),e=>e._._._),RF=N(3,e=>z(e.a,`title`,`${e._._._.k} — ${e._._._.l} ${e._._._.m} vs ${e._._._.n} ${e._._._.o}`),4),zF=I(28,e=>{V(e.c,e._._._.k),RF(e)},e=>e._._._),BF=I(29,RF,e=>e._._._),VF=I(30,RF,e=>e._._._),HF=I(31,RF,e=>e._._._),UF=I(32,RF,e=>e._._._),WF=N(2,e=>z(e.a,`title`,`checked out ${e._._._.q} ${e._._._.r}`)),GF=I(34,e=>{V(e.b,e._._._.q),WF(e)},e=>e._._._),KF=e=>{GF(e),qF(e)},qF=I(35,WF,e=>e._._._),JF=I(33,e=>V(e.a,e._._._.p),e=>e._._._),YF=JF,XF=I(26,e=>V(e.b,e._._._.i),e=>e._._._),ZF=L(`e38`,e=>A(e.a,`click`,function(e){e.stopPropagation()})),QF=e=>{XF(e),$F(e),tI(e),nI(e),rI(e),iI(e),aI(e),ZF(e)},$F=I(27,e=>z(e.a,`href`,`${e._._._.j}/files`),e=>e._._._),eI=N(3,e=>z(e.a,`title`,`${e._._._.k} — ${e._._._.l} ${e._._._.m} vs ${e._._._.n} ${e._._._.o}`),4),tI=I(28,e=>{V(e.c,e._._._.k),eI(e)},e=>e._._._),nI=I(29,eI,e=>e._._._),rI=I(30,eI,e=>e._._._),iI=I(31,eI,e=>e._._._),aI=I(32,eI,e=>e._._._),oI=(e,t)=>V(e.a,t),sI=(e,t)=>V(e.b,t),cI=(e,t)=>V(e.c,t),lI=(e,t)=>V(e.d,rv(t)),uI=(e,t)=>V(e.e,rv(t)),dI=(e,t)=>{oI(e,t[0]?.worktree),sI(e,t[0]?.pr?.number),cI(e,t[0]?.pr?.headRefName),uI(e,t[0]?.pr?.headRefOid),lI(e,t[0]?.head)},fI=(e,t)=>z(e.a,`value`,t),pI=N(7,e=>V(e.b,e.f||e.g)),mI=M(5,pI),hI=M(6,pI),gI=(e,t)=>{fI(e,t[0]?.id),mI(e,t[0]?.title),hI(e,t[0]?.agent)},_I=O(5,`<span class=chip>local <!></span>`,` Db%`,NF),vI=N(6,e=>_I(e,+!e._._._.c3(e._._.c))),yI=I(147,vI,e=>e._._._),bI=e=>{yI(e),xI(e),TI(e),EI(e),OI(e),kI(e),AI(e)},xI=I(22,vI,e=>e._._),SI=O(0,`<a class="chip pr" target=_blank rel=noopener>#<!></a><span class=dim> </span>`,` Db%lD `,IF),CI=N(9,e=>z(e.b,`title`,`${e._._.g?`PR head`:`checked out`} ${e._._.g?e._._.g.headRefName:e._._.q} ${e._._.m}`),2),wI=N(7,e=>V(e.c,e._._.g?e._._.g.headRefName:e._._.q)),TI=I(24,e=>{SI(e,+!e._._.g),CI(e),wI(e)},e=>e._._),EI=I(30,CI,e=>e._._),DI=N(8,e=>z(e.d,`title`,`${e._._.n} ${e._._.o}`)),OI=I(31,e=>{V(e.e,e._._.n),DI(e)},e=>e._._),kI=I(32,DI,e=>e._._),AI=I(34,e=>{CI(e),wI(e)},e=>e._._),jI=P(26,0,e=>V(e.a,e._.bj.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`)),MI=jI,NI=I(137,L(`e40`,e=>Et(e,{onMount:function(){e._._._._._._.be(e.a,()=>{$L(e._,!0)})}})),e=>e._._._._._._),PI=N(9,e=>{B(e.a,`closed`,e._._._.b7.has(e._._.d)),V(e.b,e._._._.b7.has(e._._.d)?`▸`:`▾`)}),FI=I(136,PI,e=>e._._._),II=L(`e39`,e=>A(e.a,`click`,function(){e._._._.b9(e._._.d)})),LI=e=>{FI(e),BI(e),VI(e),HI(e),KI(e),qI(e),JI(e),XI(e),ZI(e),QI(e),II(e)},RI=O(8,`<span class=chip>local <!></span>`,` Db%`,KF),zI=N(10,e=>RI(e,+!e._._._.c3(e._._.c))),BI=I(147,zI,e=>e._._._),VI=I(22,zI,e=>e._._),HI=I(23,PI,e=>e._._),UI=O(3,`<a class="chip pr" target=_blank rel=noopener>#<!></a><span class=dim> </span>`,` Db%lD `,QF,`<span class=dim> </span>`,`D `,YF),WI=N(13,e=>z(e.e,`title`,`${e._._.g?`PR head`:`checked out`} ${e._._.g?e._._.g.headRefName:e._._.q} ${e._._.m}`),2),GI=N(11,e=>V(e.f,e._._.g?e._._.g.headRefName:e._._.q)),KI=I(24,e=>{UI(e,+!e._._.g),WI(e),GI(e)},e=>e._._),qI=I(25,e=>V(e.c,e._._.h),e=>e._._),JI=I(30,WI,e=>e._._),YI=N(12,e=>z(e.g,`title`,`${e._._.n} ${e._._.o}`)),XI=I(31,e=>{V(e.h,e._._.n),YI(e)},e=>e._._),ZI=I(32,YI,e=>e._._),QI=I(34,e=>{WI(e),GI(e)},e=>e._._),$I=N(3,e=>{B(e.a,`closed`,e._._._._.b6.has(e._._.c(e._.e))),V(e.b,e._._._._.b6.has(e._._.c(e._.e))?`▸`:`▾`)},2),eL=I(135,$I,e=>e._._._._),tL=L(`e29`,e=>A(e.a,`click`,function(){let t=new Set(e._._._._.b6);t.delete(e._._.c(e._.e))||t.add(e._._.c(e._.e)),fH(e._._._._,t)})),nL=e=>{eL(e),rL(e),iL._(e),aL._(e),oL._(e),tL(e)},rL=I(7,$I,e=>e._._),iL=P(0,0,e=>{z(e.a,`title`,e._.e),$I(e)}),aL=P(0,0,e=>_t(e.a,`padding-left:${.35+e._.f*.75}rem`)),oL=P(0,0,e=>V(e.c,e._.g)),sL=P(18,0,e=>Gee(e.a,e._.az)),cL=e=>{sL._(e),lL._(e),uL._(e),Ree(e.a),Wee(e.a,QH(e))},lL=P(18,0,e=>Bee(e.a,e._.bq)),uL=P(18,0,e=>Uee(e.a,$H(e))),dL=Ke(24,e=>V(e.g,e._.au?`, plus uncommitted`:``)),fL=dL,pL=(e,t)=>V(e.a,t),mL=(e,t)=>V(e.b,t),hL=(e,t)=>V(e.c,rv(t)),gL=(e,t)=>V(e.d,t),_L=(e,t)=>V(e.e,rv(t)),vL=(e,t)=>V(e.f,t),yL=(e,t)=>{pL(e,t[0]?.worktree),mL(e,t[0]?.pr?.number),gL(e,t[0]?.pr?.headRefName),hL(e,t[0]?.head),_L(e,t[0]?.localHead),vL(e,t[0]?.branch)},bL=Ke(22,e=>V(e.d,e._.au?` — showing uncommitted changes only`:``)),xL=bL,SL=(e,t)=>V(e.a,t),CL=(e,t)=>V(e.b,t?` #${t?.number}`:``),wL=(e,t)=>V(e.c,t),TL=(e,t)=>{SL(e,t[0]?.worktree),CL(e,t[0]?.pr),wL(e,t[0]?.base)},EL=Ke(21,e=>V(e.c,e._.au?` — showing uncommitted changes only`:``)),DL=EL,OL=(e,t)=>V(e.a,t),kL=(e,t)=>V(e.b,t),AL=(e,t)=>{OL(e,t[0]?.worktree),kL(e,t[0]?.base)},jL=N(1,e=>V(e.a,e._.b1.trim()?`No matches in diffs.`:`No files match "${e._.at}".`)),ML=P(26,1,jL),NL=e=>{ML._(e),PL._(e)},PL=P(26,1,jL),FL=P(23,0,e=>{z(e.b,`disabled`,e._.an),V(e.c,e._.an?`Reloading…`:`Reload`)}),IL=L(`e37`,e=>{A(e.b,`click`,function(){e._.c9()}),A(e.d,`click`,function(){e._.c8()})}),LL=e=>{FL._(e),zL._(e),IL(e)},RL=k(0,`<!> #<!>: origin/<!> is <!>, GitHub last saw <!>.`,`%c%c%c%c%`,0,dI),zL=P(23,0,e=>RL(e,[e._.c5,`id`])),BL=P(20,0,e=>V(e.a,e._.am)),VL=L(`e36`,e=>A(e.b,`click`,function(){zV(e._,null)})),HL=e=>{BL._(e),VL(e)},UL=N(1,e=>xF(e.a,e._._._._._._.ak&&e._._._._._._.ak?.key===e._._.l?e._._._._._._.ak:null)),WL=I(124,UL,e=>e._._._._._._),GL=e=>{WL(e),qL(e),JL(e),YL(e),XL(e),ZL(e),e.a,wF(e.a,tU(e)),EF(e.a,eU(e))},KL=N(2,e=>CF(e.a,nU(e))),qL=I(150,KL,e=>e._._._._._._),JL=I(151,e=>SF(e.a,rU(e)),e=>e._._._._._._),YL=I(26,e=>{yF(e.a,e._._.k),KL(e)},e=>e._._),XL=I(27,e=>{TF(e.a,iU(e)),UL(e)},e=>e._._),ZL=I(28,e=>bF(e.a,e._._.w),e=>e._._),QL=O(0,`<div class=diff-wait></div>`,` `,NI,pF,(e=>`/${e}&`)(` b`),GL),$L=j(1,e=>QL(e,+!!e.b)),eR=e=>$L(e,!1),tR=O(6,`<span class=dim>✓</span>`),nR=N(10,e=>{B(e.a,`seen`,e._._.ah.has(e.j)),tR(e,+!e._._.ah.has(e.j))}),rR=I(122,nR,e=>e._._),iR=L(`e42`,e=>A(e.a,`click`,function(){iH(e._._,!1),e._._.ci(e.j)})),aR=e=>{rR(e),cR(e),iR(e)},oR=O(5,`<span>💬</span>`),sR=N(11,e=>oR(e,+!e._._.c1.has(e.j))),cR=I(146,sR,e=>e._._),lR=M(9,e=>{z(e.d,`title`,e.j),V(e.e,e.j),nR(e),sR(e)}),uR=(e,t)=>{ht(e.b,[`status`,t]),V(e.c,t)},dR=(e,t)=>{lR(e,t[0]?.key),uR(e,t[0]?.status)},fR=P(28,0,e=>V(e.b,e._.aj)),pR=L(`e43`,e=>{A(e.a,`click`,function(){iH(e._,!1)}),A(e.d,`click`,function(){iH(e._,!1)})}),mR=e=>{fR._(e),hR._(e),_R._(e),pR(e)},hR=P(28,0,e=>V(e.c,e._.bn)),gR=k(4,`<button class="sheet-file mono"><span> </span><span class=sheet-path><bdi> </bdi></span><!><!></button>`,` D D l E m%b%`,aR,dR),_R=P(28,0,e=>gR(e,[e._.bt,`key`])),vR=O(8,`<p class="dim diff-pad">binary file</p>`,0,0,`<p class="dim diff-pad">file too large to display</p>`,0,0,`<p class="dim diff-pad">file could not be read</p>`,0,0,`<!><!><!>`,`b%`,eR),yR=N(25,e=>vR(e,e.s?0:e.t?1:e.u==null&&e.v==null?2:e.y?3:4),4),bR=j(24,e=>{Ut(e,`a`,e.y),yR(e)}),xR=N(12,e=>bR(e,!e._._._._.ah.has(e.l))),SR=N(15,e=>Mt(e,`h`,e._._._._.ah.has(e.l),aU(e)),2),CR=I(122,e=>{xR(e),SR(e)},e=>e._._._._),wR=L(`e41`,e=>{A(e.a,`toggle`,function(t,n){if(bR(e,n.open),!n.open){let e=n.closest(`.diff-main`);if(e){let t=n.getBoundingClientRect().top-e.getBoundingClientRect().top;t<0&&(e.scrollTop+=t)}}}),A(e.g,`click`,function(e){e.stopPropagation()}),Nt(e,`h`)}),TR=e=>{CR(e),DR(e),jR(e),MR(e),wR(e)},ER=N(13,e=>z(e.a,`hidden`,!e._._._._.bx.has(e.l))),DR=I(143,ER,e=>e._._._._),OR=F(ZL),kR=M(22,e=>{PR(e,e.w.length),OR(e)}),AR=N(14,e=>kR(e,e._._._._.c1.get(e.l)||[])),jR=I(146,AR,e=>e._._._._),MR=I(149,SR,e=>e._._._._),NR=O(5,`<span class=chip>💬 <!></span>`,`Db%`,AF),PR=M(23,e=>{NR(e,+!e.x),kF(e)}),FR=F(XL),IR=M(11,e=>{z(e.a,`data-key`,e.l),AR(e),xR(e),ER(e),SR(e),FR(e)}),LR=(e,t)=>{ht(e.b,[`status`,t]),V(e.c,t)},RR=(e,t)=>{z(e.d,`title`,t),V(e.e,t)},zR=M(18,yR),BR=M(19,yR),VR=M(20,yR),HR=M(21,yR),UR=(e,t)=>GR(e,t[0]),WR=F(YL),GR=M(10,e=>{IR(e,e.k?.key),LR(e,e.k?.status),RR(e,e.k?.path),zR(e,e.k?.binary),BR(e,e.k?.tooLarge),VR(e,e.k?.old),HR(e,e.k?.new),WR(e)}),KR=k(0,`<details class=file><summary><span> </span><span class=path><bdi> </bdi></span><!><label class=viewed><input type=checkbox><span class=dim>viewed</span></label></summary><!></details>`,` E D l E m%b D m%`,TR,UR),qR=I(36,e=>KR(e,[e._._.s,`key`]),e=>e._._),JR=qR,YR=N(4,e=>z(e.a,`hidden`,!e._.v&&e._._.b5!==e._.d),2),XR=I(134,YR,e=>e._._),ZR=e=>{XR(e),ez(e),nz(e),rz._(e),az._(e),oz._(e),sz._(e)},QR=O(2,`<div class=files></div>`,` `,JR),$R=N(5,e=>QR(e,e._._.bl>1&&e._._.b7.has(e._.d)?1:0),2),ez=I(136,$R,e=>e._._),tz=O(1,`<button class=repo-sep><span class=tree-chev> </span><span class=mono> </span><!><span class="chip lane">on <!></span><span class=chip>vs <!></span><!></button>`,` E lD l%b Db%l Db%l%`,LI,`<p class=repo-meta><!><span class="chip lane">on <!></span><span class=chip>vs <!></span><!></p>`,`D%b Db%l Db%l%`,bI),nz=I(139,e=>{tz(e,e._._.bl>1?0:1),$R(e)},e=>e._._),rz=P(0,0,e=>{YR(e),$R(e)}),iz=N(3,e=>z(e.a,`data-pr`,e._.g?`${e._.h}/${e._.g.number}`:void 0)),az=P(0,0,iz),oz=P(0,0,iz),sz=P(0,0,YR),cz=F(qR),lz=M(18,e=>{_z(e,e.s.length),cz(e)}),uz=N(4,e=>lz(e,e._.by.get(e.d)||[])),dz=Ke(27,uz),fz=e=>{dz._(e),hz._(e)},pz=(e,t)=>bz(e,t.length),mz=N(5,e=>pz(e,e._.bz.get(e.d)||[])),hz=Ke(27,mz),gz=O(0,`<section class=repo-section><!><!></section>`,` D%b%`,ZR),_z=(e,t)=>gz(e,+!t),vz=F(HI),yz=M(3,e=>{uz(e),mz(e),rz(e),vz(e)}),bz=M(21,sz),xz=(e,t)=>Cz(e,t[0]),Sz=F(VI,xI),Cz=M(2,e=>{yz(e,e.c?.id),Tz(e,e.c?.pr),jz(e,e.c?.worktree),Mz(e,e.c?.head),Nz(e,e.c?.base),Pz(e,e.c?.baseSha),Fz(e,e.c?.full_name),Iz(e,e.c?.branch),Lz(e,e.c?.localHead),Sz(e)}),wz=F(KI,TI),Tz=M(6,e=>{Ez(e,e.g?.number),Dz(e,e.g?.url),Oz(e,e.g?.title),kz(e,e.g?.headRefName),az(e),wz(e)}),Ez=M(8,F(XF,FF)),Dz=M(9,F($F,LF)),Oz=M(10,F(tI,zF)),kz=M(11,F(nI,BF)),Az=F(qI),jz=M(7,e=>{oz(e),Az(e)}),Mz=M(12,F(JI,EI,rI,VF)),Nz=M(13,F(XI,OI,iI,HF)),Pz=M(14,F(ZI,kI,aI,UF)),Fz=M(15,F(JF)),Iz=M(16,F(QI,AI,GF,MF)),Lz=M(17,F(qF,PF)),Rz=N(5,e=>B(e.a,`seen`,e._._._._.ah.has(e._.i))),zz=I(122,Rz,e=>e._._._._),Bz=L(`e30`,e=>A(e.a,`click`,function(){e._._._._.ci(e._.i)})),Vz=e=>{zz(e),Wz(e),Gz._(e),Kz._(e),qz._(e),Jz._(e),Yz._(e),Bz(e)},Hz=O(4,`<span class=tree-note>💬</span>`),Uz=N(6,e=>Hz(e,+!e._._._._.c1.has(e._.i))),Wz=I(146,Uz,e=>e._._._._),Gz=P(0,1,e=>_t(e.a,`padding-left:${.5+e._.f*.75}rem`)),Kz=P(0,1,e=>{Rz(e),Uz(e)}),qz=P(0,1,e=>z(e.a,`title`,e._.j)),Jz=P(0,1,e=>{ht(e.b,[`status`,e._.k]),V(e.c,e._.k)}),Yz=P(0,1,e=>V(e.d,e._.l)),Xz=O(0,`<button class="tree-dir dim mono"><span class=tree-chev> </span><!>/</button>`,` E l%`,nL,`<button class="tree-file mono"><span> </span><span class=tree-file-name> </span><!></button>`,` D D lD l%`,Vz),Zz=N(3,e=>Xz(e,!e._.f(e.c)&&e.c?.kind===`dir`?0:!e._.f(e.c)&&e.c?.kind!==`dir`?1:2)),Qz=Ke(0,Zz),$z=Qz,eB=M(2,e=>{nB(e,e.c?.path),rB(e,e.c?.depth),iB(e,e.c?.label),aB(e,e.c?.file?.key),oB(e,e.c?.file?.path),sB(e,e.c?.file?.status),cB(e,e.c?.name),Zz(e)}),tB=(e,t)=>eB(e,t[0]),nB=M(4,iL),rB=M(5,e=>{Gz(e),aL(e)}),iB=M(6,oL),aB=M(8,Kz),oB=M(9,qz),sB=M(10,Jz),cB=M(11,Yz),lB=M(5,Qz),uB=N(4,e=>lB(e,oU(e)),2),dB=I(135,uB,e=>e._._),fB=M(3,uB),pB=e=>{dB(e),_B(e),yB._(e),fB(e,sU)},mB=k(0,`<!><!><!>`,`b%`,$z,tB),hB=(e,t)=>mB(e,[t,e=>e.kind===`dir`?`d:${e.path}`:e.file.key]),gB=N(6,e=>hB(e,sv(e._._.bz.get(e._.g)||[]))),_B=I(145,gB,e=>e._._),vB=M(2,F(rL)),yB=P(3,0,e=>{vB(e,cU(e)),gB(e),uB(e)}),bB=O(3,`<!><!><!>`,`b%`,pB),xB=N(7,e=>{B(e.a,`closed`,e._.b7.has(e.g)),V(e.b,e._.b7.has(e.g)?`▸`:`▾`),bB(e,+!!e._.b7.has(e.g))}),SB=Ke(0,xB),CB=L(`e31`,e=>A(e.a,`click`,function(){e._.b9(e.g)})),wB=e=>{SB._(e),CB(e)},TB=M(6,e=>{xB(e),yB(e)}),EB=N(10,e=>V(e.c,e.i?`${e.j} #${e.i.number}`:e.j)),DB=M(8,EB),OB=M(9,EB),kB=(e,t)=>{TB(e,t[0]?.id),DB(e,t[0]?.pr),OB(e,t[0]?.worktree)},AB=k(2,`<option> </option>`,` D `,0,gI),jB=I(119,e=>AB(e,[e._._.a8,`id`]),e=>e._._),MB=L(`e34`,e=>{A(e.a,`click`,function(){e._._.ch(e._._.c2)}),Bt(e,`c`)}),NB=e=>{jB(e),PB(e),FB(e),MB(e)},PB=I(128,e=>{z(e.a,`disabled`,e._._.aq),V(e.b,e._._.aq?`Sending…`:`Send to`),z(e.c,`disabled`,e._._.aq)},e=>e._._),FB=I(129,e=>zt(e,`c`,e._._.ar,lU(e)),e=>e._._),IB=N(2,e=>V(e.b,e._._.aq?`Sending…`:`Send to ${e._._.ac||e._._.ad}`),2),LB=I(120,IB,e=>e._._),RB=L(`e33`,e=>A(e.a,`click`,function(){e._._.ch(e._._.c2)})),zB=e=>{LB(e),BB(e),VB(e),RB(e)},BB=I(121,IB,e=>e._._),VB=I(128,e=>{z(e.a,`disabled`,e._._.aq),IB(e)},e=>e._._),HB=O(2,`<button class="btn primary"> </button>`,` D `,zB,`<span class="split-btn primary"><button> </button><select aria-label="Send comments to session"></select></span>`,`D D l `,NB),UB=P(6,0,e=>HB(e,(e._.a8||[]).length===1?0:(e._.a8||[]).length?1:2)),WB=L(`e35`,e=>A(e.a,`click`,function(){e._.cg()})),GB=e=>{UB._(e),KB._(e),WB(e)},KB=P(6,0,e=>V(e.b,e._.ap?`Copied ✓`:`Copy`)),qB=L(`e32`,e=>A(e.a,`click`,function(){e._.ab?.()})),JB=e=>{uv(e.b),dv(e.b,14),fv(e.b),qB(e)},YB=M(95,F(DR)),XB=k(0,`<div class=tree-repo><button class="tree-repo-name mono"><span class=tree-chev> </span> </button><!></div>`,`D E l l%`,wB,kB),ZB=N(98,e=>XB(e,[e.bj.filter(t=>e.bz.get(t.id)?.length),`id`])),QB=F(_B),$B=M(97,e=>{ZB(e),QB(e),hz(e)}),eV=N(92,e=>$B(e,new Map(e.bj.map(t=>[t.id,e.bt.filter(e=>e.repo===t.id)])))),tV=M(91,e=>{HH(e,e.bt?.length),YB(e,new Set(e.bt.map(e=>e.key))),eV(e),_R(e)}),nV=N(90,e=>tV(e,e.br?e.bq.filter(t=>e.br.has(t.key)||t.key===e.b4):e.bq),2),rV=M(88,e=>{nV(e),lL(e)}),iV=N(87,e=>rV(e,e.bm.filter(t=>e.bo(t.key)))),aV=M(84,e=>{VH(e,e.bm?.length),iV(e)}),oV=k(21,`<p class=toast-error><!>: base <!> not found<!>.</p>`,`D%c%c%`,DL,AL),sV=k(22,`<p class=dim><!><!>: already in <!><!>.</p>`,`D%b%c%b%`,xL,TL),cV=k(27,`<!><!><!>`,`b%`,fz,xz),lV=M(106),uV=N(104,e=>lV(e,uU(e))),dV=M(103,e=>{KH(e,e.c5?.length),uV(e),zL(e)}),fV=N(82,e=>dV(e,e.bj.filter(t=>t.githubDrift&&!e.b8.has(t.id)))),pV=k(24,`<p class=dim><!> #<!>: this view is <!> (<!>). Local is <!> (<!><!>).</p>`,`D%c%c%c%c%c%b%`,fL,yL),mV=N(102,e=>pV(e,[e.bj.filter(e.c3),`id`])),hV=M(81,e=>{BH(e,e.bj.length),aV(e,e.bj.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.worktree}/${t.path}`})))),oV(e,[e.bj.filter(e=>e.baseMissing),`id`]),sV(e,[e.bj.filter(e=>e.contained&&e.files.length),`id`]),cV(e,[e.bj,`id`]),eV(e),fV(e),ZB(e),mV(e),jI(e)}),gV=M(96,dz),_V=e=>{gV(e,new Map(e.bj.map(t=>[t.id,e.bm.filter(e=>e.repo===t.id)])))},vV=M(114),yV=N(112,e=>vV(e,dU(e)),2),bV=M(115),xV=N(113,e=>bV(e,fU(e)),3),SV=O(25,`<div class=diff-skel><p class=dim><span class=spin></span>Loading diff…</p><div class=skel-row></div><div class=skel-row></div><div class=skel-row></div></div>`),CV=N(50,e=>SV(e,!e.ae&&e.an?0:1)),wV=O(26,`<p class="dim center-pad"> </p>`,`D `,MI,`<p class="dim center-pad"> </p>`,`D `,NL),TV=N(94,e=>wV(e,e.ae&&!e.bn?0:e.ae&&!e.bv&&!e.b3?1:2),3),EV=j(40,e=>{hV(e,e.ae||[]),_V(e),yV(e),xV(e),CV(e),TV(e)}),DV=M(99,F(Wz,jR,cR)),OV=M(110,F(JL)),kV=M(109,F(qL)),AV=N(47,e=>kV(e,mU(e)),2),jV=j(41,e=>{wH(e,e.af?.length),DV(e,(()=>{let t=new Map;for(let n of e.af){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),OV(e,pU(e)),AV(e),yV(e),xV(e)}),MV=M(108,F(MR)),NV=N(44,e=>MV(e,hU(e))),PV=F(zz,CR,rR),FV=j(43,e=>{TH(e,e.ah?.size),NV(e),PV(e)}),IV=F(WL),LV=j(46,e=>{AV(e),IV(e)}),RV=O(20,`<p class=toast-error><!> <button>×</button></p>`,`D%c `,HL),zV=j(48,e=>{RV(e,+!e.am),BL(e)}),BV=O(7,`<span class="refresh-chip dim"><span class=spin></span>Refreshing…</span>`),VV=j(49,e=>{B(e.k,`spinning`,e.an),z(e.k,`disabled`,e.an),BV(e,+!e.an),CV(e),FL(e)}),HV=j(51,KB),UV=j(52,F(VB,PB)),WV=M(100),GV=N(54,e=>WV(e,(e.a8||[]).some(t=>t.id===e.ar)?e.ar:e.a8?.[0]?.id??null)),KV=F(FB),qV=j(53,e=>{GV(e),KV(e)}),JV=M(86,iV),YV=j(55,e=>{Tv(e.r,e.at),JV(e,Q_(e.at)),ML(e)}),XV=N(80,L(`e45`,e=>Et(e,{active:e.a7,load:e.bf,onMount:function(){let t=new AbortController,n={abort:t,loaded:!1,lastPr:e.a5||``,start:()=>{this.active&&!n.loaded&&(n.loaded=!0,this.load())}};return kn().addEventListener(`review.changed`,t=>{n.loaded&&t.data?.workspaceId===e.a6&&e.bh()},{signal:t.signal}),window.addEventListener(`keydown`,t=>{this.active&&(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||t.target?.closest?.(`.palette`)||(t.preventDefault(),oH(e,!0),cH(e,e.az+1))))},{capture:!0,signal:t.signal}),n.start(),n},onUpdate:function(){this.start();let t=e.a5||``;this.loaded&&t!==this.lastPr&&(this.lastPr=t,this.load())},onDestroy:function(){this.abort.abort()}})),5),ZV=M(107),QV=N(78,e=>ZV(e,gU(e))),$V=M(77,e=>{XV(e),QV(e)}),eH=N(57,e=>$V(e,_U(e)),2),tH=j(56,e=>{jt(e,`q`,e.au),eH(e),QV(e),EL(e),bL(e),dL(e)}),nH=j(58,e=>{B(e.a,`closed`,!e.aw),B(e.i,`on`,e.aw),z(e.i,`title`,e.aw?`Hide file tree`:`Show file tree`)}),rH=O(28,`<div class=sheet-backdrop></div><div class=file-sheet role=dialog aria-label="Jump to file"><div class=sheet-head><strong>Files</strong><span class=dim><!>/<!> viewed</span><button class=icon-btn title=Close>×</button></div><div class=sheet-list></div></div>`,` bEbD%c%l l `,mR),iH=j(59,e=>rH(e,+!e.ax)),aH=O(18,ry,(e=>`/${e}&`)(iy),cL),oH=j(60,e=>{B(e.o,`on`,e.ay),aH(e,+!e.ay)}),sH=M(117),cH=j(61,e=>{sH(e,vU(e)),XV(e),sL(e)}),lH=M(89,nV),uH=e=>{lH(e,e.b1.trim()?new Set(e.b2):null)},dH=j(62,e=>{EH(e,e.b0?.query),DH(e,e.b0?.keys),OH(e,e.b0?.hit),uH(e)}),fH=j(68,F(dB,eL)),pH=M(71),mH=F(ez,FI),hH=j(69,e=>{pH(e,yU(e)),SB(e),mH(e)}),gH=j(70,e=>{fV(e),uV(e)}),_H=(e,t)=>{NH(e,t.cbs),PH(e,t.io)},vH=M(101,mV),yH=M(118),bH=M(116,e=>yH(e,xU(e))),xH=L(`e44`,e=>{A(e.i,`click`,function(){nH(e,!e.aw),Zn(e.aw)}),A(e.k,`click`,function(){e.c9()}),A(e.m,`click`,function(){iH(e,!0)}),A(e.o,`click`,function(){e.cj()}),A(e.q,`change`,function(t){tH(e,t.target.checked),$n(e.au),e.bf(e.au)})});function SH(e){Jm(e.j),Ym(e.j,14),Xm(e.j),So(e.l),Co(e.l,14),wo(e.l),hv(e.p),gv(e.p,14),_v(e.p),Av(e.r),jv(e.r,CU(e)),EV(e,null),jV(e,[]),FV(e,new Set),LV(e,null),zV(e,null),VV(e,!1),HV(e,!1),UV(e,!1),qV(e,null),YV(e,``),tH(e,Qn()),nH(e,Xn()),iH(e,!1),oH(e,!1),cH(e,0),dH(e,{query:``,hit:null,keys:[]}),fH(e,new Set),hH(e,new Set),gH(e,new Set),_H(e,{io:null,cbs:null}),vH(e,bU),bH(e,SU(e)),xH(e)}var CH=O(6,`<button class=btn title="Copy comments as markdown"> </button><!><!>`,` D l%`,GB),wH=M(42,e=>{V(e.f,e.ag?`· ${pt(e.ag)} comment${pt(e.ag===1?``:`s`)}`:``),CH(e,+!e.ag)}),TH=M(45,e=>{V(e.e,e.aj?` · ${pt(e.aj)} viewed`:``),fR(e)}),EH=M(63,PL),DH=M(64),OH=M(65,e=>{kH(e,e.b3?.key),AH(e,e.b3?.repo),TV(e)}),kH=M(66,nV),AH=M(67,F(XR)),jH=M(76),MH=N(75,e=>jH(e,wU(e))),NH=M(73,MH),PH=M(74,MH),FH=M(31,e=>{eH(e),XV(e)}),IH=M(79,XV),LH=M(111,e=>{yV(e),xV(e)}),RH=M(32,e=>{IH(e,TU(e)),LH(e,EU(e)),eH(e),XV(e),NV(e),AV(e)}),zH=M(33,XV),BH=M(83,F(nz)),VH=M(85,e=>{V(e.c,e.bn),V(e.d,e.bn===1?``:`s`),TV(e),hR(e)}),HH=M(93,e=>{V(e.n,e.bv),TV(e)}),UH=F(jB),WH=M(34,e=>{XH(e,e.a8?.[0]?.title),ZH(e,e.a8?.[0]?.agent),GV(e),UB(e),UH(e)}),GH=O(23,`<p class=toast-error><!><button class=btn> </button><button title=Dismiss>×</button></p>`,`D%b D l `,LL),KH=(e,t)=>GH(e,+!t),qH=M(36,xV),JH=O(1,(e=>`<button class=icon-btn title="Back to terminal">${e}</button>`)(cv),(e=>` D/${e}&l`)(lv),JB),YH=M(37,e=>JH(e,+!e.ab)),XH=M(38,F(LB)),ZH=M(39,F(BB));function QH(e){return function(){oH(e._,!1),dH(e._,{query:``,hit:null,keys:[]})}}function $H(e){return function(t){e._.ck(t)}}function eU(e){return function(t){zV(e._._._._._._,t)}}function tU(e){return function(){LV(e._._._._._._,null)}}function nU(e){return function(t){e._._._._._._.cb(e._._.k,t)}}function rU(e){return function(t){e._._._._._._.cc(t)}}function iU(e){return function(t){LV(e._._._._._._,{key:e._._.l,side:t.side||`additions`,start:Math.min(t.start,t.end),end:Math.max(t.start,t.end)})}}function aU(e){return function(){e._._._._.ca(e.l)}}function oU(e){return t=>{let n=e.d(t);for(let r of e._._.b6){let[i,a]=[r.slice(0,r.indexOf(`/`)),r.slice(r.indexOf(`/`)+1)];if(i===e._.g&&(t.kind!==`dir`||t.path!==a)&&(n===a||n.startsWith(`${a}/`)))return!0}return!1}}function sU(e){return e.kind===`dir`?e.path:e.file.path.includes(`/`)?e.file.path.slice(0,e.file.path.lastIndexOf(`/`)):``}function cU(e){return t=>`${e._.g}/${t}`}function lU(e){return t=>{qV(e._._,t)}}function uU(e){return()=>{gH(e,new Set([...e.b8,...e.c5.map(e=>e.id)]))}}function dU(e){return async()=>{if(!await Y_(tv(e.af,e.ae))){zV(e,`Copy failed — clipboard needs HTTPS on this browser.`);return}HV(e,!0),setTimeout(()=>{HV(e,!1)},1500),await e.cd()}}function fU(e){return async t=>{if(t){UV(e,!0);try{await H(`/api/sessions/${t}/send`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:`Please address this review feedback, then summarize what you changed.\n\n${tv(e.af,e.ae)}`,...Z_()||{}})}),UV(e,!1),await e.cd(),e.aa?.(t)}catch(t){zV(e,String(t.message||t)),UV(e,!1)}}}}function pU(e){return async t=>{jV(e,e.af.filter(e=>e.id!==t)),await fetch(`/api/review-comments/${t}`,{method:`DELETE`})}}function mU(e){return async(t,n)=>{let r=e.ak;LV(e,null);try{let i=await H(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:t.repo,path:t.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim()})});jV(e,e.af.concat(i))}catch(t){zV(e,String(t.message||t))}}}function hU(e){return t=>{let n=new Set(e.ah),r=!n.has(t);r?n.add(t):n.delete(t),FV(e,n),fetch(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`viewed`,key:t,viewed:r})}).catch(()=>{zV(e,`Saving viewed state failed — it may reset on reload.`)})}}function gU(e){return()=>(gH(e,new Set),e.bf(e.au,!0))}function _U(e){return async(t=e.au,n=!1)=>{VV(e,!0),zV(e,null);try{let r=new URLSearchParams;t&&r.set(`uncommitted`,`1`),e.a5&&r.set(`pr`,e.a5),n&&r.set(`refresh`,`1`);let i=r.size?`?${r}`:``,[a,o]=await Promise.all([H(`/api/workspaces/${e.a6}/diff${i}`),H(`/api/workspaces/${e.a6}/review`)]);EV(e,a),jV(e,o.comments||[]),FV(e,new Set(o.viewed||[]))}catch(t){zV(e,String(t.message||t))}VV(e,!1)}}function vU(e){return()=>{oH(e,!0),cH(e,e.az+1)}}function yU(e){return t=>{let n=new Set(e.b7);n.delete(t)||n.add(t),hH(e,n)}}function bU(e){return!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)}function xU(e){return t=>{dH(e,t),t.hit&&setTimeout(()=>e.ci(t.hit.key),0)}}function SU(e){return t=>{let n=e.t.querySelector(`details[data-key="${CSS.escape(t)}"]`);n&&(n.open=!0,n.scrollIntoView({block:`start`}))}}function CU(e){return function(t){YV(e,t)}}function wU(e){return(t,n)=>{e.bb??=new WeakMap,e.bc??=new IntersectionObserver(t=>{for(let n of t)n.isIntersecting&&(e.bc.unobserve(n.target),e.bb.get(n.target)?.())},{rootMargin:`600px 0px`}),e.bb.set(t,n),e.bc.observe(t)}}function TU(e){return async()=>{try{let t=await H(`/api/workspaces/${e.a6}/review`);jV(e,t.comments||[]),FV(e,new Set(t.viewed||[]))}catch{}}}function EU(e){return async()=>{jV(e,[]),LV(e,null),await fetch(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})})}}R(`e23`,QH),R(`e22`,$H),R(`e28`,eU),R(`e26`,tU),R(`e25`,nU),R(`e27`,rU),R(`e24`,iU),R(`e1`,aU),R(`e20`,oU),R(`e19`,sU),R(`e18`,cU),R(`e0`,lU),R(`e7`,uU),R(`e13`,dU),R(`e14`,fU),R(`e11`,pU),R(`e10`,mU),R(`e9`,hU),R(`e8`,gU),R(`e4`,_U),R(`e16`,vU),R(`e2`,yU),R(`e6`,bU),R(`e17`,xU),R(`e15`,SU),R(`e21`,CU),R(`e3`,wU),R(`e5`,TU),R(`e12`,EU);var DU=Object.defineProperty,OU=Object.getOwnPropertyDescriptor,kU=(e,t)=>{for(var n in t)DU(e,n,{get:t[n],enumerable:!0})},AU=(e,t,n,r)=>{for(var i=r>1?void 0:r?OU(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&DU(t,n,i),i},J=(e,t)=>(n,r)=>t(n,r,e),jU=`Terminal input`,MU={get:()=>jU,set:e=>jU=e},NU=`Too much output to announce, navigate to rows manually to read`,PU={get:()=>NU,set:e=>NU=e};function FU(e){return e.replace(/\r?\n/g,`\r`)}function IU(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function LU(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function RU(e,t,n,r){e.stopPropagation(),e.clipboardData&&zU(e.clipboardData.getData(`text/plain`),t,n,r)}function zU(e,t,n,r){e=FU(e),e=IU(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function BU(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function VU(e,t,n,r,i){BU(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function HU(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function UU(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var WU=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},GU=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},KU=``,qU=` `,JU=class e{constructor(){this.fg=0,this.bg=0,this.extended=new YU}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},YU=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},XU=class e extends JU{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new YU,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?HU(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ZU=`di$target`,QU=`di$dependencies`,$U=new Map;function eW(e){return e[QU]||[]}function tW(e){if($U.has(e))return $U.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);nW(t,e,r)};return t._id=e,$U.set(e,t),t}function nW(e,t,n){t[ZU]===t?t[QU].push({id:e,index:n}):(t[QU]=[{id:e,index:n}],t[ZU]=t)}var rW=tW(`BufferService`),iW=tW(`CoreMouseService`),aW=tW(`CoreService`),oW=tW(`CharsetService`),sW=tW(`InstantiationService`),cW=tW(`LogService`),lW=tW(`OptionsService`),uW=tW(`OscLinkService`),dW=tW(`UnicodeService`),fW=tW(`DecorationService`),pW=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new XU,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):mW(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};pW=AU([J(0,rW),J(1,lW),J(2,uW)],pW);function mW(e,t){if(confirm(`Do you want to navigate to ${t}?
1533
1533
 
1534
1534
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var hW=tW(`CharSizeService`),gW=tW(`CoreBrowserService`),_W=tW(`MouseService`),vW=tW(`RenderService`),yW=tW(`SelectionService`),bW=tW(`CharacterJoinerService`),xW=tW(`ThemeService`),SW=tW(`LinkProviderService`),CW=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?kW.isErrorNoTelemetry(e)?new kW(e.message+`
1535
1535
 
@@ -1543,7 +1543,7 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
1543
1543
  `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};_q=AU([J(2,rW),J(3,gW),J(4,iW),J(5,xW),J(6,lW),J(7,vW)],_q);var vq=class extends Y{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(UW(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};vq=AU([J(1,rW),J(2,gW),J(3,fW),J(4,vW)],vq);var yq=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},bq={full:0,left:0,center:0,right:0},xq={full:0,left:0,center:0,right:0},Sq={full:0,left:0,center:0,right:0},Cq=class extends Y{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new yq,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(UW(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);xq.full=this._canvas.width,xq.left=e,xq.center=t,xq.right=e,this._refreshDrawHeightConstants(),Sq.full=1,Sq.left=1,Sq.center=1+xq.left,Sq.right=1+xq.left+xq.center}_refreshDrawHeightConstants(){bq.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);bq.left=t,bq.center=t,bq.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*bq.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*bq.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*bq.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*bq.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Sq[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-bq[e.position||`full`]/2),xq[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+bq[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Cq=AU([J(2,rW),J(3,fW),J(4,vW),J(5,lW),J(6,xW),J(7,gW)],Cq);var Q;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
1544
1544
  `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Q||={});var wq;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(wq||={});var Tq;(e=>e.ST=`${Q.ESC}\\`)(Tq||={});var Eq=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Q.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Eq=AU([J(2,rW),J(3,lW),J(4,aW),J(5,vW)],Eq);var Dq=0,Oq=0,kq=0,Aq=0,jq={css:`#00000000`,rgba:0},Mq;(e=>{function t(e,t,n,r){return r===void 0?`#${Lq(e)}${Lq(t)}${Lq(n)}`:`#${Lq(e)}${Lq(t)}${Lq(n)}${Lq(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(Mq||={});var Nq;(e=>{function t(e,t){if(Aq=(t.rgba&255)/255,Aq===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Dq=a+Math.round((n-a)*Aq),Oq=o+Math.round((r-o)*Aq),kq=s+Math.round((i-s)*Aq),{css:Mq.toCss(Dq,Oq,kq),rgba:Mq.toRgba(Dq,Oq,kq)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Iq.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Mq.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Dq,Oq,kq]=Iq.toChannels(t),{css:Mq.toCss(Dq,Oq,kq),rgba:t}}e.opaque=i;function a(e,t){return Aq=Math.round(t*255),[Dq,Oq,kq]=Iq.toChannels(e.rgba),{css:Mq.toCss(Dq,Oq,kq,Aq),rgba:Mq.toRgba(Dq,Oq,kq,Aq)}}e.opacity=a;function o(e,t){return Aq=e.rgba&255,a(e,Aq*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(Nq||={});var Pq;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Dq=parseInt(e.slice(1,2).repeat(2),16),Oq=parseInt(e.slice(2,3).repeat(2),16),kq=parseInt(e.slice(3,4).repeat(2),16),Mq.toColor(Dq,Oq,kq);case 5:return Dq=parseInt(e.slice(1,2).repeat(2),16),Oq=parseInt(e.slice(2,3).repeat(2),16),kq=parseInt(e.slice(3,4).repeat(2),16),Aq=parseInt(e.slice(4,5).repeat(2),16),Mq.toColor(Dq,Oq,kq,Aq);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Dq=parseInt(r[1]),Oq=parseInt(r[2]),kq=parseInt(r[3]),Aq=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Mq.toColor(Dq,Oq,kq,Aq);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Dq,Oq,kq,Aq]=t.getImageData(0,0,1,1).data,Aq!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Mq.toRgba(Dq,Oq,kq,Aq),css:e}}e.toColor=r})(Pq||={});var Fq;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Fq||={});var Iq;(e=>{function t(e,t){if(Aq=(t&255)/255,Aq===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Dq=a+Math.round((n-a)*Aq),Oq=o+Math.round((r-o)*Aq),kq=s+Math.round((i-s)*Aq),Mq.toRgba(Dq,Oq,kq)}e.blend=t;function n(e,t,n){let a=Fq.relativeLuminance(e>>8),o=Fq.relativeLuminance(t>>8);if(Rq(a,o)<n){if(o<a){let o=r(e,t,n),s=Rq(a,Fq.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>Rq(a,Fq.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Rq(a,Fq.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>Rq(a,Fq.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Rq(Fq.relativeLuminance2(o,s,c),Fq.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Rq(Fq.relativeLuminance2(o,s,c),Fq.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Rq(Fq.relativeLuminance2(o,s,c),Fq.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=Rq(Fq.relativeLuminance2(o,s,c),Fq.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Iq||={});function Lq(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Rq(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var zq=class extends JU{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Bq=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new XU}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||qU.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)Bq._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||qU.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Bq=AU([J(0,rW)],Bq);function Vq(e){return 57508<=e&&e<=57558}function Hq(e){return 9472<=e&&e<=9631}function Uq(e){return Vq(e)||Hq(e)}function Wq(){return{css:{canvas:Gq(),cell:Gq()},device:{canvas:Gq(),cell:Gq(),char:{width:0,height:0,left:0,top:0}}}}function Gq(){return{width:0,height:0}}var Kq=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new XU,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,ee=!1,te=0,ne=0,w=[],re=l!==-1&&u!==-1;for(let ie=0;ie<m;ie++){e.loadCell(ie,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ae=!1,oe=ie>=ne,se=ie,T=this._workCell;if(f.length>0&&ie===f[0][0]&&oe){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)oe&&=i===this._isCellInSelection(v,t);oe&&=!n||a<r[0]||a>=r[1],oe?(ae=!0,T=new zq(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),se=r[1]-1,m=T.getWidth()):ne=r[1]}let E=this._isCellInSelection(ie,t),D=n&&ie===a,ce=re&&ie>=l&&ie<=u,O=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{O=!0});let le=T.getChars()||qU;if(le===` `&&(T.isUnderline()||T.isOverline())&&(le=`\xA0`),te=m*s-c.get(le,T.isBold(),T.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(E&&ee||!E&&!ee&&T.bg===y)&&(E&&ee&&p.selectionForeground||T.fg===b)&&T.extended.ext===x&&ce===S&&te===C&&!D&&!ae&&!O&&oe){T.isInvisible()?_+=qU:_+=le,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=T.bg,b=T.fg,x=T.extended.ext,S=ce,C=te,ee=E,ae&&a>=ie&&a<=se&&(a=ie),!this._coreService.isCursorHidden&&D&&this._coreService.isCursorInitialized){if(w.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&w.push(`xterm-cursor-blink`),w.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:w.push(`xterm-cursor-outline`);break;case`block`:w.push(`xterm-cursor-block`);break;case`bar`:w.push(`xterm-cursor-bar`);break;case`underline`:w.push(`xterm-cursor-underline`);break;default:break}}if(T.isBold()&&w.push(`xterm-bold`),T.isItalic()&&w.push(`xterm-italic`),T.isDim()&&w.push(`xterm-dim`),_=T.isInvisible()?qU:T.getChars()||qU,T.isUnderline()&&(w.push(`xterm-underline-${T.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!T.isUnderlineColorDefault())){if(T.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${JU.toColorRGB(T.getUnderlineColor()).join(`,`)})`;else{let e=T.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&T.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}T.isOverline()&&(w.push(`xterm-overline`),_===` `&&(_=`\xA0`)),T.isStrikethrough()&&w.push(`xterm-strikethrough`),ce&&(h.style.textDecoration=`underline`);let ue=T.getFgColor(),de=T.getFgColorMode(),k=T.getBgColor(),fe=T.getBgColorMode(),pe=!!T.isInverse();if(pe){let e=ue;ue=k,k=e;let t=de;de=fe,fe=t}let me,he,ge=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{e.options.layer!==`top`&&ge||(e.backgroundColorRGB&&(fe=50331648,k=e.backgroundColorRGB.rgba>>8&16777215,me=e.backgroundColorRGB),e.foregroundColorRGB&&(de=50331648,ue=e.foregroundColorRGB.rgba>>8&16777215,he=e.foregroundColorRGB),ge=e.options.layer===`top`)}),!ge&&E&&(me=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,k=me.rgba>>8&16777215,fe=50331648,ge=!0,p.selectionForeground&&(de=50331648,ue=p.selectionForeground.rgba>>8&16777215,he=p.selectionForeground)),ge&&w.push(`xterm-decoration-top`);let _e;switch(fe){case 16777216:case 33554432:_e=p.ansi[k],w.push(`xterm-bg-${k}`);break;case 50331648:_e=Mq.toColor(k>>16,k>>8&255,k&255),this._addStyle(h,`background-color:#${qq((k>>>0).toString(16),`0`,6)}`);break;default:pe?(_e=p.foreground,w.push(`xterm-bg-257`)):_e=p.background}switch(me||T.isDim()&&(me=Nq.multiplyOpacity(_e,.5)),de){case 16777216:case 33554432:T.isBold()&&ue<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ue+=8),this._applyMinimumContrast(h,_e,p.ansi[ue],T,me,void 0)||w.push(`xterm-fg-${ue}`);break;case 50331648:let e=Mq.toColor(ue>>16&255,ue>>8&255,ue&255);this._applyMinimumContrast(h,_e,e,T,me,he)||this._addStyle(h,`color:#${qq(ue.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,_e,p.foreground,T,me,he)||pe&&w.push(`xterm-fg-257`)}w.length&&=(h.className=w.join(` `),0),!D&&!ae&&!O&&oe?g++:h.textContent=_,te!==this.defaultSpacing&&(h.style.letterSpacing=`${te}px`),d.push(h),ie=se}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Uq(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=Nq.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};Kq=AU([J(1,bW),J(2,lW),J(3,gW),J(4,aW),J(5,fW),J(6,xW)],Kq);function qq(e,t,n){for(;e.length<n;)e=t+e;return e}var Jq=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},Yq=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function Xq(){return new Yq}var Zq=`xterm-dom-renderer-owner-`,Qq=`xterm-rows`,$q=`xterm-fg-`,eJ=`xterm-bg-`,tJ=`xterm-focus`,nJ=`xterm-selection`,rJ=1,iJ=class extends Y{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=rJ++,this._rowElements=[],this._selectionRenderModel=Xq(),this.onRequestRedraw=this._register(new X).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(Qq),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(nJ),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=Wq(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(Kq,document),this._element.classList.add(Zq+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(UW(()=>{this._element.classList.remove(Zq+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Jq(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Qq} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Qq} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Qq} .xterm-dim { color: ${Nq.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Qq}.${tJ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Qq}.${tJ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Qq}.${tJ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Qq} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Qq} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Qq} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Qq} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Qq} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${nJ} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${nJ} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${nJ} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${$q}${n} { color: ${r.css}; }${this._terminalSelector} .${$q}${n}.xterm-dim { color: ${Nq.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${eJ}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${$q}257 { color: ${Nq.opaque(e.background).css}; }${this._terminalSelector} .${$q}257.xterm-dim { color: ${Nq.multiplyOpacity(Nq.opaque(e.background),.5).css}; }${this._terminalSelector} .${eJ}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(tJ),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(tJ),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Zq}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};iJ=AU([J(7,sW),J(8,hW),J(9,lW),J(10,rW),J(11,aW),J(12,gW),J(13,xW)],iJ);var aJ=class extends Y{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new X),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new cJ(this._optionsService))}catch{this._measureStrategy=this._register(new sJ(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};aJ=AU([J(2,lW)],aJ);var oJ=class extends Y{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},sJ=class extends oJ{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},cJ=class extends oJ{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},lJ=class extends Y{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new uJ(this._window)),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new X),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register($W.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Z(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(Z(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},uJ=class extends Y{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new KW),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(UW(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Z(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},dJ=class extends Y{constructor(){super(),this.linkProviders=[],this._register(UW(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function fJ(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function pJ(e,t,n,r,i,a,o,s,c){if(!a)return;let l=fJ(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var mJ=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return pJ(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=fJ(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};mJ=AU([J(0,vW),J(1,hW)],mJ);var hJ=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},gJ={};kU(gJ,{getSafariVersion:()=>CJ,isChromeOS:()=>kJ,isFirefox:()=>bJ,isIpad:()=>TJ,isIphone:()=>EJ,isLegacyEdge:()=>xJ,isLinux:()=>OJ,isMac:()=>wJ,isNode:()=>_J,isSafari:()=>SJ,isWindows:()=>DJ});var _J=typeof process<`u`&&`title`in process,vJ=_J?`node`:navigator.userAgent,yJ=_J?`node`:navigator.platform,bJ=vJ.includes(`Firefox`),xJ=vJ.includes(`Edge`),SJ=/^((?!chrome|android).)*safari/i.test(vJ);function CJ(){if(!SJ)return 0;let e=vJ.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var wJ=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(yJ),TJ=yJ===`iPad`,EJ=yJ===`iPhone`,DJ=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(yJ),OJ=yJ.indexOf(`Linux`)>=0,kJ=/\bCrOS\b/.test(vJ),AJ=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},jJ=class extends AJ{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},MJ=class extends AJ{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},NJ=!_J&&`requestIdleCallback`in window?MJ:jJ,PJ=class{constructor(){this._queue=new NJ}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},FJ=class extends Y{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new KW),this._pausedResizeTask=new PJ,this._observerDisposable=this._register(new KW),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new X),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new X),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new X),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new hJ((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new IJ(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(UW(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=UW(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};FJ=AU([J(2,lW),J(3,hW),J(4,aW),J(5,fW),J(6,rW),J(7,gW),J(8,xW)],FJ);var IJ=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function LJ(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return BJ(i,a,e,t,n,r)+VJ(a,t,n,r)+HJ(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,YJ(Math.abs(i-e),JJ(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return YJ(zJ(a>t?e:i,n)+(s-1)*n.cols+1+RJ(a>t?i:e,n),JJ(o,r))}function RJ(e,t){return e-1}function zJ(e,t){return t.cols-e}function BJ(e,t,n,r,i,a){return VJ(t,r,i,a).length===0?``:YJ(qJ(e,t,e,t-WJ(t,i),!1,i).length,JJ(`D`,a))}function VJ(e,t,n,r){let i=e-WJ(e,n),a=t-WJ(t,n);return YJ(Math.abs(i-a)-UJ(e,t,n),JJ(KJ(e,t),r))}function HJ(e,t,n,r,i,a){let o;o=VJ(t,r,i,a).length>0?r-WJ(r,i):t;let s=r,c=GJ(e,t,n,r,i,a);return YJ(qJ(e,o,n,s,c===`C`,i).length,JJ(c,a))}function UJ(e,t,n){let r=0,i=e-WJ(e,n),a=t-WJ(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=KJ(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function WJ(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function GJ(e,t,n,r,i,a){let o;return o=VJ(n,r,i,a).length>0?r-WJ(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function KJ(e,t){return e>t?`A`:`B`}function qJ(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function JJ(e,t){let n=t?`O`:`[`;return Q.ESC+n+e}function YJ(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var XJ=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function ZJ(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var QJ=50,$J=15,eY=50,tY=500,nY=RegExp(`\xA0`,`g`),rY=class extends Y{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new XU,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new X),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new X),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new XJ(this._bufferService),this._activeSelectionMode=0,this._register(UW(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(nY,` `)).join(DJ?`\r
1545
1545
  `:`
1546
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),OJ&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=ZJ(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=fJ(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-QJ),QJ),t/=QJ,t/Math.abs(t)+Math.round(t*($J-1)))}shouldForceSelection(e){return wJ?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),eY)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(wJ&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<tY&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=LJ(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=ZJ(n,this._bufferService.cols)}};rY=AU([J(3,rW),J(4,aW),J(5,_W),J(6,lW),J(7,vW),J(8,gW)],rY);var iY=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},aY=class{constructor(){this._color=new iY,this._css=new iY}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},oY=Object.freeze((()=>{let e=[Pq.toColor(`#2e3436`),Pq.toColor(`#cc0000`),Pq.toColor(`#4e9a06`),Pq.toColor(`#c4a000`),Pq.toColor(`#3465a4`),Pq.toColor(`#75507b`),Pq.toColor(`#06989a`),Pq.toColor(`#d3d7cf`),Pq.toColor(`#555753`),Pq.toColor(`#ef2929`),Pq.toColor(`#8ae234`),Pq.toColor(`#fce94f`),Pq.toColor(`#729fcf`),Pq.toColor(`#ad7fa8`),Pq.toColor(`#34e2e2`),Pq.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:Mq.toCss(r,i,a),rgba:Mq.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:Mq.toCss(n,n,n),rgba:Mq.toRgba(n,n,n)})}return e})()),sY=Pq.toColor(`#ffffff`),cY=Pq.toColor(`#000000`),lY=Pq.toColor(`#ffffff`),uY=cY,dY={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},fY=sY,pY=class extends Y{constructor(e){super(),this._optionsService=e,this._contrastCache=new aY,this._halfContrastCache=new aY,this._onChangeColors=this._register(new X),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:sY,background:cY,cursor:lY,cursorAccent:uY,selectionForeground:void 0,selectionBackgroundTransparent:dY,selectionBackgroundOpaque:Nq.blend(cY,dY),selectionInactiveBackgroundTransparent:dY,selectionInactiveBackgroundOpaque:Nq.blend(cY,dY),scrollbarSliderBackground:Nq.opacity(sY,.2),scrollbarSliderHoverBackground:Nq.opacity(sY,.4),scrollbarSliderActiveBackground:Nq.opacity(sY,.5),overviewRulerBorder:sY,ansi:oY.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=mY(e.foreground,sY),t.background=mY(e.background,cY),t.cursor=Nq.blend(t.background,mY(e.cursor,lY)),t.cursorAccent=Nq.blend(t.background,mY(e.cursorAccent,uY)),t.selectionBackgroundTransparent=mY(e.selectionBackground,dY),t.selectionBackgroundOpaque=Nq.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=mY(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Nq.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?mY(e.selectionForeground,jq):void 0,t.selectionForeground===jq&&(t.selectionForeground=void 0),Nq.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Nq.opacity(t.selectionBackgroundTransparent,.3)),Nq.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Nq.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=mY(e.scrollbarSliderBackground,Nq.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=mY(e.scrollbarSliderHoverBackground,Nq.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=mY(e.scrollbarSliderActiveBackground,Nq.opacity(t.foreground,.5)),t.overviewRulerBorder=mY(e.overviewRulerBorder,fY),t.ansi=oY.slice(),t.ansi[0]=mY(e.black,oY[0]),t.ansi[1]=mY(e.red,oY[1]),t.ansi[2]=mY(e.green,oY[2]),t.ansi[3]=mY(e.yellow,oY[3]),t.ansi[4]=mY(e.blue,oY[4]),t.ansi[5]=mY(e.magenta,oY[5]),t.ansi[6]=mY(e.cyan,oY[6]),t.ansi[7]=mY(e.white,oY[7]),t.ansi[8]=mY(e.brightBlack,oY[8]),t.ansi[9]=mY(e.brightRed,oY[9]),t.ansi[10]=mY(e.brightGreen,oY[10]),t.ansi[11]=mY(e.brightYellow,oY[11]),t.ansi[12]=mY(e.brightBlue,oY[12]),t.ansi[13]=mY(e.brightMagenta,oY[13]),t.ansi[14]=mY(e.brightCyan,oY[14]),t.ansi[15]=mY(e.brightWhite,oY[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=mY(e.extendedAnsi[r],oY[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};pY=AU([J(0,lW)],pY);function mY(e,t){if(e!==void 0)try{return Pq.toColor(e)}catch{}return t}var hY=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},gY=class{constructor(){this._services=new hY,this._services.set(sW,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=eW(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},_Y={trace:0,debug:1,info:2,warn:3,error:4,off:5},vY=`xterm.js: `,yY=class extends Y{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),bY=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=_Y[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:vY)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};yY=AU([J(0,lW)],yY);var bY,xY=class extends Y{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new X),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new X),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new X),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},$=3,SY=Object.freeze(new JU),CY=0,wY=2,TY=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*$);let r=t||XU.fromCharData([0,KU,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*$+0],n=t&2097151;return[this._data[e*$+1],t&2097152?this._combined[e]:n?HU(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*$+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*$+0]=e|2097152|t[2]<<22):this._data[e*$+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*$+0]>>22}hasWidth(e){return this._data[e*$+0]&12582912}getFg(e){return this._data[e*$+1]}getBg(e){return this._data[e*$+2]}hasContent(e){return this._data[e*$+0]&4194303}getCodePoint(e){let t=this._data[e*$+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*$+0]&2097152}getString(e){let t=this._data[e*$+0];return t&2097152?this._combined[e]:t&2097151?HU(t&2097151):``}isProtected(e){return this._data[e*$+2]&536870912}loadCell(e,t){return CY=e*$,t.content=this._data[CY+0],t.fg=this._data[CY+1],t.bg=this._data[CY+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*$+0]=t.content,this._data[e*$+1]=t.fg,this._data[e*$+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*$+0]=t|n<<22,this._data[e*$+1]=r.fg,this._data[e*$+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*$+0];r&2097152?this._combined[e]+=HU(t):r&2097151?(this._combined[e]=HU(r&2097151)+HU(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*$+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new XU;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new XU;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*wY<this._data.buffer.byteLength;let n=e*$;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*wY<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*wY<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303)return e+(this._data[e*$+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303||this._data[e*$+2]&50331648)return e+(this._data[e*$+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*$+0],n=e&2097151,a=e&2097152?this._combined[t]:n?HU(n):qU;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function EY(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=AY(u,d,t),p=1,m=0;for(;p<u.length;){let e=AY(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function DY(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function OY(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function kY(e,t,n){let r=[],i=e.map((n,r)=>AY(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=AY(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function AY(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var jY=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new X),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),VW(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};jY._nextId=1;var MY=jY,NY={},PY=NY.B;NY[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},NY.A={"#":`£`},NY.B=void 0,NY[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},NY.C=NY[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},NY.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},NY.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},NY.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},NY.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},NY.E=NY[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},NY.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},NY.H=NY[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},NY[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var FY=4294967295,IY=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=SY.clone(),this.savedCharset=PY,this.markers=[],this._nullCell=XU.fromCharData([0,KU,1,0]),this._whitespaceCell=XU.fromCharData([0,qU,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new NJ,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new xY(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new YU),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new YU),this._whitespaceCell}getBlankLine(e,t){return new TY(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>FY?FY:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=SY);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new xY(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(SY),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new TY(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new TY(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=EY(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(SY),n);if(r.length>0){let n=DY(this.lines,r);OY(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(SY),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new TY(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(SY),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=kY(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(SY,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=AY(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new MY(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},LY=class extends Y{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new X),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new IY(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new IY(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},RY=2,zY=1,BY=class extends Y{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,RY),this.rows=Math.max(e.rawOptions.rows||0,zY),this.buffers=this._register(new LY(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};BY=AU([J(0,lW)],BY);var VY={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:wJ,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},HY=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],UY=class extends Y{constructor(e){super(),this._onOptionChange=this._register(new X),this.onOptionChange=this._onOptionChange.event;let t={...VY};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(UW(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in VY))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in VY))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=VY[e],!WY(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=VY[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=HY.includes(t)?t:VY[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function WY(e){return e===`block`||e===`underline`||e===`bar`}function GY(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&GY(e[r],t-1);return n}var KY=Object.freeze({insertMode:!1}),qY=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),JY=class extends Y{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new X),this.onData=this._onData.event,this._onUserInput=this._register(new X),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new X),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=GY(KY),this.decPrivateModes=GY(qY)}reset(){this.modes=GY(KY),this.decPrivateModes=GY(qY)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};JY=AU([J(0,rW),J(1,cW),J(2,lW)],JY);var YY={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function XY(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var ZY=String.fromCharCode,QY={DEFAULT:e=>{let t=[XY(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${ZY(t[0])}${ZY(t[1])}${ZY(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${XY(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${XY(e,!0)};${e.x};${e.y}${t}`}},$Y=class extends Y{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new X),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(YY))this.addProtocol(e,YY[e]);for(let e of Object.keys(QY))this.addEncoding(e,QY[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};$Y=AU([J(0,rW),J(1,aW),J(2,lW)],$Y);var eX=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],tX=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],nX;function rX(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var iX=class{constructor(){if(this.version=`6`,!nX){nX=new Uint8Array(65536),nX.fill(1),nX[0]=0,nX.fill(0,1,32),nX.fill(0,127,160),nX.fill(2,4352,4448),nX[9001]=2,nX[9002]=2,nX.fill(2,11904,42192),nX[12351]=1,nX.fill(2,44032,55204),nX.fill(2,63744,64256),nX.fill(2,65040,65050),nX.fill(2,65072,65136),nX.fill(2,65280,65377),nX.fill(2,65504,65511);for(let e=0;e<eX.length;++e)nX.fill(0,eX[e][0],eX[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?nX[e]:rX(e,tX)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=aX.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return aX.createPropertyValue(0,n,r)}},aX=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new X,this.onChange=this._onChange.event;let e=new iX;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},oX=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function sX(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var cX=2147483647,lX=256,uX=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>lX)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>cX?cX:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>cX?cX:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,cX):e}},dX=[],fX=class{constructor(){this._state=0,this._active=dX,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=dX}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=dX,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||dX,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,UU(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=dX,this._id=-1,this._state=0}}},pX=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=UU(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},mX=[],hX=class{constructor(){this._handlers=Object.create(null),this._active=mX,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=mX}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=mX,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||mX,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,UU(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=mX,this._ident=0}},gX=new uX;gX.addParam(0);var _X=class{constructor(e){this._handler=e,this._data=``,this._params=gX,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():gX,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=UU(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=gX,this._data=``,this._hitLimit=!1,e));return this._params=gX,this._data=``,this._hitLimit=!1,t}},ine=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},vX=160,yX=function(){let e=new ine(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(vX,0,2,0),e.add(vX,8,5,8),e.add(vX,6,0,6),e.add(vX,11,0,11),e.add(vX,13,13,13),e}(),bX=class extends Y{constructor(e=yX){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new uX,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(UW(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new fX),this._dcsParser=this._register(new hX),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:vX)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<vX){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<vX){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<vX){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<vX){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<vX){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<vX){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},xX=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,SX=/^[\da-f]+$/;function CX(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=xX.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),SX.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function wX(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function TX(e,t=16){let[n,r,i]=e;return`rgb:${wX(n,t)}/${wX(r,t)}/${wX(i,t)}`}var EX={"(":0,")":1,"*":2,"+":3,"-":1,".":2},DX=131072,OX=10;function kX(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var AX=5e3,jX=0,MX=class extends Y{constructor(e,t,n,r,i,a,o,s,c=new bX){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new WU,this._utf8Decoder=new GU,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=SY.clone(),this._eraseAttrDataInternal=SY.clone(),this._onRequestBell=this._register(new X),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new X),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new X),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new X),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new X),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new X),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new X),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new X),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new X),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new NX(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Q.BEL,()=>this.bell()),this._parser.setExecuteHandler(Q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Q.BS,()=>this.backspace()),this._parser.setExecuteHandler(Q.HT,()=>this.tab()),this._parser.setExecuteHandler(Q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(wq.IND,()=>this.index()),this._parser.setExecuteHandler(wq.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(wq.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new pX(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new pX(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new pX(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new pX(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new pX(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new pX(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new pX(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new pX(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new pX(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new pX(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new pX(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new pX(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in NY)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new _X((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),AX))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${AX} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>DX&&(a=this._parseStack.position+DX)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<DX&&(this._parseBuffer=new Uint32Array(Math.min(e.length,DX))),o||this._dirtyRowTracker.clearRange(),e.length>DX)for(let t=a;t<e.length;t+=DX){let a=t+DX<e.length?t+DX:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=aX.extractWidth(t);let n=aX.extractShouldJoin(t),m=n?aX.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(HU(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof TY&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!kX(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new _X(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new pX(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(SY));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=aX.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Q.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Q.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Q.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Q.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Q.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,PY),this._charsetService.setgCharset(1,PY),this._charsetService.setgCharset(2,PY),this._charsetService.setgCharset(3,PY);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Q.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=JU.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=SY.fg,e.bg=SY.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=SY.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=SY.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=SY.fg&16777215,r.bg&=-67108864,r.bg|=SY.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Q.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=SY.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!kX(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>OX&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>OX&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(PX(n)){if(r===`?`)t.push({type:0,index:n});else{let e=CX(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=CX(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);PX(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,PY),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(EX[e[0]],NY[e[1]]||PY),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=SY.clone(),this._eraseAttrDataInternal=SY.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new XU;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Q.ESC}${e}${Q.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},NX=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(jX=e,e=t,t=jX),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};NX=AU([J(0,rW)],NX);function PX(e){return 0<=e&&e<256}var FX=5e7,IX=12,LX=50,RX=class extends Y{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>FX)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=IX?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=IX)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>LX&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},zX=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};zX=AU([J(0,rW)],zX);var BX=!1,VX=class extends Y{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new KW),this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onData=this._register(new X),this.onData=this._onData.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new X),this._instantiationService=new gY,this.optionsService=this._register(new UY(e)),this._instantiationService.setService(lW,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(BY)),this._instantiationService.setService(rW,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(yY)),this._instantiationService.setService(cW,this._logService),this.coreService=this._register(this._instantiationService.createInstance(JY)),this._instantiationService.setService(aW,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance($Y)),this._instantiationService.setService(iW,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(aX)),this._instantiationService.setService(dW,this.unicodeService),this._charsetService=this._instantiationService.createInstance(oX),this._instantiationService.setService(oW,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(zX),this._instantiationService.setService(uW,this._oscLinkService),this._inputHandler=this._register(new MX(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register($W.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register($W.forward(this._bufferService.onResize,this._onResize)),this._register($W.forward(this.coreService.onData,this._onData)),this._register($W.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new RX((e,t)=>this._inputHandler.parse(e,t))),this._register($W.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new X),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!BX&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),BX=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,RY),t=Math.max(t,zY),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(sX.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(sX(this._bufferService),!1))),this._windowsWrappingHeuristics.value=UW(()=>{for(let t of e)t.dispose()})}}},HX={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function UX(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?Q.ESC+`OA`:Q.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?Q.ESC+`OD`:Q.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?Q.ESC+`OC`:Q.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?Q.ESC+`OB`:Q.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Q.DEL,e.altKey&&(i.key=Q.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Q.ESC+`[Z`;break}i.key=Q.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Q.ESC+Q.CR:Q.CR,i.cancel=!0;break;case 27:i.key=Q.ESC,e.altKey&&(i.key=Q.ESC+Q.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`D`:t?Q.ESC+`OD`:Q.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`C`:t?Q.ESC+`OC`:Q.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`A`:t?Q.ESC+`OA`:Q.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`B`:t?Q.ESC+`OB`:Q.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Q.ESC+`[2~`);break;case 46:i.key=a?Q.ESC+`[3;`+(a+1)+`~`:Q.ESC+`[3~`;break;case 36:i.key=a?Q.ESC+`[1;`+(a+1)+`H`:t?Q.ESC+`OH`:Q.ESC+`[H`;break;case 35:i.key=a?Q.ESC+`[1;`+(a+1)+`F`:t?Q.ESC+`OF`:Q.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?Q.ESC+`[5;`+(a+1)+`~`:Q.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?Q.ESC+`[6;`+(a+1)+`~`:Q.ESC+`[6~`;break;case 112:i.key=a?Q.ESC+`[1;`+(a+1)+`P`:Q.ESC+`OP`;break;case 113:i.key=a?Q.ESC+`[1;`+(a+1)+`Q`:Q.ESC+`OQ`;break;case 114:i.key=a?Q.ESC+`[1;`+(a+1)+`R`:Q.ESC+`OR`;break;case 115:i.key=a?Q.ESC+`[1;`+(a+1)+`S`:Q.ESC+`OS`;break;case 116:i.key=a?Q.ESC+`[15;`+(a+1)+`~`:Q.ESC+`[15~`;break;case 117:i.key=a?Q.ESC+`[17;`+(a+1)+`~`:Q.ESC+`[17~`;break;case 118:i.key=a?Q.ESC+`[18;`+(a+1)+`~`:Q.ESC+`[18~`;break;case 119:i.key=a?Q.ESC+`[19;`+(a+1)+`~`:Q.ESC+`[19~`;break;case 120:i.key=a?Q.ESC+`[20;`+(a+1)+`~`:Q.ESC+`[20~`;break;case 121:i.key=a?Q.ESC+`[21;`+(a+1)+`~`:Q.ESC+`[21~`;break;case 122:i.key=a?Q.ESC+`[23;`+(a+1)+`~`:Q.ESC+`[23~`;break;case 123:i.key=a?Q.ESC+`[24;`+(a+1)+`~`:Q.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Q.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Q.DEL:e.keyCode===219?i.key=Q.ESC:e.keyCode===220?i.key=Q.FS:e.keyCode===221&&(i.key=Q.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=HX[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Q.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Q.ESC+n}else if(e.keyCode===32)i.key=Q.ESC+(e.ctrlKey?Q.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Q.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Q.US),e.key===`@`&&(i.key=Q.NUL))}return i}var WX=0,GX=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new NJ,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new NJ,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(WX=this._search(t),WX===-1)||this._getKey(this._array[WX])!==t)return!1;do if(this._array[WX]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(WX),!0;while(++WX<this._array.length&&this._getKey(this._array[WX])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(WX=this._search(e),!(WX<0||WX>=this._array.length)&&this._getKey(this._array[WX])===e))do yield this._array[WX];while(++WX<this._array.length&&this._getKey(this._array[WX])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(WX=this._search(e),!(WX<0||WX>=this._array.length)&&this._getKey(this._array[WX])===e))do t(this._array[WX]);while(++WX<this._array.length&&this._getKey(this._array[WX])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},KX=0,qX=0,JX=class extends Y{constructor(){super(),this._decorations=new GX(e=>e?.marker.line),this._onDecorationRegistered=this._register(new X),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new X),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(UW(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new YX(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{KX=t.options.x??0,qX=KX+(t.options.width??1),e>=KX&&e<qX&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},YX=class extends GW{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new X),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new X),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?Pq.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?Pq.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},XX=1e3,ZX=class{constructor(e,t=XX){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},QX=20,$X=class extends Y{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new ZX(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
1546
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),OJ&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=ZJ(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=fJ(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-QJ),QJ),t/=QJ,t/Math.abs(t)+Math.round(t*($J-1)))}shouldForceSelection(e){return wJ?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),eY)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(wJ&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<tY&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=LJ(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=ZJ(n,this._bufferService.cols)}};rY=AU([J(3,rW),J(4,aW),J(5,_W),J(6,lW),J(7,vW),J(8,gW)],rY);var iY=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},aY=class{constructor(){this._color=new iY,this._css=new iY}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},oY=Object.freeze((()=>{let e=[Pq.toColor(`#2e3436`),Pq.toColor(`#cc0000`),Pq.toColor(`#4e9a06`),Pq.toColor(`#c4a000`),Pq.toColor(`#3465a4`),Pq.toColor(`#75507b`),Pq.toColor(`#06989a`),Pq.toColor(`#d3d7cf`),Pq.toColor(`#555753`),Pq.toColor(`#ef2929`),Pq.toColor(`#8ae234`),Pq.toColor(`#fce94f`),Pq.toColor(`#729fcf`),Pq.toColor(`#ad7fa8`),Pq.toColor(`#34e2e2`),Pq.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:Mq.toCss(r,i,a),rgba:Mq.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:Mq.toCss(n,n,n),rgba:Mq.toRgba(n,n,n)})}return e})()),sY=Pq.toColor(`#ffffff`),cY=Pq.toColor(`#000000`),lY=Pq.toColor(`#ffffff`),uY=cY,dY={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},fY=sY,pY=class extends Y{constructor(e){super(),this._optionsService=e,this._contrastCache=new aY,this._halfContrastCache=new aY,this._onChangeColors=this._register(new X),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:sY,background:cY,cursor:lY,cursorAccent:uY,selectionForeground:void 0,selectionBackgroundTransparent:dY,selectionBackgroundOpaque:Nq.blend(cY,dY),selectionInactiveBackgroundTransparent:dY,selectionInactiveBackgroundOpaque:Nq.blend(cY,dY),scrollbarSliderBackground:Nq.opacity(sY,.2),scrollbarSliderHoverBackground:Nq.opacity(sY,.4),scrollbarSliderActiveBackground:Nq.opacity(sY,.5),overviewRulerBorder:sY,ansi:oY.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=mY(e.foreground,sY),t.background=mY(e.background,cY),t.cursor=Nq.blend(t.background,mY(e.cursor,lY)),t.cursorAccent=Nq.blend(t.background,mY(e.cursorAccent,uY)),t.selectionBackgroundTransparent=mY(e.selectionBackground,dY),t.selectionBackgroundOpaque=Nq.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=mY(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Nq.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?mY(e.selectionForeground,jq):void 0,t.selectionForeground===jq&&(t.selectionForeground=void 0),Nq.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Nq.opacity(t.selectionBackgroundTransparent,.3)),Nq.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Nq.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=mY(e.scrollbarSliderBackground,Nq.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=mY(e.scrollbarSliderHoverBackground,Nq.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=mY(e.scrollbarSliderActiveBackground,Nq.opacity(t.foreground,.5)),t.overviewRulerBorder=mY(e.overviewRulerBorder,fY),t.ansi=oY.slice(),t.ansi[0]=mY(e.black,oY[0]),t.ansi[1]=mY(e.red,oY[1]),t.ansi[2]=mY(e.green,oY[2]),t.ansi[3]=mY(e.yellow,oY[3]),t.ansi[4]=mY(e.blue,oY[4]),t.ansi[5]=mY(e.magenta,oY[5]),t.ansi[6]=mY(e.cyan,oY[6]),t.ansi[7]=mY(e.white,oY[7]),t.ansi[8]=mY(e.brightBlack,oY[8]),t.ansi[9]=mY(e.brightRed,oY[9]),t.ansi[10]=mY(e.brightGreen,oY[10]),t.ansi[11]=mY(e.brightYellow,oY[11]),t.ansi[12]=mY(e.brightBlue,oY[12]),t.ansi[13]=mY(e.brightMagenta,oY[13]),t.ansi[14]=mY(e.brightCyan,oY[14]),t.ansi[15]=mY(e.brightWhite,oY[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=mY(e.extendedAnsi[r],oY[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};pY=AU([J(0,lW)],pY);function mY(e,t){if(e!==void 0)try{return Pq.toColor(e)}catch{}return t}var hY=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},gY=class{constructor(){this._services=new hY,this._services.set(sW,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=eW(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},_Y={trace:0,debug:1,info:2,warn:3,error:4,off:5},vY=`xterm.js: `,yY=class extends Y{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),bY=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=_Y[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:vY)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};yY=AU([J(0,lW)],yY);var bY,xY=class extends Y{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new X),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new X),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new X),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},$=3,SY=Object.freeze(new JU),CY=0,wY=2,TY=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*$);let r=t||XU.fromCharData([0,KU,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*$+0],n=t&2097151;return[this._data[e*$+1],t&2097152?this._combined[e]:n?HU(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*$+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*$+0]=e|2097152|t[2]<<22):this._data[e*$+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*$+0]>>22}hasWidth(e){return this._data[e*$+0]&12582912}getFg(e){return this._data[e*$+1]}getBg(e){return this._data[e*$+2]}hasContent(e){return this._data[e*$+0]&4194303}getCodePoint(e){let t=this._data[e*$+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*$+0]&2097152}getString(e){let t=this._data[e*$+0];return t&2097152?this._combined[e]:t&2097151?HU(t&2097151):``}isProtected(e){return this._data[e*$+2]&536870912}loadCell(e,t){return CY=e*$,t.content=this._data[CY+0],t.fg=this._data[CY+1],t.bg=this._data[CY+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*$+0]=t.content,this._data[e*$+1]=t.fg,this._data[e*$+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*$+0]=t|n<<22,this._data[e*$+1]=r.fg,this._data[e*$+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*$+0];r&2097152?this._combined[e]+=HU(t):r&2097151?(this._combined[e]=HU(r&2097151)+HU(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*$+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new XU;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new XU;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*wY<this._data.buffer.byteLength;let n=e*$;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*wY<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*wY<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303)return e+(this._data[e*$+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303||this._data[e*$+2]&50331648)return e+(this._data[e*$+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*$+0],n=e&2097151,a=e&2097152?this._combined[t]:n?HU(n):qU;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function EY(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=AY(u,d,t),p=1,m=0;for(;p<u.length;){let e=AY(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function DY(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function OY(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function kY(e,t,n){let r=[],i=e.map((n,r)=>AY(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=AY(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function AY(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var jY=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new X),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),VW(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};jY._nextId=1;var MY=jY,NY={},PY=NY.B;NY[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},NY.A={"#":`£`},NY.B=void 0,NY[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},NY.C=NY[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},NY.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},NY.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},NY.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},NY.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},NY.E=NY[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},NY.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},NY.H=NY[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},NY[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var FY=4294967295,IY=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=SY.clone(),this.savedCharset=PY,this.markers=[],this._nullCell=XU.fromCharData([0,KU,1,0]),this._whitespaceCell=XU.fromCharData([0,qU,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new NJ,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new xY(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new YU),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new YU),this._whitespaceCell}getBlankLine(e,t){return new TY(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>FY?FY:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=SY);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new xY(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(SY),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new TY(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new TY(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=EY(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(SY),n);if(r.length>0){let n=DY(this.lines,r);OY(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(SY),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new TY(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(SY),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=kY(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(SY,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=AY(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new MY(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},LY=class extends Y{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new X),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new IY(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new IY(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},RY=2,zY=1,BY=class extends Y{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,RY),this.rows=Math.max(e.rawOptions.rows||0,zY),this.buffers=this._register(new LY(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};BY=AU([J(0,lW)],BY);var VY={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:wJ,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},HY=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],UY=class extends Y{constructor(e){super(),this._onOptionChange=this._register(new X),this.onOptionChange=this._onOptionChange.event;let t={...VY};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(UW(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in VY))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in VY))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=VY[e],!WY(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=VY[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=HY.includes(t)?t:VY[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function WY(e){return e===`block`||e===`underline`||e===`bar`}function GY(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&GY(e[r],t-1);return n}var KY=Object.freeze({insertMode:!1}),qY=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),JY=class extends Y{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new X),this.onData=this._onData.event,this._onUserInput=this._register(new X),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new X),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=GY(KY),this.decPrivateModes=GY(qY)}reset(){this.modes=GY(KY),this.decPrivateModes=GY(qY)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};JY=AU([J(0,rW),J(1,cW),J(2,lW)],JY);var YY={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function XY(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var ZY=String.fromCharCode,QY={DEFAULT:e=>{let t=[XY(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${ZY(t[0])}${ZY(t[1])}${ZY(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${XY(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${XY(e,!0)};${e.x};${e.y}${t}`}},$Y=class extends Y{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new X),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(YY))this.addProtocol(e,YY[e]);for(let e of Object.keys(QY))this.addEncoding(e,QY[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};$Y=AU([J(0,rW),J(1,aW),J(2,lW)],$Y);var eX=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],tX=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],nX;function rX(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var iX=class{constructor(){if(this.version=`6`,!nX){nX=new Uint8Array(65536),nX.fill(1),nX[0]=0,nX.fill(0,1,32),nX.fill(0,127,160),nX.fill(2,4352,4448),nX[9001]=2,nX[9002]=2,nX.fill(2,11904,42192),nX[12351]=1,nX.fill(2,44032,55204),nX.fill(2,63744,64256),nX.fill(2,65040,65050),nX.fill(2,65072,65136),nX.fill(2,65280,65377),nX.fill(2,65504,65511);for(let e=0;e<eX.length;++e)nX.fill(0,eX[e][0],eX[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?nX[e]:rX(e,tX)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=aX.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return aX.createPropertyValue(0,n,r)}},aX=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new X,this.onChange=this._onChange.event;let e=new iX;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},oX=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function sX(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var cX=2147483647,lX=256,uX=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>lX)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>cX?cX:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>cX?cX:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,cX):e}},dX=[],fX=class{constructor(){this._state=0,this._active=dX,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=dX}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=dX,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||dX,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,UU(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=dX,this._id=-1,this._state=0}}},pX=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=UU(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},mX=[],hX=class{constructor(){this._handlers=Object.create(null),this._active=mX,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=mX}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=mX,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||mX,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,UU(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=mX,this._ident=0}},gX=new uX;gX.addParam(0);var _X=class{constructor(e){this._handler=e,this._data=``,this._params=gX,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():gX,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=UU(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=gX,this._data=``,this._hitLimit=!1,e));return this._params=gX,this._data=``,this._hitLimit=!1,t}},vX=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},yX=160,bX=function(){let e=new vX(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(yX,0,2,0),e.add(yX,8,5,8),e.add(yX,6,0,6),e.add(yX,11,0,11),e.add(yX,13,13,13),e}(),xX=class extends Y{constructor(e=bX){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new uX,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(UW(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new fX),this._dcsParser=this._register(new hX),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:yX)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<yX){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<yX){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<yX){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<yX){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<yX){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<yX){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},SX=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,ine=/^[\da-f]+$/;function CX(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=SX.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),ine.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function wX(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function TX(e,t=16){let[n,r,i]=e;return`rgb:${wX(n,t)}/${wX(r,t)}/${wX(i,t)}`}var EX={"(":0,")":1,"*":2,"+":3,"-":1,".":2},DX=131072,OX=10;function kX(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var AX=5e3,jX=0,MX=class extends Y{constructor(e,t,n,r,i,a,o,s,c=new xX){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new WU,this._utf8Decoder=new GU,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=SY.clone(),this._eraseAttrDataInternal=SY.clone(),this._onRequestBell=this._register(new X),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new X),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new X),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new X),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new X),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new X),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new X),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new X),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new X),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new NX(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Q.BEL,()=>this.bell()),this._parser.setExecuteHandler(Q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Q.BS,()=>this.backspace()),this._parser.setExecuteHandler(Q.HT,()=>this.tab()),this._parser.setExecuteHandler(Q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(wq.IND,()=>this.index()),this._parser.setExecuteHandler(wq.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(wq.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new pX(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new pX(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new pX(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new pX(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new pX(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new pX(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new pX(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new pX(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new pX(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new pX(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new pX(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new pX(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in NY)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new _X((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),AX))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${AX} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>DX&&(a=this._parseStack.position+DX)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<DX&&(this._parseBuffer=new Uint32Array(Math.min(e.length,DX))),o||this._dirtyRowTracker.clearRange(),e.length>DX)for(let t=a;t<e.length;t+=DX){let a=t+DX<e.length?t+DX:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=aX.extractWidth(t);let n=aX.extractShouldJoin(t),m=n?aX.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(HU(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof TY&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!kX(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new _X(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new pX(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(SY));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=aX.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Q.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Q.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Q.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Q.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Q.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,PY),this._charsetService.setgCharset(1,PY),this._charsetService.setgCharset(2,PY),this._charsetService.setgCharset(3,PY);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Q.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=JU.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=SY.fg,e.bg=SY.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=SY.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=SY.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=SY.fg&16777215,r.bg&=-67108864,r.bg|=SY.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Q.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=SY.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!kX(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>OX&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>OX&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(PX(n)){if(r===`?`)t.push({type:0,index:n});else{let e=CX(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=CX(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);PX(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,PY),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(EX[e[0]],NY[e[1]]||PY),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=SY.clone(),this._eraseAttrDataInternal=SY.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new XU;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Q.ESC}${e}${Q.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},NX=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(jX=e,e=t,t=jX),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};NX=AU([J(0,rW)],NX);function PX(e){return 0<=e&&e<256}var FX=5e7,IX=12,LX=50,RX=class extends Y{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>FX)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=IX?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=IX)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>LX&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},zX=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};zX=AU([J(0,rW)],zX);var BX=!1,VX=class extends Y{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new KW),this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onData=this._register(new X),this.onData=this._onData.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new X),this._instantiationService=new gY,this.optionsService=this._register(new UY(e)),this._instantiationService.setService(lW,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(BY)),this._instantiationService.setService(rW,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(yY)),this._instantiationService.setService(cW,this._logService),this.coreService=this._register(this._instantiationService.createInstance(JY)),this._instantiationService.setService(aW,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance($Y)),this._instantiationService.setService(iW,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(aX)),this._instantiationService.setService(dW,this.unicodeService),this._charsetService=this._instantiationService.createInstance(oX),this._instantiationService.setService(oW,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(zX),this._instantiationService.setService(uW,this._oscLinkService),this._inputHandler=this._register(new MX(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register($W.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register($W.forward(this._bufferService.onResize,this._onResize)),this._register($W.forward(this.coreService.onData,this._onData)),this._register($W.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new RX((e,t)=>this._inputHandler.parse(e,t))),this._register($W.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new X),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!BX&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),BX=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,RY),t=Math.max(t,zY),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(sX.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(sX(this._bufferService),!1))),this._windowsWrappingHeuristics.value=UW(()=>{for(let t of e)t.dispose()})}}},HX={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function UX(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?Q.ESC+`OA`:Q.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?Q.ESC+`OD`:Q.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?Q.ESC+`OC`:Q.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?Q.ESC+`OB`:Q.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Q.DEL,e.altKey&&(i.key=Q.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Q.ESC+`[Z`;break}i.key=Q.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Q.ESC+Q.CR:Q.CR,i.cancel=!0;break;case 27:i.key=Q.ESC,e.altKey&&(i.key=Q.ESC+Q.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`D`:t?Q.ESC+`OD`:Q.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`C`:t?Q.ESC+`OC`:Q.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`A`:t?Q.ESC+`OA`:Q.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`B`:t?Q.ESC+`OB`:Q.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Q.ESC+`[2~`);break;case 46:i.key=a?Q.ESC+`[3;`+(a+1)+`~`:Q.ESC+`[3~`;break;case 36:i.key=a?Q.ESC+`[1;`+(a+1)+`H`:t?Q.ESC+`OH`:Q.ESC+`[H`;break;case 35:i.key=a?Q.ESC+`[1;`+(a+1)+`F`:t?Q.ESC+`OF`:Q.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?Q.ESC+`[5;`+(a+1)+`~`:Q.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?Q.ESC+`[6;`+(a+1)+`~`:Q.ESC+`[6~`;break;case 112:i.key=a?Q.ESC+`[1;`+(a+1)+`P`:Q.ESC+`OP`;break;case 113:i.key=a?Q.ESC+`[1;`+(a+1)+`Q`:Q.ESC+`OQ`;break;case 114:i.key=a?Q.ESC+`[1;`+(a+1)+`R`:Q.ESC+`OR`;break;case 115:i.key=a?Q.ESC+`[1;`+(a+1)+`S`:Q.ESC+`OS`;break;case 116:i.key=a?Q.ESC+`[15;`+(a+1)+`~`:Q.ESC+`[15~`;break;case 117:i.key=a?Q.ESC+`[17;`+(a+1)+`~`:Q.ESC+`[17~`;break;case 118:i.key=a?Q.ESC+`[18;`+(a+1)+`~`:Q.ESC+`[18~`;break;case 119:i.key=a?Q.ESC+`[19;`+(a+1)+`~`:Q.ESC+`[19~`;break;case 120:i.key=a?Q.ESC+`[20;`+(a+1)+`~`:Q.ESC+`[20~`;break;case 121:i.key=a?Q.ESC+`[21;`+(a+1)+`~`:Q.ESC+`[21~`;break;case 122:i.key=a?Q.ESC+`[23;`+(a+1)+`~`:Q.ESC+`[23~`;break;case 123:i.key=a?Q.ESC+`[24;`+(a+1)+`~`:Q.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Q.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Q.DEL:e.keyCode===219?i.key=Q.ESC:e.keyCode===220?i.key=Q.FS:e.keyCode===221&&(i.key=Q.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=HX[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Q.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Q.ESC+n}else if(e.keyCode===32)i.key=Q.ESC+(e.ctrlKey?Q.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Q.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Q.US),e.key===`@`&&(i.key=Q.NUL))}return i}var WX=0,GX=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new NJ,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new NJ,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(WX=this._search(t),WX===-1)||this._getKey(this._array[WX])!==t)return!1;do if(this._array[WX]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(WX),!0;while(++WX<this._array.length&&this._getKey(this._array[WX])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(WX=this._search(e),!(WX<0||WX>=this._array.length)&&this._getKey(this._array[WX])===e))do yield this._array[WX];while(++WX<this._array.length&&this._getKey(this._array[WX])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(WX=this._search(e),!(WX<0||WX>=this._array.length)&&this._getKey(this._array[WX])===e))do t(this._array[WX]);while(++WX<this._array.length&&this._getKey(this._array[WX])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},KX=0,qX=0,JX=class extends Y{constructor(){super(),this._decorations=new GX(e=>e?.marker.line),this._onDecorationRegistered=this._register(new X),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new X),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(UW(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new YX(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{KX=t.options.x??0,qX=KX+(t.options.width??1),e>=KX&&e<qX&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},YX=class extends GW{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new X),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new X),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?Pq.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?Pq.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},XX=1e3,ZX=class{constructor(e,t=XX){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},QX=20,$X=class extends Y{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new ZX(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
1547
1547
  `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Z(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(UW(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<QX+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
1548
1548
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===QX+1&&(this._liveRegion.textContent+=PU.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};$X=AU([J(1,sW),J(2,gW),J(3,vW)],$X);var eZ=class extends Y{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new X),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new X),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(UW(()=>{VW(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Z(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Z(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(Z(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(Z(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&tZ(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,VW(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};eZ=AU([J(1,_W),J(2,vW),J(3,rW),J(4,SW)],eZ);function tZ(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var nZ=class extends VX{constructor(e={}){super(e),this._linkifier=this._register(new KW),this.browser=gJ,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new KW),this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new X),this.onKey=this._onKey.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new X),this.onBell=this._onBell.event,this._onFocus=this._register(new X),this._onBlur=this._register(new X),this._onA11yCharEmitter=this._register(new X),this._onA11yTabEmitter=this._register(new X),this._onWillOpen=this._register(new X),this._setup(),this._decorationService=this._instantiationService.createInstance(JX),this._instantiationService.setService(fW,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(dJ),this._instantiationService.setService(SW,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(pW)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register($W.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register($W.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register($W.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register($W.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(UW(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=Nq.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Q.ESC}]${n};${TX(r)}${Tq.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=Mq.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=Mq.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($X,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(Z(this.element,`copy`,e=>{this.hasSelection()&&LU(e,this._selectionService)}));let e=e=>RU(e,this.textarea,this.coreService,this.optionsService);this._register(Z(this.textarea,`paste`,e)),this._register(Z(this.element,`paste`,e)),bJ?this._register(Z(this.element,`mousedown`,e=>{e.button===2&&VU(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Z(this.element,`contextmenu`,e=>{VU(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),OJ&&this._register(Z(this.element,`auxclick`,e=>{e.button===1&&BU(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Z(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(Z(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(Z(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(Z(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(Z(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(Z(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(Z(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(Z(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,MU.get()),kJ||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(lJ,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(gW,this._coreBrowserService),this._register(Z(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(Z(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(aJ,this._document,this._helperContainer),this._instantiationService.setService(hW,this._charSizeService),this._themeService=this._instantiationService.createInstance(pY),this._instantiationService.setService(xW,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Bq),this._instantiationService.setService(bW,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(FJ,this.rows,this.screenElement)),this._instantiationService.setService(vW,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(Eq,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(mJ),this._instantiationService.setService(_W,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(eZ,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(_q,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(rY,this.element,this.screenElement,r)),this._instantiationService.setService(yW,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register($W.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(vq,this.screenElement)),this._register(Z(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($X,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Cq,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Cq,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(iJ,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Z(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(Z(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Q.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){zU(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=UX(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Q.ETX||n.key===Q.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(rZ(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(SY));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Q.ESC+`[I`):this.coreService.triggerDataEvent(Q.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function rZ(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var iZ=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},aZ=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new XU)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},oZ=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new aZ(t)}getNullCell(){return new XU}},sZ=class extends Y{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new X),this.onBufferChange=this._onBufferChange.event,this._normal=new oZ(this._core.buffers.normal,`normal`),this._alternate=new oZ(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},cZ=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},lZ=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},uZ=[`cols`,`rows`],dZ=0,fZ=class extends Y{constructor(e){super(),this._core=this._register(new nZ(e)),this._addonManager=this._register(new iZ),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(uZ.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new cZ(this._core),this._parser}get unicode(){return this._checkProposedApi(),new lZ(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new sZ(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
1549
1549
  `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return MU.get()},set promptLabel(e){MU.set(e)},get tooMuchOutput(){return PU.get()},set tooMuchOutput(e){PU.set(e)}}}_verifyIntegers(...e){for(dZ of e)if(dZ===1/0||isNaN(dZ)||dZ%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(dZ of e)if(dZ&&(dZ===1/0||isNaN(dZ)||dZ%1!=0||dZ<0))throw Error(`This API only accepts positive integers`)}},pZ=Object.defineProperty,mZ=Object.getOwnPropertyDescriptor,hZ=(e,t,n,r)=>{for(var i=r>1?void 0:r?mZ(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&pZ(t,n,i),i},gZ=(e,t)=>(n,r)=>t(n,r,e),_Z=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?SZ.isErrorNoTelemetry(e)?new SZ(e.message+`
@@ -1611,5 +1611,5 @@ out vec4 outColor;
1611
1611
 
1612
1612
  void main() {
1613
1613
  outColor = v_color;
1614
- }`,e1=8,t1=e1*Float32Array.BYTES_PER_ELEMENT,n1=20*e1,r1=class{constructor(){this.attributes=new Float32Array(n1),this.count=0}},i1=0,a1=0,o1=0,s1=0,c1=0,l1=0,u1=0,d1=class extends IZ{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new r1,this._verticesCursor=new r1;let i=this._gl;this._program=iQ(A$(i,Q$,$$)),this._register(NZ(()=>i.deleteProgram(this._program))),this._projectionLocation=iQ(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(NZ(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(NZ(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=iQ(i.createBuffer()),this._register(NZ(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,t1,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,t1,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,t1,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,k$),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*K$,d=e.cells[u+q$],f=e.cells[u+J$],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*e1,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*e1,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*e1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*e1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*e1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*e1,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:i1=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:i1=(n&16777215)<<8;break;case 0:default:i1=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:i1=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:i1=(r&16777215)<<8;break;case 0:default:i1=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=M$(e.attributes,this._terminal.rows*this._terminal.cols*e1)),a1=i*this._dimensions.device.cell.width,o1=o*this._dimensions.device.cell.height,s1=(i1>>24&255)/255,c1=(i1>>16&255)/255,l1=(i1>>8&255)/255,u1=1,this._addRectangle(e.attributes,t,a1,o1,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,s1,c1,l1,u1)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},f1=class extends IZ{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(NZ(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=iQ(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=S$(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=wQ,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},p1=class extends f1{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&b$(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},m1=typeof window==`object`?window:globalThis,h1=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new c$,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new c$,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};h1.INSTANCE=new h1;var g1=h1;function _1(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}g1.INSTANCE.onDidChangeZoomLevel,g1.INSTANCE.onDidChangeFullscreen;var v1=typeof navigator==`object`?navigator.userAgent:``;v1.indexOf(`Firefox`);var y1=v1.indexOf(`AppleWebKit`)>=0;!(v1.indexOf(`Chrome`)>=0)&&v1.indexOf(`Safari`),v1.indexOf(`Electron/`),v1.indexOf(`Android`);var b1=!1;if(typeof m1.matchMedia==`function`){let e=m1.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=m1.matchMedia(`(display-mode: fullscreen)`);b1=e.matches,_1(m1,e,({matches:e})=>{b1&&t.matches||(b1=e)})}function x1(){return b1}var S1=`en`,C1=!1,w1=!1,T1=!1,E1=S1,D1,O1=globalThis,k1;typeof O1.vscode<`u`&&typeof O1.vscode.process<`u`?k1=O1.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(k1=process);var A1=typeof k1?.versions?.electron==`string`&&k1?.type===`renderer`;if(typeof k1==`object`){k1.platform,k1.platform,C1=k1.platform===`linux`,C1&&k1.env.SNAP&&k1.env.SNAP_REVISION,k1.env.CI||k1.env.BUILD_ARTIFACTSTAGINGDIRECTORY,E1=S1;let e=k1.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,E1=t.resolvedLanguage||S1,t.languagePack?.translationsConfigFile}catch{}w1=!0}else typeof navigator==`object`&&!A1?(D1=navigator.userAgent,D1.indexOf(`Windows`),D1.indexOf(`Macintosh`),(D1.indexOf(`Macintosh`)>=0||D1.indexOf(`iPad`)>=0||D1.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,C1=D1.indexOf(`Linux`)>=0,D1?.indexOf(`Mobi`),T1=!0,E1=globalThis._VSCODE_NLS_LANGUAGE||S1,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var j1=w1;T1&&typeof O1.importScripts==`function`&&O1.origin;var M1=D1,N1=E1,P1;(e=>{function t(){return N1}e.value=t;function n(){return N1.length===2?N1===`en`:N1.length>=3&&N1[0]===`e`&&N1[1]===`n`&&N1[2]===`-`}e.isDefaultVariant=n;function r(){return N1===`en`}e.isDefault=r})(P1||={});var F1=typeof O1.postMessage==`function`&&!O1.importScripts;(()=>{if(F1){let e=[];O1.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),O1.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var I1=!!(M1&&M1.indexOf(`Chrome`)>=0);M1&&M1.indexOf(`Firefox`),!I1&&M1&&M1.indexOf(`Safari`),M1&&M1.indexOf(`Edg/`),M1&&M1.indexOf(`Android`);var L1=typeof navigator==`object`?navigator:{};j1||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||L1&&L1.clipboard&&L1.clipboard.writeText,j1||L1&&L1.clipboard&&L1.clipboard.readText,j1||x1()||L1.keyboard,`ontouchstart`in m1||L1.maxTouchPoints,m1.PointerEvent&&(`ontouchstart`in m1||navigator.maxTouchPoints);var R1=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},z1=new R1,B1=new R1,V1=new R1;Array(230);var H1;(e=>{function t(e){return z1.keyCodeToStr(e)}e.toString=t;function n(e){return z1.strToKeyCode(e)}e.fromString=n;function r(e){return B1.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return V1.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return B1.strToKeyCode(e)||V1.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return z1.keyCodeToStr(e)}e.toElectronAccelerator=o})(H1||={});var U1=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),W1;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof G1?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:YQ.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:U1})})(W1||={});var G1=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?U1:(this._emitter||=new c$,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var K1;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(K1||={});var q1=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new c$,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await YQ.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};q1.EMPTY=q1.fromArray([]);function J1(e){return Y1(e,0)}function Y1(e,t){switch(typeof e){case`object`:return e===null?X1(349,t):Array.isArray(e)?$1(e,t):e0(e,t);case`string`:return Q1(e,t);case`boolean`:return Z1(e,t);case`number`:return X1(e,t);case`undefined`:return X1(937,t);default:return X1(617,t)}}function X1(e,t){return(t<<5)-t+e|0}function Z1(e,t){return X1(e?433:863,t)}function Q1(e,t){t=X1(149417,t);for(let n=0,r=e.length;n<r;n++)t=X1(e.charCodeAt(n),t);return t}function $1(e,t){return t=X1(104579,t),e.reduce((e,t)=>Y1(t,e),t)}function e0(e,t){return t=X1(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Q1(n,t),Y1(e[n],t)),t)}var{registerWindow:ane,getWindow:t0,getDocument:one,getWindows:sne,getWindowsCount:cne,getWindowId:lne,getWindowById:une,hasWindow:dne,onDidRegisterWindow:fne,onWillUnregisterWindow:pne,onDidUnregisterWindow:mne}=function(){let e=new Map,t={window:m1,disposables:new FZ};e.set(m1.vscodeWindowId,t);let n=new c$,r=new c$,i=new c$;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return IZ.None;let a=new FZ,o={window:t,disposables:a.add(new FZ)};return e.set(t.vscodeWindowId,o),a.add(NZ(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(r0(t,a0.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:m1},getDocument(e){return t0(e).document}}}(),n0=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function r0(e,t,n,r){return new n0(e,t,n,r)}var i0=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};i0.None=new i0(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=J1(n),a=r.get(i);if(a)a.users+=1;else{let o=new c$,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(NZ(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var a0={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:y1?`webkitAnimationStart`:`animationstart`,ANIMATION_END:y1?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:y1?`webkitAnimationIteration`:`animationiteration`},o0=class extends IZ{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new LZ,this._charAtlasDisposable=this._register(new LZ),this._observerDisposable=this._register(new LZ),this._model=new Z$,this._workCell=new O$,this._workCell2=new O$,this._rectangleRenderer=this._register(new LZ),this._glyphRenderer=this._register(new LZ),this._onChangeTextureAtlas=this._register(new c$),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new c$),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new c$),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new c$),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new c$),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new SQ(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new p1(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=fQ(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(r0(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(r0(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,C$(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=E$(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=E$(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(NZ(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),C$(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new d1(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new U$(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=S$(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=MZ(YQ.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),YQ.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new T$(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=c0(e,n.rows-1,0),t=c0(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,ee=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),te=-1,ne=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let w=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||ee<p[0]||ee>=p[1],d?(l=!0,r=new s0(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*K$,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),ne&&o===S&&(y===ee&&(this._model.cursor={x:ee,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},te=ee+r.getWidth()-1),y>=ee&&y<=te&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+q$]!==this._cellColorResolver.result.bg||this._model.cells[v+J$]!==this._cellColorResolver.result.fg||this._model.cells[v+Y$]!==this._cellColorResolver.result.ext)&&(w=!0,h.length>1&&(g|=X$),this._model.cells[v]=g,this._model.cells[v+q$]=this._cellColorResolver.result.bg,this._model.cells[v+J$]=this._cellColorResolver.result.fg,this._model.cells[v+Y$]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*K$,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,GZ,0,0),this._model.cells[b]=0,this._model.cells[b+q$]=this._cellColorResolver.result.bg,this._model.cells[b+J$]=this._cellColorResolver.result.fg,this._model.cells[b+Y$]=this._cellColorResolver.result.ext;y--}}w&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},s0=class extends WQ{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function c0(e,t,n=0){return Math.max(Math.min(e,t),n)}var l0=`di$target`,u0=`di$dependencies`,d0=new Map;function f0(e){if(d0.has(e))return d0.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);p0(t,e,r)};return t._id=e,d0.set(e,t),t}function p0(e,t,n){t[l0]===t?t[u0].push({id:e,index:n}):(t[u0]=[{id:e,index:n}],t[l0]=t)}f0(`BufferService`),f0(`CoreMouseService`),f0(`CoreService`),f0(`CharsetService`),f0(`InstantiationService`),f0(`LogService`);var m0=f0(`OptionsService`);f0(`OscLinkService`),f0(`UnicodeService`),f0(`DecorationService`);var h0={trace:0,debug:1,info:2,warn:3,error:4,off:5},g0=`xterm.js: `,_0=class extends IZ{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),v0=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=h0[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:g0)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};_0=hZ([gZ(0,m0)],_0);var v0,y0=class extends IZ{constructor(e){if(UZ&&WZ()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new c$),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new c$),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new c$),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new c$),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new o0(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(YQ.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(YQ.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(YQ.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(YQ.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(NZ(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},b0=2,x0=1,S0=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(b0,Math.floor(u/e.css.cell.width)),rows:Math.max(x0,Math.floor(l/e.css.cell.height))}}},C0=`3.7.8`,w0=C0,T0=typeof Buffer==`function`,E0=typeof TextDecoder==`function`?new TextDecoder:void 0,D0=typeof TextEncoder==`function`?new TextEncoder:void 0,O0=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),k0=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(O0),A0=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,j0=String.fromCharCode.bind(String),M0=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),N0=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),P0=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),F0=e=>{let t,n,r,i,a=``,o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`invalid character found`);t=n<<16|r<<8|i,a+=O0[t>>18&63]+O0[t>>12&63]+O0[t>>6&63]+O0[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},I0=typeof btoa==`function`?e=>btoa(e):T0?e=>Buffer.from(e,`binary`).toString(`base64`):F0,L0=T0?e=>Buffer.from(e).toString(`base64`):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(j0.apply(null,e.subarray(n,n+4096)));return I0(t.join(``))},R0=(e,t=!1)=>t?N0(L0(e)):L0(e),z0=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?j0(192|t>>>6)+j0(128|t&63):j0(224|t>>>12&15)+j0(128|t>>>6&63)+j0(128|t&63)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return j0(240|t>>>18&7)+j0(128|t>>>12&63)+j0(128|t>>>6&63)+j0(128|t&63)},B0=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,V0=e=>e.replace(B0,z0),H0=T0?e=>Buffer.from(e,`utf8`).toString(`base64`):D0?e=>L0(D0.encode(e)):e=>I0(V0(e)),U0=(e,t=!1)=>t?N0(H0(e)):H0(e),W0=e=>U0(e,!0),G0=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,K0=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return j0((t>>>10)+55296)+j0((t&1023)+56320);case 3:return j0((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return j0((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},q0=e=>e.replace(G0,K0),J0=e=>{if(e=e.replace(/\s+/g,``),!A0.test(e))throw TypeError(`malformed base64.`);e+=`==`.slice(2-(e.length&3));let t,n,r,i=[];for(let a=0;a<e.length;)t=k0[e.charAt(a++)]<<18|k0[e.charAt(a++)]<<12|(n=k0[e.charAt(a++)])<<6|(r=k0[e.charAt(a++)]),n===64?i.push(j0(t>>16&255)):r===64?i.push(j0(t>>16&255,t>>8&255)):i.push(j0(t>>16&255,t>>8&255,t&255));return i.join(``)},Y0=typeof atob==`function`?e=>atob(P0(e)):T0?e=>Buffer.from(e,`base64`).toString(`binary`):J0,X0=T0?e=>M0(Buffer.from(e,`base64`)):e=>M0(Y0(e).split(``).map(e=>e.charCodeAt(0))),Z0=e=>X0($0(e)),Q0=T0?e=>Buffer.from(e,`base64`).toString(`utf8`):E0?e=>E0.decode(X0(e)):e=>q0(Y0(e)),$0=e=>P0(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),e2=e=>Q0($0(e)),t2=e=>{if(typeof e!=`string`)return!1;let t=e.replace(/\s+/g,``).replace(/={0,2}$/,``);return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},n2=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),r2=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,n2(t));e(`fromBase64`,function(){return e2(this)}),e(`toBase64`,function(e){return U0(this,e)}),e(`toBase64URI`,function(){return U0(this,!0)}),e(`toBase64URL`,function(){return U0(this,!0)}),e(`toUint8Array`,function(){return Z0(this)})},i2=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,n2(t));e(`toBase64`,function(e){return R0(this,e)}),e(`toBase64URI`,function(){return R0(this,!0)}),e(`toBase64URL`,function(){return R0(this,!0)})},a2={version:C0,VERSION:w0,atob:Y0,atobPolyfill:J0,btoa:I0,btoaPolyfill:F0,fromBase64:e2,toBase64:U0,encode:U0,encodeURI:W0,encodeURL:W0,utob:V0,btou:q0,decode:e2,isValid:t2,fromUint8Array:R0,toUint8Array:Z0,extendString:r2,extendUint8Array:i2,extendBuiltins:()=>{r2(),i2()}},o2=class{constructor(e=new c2,t=new s2){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,e=>this._setOrReportClipboard(e))}dispose(){return this._disposable?.dispose()}_readText(e,t){let n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${n}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(`;`);if(t.length<2)return!0;let n=t[0],r=t[1];if(r===`?`){let e=this._provider.readText(n);return e instanceof Promise?e.then(e=>(this._readText(n,e),!0)):(this._readText(n,e),!0)}let i=``;try{i=this._base64.decodeText(r)}catch{}let a=this._provider.writeText(n,i);return a instanceof Promise?a.then(()=>!0):!0}},s2=class{async readText(e){return e===`c`?navigator.clipboard.readText():Promise.resolve(``)}async writeText(e,t){return e===`c`?navigator.clipboard.writeText(t):Promise.resolve()}},c2=class{encodeText(e){return a2.encode(e)}decodeText(e){let t=a2.decode(e);return!a2.isValid(e)||a2.encode(t)!==e?``:t}},l2=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=d2.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function u2(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var d2=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!u2(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},f2=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function p2(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var m2=class{constructor(e=p2,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||f2;this._linkProvider=this._terminal.registerLinkProvider(new l2(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}};function h2(e,t){let{term:n,write:r}=e,i=new TextEncoder,a=null,o=0,s=!1,c=null,l=()=>{if(s)return;let i=location.protocol===`https:`?`wss`:`ws`,f=a=new WebSocket(`${i}://${location.host}/term/${e.sessionId}?cols=${n.cols}&rows=${n.rows}&visible=${+!!u()}`);f.onmessage=e=>r(e.data),f.onopen=()=>{o=0,d(f),c&&=(f.send(JSON.stringify({resize:c})),null),m()},f.onclose=()=>{if(!(t.aborted||s||a!==f)){if(document.visibilityState!==`visible`){let e=()=>{document.visibilityState===`visible`&&(document.removeEventListener(`visibilitychange`,e),!t.aborted&&a===f&&l())};document.addEventListener(`visibilitychange`,e,{signal:t})}else++o<=3?setTimeout(()=>{!t.aborted&&a===f&&l()},400*o):e.onDead()}}},u=()=>document.visibilityState===`visible`&&e.isVisible(),d=e=>{e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({visible:u()}))};document.addEventListener(`visibilitychange`,()=>a&&d(a),{signal:t}),l(),t.addEventListener(`abort`,()=>a?.close());let f=[],p=0,m=()=>{for(;f.length&&a?.readyState===WebSocket.OPEN;)a.send(i.encode(f.shift()));p=0};return{send(e){a?.readyState===WebSocket.OPEN?a.send(i.encode(e)):p<1024&&(f.push(e),p+=e.length)},resize(e,t){a?.readyState===WebSocket.OPEN?a.send(JSON.stringify({resize:[e,t]})):c=[e,t]},syncVisibility(){a&&d(a)},get readyState(){return a?.readyState},reconnect(){s=!1,l()},disconnect(){s=!0,a?.close()}}}function g2(e,t,n,r){let i=null,a=0,o=0,s=0,c=0,l=n=>{let r=t().querySelector(`.xterm-screen`)||t(),i=r.clientHeight/e.rows||17;c+=n/i;let a=Math.trunc(c);if(!a)return;c-=a;let o=r.getBoundingClientRect(),s=a>0?1:-1;for(let e=0;e!==a;e+=s)r.dispatchEvent(new WheelEvent(`wheel`,{deltaY:s,deltaMode:WheelEvent.DOM_DELTA_LINE,bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2}))},u=()=>{cancelAnimationFrame(s),s=0},d=()=>{o*=.97,!(Math.abs(o)<.25)&&(l(o*16),s=requestAnimationFrame(d))};n.addEventListener(`abort`,u),t().addEventListener(`touchstart`,e=>{u(),o=0,i=e.touches[0]?.clientY??null,a=e.timeStamp},{passive:!0,signal:n}),t().addEventListener(`touchmove`,e=>{if(r?.())return;let t=e.touches[0]?.clientY;if(t==null||i==null)return;let n=i-t;Math.abs(n)>=2&&(o=n/Math.max(1,e.timeStamp-a),i=t,a=e.timeStamp,l(n)),e.preventDefault()},{passive:!1,signal:n}),t().addEventListener(`touchend`,()=>{i=null,Math.abs(o)>.5&&(u(),s=requestAnimationFrame(d))},{signal:n})}function _2(e){let t=!1,n=[],r=0;return{write(i){if(!t){e.write(i);return}for(n.push(i),r+=i.length;r>1048576&&n.length>1;)r-=n.shift().length},setFrozen(i){if(t!==i&&(t=i,!i)){let t=n.join(``);n=[],r=0,t&&e.write(t)}}}}function v2(e,t,n){let r=e.textarea;if(!r)return;let i=`\xA0`.repeat(4),a={deleteContentBackward:``,deleteWordBackward:``,deleteSoftLineBackward:``,deleteHardLineBackward:``},o=!1,s=()=>{o||(r.value!==i&&(r.value=i),r.setSelectionRange(i.length,i.length))};r.addEventListener(`beforeinput`,e=>{let n=a[e.inputType];n&&(e.preventDefault(),e.stopImmediatePropagation(),t(n))},{capture:!0,signal:n}),r.addEventListener(`compositionstart`,()=>{o=!0},{signal:n}),r.addEventListener(`compositionend`,()=>{o=!1,setTimeout(s,0)},{signal:n}),r.addEventListener(`input`,()=>setTimeout(s,0),{signal:n}),r.addEventListener(`focus`,()=>setTimeout(s,0),{signal:n}),s()}var y2=450,b2=12,x2=` ·│┃()[]{}<>'"\`,;│|`;function S2(e,t,n,r){let i=!1,a,o=0,s=0,c=null,l=null,u=()=>t().querySelector(`.xterm-screen`)||t(),d=(t,n)=>{let r=u().getBoundingClientRect();return{col:Math.max(0,Math.min(e.cols-1,Math.floor((t-r.left)/r.width*e.cols))),row:Math.max(0,Math.min(e.rows-1,Math.floor((n-r.top)/r.height*e.rows)))+e.buffer.active.viewportY}},f=t=>{let n=e.buffer.active.getLine(t.row)?.translateToString()??``,r=e=>!e||e===` `||x2.includes(e);if(r(n[t.col]))return{start:t,end:t};let i=t.col,a=t.col;for(;i>0&&!r(n[i-1]);)i--;for(;a<n.length-1&&!r(n[a+1]);)a++;return{start:{col:i,row:t.row},end:{col:a,row:t.row}}},p=(e,t)=>e.row<t.row||e.row===t.row&&e.col<=t.col,m=()=>{if(!c||!l)return;let[t,n]=p(c,l)?[c,l]:[l,c],r=(n.row-t.row)*e.cols+(n.col-t.col)+1;e.select(t.col,t.row,Math.max(1,r))},h=()=>{clearTimeout(a),a=void 0};t().addEventListener(`touchstart`,t=>{if(t.touches.length!==1){h();return}!i&&e.hasSelection()&&e.clearSelection(),o=t.touches[0].clientX,s=t.touches[0].clientY,a=setTimeout(()=>{a=void 0,i=!0,n.onStart();let e=f(d(o,s));c=e.start,l=e.end,m(),navigator.vibrate?.(10)},y2)},{passive:!0,signal:r}),t().addEventListener(`touchmove`,e=>{let t=e.touches[0];if(t){if(i){l=d(t.clientX,t.clientY),m(),e.preventDefault();return}a&&Math.hypot(t.clientX-o,t.clientY-s)>b2&&h()}},{passive:!1,signal:r});let g=()=>{if(h(),!i)return;i=!1,n.onEnd();let t=e.getSelection();t&&(navigator.clipboard?.writeText(t),n.onCopy(t))};return t().addEventListener(`touchend`,g,{signal:r}),t().addEventListener(`touchcancel`,g,{signal:r}),{selecting:()=>i}}var C2=mr,w2=(e=>`/${e}&`)(hr);function T2(e){yr(e.a,`M15 4L8 20`)}var E2=(e,t)=>_r(e.a,t),D2=(e,t)=>vr(e.a,t),O2=mr,k2=(e=>`/${e}&`)(hr);function A2(e){yr(e.a,`M7 12L17 12 M7 8L13 8 M3 20.2895V5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V15C21 16.1046 20.1046 17 19 17H7.96125C7.35368 17 6.77906 17.2762 6.39951 17.7506L4.06852 20.6643C3.71421 21.1072 3 20.8567 3 20.2895Z`)}var j2=(e,t)=>_r(e.a,t),M2=(e,t)=>vr(e.a,t),N2=mr,P2=(e=>`/${e}&`)(hr);function F2(e){yr(e.a,`M8.5 4H6C4.89543 4 4 4.89543 4 6V20C4 21.1046 4.89543 22 6 22H18C19.1046 22 20 21.1046 20 20V6C20 4.89543 19.1046 4 18 4H15.5 M8 6.4V4.5C8 4.22386 8.22386 4 8.5 4C8.77614 4 9.00422 3.77604 9.05152 3.50398C9.19968 2.65171 9.77399 1 12 1C14.226 1 14.8003 2.65171 14.9485 3.50398C14.9958 3.77604 15.2239 4 15.5 4C15.7761 4 16 4.22386 16 4.5V6.4C16 6.73137 15.7314 7 15.4 7H8.6C8.26863 7 8 6.73137 8 6.4Z`)}var I2=(e,t)=>_r(e.a,t),L2=(e,t)=>vr(e.a,t),R2=mr,z2=(e=>`/${e}&`)(hr);function B2(e){yr(e.a,`M21 3.6V20.4C21 20.7314 20.7314 21 20.4 21H3.6C3.26863 21 3 20.7314 3 20.4V3.6C3 3.26863 3.26863 3 3.6 3H20.4C20.7314 3 21 3.26863 21 3.6Z M3 16L10 13L21 18 M16 10C14.8954 10 14 9.10457 14 8C14 6.89543 14.8954 6 16 6C17.1046 6 18 6.89543 18 8C18 9.10457 17.1046 10 16 10Z`)}var V2=(e,t)=>_r(e.a,t),H2=(e,t)=>vr(e.a,t),U2=`<div class=term-wrap><div class=term></div><!><!><!><!></div><!><!>`,W2=` D b%b%b%b%l%c`,G2=400,K2=55,q2=3e4,J2=150,Y2=[[{kind:`paste`},{kind:`key`,label:`▲`,seq:`\x1B[A`},{kind:`attach`}],[{kind:`key`,label:`◀`,seq:`\x1B[D`},{kind:`key`,label:`↵`,seq:`\r`},{kind:`key`,label:`▶`,seq:`\x1B[C`}],[{kind:`key`,label:`⇥`,seq:` `},{kind:`key`,label:`▼`,seq:`\x1B[B`},{kind:`key`,label:`^C`,seq:``}]],X2=L(`o20`,e=>A(e.a,`click`,function(){e._._._.d.click()})),Z2=e=>{B2(e.b),V2(e.b,16),H2(e.b),X2(e)},Q2=L(`o19`,e=>{A(e.a,`pointerdown`,function(e){e.preventDefault()}),A(e.a,`click`,function(){e._._._._.al()})}),$2=e=>{F2(e.b),I2(e.b,16),L2(e.b),Q2(e)},e4=P(0,2,e=>{ht(e.a,{enter:e._.e===`↵`,"big-glyph":e._.e===`↵`||e._.e===`⇥`}),V(e.b,e._.e)}),t4=L(`o21`,e=>{A(e.a,`pointerdown`,function(t){t.preventDefault(),e._._._._.af(e._.f)}),A(e.a,`pointerup`,function(){e._._._._.ag()}),A(e.a,`pointercancel`,function(){e._._._._.ag()}),A(e.a,`pointerleave`,function(){e._._._._.ag()}),A(e.a,`contextmenu`,function(e){e.preventDefault()})}),n4=O(0,(e=>`<button title=Paste>${e}</button>`)(N2),(e=>` D/${e}&l`)(P2),$2,(e=>`<button title="Attach image">${e}</button>`)(R2),(e=>` D/${e}&l`)(z2),Z2,`<button class=repeat> </button>`,` D `,e=>{e4._(e),t4(e)}),r4=(e,t)=>n4(e,t===`paste`?0:t===`attach`?1:2),i4=(e,t)=>{r4(e,t[0]?.kind),a4(e,t[0]?.label),o4(e,t[0]?.seq)},a4=M(4),o4=M(5),s4=k(0,`<!><!><!>`,`b%`,0,i4),c4=(e,t)=>s4(e,[t]),l4=(e,t)=>c4(e,t[0]),u4=I(60,L(`o17`,e=>A(e.a,`click`,function(){e._._.a7?.send(`\x1B`)})),e=>e._._),d4=L(`o18`,e=>A(e.a,`pointerdown`,function(e){e.preventDefault()})),f4=e=>{u4(e),d4(e)},p4=P(5,0,L(`o8`,e=>{e._.a5&&setTimeout(()=>e.c?.focus(),50)})),m4=L(`o9`,e=>{A(e.a,`click`,function(){N3(e._,!1)}),A(e.b,`click`,function(e){e.stopPropagation()}),A(e.c,`paste`,function(t){t.preventDefault(),e._.ak(t.clipboardData)}),A(e.d,`click`,function(){N3(e._,!1)})}),h4=e=>{p4._(e),m4(e)},g4=L(`o7`,e=>A(e.a,`click`,function(){w3(e._,!1)})),_4=I(51,e=>mt(e.a,[`dot`,pr(e._._.r)]),e=>e._._),v4=e=>{_4(e),y4(e)},y4=I(57,e=>V(e.b,e._._.y),e=>e._._),b4=M(3,e=>{z(e.a,`title`,`New ${e.d} session`),qr(e.b,e.d)}),x4=L(`o15`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._.p?.(e.d)})),S4=e=>{e.b,Gr(e.b,15),Jr(e.b),x4(e)},C4=(e,t)=>b4(e,t[0]),w4=N(1,e=>{B(e.a,`armed`,e._._._.g===e._.j),z(e.a,`title`,e._._._.g===e._.j?`Really kill this session?`:`Kill session`)}),T4=I(8,w4,e=>e._._._),E4=L(`o13`,e=>A(e.a,`click`,function(t,n){e._._._.g===e._.j?(J4(e._._._,null),n.closest(`[popover]`)?.hidePopover(),e._._._._._.w?.(e._.j)):J4(e._._._,e._.j)})),D4=e=>{T4(e),O4._(e),E4(e)},O4=P(6,0,w4),k4=L(`o12`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._._._.v?.(e._.j)})),A4=e=>{If(e.b),Lf(e.b,12),Rf(e.b),k4(e)},j4=N(10,e=>B(e.a,`current`,e.j===e._._._._.t)),M4=I(53,j4,e=>e._._._._),N4=L(`o14`,e=>A(e.b,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e.j!==e._._._._.t&&e._._._._.u?.(e.j)})),P4=e=>{M4(e),I4(e),R4(e),e.d,Gr(e.d,14),Jr(e.d),N4(e)},F4=O(5,(e=>`<button class="sess-x sess-edit" title="Rename session">${e}</button>`)(Pf),(e=>` D/${e}&l`)(Ff),A4),I4=I(54,e=>F4(e,+!e._._._._.v),e=>e._._._._),L4=O(6,`<button class=sess-x>×</button>`,` `,D4),R4=I(55,e=>L4(e,+!e._._._._.w),e=>e._._._._),z4=M(9,e=>{j4(e),O4(e)}),B4=(e,t)=>mt(e.c,[`dot`,pr(t)]),V4=N(14,e=>V(e.e,e.n||e.m)),H4=M(12,e=>{qr(e.d,e.m),V4(e)}),U4=M(13,V4),W4=k(0,(e=>`<div class=sess-row><button class=sess-open><span></span>${e}<span class=sess-title> </span></button><!><!></div>`)(Fr),(e=>` D D b/${e}&D m%b%l`)(`b%c`),P4,(e,t)=>{z4(e,t[0]?.id),B4(e,t[0]?.state),H4(e,t[0]?.agent),U4(e,t[0]?.title)}),G4=I(52,e=>W4(e,[e._._._.s||[],`id`]),e=>e._._._),K4=G4,q4=I(50,e=>qr(e.b,e._._.q||`shell`),e=>e._._),J4=j(6,F(T4)),Y4=(e,t)=>{z(e.a,`popovertarget`,t),z(e.d,`id`,t)},X4=L(`o16`,e=>A(e.d,`toggle`,function(t,n){if(J4(e,null),t.newState===`open`){let t=e.a.getBoundingClientRect();n.style.top=`${Math.max(8,t.top-n.offsetHeight-8)}px`,n.style.left=`${Math.max(8,Math.min(t.left+t.width/2-n.offsetWidth/2,window.innerWidth-n.offsetWidth-8))}px`}})),Z4=e=>{q4(e),Q4(e),e3(e),n3(e),e.b,Gr(e.b,16),Jr(e.b),J4(e,null),Y4(e,Xe(e)),X4(e)},Q4=I(51,e=>mt(e.c,[`dot`,`sess-dot`,pr(e._._.r)]),e=>e._._),$4=O(4,`<!><!><!>`,`b%`,K4),e3=I(52,e=>{B(e.f,`lone`,(e._._.s||[]).length<=1),$4(e,(e._._.s||[]).length>1?0:1)},e=>e._._),t3=k(5,(e=>`<button class=icon-btn>${e}</button>`)(Fr),(e=>` D/${e}&l`)(`b%c`),S4,C4),n3=I(56,e=>t3(e,[[...e._._.x||[],`shell`],e=>e]),e=>e._._),r3=L(`o11`,e=>{A(e.a,`click`,function(){e._._.m?.()}),A(e.c,`click`,function(){e._._.n?.()}),A(e.e,`click`,function(){e._._.o?.()})}),i3=e=>{Qm(e.b),$m(e.b,16),eh(e.b),Dr(e.d),Or(e.d,16),kr(e.d),Sr(e.f),Cr(e.f,16),wr(e.f),r3(e)},a3=L(`o10`,e=>A(e.a,`click`,function(){e._._.l?.()})),o3=O(0,(e=>`<button class="icon-btn kbtn" title="Back to terminal">${e}</button>`)(K_),(e=>` D/${e}&l`)(q_),e=>{J_(e.b),Y_(e.b,16),X_(e.b),a3(e)},((e,t,n)=>`<button class="icon-btn kbtn" title=Workspaces>${e}</button><button class="icon-btn kbtn" title="Manage workspace">${t}</button><button class="icon-btn kbtn" title="Review changes">${n}</button>`)(Xm,Tr,br),((e,t,n)=>` D/${e}&l D/${t}&l D/${n}&l`)(Zm,Er,xr),i3),s3=O(8,`<button class="icon-btn kbtn kbtn-esc" title=Escape>esc</button>`,` `,f4),c3=O(1,(e=>`<button class="icon-btn kbtn sess-btn" title=Sessions>${e}<span></span></button><div popover=auto class=sess-pop><!><div class=sess-new></div></div>`)(Fr),(e=>` D/${e}& l D%b l`)(`b%c`),Z4),l3=N(11,e=>c3(e,e._.k!==`diff`&&e._.p?0:1)),u3=P(6,0,e=>{o3(e,e._.k===`diff`?0:1),s3(e,+(e._.k===`diff`)),l3(e)}),d3=(e,t)=>{z(e.e,`popovertarget`,t),z(e.j,`id`,t)},f3=k(9,`<!><!><!>`,`b%`,0,l4),p3=L(`o23`,e=>{A(e.d,`change`,function(t,n){for(let t of n.files||[])e._.ah(t);n.value=``}),A(e.e,`pointerdown`,function(e){e.preventDefault()}),A(e.g,`pointerdown`,function(e){e.preventDefault()}),A(e.j,`pointerdown`,function(e){e.preventDefault()}),A(e.j,`toggle`,function(t,n){if(t.newState===`open`){let t=e.e.getBoundingClientRect();n.style.top=`${Math.max(8,t.top-n.offsetHeight-8)}px`,n.style.bottom=`auto`}})}),m3=e=>{u3._(e),h3._(e),_3._(e),v3._(e),y3._(e),T2(e.f),E2(e.f,16),D2(e.f),A2(e.h),j2(e.h,16),M2(e.h),d3(e,Xe(e)),f3(e,[Y2]),p3(e)},h3=P(6,0,l3),g3=O(2,`<span class="kbar-ws dim" aria-hidden=true><span></span><span class=kbar-ws-name> </span></span>`,`D bD `,v4),_3=P(6,0,e=>g3(e,+!e._.y)),v3=P(6,0,e=>{B(e.g,`on`,e._.a1),z(e.g,`title`,e._.a1?`Hide keyboard`:`Show keyboard`)}),y3=P(6,0,L(`o22`,e=>A(e.g,`click`,function(){T3(e._,!e._.a1),e._.a7?.setKeyboard(e._.a1)}))),b3=$e(`o6`,1),x3=Qe(42),S3=O(4,`<div class=term-dead><button class="btn primary">Reconnect</button></div>`,`D `,g4),C3=N(45,L(`o24`,e=>Tt(e,{onMount:function(){let t=new AbortController,n=t.signal,r=new fZ({fontSize:13,fontFamily:`ui-monospace, monospace`,scrollback:5e3,allowProposedApi:!0,linkHandler:{activate(e,t){cr(t)}}}),i=new S0;r.loadAddon(i),r.open(e.b);let a=ar();try{let e=new y0;e.onContextLoss(()=>e.dispose()),r.loadAddon(e)}catch{}try{r.loadAddon(new o2)}catch{}r.loadAddon(new m2((e,t)=>cr(t))),i.fit();let o=a?_2(r):null,s=o?o.write:e=>r.write(e),c=h2({sessionId:e.t,term:r,write:s,onDead:()=>{w3(e,!0)},isVisible:()=>!!e.z},n);r.onData(e=>c.send(e)),r.attachCustomKeyEventHandler(t=>t.key===`Enter`&&t.shiftKey?(t.type===`keydown`&&c.send(`\x1B\r`),!1):(t.ctrlKey||t.metaKey)&&!t.shiftKey&&t.key===`c`&&r.hasSelection()?(t.type===`keydown`&&(navigator.clipboard?.writeText(r.getSelection()),r.clearSelection(),e.ab()),!1):!(a&&t.type===`keydown`&&t.key===`Backspace`));let l=()=>{if(!e.b.clientWidth)return;let t=i.proposeDimensions();!t||t.cols===r.cols&&t.rows===r.rows||(i.fit(),c.resize(r.cols,r.rows))},u=new ResizeObserver(l);u.observe(e.b),n.addEventListener(`abort`,()=>u.disconnect());let d=()=>requestAnimationFrame(l);if(document.addEventListener(`visibilitychange`,()=>{document.hidden||d()},{signal:n}),window.addEventListener(`pageshow`,d,{signal:n}),window.addEventListener(`focus`,d,{signal:n}),window.visualViewport?.addEventListener(`resize`,d,{signal:n}),e.b.addEventListener(`paste`,t=>{let n=[...t.clipboardData?.files||[]];if(n.length){t.preventDefault(),t.stopImmediatePropagation();for(let t of n)e.ah(t)}},{capture:!0,signal:n}),e.a7={send(e){c.send(e)},setKeyboard(e){let t=r.textarea;t&&(t.inputMode=e?`text`:`none`,e?(t.focus(),setTimeout(()=>{document.activeElement!==t&&t.focus()},50)):t.blur())}},a){r.textarea&&(r.textarea.inputMode=`none`);let t=window.visualViewport;if(t){let i=0,a=()=>{i=Math.max(i,t.height),e.a1&&i-t.height<J2&&(T3(e,!1),r.textarea&&(r.textarea.inputMode=`none`))};a(),t.addEventListener(`resize`,a,{signal:n}),window.addEventListener(`orientationchange`,()=>{i=0},{signal:n})}let i=S2(r,b3(e),{onStart(){o?.setFrozen(!0)},onEnd(){o?.setFrozen(!1)},onCopy(){e.ab()}},n);g2(r,b3(e),n,i.selecting),v2(r,e=>c.send(e),n)}e.z&&!a&&r.focus();let f={term:r,socket:c,abort:t,suspend:void 0};return e.z||(f.suspend=setTimeout(()=>c.disconnect(),q2)),f},onUpdate:function(){clearTimeout(this.suspend),this.socket.syncVisibility(),e.z?(!e.a0&&this.socket.readyState>=WebSocket.CLOSING&&(this.term.reset(),this.socket.reconnect()),!e.a0&&!e.a2&&this.term.focus()):this.suspend=setTimeout(()=>this.socket.disconnect(),q2)},onDestroy:function(){clearTimeout(this.suspend),this.abort.abort(),this.term.dispose()}})),7),w3=j(26,e=>{S3(e,+!e.a0),C3(e)}),T3=j(27,e=>{C3(e),v3(e)}),E3=O(6,((e,t)=>`<div class=kb-slot><div class=key-bar><!><div class=kspacer></div><!><input type=file accept=image/* hidden><button class="icon-btn kbtn dpad-btn" title="More keys">${e}</button><button class="icon-btn kbtn kb-toggle">${t}</button><!><div popover=auto class=dpad-grid></div></div></div>`)(C2,O2),((e,t)=>`E%b b%b b D/${e}&l D/${t}&l%b m`)(w2,k2),m3),D3=j(28,e=>{E3(e,+!e.a2),C3(e)}),O3=O(2,`<div class="term-uploading dim">uploading…</div>`),k3=j(29,e=>O3(e,+!e.a3)),A3=O(3,`<div class=term-copied>Copied</div>`),j3=j(30,e=>A3(e,+!e.a4)),M3=O(5,`<div class=trap-backdrop><div class=paste-trap><p class=dim>Long-press below and choose Paste</p><input placeholder="Paste here…"><button class=btn>Cancel</button></div></div>`,` D Db b `,h4),N3=j(31,e=>{M3(e,+!e.a5),p4(e)}),P3=(e,t)=>K3(e,t.current),F3=(e,t)=>J3(e,t.timer),I3=(e,t)=>X3(e,t.current),L3=L(`o25`,e=>{D3(e,ar()),A(e.a,`dragover`,function(e){e.preventDefault()}),A(e.a,`drop`,function(t){t.preventDefault();for(let n of t.dataTransfer?.files||[])e.ah(n)})});function R3(e){w3(e,!1),T3(e,!1),D3(e,!1),k3(e,!1),j3(e,!1),N3(e,!1),P3(e,{current:null}),F3(e,{timer:0}),I3(e,{current:null}),L3(e)}var z3=M(41),B3=N(40,e=>z3(e,g6(e))),V3=M(46),H3=M(47),U3=N(44,e=>{V3(e,_6(e)),H3(e,v6(e))}),W3=M(43,e=>{U3(e),C3(e)}),G3=N(34,e=>W3(e,y6(e))),K3=M(33,e=>{B3(e),G3(e),U3(e),C3(e)}),q3=M(37,C3),J3=M(36,e=>q3(e,b6(e))),Y3=M(42),X3=M(39,e=>{Y3(e,x6(e)),B3(e)}),Z3=M(9,G3),Q3=M(10,e=>{z(e.a,`hidden`,e.k===`diff`),u3(e)}),$3=F(M4),e6=M(19,e=>{C3(e),$3(e)}),t6=M(25,C3),n6=M(11),r6=M(12),i6=M(13),a6=M(14),o6=M(15,h3),s6=M(16,F(q4)),c6=M(17,F(Q4,_4)),l6=M(18,F(e3,G4)),u6=M(20),d6=M(21,F(I4)),f6=M(22,F(R4)),p6=M(23,F(n3)),m6=F(y4),h6=M(24,e=>{_3(e),m6(e)});function g6(e){return t=>{x3(e)(),e.a7?.send(t);let n={};n.delay=setTimeout(()=>{n.repeat=setInterval(()=>e.a7?.send(t),K2)},G2),e.ad=n}}function _6(e){return async t=>{let n=[...t?.files||[]];for(let t of n)await e.ah(t);if(!n.length){let n=t?.getData(`text/plain`);n&&e.a7?.send(n)}N3(e,!1)}}function v6(e){return async()=>{if(!navigator.clipboard?.read){N3(e,!0);return}try{for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));if(n){let r=await t.getType(n);await e.ah(new File([r],`pasted.${n.split(`/`)[1]||`png`}`,{type:n}))}else if(t.types.includes(`text/plain`)){let n=await(await t.getType(`text/plain`)).text();n&&e.a7?.send(n)}}}catch{N3(e,!0)}}}function y6(e){return async t=>{if(t){k3(e,!0);try{let n=await(await fetch(`/api/workspaces/${e.j}/assets?name=${encodeURIComponent(t.name||`pasted.png`)}`,{method:`POST`,body:t})).json();n.path&&e.a7?.send(`${n.path} `)}finally{k3(e,!1)}}}}function b6(e){return()=>{clearTimeout(e.aa),j3(e,!0),e.aa=setTimeout(()=>{j3(e,!1)},1200)}}function x6(e){return()=>{let t=e.ad;t&&(clearTimeout(t.delay),clearInterval(t.repeat),e.ad=null)}}R(`o1`,g6),R(`o4`,_6),R(`o5`,v6),R(`o3`,y6),R(`o0`,b6),R(`o2`,x6);var S6=ws,C6=(e=>`/${e}&`)(Ts);function w6(e){let t=Math.round(e/6e4);if(t<60)return`${t}m`;let n=Math.round(t/60);return n<48?`${n}h`:`${Math.round(n/24)}d`}function T6(e,t){if(!e)return null;let n=new Date(e).getTime()-Date.now();return n<=0?t?null:`now`:w6(n)}var E6=(e,t)=>V(e.e,t?`↻ ${ft(t)}`:``),D6=N(9,e=>E6(e,T6(e.i,e._.h!=null))),O6=We(4,D6),k6=O6,A6=N(12,e=>z(e.a,`title`,`${e.k}: ${e.l}% used${e.i?` — resets ${new Date(e.i).toLocaleString()}`:``}`),2),j6=M(11,e=>{V(e.d,e.l),A6(e)}),M6=M(7,e=>{ht(e.c,{hot:e.h>=90,warm:e.h>=70&&e.h<90}),gt(e.c,`width:${Math.min(100,Math.max(2,e.h))}%`),j6(e,Math.round(e.h))}),N6=M(8,e=>{D6(e),A6(e)}),P6=M(10,e=>{V(e.b,e.k),A6(e)}),F6=(e,t)=>{M6(e,t[0]?.used_percent),N6(e,t[0]?.resets_at),P6(e,t[0]?.window)},I6=P(3,0,e=>{z(e.a,`title`,`plan-usage could not reach this provider — these are its last cached numbers, ${w6(e._.h*1e3)} old`),V(e.b,w6(e._.h*1e3))}),L6=I6,R6=P(2,0,e=>V(e.a,e._.j.replace(/^default_/,``).replaceAll(`_`,` `))),z6=R6,B6=O(3,`<span class=usage-stale>⚠ <!> old</span>`,` Db%`,L6),V6=M(7,e=>{B(e.a,`stale`,e.h!=null),B6(e,+(e.h==null)),I6(e),O6(e)}),H6=(e,t)=>V(e.b,t),U6=O(2,`<span class=dim> </span>`,`D `,z6),W6=M(9,e=>{U6(e,+!e.j),R6(e)}),G6=k(4,`<div class=meter><span class="meter-label dim"> </span><span class=meter-track><span class=meter-fill></span></span><span class=meter-pct><!>%</span><span class="meter-reset dim"> </span></div>`,` E lD lD%lD `,k6,F6),K6=(e,t)=>G6(e,[t||[],`window`]),q6=k(0,`<div class=usage-row><div class=usage-name><strong> </strong><!><!></div><div class=usage-meters></div></div>`,` F l%b%l `,0,(e,t)=>{V6(e,t[0]?.stale_seconds),H6(e,t[0]?.agent),W6(e,t[0]?.plan),K6(e,t[0]?.windows)}),J6=I(12,e=>q6(e,[e._._.g||[],e=>`${e.agent}-${e.account||``}`]),e=>e._._),Y6=J6,X6=I(11,e=>V(e.a,e._._.f),e=>e._._),Z6=O(2,`<p class=dim><span class=spin></span> Loading usage…</p>`,0,0,`<p class=dim> </p>`,`D `,X6,`<div class=usage-list></div>`,` `,Y6),Q6=I(10,e=>Z6(e,e._.e?e._.e?.error?1:2:0)),$6=L(`p3`,e=>A(e.a,`click`,function(){e._.j()})),e8=e=>{Q6(e),t8(e),fo(e.b),po(e.b,13),mo(e.b),$6(e)},t8=I(13,e=>{B(e.a,`spinning`,e._.h),z(e.a,`disabled`,e._.h)}),n8=lt(`p4`,(e=>`<header class=manage-head><div><h2>Usage</h2></div><button class=icon-btn title="Refresh usage">${e}</button></header><!><!>`)(lo),(e=>`Db D/${e}&m%c`)(uo),e8),r8=F(Q6),i8=j(4,e=>{a8(e,e.e?.error),o8(e,e.e?.agents),r8(e)}),a8=M(5,F(X6)),o8=M(6,F(J6)),s8=j(7,F(t8)),c8=M(9),l8=L(`p5`,e=>Tt(e,{onMount:function(){e.i(!1)}})),u8=M(8,e=>{c8(e,p8(e)),l8(e)});function d8(e){Ps(e.a),Es(e.a,n8(e)),Is(e.a,`Usage`),Fs(e.a,`usage-modal`),Ns(e.a),Bs(e.a),i8(e,null),s8(e,!1),u8(e,m8(e))}var f8=M(3,e=>zs(e.a,h8(e)));function p8(e){return async()=>{s8(e,!0),await e.i(!0),s8(e,!1)}}function m8(e){return async t=>{try{i8(e,await H(`/api/usage${t?`?refresh`:``}`))}catch(t){i8(e,{error:String(t.message||t)})}}}function h8(e){return function(){e.d()}}R(`p1`,p8),R(`p0`,m8),R(`p2`,h8);var g8=ws,_8=(e=>`/${e}&`)(Ts),v8=Qe(1,`B2`),y8=I(12,e=>V(e.a,e._.f)),b8=L(`k4`,e=>{Ft(e,`b`),A(e.b,`keydown`,function(t){t.key===`Enter`?(t.preventDefault(),e._.l()):t.key===`Escape`&&e._.j&&e._.g()})}),x8=e=>{y8(e),S8(e),C8(e),b8(e)},S8=I(14,e=>z(e.b,`placeholder`,e._.i)),C8=I(15,e=>Pt(e,`b`,e._.j,U8(e))),w8=lt(`k6`,`<h2 class=prompt-title> </h2><input>`,`D l `,x8,0,`B2`),T8=I(13,e=>V(e.b,e._.h||`OK`)),E8=L(`k3`,e=>{A(e.a,`click`,function(){e._.l()}),A(e.c,`click`,function(){e._.g()})}),D8=e=>{T8(e),O8(e),E8(e)},O8=I(15,e=>z(e.a,`disabled`,!e._.j.trim())),k8=ut(`k5`,`<button class="btn primary"> </button><div class=spacer></div><button class=btn>Cancel</button>`,` D lb `,D8),A8=M(11),j8=N(10,e=>A8(e,W8(e))),M8=F(O8,C8),N8=j(9,e=>{j8(e),M8(e)}),P8=(e,t)=>N8(e,t||``),F8=M(4,j8),I8=L(`k7`,e=>Tt(e,{onMount:function(){setTimeout(()=>{let t=v8(e)();t?.focus(),t?.select()},0)}}));function L8(e){Ps(e.a),Bs(e.a,tn({content:k8(e)})),Es(e.a,w8(e)),Fs(e.a,`prompt-dlg`),Ns(e.a),I8(e)}var R8=F(y8),z8=M(5,e=>{Is(e.a,e.f),R8(e)}),B8=M(6,e=>zs(e.a,G8(e))),V8=M(7,F(T8)),H8=M(8,F(S8));function U8(e){return t=>{N8(e._,t)}}function W8(e){return()=>{let t=e.j.trim();t&&e.e(t)}}function G8(e){return function(){e.g()}}R(`k0`,U8),R(`k1`,W8),R(`k2`,G8);var K8=((e,t)=>`<div class=work-view>${e}<div class=main-col><!><!>${t}<!><!><div class=term-area></div></div><!><!></div>`)(Uee,DF),q8=((e,t)=>`D/${e}&D%b%b/${t}&%b%b l%b%l`)(Wee,OF),J8=N(1,e=>P8(e.a,e._.a6||e._.a7)),Y8=P(8,0,J8),X8=e=>{Y8._(e),Z8._(e),$8._(e),e5._(e),L8(e.a),z8(e.a,`Rename session`),V8(e.a,`Rename`),B8(e.a,h7(e)),H8(e.a)},Z8=P(8,0,J8),Q8=N(2,e=>F8(e.a,g7(e))),$8=P(8,0,Q8),e5=P(8,0,Q8),t5=P(1,0,e=>V(e.a,e._.a3)),n5=L(`q29`,e=>A(e.b,`click`,function(){d7(e._,null)})),r5=e=>{t5._(e),n5(e)},i5=e=>{d8(e.a),f8(e.a,_7(e))},a5=N(2,e=>V(e.b,e._._.a4?`Starting…`:`Start ${e._._.o||`claude`}`)),o5=I(63,a5,e=>e._._),s5=L(`q30`,e=>A(e.a,`click`,function(){e._._.am(e._._.o||`claude`,!0)})),c5=e=>{o5(e),l5(e),s5(e)},l5=I(67,e=>{z(e.a,`disabled`,e._._.a4),a5(e)},e=>e._._),u5=N(8,e=>t6(e.b,e._._.n&&e._._.y===`term`&&e.g===e._._.ak),3),d5=I(62,u5,e=>e._._),f5=e=>{d5(e),p5(e),m5(e),g5(e),_5(e),v5(e),x5(e),S5(e),C5(e),R3(e.b),u6(e.b,x7(e)),a6(e.b,b7(e)),n6(e.b,y7(e)),r6(e.b,v7(e))},p5=I(64,e=>p6(e.b,e._._.r),e=>e._._),m5=I(65,e=>{Q3(e.b,e._._.y),u5(e)},e=>e._._),h5=N(11,e=>o6(e.b,S7(e))),g5=I(71,e=>{Z3(e.b,e._._.aa),i6(e.b,C7(e)),h5(e)},e=>e._._),_5=I(72,e=>h6(e.b,e._._.ag),e=>e._._),v5=I(73,e=>{l6(e.b,e._._.ah),d6(e.b,w7(e))},e=>e._._),y5=le(3,0,2),b5=N(7,e=>y5(e,e.g===e._._.ak)),x5=I(75,e=>{u5(e),b5(e)},e=>e._._),S5=I(76,e=>f6(e.b,T7(e)),e=>e._._),C5=I(78,h5,e=>e._._),w5=M(6,e=>{e6(e.b,e.g),u5(e),b5(e)}),T5=(e,t)=>c6(e.b,t),E5=(e,t)=>s6(e.b,t),D5=k(0,(e=>`<!><!>${e}<!><!><!>`)(U2),(e=>`b%b/${e}&%b%c`)(W2),f5,(e,t)=>{w5(e,t[0]?.id),T5(e,t[0]?.state),E5(e,t[0]?.agent)}),O5=P(6,0,e=>D5(e,[e._.ah,`id`])),k5=e=>{O5._(e),j5._(e)},A5=O(1,`<div class=empty-sess><p class=dim>No sessions in this workspace.</p><button class="btn primary"> </button></div>`,`Db D `,c5),j5=P(6,0,e=>A5(e,+!!e._.aj)),M5=M(59,e5),N5=O(6,`<!><!><!><!>`,`b%b%`,k5,`<p class="dim pad-inline">Loading sessions…</p>`),P5=L(`q33`,e=>{e.n&&window.addEventListener(`keydown`,t=>{if(t.key===`Escape`&&e.a1&&c7(e,!1),(t.metaKey||t.ctrlKey)&&t.shiftKey&&t.key.toLowerCase()===`d`&&(t.preventDefault(),o7(e,e.y===`diff`?`term`:`diff`)),t.altKey&&(t.key===`[`||t.key===`]`)&&(e.ah?.length??0)>1){t.preventDefault();let n=e.ah.map(e=>e.id);n7(e,n[(Math.max(0,n.indexOf(e.ak))+(t.key===`]`?1:n.length-1))%n.length]),o7(e,`term`)}},{capture:!0,signal:Ee(e,0)})}),F5=N(47,e=>{Te(e,0),P5(e)},4),I5=F(x5),L5=M(46,e=>{Tg(e.a,e.ak),F5(e),I5(e)}),R5=N(44,e=>L5(e,(()=>{if(e.w&&e.ah?.some(t=>t.id===e.w))return e.w;let t=Kn(e.aa);return t&&e.ah?.some(e=>e.id===t)?t:e.ah?.[0]?.id??null})()),2),z5=F(v5),B5=M(43,e=>{l_(e.a,e.ah),WH(e.d,e.ah||[]),kne(e,e.ah?.length),N5(e,+!e.ah),R5(e),F5(e),O5(e),z5(e)}),V5=N(40,e=>B5(e,e.v??e.m?.[e.aa]?.sessions??null),2),H5=N(57,L(`q31`,e=>Tt(e,{active:e.n,load:e.au,onMount:function(){let t=new AbortController,n=t.signal,r={abort:t,started:!1,stale:!1,timer:void 0,refresh:()=>{if(document.hidden){r.stale=!0;return}r.stale=!1,this.load(!1)},sync:()=>{this.active?(r.started||(r.started=!0,this.load(!0)),r.timer??=setInterval(r.refresh,1e4)):r.stop()},stop:()=>{clearInterval(r.timer),r.timer=void 0}};return Tn().addEventListener(`sessions.changed`,t=>{let n=t.data?.workspaceId;r.started&&(!n||n===e.aa)&&r.refresh()},{signal:n}),document.addEventListener(`visibilitychange`,()=>{!document.hidden&&r.stale&&r.refresh()},{signal:n}),kn(()=>{if(!this.active)return;let t=jn(e.aa);t&&(s7(e,t.pr||``),o7(e,`diff`));let n=Nn(e.aa);n&&(n7(e,n),o7(e,`term`))},n),r.sync(),r},onUpdate:function(){this.sync()},onDestroy:function(){this.abort.abort(),this.stop()}})),2),U5=M(56,H5),W5=N(55,e=>U5(e,D7(e)),2),G5=M(54,W5),K5=N(52,e=>G5(e,O7(e)),6),q5=F(C5),J5=M(60,e=>{a_(e.a,k7(e)),q5(e)}),Y5=N(49,e=>J5(e,A7(e)),2),X5=M(48,e=>{K5(e),Y5(e)}),Z5=N(38,e=>X5(e,j7(e))),Q5=M(58,F(S5)),$5=N(23,e=>Q5(e,M7(e))),e7=j(21,e=>{M5(e,E7(e)),V5(e),Z5(e),K5(e),$5(e)}),t7=N(39,L(`q32`,e=>{e.w&&qn(e.aa,e.w)})),n7=j(22,e=>{R5(e),K5(e),$5(e),t7(e)}),r7=le(5,2,4),i7=N(25,e=>zH(e.d,e.n&&e.y===`diff`)),a7=F(m5),o7=j(24,e=>{Ag(e.a,e.y),B(e.g,`as-bar`,e.y===`diff`),r7(e,e.y===`diff`),F5(e),i7(e),a7(e)}),s7=j(26,e=>FH(e.d,e.a0)),c7=j(27,e=>{Ig(e.a,e.a1),F5(e)}),l7=O(7,S6,(e=>`/${e}&`)(C6),i5),u7=j(28,e=>l7(e,+!e.a2)),hne=O(1,`<p class=toast-error> <button title=Dismiss>×</button></p>`,`D b `,r5),d7=j(29,e=>{hne(e,+!e.a3),t5(e)}),f7=j(30,F(l5)),gne=O(8,g8,(e=>`/${e}&`)(_8),X8),p7=j(31,e=>{bne(e,e.a5?.title),xne(e,e.a5?.agent),Sne(e,e.a5?.id),gne(e,+!e.a5)}),_ne=(e,t)=>{Pne(e,t.wanted),Fne(e,t.run)},vne=M(61);function yne(e){Kg(e.a),Eg(e.a,U7(e)),jg(e.a,H7(e)),Lg(e.a,V7(e)),qg(e.a,B7(e)),h_(e.a,z7(e)),m_(e.a,R7(e)),f_(e.a,L7(e)),s_(e.a,I7(e)),SH(e.d),qH(e.d,F7(e)),YH(e.d,P7(e)),e7(e,null),n7(e,null),o7(e,`term`),s7(e,``),c7(e,!1),u7(e,!1),d7(e,null),f7(e,!1),p7(e,null),_ne(e,{wanted:!1,run:void 0}),vne(e,N7(e))}var bne=M(32,Y8),xne=M(33,Z8),Sne=M(34,$8),Cne=(e,t)=>{xg(e.a,t),Tne(e,t?.id),Ene(e,t?.status),Dne(e,t?.name)},m7=N(37,L(`q34`,e=>{if(e.n){let t=jn(e.aa);t&&(s7(e,t.pr||``),o7(e,`diff`));let n=Nn(e.aa);n&&(n7(e,n),o7(e,`term`))}})),wne=F(g5),Tne=M(36,e=>{RH(e.d,e.aa),V5(e),R5(e),m7(e),Z5(e),K5(e),t7(e),Y5(e),H5(e),wne(e)}),Ene=M(41,K5),Dne=M(42,F(_5)),One=Cne,kne=M(45,j5),Ane=M(12,e=>{Qg(e.a,e.m),V5(e)}),jne=F(d5),Mne=L(`q35`,e=>{e.n||c7(e,!1)}),Nne=M(13,e=>{Jg(e.a,e.n),m7(e),F5(e),H5(e),i7(e),jne(e),Mne(e)}),Pne=M(51,e=>{K5(e),W5(e)}),Fne=M(53,W5),Ine=F(o5),Lne=M(14,e=>{K5(e),Ine(e)}),Rne=M(15,e=>{e_(e.a,e.p),Y5(e)}),zne=(e,t)=>Yg(e.a,t),Bne=F(p5),Vne=M(17,e=>{r_(e.a,e.r),Bne(e)}),Hne=(e,t)=>u_(e.a,t),Une=M(19,e=>t_(e.a,e.t)),Wne=(e,t)=>g_(e.a,t);function h7(e){return function(){p7(e._,null)}}function g7(e){return function(t){e._.ax(e._.a8,t),p7(e._,null)}}function _7(e){return function(){u7(e._,!1)}}function v7(e){return function(){c7(e._._,!0)}}function y7(e){return function(){o7(e._._,`term`)}}function b7(e){return function(){s7(e._._,``),o7(e._._,`diff`)}}function x7(e){return function(t){n7(e._._,t)}}function S7(e){return function(t){e._._.ay(e._._.aa,t)}}function C7(e){return function(){e._._.t?.(e._._.aa)}}function w7(e){return function(t){let n=(e._._.ah||[]).find(e=>e.id===t);n&&p7(e._._,n)}}function T7(e){return function(t){e._._.aw(t)}}function E7(e){return async(t,n)=>{n=n.trim(),n&&(e7(e,(e.v||[]).map(e=>e.id===t?{...e,title:n}:e)),await fetch(`/api/sessions/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({title:n})}))}}function D7(e){return t=>(t&&(e.ap=!0),(e.ar??=Pn(e.as))())}function O7(e){return async()=>{let t=e.ap;e.ap=!1;try{let n=await H(`/api/workspaces/${e.aa}/sessions`);if(!n.length&&t&&e.af===`active`){let t=await e.am(e.o||`claude`,!1);n=t?[t]:[]}e7(e,n);let r=Kn(e.aa);r&&n.some(e=>e.id===r)&&n7(e,r),e.v.some(t=>t.id===e.w)||n7(e,e.v?.[0]?.id||null)}catch(t){e7(e,e.v||[]),d7(e,String(t))}}}function k7(e){return function(t,n){e.ay(t,n)}}function A7(e){return async(t,n)=>{if(t===e.aa){let r=await e.am(n,!0);r&&qn(t,r.id);return}try{qn(t,(await H(`/api/workspaces/${t}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:n})})).id),e.p?.(t)}catch(t){d7(e,String(t.message||t))}}}function j7(e){return async(t,n)=>{f7(e,!0);try{let r=await H(`/api/workspaces/${e.aa}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:t})});return n&&(e7(e,(e.v||[]).concat(r)),n7(e,r.id)),r}catch(t){return d7(e,String(t.message||t)),null}finally{f7(e,!1)}}}function M7(e){return async t=>{try{await H(`/api/sessions/${t}`,{method:`DELETE`}),e7(e,(e.v||[]).filter(e=>e.id!==t)),e.w===t&&n7(e,e.v?.[0]?.id||null)}catch(t){d7(e,`Kill session failed: ${String(t.message||t)}`)}}}function N7(e){return t=>{p7(e,t)}}function P7(e){return function(){o7(e,`term`)}}function F7(e){return function(t){n7(e,t),o7(e,`term`)}}function I7(e){return function(t){s7(e,t||``)}}function L7(e){return function(t){e.az(t)}}function R7(e){return function(t){e.aw(t)}}function z7(e){return function(){u7(e,!0)}}function B7(e){return function(t){d7(e,t)}}function V7(e){return t=>{c7(e,t)}}function H7(e){return t=>{o7(e,t)}}function U7(e){return function(t){n7(e,t)}}R(`q28`,h7),R(`q27`,g7),R(`q26`,_7),R(`q24`,v7),R(`q23`,y7),R(`q22`,b7),R(`q19`,x7),R(`q18`,S7),R(`q25`,C7),R(`q21`,w7),R(`q20`,T7),R(`q4`,E7),R(`q2`,D7),R(`q1`,O7),R(`q12`,k7),R(`q5`,A7),R(`q0`,j7),R(`q3`,M7),R(`q6`,N7),R(`q17`,P7),R(`q16`,F7),R(`q15`,I7),R(`q14`,L7),R(`q13`,R7),R(`q11`,z7),R(`q10`,B7),R(`q9`,V7),R(`q8`,H7),R(`q7`,U7);var W7=I(40,e=>V(e.a,e._._.t),e=>e._._),Gne=L(`b19`,e=>A(e.b,`click`,function(){I9(e._._,null),e._._.v()})),Kne=O(0,`<p> </p><button class=btn>Retry</button>`,`D l `,e=>{W7(e),Gne(e)},`<span class=spin></span>Loading workspaces…`),G7=P(1,0,e=>Kne(e,+!e._.t)),qne=G7,K7=P(0,0,e=>V(e.a,e._.t)),Jne=L(`b18`,e=>A(e.b,`click`,function(){I9(e._,null)})),Yne=e=>{K7._(e),Jne(e)},q7=I(34,e=>zne(e.b,e._._.g),e=>e._._),Xne=e=>{q7(e),J7(e),Y7(e),Q7(e),$7(e),e9(e),t9(e),n9._(e),r9._(e),yne(e.b),Hne(e.b,R9(e)),Wne(e.b,L9(e))},J7=I(35,e=>Ane(e.b,e._._.h),e=>e._._),Y7=I(36,e=>{Lne(e.b,e._._.i?e._._.i?.preferredAgent:`claude`),Vne(e.b,e._._.i?e._._.i?.agents:[`claude`])},e=>e._._),X7=N(5,e=>Nne(e.b,!e._._.p&&!e._._.a5&&e._.f===e._._.k),3),Zne=le(3,0,2),Z7=N(4,e=>Zne(e,e._.f===e._._.k)),Q7=I(37,e=>{X7(e),Z7(e)},e=>e._._),$7=I(38,X7,e=>e._._),e9=I(41,e=>Rne(e.b,z9(e)),e=>e._._),t9=I(42,X7,e=>e._._),n9=P(0,0,e=>One(e.b,e._.e)),r9=P(0,0,e=>{Une(e.b,B9(e)),X7(e),Z7(e)}),Qne=O(0,(e=>`<!><!>${e}<!><!><!>`)(K8),(e=>`b%b/${e}&%b%c`)(q8),Xne),$ne=M(4,e=>{tre(e,e.e?.id),Qne(e,+!e.e),n9(e)}),i9=N(3,e=>$ne(e,e._.g.find(t=>t.id===e.c))),a9=We(5,i9),ere=a9,tre=M(5,r9),nre=M(2,i9),rre=(e,t)=>nre(e,t[0]),o9=N(1,e=>Cf(e.a,V9(e))),s9=P(4,0,o9),ire=e=>{s9._(e),c9._(e),vf(e.a),wf(e.a,H9(e))},c9=P(4,0,o9),l9=P(3,0,e=>Ku(e.a,U9(e))),are=e=>{l9._(e),u9._(e),_u(e.a),qu(e.a,W9(e))},u9=P(3,0,e=>Gu(e.a,e._.a5)),d9=P(2,0,e=>Pa(e.a,e._.g)),ore=e=>{d9._(e),f9._(e),p9._(e),m9._(e),g9._(e),_9._(e),v9._(e),ka(e.a),io(e.a,J9(e)),za(e.a,q9(e)),Ga(e.a,K9(e)),Za(e.a,G9(e))},f9=P(2,0,e=>ro(e.a,e._.h)),p9=P(2,0,e=>eo(e.a,e._.i)),m9=P(2,0,e=>La(e.a,e._.k)),h9=N(1,e=>Xa(e.a,!e._.s&&e._.a6)),g9=P(2,0,h9),_9=P(2,0,e=>{Ka(e.a,Z9(e)),Ra(e.a,X9(e)),Va(e.a,Y9(e))}),v9=P(2,0,h9),y9=N(28,L(`b20`,e=>Tt(e,{paletteOpen:e.s,load:e.v,activeList:e.g.filter(e=>e.status===`active`).map(e=>e.id),onMount:function(){let t=new AbortController,n=t.signal,r={abort:t,statusStale:!1,statusDebounce:void 0,timer:void 0};nr(n);let i=(t,n)=>{n&&(Mn(t,n),qn(t,n)),e.a1(t)},a=new URLSearchParams(location.search);a.get(`ws`)&&(i(a.get(`ws`),a.get(`session`)),history.replaceState(null,``,`/`)),sr()&&document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[target="_blank"][href^="http"]`);t&&(e.preventDefault(),cr(t.href))},{capture:!0,signal:n}),navigator.serviceWorker?.addEventListener(`message`,e=>{e.data?.type===`open-session`&&i(e.data.workspaceId,e.data.sessionId)},{signal:n}),H(`/api/settings`).then(t=>{D9(e,t)}).catch(()=>{});let o=()=>{if(document.hidden){r.statusStale=!0;return}r.statusStale=!1,e.a0()};document.addEventListener(`visibilitychange`,()=>{document.hidden||(r.statusStale=!1,e.a0(!0))},{signal:n}),this.load(),o(),Tn().addEventListener(`workspaces.changed`,()=>{this.load(),o()},{signal:n}),Tn().addEventListener(`sessions.changed`,()=>{clearTimeout(r.statusDebounce),r.statusDebounce=setTimeout(o,300)},{signal:n}),Tn().addEventListener(`status.changed`,t=>{t.data&&(E9(e,t.data),r.statusStale=!1)},{signal:n}),r.timer=setInterval(o,6e4),window.addEventListener(`keydown`,t=>{if((t.metaKey||t.ctrlKey)&&t.key===`k`&&(t.preventDefault(),F9(e,!this.paletteOpen)),(t.metaKey||t.ctrlKey)&&!t.shiftKey&&!t.altKey&&t.key>=`1`&&t.key<=`9`){let n=this.activeList?.[Number(t.key)-1];n&&(t.preventDefault(),e.a1(n))}},{capture:!0,signal:n});let s=window.visualViewport;if(s){let e=()=>{let e=Math.abs(s.height-window.innerHeight)<1;document.documentElement.style.setProperty(`--app-height`,e?``:`${Math.round(s.height)}px`),e||window.scrollTo(0,0)};s.addEventListener(`resize`,e,{signal:n}),s.addEventListener(`scroll`,e,{signal:n}),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()},{signal:n}),window.addEventListener(`pageshow`,e,{signal:n}),window.addEventListener(`focus`,e,{signal:n})}return r},onDestroy:function(){this.abort.abort(),clearTimeout(this.statusDebounce),clearInterval(this.timer)}})),4),sre=F(e9),cre=M(27,e=>{y9(e),_9(e),c9(e),sre(e)}),b9=N(13,e=>cre(e,Q9(e))),lre=O(2,(e=>`<!>${e}`)(see),(e=>`b/${e}&`)(cee),ore),x9=N(33,e=>lre(e,e.s||e.a6?0:1)),ure=M(32,e=>{x9(e),v9(e)}),S9=N(30,e=>ure(e,!e.p&&!e.a3&&e.j),2),dre=M(29,S9),C9=N(11,e=>dre(e,e.g.find(t=>t.id===e.k))),fre=O(3,Hs,(e=>`/${e}&`)(Us),are),pre=F(t9),mre=M(31,e=>{fre(e,+!e.a5),u9(e),pre(e)}),w9=N(17,e=>mre(e,e.g.find(t=>t.id===e.q))),hre=F(q7),T9=j(6,e=>{b9(e),y9(e),C9(e),w9(e),d9(e),l9(e),s9(e),a9(e),hre(e)}),gre=F(J7),E9=j(7,e=>{f9(e),gre(e)}),_re=F(Y7),D9=j(8,e=>{p9(e),_re(e)}),O9=O(1,`<div class="boot dim"></div>`,` `,qne),vre=M(21,y9),k9=N(14,e=>vre(e,$9(e)),2),yre=O(0,`<p class=toast-error><!> <button>×</button></p>`,`D%c `,Yne),A9=N(20,e=>yre(e,e.t&&e.j?0:1)),bre=j(9,e=>{O9(e,+!!e.j),k9(e),S9(e),A9(e)}),xre=F(Q7),j9=j(10,e=>{k9(e),C9(e),m9(e),xre(e)}),Sre=k(5,`<!><!><!>`,`b%`,ere,rre),M9=j(12,e=>{Sre(e,[e.m,e=>e]),k9(e),b9(e)}),Cre=O(4,cd,(e=>`/${e}&`)(ld),ire),wre=F($7),N9=j(15,e=>{Cre(e,+!e.p),S9(e),wre(e)}),P9=j(16,w9),F9=j(18,e=>{y9(e),x9(e),g9(e)}),Tre=F(W7),I9=j(19,e=>{A9(e),K7(e),G7(e),Tre(e)});function L9(e){return function(){N9(e._._,!0)}}function R9(e){return function(t,n){Mn(t,n),qn(t,n),e._._.a1(t)}}function z9(e){return function(t){e._._.a1(t)}}function B9(e){return function(t){P9(e._._,t||e._.f)}}function V9(e){return function(t){e._.g.some(e=>e.id===t.id)||T9(e._,[t,...e._.g]),N9(e._,!1),e._.a1(t.id)}}function H9(e){return function(){N9(e._,!1)}}function U9(e){return function(t){T9(e._,e._.g.map(e=>e.id===t.id?t:e))}}function W9(e){return function(){P9(e._,null)}}function G9(e){return function(){F9(e._,!1)}}function K9(e){return function(){N9(e._,!0),F9(e._,!1)}}function q9(e){return function(t){P9(e._,t.id),N9(e._,!1),F9(e._,!1)}}function J9(e){return function(t){D9(e._,t)}}function Y9(e){return function(t,n){F9(e._,!1),H(`/api/workspaces/${t.id}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:n})}).then(n=>{Mn(t.id,n.id),e._.a1(t.id)}).catch(t=>{I9(e._,`New session failed: ${String(t.message||t)}`)})}}function X9(e){return function(t){An(t.id),e._.a1(t.id)}}function Z9(e){return function(t){e._.a1(t.id)}}function Q9(e){return async t=>{e.g.find(e=>e.id===t)?.status===`archived`&&(await H(`/api/workspaces/${t}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`restore`})}).catch(()=>{}),T9(e,e.g.map(e=>e.id===t?{...e,status:`active`}:e))),j9(e,t),N9(e,!1),P9(e,null),F9(e,!1),e.m.includes(t)||M9(e,e.m.concat(t)),Un(t)}}function $9(e){return async()=>{try{let[t]=await Promise.all([H(`/api/workspaces`),Rn()]);if(T9(e,t),e.j){let n=new Set(t.filter(e=>e.status===`active`).map(e=>e.id));M9(e,e.m.filter(e=>n.has(e))),e.k&&!n.has(e.k)&&(j9(e,e.m[e.m?.length-1]||null),Un(e.k))}else{let n=Hn();n&&t.some(e=>e.id===n)&&(j9(e,n),M9(e,[n]))}bre(e,!0)}catch(t){I9(e,`Loading workspaces failed: ${t.message||String(t)}`)}}}function Ere(e){return(t=!1)=>(e.x||=t,(e.y??=Pn(async()=>{let t=e.x;e.x=!1,E9(e,await H(`/api/status${t?`?fresh`:``}`))}))())}R(`b17`,L9),R(`b15`,R9),R(`b14`,z9),R(`b16`,B9),R(`b13`,V9),R(`b12`,H9),R(`b11`,U9),R(`b10`,W9),R(`b9`,G9),R(`b8`,K9),R(`b7`,q9),R(`b3`,J9),R(`b6`,Y9),R(`b5`,X9),R(`b4`,Z9),R(`b2`,Q9),R(`b0`,$9),R(`b1`,Ere),tt();export{t};
1615
- //# sourceMappingURL=index-DW02FbhG.js.map
1614
+ }`,e1=8,t1=e1*Float32Array.BYTES_PER_ELEMENT,n1=20*e1,r1=class{constructor(){this.attributes=new Float32Array(n1),this.count=0}},i1=0,a1=0,o1=0,s1=0,c1=0,l1=0,u1=0,d1=class extends IZ{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new r1,this._verticesCursor=new r1;let i=this._gl;this._program=iQ(A$(i,Q$,$$)),this._register(NZ(()=>i.deleteProgram(this._program))),this._projectionLocation=iQ(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(NZ(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(NZ(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=iQ(i.createBuffer()),this._register(NZ(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,t1,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,t1,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,t1,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,k$),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*K$,d=e.cells[u+q$],f=e.cells[u+J$],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*e1,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*e1,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*e1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*e1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*e1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*e1,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:i1=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:i1=(n&16777215)<<8;break;case 0:default:i1=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:i1=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:i1=(r&16777215)<<8;break;case 0:default:i1=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=M$(e.attributes,this._terminal.rows*this._terminal.cols*e1)),a1=i*this._dimensions.device.cell.width,o1=o*this._dimensions.device.cell.height,s1=(i1>>24&255)/255,c1=(i1>>16&255)/255,l1=(i1>>8&255)/255,u1=1,this._addRectangle(e.attributes,t,a1,o1,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,s1,c1,l1,u1)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},f1=class extends IZ{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(NZ(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=iQ(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=S$(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=wQ,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},p1=class extends f1{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&b$(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},m1=typeof window==`object`?window:globalThis,h1=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new c$,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new c$,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};h1.INSTANCE=new h1;var g1=h1;function _1(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}g1.INSTANCE.onDidChangeZoomLevel,g1.INSTANCE.onDidChangeFullscreen;var v1=typeof navigator==`object`?navigator.userAgent:``;v1.indexOf(`Firefox`);var y1=v1.indexOf(`AppleWebKit`)>=0;!(v1.indexOf(`Chrome`)>=0)&&v1.indexOf(`Safari`),v1.indexOf(`Electron/`),v1.indexOf(`Android`);var b1=!1;if(typeof m1.matchMedia==`function`){let e=m1.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=m1.matchMedia(`(display-mode: fullscreen)`);b1=e.matches,_1(m1,e,({matches:e})=>{b1&&t.matches||(b1=e)})}function x1(){return b1}var S1=`en`,C1=!1,w1=!1,T1=!1,E1=S1,D1,O1=globalThis,k1;typeof O1.vscode<`u`&&typeof O1.vscode.process<`u`?k1=O1.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(k1=process);var A1=typeof k1?.versions?.electron==`string`&&k1?.type===`renderer`;if(typeof k1==`object`){k1.platform,k1.platform,C1=k1.platform===`linux`,C1&&k1.env.SNAP&&k1.env.SNAP_REVISION,k1.env.CI||k1.env.BUILD_ARTIFACTSTAGINGDIRECTORY,E1=S1;let e=k1.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,E1=t.resolvedLanguage||S1,t.languagePack?.translationsConfigFile}catch{}w1=!0}else typeof navigator==`object`&&!A1?(D1=navigator.userAgent,D1.indexOf(`Windows`),D1.indexOf(`Macintosh`),(D1.indexOf(`Macintosh`)>=0||D1.indexOf(`iPad`)>=0||D1.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,C1=D1.indexOf(`Linux`)>=0,D1?.indexOf(`Mobi`),T1=!0,E1=globalThis._VSCODE_NLS_LANGUAGE||S1,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var j1=w1;T1&&typeof O1.importScripts==`function`&&O1.origin;var M1=D1,N1=E1,P1;(e=>{function t(){return N1}e.value=t;function n(){return N1.length===2?N1===`en`:N1.length>=3&&N1[0]===`e`&&N1[1]===`n`&&N1[2]===`-`}e.isDefaultVariant=n;function r(){return N1===`en`}e.isDefault=r})(P1||={});var F1=typeof O1.postMessage==`function`&&!O1.importScripts;(()=>{if(F1){let e=[];O1.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),O1.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var I1=!!(M1&&M1.indexOf(`Chrome`)>=0);M1&&M1.indexOf(`Firefox`),!I1&&M1&&M1.indexOf(`Safari`),M1&&M1.indexOf(`Edg/`),M1&&M1.indexOf(`Android`);var L1=typeof navigator==`object`?navigator:{};j1||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||L1&&L1.clipboard&&L1.clipboard.writeText,j1||L1&&L1.clipboard&&L1.clipboard.readText,j1||x1()||L1.keyboard,`ontouchstart`in m1||L1.maxTouchPoints,m1.PointerEvent&&(`ontouchstart`in m1||navigator.maxTouchPoints);var R1=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},z1=new R1,B1=new R1,V1=new R1;Array(230);var H1;(e=>{function t(e){return z1.keyCodeToStr(e)}e.toString=t;function n(e){return z1.strToKeyCode(e)}e.fromString=n;function r(e){return B1.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return V1.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return B1.strToKeyCode(e)||V1.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return z1.keyCodeToStr(e)}e.toElectronAccelerator=o})(H1||={});var U1=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),W1;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof G1?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:YQ.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:U1})})(W1||={});var G1=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?U1:(this._emitter||=new c$,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var K1;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(K1||={});var q1=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new c$,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await YQ.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};q1.EMPTY=q1.fromArray([]);function J1(e){return Y1(e,0)}function Y1(e,t){switch(typeof e){case`object`:return e===null?X1(349,t):Array.isArray(e)?$1(e,t):e0(e,t);case`string`:return Q1(e,t);case`boolean`:return Z1(e,t);case`number`:return X1(e,t);case`undefined`:return X1(937,t);default:return X1(617,t)}}function X1(e,t){return(t<<5)-t+e|0}function Z1(e,t){return X1(e?433:863,t)}function Q1(e,t){t=X1(149417,t);for(let n=0,r=e.length;n<r;n++)t=X1(e.charCodeAt(n),t);return t}function $1(e,t){return t=X1(104579,t),e.reduce((e,t)=>Y1(t,e),t)}function e0(e,t){return t=X1(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Q1(n,t),Y1(e[n],t)),t)}var{registerWindow:ane,getWindow:t0,getDocument:one,getWindows:sne,getWindowsCount:cne,getWindowId:lne,getWindowById:une,hasWindow:dne,onDidRegisterWindow:fne,onWillUnregisterWindow:pne,onDidUnregisterWindow:mne}=function(){let e=new Map,t={window:m1,disposables:new FZ};e.set(m1.vscodeWindowId,t);let n=new c$,r=new c$,i=new c$;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return IZ.None;let a=new FZ,o={window:t,disposables:a.add(new FZ)};return e.set(t.vscodeWindowId,o),a.add(NZ(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(r0(t,a0.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:m1},getDocument(e){return t0(e).document}}}(),n0=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function r0(e,t,n,r){return new n0(e,t,n,r)}var i0=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};i0.None=new i0(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=J1(n),a=r.get(i);if(a)a.users+=1;else{let o=new c$,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(NZ(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var a0={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:y1?`webkitAnimationStart`:`animationstart`,ANIMATION_END:y1?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:y1?`webkitAnimationIteration`:`animationiteration`},o0=class extends IZ{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new LZ,this._charAtlasDisposable=this._register(new LZ),this._observerDisposable=this._register(new LZ),this._model=new Z$,this._workCell=new O$,this._workCell2=new O$,this._rectangleRenderer=this._register(new LZ),this._glyphRenderer=this._register(new LZ),this._onChangeTextureAtlas=this._register(new c$),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new c$),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new c$),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new c$),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new c$),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new SQ(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new p1(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=fQ(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(r0(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(r0(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,C$(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=E$(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=E$(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(NZ(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),C$(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new d1(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new U$(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=S$(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=MZ(YQ.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),YQ.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new T$(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=c0(e,n.rows-1,0),t=c0(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,ee=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),te=-1,ne=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let w=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||ee<p[0]||ee>=p[1],d?(l=!0,r=new s0(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*K$,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),ne&&o===S&&(y===ee&&(this._model.cursor={x:ee,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},te=ee+r.getWidth()-1),y>=ee&&y<=te&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+q$]!==this._cellColorResolver.result.bg||this._model.cells[v+J$]!==this._cellColorResolver.result.fg||this._model.cells[v+Y$]!==this._cellColorResolver.result.ext)&&(w=!0,h.length>1&&(g|=X$),this._model.cells[v]=g,this._model.cells[v+q$]=this._cellColorResolver.result.bg,this._model.cells[v+J$]=this._cellColorResolver.result.fg,this._model.cells[v+Y$]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*K$,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,GZ,0,0),this._model.cells[b]=0,this._model.cells[b+q$]=this._cellColorResolver.result.bg,this._model.cells[b+J$]=this._cellColorResolver.result.fg,this._model.cells[b+Y$]=this._cellColorResolver.result.ext;y--}}w&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},s0=class extends WQ{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function c0(e,t,n=0){return Math.max(Math.min(e,t),n)}var l0=`di$target`,u0=`di$dependencies`,d0=new Map;function f0(e){if(d0.has(e))return d0.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);p0(t,e,r)};return t._id=e,d0.set(e,t),t}function p0(e,t,n){t[l0]===t?t[u0].push({id:e,index:n}):(t[u0]=[{id:e,index:n}],t[l0]=t)}f0(`BufferService`),f0(`CoreMouseService`),f0(`CoreService`),f0(`CharsetService`),f0(`InstantiationService`),f0(`LogService`);var m0=f0(`OptionsService`);f0(`OscLinkService`),f0(`UnicodeService`),f0(`DecorationService`);var h0={trace:0,debug:1,info:2,warn:3,error:4,off:5},g0=`xterm.js: `,_0=class extends IZ{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),v0=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=h0[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:g0)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};_0=hZ([gZ(0,m0)],_0);var v0,y0=class extends IZ{constructor(e){if(UZ&&WZ()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new c$),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new c$),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new c$),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new c$),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new o0(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(YQ.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(YQ.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(YQ.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(YQ.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(NZ(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},b0=2,x0=1,S0=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(b0,Math.floor(u/e.css.cell.width)),rows:Math.max(x0,Math.floor(l/e.css.cell.height))}}},C0=`3.7.8`,w0=C0,T0=typeof Buffer==`function`,E0=typeof TextDecoder==`function`?new TextDecoder:void 0,D0=typeof TextEncoder==`function`?new TextEncoder:void 0,O0=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),k0=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(O0),A0=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,j0=String.fromCharCode.bind(String),M0=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),N0=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),P0=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),F0=e=>{let t,n,r,i,a=``,o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`invalid character found`);t=n<<16|r<<8|i,a+=O0[t>>18&63]+O0[t>>12&63]+O0[t>>6&63]+O0[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},I0=typeof btoa==`function`?e=>btoa(e):T0?e=>Buffer.from(e,`binary`).toString(`base64`):F0,L0=T0?e=>Buffer.from(e).toString(`base64`):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(j0.apply(null,e.subarray(n,n+4096)));return I0(t.join(``))},R0=(e,t=!1)=>t?N0(L0(e)):L0(e),z0=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?j0(192|t>>>6)+j0(128|t&63):j0(224|t>>>12&15)+j0(128|t>>>6&63)+j0(128|t&63)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return j0(240|t>>>18&7)+j0(128|t>>>12&63)+j0(128|t>>>6&63)+j0(128|t&63)},B0=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,V0=e=>e.replace(B0,z0),H0=T0?e=>Buffer.from(e,`utf8`).toString(`base64`):D0?e=>L0(D0.encode(e)):e=>I0(V0(e)),U0=(e,t=!1)=>t?N0(H0(e)):H0(e),W0=e=>U0(e,!0),G0=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,K0=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return j0((t>>>10)+55296)+j0((t&1023)+56320);case 3:return j0((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return j0((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},q0=e=>e.replace(G0,K0),J0=e=>{if(e=e.replace(/\s+/g,``),!A0.test(e))throw TypeError(`malformed base64.`);e+=`==`.slice(2-(e.length&3));let t,n,r,i=[];for(let a=0;a<e.length;)t=k0[e.charAt(a++)]<<18|k0[e.charAt(a++)]<<12|(n=k0[e.charAt(a++)])<<6|(r=k0[e.charAt(a++)]),n===64?i.push(j0(t>>16&255)):r===64?i.push(j0(t>>16&255,t>>8&255)):i.push(j0(t>>16&255,t>>8&255,t&255));return i.join(``)},Y0=typeof atob==`function`?e=>atob(P0(e)):T0?e=>Buffer.from(e,`base64`).toString(`binary`):J0,X0=T0?e=>M0(Buffer.from(e,`base64`)):e=>M0(Y0(e).split(``).map(e=>e.charCodeAt(0))),Z0=e=>X0($0(e)),Q0=T0?e=>Buffer.from(e,`base64`).toString(`utf8`):E0?e=>E0.decode(X0(e)):e=>q0(Y0(e)),$0=e=>P0(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),e2=e=>Q0($0(e)),t2=e=>{if(typeof e!=`string`)return!1;let t=e.replace(/\s+/g,``).replace(/={0,2}$/,``);return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},n2=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),r2=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,n2(t));e(`fromBase64`,function(){return e2(this)}),e(`toBase64`,function(e){return U0(this,e)}),e(`toBase64URI`,function(){return U0(this,!0)}),e(`toBase64URL`,function(){return U0(this,!0)}),e(`toUint8Array`,function(){return Z0(this)})},i2=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,n2(t));e(`toBase64`,function(e){return R0(this,e)}),e(`toBase64URI`,function(){return R0(this,!0)}),e(`toBase64URL`,function(){return R0(this,!0)})},a2={version:C0,VERSION:w0,atob:Y0,atobPolyfill:J0,btoa:I0,btoaPolyfill:F0,fromBase64:e2,toBase64:U0,encode:U0,encodeURI:W0,encodeURL:W0,utob:V0,btou:q0,decode:e2,isValid:t2,fromUint8Array:R0,toUint8Array:Z0,extendString:r2,extendUint8Array:i2,extendBuiltins:()=>{r2(),i2()}},o2=class{constructor(e=new c2,t=new s2){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,e=>this._setOrReportClipboard(e))}dispose(){return this._disposable?.dispose()}_readText(e,t){let n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${n}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(`;`);if(t.length<2)return!0;let n=t[0],r=t[1];if(r===`?`){let e=this._provider.readText(n);return e instanceof Promise?e.then(e=>(this._readText(n,e),!0)):(this._readText(n,e),!0)}let i=``;try{i=this._base64.decodeText(r)}catch{}let a=this._provider.writeText(n,i);return a instanceof Promise?a.then(()=>!0):!0}},s2=class{async readText(e){return e===`c`?navigator.clipboard.readText():Promise.resolve(``)}async writeText(e,t){return e===`c`?navigator.clipboard.writeText(t):Promise.resolve()}},c2=class{encodeText(e){return a2.encode(e)}decodeText(e){let t=a2.decode(e);return!a2.isValid(e)||a2.encode(t)!==e?``:t}},l2=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=d2.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function u2(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var d2=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!u2(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},f2=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function p2(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var m2=class{constructor(e=p2,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||f2;this._linkProvider=this._terminal.registerLinkProvider(new l2(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}};function h2(e,t){let{term:n,write:r}=e,i=new TextEncoder,a=null,o=0,s=!1,c=null,l=()=>{if(s)return;let i=location.protocol===`https:`?`wss`:`ws`,f=a=new WebSocket(`${i}://${location.host}/term/${e.sessionId}?cols=${n.cols}&rows=${n.rows}&visible=${+!!u()}`);f.onmessage=e=>r(e.data),f.onopen=()=>{o=0,d(f),c&&=(f.send(JSON.stringify({resize:c})),null),m()},f.onclose=()=>{if(!(t.aborted||s||a!==f)){if(document.visibilityState!==`visible`){let e=()=>{document.visibilityState===`visible`&&(document.removeEventListener(`visibilitychange`,e),!t.aborted&&a===f&&l())};document.addEventListener(`visibilitychange`,e,{signal:t})}else++o<=3?setTimeout(()=>{!t.aborted&&a===f&&l()},400*o):e.onDead()}}},u=()=>document.visibilityState===`visible`&&e.isVisible(),d=e=>{e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({visible:u()}))};document.addEventListener(`visibilitychange`,()=>a&&d(a),{signal:t}),l(),t.addEventListener(`abort`,()=>a?.close());let f=[],p=0,m=()=>{for(;f.length&&a?.readyState===WebSocket.OPEN;)a.send(i.encode(f.shift()));p=0};return{send(e){a?.readyState===WebSocket.OPEN?a.send(i.encode(e)):p<1024&&(f.push(e),p+=e.length)},resize(e,t){a?.readyState===WebSocket.OPEN?a.send(JSON.stringify({resize:[e,t]})):c=[e,t]},syncVisibility(){a&&d(a)},get readyState(){return a?.readyState},reconnect(){s=!1,l()},disconnect(){s=!0,a?.close()}}}function g2(e,t,n,r){let i=null,a=0,o=0,s=0,c=0,l=n=>{let r=t().querySelector(`.xterm-screen`)||t(),i=r.clientHeight/e.rows||17;c+=n/i;let a=Math.trunc(c);if(!a)return;c-=a;let o=r.getBoundingClientRect(),s=a>0?1:-1;for(let e=0;e!==a;e+=s)r.dispatchEvent(new WheelEvent(`wheel`,{deltaY:s,deltaMode:WheelEvent.DOM_DELTA_LINE,bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2}))},u=()=>{cancelAnimationFrame(s),s=0},d=()=>{o*=.97,!(Math.abs(o)<.25)&&(l(o*16),s=requestAnimationFrame(d))};n.addEventListener(`abort`,u),t().addEventListener(`touchstart`,e=>{u(),o=0,i=e.touches[0]?.clientY??null,a=e.timeStamp},{passive:!0,signal:n}),t().addEventListener(`touchmove`,e=>{if(r?.())return;let t=e.touches[0]?.clientY;if(t==null||i==null)return;let n=i-t;Math.abs(n)>=2&&(o=n/Math.max(1,e.timeStamp-a),i=t,a=e.timeStamp,l(n)),e.preventDefault()},{passive:!1,signal:n}),t().addEventListener(`touchend`,()=>{i=null,Math.abs(o)>.5&&(u(),s=requestAnimationFrame(d))},{signal:n})}function _2(e){let t=!1,n=[],r=0;return{write(i){if(!t){e.write(i);return}for(n.push(i),r+=i.length;r>1048576&&n.length>1;)r-=n.shift().length},setFrozen(i){if(t!==i&&(t=i,!i)){let t=n.join(``);n=[],r=0,t&&e.write(t)}}}}function v2(e,t,n){let r=e.textarea;if(!r)return;let i=`\xA0`.repeat(4),a={deleteContentBackward:``,deleteWordBackward:``,deleteSoftLineBackward:``,deleteHardLineBackward:``},o=!1,s=()=>{o||(r.value!==i&&(r.value=i),r.setSelectionRange(i.length,i.length))};r.addEventListener(`beforeinput`,e=>{let n=a[e.inputType];n&&(e.preventDefault(),e.stopImmediatePropagation(),t(n))},{capture:!0,signal:n}),r.addEventListener(`compositionstart`,()=>{o=!0},{signal:n}),r.addEventListener(`compositionend`,()=>{o=!1,setTimeout(s,0)},{signal:n}),r.addEventListener(`input`,()=>setTimeout(s,0),{signal:n}),r.addEventListener(`focus`,()=>setTimeout(s,0),{signal:n}),s()}var y2=450,b2=12,x2=` ·│┃()[]{}<>'"\`,;│|`;function S2(e,t,n,r){let i=!1,a,o=0,s=0,c=null,l=null,u=()=>t().querySelector(`.xterm-screen`)||t(),d=(t,n)=>{let r=u().getBoundingClientRect();return{col:Math.max(0,Math.min(e.cols-1,Math.floor((t-r.left)/r.width*e.cols))),row:Math.max(0,Math.min(e.rows-1,Math.floor((n-r.top)/r.height*e.rows)))+e.buffer.active.viewportY}},f=t=>{let n=e.buffer.active.getLine(t.row)?.translateToString()??``,r=e=>!e||e===` `||x2.includes(e);if(r(n[t.col]))return{start:t,end:t};let i=t.col,a=t.col;for(;i>0&&!r(n[i-1]);)i--;for(;a<n.length-1&&!r(n[a+1]);)a++;return{start:{col:i,row:t.row},end:{col:a,row:t.row}}},p=(e,t)=>e.row<t.row||e.row===t.row&&e.col<=t.col,m=()=>{if(!c||!l)return;let[t,n]=p(c,l)?[c,l]:[l,c],r=(n.row-t.row)*e.cols+(n.col-t.col)+1;e.select(t.col,t.row,Math.max(1,r))},h=()=>{clearTimeout(a),a=void 0};t().addEventListener(`touchstart`,t=>{if(t.touches.length!==1){h();return}!i&&e.hasSelection()&&e.clearSelection(),o=t.touches[0].clientX,s=t.touches[0].clientY,a=setTimeout(()=>{a=void 0,i=!0,n.onStart();let e=f(d(o,s));c=e.start,l=e.end,m(),navigator.vibrate?.(10)},y2)},{passive:!0,signal:r}),t().addEventListener(`touchmove`,e=>{let t=e.touches[0];if(t){if(i){l=d(t.clientX,t.clientY),m(),e.preventDefault();return}a&&Math.hypot(t.clientX-o,t.clientY-s)>b2&&h()}},{passive:!1,signal:r});let g=()=>{if(h(),!i)return;i=!1,n.onEnd();let t=e.getSelection();t&&Y_(t).then(e=>{e&&n.onCopy(t)})};return t().addEventListener(`touchend`,g,{signal:r}),t().addEventListener(`touchcancel`,g,{signal:r}),{selecting:()=>i}}var C2=5;function w2(e,t,n,r){let i=null,a=!1,o=0,s=0,c=()=>t().querySelector(`.xterm-screen`)||t(),l=(t,n)=>{let r=c().getBoundingClientRect();return{col:Math.max(0,Math.min(e.cols-1,Math.floor((t-r.left)/r.width*e.cols))),row:Math.max(0,Math.min(e.rows-1,Math.floor((n-r.top)/r.height*e.rows)))+e.buffer.active.viewportY}};t().addEventListener(`mousedown`,t=>{if(a||t.button!==0||t.shiftKey||t.altKey||t.ctrlKey||t.metaKey)return;t.preventDefault(),t.stopImmediatePropagation();let n=t.timeStamp;s=n-o<400?s+1:1,o=n;let r=l(t.clientX,t.clientY);i={startX:t.clientX,startY:t.clientY,startCol:r.col,startRow:r.row,selecting:!1,detail:s},e.focus()},{capture:!0,signal:r}),window.addEventListener(`mousemove`,t=>{if(!i)return;if(!i.selecting){if(Math.hypot(t.clientX-i.startX,t.clientY-i.startY)<C2)return;i.selecting=!0}let n=l(t.clientX,t.clientY),r=(n.row-i.startRow)*e.cols+(n.col-i.startCol)+1,[a,o,s]=r>=0?[i.startCol,i.startRow,Math.max(1,r)]:[n.col,n.row,Math.max(1,-r+1)];e.select(a,o,s),t.preventDefault()},{signal:r}),window.addEventListener(`mouseup`,async t=>{if(!i)return;let r=i.selecting,o=i;if(i=null,r){let t=e.getSelection();t&&await Y_(t)&&n(t);return}a=!0;let s={bubbles:!0,cancelable:!0,clientX:o.startX,clientY:o.startY,button:0,buttons:1,detail:o.detail,view:window},c=document.elementFromPoint(o.startX,o.startY);c?.dispatchEvent(new MouseEvent(`mousedown`,s)),c?.dispatchEvent(new MouseEvent(`mouseup`,{...s,buttons:0,button:0})),c?.dispatchEvent(new MouseEvent(`click`,{...s,buttons:0})),a=!1,t.preventDefault()},{signal:r})}var T2=gr,E2=(e=>`/${e}&`)(_r);function D2(e){xr(e.a,`M15 4L8 20`)}var O2=(e,t)=>yr(e.a,t),k2=(e,t)=>br(e.a,t),A2=gr,j2=(e=>`/${e}&`)(_r);function M2(e){xr(e.a,`M7 12L17 12 M7 8L13 8 M3 20.2895V5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V15C21 16.1046 20.1046 17 19 17H7.96125C7.35368 17 6.77906 17.2762 6.39951 17.7506L4.06852 20.6643C3.71421 21.1072 3 20.8567 3 20.2895Z`)}var N2=(e,t)=>yr(e.a,t),P2=(e,t)=>br(e.a,t),F2=gr,I2=(e=>`/${e}&`)(_r);function L2(e){xr(e.a,`M8.5 4H6C4.89543 4 4 4.89543 4 6V20C4 21.1046 4.89543 22 6 22H18C19.1046 22 20 21.1046 20 20V6C20 4.89543 19.1046 4 18 4H15.5 M8 6.4V4.5C8 4.22386 8.22386 4 8.5 4C8.77614 4 9.00422 3.77604 9.05152 3.50398C9.19968 2.65171 9.77399 1 12 1C14.226 1 14.8003 2.65171 14.9485 3.50398C14.9958 3.77604 15.2239 4 15.5 4C15.7761 4 16 4.22386 16 4.5V6.4C16 6.73137 15.7314 7 15.4 7H8.6C8.26863 7 8 6.73137 8 6.4Z`)}var R2=(e,t)=>yr(e.a,t),z2=(e,t)=>br(e.a,t),B2=gr,V2=(e=>`/${e}&`)(_r);function H2(e){xr(e.a,`M21 3.6V20.4C21 20.7314 20.7314 21 20.4 21H3.6C3.26863 21 3 20.7314 3 20.4V3.6C3 3.26863 3.26863 3 3.6 3H20.4C20.7314 3 21 3.26863 21 3.6Z M3 16L10 13L21 18 M16 10C14.8954 10 14 9.10457 14 8C14 6.89543 14.8954 6 16 6C17.1046 6 18 6.89543 18 8C18 9.10457 17.1046 10 16 10Z`)}var U2=(e,t)=>yr(e.a,t),W2=(e,t)=>br(e.a,t),G2=`<div class=term-wrap><div class=term></div><!><!><!><!></div><!><!>`,K2=` D b%b%b%b%l%c`,q2=400,J2=55,Y2=3e4,X2=150,Z2=[[{kind:`paste`},{kind:`key`,label:`▲`,seq:`\x1B[A`},{kind:`attach`}],[{kind:`key`,label:`◀`,seq:`\x1B[D`},{kind:`key`,label:`↵`,seq:`\r`},{kind:`key`,label:`▶`,seq:`\x1B[C`}],[{kind:`key`,label:`⇥`,seq:` `},{kind:`key`,label:`▼`,seq:`\x1B[B`},{kind:`key`,label:`^C`,seq:``}]],Q2=L(`o20`,e=>A(e.a,`click`,function(){e._._._.d.click()})),$2=e=>{H2(e.b),U2(e.b,16),W2(e.b),Q2(e)},e4=L(`o19`,e=>{A(e.a,`pointerdown`,function(e){e.preventDefault()}),A(e.a,`click`,function(){e._._._._.ak()})}),t4=e=>{L2(e.b),R2(e.b,16),z2(e.b),e4(e)},n4=P(0,2,e=>{gt(e.a,{enter:e._.e===`↵`,"big-glyph":e._.e===`↵`||e._.e===`⇥`}),V(e.b,e._.e)}),r4=L(`o21`,e=>{A(e.a,`pointerdown`,function(t){t.preventDefault(),e._._._._.af(e._.f)}),A(e.a,`pointerup`,function(){e._._._._.ag()}),A(e.a,`pointercancel`,function(){e._._._._.ag()}),A(e.a,`pointerleave`,function(){e._._._._.ag()}),A(e.a,`contextmenu`,function(e){e.preventDefault()})}),i4=O(0,(e=>`<button title=Paste>${e}</button>`)(F2),(e=>` D/${e}&l`)(I2),t4,(e=>`<button title="Attach image">${e}</button>`)(B2),(e=>` D/${e}&l`)(V2),$2,`<button class=repeat> </button>`,` D `,e=>{n4._(e),r4(e)}),a4=(e,t)=>i4(e,t===`paste`?0:t===`attach`?1:2),o4=(e,t)=>{a4(e,t[0]?.kind),s4(e,t[0]?.label),c4(e,t[0]?.seq)},s4=M(4),c4=M(5),l4=k(0,`<!><!><!>`,`b%`,0,o4),u4=(e,t)=>l4(e,[t]),d4=(e,t)=>u4(e,t[0]),f4=I(60,L(`o17`,e=>A(e.a,`click`,function(){e._._.a7?.send(`\x1B`)})),e=>e._._),p4=L(`o18`,e=>A(e.a,`pointerdown`,function(e){e.preventDefault()})),m4=e=>{f4(e),p4(e)},h4=P(5,0,L(`o8`,e=>{e._.a5&&setTimeout(()=>e.c?.focus(),50)})),g4=L(`o9`,e=>{A(e.a,`click`,function(){F3(e._,!1)}),A(e.b,`click`,function(e){e.stopPropagation()}),A(e.c,`paste`,function(t){t.preventDefault(),e._.aj(t.clipboardData)}),A(e.d,`click`,function(){F3(e._,!1)})}),_4=e=>{h4._(e),g4(e)},v4=L(`o7`,e=>A(e.a,`click`,function(){E3(e._,!1)})),y4=I(51,e=>ht(e.a,[`dot`,hr(e._._.r)]),e=>e._._),b4=e=>{y4(e),x4(e)},x4=I(57,e=>V(e.b,e._._.y),e=>e._._),S4=M(3,e=>{z(e.a,`title`,`New ${e.d} session`),Yr(e.b,e.d)}),C4=L(`o15`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._.p?.(e.d)})),w4=e=>{e.b,Kr(e.b,15),Xr(e.b),C4(e)},T4=(e,t)=>S4(e,t[0]),E4=N(1,e=>{B(e.a,`armed`,e._._._.g===e._.j),z(e.a,`title`,e._._._.g===e._.j?`Really kill this session?`:`Kill session`)}),D4=I(8,E4,e=>e._._._),O4=L(`o13`,e=>A(e.a,`click`,function(t,n){e._._._.g===e._.j?(X4(e._._._,null),n.closest(`[popover]`)?.hidePopover(),e._._._._._.w?.(e._.j)):X4(e._._._,e._.j)})),k4=e=>{D4(e),A4._(e),O4(e)},A4=P(6,0,E4),j4=L(`o12`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._._._.v?.(e._.j)})),M4=e=>{Vf(e.b),Hf(e.b,12),Uf(e.b),j4(e)},N4=N(10,e=>B(e.a,`current`,e.j===e._._._._.t)),P4=I(53,N4,e=>e._._._._),F4=L(`o14`,e=>A(e.b,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e.j!==e._._._._.t&&e._._._._.u?.(e.j)})),I4=e=>{P4(e),R4(e),B4(e),e.d,Kr(e.d,14),Xr(e.d),F4(e)},L4=O(5,(e=>`<button class="sess-x sess-edit" title="Rename session">${e}</button>`)(zf),(e=>` D/${e}&l`)(Bf),M4),R4=I(54,e=>L4(e,+!e._._._._.v),e=>e._._._._),z4=O(6,`<button class=sess-x>×</button>`,` `,k4),B4=I(55,e=>z4(e,+!e._._._._.w),e=>e._._._._),V4=M(9,e=>{N4(e),A4(e)}),H4=(e,t)=>ht(e.c,[`dot`,hr(t)]),U4=N(14,e=>V(e.e,e.n||e.m)),W4=M(12,e=>{Yr(e.d,e.m),U4(e)}),G4=M(13,U4),K4=k(0,(e=>`<div class=sess-row><button class=sess-open><span></span>${e}<span class=sess-title> </span></button><!><!></div>`)(Lr),(e=>` D D b/${e}&D m%b%l`)(`b%c`),I4,(e,t)=>{V4(e,t[0]?.id),H4(e,t[0]?.state),W4(e,t[0]?.agent),G4(e,t[0]?.title)}),q4=I(52,e=>K4(e,[e._._._.s||[],`id`]),e=>e._._._),J4=q4,Y4=I(50,e=>Yr(e.b,e._._.q||`shell`),e=>e._._),X4=j(6,F(D4)),Z4=(e,t)=>{z(e.a,`popovertarget`,t),z(e.d,`id`,t)},Q4=L(`o16`,e=>A(e.d,`toggle`,function(t,n){if(X4(e,null),t.newState===`open`){let t=e.a.getBoundingClientRect();n.style.top=`${Math.max(8,t.top-n.offsetHeight-8)}px`,n.style.left=`${Math.max(8,Math.min(t.left+t.width/2-n.offsetWidth/2,window.innerWidth-n.offsetWidth-8))}px`}})),$4=e=>{Y4(e),e3(e),n3(e),i3(e),e.b,Kr(e.b,16),Xr(e.b),X4(e,null),Z4(e,Qe(e)),Q4(e)},e3=I(51,e=>ht(e.c,[`dot`,`sess-dot`,hr(e._._.r)]),e=>e._._),t3=O(4,`<!><!><!>`,`b%`,J4),n3=I(52,e=>{B(e.f,`lone`,(e._._.s||[]).length<=1),t3(e,(e._._.s||[]).length>1?0:1)},e=>e._._),r3=k(5,(e=>`<button class=icon-btn>${e}</button>`)(Lr),(e=>` D/${e}&l`)(`b%c`),w4,T4),i3=I(56,e=>r3(e,[[...e._._.x||[],`shell`],e=>e]),e=>e._._),a3=L(`o11`,e=>{A(e.a,`click`,function(){e._._.m?.()}),A(e.c,`click`,function(){e._._.n?.()}),A(e.e,`click`,function(){e._._.o?.()})}),o3=e=>{Jm(e.b),Ym(e.b,16),Xm(e.b),kr(e.d),Ar(e.d,16),jr(e.d),wr(e.f),Tr(e.f,16),Er(e.f),a3(e)},s3=L(`o10`,e=>A(e.a,`click`,function(){e._._.l?.()})),c3=O(0,(e=>`<button class="icon-btn kbtn" title="Back to terminal">${e}</button>`)(cv),(e=>` D/${e}&l`)(lv),e=>{uv(e.b),dv(e.b,16),fv(e.b),s3(e)},((e,t,n)=>`<button class="icon-btn kbtn" title=Workspaces>${e}</button><button class="icon-btn kbtn" title="Manage workspace">${t}</button><button class="icon-btn kbtn" title="Review changes">${n}</button>`)(Km,Dr,Sr),((e,t,n)=>` D/${e}&l D/${t}&l D/${n}&l`)(qm,Or,Cr),o3),l3=O(8,`<button class="icon-btn kbtn kbtn-esc" title=Escape>esc</button>`,` `,m4),u3=O(1,(e=>`<button class="icon-btn kbtn sess-btn" title=Sessions>${e}<span></span></button><div popover=auto class=sess-pop><!><div class=sess-new></div></div>`)(Lr),(e=>` D/${e}& l D%b l`)(`b%c`),$4),d3=N(11,e=>u3(e,e._.k!==`diff`&&e._.p?0:1)),f3=P(6,0,e=>{c3(e,e._.k===`diff`?0:1),l3(e,+(e._.k===`diff`)),d3(e)}),p3=(e,t)=>{z(e.e,`popovertarget`,t),z(e.j,`id`,t)},m3=k(9,`<!><!><!>`,`b%`,0,d4),h3=L(`o23`,e=>{A(e.d,`change`,function(t,n){for(let t of n.files||[])e._.ah(t);n.value=``}),A(e.e,`pointerdown`,function(e){e.preventDefault()}),A(e.g,`pointerdown`,function(e){e.preventDefault()}),A(e.j,`pointerdown`,function(e){e.preventDefault()}),A(e.j,`toggle`,function(t,n){if(t.newState===`open`){let t=e.e.getBoundingClientRect();n.style.top=`${Math.max(8,t.top-n.offsetHeight-8)}px`,n.style.bottom=`auto`}})}),g3=e=>{f3._(e),_3._(e),y3._(e),b3._(e),x3._(e),D2(e.f),O2(e.f,16),k2(e.f),M2(e.h),N2(e.h,16),P2(e.h),p3(e,Qe(e)),m3(e,[Z2]),h3(e)},_3=P(6,0,d3),v3=O(2,`<span class="kbar-ws dim" aria-hidden=true><span></span><span class=kbar-ws-name> </span></span>`,`D bD `,b4),y3=P(6,0,e=>v3(e,+!e._.y)),b3=P(6,0,e=>{B(e.g,`on`,e._.a1),z(e.g,`title`,e._.a1?`Hide keyboard`:`Show keyboard`)}),x3=P(6,0,L(`o22`,e=>A(e.g,`click`,function(){D3(e._,!e._.a1),e._.a7?.setKeyboard(e._.a1)}))),S3=tee(`o6`,1),C3=et(42),w3=O(4,`<div class=term-dead><button class="btn primary">Reconnect</button></div>`,`D `,v4),T3=N(47,L(`o24`,e=>Et(e,{onMount:function(){let t=new AbortController,n=t.signal,r=new fZ({fontSize:13,fontFamily:`ui-monospace, monospace`,scrollback:5e3,allowProposedApi:!0,rightClickSelectsWord:!0,macOptionClickForcesSelection:!0,linkHandler:{activate(e,t){ur(t)}}}),i=new S0;r.loadAddon(i),r.open(e.b);let a=sr();try{let e=new y0;e.onContextLoss(()=>e.dispose()),r.loadAddon(e)}catch{}try{r.loadAddon(new o2(void 0,{readText:()=>navigator.clipboard.readText().catch(()=>``),writeText:(e,t)=>Y_(t).then(()=>{})}))}catch{}r.loadAddon(new m2((e,t)=>ur(t))),i.fit();let o=a?_2(r):null,s=o?o.write:e=>r.write(e),c=h2({sessionId:e.t,term:r,write:s,onDead:()=>{E3(e,!0)},isVisible:()=>!!e.z},n);r.onData(e=>c.send(e)),r.attachCustomKeyEventHandler(t=>t.key===`Enter`&&t.shiftKey?(t.type===`keydown`&&c.send(`\x1B\r`),!1):(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`c`&&r.hasSelection()?(t.type===`keydown`&&Y_(r.getSelection()).then(t=>{t&&(r.clearSelection(),e.ab())}),!1):t.type===`keydown`&&(t.metaKey&&t.key.toLowerCase()===`v`||t.ctrlKey&&t.shiftKey&&t.key.toLowerCase()===`v`)?(e.ak(),!1):!(a&&t.type===`keydown`&&t.key===`Backspace`));let l=()=>{if(!e.b.clientWidth)return;let t=i.proposeDimensions();!t||t.cols===r.cols&&t.rows===r.rows||(i.fit(),c.resize(r.cols,r.rows))},u=new ResizeObserver(l);u.observe(e.b),n.addEventListener(`abort`,()=>u.disconnect());let d=()=>requestAnimationFrame(l);if(document.addEventListener(`visibilitychange`,()=>{document.hidden||d()},{signal:n}),window.addEventListener(`pageshow`,d,{signal:n}),window.addEventListener(`focus`,d,{signal:n}),window.visualViewport?.addEventListener(`resize`,d,{signal:n}),e.b.addEventListener(`paste`,t=>{let n=[...t.clipboardData?.files||[]];if(n.length){t.preventDefault(),t.stopImmediatePropagation();for(let t of n)e.ah(t)}},{capture:!0,signal:n}),e.a7={send(e){c.send(e)},setKeyboard(e){let t=r.textarea;t&&(t.inputMode=e?`text`:`none`,e?(t.focus(),setTimeout(()=>{document.activeElement!==t&&t.focus()},50)):t.blur())}},a){r.textarea&&(r.textarea.inputMode=`none`);let t=window.visualViewport;if(t){let i=0,a=()=>{i=Math.max(i,t.height),e.a1&&i-t.height<X2&&(D3(e,!1),r.textarea&&(r.textarea.inputMode=`none`))};a(),t.addEventListener(`resize`,a,{signal:n}),window.addEventListener(`orientationchange`,()=>{i=0},{signal:n})}let i=S2(r,S3(e),{onStart(){o?.setFrozen(!0)},onEnd(){o?.setFrozen(!1)},onCopy(){e.ab()}},n);g2(r,S3(e),n,i.selecting),v2(r,e=>c.send(e),n)}else w2(r,S3(e),()=>e.ab(),n);e.z&&!a&&r.focus();let f={term:r,socket:c,abort:t,suspend:void 0};return e.z||(f.suspend=setTimeout(()=>c.disconnect(),Y2)),f},onUpdate:function(){clearTimeout(this.suspend),this.socket.syncVisibility(),e.z?(!e.a0&&this.socket.readyState>=WebSocket.CLOSING&&(this.term.reset(),this.socket.reconnect()),!e.a0&&!e.a2&&this.term.focus()):this.suspend=setTimeout(()=>this.socket.disconnect(),Y2)},onDestroy:function(){clearTimeout(this.suspend),this.abort.abort(),this.term.dispose()}})),8),E3=j(26,e=>{w3(e,+!e.a0),T3(e)}),D3=j(27,e=>{T3(e),b3(e)}),O3=O(6,((e,t)=>`<div class=kb-slot><div class=key-bar><!><div class=kspacer></div><!><input type=file accept=image/* hidden><button class="icon-btn kbtn dpad-btn" title="More keys">${e}</button><button class="icon-btn kbtn kb-toggle">${t}</button><!><div popover=auto class=dpad-grid></div></div></div>`)(T2,A2),((e,t)=>`E%b b%b b D/${e}&l D/${t}&l%b m`)(E2,j2),g3),k3=j(28,e=>{O3(e,+!e.a2),T3(e)}),A3=O(2,`<div class="term-uploading dim">uploading…</div>`),j3=j(29,e=>A3(e,+!e.a3)),M3=O(3,`<div class=term-copied>Copied</div>`),N3=j(30,e=>M3(e,+!e.a4)),P3=O(5,`<div class=trap-backdrop><div class=paste-trap><p class=dim>Long-press below and choose Paste</p><input placeholder="Paste here…"><button class=btn>Cancel</button></div></div>`,` D Db b `,_4),F3=j(31,e=>{P3(e,+!e.a5),h4(e)}),I3=(e,t)=>J3(e,t.current),L3=(e,t)=>X3(e,t.timer),R3=(e,t)=>Q3(e,t.current),z3=L(`o25`,e=>{k3(e,sr()),A(e.a,`dragover`,function(e){e.preventDefault()}),A(e.a,`drop`,function(t){t.preventDefault();for(let n of t.dataTransfer?.files||[])e.ah(n)})});function B3(e){E3(e,!1),D3(e,!1),k3(e,!1),j3(e,!1),N3(e,!1),F3(e,!1),I3(e,{current:null}),L3(e,{timer:0}),R3(e,{current:null}),z3(e)}var V3=M(41),H3=N(40,e=>V3(e,v6(e))),U3=M(45),W3=M(46,T3),G3=N(44,e=>{U3(e,y6(e)),W3(e,b6(e))}),K3=M(43,e=>{G3(e),T3(e)}),q3=N(34,e=>K3(e,x6(e))),J3=M(33,e=>{H3(e),q3(e),G3(e),T3(e)}),Y3=M(37,T3),X3=M(36,e=>Y3(e,S6(e))),Z3=M(42),Q3=M(39,e=>{Z3(e,C6(e)),H3(e)}),$3=M(9,q3),e6=M(10,e=>{z(e.a,`hidden`,e.k===`diff`),f3(e)}),t6=F(P4),n6=M(19,e=>{T3(e),t6(e)}),r6=M(25,T3),i6=M(11),a6=M(12),o6=M(13),s6=M(14),c6=M(15,_3),l6=M(16,F(Y4)),u6=M(17,F(e3,y4)),d6=M(18,F(n3,q4)),f6=M(20),p6=M(21,F(R4)),m6=M(22,F(B4)),h6=M(23,F(i3)),g6=F(x4),_6=M(24,e=>{y3(e),g6(e)});function v6(e){return t=>{C3(e)(),e.a7?.send(t);let n={};n.delay=setTimeout(()=>{n.repeat=setInterval(()=>e.a7?.send(t),J2)},q2),e.ad=n}}function y6(e){return async t=>{let n=[...t?.files||[]];for(let t of n)await e.ah(t);if(!n.length){let n=t?.getData(`text/plain`);n&&e.a7?.send(n)}F3(e,!1)}}function b6(e){return async()=>{if(!navigator.clipboard?.read){F3(e,!0);return}try{for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));if(n){let r=await t.getType(n);await e.ah(new File([r],`pasted.${n.split(`/`)[1]||`png`}`,{type:n}))}else if(t.types.includes(`text/plain`)){let n=await(await t.getType(`text/plain`)).text();n&&e.a7?.send(n)}}}catch{F3(e,!0)}}}function x6(e){return async t=>{if(t){j3(e,!0);try{let n=await(await fetch(`/api/workspaces/${e.j}/assets?name=${encodeURIComponent(t.name||`pasted.png`)}`,{method:`POST`,body:t})).json();n.path&&e.a7?.send(`${n.path} `)}finally{j3(e,!1)}}}}function S6(e){return()=>{clearTimeout(e.aa),N3(e,!0),e.aa=setTimeout(()=>{N3(e,!1)},1200)}}function C6(e){return()=>{let t=e.ad;t&&(clearTimeout(t.delay),clearInterval(t.repeat),e.ad=null)}}R(`o1`,v6),R(`o4`,y6),R(`o5`,b6),R(`o3`,x6),R(`o0`,S6),R(`o2`,C6);var w6=ks,T6=(e=>`/${e}&`)(As);function E6(e){let t=Math.round(e/6e4);if(t<60)return`${t}m`;let n=Math.round(t/60);return n<48?`${n}h`:`${Math.round(n/24)}d`}function D6(e,t){if(!e)return null;let n=new Date(e).getTime()-Date.now();return n<=0?t?null:`now`:E6(n)}var O6=(e,t)=>V(e.e,t?`↻ ${pt(t)}`:``),k6=N(9,e=>O6(e,D6(e.i,e._.h!=null))),A6=Ke(4,k6),j6=A6,M6=N(12,e=>z(e.a,`title`,`${e.k}: ${e.l}% used${e.i?` — resets ${new Date(e.i).toLocaleString()}`:``}`),2),N6=M(11,e=>{V(e.d,e.l),M6(e)}),P6=M(7,e=>{gt(e.c,{hot:e.h>=90,warm:e.h>=70&&e.h<90}),_t(e.c,`width:${Math.min(100,Math.max(2,e.h))}%`),N6(e,Math.round(e.h))}),F6=M(8,e=>{k6(e),M6(e)}),I6=M(10,e=>{V(e.b,e.k),M6(e)}),L6=(e,t)=>{P6(e,t[0]?.used_percent),F6(e,t[0]?.resets_at),I6(e,t[0]?.window)},R6=P(3,0,e=>{z(e.a,`title`,`plan-usage could not reach this provider — these are its last cached numbers, ${E6(e._.h*1e3)} old`),V(e.b,E6(e._.h*1e3))}),z6=R6,B6=P(2,0,e=>V(e.a,e._.j.replace(/^default_/,``).replaceAll(`_`,` `))),V6=B6,H6=O(3,`<span class=usage-stale>⚠ <!> old</span>`,` Db%`,z6),U6=M(7,e=>{B(e.a,`stale`,e.h!=null),H6(e,+(e.h==null)),R6(e),A6(e)}),W6=(e,t)=>V(e.b,t),G6=O(2,`<span class=dim> </span>`,`D `,V6),K6=M(9,e=>{G6(e,+!e.j),B6(e)}),q6=k(4,`<div class=meter><span class="meter-label dim"> </span><span class=meter-track><span class=meter-fill></span></span><span class=meter-pct><!>%</span><span class="meter-reset dim"> </span></div>`,` E lD lD%lD `,j6,L6),J6=(e,t)=>q6(e,[t||[],`window`]),Y6=k(0,`<div class=usage-row><div class=usage-name><strong> </strong><!><!></div><div class=usage-meters></div></div>`,` F l%b%l `,0,(e,t)=>{U6(e,t[0]?.stale_seconds),W6(e,t[0]?.agent),K6(e,t[0]?.plan),J6(e,t[0]?.windows)}),X6=I(12,e=>Y6(e,[e._._.g||[],e=>`${e.agent}-${e.account||``}`]),e=>e._._),Z6=X6,Q6=I(11,e=>V(e.a,e._._.f),e=>e._._),$6=O(2,`<p class=dim><span class=spin></span> Loading usage…</p>`,0,0,`<p class=dim> </p>`,`D `,Q6,`<div class=usage-list></div>`,` `,Z6),e8=I(10,e=>$6(e,e._.e?e._.e?.error?1:2:0)),t8=L(`p3`,e=>A(e.a,`click`,function(){e._.j()})),n8=e=>{e8(e),r8(e),So(e.b),Co(e.b,13),wo(e.b),t8(e)},r8=I(13,e=>{B(e.a,`spinning`,e._.h),z(e.a,`disabled`,e._.h)}),i8=ut(`p4`,(e=>`<header class=manage-head><div><h2>Usage</h2></div><button class=icon-btn title="Refresh usage">${e}</button></header><!><!>`)(bo),(e=>`Db D/${e}&m%c`)(xo),n8),a8=F(e8),o8=j(4,e=>{s8(e,e.e?.error),c8(e,e.e?.agents),a8(e)}),s8=M(5,F(Q6)),c8=M(6,F(X6)),l8=j(7,F(r8)),u8=M(9),d8=L(`p5`,e=>Et(e,{onMount:function(){e.i(!1)}})),f8=M(8,e=>{u8(e,h8(e)),d8(e)});function p8(e){zs(e.a),js(e.a,i8(e)),Vs(e.a,`Usage`),Bs(e.a,`usage-modal`),Rs(e.a),Gs(e.a),o8(e,null),l8(e,!1),f8(e,g8(e))}var m8=M(3,e=>Ws(e.a,_8(e)));function h8(e){return async()=>{l8(e,!0),await e.i(!0),l8(e,!1)}}function g8(e){return async t=>{try{o8(e,await H(`/api/usage${t?`?refresh`:``}`))}catch(t){o8(e,{error:String(t.message||t)})}}}function _8(e){return function(){e.d()}}R(`p1`,h8),R(`p0`,g8),R(`p2`,_8);var v8=ks,y8=(e=>`/${e}&`)(As),b8=et(1,`B2`),x8=I(12,e=>V(e.a,e._.f)),S8=L(`k4`,e=>{It(e,`b`),A(e.b,`keydown`,function(t){t.key===`Enter`?(t.preventDefault(),e._.l()):t.key===`Escape`&&e._.j&&e._.g()})}),C8=e=>{x8(e),w8(e),T8(e),S8(e)},w8=I(14,e=>z(e.b,`placeholder`,e._.i)),T8=I(15,e=>Ft(e,`b`,e._.j,G8(e))),E8=ut(`k6`,`<h2 class=prompt-title> </h2><input>`,`D l `,C8,0,`B2`),D8=I(13,e=>V(e.b,e._.h||`OK`)),O8=L(`k3`,e=>{A(e.a,`click`,function(){e._.l()}),A(e.c,`click`,function(){e._.g()})}),k8=e=>{D8(e),A8(e),O8(e)},A8=I(15,e=>z(e.a,`disabled`,!e._.j.trim())),j8=dt(`k5`,`<button class="btn primary"> </button><div class=spacer></div><button class=btn>Cancel</button>`,` D lb `,k8),M8=M(11),N8=N(10,e=>M8(e,K8(e))),P8=F(A8,T8),F8=j(9,e=>{N8(e),P8(e)}),I8=(e,t)=>F8(e,t||``),L8=M(4,N8),R8=L(`k7`,e=>Et(e,{onMount:function(){setTimeout(()=>{let t=b8(e)();t?.focus(),t?.select()},0)}}));function z8(e){zs(e.a),Gs(e.a,on({content:j8(e)})),js(e.a,E8(e)),Bs(e.a,`prompt-dlg`),Rs(e.a),R8(e)}var B8=F(x8),V8=M(5,e=>{Vs(e.a,e.f),B8(e)}),H8=M(6,e=>Ws(e.a,q8(e))),U8=M(7,F(D8)),W8=M(8,F(w8));function G8(e){return t=>{F8(e._,t)}}function K8(e){return()=>{let t=e.j.trim();t&&e.e(t)}}function q8(e){return function(){e.g()}}R(`k0`,G8),R(`k1`,K8),R(`k2`,q8);var J8=((e,t)=>`<div class=work-view>${e}<div class=main-col><!><!>${t}<!><!><div class=term-area></div></div><!><!></div>`)(fh,DF),Y8=((e,t)=>`D/${e}&D%b%b/${t}&%b%b l%b%l`)(ph,OF),X8=N(1,e=>I8(e.a,e._.a6||e._.a7)),Z8=P(8,0,X8),Q8=e=>{Z8._(e),$8._(e),t5._(e),n5._(e),z8(e.a),V8(e.a,`Rename session`),U8(e.a,`Rename`),H8(e.a,g7(e)),W8(e.a)},$8=P(8,0,X8),e5=N(2,e=>L8(e.a,_7(e))),t5=P(8,0,e5),n5=P(8,0,e5),r5=P(1,0,e=>V(e.a,e._.a3)),i5=L(`q29`,e=>A(e.b,`click`,function(){f7(e._,null)})),a5=e=>{r5._(e),i5(e)},o5=e=>{p8(e.a),m8(e.a,v7(e))},s5=N(2,e=>V(e.b,e._._.a4?`Starting…`:`Start ${e._._.o||`claude`}`)),c5=I(63,s5,e=>e._._),l5=L(`q30`,e=>A(e.a,`click`,function(){e._._.am(e._._.o||`claude`,!0)})),u5=e=>{c5(e),d5(e),l5(e)},d5=I(67,e=>{z(e.a,`disabled`,e._._.a4),s5(e)},e=>e._._),f5=N(8,e=>r6(e.b,e._._.n&&e._._.y===`term`&&e.g===e._._.ak),3),p5=I(62,f5,e=>e._._),m5=e=>{p5(e),h5(e),g5(e),v5(e),y5(e),b5(e),C5(e),w5(e),T5(e),B3(e.b),f6(e.b,S7(e)),s6(e.b,x7(e)),i6(e.b,b7(e)),a6(e.b,y7(e))},h5=I(64,e=>h6(e.b,e._._.r),e=>e._._),g5=I(65,e=>{e6(e.b,e._._.y),f5(e)},e=>e._._),_5=N(11,e=>c6(e.b,C7(e))),v5=I(71,e=>{$3(e.b,e._._.aa),o6(e.b,w7(e)),_5(e)},e=>e._._),y5=I(72,e=>_6(e.b,e._._.ag),e=>e._._),b5=I(73,e=>{d6(e.b,e._._.ah),p6(e.b,T7(e))},e=>e._._),x5=le(3,0,2),S5=N(7,e=>x5(e,e.g===e._._.ak)),C5=I(75,e=>{f5(e),S5(e)},e=>e._._),w5=I(76,e=>m6(e.b,E7(e)),e=>e._._),T5=I(78,_5,e=>e._._),E5=M(6,e=>{n6(e.b,e.g),f5(e),S5(e)}),D5=(e,t)=>u6(e.b,t),O5=(e,t)=>l6(e.b,t),k5=k(0,(e=>`<!><!>${e}<!><!><!>`)(G2),(e=>`b%b/${e}&%b%c`)(K2),m5,(e,t)=>{E5(e,t[0]?.id),D5(e,t[0]?.state),O5(e,t[0]?.agent)}),A5=P(6,0,e=>k5(e,[e._.ah,`id`])),j5=e=>{A5._(e),N5._(e)},M5=O(1,`<div class=empty-sess><p class=dim>No sessions in this workspace.</p><button class="btn primary"> </button></div>`,`Db D `,u5),N5=P(6,0,e=>M5(e,+!!e._.aj)),P5=M(59,n5),F5=O(6,`<!><!><!><!>`,`b%b%`,j5,`<p class="dim pad-inline">Loading sessions…</p>`),I5=L(`q33`,e=>{e.n&&window.addEventListener(`keydown`,t=>{if(t.key===`Escape`&&e.a1&&u7(e,!1),(t.metaKey||t.ctrlKey)&&t.shiftKey&&t.key.toLowerCase()===`d`&&(t.preventDefault(),c7(e,e.y===`diff`?`term`:`diff`)),t.altKey&&(t.key===`[`||t.key===`]`)&&(e.ah?.length??0)>1){t.preventDefault();let n=e.ah.map(e=>e.id);i7(e,n[(Math.max(0,n.indexOf(e.ak))+(t.key===`]`?1:n.length-1))%n.length]),c7(e,`term`)}},{capture:!0,signal:De(e,0)})}),L5=N(47,e=>{Ee(e,0),I5(e)},4),R5=F(C5),z5=M(46,e=>{Vg(e.a,e.ak),L5(e),R5(e)}),B5=N(44,e=>z5(e,(()=>{if(e.w&&e.ah?.some(t=>t.id===e.w))return e.w;let t=Jn(e.aa);return t&&e.ah?.some(e=>e.id===t)?t:e.ah?.[0]?.id??null})()),2),V5=F(b5),H5=M(43,e=>{T_(e.a,e.ah),WH(e.d,e.ah||[]),Ane(e,e.ah?.length),F5(e,+!e.ah),B5(e),L5(e),A5(e),V5(e)}),U5=N(40,e=>H5(e,e.v??e.m?.[e.aa]?.sessions??null),2),W5=N(57,L(`q31`,e=>Et(e,{active:e.n,load:e.au,onMount:function(){let t=new AbortController,n=t.signal,r={abort:t,started:!1,stale:!1,timer:void 0,refresh:()=>{if(document.hidden){r.stale=!0;return}r.stale=!1,this.load(!1)},sync:()=>{this.active?(r.started||(r.started=!0,this.load(!0)),r.timer??=setInterval(r.refresh,1e4)):r.stop()},stop:()=>{clearInterval(r.timer),r.timer=void 0}};return kn().addEventListener(`sessions.changed`,t=>{let n=t.data?.workspaceId;r.started&&(!n||n===e.aa)&&r.refresh()},{signal:n}),document.addEventListener(`visibilitychange`,()=>{!document.hidden&&r.stale&&r.refresh()},{signal:n}),Nn(()=>{if(!this.active)return;let t=Fn(e.aa);t&&(l7(e,t.pr||``),c7(e,`diff`));let n=Ln(e.aa);n&&(i7(e,n),c7(e,`term`))},n),r.sync(),r},onUpdate:function(){this.sync()},onDestroy:function(){this.abort.abort(),this.stop()}})),2),G5=M(56,W5),K5=N(55,e=>G5(e,O7(e)),2),q5=M(54,K5),J5=N(52,e=>q5(e,k7(e)),6),Y5=F(T5),X5=M(60,e=>{x_(e.a,A7(e)),Y5(e)}),Z5=N(49,e=>X5(e,j7(e)),2),Q5=M(48,e=>{J5(e),Z5(e)}),$5=N(38,e=>Q5(e,M7(e))),e7=M(58,F(w5)),t7=N(23,e=>e7(e,N7(e))),n7=j(21,e=>{P5(e,D7(e)),U5(e),$5(e),J5(e),t7(e)}),r7=N(39,L(`q32`,e=>{e.w&&Yn(e.aa,e.w)})),i7=j(22,e=>{B5(e),J5(e),t7(e),r7(e)}),a7=le(5,2,4),o7=N(25,e=>zH(e.d,e.n&&e.y===`diff`)),s7=F(g5),c7=j(24,e=>{Kg(e.a,e.y),B(e.g,`as-bar`,e.y===`diff`),a7(e,e.y===`diff`),L5(e),o7(e),s7(e)}),l7=j(26,e=>FH(e.d,e.a0)),u7=j(27,e=>{Qg(e.a,e.a1),L5(e)}),hne=O(7,w6,(e=>`/${e}&`)(T6),o5),d7=j(28,e=>hne(e,+!e.a2)),gne=O(1,`<p class=toast-error> <button title=Dismiss>×</button></p>`,`D b `,a5),f7=j(29,e=>{gne(e,+!e.a3),r5(e)}),p7=j(30,F(d5)),_ne=O(8,v8,(e=>`/${e}&`)(y8),Q8),m7=j(31,e=>{xne(e,e.a5?.title),Sne(e,e.a5?.agent),Cne(e,e.a5?.id),_ne(e,+!e.a5)}),vne=(e,t)=>{Fne(e,t.wanted),Ine(e,t.run)},yne=M(61);function bne(e){c_(e.a),Hg(e.a,W7(e)),qg(e.a,U7(e)),$g(e.a,H7(e)),l_(e.a,V7(e)),j_(e.a,B7(e)),A_(e.a,z7(e)),O_(e.a,R7(e)),C_(e.a,L7(e)),SH(e.d),qH(e.d,I7(e)),YH(e.d,F7(e)),n7(e,null),i7(e,null),c7(e,`term`),l7(e,``),u7(e,!1),d7(e,!1),f7(e,null),p7(e,!1),m7(e,null),vne(e,{wanted:!1,run:void 0}),yne(e,P7(e))}var xne=M(32,Z8),Sne=M(33,$8),Cne=M(34,t5),wne=(e,t)=>{Lg(e.a,t),Ene(e,t?.id),Dne(e,t?.status),One(e,t?.name)},h7=N(37,L(`q34`,e=>{if(e.n){let t=Fn(e.aa);t&&(l7(e,t.pr||``),c7(e,`diff`));let n=Ln(e.aa);n&&(i7(e,n),c7(e,`term`))}})),Tne=F(v5),Ene=M(36,e=>{RH(e.d,e.aa),U5(e),B5(e),h7(e),$5(e),J5(e),r7(e),Z5(e),W5(e),Tne(e)}),Dne=M(41,J5),One=M(42,F(y5)),kne=wne,Ane=M(45,N5),jne=M(12,e=>{m_(e.a,e.m),U5(e)}),Mne=F(p5),Nne=L(`q35`,e=>{e.n||u7(e,!1)}),Pne=M(13,e=>{u_(e.a,e.n),h7(e),L5(e),W5(e),o7(e),Mne(e),Nne(e)}),Fne=M(51,e=>{J5(e),K5(e)}),Ine=M(53,K5),Lne=F(c5),Rne=M(14,e=>{J5(e),Lne(e)}),zne=M(15,e=>{g_(e.a,e.p),Z5(e)}),Bne=(e,t)=>d_(e.a,t),Vne=F(h5),Hne=M(17,e=>{y_(e.a,e.r),Vne(e)}),Une=(e,t)=>E_(e.a,t),Wne=M(19,e=>__(e.a,e.t)),Gne=(e,t)=>M_(e.a,t);function g7(e){return function(){m7(e._,null)}}function _7(e){return function(t){e._.ax(e._.a8,t),m7(e._,null)}}function v7(e){return function(){d7(e._,!1)}}function y7(e){return function(){u7(e._._,!0)}}function b7(e){return function(){c7(e._._,`term`)}}function x7(e){return function(){l7(e._._,``),c7(e._._,`diff`)}}function S7(e){return function(t){i7(e._._,t)}}function C7(e){return function(t){e._._.ay(e._._.aa,t)}}function w7(e){return function(){e._._.t?.(e._._.aa)}}function T7(e){return function(t){let n=(e._._.ah||[]).find(e=>e.id===t);n&&m7(e._._,n)}}function E7(e){return function(t){e._._.aw(t)}}function D7(e){return async(t,n)=>{n=n.trim(),n&&(n7(e,(e.v||[]).map(e=>e.id===t?{...e,title:n}:e)),await fetch(`/api/sessions/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({title:n})}))}}function O7(e){return t=>(t&&(e.ap=!0),(e.ar??=Rn(e.as))())}function k7(e){return async()=>{let t=e.ap;e.ap=!1;try{let n=await H(`/api/workspaces/${e.aa}/sessions`);if(!n.length&&t&&e.af===`active`){let t=await e.am(e.o||`claude`,!1);n=t?[t]:[]}n7(e,n);let r=Jn(e.aa);r&&n.some(e=>e.id===r)&&i7(e,r),e.v.some(t=>t.id===e.w)||i7(e,e.v?.[0]?.id||null)}catch(t){n7(e,e.v||[]),f7(e,String(t))}}}function A7(e){return function(t,n){e.ay(t,n)}}function j7(e){return async(t,n)=>{if(t===e.aa){let r=await e.am(n,!0);r&&Yn(t,r.id);return}try{Yn(t,(await H(`/api/workspaces/${t}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:n})})).id),e.p?.(t)}catch(t){f7(e,String(t.message||t))}}}function M7(e){return async(t,n)=>{p7(e,!0);try{let r=await H(`/api/workspaces/${e.aa}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:t})});return n&&(n7(e,(e.v||[]).concat(r)),i7(e,r.id)),r}catch(t){return f7(e,String(t.message||t)),null}finally{p7(e,!1)}}}function N7(e){return async t=>{try{await H(`/api/sessions/${t}`,{method:`DELETE`}),n7(e,(e.v||[]).filter(e=>e.id!==t)),e.w===t&&i7(e,e.v?.[0]?.id||null)}catch(t){f7(e,`Kill session failed: ${String(t.message||t)}`)}}}function P7(e){return t=>{m7(e,t)}}function F7(e){return function(){c7(e,`term`)}}function I7(e){return function(t){i7(e,t),c7(e,`term`)}}function L7(e){return function(t){l7(e,t||``)}}function R7(e){return function(t){e.az(t)}}function z7(e){return function(t){e.aw(t)}}function B7(e){return function(){d7(e,!0)}}function V7(e){return function(t){f7(e,t)}}function H7(e){return t=>{u7(e,t)}}function U7(e){return t=>{c7(e,t)}}function W7(e){return function(t){i7(e,t)}}R(`q28`,g7),R(`q27`,_7),R(`q26`,v7),R(`q24`,y7),R(`q23`,b7),R(`q22`,x7),R(`q19`,S7),R(`q18`,C7),R(`q25`,w7),R(`q21`,T7),R(`q20`,E7),R(`q4`,D7),R(`q2`,O7),R(`q1`,k7),R(`q12`,A7),R(`q5`,j7),R(`q0`,M7),R(`q3`,N7),R(`q6`,P7),R(`q17`,F7),R(`q16`,I7),R(`q15`,L7),R(`q14`,R7),R(`q13`,z7),R(`q11`,B7),R(`q10`,V7),R(`q9`,H7),R(`q8`,U7),R(`q7`,W7);var G7=I(40,e=>V(e.a,e._._.t),e=>e._._),Kne=L(`b19`,e=>A(e.b,`click`,function(){I9(e._._,null),e._._.v()})),qne=O(0,`<p> </p><button class=btn>Retry</button>`,`D l `,e=>{G7(e),Kne(e)},`<span class=spin></span>Loading workspaces…`),K7=P(1,0,e=>qne(e,+!e._.t)),Jne=K7,q7=P(0,0,e=>V(e.a,e._.t)),Yne=L(`b18`,e=>A(e.b,`click`,function(){I9(e._,null)})),Xne=e=>{q7._(e),Yne(e)},J7=I(34,e=>Bne(e.b,e._._.g),e=>e._._),Zne=e=>{J7(e),Y7(e),X7(e),$7(e),e9(e),t9(e),n9(e),r9._(e),i9._(e),bne(e.b),Une(e.b,R9(e)),Gne(e.b,L9(e))},Y7=I(35,e=>jne(e.b,e._._.h),e=>e._._),X7=I(36,e=>{Rne(e.b,e._._.i?e._._.i?.preferredAgent:`claude`),Hne(e.b,e._._.i?e._._.i?.agents:[`claude`])},e=>e._._),Z7=N(5,e=>Pne(e.b,!e._._.p&&!e._._.a5&&e._.f===e._._.k),3),Qne=le(3,0,2),Q7=N(4,e=>Qne(e,e._.f===e._._.k)),$7=I(37,e=>{Z7(e),Q7(e)},e=>e._._),e9=I(38,Z7,e=>e._._),t9=I(41,e=>zne(e.b,z9(e)),e=>e._._),n9=I(42,Z7,e=>e._._),r9=P(0,0,e=>kne(e.b,e._.e)),i9=P(0,0,e=>{Wne(e.b,B9(e)),Z7(e),Q7(e)}),$ne=O(0,(e=>`<!><!>${e}<!><!><!>`)(J8),(e=>`b%b/${e}&%b%c`)(Y8),Zne),ere=M(4,e=>{nre(e,e.e?.id),$ne(e,+!e.e),r9(e)}),a9=N(3,e=>ere(e,e._.g.find(t=>t.id===e.c))),o9=Ke(5,a9),tre=o9,nre=M(5,i9),rre=M(2,a9),ire=(e,t)=>rre(e,t[0]),s9=N(1,e=>Of(e.a,V9(e))),c9=P(4,0,s9),are=e=>{c9._(e),l9._(e),Cf(e.a),kf(e.a,H9(e))},l9=P(4,0,s9),u9=P(3,0,e=>Zu(e.a,U9(e))),ore=e=>{u9._(e),d9._(e),Su(e.a),Qu(e.a,W9(e))},d9=P(3,0,e=>Xu(e.a,e._.a5)),f9=P(2,0,e=>Wa(e.a,e._.g)),sre=e=>{f9._(e),p9._(e),m9._(e),h9._(e),_9._(e),v9._(e),y9._(e),za(e.a),ho(e.a,J9(e)),Ya(e.a,q9(e)),to(e.a,K9(e)),so(e.a,G9(e))},p9=P(2,0,e=>mo(e.a,e._.h)),m9=P(2,0,e=>uo(e.a,e._.i)),h9=P(2,0,e=>qa(e.a,e._.k)),g9=N(1,e=>oo(e.a,!e._.s&&e._.a6)),_9=P(2,0,g9),v9=P(2,0,e=>{no(e.a,Z9(e)),Ja(e.a,X9(e)),Za(e.a,Y9(e))}),y9=P(2,0,g9),b9=N(28,L(`b20`,e=>Et(e,{paletteOpen:e.s,load:e.v,activeList:e.g.filter(e=>e.status===`active`).map(e=>e.id),onMount:function(){let t=new AbortController,n=t.signal,r={abort:t,statusStale:!1,statusDebounce:void 0,timer:void 0};ir(n);let i=(t,n)=>{n&&(In(t,n),Yn(t,n)),e.a1(t)},a=new URLSearchParams(location.search);a.get(`ws`)&&(i(a.get(`ws`),a.get(`session`)),history.replaceState(null,``,`/`)),lr()&&document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[target="_blank"][href^="http"]`);t&&(e.preventDefault(),ur(t.href))},{capture:!0,signal:n}),navigator.serviceWorker?.addEventListener(`message`,e=>{e.data?.type===`open-session`&&i(e.data.workspaceId,e.data.sessionId)},{signal:n}),H(`/api/settings`).then(t=>{O9(e,t)}).catch(()=>{});let o=()=>{if(document.hidden){r.statusStale=!0;return}r.statusStale=!1,e.a0()};document.addEventListener(`visibilitychange`,()=>{document.hidden||(r.statusStale=!1,e.a0(!0))},{signal:n}),this.load(),o(),kn().addEventListener(`workspaces.changed`,()=>{this.load(),o()},{signal:n}),kn().addEventListener(`sessions.changed`,()=>{clearTimeout(r.statusDebounce),r.statusDebounce=setTimeout(o,300)},{signal:n}),kn().addEventListener(`status.changed`,t=>{t.data&&(D9(e,t.data),r.statusStale=!1)},{signal:n}),r.timer=setInterval(o,6e4),window.addEventListener(`keydown`,t=>{if((t.metaKey||t.ctrlKey)&&t.key===`k`&&(t.preventDefault(),F9(e,!this.paletteOpen)),(t.metaKey||t.ctrlKey)&&!t.shiftKey&&!t.altKey&&t.key>=`1`&&t.key<=`9`){let n=this.activeList?.[Number(t.key)-1];n&&(t.preventDefault(),e.a1(n))}},{capture:!0,signal:n});let s=window.visualViewport;if(s){let e=()=>{let e=Math.abs(s.height-window.innerHeight)<1;document.documentElement.style.setProperty(`--app-height`,e?``:`${Math.round(s.height)}px`),e||window.scrollTo(0,0)};s.addEventListener(`resize`,e,{signal:n}),s.addEventListener(`scroll`,e,{signal:n}),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()},{signal:n}),window.addEventListener(`pageshow`,e,{signal:n}),window.addEventListener(`focus`,e,{signal:n})}return r},onDestroy:function(){this.abort.abort(),clearTimeout(this.statusDebounce),clearInterval(this.timer)}})),4),cre=F(t9),lre=M(27,e=>{b9(e),v9(e),l9(e),cre(e)}),x9=N(13,e=>lre(e,Q9(e))),ure=O(2,(e=>`<!>${e}`)(Zr),(e=>`b/${e}&`)(Qr),sre),S9=N(33,e=>ure(e,e.s||e.a6?0:1)),dre=M(32,e=>{S9(e),y9(e)}),C9=N(30,e=>dre(e,!e.p&&!e.a3&&e.j),2),fre=M(29,C9),w9=N(11,e=>fre(e,e.g.find(t=>t.id===e.k))),pre=O(3,qs,(e=>`/${e}&`)(Js),ore),mre=F(n9),hre=M(31,e=>{pre(e,+!e.a5),d9(e),mre(e)}),T9=N(17,e=>hre(e,e.g.find(t=>t.id===e.q))),gre=F(J7),E9=j(6,e=>{x9(e),b9(e),w9(e),T9(e),f9(e),u9(e),c9(e),o9(e),gre(e)}),_re=F(Y7),D9=j(7,e=>{p9(e),_re(e)}),vre=F(X7),O9=j(8,e=>{m9(e),vre(e)}),yre=O(1,`<div class="boot dim"></div>`,` `,Jne),bre=M(21,b9),k9=N(14,e=>bre(e,$9(e)),2),xre=O(0,`<p class=toast-error><!> <button>×</button></p>`,`D%c `,Xne),A9=N(20,e=>xre(e,e.t&&e.j?0:1)),Sre=j(9,e=>{yre(e,+!!e.j),k9(e),C9(e),A9(e)}),Cre=F($7),j9=j(10,e=>{k9(e),w9(e),h9(e),Cre(e)}),wre=k(5,`<!><!><!>`,`b%`,tre,ire),M9=j(12,e=>{wre(e,[e.m,e=>e]),k9(e),x9(e)}),Tre=O(4,pd,(e=>`/${e}&`)(md),are),Ere=F(e9),N9=j(15,e=>{Tre(e,+!e.p),C9(e),Ere(e)}),P9=j(16,T9),F9=j(18,e=>{b9(e),S9(e),_9(e)}),Dre=F(G7),I9=j(19,e=>{A9(e),q7(e),K7(e),Dre(e)});function L9(e){return function(){N9(e._._,!0)}}function R9(e){return function(t,n){In(t,n),Yn(t,n),e._._.a1(t)}}function z9(e){return function(t){e._._.a1(t)}}function B9(e){return function(t){P9(e._._,t||e._.f)}}function V9(e){return function(t){e._.g.some(e=>e.id===t.id)||E9(e._,[t,...e._.g]),N9(e._,!1),e._.a1(t.id)}}function H9(e){return function(){N9(e._,!1)}}function U9(e){return function(t){E9(e._,e._.g.map(e=>e.id===t.id?t:e))}}function W9(e){return function(){P9(e._,null)}}function G9(e){return function(){F9(e._,!1)}}function K9(e){return function(){N9(e._,!0),F9(e._,!1)}}function q9(e){return function(t){P9(e._,t.id),N9(e._,!1),F9(e._,!1)}}function J9(e){return function(t){O9(e._,t)}}function Y9(e){return function(t,n){F9(e._,!1),H(`/api/workspaces/${t.id}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:n})}).then(n=>{In(t.id,n.id),e._.a1(t.id)}).catch(t=>{I9(e._,`New session failed: ${String(t.message||t)}`)})}}function X9(e){return function(t){Pn(t.id),e._.a1(t.id)}}function Z9(e){return function(t){e._.a1(t.id)}}function Q9(e){return async t=>{e.g.find(e=>e.id===t)?.status===`archived`&&(await H(`/api/workspaces/${t}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`restore`})}).catch(()=>{}),E9(e,e.g.map(e=>e.id===t?{...e,status:`active`}:e))),j9(e,t),N9(e,!1),P9(e,null),F9(e,!1),e.m.includes(t)||M9(e,e.m.concat(t)),Gn(t)}}function $9(e){return async()=>{try{let[t]=await Promise.all([H(`/api/workspaces`),Hn()]);if(E9(e,t),e.j){let n=new Set(t.filter(e=>e.status===`active`).map(e=>e.id));M9(e,e.m.filter(e=>n.has(e))),e.k&&!n.has(e.k)&&(j9(e,e.m[e.m?.length-1]||null),Gn(e.k))}else{let n=ree();n&&t.some(e=>e.id===n)&&(j9(e,n),M9(e,[n]))}Sre(e,!0)}catch(t){I9(e,`Loading workspaces failed: ${t.message||String(t)}`)}}}function Ore(e){return(t=!1)=>(e.x||=t,(e.y??=Rn(async()=>{let t=e.x;e.x=!1,D9(e,await H(`/api/status${t?`?fresh`:``}`))}))())}R(`b17`,L9),R(`b15`,R9),R(`b14`,z9),R(`b16`,B9),R(`b13`,V9),R(`b12`,H9),R(`b11`,U9),R(`b10`,W9),R(`b9`,G9),R(`b8`,K9),R(`b7`,q9),R(`b3`,J9),R(`b6`,Y9),R(`b5`,X9),R(`b4`,Z9),R(`b2`,Q9),R(`b0`,$9),R(`b1`,Ore),nt();export{t};
1615
+ //# sourceMappingURL=index-DMpI1yWM.js.map