@sheetxl/mcp 0.8.0-beta.24 → 0.8.0-beta.25

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 (211) hide show
  1. package/assets/{tWO-mE87mAuj1qih.js → 45FAgD1JyG2a1Rti.js} +2 -2
  2. package/assets/{DtVSjxL6N_7WyM8Z.js → 70weNsvW2LMx5QcW.js} +1 -1
  3. package/assets/{LM2rVDHdB0jVUFcT.js → APcHum0Riw3QhLBQ.js} +1 -1
  4. package/assets/{CM-q_J5aF6YXmjeu.js → Abkx7KJ6_X5avkR4.js} +3 -3
  5. package/assets/{B7lATTNffVTrDsKE.js → B0FfnXdiZxExcdjB.js} +2 -2
  6. package/assets/{DL8pez0eKo8arYPj.js → B6e_DsVO4i91IYEO.js} +3 -3
  7. package/assets/{DOSWSyKkK4eSi4PD.js → B940vbTfpMYACpDE.js} +2 -2
  8. package/assets/{CmkgQ5-IG0BSCM3R.js → BAowTO-7Utmg0UvM.js} +3 -3
  9. package/assets/{fEfisM0E2fUYKIyU.js → BBccc8pDH-6AJdoT.js} +5 -5
  10. package/assets/{BJwiwzwx4Bl5L4Vq.js → BD3Bc7ZHxenj4S7Q.js} +1 -1
  11. package/assets/{CCF6CwJ6cbeLRl23.js → BFKj2ik7h-yM6oCR.js} +1 -1
  12. package/assets/{DM-yGHahbfA_uarn.js → BHIi-cAKnh_sAifV.js} +1 -1
  13. package/assets/{2YT_wstXIH6UIigi.js → BHeXL-Lo390ZSNV0.js} +1 -1
  14. package/assets/{CR1aLf7CWEfPTO9a.js → BNvsIyBwweYnfUz3.js} +1 -1
  15. package/assets/{CnI4Nli8vtWdFKvf.js → BSJ_L1gNOejEih6N.js} +32 -32
  16. package/assets/{yz2PTfYm_8EGJPM5.js → BV13tLgNXZ8MDaE_.js} +1 -1
  17. package/assets/{suLYEZBtGUhSYeB7.js → BW8ReYzx-CEJ-lAG.js} +1 -1
  18. package/assets/{CIw6ZC3K9x-ccacl.js → BXxUz-sB48Z9nSFi.js} +1 -1
  19. package/assets/{sJVPCrgeh0U6LbAK.js → B_GZxEqqpKtEPbWC.js} +1 -1
  20. package/assets/{a2e_g9YI3J-lUD7-.js → Bb7ZxgjHwiKgARXs.js} +1 -1
  21. package/assets/{B16G2473LTkZP6Mq.js → BbfSzxx5EzAvn-_F.js} +1417 -1356
  22. package/assets/{DuEtCJEnG_GnJzTX.js → BktUuVP0Jew8_-ff.js} +1 -1
  23. package/assets/{7vPlH3_rhJxmmBvG.js → Brlza6Jd2oGGX9vB.js} +1 -1
  24. package/assets/{CmwNIrRssYuLN2fn.js → BtNEVWQWEp_Ie1nT.js} +490 -490
  25. package/assets/{ByYJTTTUuu67hDF-.js → Bwk-CZuGiTRT2ox_.js} +4 -4
  26. package/assets/{DIgPlkEabQdKNUQn.js → BzLwCwXsh7eXQpeK.js} +1 -1
  27. package/assets/{KMzONx2Ps841nJHj.js → BzU8BhgrkSoh-XJF.js} +8 -8
  28. package/assets/{DkQ4kxEKhKYQgfjK.js → C-FJab2sVwBbOTiA.js} +1 -1
  29. package/assets/{CJ2hV-9ipqOEkLSG.js → C-Vt758qtn8QeCrw.js} +1 -1
  30. package/assets/{9GnbVPKozgrJpeLW.js → C2kYWrsx5mg4XOES.js} +1 -1
  31. package/assets/{Ch9w7xFxVMrvGuC_.js → C6Vsz4e_ASJdx3LP.js} +1 -1
  32. package/assets/{Cxzowsi6ASdZtzeI.js → C9DvPNfuz_0hun6C.js} +1 -1
  33. package/assets/{xD41vsQY6h60lCqz.js → CAI8p60cuWlgnlko.js} +8 -8
  34. package/assets/{DRzZ4bEyLRGVOLzV.js → CCOaNx5_BfWCc9yz.js} +1 -1
  35. package/assets/{6CBUVbF01Bedq0e2.js → CD2yoEhIT8DyXBou.js} +57 -57
  36. package/assets/{CpvJUGg9ckuCIpIS.js → CDiutOsLAzu4c0Ej.js} +1 -1
  37. package/assets/{CT4czEKWIj1GeQN8.js → CFrOPd_UcD7qclCq.js} +1 -1
  38. package/assets/{B-t1q2NS61c2B8E4.js → CGS7apShLtnlmF8D.js} +1 -1
  39. package/assets/{BH7ctzMzOYVTGxzA.js → CGdayif_qNMtoATI.js} +1 -1
  40. package/assets/{CFT_tDogP98gTbh7.js → CJubVukzHBNJb_Wf.js} +93 -93
  41. package/assets/{b8yACuWy67eIj_j2.js → COXWiXy3DCfmXSm5.js} +1 -1
  42. package/assets/{DPLTGglaPovTg9e5.js → COZ-bhj463kGINFA.js} +1 -1
  43. package/assets/{CnKX5SPVE2iuSK42.js → CSMsn9bKgR9kWG0m.js} +1 -1
  44. package/assets/{DaF9L7No8h8a-cqb.js → CVWoX7wNwrZwm5XB.js} +2 -2
  45. package/assets/{BkekCZ17YTtd07_C.js → CX-KrjVgXM-7o--S.js} +2 -2
  46. package/assets/{C0uu0vLKQh0S508B.js → CYtkZMCX6dyEqjb9.js} +40 -40
  47. package/assets/{Xccc6oxtlSvJUDsC.js → Cb7FKT3S78r6IYHi.js} +1 -1
  48. package/assets/{Dhy6iU_09lrQnOAV.js → CcTDxlAqw6HuYmmm.js} +34 -34
  49. package/assets/CehVpkp73IfWGN_b.js +14 -0
  50. package/assets/{BrJd9jVVv9SQzZol.js → CfWSdzSpbErVA_1h.js} +332 -332
  51. package/assets/{3VycPrqi6qgLOgGY.js → Ci3R5B7bLke8NZRo.js} +6 -6
  52. package/assets/{DyiH3LlinD-38bG7.js → ClRgSo0axU3lAOwR.js} +1 -1
  53. package/assets/{DwNcvKM47ZHfvQM6.js → Cmf4eJow6AIuPH_w.js} +1 -1
  54. package/assets/{DczQhB3mRSUw6GCf.js → Cplall3oc-_3AhCB.js} +1 -1
  55. package/assets/{BPNLZ07Bu_B8Yhf1.js → Cu4ok_jTnQif8QtX.js} +1 -1
  56. package/assets/{D-vo2bQyAmStQmD9.js → D053O1kZ7JtMwiqh.js} +1 -1
  57. package/assets/{BjyXkr-CzV8mVx0t.js → D5aWcMLJ2wyLm9Ws.js} +1 -1
  58. package/assets/{DE7G34oYbvrfXbJ7.js → D6qQAWN_5p3FAshK.js} +338 -338
  59. package/assets/{BaYk1vO2hP2S3_1w.js → D7NjohknztgMLqhT.js} +2 -2
  60. package/assets/{BJqo8c5bFKjnq69G.js → D8cqT2lbcP5Yp1Or.js} +11 -11
  61. package/assets/{BkHeIMSE7-LehRCs.js → D8wjcRGgRdU34Ata.js} +1 -1
  62. package/assets/{DGOgx3-IyO8bjF_t.js → DAnTpFc2vx3CmP8e.js} +63 -63
  63. package/assets/{BWLavTnANLUerdS0.js → DB2MrmDLZ-OzVRQu.js} +2 -2
  64. package/assets/{CbJWbjmv4bz4ppIZ.js → DBgHcEP-FcgSHLvx.js} +335 -335
  65. package/assets/{DUbIxDAzW1dzrtdI.js → DFd0JAiw5dkbnULM.js} +1 -1
  66. package/assets/{B6caaQsfOpFEgYQ4.js → DG9KGapq8eHlcTC7.js} +1 -1
  67. package/assets/{Daaro0HbHkKXkBP-.js → DHCl7HWDbT3xqx8W.js} +2 -2
  68. package/assets/{BnNB_ejvNaLu6B3o.js → DJlQxf99HCszeCCD.js} +1 -1
  69. package/assets/{CFNtPYPfDPH-3BXK.js → DLW76uSURiQM07DD.js} +1 -1
  70. package/assets/{By1QPrSxtnRiJu0R.js → DQBqVPRLkZFb2P_x.js} +2 -2
  71. package/assets/{Ds4TB1hn56-RK6_f.js → DQlLgxA592HvgKzh.js} +1 -1
  72. package/assets/{DNSWaXblwhTtI3w7.js → DRvzD5Tkcb2OU0G2.js} +1 -1
  73. package/assets/{CIY_RiLu1_FmRLAA.js → DUfrvQDZKh_22F91.js} +1 -1
  74. package/assets/{Dk9zYXO3VoBhTdex.js → DX94YgmfoL_ngS60.js} +1 -1
  75. package/assets/{DJfpKncnYnrr28G0.js → DXDhH3F4N4OOigqN.js} +1 -1
  76. package/assets/{bv3fZLUPzd14I58C.js → DXVfJfT6ftWk5kYi.js} +495 -495
  77. package/assets/{Jy-_0a72nn5Iv1NK.js → DYx_I-o0yjx056Dq.js} +1 -1
  78. package/assets/{DFVQIZ2zZyAphhCF.js → DZBfVpnngvY9Ra3C.js} +1 -1
  79. package/assets/{DXCTHw-ZutNIuo_2.js → DZOzgVEOXfHTE3YC.js} +1 -1
  80. package/assets/{BifwlrCmEVtjh_1U.js → DZTVTdrwu05fNZk_.js} +1 -1
  81. package/assets/{CzRvg04_TIbwBH5C.js → DaB9iRVJj3TmKH92.js} +3 -3
  82. package/assets/{Dlqk7XqKnAZ8Pcj3.js → DbHVXEt9qwlb8Gou.js} +154 -155
  83. package/assets/{CKD460cQOgwF6uSV.js → DbXqd8hGNQEyS-s0.js} +1 -1
  84. package/assets/{DaHD9SY75O8wDy3p.js → DcHo7BC8Ny3hWq0j.js} +2 -2
  85. package/assets/{doqBmhonQlHp-1Ud.js → DcHvH_I64hbnNh9G.js} +1 -1
  86. package/assets/{B4uS01J0mrSJSftQ.js → DfaQvLAaU7HHPnSe.js} +66 -66
  87. package/assets/{76dPHG5RYA7MUV_g.js → DgE30NwKzEjZI1W6.js} +3 -3
  88. package/assets/{DJGYlGr2Zj7SkYqc.js → Djl7cjJyCIS_Qvbd.js} +1 -1
  89. package/assets/{TZnuVwhVjkOBax9F.js → DkS3EQvuEuPDvCws.js} +2 -2
  90. package/assets/{BxwB3iTNSE1TgHkb.js → DkT0-_t9Xgp4l-Mh.js} +1 -1
  91. package/assets/{B-5mBXpY9i6-eCrZ.js → DlOCT6DI5bhPtQ8j.js} +33 -33
  92. package/assets/{C6PNMev7cs5JLgwy.js → DpGFb3hbAT5Murcv.js} +1 -1
  93. package/assets/{MosMza0-rXD8uHX_.js → DunKnm-bQd0oHn9n.js} +2 -2
  94. package/assets/{mZt9BTEejCJZ4YK4.js → Duw8QQGcrPmesb-M.js} +1 -1
  95. package/assets/{D8k9de_hen-KqBWe.js → DvkgborRc2vRq8E-.js} +1 -1
  96. package/assets/{DPYFRLJbHGlrcrJq.js → DwmlBb640xWfAMV2.js} +2 -2
  97. package/assets/{7IzItpr7MkdnaAwh.js → GfAXkT_vctdRX_9f.js} +67 -67
  98. package/assets/{CUYQlZz5zWsUdmRy.js → H40qXR3Gazmnq4Mv.js} +1 -1
  99. package/assets/{B8bEJ65vQRqsfBlS.js → HLtC2gb8SfNmJU5q.js} +5 -5
  100. package/assets/{BrYc6PLonux_gI6b.js → H_6CBe3t27jHlBHk.js} +172 -172
  101. package/assets/{qc7rA-Z3a4rkVQPx.js → LQNEL4KjDxwZNwWq.js} +187 -187
  102. package/assets/{D6d1DKL15m52ZCuC.js → O8YGVK4vtz39jQ84.js} +1 -1
  103. package/assets/{BXWGS09xFG81nnIT.js → TqxFLhPz3zbgi95t.js} +1 -1
  104. package/assets/{Cf0zmfQYfJ7zM0Ya.js → UdhH9UX9jQ4IV11J.js} +1 -1
  105. package/assets/{TdDTOcC1TYhk6UuR.js → V4pGXJr6fe-CPg7i.js} +1 -1
  106. package/assets/{C-nA4SXN5hWHaxV6.js → V_VVW06vjWkmlbdh.js} +534 -534
  107. package/assets/{CEk658HeLJk2cAjM.js → VkeNTI1TMsA1ZbGz.js} +3 -3
  108. package/assets/{P6V3JAiRpC3BWceC.js → cTLYCAhDs2fR2ITC.js} +1 -1
  109. package/assets/{DGI_8HyNF0eAv0P5.js → cU78RT4WJKAp5mU_.js} +1 -1
  110. package/assets/{C9iFJ52KwQTePQ81.js → ckvxz2tZRlY1UPpg.js} +10295 -10253
  111. package/assets/{DqSBb1HmgeU7eg_i.js → eCD6fmcTsgv76IZm.js} +110 -110
  112. package/assets/{flby0g5gyZ9P2Wu2.js → irrAIfw6CnCOHmPE.js} +1 -1
  113. package/assets/{DMDTS0LH9Ke9t-3z.js → ixHQtoul8ubEJfWS.js} +12 -7
  114. package/assets/{D_tdoUtUe7cApQJn.js → kmiMiNIUc6rS8DG8.js} +4 -4
  115. package/assets/{DRq6lQLndj73WT35.js → m9BgbF-NgPIYW4kc.js} +1 -1
  116. package/assets/{CSXmTA6w6Pnbtqvb.js → s56uiNHMGbBV6xgZ.js} +1 -1
  117. package/assets/{CFWwwr74qRKOBrg9.js → u8xtjHo43n-S_O6j.js} +1 -1
  118. package/assets/{NAWWzA_hk4wYtsPP.js → u9le-qZ3tbYKK1kU.js} +2 -2
  119. package/assets/{BAVltO4Xf7lC0Xr6.js → xMi-tFxI2s6e18L1.js} +1 -1
  120. package/assets/{g2Nu44uuSJFMzxEV.js → xSUMX6J9-MJIGgmG.js} +2 -2
  121. package/index.js +124 -124
  122. package/lib.js +1 -1
  123. package/licenses/dependencies.txt +56 -56
  124. package/package.json +2 -2
  125. package/screenshot-page/assets/{C_YKEkTsGB_5gFNg.js → 0P0DnZolMnjPhiea.js} +2 -2
  126. package/screenshot-page/assets/3L7CY5dA_kT2UBjv.js +1 -0
  127. package/screenshot-page/assets/{FcTM4SB17cEX1M3X.js → 5Y11BWntgqmzo9dz.js} +1 -1
  128. package/screenshot-page/assets/{CXwbGzavyvYgDbWU.js → B0CDAMDdxSN4en9k.js} +1 -1
  129. package/screenshot-page/assets/B6UwT0pG4sQeG7fA.js +3 -0
  130. package/screenshot-page/assets/{BbT5KRhoeAKLzy54.js → BCmGLxQEUabeee6Q.js} +2 -2
  131. package/screenshot-page/assets/{DR-og7vslxlOZd8j.js → BGIujWi3UayyIWlg.js} +1 -1
  132. package/screenshot-page/assets/BH2IWQ-8AfNbhYZJ.js +39 -0
  133. package/screenshot-page/assets/BNjmzbnQlBmX-HPQ.js +1 -0
  134. package/screenshot-page/assets/{DcrVJCyDwGKeil2U.js → BQTLEc84Eql61S2m.js} +1 -1
  135. package/screenshot-page/assets/{DGkaCFHx4PsOJkFu.js → BVnzv_sY_58zEJyM.js} +1 -1
  136. package/screenshot-page/assets/{Cx1kZ2u_8JFV2Q8D.js → BiRVjUOUI8Qv0CE1.js} +1 -1
  137. package/screenshot-page/assets/{r2HZG9_SMzF3__ID.js → BkU12U7IqW7qjopk.js} +6 -6
  138. package/screenshot-page/assets/{D6EXAYU-ZH8hjx_7.js → Bne-AygyF1USkPAy.js} +2 -2
  139. package/screenshot-page/assets/{Dkf51CnZh2zPEGMd.js → BpJaTpbR_CQzXj9M.js} +1 -1
  140. package/screenshot-page/assets/Bs-IXwX9BKsCxwcJ.js +2 -0
  141. package/screenshot-page/assets/{CwCu_r0BW41uLt3P.js → Bt7fKk5ZupUuo_xD.js} +2 -2
  142. package/screenshot-page/assets/{DM6hr-bvWV50-Oex.js → C-2hBFk27roWkIrQ.js} +2 -2
  143. package/screenshot-page/assets/C7MXfx6zf_uTwcpu.js +1 -0
  144. package/screenshot-page/assets/CALWodHqzUTIv9le.js +5 -0
  145. package/screenshot-page/assets/{B-0-chiwq4MIUQy9.js → CCYEWK5QyGSnUAfh.js} +1 -1
  146. package/screenshot-page/assets/{Cx9eq2x1gIXGki3Q.js → CFS0h-wE9YlZRk_1.js} +1 -1
  147. package/screenshot-page/assets/CKdQfdZJGJFgnrr9.js +586 -0
  148. package/screenshot-page/assets/{BKwDvElKinpn1IK0.js → CL_hAngRQwm_KGdR.js} +1 -1
  149. package/screenshot-page/assets/{a3fvt1Klg1uGE7p6.js → CMryHLEhCyKGuRSW.js} +7 -7
  150. package/screenshot-page/assets/COL9dj40ytErlGak.js +2 -0
  151. package/screenshot-page/assets/{BcZPWw18bdj_ZvA9.js → CRtk9ixuBWxhPfPU.js} +1 -1
  152. package/screenshot-page/assets/CUQsrLir5jYpnRPM.js +1 -0
  153. package/screenshot-page/assets/CUgX7ETRCJsvqa2x.js +1 -0
  154. package/screenshot-page/assets/{C7mXat-6esc1AmRD.js → CXeDqC02BZcixiHS.js} +2 -2
  155. package/screenshot-page/assets/{Pt9ne0xkE2icD3Ih.js → CZaKvnrRdlLj1_X8.js} +1 -1
  156. package/screenshot-page/assets/CfD1bn6b-NM38iZV.js +1 -0
  157. package/screenshot-page/assets/{WTrYzPnMQhYDILMR.js → Ck5onwb1w_19WrtG.js} +1 -1
  158. package/screenshot-page/assets/{DyxJBLjUkeDuu96F.js → CltB1nb5HHSmYrNG.js} +1 -1
  159. package/screenshot-page/assets/{D6Yv5cc1JE7DGd6j.js → CqBSIwwGzWl8mrBe.js} +1 -1
  160. package/screenshot-page/assets/CvBPH5c-gnUG8Jen.js +1 -0
  161. package/screenshot-page/assets/{D7Yt7xmUlA6-Lq0Q.js → D-jd_TJCN7AAn125.js} +9 -9
  162. package/screenshot-page/assets/{ChSvXfVMLxZsP9zG.js → D4RZZdlItfrgQHcE.js} +1 -1
  163. package/screenshot-page/assets/{Bfq6-treWd_rRiWl.js → D53hpXNHxIgSWl80.js} +1 -1
  164. package/screenshot-page/assets/{J73KTOmdZGNmnq-z.js → D72Rp__0TEqJ972a.js} +1 -1
  165. package/screenshot-page/assets/D8EmNst-H2v0eWcf.js +1 -0
  166. package/screenshot-page/assets/{BTJ1NNUzHotNDiDe.js → D98PlIA4qQ_6ciCu.js} +2 -2
  167. package/screenshot-page/assets/{Tj3B5At0OAN3tDza.js → DACqwpSwlZka3b7s.js} +1 -1
  168. package/screenshot-page/assets/{CI3Z1f4amZ9G2rPD.js → DJebrQ5mu8uxpX3b.js} +1 -1
  169. package/screenshot-page/assets/{CSFFMEKyxEFaykqL.js → DTAKTGn53yF_B621.js} +1 -1
  170. package/screenshot-page/assets/{D6Ciix7JAZtdKqmj.js → DYYzsN95gWMsxOaj.js} +1 -1
  171. package/screenshot-page/assets/{DOVt9zHz7FQ2KUQM.js → Da_VIghRFdNrmfZT.js} +1 -1
  172. package/screenshot-page/assets/{clrFU8i-0wNkmbs7.js → DbnmgPTSEii4OGkB.js} +1 -1
  173. package/screenshot-page/assets/{0UZBKpOOsp7P-DkP.js → DdmX3djBOA6UCZtf.js} +2 -2
  174. package/screenshot-page/assets/{DEpn6VGd30cHEJOS.js → DfQS5zAy3pN31xNb.js} +1 -1
  175. package/screenshot-page/assets/{DynKB5GH-vfFMJEy.js → DkTX5ZjGNQ5SrwJa.js} +1 -1
  176. package/screenshot-page/assets/{Bg9UyX4yrB2mSdJt.js → DmIjTb4kKfUHxWaF.js} +23 -23
  177. package/screenshot-page/assets/DqOrgSpuJhQRhMoG.js +4 -0
  178. package/screenshot-page/assets/{BIuMiduMHSsTGacU.js → Dz_yLNMXKWGx1O6V.js} +2 -2
  179. package/screenshot-page/assets/{B-8IMo2f1yGNXOyz.js → GxbRmvyoKhHl0ZYY.js} +13 -8
  180. package/screenshot-page/assets/{FqdZRM336KMEcsbU.js → MqGbtsji4DVGCAMR.js} +1 -1
  181. package/screenshot-page/assets/{zvxBjll3jnL0-vNn.js → Np3jWxG724t5hLHZ.js} +2 -2
  182. package/screenshot-page/assets/eR9_DaySoB72PvMo.js +1 -0
  183. package/screenshot-page/assets/{CtiTwHzd_ZSzd3W2.js → hB5riGkPy0wXVIig.js} +1 -1
  184. package/screenshot-page/assets/hHvAGynpTvAb97GX.js +1 -0
  185. package/screenshot-page/assets/{DmDFKv_3APEWI-IY.js → jKvAZg0Tp701aw1o.js} +2 -2
  186. package/screenshot-page/assets/{DACSL7FA_J91Z_H7.js → jteb4n23QwBT9m_4.js} +1 -1
  187. package/screenshot-page/assets/mzrDp0emvkWnkXBt.js +1 -0
  188. package/screenshot-page/assets/x1O923k1mN-CduO_.js +1 -0
  189. package/screenshot-page/index.html +15 -15
  190. package/types/scripting-api.json +1 -1
  191. package/types/scripting.d.ts +1 -1
  192. package/assets/Dfv_T_PQVL0O3lu5.js +0 -14
  193. package/screenshot-page/assets/B7pXfEVkcbaMBMhc.js +0 -1
  194. package/screenshot-page/assets/BDRMUi2BsnBqytIq.js +0 -2
  195. package/screenshot-page/assets/BEjJHVSbtlsNtoq7.js +0 -3
  196. package/screenshot-page/assets/BPMQ22uISGOm3ymr.js +0 -1
  197. package/screenshot-page/assets/Bxq4FCQhyPbVhhaR.js +0 -2
  198. package/screenshot-page/assets/CNB6WmYfGVZjlCKV.js +0 -5
  199. package/screenshot-page/assets/CXeJV1BW2CVemhPE.js +0 -1
  200. package/screenshot-page/assets/CkxmJxdtjBIxYoMq.js +0 -1
  201. package/screenshot-page/assets/D43IayseD2Cy8OZo.js +0 -4
  202. package/screenshot-page/assets/D8KyhLvfyjLZW92H.js +0 -39
  203. package/screenshot-page/assets/DBxAatsD6aWk7Zb6.js +0 -586
  204. package/screenshot-page/assets/DMhOGCTy8V0N14gY.js +0 -1
  205. package/screenshot-page/assets/DSTlKGmqncM7XHeW.js +0 -1
  206. package/screenshot-page/assets/Dh14XQinAphjZOKC.js +0 -1
  207. package/screenshot-page/assets/Dt8JxbBBr2TeDflQ.js +0 -1
  208. package/screenshot-page/assets/Dxi-bXNjS-CpC5Qr.js +0 -1
  209. package/screenshot-page/assets/Oay0yGsGYgJDzy8r.js +0 -1
  210. package/screenshot-page/assets/QZg76Jflu3Q808W3.js +0 -1
  211. package/screenshot-page/assets/qFyplGXRu7IepHio.js +0 -1
@@ -1,57 +1,57 @@
1
- import{i as e}from"./CQukCzhuewMuFOlO.js";import{Bn as t,D as n,Ei as r,En as i,F as a,Ir as o,Mn as s,Ni as c,Q as l,Qi as u,V as d,Vt as f,Wr as p,Xr as m,Yn as h,bi as g,bt as _,ct as v,da as y,dr as b,dt as ee,ei as x,et as S,fi as te,fn as C,hr as w,ka as T,p as E,qi as ne,s as D}from"./DBxAatsD6aWk7Zb6.js";function O(e){console&&console.error&&console.error(`Error: ${e}`)}function k(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function re(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function ie(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e}var A=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},j=class extends A{constructor(e){super([]),this.idx=1,Object.assign(this,V(e))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},M=class extends A{constructor(e){super(e.definition),this.orgText=``,Object.assign(this,V(e))}},N=class extends A{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,V(e))}},P=class extends A{constructor(e){super(e.definition),this.idx=1,Object.assign(this,V(e))}},F=class extends A{constructor(e){super(e.definition),this.idx=1,Object.assign(this,V(e))}},I=class extends A{constructor(e){super(e.definition),this.idx=1,Object.assign(this,V(e))}},L=class extends A{constructor(e){super(e.definition),this.idx=1,Object.assign(this,V(e))}},R=class extends A{constructor(e){super(e.definition),this.idx=1,Object.assign(this,V(e))}},z=class extends A{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,V(e))}},B=class{constructor(e){this.idx=1,Object.assign(this,V(e))}accept(e){e.visit(this)}};function ae(e){function t(e){return e.map(ae)}if(e instanceof j){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return typeof e.label==`string`&&(t.label=e.label),t}if(e instanceof N)return{type:`Alternative`,definition:t(e.definition)};if(e instanceof P)return{type:`Option`,idx:e.idx,definition:t(e.definition)};if(e instanceof F)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};if(e instanceof I)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:ae(new B({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof R)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:ae(new B({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof L)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};if(e instanceof z)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};if(e instanceof B){let t={type:`Terminal`,name:e.terminalType.name,label:(n=e.terminalType,typeof(r=n).LABEL==`string`&&r.LABEL!==``?n.LABEL:n.name),idx:e.idx};typeof e.label==`string`&&(t.terminalLabel=e.label);let i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=i instanceof RegExp?i.source:i),t}if(e instanceof M)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error(`non exhaustive match`);var n,r}function V(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var oe=class{visit(e){let t=e;switch(t.constructor){case j:return this.visitNonTerminal(t);case N:return this.visitAlternative(t);case P:return this.visitOption(t);case F:return this.visitRepetitionMandatory(t);case I:return this.visitRepetitionMandatoryWithSeparator(t);case R:return this.visitRepetitionWithSeparator(t);case L:return this.visitRepetition(t);case z:return this.visitAlternation(t);case B:return this.visitTerminal(t);case M:return this.visitRule(t);default:throw Error(`non exhaustive match`)}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function se(e,t=[]){return e instanceof P||e instanceof L||e instanceof R||(e instanceof z?e.definition.some(e=>se(e,t)):!(e instanceof j&&t.includes(e))&&e instanceof A&&(e instanceof j&&t.push(e),e.definition.every(e=>se(e,t))))}function H(e){if(e instanceof j)return`SUBRULE`;if(e instanceof P)return`OPTION`;if(e instanceof z)return`OR`;if(e instanceof F)return`AT_LEAST_ONE`;if(e instanceof I)return`AT_LEAST_ONE_SEP`;if(e instanceof R)return`MANY_SEP`;if(e instanceof L)return`MANY`;if(e instanceof B)return`CONSUME`;throw Error(`non exhaustive match`)}var ce=class{walk(e,t=[]){e.definition.forEach((n,r)=>{let i=e.definition.slice(r+1);if(n instanceof j)this.walkProdRef(n,i,t);else if(n instanceof B)this.walkTerminal(n,i,t);else if(n instanceof N)this.walkFlat(n,i,t);else if(n instanceof P)this.walkOption(n,i,t);else if(n instanceof F)this.walkAtLeastOne(n,i,t);else if(n instanceof I)this.walkAtLeastOneSep(n,i,t);else if(n instanceof R)this.walkManySep(n,i,t);else if(n instanceof L)this.walkMany(n,i,t);else{if(!(n instanceof z))throw Error(`non exhaustive match`);this.walkOr(n,i,t)}})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){let r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){let r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){let r=[new P({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){let r=le(e,t,n);this.walk(e,r)}walkMany(e,t,n){let r=[new P({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){let r=le(e,t,n);this.walk(e,r)}walkOr(e,t,n){let r=t.concat(n);e.definition.forEach(e=>{let t=new N({definition:[e]});this.walk(t,r)})}};function le(e,t,n){return[new P({definition:[new B({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function ue(e){if(e instanceof j)return ue(e.referencedRule);if(e instanceof B)return[e.terminalType];if(function(e){return e instanceof N||e instanceof P||e instanceof L||e instanceof F||e instanceof I||e instanceof R||e instanceof B||e instanceof M}(e))return function(e){let t=[],n=e.definition,r,i=0,a=n.length>i,o=!0;for(;a&&o;)r=n[i],o=se(r),t=t.concat(ue(r)),i+=1,a=n.length>i;return[...new Set(t)]}(e);if(function(e){return e instanceof z}(e))return function(e){let t=e.definition.map(e=>ue(e));return[...new Set(t.flat())]}(e);throw Error(`non exhaustive match`)}var de=`_~IN~_`,fe=class extends ce{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){let r=(i=e.referencedRule,a=e.idx,i.name+a+de+this.topProd.name);var i,a;let o=ue(new N({definition:t.concat(n)}));this.follows[r]=o}};function U(e){return e.charCodeAt(0)}function pe(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function W(e,t){if(!0===e[t])throw`duplicate flag `+t;e[t],e[t]=!0}function G(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function me(){throw Error(`Internal Error - Should never get here!`)}function he(e){return e.type===`Character`}var ge=[];for(let e=U(`0`);e<=U(`9`);e++)ge.push(e);var _e=[U(`_`)].concat(ge);for(let e=U(`a`);e<=U(`z`);e++)_e.push(e);for(let e=U(`A`);e<=U(`Z`);e++)_e.push(e);var ve=[U(` `),U(`\f`),U(`
2
- `),U(`\r`),U(` `),U(`\v`),U(` `),U(`\xA0`),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(`\u2028`),U(`\u2029`),U(` `),U(` `),U(` `),U(``)],ye=/[0-9a-fA-F]/,be=/[0-9]/,xe=/[1-9]/,Se=class{visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this):this.visit(n))}}visit(e){switch(e.type){case`Pattern`:this.visitPattern(e);break;case`Flags`:this.visitFlags(e);break;case`Disjunction`:this.visitDisjunction(e);break;case`Alternative`:this.visitAlternative(e);break;case`StartAnchor`:this.visitStartAnchor(e);break;case`EndAnchor`:this.visitEndAnchor(e);break;case`WordBoundary`:this.visitWordBoundary(e);break;case`NonWordBoundary`:this.visitNonWordBoundary(e);break;case`Lookahead`:this.visitLookahead(e);break;case`NegativeLookahead`:this.visitNegativeLookahead(e);break;case`Lookbehind`:this.visitLookbehind(e);break;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);break;case`Character`:this.visitCharacter(e);break;case`Set`:this.visitSet(e);break;case`Group`:this.visitGroup(e);break;case`GroupBackReference`:this.visitGroupBackReference(e);break;case`Quantifier`:this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},Ce={},we=new class{constructor(){this.idx=0,this.input=``,this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);let t=this.disjunction();this.consumeChar(`/`);let n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case`g`:W(n,`global`);break;case`i`:W(n,`ignoreCase`);break;case`m`:W(n,`multiLine`);break;case`u`:W(n,`unicode`);break;case`y`:W(n,`sticky`)}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:let t;switch(this.consumeChar(`?`),this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break;case`<`:switch(this.popChar()){case`=`:t=`Lookbehind`;break;case`!`:t=`NegativeLookbehind`}}G(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return me()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:let n=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:n,atMost:n};break;case`,`:let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar(`}`)}if(!0===e&&t===void 0)return;G(t)}if(!0!==e||t!==void 0)return G(t)?(this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t):void 0}atom(){let e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group()}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),G(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):me()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[U(`
3
- `),U(`\r`),U(`\u2028`),U(`\u2029`)]}}atomEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:`GroupBackReference`,value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case`d`:e=ge;break;case`D`:e=ge,t=!0;break;case`s`:e=ve;break;case`S`:e=ve,t=!0;break;case`w`:e=_e;break;case`W`:e=_e,t=!0}return G(e)?{type:`Set`,value:e,complement:t}:me()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=U(`\f`);break;case`n`:e=U(`
4
- `);break;case`r`:e=U(`\r`);break;case`t`:e=U(` `);break;case`v`:e=U(`\v`)}return G(e)?{type:`Character`,value:e}:me()}controlLetterEscapeAtom(){this.consumeChar(`c`);let e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar(`0`),{type:`Character`,value:U(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:U(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
5
- `:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:U(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,he(t)&&this.isRangeDash()){this.consumeChar(`-`);let n=this.classAtom();if(n.type,he(n)){if(n.value<t.value)throw Error(`Range out of order in character class`);e.push({from:t.value,to:n.value})}else pe(t.value,e),e.push(U(`-`)),pe(n.value,e)}else pe(t.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,value:e}}classAtom(){switch(this.peekChar()){case`]`:case`
6
- `:case`\r`:case`\u2028`:case`\u2029`:throw Error(`TBD`);case`\\`:return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`b`:return this.consumeChar(`b`),{type:`Character`,value:U(`\b`)};case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;this.consumeChar(`(`),this.peekChar(0)===`?`?(this.consumeChar(`?`),this.consumeChar(`:`),e=!1):this.groupIdx++;let t=this.disjunction();this.consumeChar(`)`);let n={type:`Group`,capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(!1===xe.test(e))throw Error(`Expecting a positive integer`);for(;be.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===be.test(e))throw Error(`Expecting an integer`);for(;be.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
7
- `:case`\r`:case`\u2028`:case`\u2029`:case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:throw Error(`TBD`);default:return{type:`Character`,value:U(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case`g`:case`i`:case`m`:case`u`:case`y`:return!0;default:return!1}}isRangeDash(){return this.peekChar()===`-`&&this.isClassAtom(1)}isDigit(){return be.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case`]`:case`
1
+ import{i as e}from"./CQukCzhuewMuFOlO.js";import{$i as t,At as n,Er as r,Hi as i,L as a,M as o,Ni as s,O as c,Pr as l,Rn as u,Sr as d,Tt as f,Vt as p,W as m,Yr as h,Z as g,_i as _,da as v,jn as y,lr as ee,n as b,ni as x,oi as te,ra as S,rt as C,u as w,vn as ne,w as re,wn as ie,y as T}from"./CKdQfdZJGJFgnrr9.js";function E(e){console&&console.error&&console.error(`Error: ${e}`)}function D(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function ae(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function O(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e}var k=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},A=class extends k{constructor(e){super([]),this.idx=1,Object.assign(this,B(e))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},j=class extends k{constructor(e){super(e.definition),this.orgText=``,Object.assign(this,B(e))}},M=class extends k{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,B(e))}},N=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},P=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},F=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},I=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},L=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},R=class extends k{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,B(e))}},z=class{constructor(e){this.idx=1,Object.assign(this,B(e))}accept(e){e.visit(this)}};function oe(e){function t(e){return e.map(oe)}if(e instanceof A){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return typeof e.label==`string`&&(t.label=e.label),t}if(e instanceof M)return{type:`Alternative`,definition:t(e.definition)};if(e instanceof N)return{type:`Option`,idx:e.idx,definition:t(e.definition)};if(e instanceof P)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};if(e instanceof F)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:oe(new z({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof L)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:oe(new z({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof I)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};if(e instanceof R)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};if(e instanceof z){let t={type:`Terminal`,name:e.terminalType.name,label:(n=e.terminalType,typeof(r=n).LABEL==`string`&&r.LABEL!==``?n.LABEL:n.name),idx:e.idx};typeof e.label==`string`&&(t.terminalLabel=e.label);let i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=i instanceof RegExp?i.source:i),t}if(e instanceof j)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error(`non exhaustive match`);var n,r}function B(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var se=class{visit(e){let t=e;switch(t.constructor){case A:return this.visitNonTerminal(t);case M:return this.visitAlternative(t);case N:return this.visitOption(t);case P:return this.visitRepetitionMandatory(t);case F:return this.visitRepetitionMandatoryWithSeparator(t);case L:return this.visitRepetitionWithSeparator(t);case I:return this.visitRepetition(t);case R:return this.visitAlternation(t);case z:return this.visitTerminal(t);case j:return this.visitRule(t);default:throw Error(`non exhaustive match`)}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function ce(e,t=[]){return e instanceof N||e instanceof I||e instanceof L||(e instanceof R?e.definition.some(e=>ce(e,t)):!(e instanceof A&&t.includes(e))&&e instanceof k&&(e instanceof A&&t.push(e),e.definition.every(e=>ce(e,t))))}function V(e){if(e instanceof A)return`SUBRULE`;if(e instanceof N)return`OPTION`;if(e instanceof R)return`OR`;if(e instanceof P)return`AT_LEAST_ONE`;if(e instanceof F)return`AT_LEAST_ONE_SEP`;if(e instanceof L)return`MANY_SEP`;if(e instanceof I)return`MANY`;if(e instanceof z)return`CONSUME`;throw Error(`non exhaustive match`)}var le=class{walk(e,t=[]){e.definition.forEach((n,r)=>{let i=e.definition.slice(r+1);if(n instanceof A)this.walkProdRef(n,i,t);else if(n instanceof z)this.walkTerminal(n,i,t);else if(n instanceof M)this.walkFlat(n,i,t);else if(n instanceof N)this.walkOption(n,i,t);else if(n instanceof P)this.walkAtLeastOne(n,i,t);else if(n instanceof F)this.walkAtLeastOneSep(n,i,t);else if(n instanceof L)this.walkManySep(n,i,t);else if(n instanceof I)this.walkMany(n,i,t);else{if(!(n instanceof R))throw Error(`non exhaustive match`);this.walkOr(n,i,t)}})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){let r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){let r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){let r=[new N({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){let r=ue(e,t,n);this.walk(e,r)}walkMany(e,t,n){let r=[new N({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){let r=ue(e,t,n);this.walk(e,r)}walkOr(e,t,n){let r=t.concat(n);e.definition.forEach(e=>{let t=new M({definition:[e]});this.walk(t,r)})}};function ue(e,t,n){return[new N({definition:[new z({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function de(e){if(e instanceof A)return de(e.referencedRule);if(e instanceof z)return[e.terminalType];if(function(e){return e instanceof M||e instanceof N||e instanceof I||e instanceof P||e instanceof F||e instanceof L||e instanceof z||e instanceof j}(e))return function(e){let t=[],n=e.definition,r,i=0,a=n.length>i,o=!0;for(;a&&o;)r=n[i],o=ce(r),t=t.concat(de(r)),i+=1,a=n.length>i;return[...new Set(t)]}(e);if(function(e){return e instanceof R}(e))return function(e){let t=e.definition.map(e=>de(e));return[...new Set(t.flat())]}(e);throw Error(`non exhaustive match`)}var fe=`_~IN~_`,pe=class extends le{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){let r=(i=e.referencedRule,a=e.idx,i.name+a+fe+this.topProd.name);var i,a;let o=de(new M({definition:t.concat(n)}));this.follows[r]=o}};function H(e){return e.charCodeAt(0)}function me(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function U(e,t){if(!0===e[t])throw`duplicate flag `+t;e[t],e[t]=!0}function W(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function he(){throw Error(`Internal Error - Should never get here!`)}function ge(e){return e.type===`Character`}var _e=[];for(let e=H(`0`);e<=H(`9`);e++)_e.push(e);var ve=[H(`_`)].concat(_e);for(let e=H(`a`);e<=H(`z`);e++)ve.push(e);for(let e=H(`A`);e<=H(`Z`);e++)ve.push(e);var ye=[H(` `),H(`\f`),H(`
2
+ `),H(`\r`),H(` `),H(`\v`),H(` `),H(`\xA0`),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(`\u2028`),H(`\u2029`),H(` `),H(` `),H(` `),H(``)],be=/[0-9a-fA-F]/,xe=/[0-9]/,Se=/[1-9]/,Ce=class{visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this):this.visit(n))}}visit(e){switch(e.type){case`Pattern`:this.visitPattern(e);break;case`Flags`:this.visitFlags(e);break;case`Disjunction`:this.visitDisjunction(e);break;case`Alternative`:this.visitAlternative(e);break;case`StartAnchor`:this.visitStartAnchor(e);break;case`EndAnchor`:this.visitEndAnchor(e);break;case`WordBoundary`:this.visitWordBoundary(e);break;case`NonWordBoundary`:this.visitNonWordBoundary(e);break;case`Lookahead`:this.visitLookahead(e);break;case`NegativeLookahead`:this.visitNegativeLookahead(e);break;case`Lookbehind`:this.visitLookbehind(e);break;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);break;case`Character`:this.visitCharacter(e);break;case`Set`:this.visitSet(e);break;case`Group`:this.visitGroup(e);break;case`GroupBackReference`:this.visitGroupBackReference(e);break;case`Quantifier`:this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},we={},Te=new class{constructor(){this.idx=0,this.input=``,this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);let t=this.disjunction();this.consumeChar(`/`);let n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case`g`:U(n,`global`);break;case`i`:U(n,`ignoreCase`);break;case`m`:U(n,`multiLine`);break;case`u`:U(n,`unicode`);break;case`y`:U(n,`sticky`)}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:let t;switch(this.consumeChar(`?`),this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break;case`<`:switch(this.popChar()){case`=`:t=`Lookbehind`;break;case`!`:t=`NegativeLookbehind`}}W(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return he()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:let n=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:n,atMost:n};break;case`,`:let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar(`}`)}if(!0===e&&t===void 0)return;W(t)}if(!0!==e||t!==void 0)return W(t)?(this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t):void 0}atom(){let e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group()}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),W(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):he()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[H(`
3
+ `),H(`\r`),H(`\u2028`),H(`\u2029`)]}}atomEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:`GroupBackReference`,value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case`d`:e=_e;break;case`D`:e=_e,t=!0;break;case`s`:e=ye;break;case`S`:e=ye,t=!0;break;case`w`:e=ve;break;case`W`:e=ve,t=!0}return W(e)?{type:`Set`,value:e,complement:t}:he()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=H(`\f`);break;case`n`:e=H(`
4
+ `);break;case`r`:e=H(`\r`);break;case`t`:e=H(` `);break;case`v`:e=H(`\v`)}return W(e)?{type:`Character`,value:e}:he()}controlLetterEscapeAtom(){this.consumeChar(`c`);let e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar(`0`),{type:`Character`,value:H(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:H(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
5
+ `:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:H(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,ge(t)&&this.isRangeDash()){this.consumeChar(`-`);let n=this.classAtom();if(n.type,ge(n)){if(n.value<t.value)throw Error(`Range out of order in character class`);e.push({from:t.value,to:n.value})}else me(t.value,e),e.push(H(`-`)),me(n.value,e)}else me(t.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,value:e}}classAtom(){switch(this.peekChar()){case`]`:case`
6
+ `:case`\r`:case`\u2028`:case`\u2029`:throw Error(`TBD`);case`\\`:return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`b`:return this.consumeChar(`b`),{type:`Character`,value:H(`\b`)};case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;this.consumeChar(`(`),this.peekChar(0)===`?`?(this.consumeChar(`?`),this.consumeChar(`:`),e=!1):this.groupIdx++;let t=this.disjunction();this.consumeChar(`)`);let n={type:`Group`,capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(!1===Se.test(e))throw Error(`Expecting a positive integer`);for(;xe.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===xe.test(e))throw Error(`Expecting an integer`);for(;xe.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
7
+ `:case`\r`:case`\u2028`:case`\u2029`:case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:throw Error(`TBD`);default:return{type:`Character`,value:H(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case`g`:case`i`:case`m`:case`u`:case`y`:return!0;default:return!1}}isRangeDash(){return this.peekChar()===`-`&&this.isClassAtom(1)}isDigit(){return xe.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case`]`:case`
8
8
  `:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case`.`:case`\\`:case`[`:case`(`:return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case`^`:case`$`:return!0;case`\\`:switch(this.peekChar(1)){case`b`:case`B`:return!0;default:return!1}case`(`:return this.peekChar(1)===`?`&&(this.peekChar(2)===`=`||this.peekChar(2)===`!`||this.peekChar(2)===`<`&&(this.peekChar(3)===`=`||this.peekChar(3)===`!`));default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:case`/`:case`
9
- `:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}parseHexDigits(e){let t=``;for(let n=0;n<e;n++){let e=this.popChar();if(!1===ye.test(e))throw Error(`Expecting a HexDecimal digits`);t+=e}return{type:`Character`,value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error(`Expected: '`+e+`' but found: '`+this.input[this.idx]+`' at offset: `+this.idx);if(this.idx>=this.input.length)throw Error(`Unexpected end of input`);this.idx++}loc(e){return{begin:e,end:this.idx}}};function Te(e){let t=e.toString();if(Ce.hasOwnProperty(t))return Ce[t];{let e=we.pattern(t);return Ce[t]=e,e}}var Ee=`Complement Sets are not supported for first char optimization`,De=`Unable to use "first char" lexer optimizations:
10
- `;function Oe(e,t=!1){try{let t=Te(e);return ke(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===Ee)t&&k(`${De}\tUnable to optimize: < ${e.toString()} >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n=``;t&&(n=`
9
+ `:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}parseHexDigits(e){let t=``;for(let n=0;n<e;n++){let e=this.popChar();if(!1===be.test(e))throw Error(`Expecting a HexDecimal digits`);t+=e}return{type:`Character`,value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error(`Expected: '`+e+`' but found: '`+this.input[this.idx]+`' at offset: `+this.idx);if(this.idx>=this.input.length)throw Error(`Unexpected end of input`);this.idx++}loc(e){return{begin:e,end:this.idx}}};function Ee(e){let t=e.toString();if(we.hasOwnProperty(t))return we[t];{let e=Te.pattern(t);return we[t]=e,e}}var De=`Complement Sets are not supported for first char optimization`,Oe=`Unable to use "first char" lexer optimizations:
10
+ `;function ke(e,t=!1){try{let t=Ee(e);return Ae(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===De)t&&D(`${Oe}\tUnable to optimize: < ${e.toString()} >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n=``;t&&(n=`
11
11
  This will disable the lexer's first char optimizations.
12
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),O(`${De}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function ke(e,t,n){switch(e.type){case`Disjunction`:for(let r=0;r<e.value.length;r++)ke(e.value[r],t,n);break;case`Alternative`:let r=e.value;for(let e=0;e<r.length;e++){let i=r[e];switch(i.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`Lookbehind`:case`NegativeLookbehind`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}let a=i;switch(a.type){case`Character`:Ae(a.value,t,n);break;case`Set`:if(!0===a.complement)throw Error(Ee);a.value.forEach(e=>{if(typeof e==`number`)Ae(e,t,n);else{let r=e;if(!0===n)for(let e=r.from;e<=r.to;e++)Ae(e,t,n);else{for(let e=r.from;e<=r.to&&e<256;e++)Ae(e,t,n);if(r.to>=256){let e=r.from>=256?r.from:256,n=r.to,i=K(e),a=K(n);for(let e=i;e<=a;e++)t[e]=e}}}});break;case`Group`:ke(a.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}let o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type===`Group`&&!1===Me(a)||a.type!==`Group`&&!1===o)break}break;default:throw Error(`non exhaustive match!`)}return Object.values(t)}function Ae(e,t,n){let r=K(e);t[r]=r,!0===n&&function(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let e=K(r.charCodeAt(0));t[e]=e}else{let e=n.toLowerCase();if(e!==n){let n=K(e.charCodeAt(0));t[n]=n}}}(e,t)}function je(e,t){return e.value.find(e=>{if(typeof e==`number`)return t.includes(e);{let n=e;return t.find(e=>n.from<=e&&e<=n.to)!==void 0}})}function Me(e){let t=e.quantifier;return!(!t||t.atLeast!==0)||!!e.value&&(Array.isArray(e.value)?e.value.every(Me):Me(e.value))}var Ne=class extends Se{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case`Lookahead`:this.visitLookahead(e);return;case`NegativeLookahead`:this.visitNegativeLookahead(e);return;case`Lookbehind`:this.visitLookbehind(e);return;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?je(e,this.targetCharCodes)===void 0&&(this.found=!0):je(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Pe(e,t){if(t instanceof RegExp){let n=Te(t),r=new Ne(e);return r.visit(n),r.found}for(let n of t){let t=n.charCodeAt(0);if(e.includes(t))return!0}return!1}var Fe=`PATTERN`,Ie=`defaultMode`;function Le(e,t){let n=(t=Object.assign({safeMode:!1,positionTracking:`full`,lineTerminatorCharacters:[`\r`,`
13
- `],tracer:(e,t)=>t()},t)).tracer,r;n(`initCharCodeToOptimizedIndexMap`,()=>{(function(){if(Ye.length===0){Ye=Array(65536);for(let e=0;e<65536;e++)Ye[e]=e>255?255+~~(e/255):e}})()}),n(`Reject Lexer.NA`,()=>{r=e.filter(e=>e[Fe]!==J.NA)});let i,a,o,s,c,l,u,d,f,p,m,h=!1;n(`Transform Patterns`,()=>{h=!1,i=r.map(e=>{let t=e[Fe];if(t instanceof RegExp){let e=t.source;return e.length!==1||e===`^`||e===`$`||e===`.`||t.ignoreCase?e.length!==2||e[0]!==`\\`||[`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`].includes(e[1])?Ve(t):e[1]:e}if(typeof t==`function`)return h=!0,{exec:t};if(typeof t==`object`)return h=!0,t;if(typeof t==`string`){if(t.length===1)return t;{let e=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`);return Ve(new RegExp(e))}}throw Error(`non exhaustive match`)})}),n(`misc mapping`,()=>{a=r.map(e=>e.tokenTypeIdx),o=r.map(e=>{let t=e.GROUP;if(t!==J.SKIPPED){if(typeof t==`string`)return t;if(t===void 0)return!1;throw Error(`non exhaustive match`)}}),s=r.map(e=>{let t=e.LONGER_ALT;if(t)return Array.isArray(t)?t.map(e=>r.indexOf(e)):[r.indexOf(t)]}),c=r.map(e=>e.PUSH_MODE),l=r.map(e=>Object.hasOwn(e,`POP_MODE`))}),n(`Line Terminator Handling`,()=>{let e=qe(t.lineTerminatorCharacters);u=r.map(e=>!1),t.positionTracking!==`onlyOffset`&&(u=r.map(t=>Object.hasOwn(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:!1===Ge(t,e)&&Pe(e,t.PATTERN)))}),n(`Misc Mapping #2`,()=>{d=r.map(He),f=i.map(Ue),p=r.reduce((e,t)=>{let n=t.GROUP;return typeof n==`string`&&n!==J.SKIPPED&&(e[n]=[]),e},{}),m=i.map((e,t)=>{let n=o[t]===void 0&&s[t]===void 0?function(e){if(!(e instanceof RegExp)||e.flags!==``)return;let t;try{t=Te(e)}catch{return}if(t.value.value.length!==1||t.value.value[0].value.length!==1)return;let n,r=t.value.value[0].value[0];for(;r.type===`Group`;){if(r.capturing||r.quantifier!==void 0&&n!==void 0||r.value.value.length!==1||r.value.value[0].value.length!==1)return;n=r.quantifier??n,r=r.value.value[0].value[0]}if(r.type!==`Set`||r.complement||r.quantifier!==void 0&&n!==void 0||(n=r.quantifier??n,n?.atLeast!==1||n.atMost!==1/0||!n.greedy))return;let i=new Uint8Array(128);for(let e of r.value){let t=typeof e==`number`?e:e.from,n=typeof e==`number`?e:e.to;if(t<0||n>=i.length)return;i.fill(1,t,n+1)}return i}(r[t].PATTERN):void 0;return{pattern:i[t],asciiClass:n,longerAlt:s[t],canLineTerminator:u[t],matchType:n===void 0?!1===f[t]?d[t]?1:2:0:3,short:f[t],group:o[t],push:c[t],pop:l[t],tokenTypeIdx:a[t],tokenType:r[t]}})});let g=!0,_=[];return t.safeMode||n(`First Char Optimization`,()=>{_=r.reduce((e,n,r)=>{if(typeof n.PATTERN==`string`)Je(e,K(n.PATTERN.charCodeAt(0)),m[r]);else if(Array.isArray(n.START_CHARS_HINT)){let t;n.START_CHARS_HINT.forEach(n=>{let i=K(typeof n==`string`?n.charCodeAt(0):n);t!==i&&(t=i,Je(e,i,m[r]))})}else if(n.PATTERN instanceof RegExp){if(n.PATTERN.unicode)g=!1,t.ensureOptimizations&&O(`${De}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let i=Oe(n.PATTERN,t.ensureOptimizations);i.length===0&&(g=!1),i.forEach(t=>{Je(e,t,m[r])})}}else t.ensureOptimizations&&O(`${De}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),g=!1;return e},[])}),{emptyGroups:p,patternIdxToConfig:m,charCodeToPatternIdxToConfig:_,hasCustom:h,canBeOptimized:g}}function Re(e,t){let n=[],r=function(e){let t=e.filter(e=>!Object.hasOwn(e,Fe));return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:q.MISSING_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}(e);n=n.concat(r.errors);let i=function(e){let t=e.filter(e=>{let t=e[Fe];return!(t instanceof RegExp||typeof t==`function`||Object.hasOwn(t,`exec`)||typeof t==`string`)});return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.`,type:q.INVALID_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(function(e){let t=[],n=e.filter(e=>e[Fe]instanceof RegExp);return t=t.concat(function(e){class t extends Se{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Te(n),r=new t;return r.visit(e),r.found}catch{return ze.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
12
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),E(`${Oe}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Ae(e,t,n){switch(e.type){case`Disjunction`:for(let r=0;r<e.value.length;r++)Ae(e.value[r],t,n);break;case`Alternative`:let r=e.value;for(let e=0;e<r.length;e++){let i=r[e];switch(i.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`Lookbehind`:case`NegativeLookbehind`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}let a=i;switch(a.type){case`Character`:je(a.value,t,n);break;case`Set`:if(!0===a.complement)throw Error(De);a.value.forEach(e=>{if(typeof e==`number`)je(e,t,n);else{let r=e;if(!0===n)for(let e=r.from;e<=r.to;e++)je(e,t,n);else{for(let e=r.from;e<=r.to&&e<256;e++)je(e,t,n);if(r.to>=256){let e=r.from>=256?r.from:256,n=r.to,i=K(e),a=K(n);for(let e=i;e<=a;e++)t[e]=e}}}});break;case`Group`:Ae(a.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}let o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type===`Group`&&!1===Ne(a)||a.type!==`Group`&&!1===o)break}break;default:throw Error(`non exhaustive match!`)}return Object.values(t)}function je(e,t,n){let r=K(e);t[r]=r,!0===n&&function(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let e=K(r.charCodeAt(0));t[e]=e}else{let e=n.toLowerCase();if(e!==n){let n=K(e.charCodeAt(0));t[n]=n}}}(e,t)}function Me(e,t){return e.value.find(e=>{if(typeof e==`number`)return t.includes(e);{let n=e;return t.find(e=>n.from<=e&&e<=n.to)!==void 0}})}function Ne(e){let t=e.quantifier;return!(!t||t.atLeast!==0)||!!e.value&&(Array.isArray(e.value)?e.value.every(Ne):Ne(e.value))}var Pe=class extends Ce{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case`Lookahead`:this.visitLookahead(e);return;case`NegativeLookahead`:this.visitNegativeLookahead(e);return;case`Lookbehind`:this.visitLookbehind(e);return;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?Me(e,this.targetCharCodes)===void 0&&(this.found=!0):Me(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Fe(e,t){if(t instanceof RegExp){let n=Ee(t),r=new Pe(e);return r.visit(n),r.found}for(let n of t){let t=n.charCodeAt(0);if(e.includes(t))return!0}return!1}var G=`PATTERN`,Ie=`defaultMode`;function Le(e,t){let n=(t=Object.assign({safeMode:!1,positionTracking:`full`,lineTerminatorCharacters:[`\r`,`
13
+ `],tracer:(e,t)=>t()},t)).tracer,r;n(`initCharCodeToOptimizedIndexMap`,()=>{(function(){if(Ye.length===0){Ye=Array(65536);for(let e=0;e<65536;e++)Ye[e]=e>255?255+~~(e/255):e}})()}),n(`Reject Lexer.NA`,()=>{r=e.filter(e=>e[G]!==J.NA)});let i,a,o,s,c,l,u,d,f,p,m,h=!1;n(`Transform Patterns`,()=>{h=!1,i=r.map(e=>{let t=e[G];if(t instanceof RegExp){let e=t.source;return e.length!==1||e===`^`||e===`$`||e===`.`||t.ignoreCase?e.length!==2||e[0]!==`\\`||[`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`].includes(e[1])?Ve(t):e[1]:e}if(typeof t==`function`)return h=!0,{exec:t};if(typeof t==`object`)return h=!0,t;if(typeof t==`string`){if(t.length===1)return t;{let e=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`);return Ve(new RegExp(e))}}throw Error(`non exhaustive match`)})}),n(`misc mapping`,()=>{a=r.map(e=>e.tokenTypeIdx),o=r.map(e=>{let t=e.GROUP;if(t!==J.SKIPPED){if(typeof t==`string`)return t;if(t===void 0)return!1;throw Error(`non exhaustive match`)}}),s=r.map(e=>{let t=e.LONGER_ALT;if(t)return Array.isArray(t)?t.map(e=>r.indexOf(e)):[r.indexOf(t)]}),c=r.map(e=>e.PUSH_MODE),l=r.map(e=>Object.hasOwn(e,`POP_MODE`))}),n(`Line Terminator Handling`,()=>{let e=qe(t.lineTerminatorCharacters);u=r.map(e=>!1),t.positionTracking!==`onlyOffset`&&(u=r.map(t=>Object.hasOwn(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:!1===Ge(t,e)&&Fe(e,t.PATTERN)))}),n(`Misc Mapping #2`,()=>{d=r.map(He),f=i.map(Ue),p=r.reduce((e,t)=>{let n=t.GROUP;return typeof n==`string`&&n!==J.SKIPPED&&(e[n]=[]),e},{}),m=i.map((e,t)=>{let n=o[t]===void 0&&s[t]===void 0?function(e){if(!(e instanceof RegExp)||e.flags!==``)return;let t;try{t=Ee(e)}catch{return}if(t.value.value.length!==1||t.value.value[0].value.length!==1)return;let n,r=t.value.value[0].value[0];for(;r.type===`Group`;){if(r.capturing||r.quantifier!==void 0&&n!==void 0||r.value.value.length!==1||r.value.value[0].value.length!==1)return;n=r.quantifier??n,r=r.value.value[0].value[0]}if(r.type!==`Set`||r.complement||r.quantifier!==void 0&&n!==void 0||(n=r.quantifier??n,n?.atLeast!==1||n.atMost!==1/0||!n.greedy))return;let i=new Uint8Array(128);for(let e of r.value){let t=typeof e==`number`?e:e.from,n=typeof e==`number`?e:e.to;if(t<0||n>=i.length)return;i.fill(1,t,n+1)}return i}(r[t].PATTERN):void 0;return{pattern:i[t],asciiClass:n,longerAlt:s[t],canLineTerminator:u[t],matchType:n===void 0?!1===f[t]?d[t]?1:2:0:3,short:f[t],group:o[t],push:c[t],pop:l[t],tokenTypeIdx:a[t],tokenType:r[t]}})});let g=!0,_=[];return t.safeMode||n(`First Char Optimization`,()=>{_=r.reduce((e,n,r)=>{if(typeof n.PATTERN==`string`)Je(e,K(n.PATTERN.charCodeAt(0)),m[r]);else if(Array.isArray(n.START_CHARS_HINT)){let t;n.START_CHARS_HINT.forEach(n=>{let i=K(typeof n==`string`?n.charCodeAt(0):n);t!==i&&(t=i,Je(e,i,m[r]))})}else if(n.PATTERN instanceof RegExp){if(n.PATTERN.unicode)g=!1,t.ensureOptimizations&&E(`${Oe}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let i=ke(n.PATTERN,t.ensureOptimizations);i.length===0&&(g=!1),i.forEach(t=>{Je(e,t,m[r])})}}else t.ensureOptimizations&&E(`${Oe}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),g=!1;return e},[])}),{emptyGroups:p,patternIdxToConfig:m,charCodeToPatternIdxToConfig:_,hasCustom:h,canBeOptimized:g}}function Re(e,t){let n=[],r=function(e){let t=e.filter(e=>!Object.hasOwn(e,G));return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:q.MISSING_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}(e);n=n.concat(r.errors);let i=function(e){let t=e.filter(e=>{let t=e[G];return!(t instanceof RegExp||typeof t==`function`||Object.hasOwn(t,`exec`)||typeof t==`string`)});return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.`,type:q.INVALID_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(function(e){let t=[],n=e.filter(e=>e[G]instanceof RegExp);return t=t.concat(function(e){class t extends Ce{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ee(n),r=new t;return r.visit(e),r.found}catch{return ze.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
14
14
  Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
15
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){class t extends Se{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Te(n),r=new t;return r.visit(e),r.found}catch{return Be.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
15
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){class t extends Ce{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ee(n),r=new t;return r.visit(e),r.found}catch{return Be.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
16
16
  Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
17
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){return e.filter(e=>{let t=e[Fe];return t instanceof RegExp&&(t.multiline||t.global)}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:q.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){let t=[],n=e.map(n=>e.reduce((e,r)=>(n.PATTERN.source!==r.PATTERN.source||t.includes(r)||r.PATTERN===J.NA||(t.push(r),e.push(r)),e),[]));return n=n.filter(Boolean),n.filter(e=>e.length>1).map(e=>{let t=e.map(e=>e.name);return{message:`The same RegExp pattern ->${e[0].PATTERN}<-has been used in all of the following Token Types: ${t.join(`, `)} <-`,type:q.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}(n)),t=t.concat(function(e){return e.filter(e=>e.PATTERN.test(``)).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:q.EMPTY_MATCH_PATTERN,tokenTypes:[e]}))}(n)),t}(a)),n=n.concat(function(e){return e.filter(e=>{if(!Object.hasOwn(e,`GROUP`))return!1;let t=e.GROUP;return t!==J.SKIPPED&&t!==J.NA&&typeof t!=`string`}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:q.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}))}(a)),n=n.concat(function(e,t){return e.filter(e=>e.PUSH_MODE!==void 0&&!t.includes(e.PUSH_MODE)).map(e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:q.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))}(a,t)),n=n.concat(function(e){let t=[],n=e.reduce((e,t,n)=>{let r=t.PATTERN;return r===J.NA||(typeof r==`string`?e.push({str:r,idx:n,tokenType:t}):r instanceof RegExp&&(i=r,[`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`].find(e=>i.source.indexOf(e)!==-1)===void 0)&&e.push({str:r.source,idx:n,tokenType:t})),e;var i},[]);return e.forEach((e,r)=>{n.forEach(({str:n,idx:i,tokenType:a})=>{if(r<i&&function(e,t){if(t instanceof RegExp){if(/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source))return!1;let n=t.exec(e);return n!==null&&n.index===0}if(typeof t==`function`)return t(e,0,[],{});if(Object.hasOwn(t,`exec`))return t.exec(e,0,[],{});if(typeof t==`string`)return t===e;throw Error(`non exhaustive match`)}(n,e.PATTERN)){let n=`Token: ->${a.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:q.UNREACHABLE_PATTERN,tokenTypes:[e,a]})}})}),t}(a)),n}var ze=/[^\\][$]/,Be=/[^\\[][\^]|^\^/;function Ve(e){let t=e.ignoreCase?`iy`:`y`;return RegExp(`${e.source}`,t)}function He(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if(typeof t==`function`||Object.hasOwn(t,`exec`))return!0;if(typeof t==`string`)return!1;throw Error(`non exhaustive match`)}function Ue(e){return typeof e==`string`&&e.length===1&&e.charCodeAt(0)}var We={test:function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let t=e.charCodeAt(n);if(t===10)return this.lastIndex=n+1,!0;if(t===13)return this.lastIndex=e.charCodeAt(n+1)===10?n+2:n+1,!0}return!1},lastIndex:0};function Ge(e,t){if(Object.hasOwn(e,`LINE_BREAKS`))return!1;if(e.PATTERN instanceof RegExp){try{Pe(t,e.PATTERN)}catch(e){return{issue:q.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(typeof e.PATTERN==`string`)return!1;if(He(e))return{issue:q.CUSTOM_LINE_BREAK};throw Error(`non exhaustive match`)}function Ke(e,t){if(t.issue===q.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===q.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${e.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}function qe(e){return e.map(e=>typeof e==`string`?e.charCodeAt(0):e)}function Je(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}var Ye=[];function K(e){return e<256?e:Ye[e]}function Xe(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]}function Ze(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}var Qe=1,$e={};function et(e){let t=function(e){let t=[...e],n=e,r=!0;for(;r;){n=n.map(e=>e.CATEGORIES).flat().filter(Boolean);let e=n.filter(e=>!t.includes(e));t=t.concat(e),e.length===0?r=!1:n=e}return t}(e);(function(e){e.forEach(e=>{var t;nt(e)||($e[Qe]=e,e.tokenTypeIdx=Qe++),rt(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),rt(e)||(e.CATEGORIES=[]),t=e,Object.hasOwn(t??{},`categoryMatches`)||(e.categoryMatches=[]),function(e){return Object.hasOwn(e??{},`categoryMatchesMap`)}(e)||(e.categoryMatchesMap={})})})(t),function(e){e.forEach(e=>{tt([],e)})}(t),function(e){e.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push($e[t].tokenTypeIdx)})})}(t),t.forEach(e=>{e.isParent=e.categoryMatches.length>0})}function tt(e,t){e.forEach(e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),t.CATEGORIES.forEach(n=>{let r=e.concat(t);r.includes(n)||tt(r,n)})}function nt(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}function rt(e){return Object.hasOwn(e??{},`CATEGORIES`)}function it(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}var q,at={buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,n,r,i,a)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`};(function(e){e[e.MISSING_PATTERN=0]=`MISSING_PATTERN`,e[e.INVALID_PATTERN=1]=`INVALID_PATTERN`,e[e.EOI_ANCHOR_FOUND=2]=`EOI_ANCHOR_FOUND`,e[e.UNSUPPORTED_FLAGS_FOUND=3]=`UNSUPPORTED_FLAGS_FOUND`,e[e.DUPLICATE_PATTERNS_FOUND=4]=`DUPLICATE_PATTERNS_FOUND`,e[e.INVALID_GROUP_TYPE_FOUND=5]=`INVALID_GROUP_TYPE_FOUND`,e[e.PUSH_MODE_DOES_NOT_EXIST=6]=`PUSH_MODE_DOES_NOT_EXIST`,e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]=`MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE`,e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]=`MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY`,e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]=`MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST`,e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]=`LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED`,e[e.SOI_ANCHOR_FOUND=11]=`SOI_ANCHOR_FOUND`,e[e.EMPTY_MATCH_PATTERN=12]=`EMPTY_MATCH_PATTERN`,e[e.NO_LINE_BREAKS_FLAGS=13]=`NO_LINE_BREAKS_FLAGS`,e[e.UNREACHABLE_PATTERN=14]=`UNREACHABLE_PATTERN`,e[e.IDENTIFY_TERMINATOR=15]=`IDENTIFY_TERMINATOR`,e[e.CUSTOM_LINE_BREAK=16]=`CUSTOM_LINE_BREAK`,e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]=`MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE`})(q||={});var ot={deferDefinitionErrorsHandling:!1,positionTracking:`full`,lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
18
- `,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:at,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ot);var J=class{constructor(e,t=ot){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=re(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},typeof t==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
17
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){return e.filter(e=>{let t=e[G];return t instanceof RegExp&&(t.multiline||t.global)}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:q.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){let t=[],n=e.map(n=>e.reduce((e,r)=>(n.PATTERN.source!==r.PATTERN.source||t.includes(r)||r.PATTERN===J.NA||(t.push(r),e.push(r)),e),[]));return n=n.filter(Boolean),n.filter(e=>e.length>1).map(e=>{let t=e.map(e=>e.name);return{message:`The same RegExp pattern ->${e[0].PATTERN}<-has been used in all of the following Token Types: ${t.join(`, `)} <-`,type:q.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}(n)),t=t.concat(function(e){return e.filter(e=>e.PATTERN.test(``)).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:q.EMPTY_MATCH_PATTERN,tokenTypes:[e]}))}(n)),t}(a)),n=n.concat(function(e){return e.filter(e=>{if(!Object.hasOwn(e,`GROUP`))return!1;let t=e.GROUP;return t!==J.SKIPPED&&t!==J.NA&&typeof t!=`string`}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:q.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}))}(a)),n=n.concat(function(e,t){return e.filter(e=>e.PUSH_MODE!==void 0&&!t.includes(e.PUSH_MODE)).map(e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:q.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))}(a,t)),n=n.concat(function(e){let t=[],n=e.reduce((e,t,n)=>{let r=t.PATTERN;return r===J.NA||(typeof r==`string`?e.push({str:r,idx:n,tokenType:t}):r instanceof RegExp&&(i=r,[`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`].find(e=>i.source.indexOf(e)!==-1)===void 0)&&e.push({str:r.source,idx:n,tokenType:t})),e;var i},[]);return e.forEach((e,r)=>{n.forEach(({str:n,idx:i,tokenType:a})=>{if(r<i&&function(e,t){if(t instanceof RegExp){if(/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source))return!1;let n=t.exec(e);return n!==null&&n.index===0}if(typeof t==`function`)return t(e,0,[],{});if(Object.hasOwn(t,`exec`))return t.exec(e,0,[],{});if(typeof t==`string`)return t===e;throw Error(`non exhaustive match`)}(n,e.PATTERN)){let n=`Token: ->${a.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:q.UNREACHABLE_PATTERN,tokenTypes:[e,a]})}})}),t}(a)),n}var ze=/[^\\][$]/,Be=/[^\\[][\^]|^\^/;function Ve(e){let t=e.ignoreCase?`iy`:`y`;return RegExp(`${e.source}`,t)}function He(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if(typeof t==`function`||Object.hasOwn(t,`exec`))return!0;if(typeof t==`string`)return!1;throw Error(`non exhaustive match`)}function Ue(e){return typeof e==`string`&&e.length===1&&e.charCodeAt(0)}var We={test:function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let t=e.charCodeAt(n);if(t===10)return this.lastIndex=n+1,!0;if(t===13)return this.lastIndex=e.charCodeAt(n+1)===10?n+2:n+1,!0}return!1},lastIndex:0};function Ge(e,t){if(Object.hasOwn(e,`LINE_BREAKS`))return!1;if(e.PATTERN instanceof RegExp){try{Fe(t,e.PATTERN)}catch(e){return{issue:q.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(typeof e.PATTERN==`string`)return!1;if(He(e))return{issue:q.CUSTOM_LINE_BREAK};throw Error(`non exhaustive match`)}function Ke(e,t){if(t.issue===q.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===q.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${e.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}function qe(e){return e.map(e=>typeof e==`string`?e.charCodeAt(0):e)}function Je(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}var Ye=[];function K(e){return e<256?e:Ye[e]}function Xe(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]}function Ze(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}var Qe=1,$e={};function et(e){let t=function(e){let t=[...e],n=e,r=!0;for(;r;){n=n.map(e=>e.CATEGORIES).flat().filter(Boolean);let e=n.filter(e=>!t.includes(e));t=t.concat(e),e.length===0?r=!1:n=e}return t}(e);(function(e){e.forEach(e=>{var t;nt(e)||($e[Qe]=e,e.tokenTypeIdx=Qe++),rt(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),rt(e)||(e.CATEGORIES=[]),t=e,Object.hasOwn(t??{},`categoryMatches`)||(e.categoryMatches=[]),function(e){return Object.hasOwn(e??{},`categoryMatchesMap`)}(e)||(e.categoryMatchesMap={})})})(t),function(e){e.forEach(e=>{tt([],e)})}(t),function(e){e.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push($e[t].tokenTypeIdx)})})}(t),t.forEach(e=>{e.isParent=e.categoryMatches.length>0})}function tt(e,t){e.forEach(e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),t.CATEGORIES.forEach(n=>{let r=e.concat(t);r.includes(n)||tt(r,n)})}function nt(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}function rt(e){return Object.hasOwn(e??{},`CATEGORIES`)}function it(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}var q,at={buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,n,r,i,a)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`};(function(e){e[e.MISSING_PATTERN=0]=`MISSING_PATTERN`,e[e.INVALID_PATTERN=1]=`INVALID_PATTERN`,e[e.EOI_ANCHOR_FOUND=2]=`EOI_ANCHOR_FOUND`,e[e.UNSUPPORTED_FLAGS_FOUND=3]=`UNSUPPORTED_FLAGS_FOUND`,e[e.DUPLICATE_PATTERNS_FOUND=4]=`DUPLICATE_PATTERNS_FOUND`,e[e.INVALID_GROUP_TYPE_FOUND=5]=`INVALID_GROUP_TYPE_FOUND`,e[e.PUSH_MODE_DOES_NOT_EXIST=6]=`PUSH_MODE_DOES_NOT_EXIST`,e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]=`MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE`,e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]=`MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY`,e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]=`MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST`,e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]=`LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED`,e[e.SOI_ANCHOR_FOUND=11]=`SOI_ANCHOR_FOUND`,e[e.EMPTY_MATCH_PATTERN=12]=`EMPTY_MATCH_PATTERN`,e[e.NO_LINE_BREAKS_FLAGS=13]=`NO_LINE_BREAKS_FLAGS`,e[e.UNREACHABLE_PATTERN=14]=`UNREACHABLE_PATTERN`,e[e.IDENTIFY_TERMINATOR=15]=`IDENTIFY_TERMINATOR`,e[e.CUSTOM_LINE_BREAK=16]=`CUSTOM_LINE_BREAK`,e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]=`MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE`})(q||={});var ot={deferDefinitionErrorsHandling:!1,positionTracking:`full`,lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
18
+ `,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:at,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ot);var J=class{constructor(e,t=ot){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=ae(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},typeof t==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
19
19
  a boolean 2nd argument is no longer supported`);this.config=Object.assign({},ot,t);let n=this.config.traceInitPerf;!0===n?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n==`number`&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT(`Lexer Constructor`,()=>{let n,r=!0;this.TRACE_INIT(`Lexer Config handling`,()=>{if(this.config.lineTerminatorsPattern===ot.lineTerminatorsPattern)this.config.lineTerminatorsPattern=We;else if(this.config.lineTerminatorCharacters===ot.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
20
20
  For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error(`"safeMode" and "ensureOptimizations" flags are mutually exclusive.`);this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?n={modes:{defaultMode:[...e]},defaultMode:Ie}:(r=!1,n=Object.assign({},e))}),!1===this.config.skipValidations&&(this.TRACE_INIT(`performRuntimeChecks`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e){let t=[];return Object.hasOwn(e,`defaultMode`)||t.push({message:`A MultiMode Lexer cannot be initialized without a <defaultMode> property in its definition
21
21
  `,type:q.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(e,`modes`)||t.push({message:`A MultiMode Lexer cannot be initialized without a <modes> property in its definition
22
- `,type:q.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(e,`modes`)&&Object.hasOwn(e,`defaultMode`)&&!Object.hasOwn(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${Ie}: <${e.defaultMode}>which does not exist\n`,type:q.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(e,`modes`)&&Object.keys(e.modes).forEach(n=>{let r=e.modes[n];r.forEach((e,i)=>{e===void 0?t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${n}> at index: <${i}>\n`,type:q.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(e,`LONGER_ALT`)&&(Array.isArray(e.LONGER_ALT)?e.LONGER_ALT:[e.LONGER_ALT]).forEach(i=>{i===void 0||r.includes(i)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${e.name}> outside of mode <${n}>\n`,type:q.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),t}(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT(`performWarningRuntimeChecks`,()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(function(e,t,n){let r=[],i=!1,a=Object.values(e.modes||{}).flat().filter(Boolean).filter(e=>e[Fe]!==J.NA),o=qe(n);return t&&a.forEach(e=>{let t=Ge(e,o);if(!1!==t){let n={message:Ke(e,t),type:t.issue,tokenType:e};r.push(n)}else Object.hasOwn(e,`LINE_BREAKS`)?!0===e.LINE_BREAKS&&(i=!0):Pe(o,e.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
22
+ `,type:q.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(e,`modes`)&&Object.hasOwn(e,`defaultMode`)&&!Object.hasOwn(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${Ie}: <${e.defaultMode}>which does not exist\n`,type:q.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(e,`modes`)&&Object.keys(e.modes).forEach(n=>{let r=e.modes[n];r.forEach((e,i)=>{e===void 0?t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${n}> at index: <${i}>\n`,type:q.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(e,`LONGER_ALT`)&&(Array.isArray(e.LONGER_ALT)?e.LONGER_ALT:[e.LONGER_ALT]).forEach(i=>{i===void 0||r.includes(i)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${e.name}> outside of mode <${n}>\n`,type:q.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),t}(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT(`performWarningRuntimeChecks`,()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(function(e,t,n){let r=[],i=!1,a=Object.values(e.modes||{}).flat().filter(Boolean).filter(e=>e[G]!==J.NA),o=qe(n);return t&&a.forEach(e=>{let t=Ge(e,o);if(!1!==t){let n={message:Ke(e,t),type:t.issue,tokenType:e};r.push(n)}else Object.hasOwn(e,`LINE_BREAKS`)?!0===e.LINE_BREAKS&&(i=!0):Fe(o,e.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
23
23
  This Lexer has been defined to track line and column information,
24
24
  But none of the Token Types can be identified as matching a line terminator.
25
25
  See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
26
26
  for details.`,type:q.NO_LINE_BREAKS_FLAGS}),r}(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},Object.entries(n.modes).forEach(([e,t])=>{n.modes[e]=t.filter(e=>e!==void 0)});let i=Object.keys(n.modes);if(Object.entries(n.modes).forEach(([e,n])=>{this.TRACE_INIT(`Mode: <${e}> processing`,()=>{if(this.modes.push(e),!1===this.config.skipValidations&&this.TRACE_INIT(`validatePatterns`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Re(n,i))}),this.lexerDefinitionErrors.length===0){let r;et(n),this.TRACE_INIT(`analyzeTokenTypes`,()=>{r=Le(n,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[e]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[e]=r.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[e]=r.canBeOptimized}})}),this.defaultMode=n.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
27
27
  `);throw Error(`Errors detected in definition of Lexer:
28
- `+e)}this.lexerDefinitionWarning.forEach(e=>{k(e.message)}),this.TRACE_INIT(`Choosing sub-methods implementations`,()=>{if(r&&(this.handleModes=()=>{}),!1===this.trackStartLines&&(this.computeNewColumn=e=>e),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=()=>{}),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else{if(!/onlyOffset/i.test(this.config.positionTracking))throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.createTokenInstance=this.createOffsetOnlyToken}this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT(`Failed Optimization Warnings`,()=>{let e=Object.entries(this.canModeBeOptimized).reduce((e,[t,n])=>(!1===n&&e.push(t),e),[]);if(t.ensureOptimizations&&e.length>0)throw Error(`Lexer Modes: < ${e.join(`, `)} > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT(`clearRegExpParserCache`,()=>{Ce={}}),this.TRACE_INIT(`toFastProperties`,()=>{ie(this)})})}tokenize(e,t=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
28
+ `+e)}this.lexerDefinitionWarning.forEach(e=>{D(e.message)}),this.TRACE_INIT(`Choosing sub-methods implementations`,()=>{if(r&&(this.handleModes=()=>{}),!1===this.trackStartLines&&(this.computeNewColumn=e=>e),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=()=>{}),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else{if(!/onlyOffset/i.test(this.config.positionTracking))throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.createTokenInstance=this.createOffsetOnlyToken}this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT(`Failed Optimization Warnings`,()=>{let e=Object.entries(this.canModeBeOptimized).reduce((e,[t,n])=>(!1===n&&e.push(t),e),[]);if(t.ensureOptimizations&&e.length>0)throw Error(`Lexer Modes: < ${e.join(`, `)} > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT(`clearRegExpParserCache`,()=>{we={}}),this.TRACE_INIT(`toFastProperties`,()=>{O(this)})})}tokenize(e,t=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
29
29
  `);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
30
- `+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=e,v=_.length,y=0,b=0,ee=this.hasCustom?0:Math.floor(e.length/10),x=Array(ee),S=[],te=this.trackStartLines?1:void 0,C=this.trackStartLines?1:void 0,w={};for(let e=0;e<this.cachedGroupKeys.length;e++)w[this.cachedGroupKeys[e]]=[];let T=this.trackStartLines,E=this.config.lineTerminatorsPattern,ne=0,D=[],O=[],k=[],re=[];Object.freeze(re);let ie=!1,A=e=>{if(k.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);S.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{k.pop();let e=k.at(-1);D=this.patternIdxToConfig[e],O=this.charCodeToPatternIdxToConfig[e],ne=D.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;ie=!(!O||!t)}};function j(e){k.push(e),O=this.charCodeToPatternIdxToConfig[e],D=this.patternIdxToConfig[e],ne=D.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;ie=!(!O||!t)}let M;j.call(this,t);let N=this.config.recoveryEnabled;for(;y<v;){s=null,u=-1;let t=_.charCodeAt(y),ee;if(ie){let e=K(t),n=O[e];ee=n===void 0?re:n}else ee=D;let P=ee.length;for(n=0;n<P;n++){M=ee[n];let r=M.pattern;switch(c=null,M.matchType){case 0:t===M.short&&(u=1,s=r);break;case 1:g=r.exec(_,y,x,w),g===null?s=null:(s=g[0],u=s.length,g.payload!==void 0&&(c=g.payload));break;case 3:{let e=M.asciiClass;if(e[t]!==1){r.lastIndex=0;break}let n=y+1;for(;e[_.charCodeAt(n)]===1;)n++;u=n-y,r.lastIndex=n;break}case 2:r.lastIndex=y,u=this.matchLength(r,e,y)}if(u!==-1){if(o=M.longerAlt,o!==void 0){s=e.substring(y,y+u);let t=o.length;for(i=0;i<t;i++){let t=D[o[i]],n=t.pattern;if(l=null,t.matchType===1?(g=n.exec(_,y,x,w),g===null?a=null:(a=g[0],g.payload!==void 0&&(l=g.payload))):(n.lastIndex=y,a=this.match(n,e,y)),a&&a.length>s.length){s=a,u=a.length,c=l,M=t;break}}}break}}if(u!==-1){if(d=M.group,d!==void 0&&(s=s===null?e.substring(y,y+u):s,f=M.tokenTypeIdx,p=this.createTokenInstance(s,y,f,M.tokenType,te,C,u),this.handlePayload(p,c),!1===d?b=this.addToken(x,b,p):w[d].push(p)),!0===T&&!0===M.canLineTerminator){let t,n,r=0;E.lastIndex=0;do s=s===null?e.substring(y,y+u):s,t=E.test(s),!0===t&&(n=E.lastIndex-1,r++);while(!0===t);r===0?C=this.computeNewColumn(C,u):(te+=r,C=u-n,this.updateTokenEndLineColumnLocation(p,d,n,r,te,C,u))}else C=this.computeNewColumn(C,u);y+=u,this.handleModes(M,A,j,p)}else{let t=y,n=te,i=C,a=!1===N;for(;!1===a&&y<v;)for(y++,r=0;r<ne;r++){let t=D[r],n=t.pattern;switch(t.matchType){case 0:_.charCodeAt(y)===t.short&&(a=!0);break;case 1:a=n.exec(_,y,x,w)!==null;break;case 3:case 2:n.lastIndex=y,a=n.exec(e)!==null}if(!0===a)break}if(m=y-t,C=this.computeNewColumn(C,m),h=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(_,t,m,n,i,k.at(-1)),S.push({offset:t,line:n,column:i,length:m,message:h}),!1===N)break}}return this.hasCustom||(x.length=b),{tokens:x,groups:w,errors:S}}handleModes(e,t,n,r){if(!0===e.pop){let i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,n,r,i,a,o){let s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,r===1&&!0===s||(e.endLine=i+c,e.endColumn=a-1-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null}matchLength(e,t,n){return!0===e.test(t)?e.lastIndex-n:-1}};function st(e){return ct(e)?e.LABEL:e.name}function ct(e){return typeof e.LABEL==`string`&&e.LABEL!==``}J.SKIPPED=`This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.`,J.NA=/NOT_APPLICABLE/;var lt=`parent`,ut=`categories`,dt=`label`,ft=`group`,pt=`push_mode`,mt=`pop_mode`,ht=`longer_alt`,gt=`line_breaks`,_t=`start_chars_hint`;function Y(e){return function(e){let t=e.pattern,n={};if(n.name=e.name,t!==void 0&&(n.PATTERN=t),Object.hasOwn(e,lt))throw`The parent property is no longer supported.
30
+ `+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=e,v=_.length,y=0,ee=0,b=this.hasCustom?0:Math.floor(e.length/10),x=Array(b),te=[],S=this.trackStartLines?1:void 0,C=this.trackStartLines?1:void 0,w={};for(let e=0;e<this.cachedGroupKeys.length;e++)w[this.cachedGroupKeys[e]]=[];let ne=this.trackStartLines,re=this.config.lineTerminatorsPattern,ie=0,T=[],E=[],D=[],ae=[];Object.freeze(ae);let O=!1,k=e=>{if(D.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);te.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{D.pop();let e=D.at(-1);T=this.patternIdxToConfig[e],E=this.charCodeToPatternIdxToConfig[e],ie=T.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=!(!E||!t)}};function A(e){D.push(e),E=this.charCodeToPatternIdxToConfig[e],T=this.patternIdxToConfig[e],ie=T.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=!(!E||!t)}let j;A.call(this,t);let M=this.config.recoveryEnabled;for(;y<v;){s=null,u=-1;let t=_.charCodeAt(y),b;if(O){let e=K(t),n=E[e];b=n===void 0?ae:n}else b=T;let N=b.length;for(n=0;n<N;n++){j=b[n];let r=j.pattern;switch(c=null,j.matchType){case 0:t===j.short&&(u=1,s=r);break;case 1:g=r.exec(_,y,x,w),g===null?s=null:(s=g[0],u=s.length,g.payload!==void 0&&(c=g.payload));break;case 3:{let e=j.asciiClass;if(e[t]!==1){r.lastIndex=0;break}let n=y+1;for(;e[_.charCodeAt(n)]===1;)n++;u=n-y,r.lastIndex=n;break}case 2:r.lastIndex=y,u=this.matchLength(r,e,y)}if(u!==-1){if(o=j.longerAlt,o!==void 0){s=e.substring(y,y+u);let t=o.length;for(i=0;i<t;i++){let t=T[o[i]],n=t.pattern;if(l=null,t.matchType===1?(g=n.exec(_,y,x,w),g===null?a=null:(a=g[0],g.payload!==void 0&&(l=g.payload))):(n.lastIndex=y,a=this.match(n,e,y)),a&&a.length>s.length){s=a,u=a.length,c=l,j=t;break}}}break}}if(u!==-1){if(d=j.group,d!==void 0&&(s=s===null?e.substring(y,y+u):s,f=j.tokenTypeIdx,p=this.createTokenInstance(s,y,f,j.tokenType,S,C,u),this.handlePayload(p,c),!1===d?ee=this.addToken(x,ee,p):w[d].push(p)),!0===ne&&!0===j.canLineTerminator){let t,n,r=0;re.lastIndex=0;do s=s===null?e.substring(y,y+u):s,t=re.test(s),!0===t&&(n=re.lastIndex-1,r++);while(!0===t);r===0?C=this.computeNewColumn(C,u):(S+=r,C=u-n,this.updateTokenEndLineColumnLocation(p,d,n,r,S,C,u))}else C=this.computeNewColumn(C,u);y+=u,this.handleModes(j,k,A,p)}else{let t=y,n=S,i=C,a=!1===M;for(;!1===a&&y<v;)for(y++,r=0;r<ie;r++){let t=T[r],n=t.pattern;switch(t.matchType){case 0:_.charCodeAt(y)===t.short&&(a=!0);break;case 1:a=n.exec(_,y,x,w)!==null;break;case 3:case 2:n.lastIndex=y,a=n.exec(e)!==null}if(!0===a)break}if(m=y-t,C=this.computeNewColumn(C,m),h=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(_,t,m,n,i,D.at(-1)),te.push({offset:t,line:n,column:i,length:m,message:h}),!1===M)break}}return this.hasCustom||(x.length=ee),{tokens:x,groups:w,errors:te}}handleModes(e,t,n,r){if(!0===e.pop){let i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,n,r,i,a,o){let s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,r===1&&!0===s||(e.endLine=i+c,e.endColumn=a-1-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null}matchLength(e,t,n){return!0===e.test(t)?e.lastIndex-n:-1}};function st(e){return ct(e)?e.LABEL:e.name}function ct(e){return typeof e.LABEL==`string`&&e.LABEL!==``}J.SKIPPED=`This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.`,J.NA=/NOT_APPLICABLE/;var lt=`parent`,ut=`categories`,dt=`label`,ft=`group`,pt=`push_mode`,mt=`pop_mode`,ht=`longer_alt`,gt=`line_breaks`,_t=`start_chars_hint`;function Y(e){return function(e){let t=e.pattern,n={};if(n.name=e.name,t!==void 0&&(n.PATTERN=t),Object.hasOwn(e,lt))throw`The parent property is no longer supported.
31
31
  See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(e,ut)&&(n.CATEGORIES=e[ut]),et([n]),Object.hasOwn(e,dt)&&(n.LABEL=e[dt]),Object.hasOwn(e,ft)&&(n.GROUP=e[ft]),Object.hasOwn(e,mt)&&(n.POP_MODE=e[mt]),Object.hasOwn(e,pt)&&(n.PUSH_MODE=e[pt]),Object.hasOwn(e,ht)&&(n.LONGER_ALT=e[ht]),Object.hasOwn(e,gt)&&(n.LINE_BREAKS=e[gt]),Object.hasOwn(e,_t)&&(n.START_CHARS_HINT=e[_t]),n}(e)}var X=Y({name:`EOF`,pattern:J.NA});function vt(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}et([X]);var yt={buildMismatchTokenMessage:({expected:e,actual:t,previous:n,ruleName:r})=>`Expecting ${ct(e)?`--\x3e ${st(e)} <--`:`token of type --\x3e ${e.name} <--`} but found --\x3e '${t.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>`Redundant input, expecting EOF but found: `+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let a=`
32
32
  but found: '`+t[0].image+`'`;return r?`Expecting: `+r+a:`Expecting: one of these possible Token sequences:\n${e.reduce((e,t)=>e.concat(t),[]).map(e=>`[${e.map(e=>st(e)).join(`, `)}]`).map((e,t)=>` ${t+1}. ${e}`).join(`
33
33
  `)}`+a},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){let i=`
34
34
  but found: '`+t[0].image+`'`;return n?`Expecting: `+n+i:`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::\n <${e.map(e=>`[${e.map(e=>st(e)).join(`,`)}]`).join(` ,`)}>`+i}};Object.freeze(yt);var bt={buildRuleNotFoundError:(e,t)=>`Invalid grammar, reference to a rule which is not defined: ->`+t.nonTerminalName+`<-
35
- inside top level rule: ->`+e.name+`<-`},xt={buildDuplicateFoundError(e,t){let n=e.name,r=t[0],i=r.idx,a=H(r),o=(s=r)instanceof B?s.terminalType.name:s instanceof j?s.nonTerminalName:``;var s;let c=`->${a}${i>0?i:``}<- ${o?`with argument: ->${o}<-`:``}\n appears more than once (${t.length} times) in the top level rule: ->${n}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return c=c.replace(/[ \t]+/g,` `),c=c.replace(/\s\s+/g,`
35
+ inside top level rule: ->`+e.name+`<-`},xt={buildDuplicateFoundError(e,t){let n=e.name,r=t[0],i=r.idx,a=V(r),o=(s=r)instanceof z?s.terminalType.name:s instanceof A?s.nonTerminalName:``;var s;let c=`->${a}${i>0?i:``}<- ${o?`with argument: ->${o}<-`:``}\n appears more than once (${t.length} times) in the top level rule: ->${n}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return c=c.replace(/[ \t]+/g,` `),c=c.replace(/\s\s+/g,`
36
36
  `),c},buildNamespaceConflictError:e=>`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter.`,buildAlternationPrefixAmbiguityError(e){let t=e.prefixPath.map(e=>st(e)).join(`, `),n=e.alternation.idx===0?``:e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(` ,`)}> due to common lookahead prefix\nin <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details.`},buildAlternationAmbiguityError(e){let t=e.alternation.idx===0?``:e.alternation.idx,n=e.prefixPath.length===0,r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(` ,`)}> in <OR${t}> inside <${e.topLevelRule.name}> Rule,\n`;return r+=n?`These alternatives are all empty (match no tokens), making them indistinguishable.
37
37
  Only the last alternative may be empty.
38
38
  `:`<${e.prefixPath.map(e=>st(e)).join(`, `)}> may appears as a prefix path in all these alternatives.\n`,r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
39
- For Further details.`,r},buildEmptyRepetitionError(e){let t=H(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError:e=>`deprecated`,buildEmptyAlternationError:e=>`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`,buildTooManyAlternativesError:e=>`An Alternation cannot have more than 256 alternatives:\n<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\n has ${e.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(e){let t=e.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${t}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${t} --\x3e ${e.leftRecursionPath.map(e=>e.name).concat([t]).join(` --> `)}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>`deprecated`,buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof M?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}},Z,St=class extends oe{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:Q.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},Ct=class extends ce{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName=``,this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error(`The path does not start with the walker's top Rule!`);return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName=``,this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},wt=class extends Ct{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName=``,this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new N({definition:t.concat(n)});this.possibleTokTypes=ue(e),this.found=!0}}},Tt=class extends ce{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Et=class extends Tt{walkMany(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof B&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}},Dt=class extends Tt{walkManySep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof B&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}},Ot=class extends Tt{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof B&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}},kt=class extends Tt{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof B&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}};function At(e,t,n=[]){n=[...n];let r=[],i=0;function a(a){let o=At(a.concat(e.slice(i+1)),t,n);return r.concat(o)}for(;n.length<t&&i<e.length;){let t=e[i];if(t instanceof N||t instanceof j)return a(t.definition);if(t instanceof P)r=a(t.definition);else{if(t instanceof F)return a(t.definition.concat([new L({definition:t.definition})]));if(t instanceof I)return a([new N({definition:t.definition}),new L({definition:[new B({terminalType:t.separator})].concat(t.definition)})]);if(t instanceof R)r=a(t.definition.concat([new L({definition:[new B({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof L)r=a(t.definition.concat([new L({definition:t.definition})]));else{if(t instanceof z)return t.definition.forEach(e=>{e.definition.length!==0&&(r=a(e.definition))}),r;if(!(t instanceof B))throw Error(`non exhaustive match`);n.push(t.terminalType)}}i++}return r.push({partialPath:n,suffixDef:e.slice(i)}),r}function jt(e,t,n,r){let i=[...n];i.push(e.name);let a=[...r];return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}function Mt(e){if(e instanceof P||e===`Option`)return Z.OPTION;if(e instanceof L||e===`Repetition`)return Z.REPETITION;if(e instanceof F||e===`RepetitionMandatory`)return Z.REPETITION_MANDATORY;if(e instanceof I||e===`RepetitionMandatoryWithSeparator`)return Z.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof R||e===`RepetitionWithSeparator`)return Z.REPETITION_WITH_SEPARATOR;if(e instanceof z||e===`Alternation`)return Z.ALTERNATION;throw Error(`non exhaustive match`)}function Nt(e,t,n,r){let i=e.length,a=e.every(e=>e.every(e=>e.length===1));if(t)return function(t){let r=t.map(e=>e.GATE);for(let t=0;t<i;t++){let i=e[t],a=i.length,o=r[t];if(o===void 0||!1!==o.call(this))e:for(let e=0;e<a;e++){let r=i[e],a=r.length;for(let e=0;e<a;e++)if(!1===n(this.LA_FAST(e+1),r[e]))continue e;return t}}};if(a&&!r){let t=e.map(e=>e.flat()).reduce((e,t,n)=>(t.forEach(t=>{t.tokenTypeIdx in e||(e[t.tokenTypeIdx]=n),t.categoryMatches.forEach(t=>{Object.hasOwn(e,t)||(e[t]=n)})}),e),{});return function(){let e=this.LA_FAST(1);return t[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){let r=e[t],i=r.length;e:for(let e=0;e<i;e++){let i=r[e],a=i.length;for(let e=0;e<a;e++)if(!1===n(this.LA_FAST(e+1),i[e]))continue e;return t}}}}function Pt(e,t,n){let r=e.every(e=>e.length===1),i=e.length;if(r&&!n){let t=e.flat();if(t.length===1&&t[0].categoryMatches.length===0){let e=t[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===e}}{let e=t.reduce((e,t,n)=>(e[t.tokenTypeIdx]=!0,t.categoryMatches.forEach(t=>{e[t]=!0}),e),[]);return function(){let t=this.LA_FAST(1);return!0===e[t.tokenTypeIdx]}}}return function(){e:for(let n=0;n<i;n++){let r=e[n],i=r.length;for(let e=0;e<i;e++)if(!1===t(this.LA_FAST(e+1),r[e]))continue e;return!0}return!1}}(function(e){e[e.OPTION=0]=`OPTION`,e[e.REPETITION=1]=`REPETITION`,e[e.REPETITION_MANDATORY=2]=`REPETITION_MANDATORY`,e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]=`REPETITION_MANDATORY_WITH_SEPARATOR`,e[e.REPETITION_WITH_SEPARATOR=4]=`REPETITION_WITH_SEPARATOR`,e[e.ALTERNATION=5]=`ALTERNATION`})(Z||={});var Ft=class extends ce{constructor(e,t,n){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)}walkOption(e,t,n){this.checkIsTarget(e,Z.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,Z.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,Z.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,Z.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}},It=class extends oe{constructor(e,t,n){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=n,this.result=[]}checkIsTarget(e,t){e.idx!==this.targetOccurrence||this.targetProdType!==t||this.targetRef!==void 0&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Z.OPTION)}visitRepetition(e){this.checkIsTarget(e,Z.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Z.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Z.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Z.ALTERNATION)}};function Lt(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function Rt(e){let t=[``];for(let n=0;n<e.length;n++){let r=e[n],i=[];for(let e=0;e<t.length;e++){let n=t[e];i.push(n+`_`+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){let t=`_`+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function zt(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;let i=e[r];for(let e=0;e<t.length;e++)if(!0===i[t[e]])return!1}return!0}function Bt(e,t){let n=e.map(e=>At([e],1)),r=Lt(n.length),i=n.map(e=>{let t={};return e.forEach(e=>{Rt(e.partialPath).forEach(e=>{t[e]=!0})}),t}),a=n;for(let e=1;e<=t;e++){let n=a;a=Lt(n.length);for(let o=0;o<n.length;o++){let s=n[o];for(let n=0;n<s.length;n++){let c=s[n].partialPath,l=s[n].suffixDef,u=Rt(c);if(zt(i,u,o)||l.length===0||c.length===t){let e=r[o];if(!1===Ut(e,c)){e.push(c);for(let e=0;e<u.length;e++){let t=u[e];i[o][t]=!0}}}else{let t=At(l,e+1,c);a[o]=a[o].concat(t),t.forEach(e=>{Rt(e.partialPath).forEach(e=>{i[o][e]=!0})})}}}}return r}function Vt(e,t,n,r){let i=new It(e,Z.ALTERNATION,r);return t.accept(i),Bt(i.result,n)}function Ht(e,t,n,r){let i=new It(e,n);t.accept(i);let a=i.result,o=new Ft(t,e,n).startWalking();return Bt([new N({definition:a}),new N({definition:o})],r)}function Ut(e,t){e:for(let n=0;n<e.length;n++){let r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){let n=t[e],i=r[e];if((n===i||i.categoryMatchesMap[n.tokenTypeIdx]!==void 0)==0)continue e}return!0}}return!1}function Wt(e){return e.every(e=>e.every(e=>e.every(e=>e.categoryMatches.length===0)))}function Gt(e,t,n,r){let i=e.flatMap(e=>function(e,t){let n=new Jt;e.accept(n);let r=n.allProductions,i=Object.groupBy(r,Kt),a=Object.fromEntries(Object.entries(i).filter(([e,t])=>t.length>1));return Object.values(a).map(n=>{let r=n[0],i=t.buildDuplicateFoundError(e,n),a=H(r),o={message:i,type:Q.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:r.idx},s=qt(r);return s&&(o.parameter=s),o})}(e,n)),a=function(e,t,n){let r=[],i=t.map(e=>e.name);return e.forEach(e=>{let t=e.name;if(i.includes(t)){let i=n.buildNamespaceConflictError(e);r.push({message:i,type:Q.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),r}(e,t,n),o=e.flatMap(e=>function(e,t){let n=new Zt;return e.accept(n),n.alternations.flatMap(n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:Q.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[])}(e,n)),s=e.flatMap(t=>function(e,t,n,r){let i=[];if(t.reduce((t,n)=>n.name===e.name?t+1:t,0)>1){let t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:Q.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}(t,e,r,n));return i.concat(a,o,s)}function Kt(e){return`${H(e)}_#_${e.idx}_#_${qt(e)}`}function qt(e){return e instanceof B?e.terminalType.name:e instanceof j?e.nonTerminalName:``}var Jt=class extends oe{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function Yt(e,t,n,r=[]){let i=[],a=Xt(t.definition);if(a.length===0)return[];{let t=e.name;a.includes(e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:Q.LEFT_RECURSION,ruleName:t});let o=r.concat([e]),s=a.filter(e=>!o.includes(e)).flatMap(t=>{let i=[...r];return i.push(t),Yt(e,t,n,i)});return i.concat(s)}}function Xt(e){let t=[];if(e.length===0)return t;let n=e[0];if(n instanceof j)t.push(n.referencedRule);else if(n instanceof N||n instanceof P||n instanceof F||n instanceof I||n instanceof R||n instanceof L)t=t.concat(Xt(n.definition));else if(n instanceof z)t=n.definition.map(e=>Xt(e.definition)).flat();else if(!(n instanceof B))throw Error(`non exhaustive match`);let r=se(n),i=e.length>1;if(r&&i){let n=e.slice(1);return t.concat(Xt(n))}return t}var Zt=class extends oe{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Qt(e,t){let n=new Zt;return e.accept(n),n.alternations.flatMap(n=>n.definition.slice(0,-1).flatMap((r,i)=>function(e,t,n,r){let i=`EXIT_NONE_TERMINAL`,a=[i],o=`EXIT_ALTERNATIVE`,s=!1,c=t.length,l=c-r-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});d.length!==0;){let e=d.pop();if(e===o){s&&d.at(-1).idx<=l&&d.pop();continue}let r=e.def,f=e.idx,p=e.ruleStack,m=e.occurrenceStack;if(r.length===0)continue;let h=r[0];if(h===i){let e={idx:f,def:r.slice(1),ruleStack:p.slice(0,-1),occurrenceStack:m.slice(0,-1)};d.push(e)}else if(h instanceof B){if(f<c-1){let e=f+1;if(n(t[e],h.terminalType)){let t={idx:e,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(t)}}else{if(f!==c-1)throw Error(`non exhaustive match`);u.push({nextTokenType:h.terminalType,nextTokenOccurrence:h.idx,ruleStack:p,occurrenceStack:m}),s=!0}}else if(h instanceof j){let e=[...p];e.push(h.nonTerminalName);let t=[...m];t.push(h.idx);let n={idx:f,def:h.definition.concat(a,r.slice(1)),ruleStack:e,occurrenceStack:t};d.push(n)}else if(h instanceof P){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t={idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof F){let e=new L({definition:h.definition,idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof I){let e=new L({definition:[new B({terminalType:h.separator})].concat(h.definition),idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof R){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new L({definition:[new B({terminalType:h.separator})].concat(h.definition),idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof L){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new L({definition:h.definition,idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof z)for(let e=h.definition.length-1;e>=0;e--){let t={idx:f,def:h.definition[e].definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t),d.push(o)}else if(h instanceof N)d.push({idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m});else{if(!(h instanceof M))throw Error(`non exhaustive match`);d.push(jt(h,f,p,m))}}return u}([r],[],Xe,1).length===0?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:Q.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]))}function $t(e,t,n){let r=new Zt;e.accept(r);let i=r.alternations;return i=i.filter(e=>!0!==e.ignoreAmbiguities),i.flatMap(r=>{let i=r.idx,a=Vt(i,e,r.maxLookahead||t,r),o=function(e,t,n,r){let i=[];return e.reduce((n,r,a)=>(!0===t.definition[a].ignoreAmbiguities||r.forEach(r=>{let o=[a];e.forEach((e,n)=>{a!==n&&Ut(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&o.push(n)}),o.length>1&&!Ut(i,r)&&(i.push(r),n.push({alts:o,path:r}))}),n),[]).map(e=>{let i=e.alts.map(e=>e+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Q.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}})}(a,r,e,n),s=function(e,t,n,r){let i=e.reduce((e,t,n)=>{let r=t.map(e=>({idx:n,path:e}));return e.concat(r)},[]);return i.flatMap(e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];let a=e.idx,o=e.path;return i.filter(e=>{return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<a&&(n=e.path,r=o,n.length<r.length&&n.every((e,t)=>{let n=r[t];return e===n||n.categoryMatchesMap[e.tokenTypeIdx]}));var n,r}).map(e=>{let i=[e.idx+1,a+1],o=t.idx===0?``:t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Q.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:o,alternatives:i}})})}(a,r,e,n);return o.concat(s)})}var en=class extends oe{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function tn(e){let t=Object.assign({errMsgProvider:bt},e),n={};return e.rules.forEach(e=>{n[e.name]=e}),function(e,t){let n=new St(e,t);return n.resolveRefs(),n.errors}(n,t.errMsgProvider)}var nn=`MismatchedTokenException`,rn=`NoViableAltException`,an=`EarlyExitException`,on=`NotAllInputParsedException`,sn=[nn,rn,an,on];function cn(e){return sn.includes(e.name)}Object.freeze(sn);var ln=class extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},un=class extends ln{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=nn}},dn=class extends ln{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=rn}},fn=class extends ln{constructor(e,t){super(e,t),this.name=on}},pn=class extends ln{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=an}},mn={},hn=class extends Error{constructor(e){super(e),this.name=`InRuleRecoveryException`}};function gn(e,t,n,r,i,a,o){var s,c;let l=r|i,u=(s=this.firstAfterRepMap)[c=this.currRuleShortName]??(s[c]=[]),d=u[l];if(d===void 0){let e=this.getCurrRuleFullName();d=new a(this.getGAstProductions()[e],i).startWalking(),u[l]=d}let f=d.token,p=d.occurrence,m=d.isEndOfRule;this.RULE_STACK_IDX===0&&m&&f===void 0&&(f=X,p=1),f!==void 0&&p!==void 0&&this.shouldInRepetitionRecoveryBeTried(f,p,o)&&this.tryInRepetitionRecovery(e,t,n,f)}var _n=1024,vn=1280,yn=1536,bn=class{constructor(e){this.maxLookahead=e?.maxLookahead??$.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(t.length===0){let n=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...r,...i]}return t}validateNoLeftRecursion(e){return e.flatMap(e=>Yt(e,e,xt))}validateEmptyOrAlternatives(e){return e.flatMap(e=>Qt(e,xt))}validateAmbiguousAlternationAlternatives(e,t){return e.flatMap(e=>$t(e,t,xt))}validateSomeNonEmptyLookaheadPath(e,t){return function(e,t,n){let r=[];return e.forEach(e=>{let i=new en;e.accept(i),i.allProductions.forEach(i=>{let a=Mt(i),o=i.maxLookahead||t;if(Ht(i.idx,e,a,o)[0].flat().length===0){let t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:Q.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),r}(e,t,xt)}buildLookaheadForAlternation(e){return function(e,t,n,r,i,a){let o=Vt(e,t,n);return a(o,r,Wt(o)?Ze:Xe,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Nt)}buildLookaheadForOptional(e){return function(e,t,n,r,i,a){let o=Ht(e,t,i,n),s=Wt(o)?Ze:Xe;return a(o[0],s,r)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Mt(e.prodType),Pt)}},xn=new class extends oe{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}};function Sn(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==1&&(e.endOffset=t.endOffset)}function Cn(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==1&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}var wn;function Tn(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function En(e,t){let n=Object.keys(e),r=n.length;for(let i=0;i<r;i++){let r=e[n[i]],a=r.length;for(let e=0;e<a;e++){let n=r[e];n.tokenTypeIdx===void 0&&this[n.name](n.children,t)}}}function Dn(e,t){let n=function(){};return Tn(n,e+`BaseSemantics`),n.prototype={visit:function(e,t){if(Array.isArray(e)&&(e=e[0]),e!==void 0)return this[e.name](e.children,t)},validateVisitor:function(){let e=function(e,t){return function(e,t){return t.filter(t=>typeof e[t]==`function`==0).map(t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:wn.MISSING_METHOD,methodName:t})).filter(Boolean)}(e,t)}(this,t);if(e.length!==0){let t=e.map(e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join(`
39
+ For Further details.`,r},buildEmptyRepetitionError(e){let t=V(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError:e=>`deprecated`,buildEmptyAlternationError:e=>`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`,buildTooManyAlternativesError:e=>`An Alternation cannot have more than 256 alternatives:\n<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\n has ${e.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(e){let t=e.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${t}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${t} --\x3e ${e.leftRecursionPath.map(e=>e.name).concat([t]).join(` --> `)}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>`deprecated`,buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof j?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}},Z,St=class extends se{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:Q.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},Ct=class extends le{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName=``,this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error(`The path does not start with the walker's top Rule!`);return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName=``,this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},wt=class extends Ct{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName=``,this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new M({definition:t.concat(n)});this.possibleTokTypes=de(e),this.found=!0}}},Tt=class extends le{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Et=class extends Tt{walkMany(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof z&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}},Dt=class extends Tt{walkManySep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof z&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}},Ot=class extends Tt{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof z&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}},kt=class extends Tt{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof z&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}};function At(e,t,n=[]){n=[...n];let r=[],i=0;function a(a){let o=At(a.concat(e.slice(i+1)),t,n);return r.concat(o)}for(;n.length<t&&i<e.length;){let t=e[i];if(t instanceof M||t instanceof A)return a(t.definition);if(t instanceof N)r=a(t.definition);else{if(t instanceof P)return a(t.definition.concat([new I({definition:t.definition})]));if(t instanceof F)return a([new M({definition:t.definition}),new I({definition:[new z({terminalType:t.separator})].concat(t.definition)})]);if(t instanceof L)r=a(t.definition.concat([new I({definition:[new z({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof I)r=a(t.definition.concat([new I({definition:t.definition})]));else{if(t instanceof R)return t.definition.forEach(e=>{e.definition.length!==0&&(r=a(e.definition))}),r;if(!(t instanceof z))throw Error(`non exhaustive match`);n.push(t.terminalType)}}i++}return r.push({partialPath:n,suffixDef:e.slice(i)}),r}function jt(e,t,n,r){let i=[...n];i.push(e.name);let a=[...r];return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}function Mt(e){if(e instanceof N||e===`Option`)return Z.OPTION;if(e instanceof I||e===`Repetition`)return Z.REPETITION;if(e instanceof P||e===`RepetitionMandatory`)return Z.REPETITION_MANDATORY;if(e instanceof F||e===`RepetitionMandatoryWithSeparator`)return Z.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof L||e===`RepetitionWithSeparator`)return Z.REPETITION_WITH_SEPARATOR;if(e instanceof R||e===`Alternation`)return Z.ALTERNATION;throw Error(`non exhaustive match`)}function Nt(e,t,n,r){let i=e.length,a=e.every(e=>e.every(e=>e.length===1));if(t)return function(t){let r=t.map(e=>e.GATE);for(let t=0;t<i;t++){let i=e[t],a=i.length,o=r[t];if(o===void 0||!1!==o.call(this))e:for(let e=0;e<a;e++){let r=i[e],a=r.length;for(let e=0;e<a;e++)if(!1===n(this.LA_FAST(e+1),r[e]))continue e;return t}}};if(a&&!r){let t=e.map(e=>e.flat()).reduce((e,t,n)=>(t.forEach(t=>{t.tokenTypeIdx in e||(e[t.tokenTypeIdx]=n),t.categoryMatches.forEach(t=>{Object.hasOwn(e,t)||(e[t]=n)})}),e),{});return function(){let e=this.LA_FAST(1);return t[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){let r=e[t],i=r.length;e:for(let e=0;e<i;e++){let i=r[e],a=i.length;for(let e=0;e<a;e++)if(!1===n(this.LA_FAST(e+1),i[e]))continue e;return t}}}}function Pt(e,t,n){let r=e.every(e=>e.length===1),i=e.length;if(r&&!n){let t=e.flat();if(t.length===1&&t[0].categoryMatches.length===0){let e=t[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===e}}{let e=t.reduce((e,t,n)=>(e[t.tokenTypeIdx]=!0,t.categoryMatches.forEach(t=>{e[t]=!0}),e),[]);return function(){let t=this.LA_FAST(1);return!0===e[t.tokenTypeIdx]}}}return function(){e:for(let n=0;n<i;n++){let r=e[n],i=r.length;for(let e=0;e<i;e++)if(!1===t(this.LA_FAST(e+1),r[e]))continue e;return!0}return!1}}(function(e){e[e.OPTION=0]=`OPTION`,e[e.REPETITION=1]=`REPETITION`,e[e.REPETITION_MANDATORY=2]=`REPETITION_MANDATORY`,e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]=`REPETITION_MANDATORY_WITH_SEPARATOR`,e[e.REPETITION_WITH_SEPARATOR=4]=`REPETITION_WITH_SEPARATOR`,e[e.ALTERNATION=5]=`ALTERNATION`})(Z||={});var Ft=class extends le{constructor(e,t,n){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)}walkOption(e,t,n){this.checkIsTarget(e,Z.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,Z.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,Z.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,Z.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}},It=class extends se{constructor(e,t,n){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=n,this.result=[]}checkIsTarget(e,t){e.idx!==this.targetOccurrence||this.targetProdType!==t||this.targetRef!==void 0&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Z.OPTION)}visitRepetition(e){this.checkIsTarget(e,Z.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Z.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Z.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Z.ALTERNATION)}};function Lt(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function Rt(e){let t=[``];for(let n=0;n<e.length;n++){let r=e[n],i=[];for(let e=0;e<t.length;e++){let n=t[e];i.push(n+`_`+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){let t=`_`+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function zt(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;let i=e[r];for(let e=0;e<t.length;e++)if(!0===i[t[e]])return!1}return!0}function Bt(e,t){let n=e.map(e=>At([e],1)),r=Lt(n.length),i=n.map(e=>{let t={};return e.forEach(e=>{Rt(e.partialPath).forEach(e=>{t[e]=!0})}),t}),a=n;for(let e=1;e<=t;e++){let n=a;a=Lt(n.length);for(let o=0;o<n.length;o++){let s=n[o];for(let n=0;n<s.length;n++){let c=s[n].partialPath,l=s[n].suffixDef,u=Rt(c);if(zt(i,u,o)||l.length===0||c.length===t){let e=r[o];if(!1===Ut(e,c)){e.push(c);for(let e=0;e<u.length;e++){let t=u[e];i[o][t]=!0}}}else{let t=At(l,e+1,c);a[o]=a[o].concat(t),t.forEach(e=>{Rt(e.partialPath).forEach(e=>{i[o][e]=!0})})}}}}return r}function Vt(e,t,n,r){let i=new It(e,Z.ALTERNATION,r);return t.accept(i),Bt(i.result,n)}function Ht(e,t,n,r){let i=new It(e,n);t.accept(i);let a=i.result,o=new Ft(t,e,n).startWalking();return Bt([new M({definition:a}),new M({definition:o})],r)}function Ut(e,t){e:for(let n=0;n<e.length;n++){let r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){let n=t[e],i=r[e];if((n===i||i.categoryMatchesMap[n.tokenTypeIdx]!==void 0)==0)continue e}return!0}}return!1}function Wt(e){return e.every(e=>e.every(e=>e.every(e=>e.categoryMatches.length===0)))}function Gt(e,t,n,r){let i=e.flatMap(e=>function(e,t){let n=new Jt;e.accept(n);let r=n.allProductions,i=Object.groupBy(r,Kt),a=Object.fromEntries(Object.entries(i).filter(([e,t])=>t.length>1));return Object.values(a).map(n=>{let r=n[0],i=t.buildDuplicateFoundError(e,n),a=V(r),o={message:i,type:Q.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:r.idx},s=qt(r);return s&&(o.parameter=s),o})}(e,n)),a=function(e,t,n){let r=[],i=t.map(e=>e.name);return e.forEach(e=>{let t=e.name;if(i.includes(t)){let i=n.buildNamespaceConflictError(e);r.push({message:i,type:Q.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),r}(e,t,n),o=e.flatMap(e=>function(e,t){let n=new Zt;return e.accept(n),n.alternations.flatMap(n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:Q.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[])}(e,n)),s=e.flatMap(t=>function(e,t,n,r){let i=[];if(t.reduce((t,n)=>n.name===e.name?t+1:t,0)>1){let t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:Q.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}(t,e,r,n));return i.concat(a,o,s)}function Kt(e){return`${V(e)}_#_${e.idx}_#_${qt(e)}`}function qt(e){return e instanceof z?e.terminalType.name:e instanceof A?e.nonTerminalName:``}var Jt=class extends se{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function Yt(e,t,n,r=[]){let i=[],a=Xt(t.definition);if(a.length===0)return[];{let t=e.name;a.includes(e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:Q.LEFT_RECURSION,ruleName:t});let o=r.concat([e]),s=a.filter(e=>!o.includes(e)).flatMap(t=>{let i=[...r];return i.push(t),Yt(e,t,n,i)});return i.concat(s)}}function Xt(e){let t=[];if(e.length===0)return t;let n=e[0];if(n instanceof A)t.push(n.referencedRule);else if(n instanceof M||n instanceof N||n instanceof P||n instanceof F||n instanceof L||n instanceof I)t=t.concat(Xt(n.definition));else if(n instanceof R)t=n.definition.map(e=>Xt(e.definition)).flat();else if(!(n instanceof z))throw Error(`non exhaustive match`);let r=ce(n),i=e.length>1;if(r&&i){let n=e.slice(1);return t.concat(Xt(n))}return t}var Zt=class extends se{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Qt(e,t){let n=new Zt;return e.accept(n),n.alternations.flatMap(n=>n.definition.slice(0,-1).flatMap((r,i)=>function(e,t,n,r){let i=`EXIT_NONE_TERMINAL`,a=[i],o=`EXIT_ALTERNATIVE`,s=!1,c=t.length,l=c-r-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});d.length!==0;){let e=d.pop();if(e===o){s&&d.at(-1).idx<=l&&d.pop();continue}let r=e.def,f=e.idx,p=e.ruleStack,m=e.occurrenceStack;if(r.length===0)continue;let h=r[0];if(h===i){let e={idx:f,def:r.slice(1),ruleStack:p.slice(0,-1),occurrenceStack:m.slice(0,-1)};d.push(e)}else if(h instanceof z){if(f<c-1){let e=f+1;if(n(t[e],h.terminalType)){let t={idx:e,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(t)}}else{if(f!==c-1)throw Error(`non exhaustive match`);u.push({nextTokenType:h.terminalType,nextTokenOccurrence:h.idx,ruleStack:p,occurrenceStack:m}),s=!0}}else if(h instanceof A){let e=[...p];e.push(h.nonTerminalName);let t=[...m];t.push(h.idx);let n={idx:f,def:h.definition.concat(a,r.slice(1)),ruleStack:e,occurrenceStack:t};d.push(n)}else if(h instanceof N){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t={idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof P){let e=new I({definition:h.definition,idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof F){let e=new I({definition:[new z({terminalType:h.separator})].concat(h.definition),idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof L){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new I({definition:[new z({terminalType:h.separator})].concat(h.definition),idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof I){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new I({definition:h.definition,idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof R)for(let e=h.definition.length-1;e>=0;e--){let t={idx:f,def:h.definition[e].definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t),d.push(o)}else if(h instanceof M)d.push({idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m});else{if(!(h instanceof j))throw Error(`non exhaustive match`);d.push(jt(h,f,p,m))}}return u}([r],[],Xe,1).length===0?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:Q.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]))}function $t(e,t,n){let r=new Zt;e.accept(r);let i=r.alternations;return i=i.filter(e=>!0!==e.ignoreAmbiguities),i.flatMap(r=>{let i=r.idx,a=Vt(i,e,r.maxLookahead||t,r),o=function(e,t,n,r){let i=[];return e.reduce((n,r,a)=>(!0===t.definition[a].ignoreAmbiguities||r.forEach(r=>{let o=[a];e.forEach((e,n)=>{a!==n&&Ut(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&o.push(n)}),o.length>1&&!Ut(i,r)&&(i.push(r),n.push({alts:o,path:r}))}),n),[]).map(e=>{let i=e.alts.map(e=>e+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Q.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}})}(a,r,e,n),s=function(e,t,n,r){let i=e.reduce((e,t,n)=>{let r=t.map(e=>({idx:n,path:e}));return e.concat(r)},[]);return i.flatMap(e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];let a=e.idx,o=e.path;return i.filter(e=>{return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<a&&(n=e.path,r=o,n.length<r.length&&n.every((e,t)=>{let n=r[t];return e===n||n.categoryMatchesMap[e.tokenTypeIdx]}));var n,r}).map(e=>{let i=[e.idx+1,a+1],o=t.idx===0?``:t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Q.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:o,alternatives:i}})})}(a,r,e,n);return o.concat(s)})}var en=class extends se{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function tn(e){let t=Object.assign({errMsgProvider:bt},e),n={};return e.rules.forEach(e=>{n[e.name]=e}),function(e,t){let n=new St(e,t);return n.resolveRefs(),n.errors}(n,t.errMsgProvider)}var nn=`MismatchedTokenException`,rn=`NoViableAltException`,an=`EarlyExitException`,on=`NotAllInputParsedException`,sn=[nn,rn,an,on];function cn(e){return sn.includes(e.name)}Object.freeze(sn);var ln=class extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},un=class extends ln{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=nn}},dn=class extends ln{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=rn}},fn=class extends ln{constructor(e,t){super(e,t),this.name=on}},pn=class extends ln{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=an}},mn={},hn=class extends Error{constructor(e){super(e),this.name=`InRuleRecoveryException`}};function gn(e,t,n,r,i,a,o){var s,c;let l=r|i,u=(s=this.firstAfterRepMap)[c=this.currRuleShortName]??(s[c]=[]),d=u[l];if(d===void 0){let e=this.getCurrRuleFullName();d=new a(this.getGAstProductions()[e],i).startWalking(),u[l]=d}let f=d.token,p=d.occurrence,m=d.isEndOfRule;this.RULE_STACK_IDX===0&&m&&f===void 0&&(f=X,p=1),f!==void 0&&p!==void 0&&this.shouldInRepetitionRecoveryBeTried(f,p,o)&&this.tryInRepetitionRecovery(e,t,n,f)}var _n=1024,vn=1280,yn=1536,bn=class{constructor(e){this.maxLookahead=e?.maxLookahead??$.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(t.length===0){let n=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...r,...i]}return t}validateNoLeftRecursion(e){return e.flatMap(e=>Yt(e,e,xt))}validateEmptyOrAlternatives(e){return e.flatMap(e=>Qt(e,xt))}validateAmbiguousAlternationAlternatives(e,t){return e.flatMap(e=>$t(e,t,xt))}validateSomeNonEmptyLookaheadPath(e,t){return function(e,t,n){let r=[];return e.forEach(e=>{let i=new en;e.accept(i),i.allProductions.forEach(i=>{let a=Mt(i),o=i.maxLookahead||t;if(Ht(i.idx,e,a,o)[0].flat().length===0){let t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:Q.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),r}(e,t,xt)}buildLookaheadForAlternation(e){return function(e,t,n,r,i,a){let o=Vt(e,t,n);return a(o,r,Wt(o)?Ze:Xe,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Nt)}buildLookaheadForOptional(e){return function(e,t,n,r,i,a){let o=Ht(e,t,i,n),s=Wt(o)?Ze:Xe;return a(o[0],s,r)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Mt(e.prodType),Pt)}},xn=new class extends se{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}};function Sn(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==1&&(e.endOffset=t.endOffset)}function Cn(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==1&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}var wn;function Tn(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function En(e,t){let n=Object.keys(e),r=n.length;for(let i=0;i<r;i++){let r=e[n[i]],a=r.length;for(let e=0;e<a;e++){let n=r[e];n.tokenTypeIdx===void 0&&this[n.name](n.children,t)}}}function Dn(e,t){let n=function(){};return Tn(n,e+`BaseSemantics`),n.prototype={visit:function(e,t){if(Array.isArray(e)&&(e=e[0]),e!==void 0)return this[e.name](e.children,t)},validateVisitor:function(){let e=function(e,t){return function(e,t){return t.filter(t=>typeof e[t]==`function`==0).map(t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:wn.MISSING_METHOD,methodName:t})).filter(Boolean)}(e,t)}(this,t);if(e.length!==0){let t=e.map(e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join(`
40
40
 
41
41
  `).replace(/\n/g,`
42
42
  `)}`)}}},n.prototype.constructor=n,n._RULE_NAMES=t,n}(function(e){e[e.REDUNDANT_METHOD=0]=`REDUNDANT_METHOD`,e[e.MISSING_METHOD=1]=`MISSING_METHOD`})(wn||={});var On={description:`This Object indicates the Parser is during Recording Phase`};Object.freeze(On);var kn=!0,An=Y({name:`RECORDING_PHASE_TOKEN`,pattern:J.NA});et([An]);var jn=vt(An,`This IToken indicates the Parser is in Recording Phase
43
43
  See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(jn);var Mn={name:`This CSTNode indicates the Parser is in Recording Phase
44
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};function Nn(e,t,n,r=!1){In(n);let i=this.recordingProdStack.at(-1),a=typeof t==`function`?t:t.DEF,o=new e({definition:[],idx:n});return r&&(o.separator=t.SEP),Object.hasOwn(t,`MAX_LOOKAHEAD`)&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),a.call(this),i.definition.push(o),this.recordingProdStack.pop(),On}function Pn(e,t){In(t);let n=this.recordingProdStack.at(-1),r=!1===Array.isArray(e),i=!1===r?e:e.DEF,a=new z({definition:[],idx:t,ignoreAmbiguities:r&&!0===e.IGNORE_AMBIGUITIES});return Object.hasOwn(e,`MAX_LOOKAHEAD`)&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=i.some(e=>typeof e.GATE==`function`),n.definition.push(a),i.forEach(e=>{let t=new N({definition:[]});a.definition.push(t),Object.hasOwn(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Object.hasOwn(e,`GATE`)&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),On}function Fn(e){return e===0?``:`${e}`}function In(e){if(e<0||e>255){let t=Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than 256`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var Ln=vt(X,``,-1,-1,-1,-1,-1,-1);Object.freeze(Ln);var Q,$=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:yt,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),Rn=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});(function(e){e[e.INVALID_RULE_NAME=0]=`INVALID_RULE_NAME`,e[e.DUPLICATE_RULE_NAME=1]=`DUPLICATE_RULE_NAME`,e[e.INVALID_RULE_OVERRIDE=2]=`INVALID_RULE_OVERRIDE`,e[e.DUPLICATE_PRODUCTIONS=3]=`DUPLICATE_PRODUCTIONS`,e[e.UNRESOLVED_SUBRULE_REF=4]=`UNRESOLVED_SUBRULE_REF`,e[e.LEFT_RECURSION=5]=`LEFT_RECURSION`,e[e.NONE_LAST_EMPTY_ALT=6]=`NONE_LAST_EMPTY_ALT`,e[e.AMBIGUOUS_ALTS=7]=`AMBIGUOUS_ALTS`,e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]=`CONFLICT_TOKENS_RULES_NAMESPACE`,e[e.INVALID_TOKEN_NAME=9]=`INVALID_TOKEN_NAME`,e[e.NO_NON_EMPTY_LOOKAHEAD=10]=`NO_NON_EMPTY_LOOKAHEAD`,e[e.AMBIGUOUS_PREFIX_ALTS=11]=`AMBIGUOUS_PREFIX_ALTS`,e[e.TOO_MANY_ALTS=12]=`TOO_MANY_ALTS`,e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]=`CUSTOM_LOOKAHEAD_VALIDATION`})(Q||={});var zn,Bn=class e{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT(`performSelfAnalysis`,()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT(`toFastProps`,()=>{ie(this)}),this.TRACE_INIT(`Grammar Recording`,()=>{try{this.enableRecording(),this.definedRulesNames.forEach(e=>{let t=this[e].originalGrammarAction,n;this.TRACE_INIT(`${e} Rule`,()=>{n=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=n})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT(`Grammar Resolving`,()=>{r=tn({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT(`Grammar Validations`,()=>{if(r.length===0&&!1===this.skipValidations){let t=function(e){let t=e.errMsgProvider??xt;return Gt(e.rules,e.tokenTypes,t,e.grammarName)}({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:xt,grammarName:n}),r=(e={lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:n}).lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}).map(e=>Object.assign({type:Q.CUSTOM_LOOKAHEAD_VALIDATION},e));this.definitionErrors=this.definitionErrors.concat(t,r)}var e}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT(`computeAllProdsFollows`,()=>{let e=function(e){let t={};return e.forEach(e=>{let n=new fe(e).startWalking();Object.assign(t,n)}),t}(Object.values(this.gastProductionsCache));this.resyncFollows=e}),this.TRACE_INIT(`ComputeLookaheadFunctions`,()=>{var e,t;(t=(e=this.lookaheadStrategy).initialize)==null||t.call(e,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw t=this.definitionErrors.map(e=>e.message),Error(`Parser Definition Errors detected:\n ${t.join(`
44
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};function Nn(e,t,n,r=!1){In(n);let i=this.recordingProdStack.at(-1),a=typeof t==`function`?t:t.DEF,o=new e({definition:[],idx:n});return r&&(o.separator=t.SEP),Object.hasOwn(t,`MAX_LOOKAHEAD`)&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),a.call(this),i.definition.push(o),this.recordingProdStack.pop(),On}function Pn(e,t){In(t);let n=this.recordingProdStack.at(-1),r=!1===Array.isArray(e),i=!1===r?e:e.DEF,a=new R({definition:[],idx:t,ignoreAmbiguities:r&&!0===e.IGNORE_AMBIGUITIES});return Object.hasOwn(e,`MAX_LOOKAHEAD`)&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=i.some(e=>typeof e.GATE==`function`),n.definition.push(a),i.forEach(e=>{let t=new M({definition:[]});a.definition.push(t),Object.hasOwn(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Object.hasOwn(e,`GATE`)&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),On}function Fn(e){return e===0?``:`${e}`}function In(e){if(e<0||e>255){let t=Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than 256`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var Ln=vt(X,``,-1,-1,-1,-1,-1,-1);Object.freeze(Ln);var Q,$=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:yt,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),Rn=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});(function(e){e[e.INVALID_RULE_NAME=0]=`INVALID_RULE_NAME`,e[e.DUPLICATE_RULE_NAME=1]=`DUPLICATE_RULE_NAME`,e[e.INVALID_RULE_OVERRIDE=2]=`INVALID_RULE_OVERRIDE`,e[e.DUPLICATE_PRODUCTIONS=3]=`DUPLICATE_PRODUCTIONS`,e[e.UNRESOLVED_SUBRULE_REF=4]=`UNRESOLVED_SUBRULE_REF`,e[e.LEFT_RECURSION=5]=`LEFT_RECURSION`,e[e.NONE_LAST_EMPTY_ALT=6]=`NONE_LAST_EMPTY_ALT`,e[e.AMBIGUOUS_ALTS=7]=`AMBIGUOUS_ALTS`,e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]=`CONFLICT_TOKENS_RULES_NAMESPACE`,e[e.INVALID_TOKEN_NAME=9]=`INVALID_TOKEN_NAME`,e[e.NO_NON_EMPTY_LOOKAHEAD=10]=`NO_NON_EMPTY_LOOKAHEAD`,e[e.AMBIGUOUS_PREFIX_ALTS=11]=`AMBIGUOUS_PREFIX_ALTS`,e[e.TOO_MANY_ALTS=12]=`TOO_MANY_ALTS`,e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]=`CUSTOM_LOOKAHEAD_VALIDATION`})(Q||={});var zn,Bn=class e{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT(`performSelfAnalysis`,()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT(`toFastProps`,()=>{O(this)}),this.TRACE_INIT(`Grammar Recording`,()=>{try{this.enableRecording(),this.definedRulesNames.forEach(e=>{let t=this[e].originalGrammarAction,n;this.TRACE_INIT(`${e} Rule`,()=>{n=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=n})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT(`Grammar Resolving`,()=>{r=tn({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT(`Grammar Validations`,()=>{if(r.length===0&&!1===this.skipValidations){let t=function(e){let t=e.errMsgProvider??xt;return Gt(e.rules,e.tokenTypes,t,e.grammarName)}({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:xt,grammarName:n}),r=(e={lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:n}).lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}).map(e=>Object.assign({type:Q.CUSTOM_LOOKAHEAD_VALIDATION},e));this.definitionErrors=this.definitionErrors.concat(t,r)}var e}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT(`computeAllProdsFollows`,()=>{let e=function(e){let t={};return e.forEach(e=>{let n=new pe(e).startWalking();Object.assign(t,n)}),t}(Object.values(this.gastProductionsCache));this.resyncFollows=e}),this.TRACE_INIT(`ComputeLookaheadFunctions`,()=>{var e,t;(t=(e=this.lookaheadStrategy).initialize)==null||t.call(e,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw t=this.definitionErrors.map(e=>e.message),Error(`Parser Definition Errors detected:\n ${t.join(`
45
45
  -------------------------------
46
46
  `)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initGastRecorder(t),n.initPerformanceTracer(t),Object.hasOwn(t,`ignoredIssues`))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
47
47
  Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
48
48
  See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
49
- For further details.`);this.skipValidations=Object.hasOwn(t,`skipValidations`)?t.skipValidations:$.skipValidations}};Bn.DEFER_DEFINITION_ERRORS_HANDLING=!1,zn=Bn,[class{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,`recoveryEnabled`)?e.recoveryEnabled:$.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=gn)}getTokenToInsert(e){let t=vt(e,``,-1,-1,-1,-1,-1,-1);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,r){let i=this.findReSyncTokenType(),a=this.exportLexerState(),o=[],s=!1,c=this.LA_FAST(1),l=this.LA_FAST(1),u=()=>{let e=this.LA(0),t=new un(this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:e,ruleName:this.getCurrRuleFullName()}),c,this.LA(0));t.resyncedTokens=o.slice(0,-1),this.SAVE_ERROR(t)};for(;!s;){if(this.tokenMatcher(l,r))return void u();if(n.call(this))return u(),void e.apply(this,t);this.tokenMatcher(l,i)?s=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o))}this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,n){return!1!==n&&!this.tokenMatcher(this.LA_FAST(1),e)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t))}getNextPossibleTokenTypes(e){let t=e.ruleStack[0],n=this.getGAstProductions()[t];return new wt(n,e).startWalking()}getFollowsForInRuleRecovery(e,t){let n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new hn(`sad sad panda`)}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||t.length===0)return!1;let n=this.LA_FAST(1);return t.find(e=>this.tokenMatcher(n,e))!==void 0}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(t).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA_FAST(1),n=2;for(;;){let r=e.find(e=>Xe(t,e));if(r!==void 0)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return mn;let e=this.currRuleShortName,t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK,n=this.RULE_STACK_IDX+1,r=Array(n);for(let i=0;i<n;i++)r[i]=i===0?mn:{ruleName:this.shortRuleNameToFullName(e[i]),idxInCallingRule:t[i],inRule:this.shortRuleNameToFullName(e[i-1])};return r}flattenFollowSet(){return this.buildFullFollowKeyStack().map(e=>this.getFollowSetFromFollowKey(e)).flat()}getFollowSetFromFollowKey(e){if(e===mn)return[X];let t=e.ruleName+e.idxInCallingRule+de+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,X)||t.push(e),t}reSyncTo(e){let t=[],n=this.LA_FAST(1);for(;!1===this.tokenMatcher(n,e);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return t.slice(0,-1)}attemptInRepetitionRecovery(e,t,n,r,i,a,o){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,t=Array(e);for(let n=0;n<e;n++)t[n]=this.shortRuleNameToFullName(this.RULE_STACK[n]);return t}},class{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,`dynamicTokensEnabled`)?e.dynamicTokensEnabled:$.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,`maxLookahead`)?e.maxLookahead:$.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,`lookaheadStrategy`)?e.lookaheadStrategy:new bn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{let{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:o}=function(e){xn.reset(),e.accept(xn);let t=xn.dslMethods;return xn.reset(),t}(e);t.forEach(t=>{let n=t.idx===0?``:t.idx;this.TRACE_INIT(`${H(t)}${n}`,()=>{let n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[e.name],256|t.idx,n)})}),n.forEach(t=>{this.computeLookaheadFunc(e,t.idx,768,`Repetition`,t.maxLookahead,H(t))}),r.forEach(t=>{this.computeLookaheadFunc(e,t.idx,512,`Option`,t.maxLookahead,H(t))}),i.forEach(t=>{this.computeLookaheadFunc(e,t.idx,_n,`RepetitionMandatory`,t.maxLookahead,H(t))}),a.forEach(t=>{this.computeLookaheadFunc(e,t.idx,yn,`RepetitionMandatoryWithSeparator`,t.maxLookahead,H(t))}),o.forEach(t=>{this.computeLookaheadFunc(e,t.idx,vn,`RepetitionWithSeparator`,t.maxLookahead,H(t))})})})}computeLookaheadFunc(e,t,n,r,i,a){this.TRACE_INIT(`${a}${t===0?``:t}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r});this.setLaFuncCache(this.fullRuleNameToShort[e.name],n|t,a)})}setLaFuncCache(e,t,n){let r=this.lookAheadFuncsCache[e];r===void 0&&(r=[],this.lookAheadFuncsCache[e]=r),r[t]=n}},class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,`nodeLocationTracking`)?e.nodeLocationTracking:$.nodeLocationTracking,this.outputCst){if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Cn,this.setNodeLocationFromNode=Cn,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Sn,this.setNodeLocationFromNode=Sn,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{}}}else this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{}}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(e){let t=this.LA_FAST(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset==1?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=-1,n.startLine=-1,n.startColumn=-1)}cstPostRuleOnlyOffset(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset==1?n.endOffset=t.endOffset:n.startOffset=-1}cstPostTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];var r,i=t,a=e;(r=n).children[a]===void 0?r.children[a]=[i]:r.children[a].push(i),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];(function(e,t,n){e.children[t]===void 0?e.children[t]=[n]:e.children[t].push(n)})(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}get currCSTNode(){return this.CST_STACK[this.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let e=Dn(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let e=function(e,t,n){let r=function(){};Tn(r,e+`BaseSemanticsWithDefaults`);let i=Object.create(n.prototype);return t.forEach(e=>{i[e]=En}),(r.prototype=i).constructor=r,r}(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}},class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)throw Error(`Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.`);this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):Ln}LA_FAST(e){let t=this.currIdx+e;return this.tokVector[t]}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Ln:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}},class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=Ze,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(t,`serializedGrammar`))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
49
+ For further details.`);this.skipValidations=Object.hasOwn(t,`skipValidations`)?t.skipValidations:$.skipValidations}};Bn.DEFER_DEFINITION_ERRORS_HANDLING=!1,zn=Bn,[class{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,`recoveryEnabled`)?e.recoveryEnabled:$.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=gn)}getTokenToInsert(e){let t=vt(e,``,-1,-1,-1,-1,-1,-1);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,r){let i=this.findReSyncTokenType(),a=this.exportLexerState(),o=[],s=!1,c=this.LA_FAST(1),l=this.LA_FAST(1),u=()=>{let e=this.LA(0),t=new un(this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:e,ruleName:this.getCurrRuleFullName()}),c,this.LA(0));t.resyncedTokens=o.slice(0,-1),this.SAVE_ERROR(t)};for(;!s;){if(this.tokenMatcher(l,r))return void u();if(n.call(this))return u(),void e.apply(this,t);this.tokenMatcher(l,i)?s=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o))}this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,n){return!1!==n&&!this.tokenMatcher(this.LA_FAST(1),e)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t))}getNextPossibleTokenTypes(e){let t=e.ruleStack[0],n=this.getGAstProductions()[t];return new wt(n,e).startWalking()}getFollowsForInRuleRecovery(e,t){let n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new hn(`sad sad panda`)}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||t.length===0)return!1;let n=this.LA_FAST(1);return t.find(e=>this.tokenMatcher(n,e))!==void 0}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(t).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA_FAST(1),n=2;for(;;){let r=e.find(e=>Xe(t,e));if(r!==void 0)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return mn;let e=this.currRuleShortName,t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK,n=this.RULE_STACK_IDX+1,r=Array(n);for(let i=0;i<n;i++)r[i]=i===0?mn:{ruleName:this.shortRuleNameToFullName(e[i]),idxInCallingRule:t[i],inRule:this.shortRuleNameToFullName(e[i-1])};return r}flattenFollowSet(){return this.buildFullFollowKeyStack().map(e=>this.getFollowSetFromFollowKey(e)).flat()}getFollowSetFromFollowKey(e){if(e===mn)return[X];let t=e.ruleName+e.idxInCallingRule+fe+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,X)||t.push(e),t}reSyncTo(e){let t=[],n=this.LA_FAST(1);for(;!1===this.tokenMatcher(n,e);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return t.slice(0,-1)}attemptInRepetitionRecovery(e,t,n,r,i,a,o){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,t=Array(e);for(let n=0;n<e;n++)t[n]=this.shortRuleNameToFullName(this.RULE_STACK[n]);return t}},class{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,`dynamicTokensEnabled`)?e.dynamicTokensEnabled:$.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,`maxLookahead`)?e.maxLookahead:$.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,`lookaheadStrategy`)?e.lookaheadStrategy:new bn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{let{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:o}=function(e){xn.reset(),e.accept(xn);let t=xn.dslMethods;return xn.reset(),t}(e);t.forEach(t=>{let n=t.idx===0?``:t.idx;this.TRACE_INIT(`${V(t)}${n}`,()=>{let n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[e.name],256|t.idx,n)})}),n.forEach(t=>{this.computeLookaheadFunc(e,t.idx,768,`Repetition`,t.maxLookahead,V(t))}),r.forEach(t=>{this.computeLookaheadFunc(e,t.idx,512,`Option`,t.maxLookahead,V(t))}),i.forEach(t=>{this.computeLookaheadFunc(e,t.idx,_n,`RepetitionMandatory`,t.maxLookahead,V(t))}),a.forEach(t=>{this.computeLookaheadFunc(e,t.idx,yn,`RepetitionMandatoryWithSeparator`,t.maxLookahead,V(t))}),o.forEach(t=>{this.computeLookaheadFunc(e,t.idx,vn,`RepetitionWithSeparator`,t.maxLookahead,V(t))})})})}computeLookaheadFunc(e,t,n,r,i,a){this.TRACE_INIT(`${a}${t===0?``:t}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r});this.setLaFuncCache(this.fullRuleNameToShort[e.name],n|t,a)})}setLaFuncCache(e,t,n){let r=this.lookAheadFuncsCache[e];r===void 0&&(r=[],this.lookAheadFuncsCache[e]=r),r[t]=n}},class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,`nodeLocationTracking`)?e.nodeLocationTracking:$.nodeLocationTracking,this.outputCst){if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Cn,this.setNodeLocationFromNode=Cn,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Sn,this.setNodeLocationFromNode=Sn,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{}}}else this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{}}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(e){let t=this.LA_FAST(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset==1?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=-1,n.startLine=-1,n.startColumn=-1)}cstPostRuleOnlyOffset(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset==1?n.endOffset=t.endOffset:n.startOffset=-1}cstPostTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];var r,i=t,a=e;(r=n).children[a]===void 0?r.children[a]=[i]:r.children[a].push(i),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];(function(e,t,n){e.children[t]===void 0?e.children[t]=[n]:e.children[t].push(n)})(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}get currCSTNode(){return this.CST_STACK[this.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let e=Dn(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let e=function(e,t,n){let r=function(){};Tn(r,e+`BaseSemanticsWithDefaults`);let i=Object.create(n.prototype);return t.forEach(e=>{i[e]=En}),(r.prototype=i).constructor=r,r}(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}},class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)throw Error(`Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.`);this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):Ln}LA_FAST(e){let t=this.currIdx+e;return this.tokVector[t]}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Ln:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}},class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=Ze,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(t,`serializedGrammar`))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
50
50
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
51
51
  For Further details.`);if(Array.isArray(e)){if(e.length===0)throw Error(`A Token Vocabulary cannot be empty.
52
52
  Note that the first argument for the parser constructor
53
53
  is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset==`number`)throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
54
54
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
55
- For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((e,t)=>(e[t.name]=t,e),{});else if(Object.hasOwn(e,`modes`)&&Object.values(e.modes).flat().every(it)){let t=Object.values(e.modes).flat(),n=[...new Set(t)];this.tokensMap=n.reduce((e,t)=>(e[t.name]=t,e),{})}else{if(typeof e!=`object`||!e)throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap=Object.assign({},e)}this.tokensMap.EOF=X;let n=(Object.hasOwn(e,`modes`)?Object.values(e.modes).flat():Object.values(e)).every(e=>e.categoryMatches?.length==0);this.tokenMatcher=n?Ze:Xe,et(Object.values(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let r=Object.hasOwn(n,`resyncEnabled`)?n.resyncEnabled:Rn.resyncEnabled,i=Object.hasOwn(n,`recoveryValueFunc`)?n.recoveryValueFunc:Rn.recoveryValueFunc,a=this.ruleShortNameIdx++,o;return this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a,o=!0===this.outputCst?function(...n){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);let r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...t){this.onBeforeParse(e);try{return o.apply(this,t)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:o})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK_IDX===0,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(cn(e)){let t=e;if(i){let r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){let n=512|t;return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof e!=`function`){r=e.DEF;let t=e.GATE;if(t!==void 0){let e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){let n=_n|e;return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(r);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,_n,e,Ot)}atLeastOneSepFirstInternal(e,t){let n=yn|e;this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0!==this.currRuleLookaheadFuncs[n].call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,kt],t,yn,e,kt)}}manyInternal(e,t){let n=768|e;return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let a=!0;for(;!0===i.call(this)&&!0===a;)a=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Et,a)}manySepFirstInternal(e,t){let n=vn|e;this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0===this.currRuleLookaheadFuncs[n].call(this)){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,Dt],t,vn,e,Dt)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,yn,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=256|t,r=Array.isArray(e)?e:e.DEF,i=this.currRuleLookaheadFuncs[n].call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,n){let r;try{let i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.coreRule.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw cn(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{let t=this.LA_FAST(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r,i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new un(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||n.name!==`MismatchedTokenException`||this.isBackTracking())throw n;{let r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===`InRuleRecoveryException`?n:e}}}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let e=0;e<t.length;e++)this.RULE_STACK[e]=t[e];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=n,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),X)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let e=0;e<this.maxLookahead+1;e++)this.tokVector.push(Ln)}onAfterParse(e){if(!1===this.isAtEndOfInput()){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new fn(t,e))}for(;this.tokVector.at(-1)===Ln;)this.tokVector.pop()}},class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,n=Rn){if(this.definedRulesNames.includes(e)){let t={message:xt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Q.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=Rn){let r=function(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:Q.INVALID_RULE_OVERRIDE,ruleName:e})),r}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);let i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){let n=e.coreRule??e;return function(){this.isBackTrackingStack.push(1);let e=this.saveRecogState();try{return n.apply(this,t),!0}catch(e){if(cn(e))return!1;throw e}finally{this.reloadRecogState(e),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Object.values(this.gastProductionsCache).map(ae)}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,`errorMessageProvider`)?e.errorMessageProvider:$.errorMessageProvider}SAVE_ERROR(e){if(cn(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let r=this.getCurrRuleFullName(),i=Ht(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let o=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:a,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new pn(o,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),r=Vt(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let e=1;e<=this.maxLookahead;e++)i.push(this.LA(e));let a=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:a,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new dn(o,this.LA(1),a))}},class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT(`Enable Recording`,()=>{for(let e=0;e<10;e++){let t=e>0?e:``;this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT(`Deleting Recording methods`,()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:``;delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return Ln}topLevelRuleRecord(e,t){try{let n=new M({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message+=`
55
+ For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((e,t)=>(e[t.name]=t,e),{});else if(Object.hasOwn(e,`modes`)&&Object.values(e.modes).flat().every(it)){let t=Object.values(e.modes).flat(),n=[...new Set(t)];this.tokensMap=n.reduce((e,t)=>(e[t.name]=t,e),{})}else{if(typeof e!=`object`||!e)throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap=Object.assign({},e)}this.tokensMap.EOF=X;let n=(Object.hasOwn(e,`modes`)?Object.values(e.modes).flat():Object.values(e)).every(e=>e.categoryMatches?.length==0);this.tokenMatcher=n?Ze:Xe,et(Object.values(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let r=Object.hasOwn(n,`resyncEnabled`)?n.resyncEnabled:Rn.resyncEnabled,i=Object.hasOwn(n,`recoveryValueFunc`)?n.recoveryValueFunc:Rn.recoveryValueFunc,a=this.ruleShortNameIdx++,o;return this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a,o=!0===this.outputCst?function(...n){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);let r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...t){this.onBeforeParse(e);try{return o.apply(this,t)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:o})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK_IDX===0,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(cn(e)){let t=e;if(i){let r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){let n=512|t;return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof e!=`function`){r=e.DEF;let t=e.GATE;if(t!==void 0){let e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){let n=_n|e;return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(r);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,_n,e,Ot)}atLeastOneSepFirstInternal(e,t){let n=yn|e;this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0!==this.currRuleLookaheadFuncs[n].call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,kt],t,yn,e,kt)}}manyInternal(e,t){let n=768|e;return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let a=!0;for(;!0===i.call(this)&&!0===a;)a=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Et,a)}manySepFirstInternal(e,t){let n=vn|e;this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0===this.currRuleLookaheadFuncs[n].call(this)){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,Dt],t,vn,e,Dt)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,yn,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=256|t,r=Array.isArray(e)?e:e.DEF,i=this.currRuleLookaheadFuncs[n].call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,n){let r;try{let i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.coreRule.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw cn(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{let t=this.LA_FAST(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r,i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new un(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||n.name!==`MismatchedTokenException`||this.isBackTracking())throw n;{let r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===`InRuleRecoveryException`?n:e}}}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let e=0;e<t.length;e++)this.RULE_STACK[e]=t[e];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=n,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),X)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let e=0;e<this.maxLookahead+1;e++)this.tokVector.push(Ln)}onAfterParse(e){if(!1===this.isAtEndOfInput()){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new fn(t,e))}for(;this.tokVector.at(-1)===Ln;)this.tokVector.pop()}},class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,n=Rn){if(this.definedRulesNames.includes(e)){let t={message:xt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Q.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=Rn){let r=function(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:Q.INVALID_RULE_OVERRIDE,ruleName:e})),r}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);let i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){let n=e.coreRule??e;return function(){this.isBackTrackingStack.push(1);let e=this.saveRecogState();try{return n.apply(this,t),!0}catch(e){if(cn(e))return!1;throw e}finally{this.reloadRecogState(e),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Object.values(this.gastProductionsCache).map(oe)}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,`errorMessageProvider`)?e.errorMessageProvider:$.errorMessageProvider}SAVE_ERROR(e){if(cn(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let r=this.getCurrRuleFullName(),i=Ht(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let o=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:a,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new pn(o,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),r=Vt(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let e=1;e<=this.maxLookahead;e++)i.push(this.LA(e));let a=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:a,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new dn(o,this.LA(1),a))}},class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT(`Enable Recording`,()=>{for(let e=0;e<10;e++){let t=e>0?e:``;this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT(`Deleting Recording methods`,()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:``;delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return Ln}topLevelRuleRecord(e,t){try{let n=new j({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message+=`
56
56
  This error was thrown during the "grammar recording phase" For more info see:
57
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return Nn.call(this,P,e,t)}atLeastOneInternalRecord(e,t){Nn.call(this,F,t,e)}atLeastOneSepFirstInternalRecord(e,t){Nn.call(this,I,t,e,kn)}manyInternalRecord(e,t){Nn.call(this,L,t,e)}manySepFirstInternalRecord(e,t){Nn.call(this,R,t,e,kn)}orInternalRecord(e,t){return Pn.call(this,e,t)}subruleInternalRecord(e,t,n){if(In(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${Fn(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=e.ruleName,a=new j({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Mn:On}consumeInternalRecord(e,t,n){if(In(t),!nt(e)){let n=Error(`<CONSUME${Fn(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=new B({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),jn}},class{initPerformanceTracer(e){if(Object.hasOwn(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=$.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=re(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if(n===`constructor`)return;let r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(zn.prototype,n,r):zn.prototype[n]=e.prototype[n]})});var Vn=class extends Bn{constructor(e,t=$){let n=Object.assign({},t);n.outputCst=!1,super(e,n)}},Hn=class t{static shared(e){let n=e?.locale??y,r=e?.maxColumn??Kn,i=e?.maxRow??qn,a=Gn.get(n);a||(a=new Map,Gn.set(n,a));let o=`${r}:${i}`,s=a.get(o);return s||(s=new t({locale:n,maxColumn:r,maxRow:i}),a.set(o,s)),s}constructor(e){let t=e?.maxColumn??Kn,n=e?.maxRow??qn,r=e?.locale??y;this._locale=r,this._maxColumn=t,this._maxRow=n;let{separatorFunction:i,separatorColumn:a,separatorRow:o,separatorDecimal:s}=r.separators;if(a===o)throw Error(`FormulaLexer: separatorColumn and separatorRow must differ (both '${a}')`);let c=Y({name:`WhiteSpace`,pattern:/[ \n\v\f\r\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,group:J.SKIPPED}),l=Y({name:`StringToken`,pattern:/"(""|[^"])*"/}),u=Y({name:`FunctionToken`,pattern:/[a-zA-Z_\u007F-\uFFFF]+[a-zA-Z0-9_.\u007F-\uFFFF]*(?=\()/}),f=Y({name:`TableReference`,pattern:{exec:C},line_breaks:!1,start_chars_hint:Wn}),p=Y({name:`BracketedString`,pattern:{exec:d},line_breaks:!1,start_chars_hint:[91],longer_alt:[f,l]}),m=e=>(e??[]).map(e=>e?.trim()).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).map(e=>e+`|`).join(``),h=e=>e.replace(/[A-Za-z]/g,e=>`[${e.toUpperCase()}${e.toLowerCase()}]`),g=Y({name:`LiteralError`,pattern:new RegExp(m(r.errorLiterals)+[`#PARSE!`,`#NULL!`,`#DIV\\/0!`,`#VALUE!`,`#NUM!`,`#FIELD!`,`#N\\/A`,`#GETTING_DATA`,`#SPILL!`,`#CONNECT!`,`#BLOCKED!`,`#UNKNOWN!`,`#CALC!`,`#BUSY!`,`#PYTHON!`,`#TIMEOUT!`].map(h).join(`|`))}),_=Y({name:`RefError`,pattern:new RegExp(m(r.errorRefs)+[`#REF!`,`#NAME\\?`].map(h).join(`|`))}),v=Y({name:`SingleQuotedString`,pattern:/'(''|[^'])*'/}),b=Y({name:`SheetQuoted`,pattern:/'(?:''|[^'])*?'!/}),ee=Y({name:`Sheet`,pattern:/[A-Za-z_.\d\u007F-\uFFFF]*!/}),x=/[a-zA-Z_\\\u007F-\uFFFF][a-zA-Z0-9_.?\\\u007F-\uFFFF]*:?/y,S=Y({name:`NamedToken`,pattern:{exec:(e,t)=>{x.lastIndex=t;let n=x.exec(e);if(!n)return null;let r=n[0],i=r.indexOf(`.:`);return i===-1?r.endsWith(`:`)&&(r=r.slice(0,-1)):r=r.substring(0,i),[r]}},line_breaks:!1,start_chars_hint:Wn}),te=Y({name:`Cell`,pattern:{exec:Xn(t,n)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:S}),w=Y({name:`Column`,pattern:{exec:Yn(t)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:S}),T=Y({name:`AbsRow`,pattern:/[$][0-9]+/}),E=s===`.`?`\\.`:s,ne=Y({name:`NumberToken`,pattern:RegExp(`[0-9]+${E}(?!:)[0-9]*([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|${E}[0-9]+([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+`)}),D=Y({name:`ScientificDigit`,pattern:/[0-9]+\*\*[+-]?[0-9]+/}),O=Y({name:`DigitToken`,pattern:/[0-9]+/}),k=[`TRUE`,`FALSE`];for(let e of[r.booleanTrue,r.booleanFalse]){let t=e?.trim();t&&!k.some(e=>e.toLowerCase()===t.toLowerCase())&&k.push(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}let re=Y({name:`BooleanToken`,pattern:new RegExp(k.join(`|`),`i`)}),ie=Y({name:`ArgSeparator`,pattern:Zn(i)}),A=Y({name:`ColSeparator`,pattern:Zn(a)}),j=Y({name:`RowSeparator`,pattern:Zn(o)}),M=Y({name:`RangeOp`,pattern:/:/}),N=Y({name:`RangeTrimFullOp`,pattern:/\.:\./}),P=Y({name:`RangeTrimLeadingOp`,pattern:/\.:/}),F=Y({name:`RangeTrimTrailingOp`,pattern:/:\./}),I=Y({name:`OpenParen`,pattern:/\(/}),L=Y({name:`CloseParen`,pattern:/\)/}),R=Y({name:`OpenCurlyParen`,pattern:/{/}),z=Y({name:`CloseCurlyParen`,pattern:/}/}),B=Y({name:`QuoteS`,pattern:/'/}),ae=Y({name:`MulOp`,pattern:/\*(?!\*)/}),V=Y({name:`PlusOp`,pattern:/\+/}),oe=Y({name:`DivOp`,pattern:/\//}),se=Y({name:`MinOp`,pattern:/-/}),H=Y({name:`ImplicitIntersectOp`,pattern:/@/}),ce=Y({name:`ConcatOp`,pattern:/&/}),le=Y({name:`ExOp`,pattern:/\^/}),ue=Y({name:`PercentOp`,pattern:/%/}),de=Y({name:`ArrayAnchorOp`,pattern:/#/,longer_alt:[g,_]}),fe=Y({name:`GtOp`,pattern:/>/}),U=Y({name:`EqOp`,pattern:/=/}),pe=Y({name:`LtOp`,pattern:/</}),W=[c,l,b,v,ee,u,f,p,g,_,ie,...a===i?[]:[A],j,N,P,F,M,te,re,w,T,ne,D,O,de,H,S,I,L,R,z,B,ae,V,oe,se,ce,le,ue,Y({name:`NeqOp`,pattern:/<>/}),Y({name:`GteOp`,pattern:/>=/}),Y({name:`LteOp`,pattern:/<=/}),fe,U,pe];this._lexer=new J(W,{ensureOptimizations:!0});let G={};W.forEach(e=>{G[e.name]=e}),a===i&&(G.ColSeparator=ie),this._vocabulary=G}tokenize(t,n=!0){let r=this._lexer.tokenize(t);if(n&&r.errors.length>0){let n=r.errors[0],i=n.line,a=n.column,o=t.substr(n.offset,n.length||1),s=o?`Unexpected character '${o}'`:n.message;throw new e.Parse(s,{line:i,column:a,offset:n.offset,length:n.length})}return r}getVocabulary(){return this._vocabulary}getLocale(){return this._locale}getMaxColumn(){return this._maxColumn}getMaxRow(){return this._maxRow}getSeparators(){return this._locale.separators}},Un=(()=>{let e=[];for(let t=65;t<=90;t++)e.push(t);for(let t=97;t<=122;t++)e.push(t);for(let t=48;t<=57;t++)e.push(t);return e})().filter(e=>e<48||e>57),Wn=(()=>{let e=[...Un,95,92];for(let t=127;t<=65535;t++)e.push(t);return e})(),Gn=new WeakMap,Kn=16384,qn=1048576;function Jn(e,t,n){let r=0;for(let i=t;i<n;i++){let t=e.charCodeAt(i);r=26*r+(t>=97?t-96:t-64)}return r}function Yn(e){return(t,n)=>{let r=n;t.charCodeAt(r)===36&&r++;let i=r;for(;r<t.length&&r-i<3;){let e=t.charCodeAt(r);if(!(e>=65&&e<=90||e>=97&&e<=122))break;r++}if(r-i===0||Jn(t,i,r)>e)return null;if(r<t.length){let e=t.charCodeAt(r);if(e>=48&&e<=57)return null}return[t.substring(n,r)]}}function Xn(e,t){return(n,r)=>{let i=r;n.charCodeAt(i)===36&&i++;let a=i;for(;i<n.length&&i-a<3;){let e=n.charCodeAt(i);if(!(e>=65&&e<=90||e>=97&&e<=122))break;i++}if(i-a===0||Jn(n,a,i)>e)return null;i<n.length&&n.charCodeAt(i)===36&&i++;let o=i;for(;i<n.length;){let e=n.charCodeAt(i);if(!(e>=48&&e<=57))break;i++}if(i===o)return null;let s=parseInt(n.substring(o,i),10);return s<1||s>t?null:[n.substring(r,i)]}}function Zn(e){return new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}var Qn=class{constructor(e=y){let t=function(e){let t=[...ee];if(e)for(let n of Object.values(e)){let e=n?.trim();e&&!t.some(t=>t.toLowerCase()===e.toLowerCase())&&t.push(e)}return t.sort((e,t)=>t.length-e.length),t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)}(e.specifiers),n=Y({name:`WhiteSpace`,pattern:/\s+/,group:J.SKIPPED}),r=Y({name:`TableSpecifier`,pattern:RegExp(`\\[#(?:${t})\\]`,`i`)}),i=[n,r,Y({name:`BracketedColumn`,pattern:/\[(?:'['#[\]]|'(?!['#[\]])|[^'[\]])*\]/,longer_alt:[r]}),Y({name:`BareSpecifier`,pattern:RegExp(`#(?:${t})`,`i`)}),Y({name:`ColumnSep`,pattern:/:/}),Y({name:`ListSep`,pattern:new RegExp(e.separators.separatorFunction.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))})];this._lexer=new J(i,{ensureOptimizations:!0});let a={};i.forEach(e=>{a[e.name]=e}),this._vocabulary=a}getVocabulary(){return this._vocabulary}tokenize(e){return this._lexer.tokenize(e)}},$n=class extends Vn{constructor(e=y){let t=new Qn(e),n=t.getVocabulary();super(n,{nodeLocationTracking:`none`,maxLookahead:2,skipValidations:!0,recoveryEnabled:!1}),this._lexer=t;let{TableSpecifier:i,BracketedColumn:a,BareSpecifier:o,ColumnSep:s,ListSep:c}=n,u=this;u.RULE(`ruleContent`,()=>{let e=[],t=u.SUBRULE(u.ruleItem);return u.ACTION(()=>{t&&e.push(t)}),u.MANY(()=>{u.CONSUME(c),u.OPTION(()=>{let t=u.SUBRULE2(u.ruleItem);u.ACTION(()=>{t&&e.push(t)})})}),e}),u.RULE(`ruleItem`,()=>u.OR([{ALT:()=>u.SUBRULE(u.ruleSpecifier)},{ALT:()=>u.SUBRULE(u.ruleColumnOrRange)}])),u.RULE(`ruleSpecifier`,()=>u.OR([{ALT:()=>{let t=u.CONSUME(i);return u.ACTION(()=>{let n=l(t.image,e);return n.image=t.image,n})}},{ALT:()=>{let t=u.CONSUME(o);return u.ACTION(()=>{let n=l(t.image,e);return n.image=t.image,n})}}])),u.RULE(`ruleColumnOrRange`,()=>{let e=u.CONSUME(a),t,n;return u.OPTION(()=>{t=u.CONSUME(s),n=u.CONSUME2(a)}),u.ACTION(()=>{let i=v(e.image);if(i.image=e.image,!n)return i;let a=v(n.image);a.image=n.image;let o=r(`:`,i,a,!0);return o.image=t?.image??`:`,o})}),u.performSelfAnalysis()}_parseInner(e){let t=this._lexer.tokenize(e);return t.errors.length>0||t.tokens.length===0?[]:(this.input=t.tokens,this.reset(),this.ruleContent()??[])}_parseContent(e){if(!e)return[];let t=e.trim();if(!t)return[];let n=t[0];if(n===`@`){let e=t.slice(1).trim();if(!e){let e=s(`@`,null,!0);return e.image=`@`,[e]}if(e.charAt(0)===`[`){let t=this._parseInner(e);if(t.length===1&&t[0].type===`infix`){let e=s(`@`,t[0],!0);return e.image=`@`,[e]}}let n=v(e);n.image=e;let r=s(`@`,n,!0);return r.image=`@`,[r]}if(n!==`[`&&n!==`#`){let t=v(e);return t.image=e,[t]}return this._parseInner(t)}parse(e,t,n){this.reset();let r=()=>({root:a(``,[]),errors:[]});if(!n)return r();let i=0;if(n.charAt(0)===`[`){let e=n.indexOf(`]`);e!==-1&&n.charAt(e+1)===`!`&&(i=e+2)}let o=n.indexOf(`[`,i);if(o===-1)return r();let s=n.slice(0,o),c=n.slice(o+1,-1),l=this._parseContent(c);return{root:a(s,l),errors:this.errors.length>0?[...this.errors]:[]}}},er=new Set([`:`,`.:.`,`.:`,`:.`]),tr=new Set([`.:.`,`.:`,`:.`]),nr=e=>{if(!e)return null;if(e.type===T.Cell){let t=e.value;return t.rowIndex===-(2**53-1)?`col`:t.colIndex===-(2**53-1)?`row`:null}return Number.isInteger(e.value)?`row`:null},rr=(e,t)=>{let n=parseInt(e.charCodeAt(0)===36?e.substring(1):e,10);return n>=1&&n<=t},ir=`A formula must not be empty`,ar=(e,t)=>`A formula must not be longer than ${t} characters (this one is ${e})`;function or(e,t){let n=e?.[0]?.image;if(!n){let e=t?.image;return e?`Expected a value after '${e}'`:`Expected a value`}return`Unexpected '${n}'`}var sr={...yt,buildNoViableAltMessage:e=>or(e.actual,e.previous),buildEarlyExitMessage:e=>or(e.actual,e.previous),buildNotAllInputParsedMessage:e=>{let t=e.firstRedundant?.image;return t?`Unexpected '${t}'`:yt.buildNotAllInputParsedMessage(e)},buildMismatchTokenMessage:e=>{let t=e.actual?.image;return e.expected===X&&t?`Unexpected '${t}'`:yt.buildMismatchTokenMessage(e)}},cr=class extends Vn{constructor(e){let a=e?.lexer??Hn.shared(e?.lexerOptions),l=a.getVocabulary();super(l,{skipValidations:!0,recoveryEnabled:!0,...e,nodeLocationTracking:`full`,errorMessageProvider:sr,maxLookahead:1}),this._ruleInfixOp=this.RULE(`ruleInfixOp`,()=>{let{PlusOp:e,MinOp:t,MulOp:n,DivOp:i,ExOp:a,ConcatOp:o,GtOp:s,EqOp:c,LtOp:l,NeqOp:u,GteOp:d,LteOp:f}=this._vocab,p=[];return p.push({node:this.SUBRULE(this._rulePostfixOp)}),this.MANY(()=>{let r=this.OR(this._c1||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(i).image},{ALT:()=>this.CONSUME(a).image},{ALT:()=>this.CONSUME(o).image},{ALT:()=>this.CONSUME(s).image},{ALT:()=>this.CONSUME(c).image},{ALT:()=>this.CONSUME(l).image},{ALT:()=>this.CONSUME(u).image},{ALT:()=>this.CONSUME(d).image},{ALT:()=>this.CONSUME(f).image}]),m={value:r,index:this.getLexerPosition(),isRange:h.includes(r)},g=this.SUBRULE2(this._rulePostfixOp);p.push({op:m,node:g})}),this.ACTION(()=>{let e=p.length-1,t=g.length;for(let n=0;e>0&&n<t;n++){let t=g[n],i=1;for(;i<p.length;){let n=p[i].op;if(t.includes(n.value)){let t=p[i-1].node,a=p[i].node,o=r(n.value,t,a,n.isRange);o=this._tag(o,n.index),p[i-1].node=o,p.splice(i,1),e--}else i++}}}),p[0].node}),this._rulePlusMinusOp=this.RULE(`rulePlusMinusOp`,()=>{let{PlusOp:e,MinOp:t}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)}])}),this._rulePostfixOp=this.RULE(`rulePostfixOp`,()=>{let{PercentOp:e}=this._vocab,t=this.SUBRULE(this._rulePrefixOp),n=[];return this.MANY(()=>{let t=this.CONSUME(e).image;this.ACTION(()=>{n.push([t,this.getLexerPosition()])})}),this.ACTION(()=>{let e=n.length;if(e!==0)for(let r=0;r<e;r++){let e=n[r],i=e[0],a=e[1],o=h.includes(i);t=S(i,t,o),t=this._tag(t,a)}}),t}),this._rulePrefixOp=this.RULE(`rulePrefixOp`,()=>{let{PlusOp:e,MinOp:t,ImplicitIntersectOp:n}=this._vocab,r=[];this.MANY(()=>{let i=this.OR([{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image}]);this.ACTION(()=>{r.push([i,this.getLexerPosition()])})});let i=this.SUBRULE(this._ruleRangeOp);return this.ACTION(()=>{let e=r.length;if(e!==0)for(let t=e-1;t>=0;t--){let e=r[t],n=e[0],a=e[1],o=h.includes(n);i=s(n,i,o),i=this._tag(i,a)}}),i}),this._ruleRangeOp=this.RULE(`ruleRangeOp`,()=>{let{RangeOp:e,RangeTrimFullOp:t,RangeTrimLeadingOp:n,RangeTrimTrailingOp:i,ArrayAnchorOp:a}=this._vocab,o=[];return o.push({node:this.SUBRULE(this._ruleCallOp)}),this.MANY2(()=>{this.CONSUME(a),o.push({anchor:this.getLexerPosition()})}),this.MANY(()=>{let r={value:this.OR(this._c2||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(i).image}]),index:this.getLexerPosition()},s=this.SUBRULE2(this._ruleCallOp);o.push({op:r,node:s}),this.MANY3(()=>{this.CONSUME2(a),o.push({anchor:this.getLexerPosition()})})}),this.ACTION(()=>{for(let e=1;e+1<o.length;e++){let t=o[e],n=o[e+1];if(t.op?.value!==`:`||n.op?.value!==`:`)continue;let i=nr(t.node);i&&nr(n.node)===i&&nr(o[e-1].node)!==i&&(t.node=this._tag(r(`:`,t.node,n.node,!0),n.op.index),o.splice(e+1,1))}for(let e=1;e<o.length;e++){let t=o[e];if(t.anchor!==void 0){o[0].node=this._tag(S(`#`,o[0].node,!0),t.anchor);continue}let n=t.op,i=r(n.value,o[0].node,t.node,!0);i=this._tag(i,n.index),o[0].node=i}}),o[0].node}),this._ruleCallOp=this.RULE(`ruleCallOp`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab,n=this.SUBRULE(this._ruleFormula);return this.MANY({GATE:()=>{let t=this.LA(0),n=this.LA(1);return!(!t||!n||n.tokenType!==e)&&n.startOffset===t.endOffset+1},DEF:()=>{this.CONSUME(e);let r=this.getLexerPosition(),i=this.SUBRULE(this._ruleFunctionArguments),a=n,o=this.ACTION(()=>this._tag(_(a,i),r)),s=this.OPTION(()=>this.CONSUME(t));this.ACTION(()=>{s||this._reportError(o,`Missing closing parenthesis ')'`,r),this._tagClose(o,this.getLexerPosition()),n=o})}}),n}),this._ruleIntersectOp=this.RULE(`ruleIntersectOp`,()=>{let e=[this.SUBRULE(this._ruleInfixOp)];return this.MANY(()=>{this.OPTION({GATE:()=>{let e=this.LA(0);return this.LA(1).startOffset>e.endOffset+1},DEF:()=>{e.push(this.SUBRULE3(this._ruleInfixOp))}})}),this.ACTION(()=>{for(;e.length>1;){let t=e.length-1;for(let n=0;n<t;n++){let i=e[n],a=e[n+1],o=r(` `,i,a,!0),s=this._tokenMap.get(i);s&&delete s.tokenIndexClose;let c=this._tokenMap.get(a),l=c?.tokenIndex;if(l!==void 0){let e=this.input[l],t=this.input[l-1]?.endOffset??-1,n=this._inputText.slice(t+1,e.startOffset).slice(0,-1);n.length>0&&(o.wsBefore=n)}c&&delete c.tokenIndex,n+1<t&&c&&delete c.tokenIndexClose,e.splice(n,2,o),n--,t--}}}),e[0]}),this._ruleFormula=this.RULE(`ruleFormula`,()=>this.OR9([{ALT:()=>this.SUBRULE(this._ruleLiteral)},{ALT:()=>this.SUBRULE(this._ruleReference)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>this.SUBRULE(this._ruleParen)},{ALT:()=>this.SUBRULE(this._ruleTableReference)},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleLiteralArray)}])),this._ruleGroup=this.RULE(`ruleGroup`,()=>{let{ArgSeparator:e}=this._vocab,t=[];return this.MANY(()=>{this.CONSUME(e);let n=this.SUBRULE2(this._ruleIntersectOp);this.ACTION(()=>{t.push(n)})}),t}),this._ruleParen=this.RULE(`ruleParen`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab;return this._processParen(T.Paren,e,t)}),this._ruleLiteralArray=this.RULE(`ruleLiteralArray`,()=>{let{OpenCurlyParen:e,CloseCurlyParen:t,ColSeparator:n,RowSeparator:r}=this._vocab,i=ne();this.CONSUME(e);let a=this.getLexerPosition(),o=this.ACTION(()=>this._tag(w(i),a)),s=this.SUBRULE(this._ruleLiteralForArray);this.ACTION(()=>{i.value.push(s)}),this.MANY(()=>{let e=!1;this.OR([{ALT:()=>{this.CONSUME(n),e=!0}},{ALT:()=>this.CONSUME(r)}]);let t=this.SUBRULE2(this._ruleLiteralForArray);this.ACTION(()=>{e||(i=ne(),o.value.push(i)),i.value.push(t)})});let c=this.OPTION(()=>this.CONSUME(t));return o=this.ACTION(()=>(c||this._reportError(o,`Missing closing parenthesis '}'`,a),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleLiteralForArray=this.RULE(`ruleLiteralForArray`,()=>{let{StringToken:e,BooleanToken:t,LiteralError:n,RefError:r}=this._vocab;return this.OR([{ALT:()=>{let e=this.OPTION(()=>this.SUBRULE(this._rulePlusMinusOp)),t=this.SUBRULE(this._ruleNumber),n=this.ACTION(()=>this._tag(f(t.image,this._locale),this.getLexerPosition()));return this.ACTION(()=>e?i(e.image,n):n)}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(D(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(t);return this.ACTION(()=>this._tag(te(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(c(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(o(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleLiteral=this.RULE(`ruleLiteral`,()=>{let{StringToken:e,BooleanToken:t,LiteralError:n,RefError:r}=this._vocab;return this.OR([{ALT:()=>{let e=this.SUBRULE(this._ruleNumber);return this.ACTION(()=>this._tag(f(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(D(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(t);return this.ACTION(()=>this._tag(te(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(c(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(o(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleFunction=this.RULE(`ruleFunction`,()=>{let{FunctionToken:e,OpenParen:t,CloseParen:n}=this._vocab,r=this.CONSUME(e).image,i=this.getLexerPosition();this.CONSUME(t);let a=this.SUBRULE(this._ruleFunctionArguments),o=this.ACTION(()=>this._tag(p(r,a),i)),s=this.OPTION(()=>this.CONSUME(n));return o=this.ACTION(()=>(s||this._reportError(o,`Missing closing parenthesis ')'`,i),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleFunctionArguments=this.RULE(`ruleFunctionArguments`,()=>{let{ArgSeparator:e,CloseParen:t}=this._vocab,n=[];return this.OPTION({GATE:()=>this.LA(1).tokenType!==t,DEF:()=>{let t;this.OPTION2(()=>{t=this.SUBRULE(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(x(),this.getLexerPosition())),n.push(t),this.MANY(()=>{let t;this.CONSUME(e),this.OPTION3(()=>{t=this.SUBRULE2(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(x(),this.getLexerPosition())),n.push(t)})}}),n}),this._ruleBracketedString=this.RULE(`ruleBracketedString`,()=>{let{BracketedString:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleTableReference=this.RULE(`ruleTableReference`,()=>{let{TableReference:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleReference=this.RULE(`ruleReference`,()=>{let{Sheet:e,SheetQuoted:r,DivOp:i,MulOp:a,PlusOp:s,MinOp:c,ArgSeparator:l,Cell:u,NamedToken:d,SingleQuotedString:f,Column:p,AbsRow:h,DigitToken:g,RefError:_}=this._vocab,v,y;this.OPTION2({GATE:()=>{for(let t=1;t<6;t++){let n=this.LA(t);if(n.tokenType===e||n.tokenType===r)return!0;if(n.image===``||n.image===`)`||n.tokenType===i||n.tokenType===a||n.tokenType===s||n.tokenType===c||n.tokenType===l)break}return!1},DEF:()=>{y=this.getLexerPosition()+1,v=this.SUBRULE(this._rulePrefixSheetName)}});let b=this.OR([{ALT:()=>{let e=this.CONSUME(u),t=this.getLexerPosition();return this.ACTION(()=>this._tag(n(e.image,this.rowIndex,this.colIndex),t))}},{ALT:()=>{let e=this.OR2([{ALT:()=>this.CONSUME(d)},{ALT:()=>this.CONSUME(f)}]);return this.ACTION(()=>this._tag(t(e.image),this.getLexerPosition()))}},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>{let e=this.CONSUME(p);return this.ACTION(()=>this._tag(m(e.image,this.colIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(h);return this.ACTION(()=>this._tag(E(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(g);return this.ACTION(()=>this._tag(E(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(_);return this.ACTION(()=>this._tag(o(e.image,this._locale),this.getLexerPosition()))}}]);return this.ACTION(()=>{if(v&&b){if(v.name===``)return void this._reportError(b,`'${v.image}' is not a valid sheet reference — a '!' needs a sheet name before it`);let e=b;if(b.type===T.Postfix&&b.inputs?.[0]&&(e=b.inputs[0]),e.type===T.Cell||e.type===T.Named||e.type===T.Row||e.type===T.TableColumn||e.type===T.Error){e.value.scope=v.name,e.value.scopeImage=v.image;let t=this._tokenMap.get(e);t&&y!==void 0&&(t.tokenIndex=y)}}}),b}),this._rulePrefixSheetName=this.RULE(`rulePrefixSheetName`,()=>{let{SheetQuoted:e,BracketedString:t,NamedToken:n,Column:r,RangeOp:i,Sheet:a}=this._vocab;return this.OR([{ALT:()=>{let t=this.CONSUME(e).image;return{name:t.slice(1,-2).replace(/''/g,`'`),image:t}}},{ALT:()=>{let e=``;this.OPTION(()=>{e+=this.CONSUME(t).image}),this.OPTION2({GATE:()=>this.LA(2).tokenType===i,DEF:()=>{e+=this.OR2([{ALT:()=>this.CONSUME(n).image},{GATE:()=>this.LA(1).image.charCodeAt(0)!==36,ALT:()=>this.CONSUME(r).image}]),this.CONSUME(i),e+=`:`}});let o=this.CONSUME(a).image;return{name:e+o.slice(0,-1),image:e+o}}}])}),this._ruleNumber=this.RULE(`ruleNumber`,()=>{let{NumberToken:e,ScientificDigit:t,DigitToken:n}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)},{ALT:()=>this.CONSUME(n)}])}),this._ruleRoot=this.RULE(`ruleRoot`,()=>{let{ArgSeparator:e}=this._vocab,t=this.SUBRULE(this._ruleIntersectOp),n=[];return this.MANY(()=>{this.CONSUME(e),n.push(this.SUBRULE2(this._ruleIntersectOp))}),this.ACTION(()=>n.length===0?t:{type:T.List,value:`,`,inputs:[t,...n],isReference:!0})}),this._lexer=a,this._locale=a.getLocale(),this._vocab=l,this._srParser=e?.srParser??new $n(this._locale),this.performSelfAnalysis()}getLexer(){return this._lexer}parse(n,r,i){let a=this._lexer.tokenize(i),o;if(!a)return{root:{type:T.Unparsed,value:i},errors:[]};let s=a.tokens;if(s.length===0)throw new e.Parse(ir);return this.input=s,this._inputText=i,this._inputTextLength=i.length,this.rowIndex=n,this.colIndex=r,this._astErrors=[],this._tokenMap=new Map,this.reset(),o=this._ruleRoot(),o&&this._bindAllWhitespace(o),o=u(o,(e,r)=>{let i=e.type,a=r?.isReference?r.value:void 0,o=typeof a==`string`&&er.has(a),s=typeof a==`string`&&tr.has(a),c=o?r.inputs:void 0,l=c?c[0]===e?c[1]:c[0]:void 0,u=this._lexer.getMaxRow();if(o&&i!==T.Cell&&Number.isInteger(e.value)){let t=E(e.image,n);return b(t,e),nr(l)===`row`?rr(e.image,u)||this._reportError(t,`'${e.image}' is not a valid row — rows run from 1 to ${u}`):this._reportError(t,`'${e.image}' is not a valid reference — a whole row can only pair with another row (as in ${e.image}:${e.image})`),t}if(s&&i===T.Named)return this._reportError(e,`'${e.image??e.value?.nameId}' is a name — '${a}' needs a cell or range on both sides`),e;if(i===T.Cell){let n=e.value,r=n.colIndex===-(2**53-1),i=n.rowIndex===-(2**53-1);if((r||i)&&nr(l)===(r?`row`:`col`))return r&&!rr(e.image,u)&&this._reportError(e,`'${e.image}' is not a valid row — rows run from 1 to ${u}`),e;if(r||i||n.colIndex>=16384){let o=t(e.image);b(o,e);let c=n.scope;return c&&(o.value.scope=c,o.value.scopeImage=n.scopeImage),r?this._reportError(o,`'${e.image}' is not a valid reference — a row needs a column (use ${e.image}:${e.image} for the whole row)`):i&&e.image.includes(`$`)?this._reportError(o,`'${e.image}' is not a valid reference — a whole column can only pair with another column (as in ${e.image}:${e.image})`):s&&this._reportError(o,`'${e.image}' is a name — '${a}' needs a cell or range on both sides`),o}}return e}),{root:o,errors:[...this.errors,...this._astErrors]}}_processParen(e,t,n){let r;this.CONSUME(t);let i=this.getLexerPosition();r=this.ACTION(()=>(r={type:e,value:null,inputs:null},this._tag(r,i)));let a=[],o=this.SUBRULE(this._ruleIntersectOp);o&&a.push(o);let s=this.SUBRULE(this._ruleGroup),c=this.OPTION(()=>this.CONSUME(n));return r=this.ACTION(()=>{if(s)for(let e=0;e<s.length;e++)a.push(s[e]);return r&&(c||this._reportError(r,`Missing closing parenthesis`,i),r.inputs=a),this._tagClose(r,this.getLexerPosition())}),r}_reportError(e,t,n=void 0,r=`SyntaxError`){n===void 0&&(n=this.getLexerPosition()),e.error=!0,this._astErrors.push({name:r,message:t,previousToken:this.input[n],ast:e})}_tag(e,t){return e?(e.image??=this.input[t].image,this._tokenMap.set(e,{tokenIndex:t,tokenIndexClose:t}),e):(console.warn(`node is null`),e)}_tagClose(e,t){let n=this._tokenMap.get(e);return n?n.tokenIndexClose=t:this._tokenMap.set(e,{tokenIndexClose:t}),e}_bindNodeWhitespace(e){let t=this._tokenMap.get(e);if(!t)return;let n=this.input,r=this._inputText,i=t.tokenIndex;if(i!==void 0){let t=n[i],a=n[i-1]?.endOffset??-1;a+1<t.startOffset&&(e.wsBefore=r.slice(a+1,t.startOffset))}let a=t.tokenIndexClose;if(a!==void 0){let t=n[a],i=n[a+1]?.startOffset??this._inputTextLength;t.endOffset+1<i&&(e.wsAfter=r.slice(t.endOffset+1,i))}}_bindAllWhitespace(e){if(e){if(this._bindNodeWhitespace(e),e.inputs)for(let t of e.inputs)t&&this._bindAllWhitespace(t);if(e.type===T.Array&&Array.isArray(e.value)){for(let t of e.value)if(t&&Array.isArray(t.value))for(let e of t.value)e&&this._bindAllWhitespace(e)}}}};export{ir as i,ar as n,cr as r,Hn as t};
57
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return Nn.call(this,N,e,t)}atLeastOneInternalRecord(e,t){Nn.call(this,P,t,e)}atLeastOneSepFirstInternalRecord(e,t){Nn.call(this,F,t,e,kn)}manyInternalRecord(e,t){Nn.call(this,I,t,e)}manySepFirstInternalRecord(e,t){Nn.call(this,L,t,e,kn)}orInternalRecord(e,t){return Pn.call(this,e,t)}subruleInternalRecord(e,t,n){if(In(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${Fn(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=e.ruleName,a=new A({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Mn:On}consumeInternalRecord(e,t,n){if(In(t),!nt(e)){let n=Error(`<CONSUME${Fn(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=new z({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),jn}},class{initPerformanceTracer(e){if(Object.hasOwn(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=$.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=ae(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if(n===`constructor`)return;let r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(zn.prototype,n,r):zn.prototype[n]=e.prototype[n]})});var Vn=class extends Bn{constructor(e,t=$){let n=Object.assign({},t);n.outputCst=!1,super(e,n)}},Hn=class t{static shared(e){let n=e?.locale??T,r=e?.maxColumn??Kn,i=e?.maxRow??qn,a=Gn.get(n);a||(a=new Map,Gn.set(n,a));let o=`${r}:${i}`,s=a.get(o);return s||(s=new t({locale:n,maxColumn:r,maxRow:i}),a.set(o,s)),s}constructor(e){let t=e?.maxColumn??Kn,n=e?.maxRow??qn,r=e?.locale??T;this._locale=r,this._maxColumn=t,this._maxRow=n;let{separatorFunction:i,separatorColumn:o,separatorRow:s,separatorDecimal:c}=r.separators;if(o===s)throw Error(`FormulaLexer: separatorColumn and separatorRow must differ (both '${o}')`);let l=Y({name:`WhiteSpace`,pattern:/[ \n\v\f\r\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,group:J.SKIPPED}),u=Y({name:`StringToken`,pattern:/"(""|[^"])*"/}),d=Y({name:`FunctionToken`,pattern:/[a-zA-Z_\u007F-\uFFFF]+[a-zA-Z0-9_.\u007F-\uFFFF]*(?=\()/}),f=Y({name:`TableReference`,pattern:{exec:a},line_breaks:!1,start_chars_hint:Wn}),p=Y({name:`BracketedString`,pattern:{exec:ne},line_breaks:!1,start_chars_hint:[91],longer_alt:[f,u]}),m=e=>(e??[]).map(e=>e?.trim()).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).map(e=>e+`|`).join(``),h=e=>e.replace(/[A-Za-z]/g,e=>`[${e.toUpperCase()}${e.toLowerCase()}]`),g=Y({name:`LiteralError`,pattern:new RegExp(m(r.errorLiterals)+[`#PARSE!`,`#NULL!`,`#DIV\\/0!`,`#VALUE!`,`#NUM!`,`#FIELD!`,`#N\\/A`,`#GETTING_DATA`,`#SPILL!`,`#CONNECT!`,`#BLOCKED!`,`#UNKNOWN!`,`#CALC!`,`#BUSY!`,`#PYTHON!`,`#TIMEOUT!`].map(h).join(`|`))}),_=Y({name:`RefError`,pattern:new RegExp(m(r.errorRefs)+[`#REF!`,`#NAME\\?`].map(h).join(`|`))}),v=Y({name:`SingleQuotedString`,pattern:/'(''|[^'])*'/}),y=Y({name:`SheetQuoted`,pattern:/'(?:''|[^'])*?'!/}),ee=Y({name:`Sheet`,pattern:/[A-Za-z_.\d\u007F-\uFFFF]*!/}),b=/[a-zA-Z_\\\u007F-\uFFFF][a-zA-Z0-9_.?\\\u007F-\uFFFF]*:?/y,x=Y({name:`NamedToken`,pattern:{exec:(e,t)=>{b.lastIndex=t;let n=b.exec(e);if(!n)return null;let r=n[0],i=r.indexOf(`.:`);return i===-1?r.endsWith(`:`)&&(r=r.slice(0,-1)):r=r.substring(0,i),[r]}},line_breaks:!1,start_chars_hint:Wn}),te=Y({name:`Cell`,pattern:{exec:Xn(t,n)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:x}),S=Y({name:`Column`,pattern:{exec:Yn(t)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:x}),C=Y({name:`AbsRow`,pattern:/[$][0-9]+/}),w=c===`.`?`\\.`:c,re=Y({name:`NumberToken`,pattern:RegExp(`[0-9]+${w}(?!:)[0-9]*([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|${w}[0-9]+([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+`)}),ie=Y({name:`ScientificDigit`,pattern:/[0-9]+\*\*[+-]?[0-9]+/}),E=Y({name:`DigitToken`,pattern:/[0-9]+/}),D=[`TRUE`,`FALSE`];for(let e of[r.booleanTrue,r.booleanFalse]){let t=e?.trim();t&&!D.some(e=>e.toLowerCase()===t.toLowerCase())&&D.push(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}let ae=Y({name:`BooleanToken`,pattern:new RegExp(D.join(`|`),`i`)}),O=Y({name:`ArgSeparator`,pattern:Zn(i)}),k=Y({name:`ColSeparator`,pattern:Zn(o)}),A=Y({name:`RowSeparator`,pattern:Zn(s)}),j=Y({name:`RangeOp`,pattern:/:/}),M=Y({name:`RangeTrimFullOp`,pattern:/\.:\./}),N=Y({name:`RangeTrimLeadingOp`,pattern:/\.:/}),P=Y({name:`RangeTrimTrailingOp`,pattern:/:\./}),F=Y({name:`OpenParen`,pattern:/\(/}),I=Y({name:`CloseParen`,pattern:/\)/}),L=Y({name:`OpenCurlyParen`,pattern:/{/}),R=Y({name:`CloseCurlyParen`,pattern:/}/}),z=Y({name:`QuoteS`,pattern:/'/}),oe=Y({name:`MulOp`,pattern:/\*(?!\*)/}),B=Y({name:`PlusOp`,pattern:/\+/}),se=Y({name:`DivOp`,pattern:/\//}),ce=Y({name:`MinOp`,pattern:/-/}),V=Y({name:`ImplicitIntersectOp`,pattern:/@/}),le=Y({name:`ConcatOp`,pattern:/&/}),ue=Y({name:`ExOp`,pattern:/\^/}),de=Y({name:`PercentOp`,pattern:/%/}),fe=Y({name:`ArrayAnchorOp`,pattern:/#/,longer_alt:[g,_]}),pe=Y({name:`GtOp`,pattern:/>/}),H=Y({name:`EqOp`,pattern:/=/}),me=Y({name:`LtOp`,pattern:/</}),U=[l,u,y,v,ee,d,f,p,g,_,O,...o===i?[]:[k],A,M,N,P,j,te,ae,S,C,re,ie,E,fe,V,x,F,I,L,R,z,oe,B,se,ce,le,ue,de,Y({name:`NeqOp`,pattern:/<>/}),Y({name:`GteOp`,pattern:/>=/}),Y({name:`LteOp`,pattern:/<=/}),pe,H,me];this._lexer=new J(U,{ensureOptimizations:!0});let W={};U.forEach(e=>{W[e.name]=e}),o===i&&(W.ColSeparator=O),this._vocabulary=W}tokenize(t,n=!0){let r=this._lexer.tokenize(t);if(n&&r.errors.length>0){let n=r.errors[0],i=n.line,a=n.column,o=t.substr(n.offset,n.length||1),s=o?`Unexpected character '${o}'`:n.message;throw new e.Parse(s,{line:i,column:a,offset:n.offset,length:n.length})}return r}getVocabulary(){return this._vocabulary}getLocale(){return this._locale}getMaxColumn(){return this._maxColumn}getMaxRow(){return this._maxRow}getSeparators(){return this._locale.separators}},Un=(()=>{let e=[];for(let t=65;t<=90;t++)e.push(t);for(let t=97;t<=122;t++)e.push(t);for(let t=48;t<=57;t++)e.push(t);return e})().filter(e=>e<48||e>57),Wn=(()=>{let e=[...Un,95,92];for(let t=127;t<=65535;t++)e.push(t);return e})(),Gn=new WeakMap,Kn=16384,qn=1048576;function Jn(e,t,n){let r=0;for(let i=t;i<n;i++){let t=e.charCodeAt(i);r=26*r+(t>=97?t-96:t-64)}return r}function Yn(e){return(t,n)=>{let r=n;t.charCodeAt(r)===36&&r++;let i=r;for(;r<t.length&&r-i<3;){let e=t.charCodeAt(r);if(!(e>=65&&e<=90||e>=97&&e<=122))break;r++}if(r-i===0||Jn(t,i,r)>e)return null;if(r<t.length){let e=t.charCodeAt(r);if(e>=48&&e<=57)return null}return[t.substring(n,r)]}}function Xn(e,t){return(n,r)=>{let i=r;n.charCodeAt(i)===36&&i++;let a=i;for(;i<n.length&&i-a<3;){let e=n.charCodeAt(i);if(!(e>=65&&e<=90||e>=97&&e<=122))break;i++}if(i-a===0||Jn(n,a,i)>e)return null;i<n.length&&n.charCodeAt(i)===36&&i++;let o=i;for(;i<n.length;){let e=n.charCodeAt(i);if(!(e>=48&&e<=57))break;i++}if(i===o)return null;let s=parseInt(n.substring(o,i),10);return s<1||s>t?null:[n.substring(r,i)]}}function Zn(e){return new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}var Qn=class{constructor(e=T){let t=function(e){let t=[...m];if(e)for(let n of Object.values(e)){let e=n?.trim();e&&!t.some(t=>t.toLowerCase()===e.toLowerCase())&&t.push(e)}return t.sort((e,t)=>t.length-e.length),t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)}(e.specifiers),n=Y({name:`WhiteSpace`,pattern:/\s+/,group:J.SKIPPED}),r=Y({name:`TableSpecifier`,pattern:RegExp(`\\[#(?:${t})\\]`,`i`)}),i=[n,r,Y({name:`BracketedColumn`,pattern:/\[(?:'['#[\]]|'(?!['#[\]])|[^'[\]])*\]/,longer_alt:[r]}),Y({name:`BareSpecifier`,pattern:RegExp(`#(?:${t})`,`i`)}),Y({name:`ColumnSep`,pattern:/:/}),Y({name:`ListSep`,pattern:new RegExp(e.separators.separatorFunction.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))})];this._lexer=new J(i,{ensureOptimizations:!0});let a={};i.forEach(e=>{a[e.name]=e}),this._vocabulary=a}getVocabulary(){return this._vocabulary}tokenize(e){return this._lexer.tokenize(e)}},$n=class extends Vn{constructor(e=T){let t=new Qn(e),n=t.getVocabulary();super(n,{nodeLocationTracking:`none`,maxLookahead:2,skipValidations:!0,recoveryEnabled:!1}),this._lexer=t;let{TableSpecifier:r,BracketedColumn:i,BareSpecifier:a,ColumnSep:s,ListSep:l}=n,u=this;u.RULE(`ruleContent`,()=>{let e=[],t=u.SUBRULE(u.ruleItem);return u.ACTION(()=>{t&&e.push(t)}),u.MANY(()=>{u.CONSUME(l),u.OPTION(()=>{let t=u.SUBRULE2(u.ruleItem);u.ACTION(()=>{t&&e.push(t)})})}),e}),u.RULE(`ruleItem`,()=>u.OR([{ALT:()=>u.SUBRULE(u.ruleSpecifier)},{ALT:()=>u.SUBRULE(u.ruleColumnOrRange)}])),u.RULE(`ruleSpecifier`,()=>u.OR([{ALT:()=>{let t=u.CONSUME(r);return u.ACTION(()=>{let n=c(t.image,e);return n.image=t.image,n})}},{ALT:()=>{let t=u.CONSUME(a);return u.ACTION(()=>{let n=c(t.image,e);return n.image=t.image,n})}}])),u.RULE(`ruleColumnOrRange`,()=>{let e=u.CONSUME(i),t,n;return u.OPTION(()=>{t=u.CONSUME(s),n=u.CONSUME2(i)}),u.ACTION(()=>{let r=o(e.image);if(r.image=e.image,!n)return r;let i=o(n.image);i.image=n.image;let a=C(`:`,r,i,!0);return a.image=t?.image??`:`,a})}),u.performSelfAnalysis()}_parseInner(e){let t=this._lexer.tokenize(e);return t.errors.length>0||t.tokens.length===0?[]:(this.input=t.tokens,this.reset(),this.ruleContent()??[])}_parseContent(e){if(!e)return[];let t=e.trim();if(!t)return[];let n=t[0];if(n===`@`){let e=t.slice(1).trim();if(!e){let e=g(`@`,null,!0);return e.image=`@`,[e]}if(e.charAt(0)===`[`){let t=this._parseInner(e);if(t.length===1&&t[0].type===`infix`){let e=g(`@`,t[0],!0);return e.image=`@`,[e]}}let n=o(e);n.image=e;let r=g(`@`,n,!0);return r.image=`@`,[r]}if(n!==`[`&&n!==`#`){let t=o(e);return t.image=e,[t]}return this._parseInner(t)}parse(e,t,r){this.reset();let i=()=>({root:n(``,[]),errors:[]});if(!r)return i();let a=0;if(r.charAt(0)===`[`){let e=r.indexOf(`]`);e!==-1&&r.charAt(e+1)===`!`&&(a=e+2)}let o=r.indexOf(`[`,a);if(o===-1)return i();let s=r.slice(0,o),c=r.slice(o+1,-1),l=this._parseContent(c);return{root:n(s,l),errors:this.errors.length>0?[...this.errors]:[]}}},er=new Set([`:`,`.:.`,`.:`,`:.`]),tr=new Set([`.:.`,`.:`,`:.`]),nr=e=>{if(!e)return null;if(e.type===v.Cell){let t=e.value;return t.rowIndex===-(2**53-1)?`col`:t.colIndex===-(2**53-1)?`row`:null}return Number.isInteger(e.value)?`row`:null},rr=(e,t)=>{let n=parseInt(e.charCodeAt(0)===36?e.substring(1):e,10);return n>=1&&n<=t},ir=`A formula must not be empty`,ar=(e,t)=>`A formula must not be longer than ${t} characters (this one is ${e})`;function or(e,t){let n=e?.[0]?.image;if(!n){let e=t?.image;return e?`Expected a value after '${e}'`:`Expected a value`}return`Unexpected '${n}'`}var sr={...yt,buildNoViableAltMessage:e=>or(e.actual,e.previous),buildEarlyExitMessage:e=>or(e.actual,e.previous),buildNotAllInputParsedMessage:e=>{let t=e.firstRedundant?.image;return t?`Unexpected '${t}'`:yt.buildNotAllInputParsedMessage(e)},buildMismatchTokenMessage:e=>{let t=e.actual?.image;return e.expected===X&&t?`Unexpected '${t}'`:yt.buildMismatchTokenMessage(e)}},cr=class extends Vn{constructor(e){let n=e?.lexer??Hn.shared(e?.lexerOptions),a=n.getVocabulary();super(a,{skipValidations:!0,recoveryEnabled:!0,...e,nodeLocationTracking:`full`,errorMessageProvider:sr,maxLookahead:1}),this._ruleInfixOp=this.RULE(`ruleInfixOp`,()=>{let{PlusOp:e,MinOp:t,MulOp:n,DivOp:i,ExOp:a,ConcatOp:o,GtOp:s,EqOp:c,LtOp:u,NeqOp:d,GteOp:f,LteOp:p}=this._vocab,m=[];return m.push({node:this.SUBRULE(this._rulePostfixOp)}),this.MANY(()=>{let r=this.OR(this._c1||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(i).image},{ALT:()=>this.CONSUME(a).image},{ALT:()=>this.CONSUME(o).image},{ALT:()=>this.CONSUME(s).image},{ALT:()=>this.CONSUME(c).image},{ALT:()=>this.CONSUME(u).image},{ALT:()=>this.CONSUME(d).image},{ALT:()=>this.CONSUME(f).image},{ALT:()=>this.CONSUME(p).image}]),h={value:r,index:this.getLexerPosition(),isRange:l.includes(r)},g=this.SUBRULE2(this._rulePostfixOp);m.push({op:h,node:g})}),this.ACTION(()=>{let e=m.length-1,t=r.length;for(let n=0;e>0&&n<t;n++){let t=r[n],i=1;for(;i<m.length;){let n=m[i].op;if(t.includes(n.value)){let t=m[i-1].node,r=m[i].node,a=C(n.value,t,r,n.isRange);a=this._tag(a,n.index),m[i-1].node=a,m.splice(i,1),e--}else i++}}}),m[0].node}),this._rulePlusMinusOp=this.RULE(`rulePlusMinusOp`,()=>{let{PlusOp:e,MinOp:t}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)}])}),this._rulePostfixOp=this.RULE(`rulePostfixOp`,()=>{let{PercentOp:e}=this._vocab,t=this.SUBRULE(this._rulePrefixOp),n=[];return this.MANY(()=>{let t=this.CONSUME(e).image;this.ACTION(()=>{n.push([t,this.getLexerPosition()])})}),this.ACTION(()=>{let e=n.length;if(e!==0)for(let r=0;r<e;r++){let e=n[r],i=e[0],a=e[1],o=l.includes(i);t=s(i,t,o),t=this._tag(t,a)}}),t}),this._rulePrefixOp=this.RULE(`rulePrefixOp`,()=>{let{PlusOp:e,MinOp:t,ImplicitIntersectOp:n}=this._vocab,r=[];this.MANY(()=>{let i=this.OR([{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image}]);this.ACTION(()=>{r.push([i,this.getLexerPosition()])})});let i=this.SUBRULE(this._ruleRangeOp);return this.ACTION(()=>{let e=r.length;if(e!==0)for(let t=e-1;t>=0;t--){let e=r[t],n=e[0],a=e[1],o=l.includes(n);i=g(n,i,o),i=this._tag(i,a)}}),i}),this._ruleRangeOp=this.RULE(`ruleRangeOp`,()=>{let{RangeOp:e,RangeTrimFullOp:t,RangeTrimLeadingOp:n,RangeTrimTrailingOp:r,ArrayAnchorOp:i}=this._vocab,a=[];return a.push({node:this.SUBRULE(this._ruleCallOp)}),this.MANY2(()=>{this.CONSUME(i),a.push({anchor:this.getLexerPosition()})}),this.MANY(()=>{let o={value:this.OR(this._c2||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(r).image}]),index:this.getLexerPosition()},s=this.SUBRULE2(this._ruleCallOp);a.push({op:o,node:s}),this.MANY3(()=>{this.CONSUME2(i),a.push({anchor:this.getLexerPosition()})})}),this.ACTION(()=>{for(let e=1;e+1<a.length;e++){let t=a[e],n=a[e+1];if(t.op?.value!==`:`||n.op?.value!==`:`)continue;let r=nr(t.node);r&&nr(n.node)===r&&nr(a[e-1].node)!==r&&(t.node=this._tag(C(`:`,t.node,n.node,!0),n.op.index),a.splice(e+1,1))}for(let e=1;e<a.length;e++){let t=a[e];if(t.anchor!==void 0){a[0].node=this._tag(s(`#`,a[0].node,!0),t.anchor);continue}let n=t.op,r=C(n.value,a[0].node,t.node,!0);r=this._tag(r,n.index),a[0].node=r}}),a[0].node}),this._ruleCallOp=this.RULE(`ruleCallOp`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab,n=this.SUBRULE(this._ruleFormula);return this.MANY({GATE:()=>{let t=this.LA(0),n=this.LA(1);return!(!t||!n||n.tokenType!==e)&&n.startOffset===t.endOffset+1},DEF:()=>{this.CONSUME(e);let r=this.getLexerPosition(),i=this.SUBRULE(this._ruleFunctionArguments),a=n,o=this.ACTION(()=>this._tag(h(a,i),r)),s=this.OPTION(()=>this.CONSUME(t));this.ACTION(()=>{s||this._reportError(o,`Missing closing parenthesis ')'`,r),this._tagClose(o,this.getLexerPosition()),n=o})}}),n}),this._ruleIntersectOp=this.RULE(`ruleIntersectOp`,()=>{let e=[this.SUBRULE(this._ruleInfixOp)];return this.MANY(()=>{this.OPTION({GATE:()=>{let e=this.LA(0);return this.LA(1).startOffset>e.endOffset+1},DEF:()=>{e.push(this.SUBRULE3(this._ruleInfixOp))}})}),this.ACTION(()=>{for(;e.length>1;){let t=e.length-1;for(let n=0;n<t;n++){let r=e[n],i=e[n+1],a=C(` `,r,i,!0),o=this._tokenMap.get(r);o&&delete o.tokenIndexClose;let s=this._tokenMap.get(i),c=s?.tokenIndex;if(c!==void 0){let e=this.input[c],t=this.input[c-1]?.endOffset??-1,n=this._inputText.slice(t+1,e.startOffset).slice(0,-1);n.length>0&&(a.wsBefore=n)}s&&delete s.tokenIndex,n+1<t&&s&&delete s.tokenIndexClose,e.splice(n,2,a),n--,t--}}}),e[0]}),this._ruleFormula=this.RULE(`ruleFormula`,()=>this.OR9([{ALT:()=>this.SUBRULE(this._ruleLiteral)},{ALT:()=>this.SUBRULE(this._ruleReference)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>this.SUBRULE(this._ruleParen)},{ALT:()=>this.SUBRULE(this._ruleTableReference)},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleLiteralArray)}])),this._ruleGroup=this.RULE(`ruleGroup`,()=>{let{ArgSeparator:e}=this._vocab,t=[];return this.MANY(()=>{this.CONSUME(e);let n=this.SUBRULE2(this._ruleIntersectOp);this.ACTION(()=>{t.push(n)})}),t}),this._ruleParen=this.RULE(`ruleParen`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab;return this._processParen(v.Paren,e,t)}),this._ruleLiteralArray=this.RULE(`ruleLiteralArray`,()=>{let{OpenCurlyParen:e,CloseCurlyParen:t,ColSeparator:n,RowSeparator:r}=this._vocab,i=d();this.CONSUME(e);let a=this.getLexerPosition(),o=this.ACTION(()=>this._tag(b(i),a)),s=this.SUBRULE(this._ruleLiteralForArray);this.ACTION(()=>{i.value.push(s)}),this.MANY(()=>{let e=!1;this.OR([{ALT:()=>{this.CONSUME(n),e=!0}},{ALT:()=>this.CONSUME(r)}]);let t=this.SUBRULE2(this._ruleLiteralForArray);this.ACTION(()=>{e||(i=d(),o.value.push(i)),i.value.push(t)})});let c=this.OPTION(()=>this.CONSUME(t));return o=this.ACTION(()=>(c||this._reportError(o,`Missing closing parenthesis '}'`,a),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleLiteralForArray=this.RULE(`ruleLiteralForArray`,()=>{let{StringToken:e,BooleanToken:n,LiteralError:r,RefError:a}=this._vocab;return this.OR([{ALT:()=>{let e=this.OPTION(()=>this.SUBRULE(this._rulePlusMinusOp)),t=this.SUBRULE(this._ruleNumber),n=this.ACTION(()=>this._tag(u(t.image,this._locale),this.getLexerPosition()));return this.ACTION(()=>e?y(e.image,n):n)}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(p(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(t(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(_(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(a);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleLiteral=this.RULE(`ruleLiteral`,()=>{let{StringToken:e,BooleanToken:n,LiteralError:r,RefError:a}=this._vocab;return this.OR([{ALT:()=>{let e=this.SUBRULE(this._ruleNumber);return this.ACTION(()=>this._tag(u(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(p(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(t(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(_(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(a);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleFunction=this.RULE(`ruleFunction`,()=>{let{FunctionToken:e,OpenParen:t,CloseParen:n}=this._vocab,r=this.CONSUME(e).image,i=this.getLexerPosition();this.CONSUME(t);let a=this.SUBRULE(this._ruleFunctionArguments),o=this.ACTION(()=>this._tag(w(r,a),i)),s=this.OPTION(()=>this.CONSUME(n));return o=this.ACTION(()=>(s||this._reportError(o,`Missing closing parenthesis ')'`,i),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleFunctionArguments=this.RULE(`ruleFunctionArguments`,()=>{let{ArgSeparator:e,CloseParen:t}=this._vocab,n=[];return this.OPTION({GATE:()=>this.LA(1).tokenType!==t,DEF:()=>{let t;this.OPTION2(()=>{t=this.SUBRULE(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(ee(),this.getLexerPosition())),n.push(t),this.MANY(()=>{let t;this.CONSUME(e),this.OPTION3(()=>{t=this.SUBRULE2(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(ee(),this.getLexerPosition())),n.push(t)})}}),n}),this._ruleBracketedString=this.RULE(`ruleBracketedString`,()=>{let{BracketedString:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleTableReference=this.RULE(`ruleTableReference`,()=>{let{TableReference:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleReference=this.RULE(`ruleReference`,()=>{let{Sheet:e,SheetQuoted:t,DivOp:n,MulOp:r,PlusOp:a,MinOp:o,ArgSeparator:s,Cell:c,NamedToken:l,SingleQuotedString:u,Column:d,AbsRow:p,DigitToken:m,RefError:h}=this._vocab,g,_;this.OPTION2({GATE:()=>{for(let i=1;i<6;i++){let c=this.LA(i);if(c.tokenType===e||c.tokenType===t)return!0;if(c.image===``||c.image===`)`||c.tokenType===n||c.tokenType===r||c.tokenType===a||c.tokenType===o||c.tokenType===s)break}return!1},DEF:()=>{_=this.getLexerPosition()+1,g=this.SUBRULE(this._rulePrefixSheetName)}});let y=this.OR([{ALT:()=>{let e=this.CONSUME(c),t=this.getLexerPosition();return this.ACTION(()=>this._tag(re(e.image,this.rowIndex,this.colIndex),t))}},{ALT:()=>{let e=this.OR2([{ALT:()=>this.CONSUME(l)},{ALT:()=>this.CONSUME(u)}]);return this.ACTION(()=>this._tag(ie(e.image),this.getLexerPosition()))}},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>{let e=this.CONSUME(d);return this.ACTION(()=>this._tag(f(e.image,this.colIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(p);return this.ACTION(()=>this._tag(x(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(m);return this.ACTION(()=>this._tag(x(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(h);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}]);return this.ACTION(()=>{if(g&&y){if(g.name===``)return void this._reportError(y,`'${g.image}' is not a valid sheet reference — a '!' needs a sheet name before it`);let e=y;if(y.type===v.Postfix&&y.inputs?.[0]&&(e=y.inputs[0]),e.type===v.Cell||e.type===v.Named||e.type===v.Row||e.type===v.TableColumn||e.type===v.Error){e.value.scope=g.name,e.value.scopeImage=g.image;let t=this._tokenMap.get(e);t&&_!==void 0&&(t.tokenIndex=_)}}}),y}),this._rulePrefixSheetName=this.RULE(`rulePrefixSheetName`,()=>{let{SheetQuoted:e,BracketedString:t,NamedToken:n,Column:r,RangeOp:i,Sheet:a}=this._vocab;return this.OR([{ALT:()=>{let t=this.CONSUME(e).image;return{name:t.slice(1,-2).replace(/''/g,`'`),image:t}}},{ALT:()=>{let e=``;this.OPTION(()=>{e+=this.CONSUME(t).image}),this.OPTION2({GATE:()=>this.LA(2).tokenType===i,DEF:()=>{e+=this.OR2([{ALT:()=>this.CONSUME(n).image},{GATE:()=>this.LA(1).image.charCodeAt(0)!==36,ALT:()=>this.CONSUME(r).image}]),this.CONSUME(i),e+=`:`}});let o=this.CONSUME(a).image;return{name:e+o.slice(0,-1),image:e+o}}}])}),this._ruleNumber=this.RULE(`ruleNumber`,()=>{let{NumberToken:e,ScientificDigit:t,DigitToken:n}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)},{ALT:()=>this.CONSUME(n)}])}),this._ruleRoot=this.RULE(`ruleRoot`,()=>{let{ArgSeparator:e}=this._vocab,t=this.SUBRULE(this._ruleIntersectOp),n=[];return this.MANY(()=>{this.CONSUME(e),n.push(this.SUBRULE2(this._ruleIntersectOp))}),this.ACTION(()=>n.length===0?t:{type:v.List,value:`,`,inputs:[t,...n],isReference:!0})}),this._lexer=n,this._locale=n.getLocale(),this._vocab=a,this._srParser=e?.srParser??new $n(this._locale),this.performSelfAnalysis()}getLexer(){return this._lexer}parse(t,n,r){let i=this._lexer.tokenize(r),a;if(!i)return{root:{type:v.Unparsed,value:r},errors:[]};let o=i.tokens;if(o.length===0)throw new e.Parse(ir);return this.input=o,this._inputText=r,this._inputTextLength=r.length,this.rowIndex=t,this.colIndex=n,this._astErrors=[],this._tokenMap=new Map,this.reset(),a=this._ruleRoot(),a&&this._bindAllWhitespace(a),a=te(a,(e,n)=>{let r=e.type,i=n?.isReference?n.value:void 0,a=typeof i==`string`&&er.has(i),o=typeof i==`string`&&tr.has(i),s=a?n.inputs:void 0,c=s?s[0]===e?s[1]:s[0]:void 0,l=this._lexer.getMaxRow();if(a&&r!==v.Cell&&Number.isInteger(e.value)){let n=x(e.image,t);return S(n,e),nr(c)===`row`?rr(e.image,l)||this._reportError(n,`'${e.image}' is not a valid row — rows run from 1 to ${l}`):this._reportError(n,`'${e.image}' is not a valid reference — a whole row can only pair with another row (as in ${e.image}:${e.image})`),n}if(o&&r===v.Named)return this._reportError(e,`'${e.image??e.value?.nameId}' is a name — '${i}' needs a cell or range on both sides`),e;if(r===v.Cell){let t=e.value,n=t.colIndex===-(2**53-1),r=t.rowIndex===-(2**53-1);if((n||r)&&nr(c)===(n?`row`:`col`))return n&&!rr(e.image,l)&&this._reportError(e,`'${e.image}' is not a valid row — rows run from 1 to ${l}`),e;if(n||r||t.colIndex>=16384){let a=ie(e.image);S(a,e);let s=t.scope;return s&&(a.value.scope=s,a.value.scopeImage=t.scopeImage),n?this._reportError(a,`'${e.image}' is not a valid reference — a row needs a column (use ${e.image}:${e.image} for the whole row)`):r&&e.image.includes(`$`)?this._reportError(a,`'${e.image}' is not a valid reference — a whole column can only pair with another column (as in ${e.image}:${e.image})`):o&&this._reportError(a,`'${e.image}' is a name — '${i}' needs a cell or range on both sides`),a}}return e}),{root:a,errors:[...this.errors,...this._astErrors]}}_processParen(e,t,n){let r;this.CONSUME(t);let i=this.getLexerPosition();r=this.ACTION(()=>(r={type:e,value:null,inputs:null},this._tag(r,i)));let a=[],o=this.SUBRULE(this._ruleIntersectOp);o&&a.push(o);let s=this.SUBRULE(this._ruleGroup),c=this.OPTION(()=>this.CONSUME(n));return r=this.ACTION(()=>{if(s)for(let e=0;e<s.length;e++)a.push(s[e]);return r&&(c||this._reportError(r,`Missing closing parenthesis`,i),r.inputs=a),this._tagClose(r,this.getLexerPosition())}),r}_reportError(e,t,n=void 0,r=`SyntaxError`){n===void 0&&(n=this.getLexerPosition()),e.error=!0,this._astErrors.push({name:r,message:t,previousToken:this.input[n],ast:e})}_tag(e,t){return e?(e.image??=this.input[t].image,this._tokenMap.set(e,{tokenIndex:t,tokenIndexClose:t}),e):(console.warn(`node is null`),e)}_tagClose(e,t){let n=this._tokenMap.get(e);return n?n.tokenIndexClose=t:this._tokenMap.set(e,{tokenIndexClose:t}),e}_bindNodeWhitespace(e){let t=this._tokenMap.get(e);if(!t)return;let n=this.input,r=this._inputText,i=t.tokenIndex;if(i!==void 0){let t=n[i],a=n[i-1]?.endOffset??-1;a+1<t.startOffset&&(e.wsBefore=r.slice(a+1,t.startOffset))}let a=t.tokenIndexClose;if(a!==void 0){let t=n[a],i=n[a+1]?.startOffset??this._inputTextLength;t.endOffset+1<i&&(e.wsAfter=r.slice(t.endOffset+1,i))}}_bindAllWhitespace(e){if(e){if(this._bindNodeWhitespace(e),e.inputs)for(let t of e.inputs)t&&this._bindAllWhitespace(t);if(e.type===v.Array&&Array.isArray(e.value)){for(let t of e.value)if(t&&Array.isArray(t.value))for(let e of t.value)e&&this._bindAllWhitespace(e)}}}};export{ir as i,ar as n,cr as r,Hn as t};