@kabmo-labs/kabmo 0.42.0 → 0.42.1

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 (181) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +592 -593
  3. package/dist/client/static/js/{CsvGrid-20k047ht.js → CsvGrid-8gdp5b49.js} +1 -1
  4. package/dist/client/static/js/{DocxView-qpvhfcmg.js → DocxView-j9sphgra.js} +2 -2
  5. package/dist/client/static/js/{DrawioView-178skky8.js → DrawioView-xsgjc7d8.js} +1 -1
  6. package/dist/client/static/js/{ImageView-460th5qa.js → ImageView-ve9hc519.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-5cv0dty8.js → LayoutWrapper-5mqffvkc.js} +2 -2
  8. package/dist/client/static/js/{Modal-wks6p4r5.js → Modal-50whypff.js} +10 -10
  9. package/dist/client/static/js/{PdfView-y51g03nr.js → PdfView-afd5cg54.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-rsmvn7ks.js → SessionsView-7719nvy0.js} +1 -1
  11. package/dist/client/static/js/{SheetView-z7yvb05v.js → SheetView-gfzgxb4r.js} +1 -1
  12. package/dist/client/static/js/{SvgPreview-yehgzhem.js → SvgPreview-225pkb99.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-6zxpcy8b.js → abnfDiagram-O67JEVCF-z70sk69m.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-cagtcfhk.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-m98sgh3c.js → architectureDiagram-NJMV4G6O-pf1gpkje.js} +3 -3
  16. package/dist/client/static/js/{blockDiagram-BEXU5L5S-cp7rervg.js → blockDiagram-BEXU5L5S-sr25kbn6.js} +2 -2
  17. package/dist/client/static/js/{c4Diagram-YGBWAQC7-t31recqm.js → c4Diagram-YGBWAQC7-znstpg86.js} +1 -1
  18. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fy8x3dkx.js → classDiagram-v2-NBCMYWYE-7n0pdcd8.js} +3 -3
  19. package/dist/client/static/js/{cose-bilkent-JH36ORCC-va7ybm9e.js → cose-bilkent-JH36ORCC-zn3qw4c4.js} +1 -1
  20. package/dist/client/static/js/cynefin-OW5HDTMX-6g2ydrss.js +1 -0
  21. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-4k0k429c.js → cynefinDiagram-VND7K2PF-3z41vtzs.js} +1 -1
  22. package/dist/client/static/js/{dagre-6A5THRUB-ykdhxq6t.js → dagre-6A5THRUB-5j3zn883.js} +2 -2
  23. package/dist/client/static/js/{diagram-22UHCM2B-5nvwx7b6.js → diagram-22UHCM2B-ryw1w2kh.js} +4 -4
  24. package/dist/client/static/js/{diagram-3UASUU5V-hc7zsjgw.js → diagram-3UASUU5V-p91q4gkh.js} +1 -1
  25. package/dist/client/static/js/{diagram-ATOU4E4O-97ae07y7.js → diagram-ATOU4E4O-22dn73g4.js} +1 -1
  26. package/dist/client/static/js/{diagram-CDSNMT55-b56nnbbs.js → diagram-CDSNMT55-589p9n53.js} +3 -3
  27. package/dist/client/static/js/{diagram-MLGK6HIB-37rygr9k.js → diagram-MLGK6HIB-ezw06wbx.js} +1 -1
  28. package/dist/client/static/js/{diagram-MPIPVDR6-wv3vhhfk.js → diagram-MPIPVDR6-cfwrsvk1.js} +1 -1
  29. package/dist/client/static/js/{dockerfile-0efb1z6e.js → dockerfile-r4k7q34y.js} +1 -1
  30. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-13fv7vxg.js → ebnfDiagram-ZINNZB2B-3rv2wvbf.js} +1 -1
  31. package/dist/client/static/js/{elixir-mabagxwa.js → elixir-szk51ehr.js} +1 -1
  32. package/dist/client/static/js/{elk-276RUBZZ-xam60ktz.js → elk-276RUBZZ-ma40kneq.js} +1 -1
  33. package/dist/client/static/js/{erDiagram-OPXOYQCR-24ctv2ee.js → erDiagram-OPXOYQCR-xwstsfqa.js} +2 -2
  34. package/dist/client/static/js/eventmodeling-NTZA5JFV-b774qbn2.js +1 -0
  35. package/dist/client/static/js/flowDiagram-KWPJA3E3-evp84v09.js +1 -0
  36. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-766a8fqw.js → ganttDiagram-FUAMR5RP-qxyx9tr9.js} +2 -2
  37. package/dist/client/static/js/gitGraph-4MIJSDKK-b047d6vk.js +1 -0
  38. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-fmwjkgh6.js → gitGraphDiagram-X574FWY7-v6sg7bkh.js} +1 -1
  39. package/dist/client/static/js/html-tbz83eke.js +1 -0
  40. package/dist/client/static/js/{index-xxe52zrm.js → index-001vebsp.js} +1 -1
  41. package/dist/client/static/js/{index-4j8rgr4p.js → index-0nca2nhp.js} +1 -1
  42. package/dist/client/static/js/{index-nbexks3x.js → index-0p43qr4k.js} +1 -1
  43. package/dist/client/static/js/{index-yvxa7hd8.js → index-2w9j2nj4.js} +1 -1
  44. package/dist/client/static/js/{index-2x9eqztp.js → index-313ctswm.js} +1 -1
  45. package/dist/client/static/js/{index-ka2rc2cr.js → index-3d40c0a7.js} +3 -3
  46. package/dist/client/static/js/{index-sq3r1xhf.js → index-4y0ayjfx.js} +1 -1
  47. package/dist/client/static/js/{index-qj34r6d0.js → index-5599dngt.js} +1 -1
  48. package/dist/client/static/js/{index-hzwr5fm9.js → index-5asf5625.js} +3 -3
  49. package/dist/client/static/js/{index-dydwcp3n.js → index-6dxs0tvg.js} +1 -1
  50. package/dist/client/static/js/{index-a9t9gdew.js → index-6eq445nn.js} +4 -4
  51. package/dist/client/static/js/{index-4z4ax55k.js → index-869bpqcs.js} +6 -6
  52. package/dist/client/static/js/{index-97qst4k9.js → index-8fvmyv7t.js} +1 -1
  53. package/dist/client/static/js/{index-vcn1kcpy.js → index-8pdz41yh.js} +3 -3
  54. package/dist/client/static/js/{index-zvazj4va.js → index-9hzfvjrb.js} +1 -1
  55. package/dist/client/static/js/{index-9vdbnvmk.js → index-9ss64g4g.js} +1 -1
  56. package/dist/client/static/js/{index-zjydzxhm.js → index-b0v6gwym.js} +2 -2
  57. package/dist/client/static/js/{index-ejdnjh5c.js → index-b37ewyvk.js} +1 -1
  58. package/dist/client/static/js/{index-z6kpc98a.js → index-b3d2k7ec.js} +1 -1
  59. package/dist/client/static/js/{index-grczkttn.js → index-b42t14wk.js} +7 -7
  60. package/dist/client/static/js/{index-1c0pnsjd.js → index-cqaz1281.js} +1 -1
  61. package/dist/client/static/js/{index-sx809d6d.js → index-df4yxfzd.js} +1 -1
  62. package/dist/client/static/js/{index-2hpy58d0.js → index-gsxebrq9.js} +2 -2
  63. package/dist/client/static/js/{index-sz3mxjvy.js → index-kh6vp5w5.js} +1 -1
  64. package/dist/client/static/js/{index-x7f5ysch.js → index-mphhvgm9.js} +1 -1
  65. package/dist/client/static/js/{index-13xbwcbz.js → index-mq6s2faf.js} +1 -1
  66. package/dist/client/static/js/{index-xe5cqwnf.js → index-mvykbyhe.js} +1 -1
  67. package/dist/client/static/js/{index-czagykbq.js → index-pxtff3ez.js} +2 -2
  68. package/dist/client/static/js/{index-tqycj126.js → index-q3qpm7jn.js} +1 -1
  69. package/dist/client/static/js/{index-6ge6gk9w.js → index-qh753ynv.js} +1 -1
  70. package/dist/client/static/js/{index-8hgm0abr.js → index-rt6ac0kk.js} +175 -171
  71. package/dist/client/static/js/{index-b4y5g48d.js → index-sr7sdm2t.js} +1 -1
  72. package/dist/client/static/js/{index-8jqawh3r.js → index-v5dbrq83.js} +1 -1
  73. package/dist/client/static/js/{index-1rxa9zxp.js → index-w5q9ymf4.js} +1 -1
  74. package/dist/client/static/js/{index-4mstdh41.js → index-x7a5jpvq.js} +1 -1
  75. package/dist/client/static/js/{index-7t63akyt.js → index-x7m6dmt4.js} +1 -1
  76. package/dist/client/static/js/{index-13dr1t1r.js → index-xsts4pqm.js} +23 -23
  77. package/dist/client/static/js/{index-95en3p3g.js → index-y1p3bdsw.js} +4 -4
  78. package/dist/client/static/js/info-A6RAGUB7-n495k952.js +1 -0
  79. package/dist/client/static/js/{infoDiagram-VRGFBTTK-tqytmzp1.js → infoDiagram-VRGFBTTK-0anekyhb.js} +2 -2
  80. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-rp77ff6m.js → ishikawaDiagram-OU5B5YK6-zxpmfkjb.js} +2 -2
  81. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-c7bxrhf1.js → journeyDiagram-ZHPQQLJL-1e86fzra.js} +2 -2
  82. package/dist/client/static/js/{kanban-definition-PNTS6WVX-j2pxewqq.js → kanban-definition-PNTS6WVX-e85hhmr1.js} +4 -4
  83. package/dist/client/static/js/{mermaid.core-cqqe1krg.js → mermaid.core-jpcrnzyw.js} +2 -2
  84. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-s03k32p9.js → mindmap-definition-NLK3R4M7-xwy5928e.js} +1 -1
  85. package/dist/client/static/js/one-dark-pro-r0tswz8r.js +1 -0
  86. package/dist/client/static/js/one-light-xzcfrptf.js +1 -0
  87. package/dist/client/static/js/packet-AYTQ26CC-zajj62z6.js +1 -0
  88. package/dist/client/static/js/{pegDiagram-GJSIUBJH-dfg2j0zc.js → pegDiagram-GJSIUBJH-7dy6pw26.js} +1 -1
  89. package/dist/client/static/js/{perl-5vxax0nr.js → perl-dtn1fccw.js} +1 -1
  90. package/dist/client/static/js/{php-hgrgdq63.js → php-7av78hch.js} +1 -1
  91. package/dist/client/static/js/pie-WAS4IAKB-1ve78y5f.js +1 -0
  92. package/dist/client/static/js/{pieDiagram-5QR66LMP-pshd1j79.js → pieDiagram-5QR66LMP-nrv2t5yn.js} +2 -2
  93. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-cvvvmtk2.js → quadrantDiagram-O4NWA36T-3nt63xr8.js} +1 -1
  94. package/dist/client/static/js/radar-RG4KPBEZ-8rqadb58.js +1 -0
  95. package/dist/client/static/js/railroad-74A4TZTK-v6ppm8dy.js +1 -0
  96. package/dist/client/static/js/railroad-abnf-HS5TGJTU-9j6bae14.js +1 -0
  97. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-56cpyt0g.js +1 -0
  98. package/dist/client/static/js/railroad-peg-WCYAUIDC-yfdmspf4.js +1 -0
  99. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-h53p3sha.js → railroadDiagram-XR7U4H2S-evm05hzp.js} +1 -1
  100. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-bdv2fkxd.js → requirementDiagram-PLB6GJNP-tzrcmktj.js} +1 -1
  101. package/dist/client/static/js/{ruby-8pxcn21w.js → ruby-s2bqr910.js} +1 -1
  102. package/dist/client/static/js/{rust-j80dxgjg.js → rust-pcvgybk3.js} +1 -1
  103. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-xqnnvmhy.js → sankeyDiagram-IPEJSGJF-jvjd5rz8.js} +1 -1
  104. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-3p67305f.js → sequenceDiagram-PO4LG4MO-0zvjwx29.js} +3 -3
  105. package/dist/client/static/js/{sizeCapture-INFHLROL-f87525h7.js → sizeCapture-INFHLROL-6t6g0edv.js} +1 -1
  106. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-e5st1fy3.js → stateDiagram-v2-GCMORJYK-nb13b23a.js} +1 -1
  107. package/dist/client/static/js/{swimlanes-2SLR337P-ceghkbez.js → swimlanes-2SLR337P-ef8vmg6f.js} +1 -1
  108. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-vc8hvfya.js → swimlanesDiagram-TC7HE7FX-f4sx355z.js} +1 -1
  109. package/dist/client/static/js/{timeline-definition-EJHVYXUP-f7evs443.js → timeline-definition-EJHVYXUP-3bfph698.js} +3 -3
  110. package/dist/client/static/js/treeView-Q6P3EWNA-vwpg3wp8.js +1 -0
  111. package/dist/client/static/js/treemap-WGGIJYW6-htfxwd32.js +1 -0
  112. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-0gpn21p7.js → usecaseDiagram-POWQR4AR-vj6yj6tc.js} +7 -7
  113. package/dist/client/static/js/{vennDiagram-UO4OBE2U-4spzy428.js → vennDiagram-UO4OBE2U-9xyyabaq.js} +2 -2
  114. package/dist/client/static/js/{vue-xm1dxpmy.js → vue-cbqm4bed.js} +1 -1
  115. package/dist/client/static/js/wardley-WFR3VGLG-hapfjkzq.js +1 -0
  116. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-745xr2pa.js → wardleyDiagram-VNRHLVJA-zpcwgv9d.js} +2 -2
  117. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-7dr9qwx5.js → xychartDiagram-PMCCYNJV-pdr2rms2.js} +3 -3
  118. package/package.json +1 -1
  119. package/src/cli/lib/commands/session.js +12 -1
  120. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +14 -123
  121. package/src/client/components/workspace/chat-timeline/OrchestrationNotice.tsx +214 -0
  122. package/src/client/components/workspace/chat-timeline/UserTurn.test.tsx +126 -0
  123. package/src/client/components/workspace/chat-timeline/UserTurn.tsx +183 -0
  124. package/src/client/hooks/chat/timeline/composer-modes.ts +10 -7
  125. package/src/client/hooks/chat/timeline/plan-review-republish.test.ts +121 -0
  126. package/src/client/hooks/chat/timeline/plan-review.ts +12 -3
  127. package/src/server/lib/harness/acp/acp-audit.server.ts +1 -1
  128. package/src/server/lib/harness/acp/session-exit.ts +39 -5
  129. package/src/server/lib/harness/acp/session-turns.ts +67 -12
  130. package/src/server/lib/harness/acp/session.test.ts +61 -0
  131. package/src/server/lib/harness/acp/session.ts +15 -25
  132. package/src/server/lib/harness/acp/turn-outcome.server.test.ts +97 -0
  133. package/src/server/lib/harness/acp/turn-outcome.server.ts +71 -0
  134. package/src/server/lib/harness/acp/turn-silence.ts +52 -0
  135. package/src/server/lib/harness/acp/turn.test.ts +85 -3
  136. package/src/server/lib/harness/acp/turn.ts +62 -4
  137. package/src/server/lib/lifecycle/after-listen.ts +10 -0
  138. package/src/server/lib/omp/rpc/frame-fold-contract.ts +21 -0
  139. package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +4 -0
  140. package/src/server/lib/omp/rpc/frame-fold.ts +25 -2
  141. package/src/server/lib/omp/rpc/manager.ts +9 -8
  142. package/src/server/lib/omp/rpc/retry-saga.ts +54 -0
  143. package/src/server/lib/omp/rpc/run-settle.server.ts +38 -5
  144. package/src/server/lib/omp/rpc/run-settle.test.ts +5 -2
  145. package/src/server/lib/omp/rpc/session-commands-dialog.test.ts +6 -20
  146. package/src/server/lib/omp/rpc/session-commands-mapping.test.ts +131 -0
  147. package/src/server/lib/omp/rpc/session-commands.test.ts +95 -116
  148. package/src/server/lib/omp/rpc/session-commands.ts +38 -17
  149. package/src/server/lib/omp/rpc/terminal-settle.test.ts +223 -0
  150. package/src/server/lib/omp/rpc/terminal-settle.ts +127 -29
  151. package/src/server/lib/sessions/notify.server.test.ts +11 -3
  152. package/src/server/lib/sessions/notify.server.ts +67 -42
  153. package/src/server/lib/sessions/spawn.server.test.ts +5 -1
  154. package/src/server/lib/sessions/spawn.server.ts +8 -3
  155. package/src/server/routes/sessions/answer.test.ts +62 -0
  156. package/src/server/routes/sessions/answer.ts +13 -2
  157. package/src/shared/lib/chat/composer/delegation.ts +11 -7
  158. package/src/shared/lib/chat/export-markdown.ts +19 -0
  159. package/src/shared/lib/chat/orchestration/notice.test.ts +118 -0
  160. package/src/shared/lib/chat/orchestration/notice.ts +183 -0
  161. package/src/shared/lib/chat/timeline/omp-callbacks.ts +6 -1
  162. package/src/shared/lib/icons/tint-hues.generated.ts +36 -36
  163. package/dist/client/static/js/architecture-7GRP2DOG-9q06651f.js +0 -1
  164. package/dist/client/static/js/cynefin-OW5HDTMX-w7a38g4g.js +0 -1
  165. package/dist/client/static/js/eventmodeling-NTZA5JFV-6wrjccyw.js +0 -1
  166. package/dist/client/static/js/flowDiagram-KWPJA3E3-19vjkg84.js +0 -1
  167. package/dist/client/static/js/gitGraph-4MIJSDKK-4je2p50v.js +0 -1
  168. package/dist/client/static/js/html-bwyt0ayy.js +0 -1
  169. package/dist/client/static/js/info-A6RAGUB7-k0z5qdew.js +0 -1
  170. package/dist/client/static/js/one-dark-pro-9tt0a020.js +0 -1
  171. package/dist/client/static/js/one-light-5fg4r0ra.js +0 -1
  172. package/dist/client/static/js/packet-AYTQ26CC-6cnvmb2z.js +0 -1
  173. package/dist/client/static/js/pie-WAS4IAKB-m9z1mztn.js +0 -1
  174. package/dist/client/static/js/radar-RG4KPBEZ-8m9rkex6.js +0 -1
  175. package/dist/client/static/js/railroad-74A4TZTK-wc55emj8.js +0 -1
  176. package/dist/client/static/js/railroad-abnf-HS5TGJTU-2y2rnrzq.js +0 -1
  177. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-zzcc9x0v.js +0 -1
  178. package/dist/client/static/js/railroad-peg-WCYAUIDC-z82na5nb.js +0 -1
  179. package/dist/client/static/js/treeView-Q6P3EWNA-kzh6cm3f.js +0 -1
  180. package/dist/client/static/js/treemap-WGGIJYW6-wz5ed560.js +0 -1
  181. package/dist/client/static/js/wardley-WFR3VGLG-zewbfccz.js +0 -1
@@ -1,4 +1,4 @@
1
- import{t,l,V,C,ee,R,F,z,P,U,q,j,p,h,K,Sp,ft,Ze,Xe,Ur,Rt,Ft,Lt,gt}from"./index-13dr1t1r.js";import{yn}from"./index-czagykbq.js";var ks={};yn(ks,{default:()=>dt});var Ms={};yn(Ms,{default:()=>He});var Bs={};yn(Bs,{default:()=>ri});var df=typeof global=="object"&&global&&global.Object===Object&&global,bs=df;var pf=typeof self=="object"&&self&&self.Object===Object&&self,mf=bs||pf||Function("return this")(),pe=mf;var gf=pe.Symbol,Oe=gf;var to=Object.prototype,{hasOwnProperty:Tf,toString:Ef}=to,es=Oe?Oe.toStringTag:void 0;function yf(e){var r=Tf.call(e,es),s=e[es];try{e[es]=void 0;var n=!0}catch(o){}var i=Ef.call(e);if(n)if(r)e[es]=s;else delete e[es];return i}var ro=yf;var Af=Object.prototype,xf=Af.toString;function Sf(e){return xf.call(e)}var so=Sf;var Rf="[object Null]",Of="[object Undefined]",no=Oe?Oe.toStringTag:void 0;function Lf(e){if(e==null)return e===void 0?Of:Rf;return no&&no in Object(e)?ro(e):so(e)}var Pe=Lf;function If(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}var ne=If;var Nf="[object AsyncFunction]",bf="[object Function]",Cf="[object GeneratorFunction]",vf="[object Proxy]";function kf(e){if(!ne(e))return!1;var r=Pe(e);return r==bf||r==Cf||r==Nf||r==vf}var Ue=kf;var _f=pe["__core-js_shared__"],Cs=_f;var io=function(){var e=/[^.]+$/.exec(Cs&&Cs.keys&&Cs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Mf(e){return!!io&&io in e}var oo=Mf;var wf=Function.prototype,Pf=wf.toString;function Uf(e){if(e!=null){try{return Pf.call(e)}catch(r){}try{return e+""}catch(r){}}return""}var It=Uf;var Df=/[\\^$.*+?()[\]{}|]/g,Ff=/^\[object .+?Constructor\]$/,Bf=Function.prototype,$f=Object.prototype,Gf=Bf.toString,Wf=$f.hasOwnProperty,jf=RegExp("^"+Gf.call(Wf).replace(Df,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(e){if(!ne(e)||oo(e))return!1;var r=Ue(e)?jf:Ff;return r.test(It(e))}var ao=Kf;function zf(e,r){return e==null?void 0:e[r]}var lo=zf;function Vf(e,r){var s=lo(e,r);return ao(s)?s:void 0}var $e=Vf;var Hf=function(){try{var e=$e(Object,"defineProperty");return e({},"",{}),e}catch(r){}}(),hr=Hf;function Yf(e,r,s){if(r=="__proto__"&&hr)hr(e,r,{configurable:!0,enumerable:!0,value:s,writable:!0});else e[r]=s}var dr=Yf;function Xf(e,r){return e===r||e!==e&&r!==r}var ct=Xf;var qf=Object.prototype,Jf=qf.hasOwnProperty;function Zf(e,r,s){var n=e[r];if(!(Jf.call(e,r)&&ct(n,s))||s===void 0&&!(r in e))dr(e,r,s)}var Pt=Zf;function Qf(e,r,s,n){var i=!s;s||(s={});var o=-1,c=r.length;while(++o<c){var u=r[o],a=n?n(s[u],e[u],u,s,e):void 0;if(a===void 0)a=e[u];if(i)dr(s,u,a);else Pt(s,u,a)}return s}var ut=Qf;function eh(e){return e}var st=eh;function th(e,r,s){switch(s.length){case 0:return e.call(r);case 1:return e.call(r,s[0]);case 2:return e.call(r,s[0],s[1]);case 3:return e.call(r,s[0],s[1],s[2])}return e.apply(r,s)}var co=th;var uo=Math.max;function rh(e,r,s){return r=uo(r===void 0?e.length-1:r,0),function(){var n=arguments,i=-1,o=uo(n.length-r,0),c=Array(o);while(++i<o)c[i]=n[r+i];i=-1;var u=Array(r+1);while(++i<r)u[i]=n[i];return u[r]=s(c),co(e,this,u)}}var fo=rh;function sh(e){return function(){return e}}var ho=sh;var nh=!hr?st:function(e,r){return hr(e,"toString",{configurable:!0,enumerable:!1,value:ho(r),writable:!0})},po=nh;var ih=800,oh=16,ah=Date.now;function lh(e){var r=0,s=0;return function(){var n=ah(),i=oh-(n-s);if(s=n,i>0){if(++r>=ih)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}var mo=lh;var ch=mo(po),go=ch;function uh(e,r){return go(fo(e,r,st),e+"")}var pr=uh;var fh=9007199254740991;function hh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=fh}var mr=hh;function dh(e){return e!=null&&mr(e.length)&&!Ue(e)}var me=dh;var ph=9007199254740991,mh=/^(?:0|[1-9]\d*)$/;function gh(e,r){var s=typeof e;return r=r==null?ph:r,!!r&&(s=="number"||s!="symbol"&&mh.test(e))&&(e>-1&&e%1==0&&e<r)}var Ut=gh;function Th(e,r,s){if(!ne(s))return!1;var n=typeof r;if(n=="number"?me(s)&&Ut(r,s.length):n=="string"&&(r in s))return ct(s[r],e);return!1}var Dt=Th;function Eh(e){return pr(function(r,s){var n=-1,i=s.length,o=i>1?s[i-1]:void 0,c=i>2?s[2]:void 0;if(o=e.length>3&&typeof o=="function"?(i--,o):void 0,c&&Dt(s[0],s[1],c))o=i<3?void 0:o,i=1;r=Object(r);while(++n<i){var u=s[n];if(u)e(r,u,n,o)}return r})}var To=Eh;var yh=Object.prototype;function Ah(e){var r=e&&e.constructor,s=typeof r=="function"&&r.prototype||yh;return e===s}var ht=Ah;function xh(e,r){var s=-1,n=Array(e);while(++s<e)n[s]=r(s);return n}var Eo=xh;function Sh(e){return e!=null&&typeof e=="object"}var ue=Sh;var Rh="[object Arguments]";function Oh(e){return ue(e)&&Pe(e)==Rh}var Qn=Oh;var yo=Object.prototype,{hasOwnProperty:Lh,propertyIsEnumerable:Ih}=yo,Nh=Qn(function(){return arguments}())?Qn:function(e){return ue(e)&&Lh.call(e,"callee")&&!Ih.call(e,"callee")},Bt=Nh;var bh=Array.isArray,L=bh;function Ch(){return!1}var Ao=Ch;var Ro=typeof ks=="object"&&ks&&!ks.nodeType&&ks,xo=Ro&&typeof vs=="object"&&vs&&!vs.nodeType&&vs,vh=xo&&xo.exports===Ro,So=vh?pe.Buffer:void 0,kh=So?So.isBuffer:void 0,_h=kh||Ao,dt=_h;var Mh="[object Arguments]",wh="[object Array]",Ph="[object Boolean]",Uh="[object Date]",Dh="[object Error]",Fh="[object Function]",Bh="[object Map]",$h="[object Number]",Gh="[object Object]",Wh="[object RegExp]",jh="[object Set]",Kh="[object String]",zh="[object WeakMap]",Vh="[object ArrayBuffer]",Hh="[object DataView]",Yh="[object Float32Array]",Xh="[object Float64Array]",qh="[object Int8Array]",Jh="[object Int16Array]",Zh="[object Int32Array]",Qh="[object Uint8Array]",ed="[object Uint8ClampedArray]",td="[object Uint16Array]",rd="[object Uint32Array]",X={};X[Yh]=X[Xh]=X[qh]=X[Jh]=X[Zh]=X[Qh]=X[ed]=X[td]=X[rd]=!0;X[Mh]=X[wh]=X[Vh]=X[Ph]=X[Hh]=X[Uh]=X[Dh]=X[Fh]=X[Bh]=X[$h]=X[Gh]=X[Wh]=X[jh]=X[Kh]=X[zh]=!1;function sd(e){return ue(e)&&mr(e.length)&&!!X[Pe(e)]}var Oo=sd;function nd(e){return function(r){return e(r)}}var pt=nd;var Lo=typeof Ms=="object"&&Ms&&!Ms.nodeType&&Ms,ts=Lo&&typeof _s=="object"&&_s&&!_s.nodeType&&_s,id=ts&&ts.exports===Lo,ei=id&&bs.process,od=function(){try{var e=ts&&ts.require&&ts.require("util").types;if(e)return e;return ei&&ei.binding&&ei.binding("util")}catch(r){}}(),He=od;var Io=He&&He.isTypedArray,ad=Io?pt(Io):Oo,gr=ad;var ld=Object.prototype,cd=ld.hasOwnProperty;function ud(e,r){var s=L(e),n=!s&&Bt(e),i=!s&&!n&&dt(e),o=!s&&!n&&!i&&gr(e),c=s||n||i||o,u=c?Eo(e.length,String):[],a=u.length;for(var f in e)if((r||cd.call(e,f))&&!(c&&(f=="length"||i&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Ut(f,a))))u.push(f);return u}var ws=ud;function fd(e,r){return function(s){return e(r(s))}}var Ps=fd;var hd=Ps(Object.keys,Object),No=hd;var dd=Object.prototype,pd=dd.hasOwnProperty;function md(e){if(!ht(e))return No(e);var r=[];for(var s in Object(e))if(pd.call(e,s)&&s!="constructor")r.push(s);return r}var Us=md;function gd(e){return me(e)?ws(e):Us(e)}var W=gd;var Td=Object.prototype,Ed=Td.hasOwnProperty,yd=To(function(e,r){if(ht(r)||me(r)){ut(r,W(r),e);return}for(var s in r)if(Ed.call(r,s))Pt(e,s,r[s])}),Ne=yd;function Ad(){this.__data__=[],this.size=0}var bo=Ad;function xd(e,r){var s=e.length;while(s--)if(ct(e[s][0],r))return s;return-1}var $t=xd;var Sd=Array.prototype,Rd=Sd.splice;function Od(e){var r=this.__data__,s=$t(r,e);if(s<0)return!1;var n=r.length-1;if(s==n)r.pop();else Rd.call(r,s,1);return--this.size,!0}var Co=Od;function Ld(e){var r=this.__data__,s=$t(r,e);return s<0?void 0:r[s][1]}var vo=Ld;function Id(e){return $t(this.__data__,e)>-1}var ko=Id;function Nd(e,r){var s=this.__data__,n=$t(s,e);if(n<0)++this.size,s.push([e,r]);else s[n][1]=r;return this}var _o=Nd;function Tr(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}Tr.prototype.clear=bo;Tr.prototype.delete=Co;Tr.prototype.get=vo;Tr.prototype.has=ko;Tr.prototype.set=_o;var Gt=Tr;function bd(){this.__data__=new Gt,this.size=0}var Mo=bd;function Cd(e){var r=this.__data__,s=r.delete(e);return this.size=r.size,s}var wo=Cd;function vd(e){return this.__data__.get(e)}var Po=vd;function kd(e){return this.__data__.has(e)}var Uo=kd;var _d=$e(pe,"Map"),Wt=_d;var Md=$e(Object,"create"),Nt=Md;function wd(){this.__data__=Nt?Nt(null):{},this.size=0}var Do=wd;function Pd(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var Fo=Pd;var Ud="__lodash_hash_undefined__",Dd=Object.prototype,Fd=Dd.hasOwnProperty;function Bd(e){var r=this.__data__;if(Nt){var s=r[e];return s===Ud?void 0:s}return Fd.call(r,e)?r[e]:void 0}var Bo=Bd;var $d=Object.prototype,Gd=$d.hasOwnProperty;function Wd(e){var r=this.__data__;return Nt?r[e]!==void 0:Gd.call(r,e)}var $o=Wd;var jd="__lodash_hash_undefined__";function Kd(e,r){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Nt&&r===void 0?jd:r,this}var Go=Kd;function Er(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}Er.prototype.clear=Do;Er.prototype.delete=Fo;Er.prototype.get=Bo;Er.prototype.has=$o;Er.prototype.set=Go;var ti=Er;function zd(){this.size=0,this.__data__={hash:new ti,map:new(Wt||Gt),string:new ti}}var Wo=zd;function Vd(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}var jo=Vd;function Hd(e,r){var s=e.__data__;return jo(r)?s[typeof r=="string"?"string":"hash"]:s.map}var jt=Hd;function Yd(e){var r=jt(this,e).delete(e);return this.size-=r?1:0,r}var Ko=Yd;function Xd(e){return jt(this,e).get(e)}var zo=Xd;function qd(e){return jt(this,e).has(e)}var Vo=qd;function Jd(e,r){var s=jt(this,e),n=s.size;return s.set(e,r),this.size+=s.size==n?0:1,this}var Ho=Jd;function yr(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}yr.prototype.clear=Wo;yr.prototype.delete=Ko;yr.prototype.get=zo;yr.prototype.has=Vo;yr.prototype.set=Ho;var er=yr;var Zd=200;function Qd(e,r){var s=this.__data__;if(s instanceof Gt){var n=s.__data__;if(!Wt||n.length<Zd-1)return n.push([e,r]),this.size=++s.size,this;s=this.__data__=new er(n)}return s.set(e,r),this.size=s.size,this}var Yo=Qd;function Ar(e){var r=this.__data__=new Gt(e);this.size=r.size}Ar.prototype.clear=Mo;Ar.prototype.delete=wo;Ar.prototype.get=Po;Ar.prototype.has=Uo;Ar.prototype.set=Yo;var Kt=Ar;function ep(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(r(e[s],s,e)===!1)break;return e}var Ds=ep;function tp(e,r){return e&&ut(r,W(r),e)}var Xo=tp;function rp(e){var r=[];if(e!=null)for(var s in Object(e))r.push(s);return r}var qo=rp;var sp=Object.prototype,np=sp.hasOwnProperty;function ip(e){if(!ne(e))return qo(e);var r=ht(e),s=[];for(var n in e)if(!(n=="constructor"&&(r||!np.call(e,n))))s.push(n);return s}var Jo=ip;function op(e){return me(e)?ws(e,!0):Jo(e)}var zt=op;function ap(e,r){return e&&ut(r,zt(r),e)}var Zo=ap;var ra=typeof Bs=="object"&&Bs&&!Bs.nodeType&&Bs,Qo=ra&&typeof Fs=="object"&&Fs&&!Fs.nodeType&&Fs,lp=Qo&&Qo.exports===ra,ea=lp?pe.Buffer:void 0,ta=ea?ea.allocUnsafe:void 0;function cp(e,r){if(r)return e.slice();var s=e.length,n=ta?ta(s):new e.constructor(s);return e.copy(n),n}var ri=cp;function up(e,r){var s=-1,n=e.length;r||(r=Array(n));while(++s<n)r[s]=e[s];return r}var sa=up;function fp(e,r){var s=-1,n=e==null?0:e.length,i=0,o=[];while(++s<n){var c=e[s];if(r(c,s,e))o[i++]=c}return o}var xr=fp;function hp(){return[]}var $s=hp;var dp=Object.prototype,pp=dp.propertyIsEnumerable,na=Object.getOwnPropertySymbols,mp=!na?$s:function(e){if(e==null)return[];return e=Object(e),xr(na(e),function(r){return pp.call(e,r)})},Sr=mp;function gp(e,r){return ut(e,Sr(e),r)}var ia=gp;function Tp(e,r){var s=-1,n=r.length,i=e.length;while(++s<n)e[i+s]=r[s];return e}var Rr=Tp;var Ep=Ps(Object.getPrototypeOf,Object),Gs=Ep;var yp=Object.getOwnPropertySymbols,Ap=!yp?$s:function(e){var r=[];while(e)Rr(r,Sr(e)),e=Gs(e);return r},Ws=Ap;function xp(e,r){return ut(e,Ws(e),r)}var oa=xp;function Rp(e,r,s){var n=r(e);return L(e)?n:Rr(n,s(e))}var js=Rp;function Op(e){return js(e,W,Sr)}var rs=Op;function Lp(e){return js(e,zt,Ws)}var Ks=Lp;var Ip=$e(pe,"DataView"),zs=Ip;var Np=$e(pe,"Promise"),Vs=Np;var bp=$e(pe,"Set"),Vt=bp;var Cp=$e(pe,"WeakMap"),Hs=Cp;var aa="[object Map]",vp="[object Object]",la="[object Promise]",ca="[object Set]",ua="[object WeakMap]",fa="[object DataView]",kp=It(zs),_p=It(Wt),Mp=It(Vs),wp=It(Vt),Pp=It(Hs),tr=Pe;if(zs&&tr(new zs(new ArrayBuffer(1)))!=fa||Wt&&tr(new Wt)!=aa||Vs&&tr(Vs.resolve())!=la||Vt&&tr(new Vt)!=ca||Hs&&tr(new Hs)!=ua)tr=function(e){var r=Pe(e),s=r==vp?e.constructor:void 0,n=s?It(s):"";if(n)switch(n){case kp:return fa;case _p:return aa;case Mp:return la;case wp:return ca;case Pp:return ua}return r};var nt=tr;var Up=Object.prototype,Dp=Up.hasOwnProperty;function Fp(e){var r=e.length,s=new e.constructor(r);if(r&&typeof e[0]=="string"&&Dp.call(e,"index"))s.index=e.index,s.input=e.input;return s}var ha=Fp;var Bp=pe.Uint8Array,Or=Bp;function $p(e){var r=new e.constructor(e.byteLength);return new Or(r).set(new Or(e)),r}var Lr=$p;function Gp(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}var da=Gp;var Wp=/\w*$/;function jp(e){var r=new e.constructor(e.source,Wp.exec(e));return r.lastIndex=e.lastIndex,r}var pa=jp;var ma=Oe?Oe.prototype:void 0,ga=ma?ma.valueOf:void 0;function Kp(e){return ga?Object(ga.call(e)):{}}var Ta=Kp;function zp(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}var Ea=zp;var Vp="[object Boolean]",Hp="[object Date]",Yp="[object Map]",Xp="[object Number]",qp="[object RegExp]",Jp="[object Set]",Zp="[object String]",Qp="[object Symbol]",em="[object ArrayBuffer]",tm="[object DataView]",rm="[object Float32Array]",sm="[object Float64Array]",nm="[object Int8Array]",im="[object Int16Array]",om="[object Int32Array]",am="[object Uint8Array]",lm="[object Uint8ClampedArray]",cm="[object Uint16Array]",um="[object Uint32Array]";function fm(e,r,s){var n=e.constructor;switch(r){case em:return Lr(e);case Vp:case Hp:return new n(+e);case tm:return da(e,s);case rm:case sm:case nm:case im:case om:case am:case lm:case cm:case um:return Ea(e,s);case Yp:return new n;case Xp:case Zp:return new n(e);case qp:return pa(e);case Jp:return new n;case Qp:return Ta(e)}}var ya=fm;var Aa=Object.create,hm=function(){function e(){}return function(r){if(!ne(r))return{};if(Aa)return Aa(r);e.prototype=r;var s=new e;return e.prototype=void 0,s}}(),xa=hm;function dm(e){return typeof e.constructor=="function"&&!ht(e)?xa(Gs(e)):{}}var Sa=dm;var pm="[object Map]";function mm(e){return ue(e)&&nt(e)==pm}var Ra=mm;var Oa=He&&He.isMap,gm=Oa?pt(Oa):Ra,La=gm;var Tm="[object Set]";function Em(e){return ue(e)&&nt(e)==Tm}var Ia=Em;var Na=He&&He.isSet,ym=Na?pt(Na):Ia,ba=ym;var Am=1,xm=2,Sm=4,Ca="[object Arguments]",Rm="[object Array]",Om="[object Boolean]",Lm="[object Date]",Im="[object Error]",va="[object Function]",Nm="[object GeneratorFunction]",bm="[object Map]",Cm="[object Number]",ka="[object Object]",vm="[object RegExp]",km="[object Set]",_m="[object String]",Mm="[object Symbol]",wm="[object WeakMap]",Pm="[object ArrayBuffer]",Um="[object DataView]",Dm="[object Float32Array]",Fm="[object Float64Array]",Bm="[object Int8Array]",$m="[object Int16Array]",Gm="[object Int32Array]",Wm="[object Uint8Array]",jm="[object Uint8ClampedArray]",Km="[object Uint16Array]",zm="[object Uint32Array]",H={};H[Ca]=H[Rm]=H[Pm]=H[Um]=H[Om]=H[Lm]=H[Dm]=H[Fm]=H[Bm]=H[$m]=H[Gm]=H[bm]=H[Cm]=H[ka]=H[vm]=H[km]=H[_m]=H[Mm]=H[Wm]=H[jm]=H[Km]=H[zm]=!0;H[Im]=H[va]=H[wm]=!1;function Ys(e,r,s,n,i,o){var c,u=r&Am,a=r&xm,f=r&Sm;if(s)c=i?s(e,n,i,o):s(e);if(c!==void 0)return c;if(!ne(e))return e;var d=L(e);if(d){if(c=ha(e),!u)return sa(e,c)}else{var m=nt(e),g=m==va||m==Nm;if(dt(e))return ri(e,u);if(m==ka||m==Ca||g&&!i){if(c=a||g?{}:Sa(e),!u)return a?oa(e,Zo(c,e)):ia(e,Xo(c,e))}else{if(!H[m])return i?e:{};c=ya(e,m,u)}}o||(o=new Kt);var E=o.get(e);if(E)return E;if(o.set(e,c),ba(e))e.forEach(function(I){c.add(Ys(I,r,s,I,e,o))});else if(La(e))e.forEach(function(I,A){c.set(A,Ys(I,r,s,A,e,o))});var b=f?a?Ks:rs:a?zt:W,v=d?void 0:b(e);return Ds(v||e,function(I,A){if(v)A=I,I=e[A];Pt(c,A,Ys(I,r,s,A,e,o))}),c}var _a=Ys;var Vm=4;function Hm(e){return _a(e,Vm)}var Y=Hm;function Ym(e){var r=-1,s=e==null?0:e.length,n=0,i=[];while(++r<s){var o=e[r];if(o)i[n++]=o}return i}var mt=Ym;var Ma=Object.prototype,Xm=Ma.hasOwnProperty,qm=pr(function(e,r){e=Object(e);var s=-1,n=r.length,i=n>2?r[2]:void 0;if(i&&Dt(r[0],r[1],i))n=1;while(++s<n){var o=r[s],c=zt(o),u=-1,a=c.length;while(++u<a){var f=c[u],d=e[f];if(d===void 0||ct(d,Ma[f])&&!Xm.call(e,f))e[f]=o[f]}}return e}),Ir=qm;var Jm="__lodash_hash_undefined__";function Zm(e){return this.__data__.set(e,Jm),this}var wa=Zm;function Qm(e){return this.__data__.has(e)}var Pa=Qm;function Xs(e){var r=-1,s=e==null?0:e.length;this.__data__=new er;while(++r<s)this.add(e[r])}Xs.prototype.add=Xs.prototype.push=wa;Xs.prototype.has=Pa;var Nr=Xs;function eg(e,r,s,n){var i=e.length,o=s+(n?1:-1);while(n?o--:++o<i)if(r(e[o],o,e))return o;return-1}var qs=eg;function tg(e){return e!==e}var Ua=tg;function rg(e,r,s){var n=s-1,i=e.length;while(++n<i)if(e[n]===r)return n;return-1}var Da=rg;function sg(e,r,s){return r===r?Da(e,r,s):qs(e,Ua,s)}var br=sg;function ng(e,r){var s=e==null?0:e.length;return!!s&&br(e,r,0)>-1}var Js=ng;function ig(e,r,s){var n=-1,i=e==null?0:e.length;while(++n<i)if(s(r,e[n]))return!0;return!1}var Zs=ig;function og(e,r){var s=-1,n=e==null?0:e.length,i=Array(n);while(++s<n)i[s]=r(e[s],s,e);return i}var Tt=og;function ag(e,r){return e.has(r)}var Cr=ag;var lg=200;function cg(e,r,s,n){var i=-1,o=Js,c=!0,u=e.length,a=[],f=r.length;if(!u)return a;if(s)r=Tt(r,pt(s));if(n)o=Zs,c=!1;else if(r.length>=lg)o=Cr,c=!1,r=new Nr(r);e:while(++i<u){var d=e[i],m=s==null?d:s(d);if(d=n||d!==0?d:0,c&&m===m){var g=f;while(g--)if(r[g]===m)continue e;a.push(d)}else if(!o(r,m,n))a.push(d)}return a}var Fa=cg;var Ba=Oe?Oe.isConcatSpreadable:void 0;function ug(e){return L(e)||Bt(e)||!!(Ba&&e&&e[Ba])}var $a=ug;function Ga(e,r,s,n,i){var o=-1,c=e.length;s||(s=$a),i||(i=[]);while(++o<c){var u=e[o];if(r>0&&s(u))if(r>1)Ga(u,r-1,s,n,i);else Rr(i,u);else if(!n)i[i.length]=u}return i}var vr=Ga;function fg(e){return ue(e)&&me(e)}var si=fg;var hg=pr(function(e,r){return si(e)?Fa(e,vr(r,1,si,!0)):[]}),Ht=hg;function dg(e,r,s){var n=-1,i=e.length;if(r<0)r=-r>i?0:i+r;if(s=s>i?i:s,s<0)s+=i;i=r>s?0:s-r>>>0,r>>>=0;var o=Array(i);while(++n<i)o[n]=e[n+r];return o}var Qs=dg;var pg=/\s/;function mg(e){var r=e.length;while(r--&&pg.test(e.charAt(r)));return r}var Wa=mg;var gg=/^\s+/;function Tg(e){return e?e.slice(0,Wa(e)+1).replace(gg,""):e}var ja=Tg;var Eg="[object Symbol]";function yg(e){return typeof e=="symbol"||ue(e)&&Pe(e)==Eg}var Yt=yg;var Ka=NaN,Ag=/^[-+]0x[0-9a-f]+$/i,xg=/^0b[01]+$/i,Sg=/^0o[0-7]+$/i,Rg=parseInt;function Og(e){if(typeof e=="number")return e;if(Yt(e))return Ka;if(ne(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=ne(r)?r+"":r}if(typeof e!="string")return e===0?e:+e;e=ja(e);var s=xg.test(e);return s||Sg.test(e)?Rg(e.slice(2),s?2:8):Ag.test(e)?Ka:+e}var za=Og;var Va=1/0,Lg=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function Ig(e){if(!e)return e===0?e:0;if(e=za(e),e===Va||e===-Va){var r=e<0?-1:1;return r*Lg}return e===e?e:0}var Ha=Ig;function Ng(e){var r=Ha(e),s=r%1;return r===r?s?r-s:r:0}var Et=Ng;function bg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:Et(r),Qs(e,r<0?0:r,n)}var fe=bg;function Cg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:Et(r),r=n-r,Qs(e,0,r<0?0:r)}var bt=Cg;function vg(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(!r(e[s],s,e))return!1;return!0}var Ya=vg;function kg(e){return function(r,s,n){var i=-1,o=Object(r),c=n(r),u=c.length;while(u--){var a=c[e?u:++i];if(s(o[a],a,o)===!1)break}return r}}var Xa=kg;var _g=Xa(),qa=_g;function Mg(e,r){return e&&qa(e,r,W)}var Ja=Mg;function wg(e,r){return function(s,n){if(s==null)return s;if(!me(s))return e(s,n);var i=s.length,o=r?i:-1,c=Object(s);while(r?o--:++o<i)if(n(c[o],o,c)===!1)break;return s}}var Za=wg;var Pg=Za(Ja),Ge=Pg;function Ug(e,r){var s=!0;return Ge(e,function(n,i,o){return s=!!r(n,i,o),s}),s}var Qa=Ug;function Dg(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(r(e[s],s,e))return!0;return!1}var en=Dg;var Fg=1,Bg=2;function $g(e,r,s,n,i,o){var c=s&Fg,u=e.length,a=r.length;if(u!=a&&!(c&&a>u))return!1;var f=o.get(e),d=o.get(r);if(f&&d)return f==r&&d==e;var m=-1,g=!0,E=s&Bg?new Nr:void 0;o.set(e,r),o.set(r,e);while(++m<u){var b=e[m],v=r[m];if(n)var I=c?n(v,b,m,r,e,o):n(b,v,m,e,r,o);if(I!==void 0){if(I)continue;g=!1;break}if(E){if(!en(r,function(A,O){if(!Cr(E,O)&&(b===A||i(b,A,s,n,o)))return E.push(O)})){g=!1;break}}else if(!(b===v||i(b,v,s,n,o))){g=!1;break}}return o.delete(e),o.delete(r),g}var tn=$g;function Gg(e){var r=-1,s=Array(e.size);return e.forEach(function(n,i){s[++r]=[i,n]}),s}var el=Gg;function Wg(e){var r=-1,s=Array(e.size);return e.forEach(function(n){s[++r]=n}),s}var kr=Wg;var jg=1,Kg=2,zg="[object Boolean]",Vg="[object Date]",Hg="[object Error]",Yg="[object Map]",Xg="[object Number]",qg="[object RegExp]",Jg="[object Set]",Zg="[object String]",Qg="[object Symbol]",eT="[object ArrayBuffer]",tT="[object DataView]",tl=Oe?Oe.prototype:void 0,ni=tl?tl.valueOf:void 0;function rT(e,r,s,n,i,o,c){switch(s){case tT:if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case eT:if(e.byteLength!=r.byteLength||!o(new Or(e),new Or(r)))return!1;return!0;case zg:case Vg:case Xg:return ct(+e,+r);case Hg:return e.name==r.name&&e.message==r.message;case qg:case Zg:return e==r+"";case Yg:var u=el;case Jg:var a=n&jg;if(u||(u=kr),e.size!=r.size&&!a)return!1;var f=c.get(e);if(f)return f==r;n|=Kg,c.set(e,r);var d=tn(u(e),u(r),n,i,o,c);return c.delete(e),d;case Qg:if(ni)return ni.call(e)==ni.call(r)}return!1}var rl=rT;var sT=1,nT=Object.prototype,iT=nT.hasOwnProperty;function oT(e,r,s,n,i,o){var c=s&sT,u=rs(e),a=u.length,f=rs(r),d=f.length;if(a!=d&&!c)return!1;var m=a;while(m--){var g=u[m];if(!(c?g in r:iT.call(r,g)))return!1}var E=o.get(e),b=o.get(r);if(E&&b)return E==r&&b==e;var v=!0;o.set(e,r),o.set(r,e);var I=c;while(++m<a){g=u[m];var A=e[g],O=r[g];if(n)var T=c?n(O,A,g,r,e,o):n(A,O,g,e,r,o);if(!(T===void 0?A===O||i(A,O,s,n,o):T)){v=!1;break}I||(I=g=="constructor")}if(v&&!I){var _=e.constructor,Q=r.constructor;if(_!=Q&&(("constructor"in e)&&("constructor"in r))&&!(typeof _=="function"&&_ instanceof _&&typeof Q=="function"&&Q instanceof Q))v=!1}return o.delete(e),o.delete(r),v}var sl=oT;var aT=1,nl="[object Arguments]",il="[object Array]",rn="[object Object]",lT=Object.prototype,ol=lT.hasOwnProperty;function cT(e,r,s,n,i,o){var c=L(e),u=L(r),a=c?il:nt(e),f=u?il:nt(r);a=a==nl?rn:a,f=f==nl?rn:f;var d=a==rn,m=f==rn,g=a==f;if(g&&dt(e)){if(!dt(r))return!1;c=!0,d=!1}if(g&&!d)return o||(o=new Kt),c||gr(e)?tn(e,r,s,n,i,o):rl(e,r,a,s,n,i,o);if(!(s&aT)){var E=d&&ol.call(e,"__wrapped__"),b=m&&ol.call(r,"__wrapped__");if(E||b){var v=E?e.value():e,I=b?r.value():r;return o||(o=new Kt),i(v,I,s,n,o)}}if(!g)return!1;return o||(o=new Kt),sl(e,r,s,n,i,o)}var al=cT;function ll(e,r,s,n,i){if(e===r)return!0;if(e==null||r==null||!ue(e)&&!ue(r))return e!==e&&r!==r;return al(e,r,s,n,ll,i)}var sn=ll;var uT=1,fT=2;function hT(e,r,s,n){var i=s.length,o=i,c=!n;if(e==null)return!o;e=Object(e);while(i--){var u=s[i];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}while(++i<o){u=s[i];var a=u[0],f=e[a],d=u[1];if(c&&u[2]){if(f===void 0&&!(a in e))return!1}else{var m=new Kt;if(n)var g=n(f,d,a,e,r,m);if(!(g===void 0?sn(d,f,uT|fT,n,m):g))return!1}}return!0}var cl=hT;function dT(e){return e===e&&!ne(e)}var nn=dT;function pT(e){var r=W(e),s=r.length;while(s--){var n=r[s],i=e[n];r[s]=[n,i,nn(i)]}return r}var ul=pT;function mT(e,r){return function(s){if(s==null)return!1;return s[e]===r&&(r!==void 0||(e in Object(s)))}}var on=mT;function gT(e){var r=ul(e);if(r.length==1&&r[0][2])return on(r[0][0],r[0][1]);return function(s){return s===e||cl(s,e,r)}}var fl=gT;var TT=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ET=/^\w*$/;function yT(e,r){if(L(e))return!1;var s=typeof e;if(s=="number"||s=="symbol"||s=="boolean"||e==null||Yt(e))return!0;return ET.test(e)||!TT.test(e)||r!=null&&e in Object(r)}var _r=yT;var AT="Expected a function";function ii(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw TypeError(AT);var s=function(){var n=arguments,i=r?r.apply(this,n):n[0],o=s.cache;if(o.has(i))return o.get(i);var c=e.apply(this,n);return s.cache=o.set(i,c)||o,c};return s.cache=new(ii.Cache||er),s}ii.Cache=er;var hl=ii;var xT=500;function ST(e){var r=hl(e,function(n){if(s.size===xT)s.clear();return n}),s=r.cache;return r}var dl=ST;var RT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,OT=/\\(\\)?/g,LT=dl(function(e){var r=[];if(e.charCodeAt(0)===46)r.push("");return e.replace(RT,function(s,n,i,o){r.push(i?o.replace(OT,"$1"):n||s)}),r}),pl=LT;var IT=1/0,ml=Oe?Oe.prototype:void 0,gl=ml?ml.toString:void 0;function Tl(e){if(typeof e=="string")return e;if(L(e))return Tt(e,Tl)+"";if(Yt(e))return gl?gl.call(e):"";var r=e+"";return r=="0"&&1/e==-IT?"-0":r}var El=Tl;function NT(e){return e==null?"":El(e)}var yl=NT;function bT(e,r){if(L(e))return e;return _r(e,r)?[e]:pl(yl(e))}var Xt=bT;var CT=1/0;function vT(e){if(typeof e=="string"||Yt(e))return e;var r=e+"";return r=="0"&&1/e==-CT?"-0":r}var yt=vT;function kT(e,r){r=Xt(r,e);var s=0,n=r.length;while(e!=null&&s<n)e=e[yt(r[s++])];return s&&s==n?e:void 0}var Mr=kT;function _T(e,r,s){var n=e==null?void 0:Mr(e,r);return n===void 0?s:n}var Al=_T;function MT(e,r){return e!=null&&r in Object(e)}var xl=MT;function wT(e,r,s){r=Xt(r,e);var n=-1,i=r.length,o=!1;while(++n<i){var c=yt(r[n]);if(!(o=e!=null&&s(e,c)))break;e=e[c]}if(o||++n!=i)return o;return i=e==null?0:e.length,!!i&&mr(i)&&Ut(c,i)&&(L(e)||Bt(e))}var an=wT;function PT(e,r){return e!=null&&an(e,r,xl)}var Sl=PT;var UT=1,DT=2;function FT(e,r){if(_r(e)&&nn(r))return on(yt(e),r);return function(s){var n=Al(s,e);return n===void 0&&n===r?Sl(s,e):sn(r,n,UT|DT)}}var Rl=FT;function BT(e){return function(r){return r==null?void 0:r[e]}}var Ol=BT;function $T(e){return function(r){return Mr(r,e)}}var Ll=$T;function GT(e){return _r(e)?Ol(yt(e)):Ll(e)}var Il=GT;function WT(e){if(typeof e=="function")return e;if(e==null)return st;if(typeof e=="object")return L(e)?Rl(e[0],e[1]):fl(e);return Il(e)}var ge=WT;function jT(e,r,s){var n=L(e)?Ya:Qa;if(s&&Dt(e,r,s))r=void 0;return n(e,ge(r,3))}var ve=jT;function KT(e,r){var s=[];return Ge(e,function(n,i,o){if(r(n,i,o))s.push(n)}),s}var ln=KT;function zT(e,r){var s=L(e)?xr:ln;return s(e,ge(r,3))}var ke=zT;function VT(e){return function(r,s,n){var i=Object(r);if(!me(r)){var o=ge(s,3);r=W(r),s=function(u){return o(i[u],u,i)}}var c=e(r,s,n);return c>-1?i[o?r[c]:c]:void 0}}var Nl=VT;var HT=Math.max;function YT(e,r,s){var n=e==null?0:e.length;if(!n)return-1;var i=s==null?0:Et(s);if(i<0)i=HT(n+i,0);return qs(e,ge(r,3),i)}var bl=YT;var XT=Nl(bl),At=XT;function qT(e){return e&&e.length?e[0]:void 0}var Le=qT;function JT(e,r){var s=-1,n=me(e)?Array(e.length):[];return Ge(e,function(i,o,c){n[++s]=r(i,o,c)}),n}var Cl=JT;function ZT(e,r){var s=L(e)?Tt:Cl;return s(e,ge(r,3))}var y=ZT;function QT(e,r){return vr(y(e,r),1)}var De=QT;function eE(e){var r=e==null?0:e.length;return r?vr(e,1):[]}var xe=eE;function tE(e){return typeof e=="function"?e:st}var vl=tE;function rE(e,r){var s=L(e)?Ds:Ge;return s(e,vl(r))}var x=rE;function sE(e,r,s,n){var i=-1,o=e==null?0:e.length;while(++i<o){var c=e[i];r(n,c,s(c),e)}return n}var kl=sE;function nE(e,r,s,n){return Ge(e,function(i,o,c){r(n,i,s(i),c)}),n}var _l=nE;function iE(e,r){return function(s,n){var i=L(s)?kl:_l,o=r?r():{};return i(s,e,ge(n,2),o)}}var Ml=iE;var oE=Object.prototype,aE=oE.hasOwnProperty,lE=Ml(function(e,r,s){if(aE.call(e,s))e[s].push(r);else dr(e,s,[r])}),oi=lE;var cE=Object.prototype,uE=cE.hasOwnProperty;function fE(e,r){return e!=null&&uE.call(e,r)}var wl=fE;function hE(e,r){return e!=null&&an(e,r,wl)}var S=hE;var dE="[object String]";function pE(e){return typeof e=="string"||!L(e)&&ue(e)&&Pe(e)==dE}var Se=pE;function mE(e,r){return Tt(r,function(s){return e[s]})}var Pl=mE;function gE(e){return e==null?[]:Pl(e,W(e))}var G=gE;var TE=Math.max;function EE(e,r,s,n){e=me(e)?e:G(e),s=s&&!n?Et(s):0;var i=e.length;if(s<0)s=TE(i+s,0);return Se(e)?s<=i&&e.indexOf(r,s)>-1:!!i&&br(e,r,s)>-1}var te=EE;var yE=Math.max;function AE(e,r,s){var n=e==null?0:e.length;if(!n)return-1;var i=s==null?0:Et(s);if(i<0)i=yE(n+i,0);return br(e,r,i)}var cn=AE;var xE="[object Map]",SE="[object Set]",RE=Object.prototype,OE=RE.hasOwnProperty;function LE(e){if(e==null)return!0;if(me(e)&&(L(e)||typeof e=="string"||typeof e.splice=="function"||dt(e)||gr(e)||Bt(e)))return!e.length;var r=nt(e);if(r==xE||r==SE)return!e.size;if(ht(e))return!Us(e).length;for(var s in e)if(OE.call(e,s))return!1;return!0}var M=LE;var IE="[object RegExp]";function NE(e){return ue(e)&&Pe(e)==IE}var Ul=NE;var Dl=He&&He.isRegExp,bE=Dl?pt(Dl):Ul,Je=bE;function CE(e){return e===void 0}var _e=CE;function vE(e){var r=e==null?0:e.length;return r?e[r-1]:void 0}var it=vE;function kE(){}var le=kE;function _E(e,r,s,n){if(!ne(e))return e;r=Xt(r,e);var i=-1,o=r.length,c=o-1,u=e;while(u!=null&&++i<o){var a=yt(r[i]),f=s;if(a==="__proto__"||a==="constructor"||a==="prototype")return e;if(i!=c){var d=u[a];if(f=n?n(d,a,u):void 0,f===void 0)f=ne(d)?d:Ut(r[i+1])?[]:{}}Pt(u,a,f),u=u[a]}return e}var Fl=_E;function ME(e,r,s){var n=-1,i=r.length,o={};while(++n<i){var c=r[n],u=Mr(e,c);if(s(u,c))Fl(o,Xt(c,e),u)}return o}var Bl=ME;function wE(e,r){if(e==null)return{};var s=Tt(Ks(e),function(n){return[n]});return r=ge(r),Bl(e,s,function(n,i){return r(n,i[0])})}var We=wE;function PE(e,r,s,n){var i=-1,o=e==null?0:e.length;if(n&&o)s=e[++i];while(++i<o)s=r(s,e[i],i,e);return s}var $l=PE;function UE(e,r,s,n,i){return i(e,function(o,c,u){s=n?(n=!1,o):r(s,o,c,u)}),s}var Gl=UE;function DE(e,r,s){var n=L(e)?$l:Gl,i=arguments.length<3;return n(e,ge(r,4),s,i,Ge)}var Te=DE;var FE="Expected a function";function BE(e){if(typeof e!="function")throw TypeError(FE);return function(){var r=arguments;switch(r.length){case 0:return!e.call(this);case 1:return!e.call(this,r[0]);case 2:return!e.call(this,r[0],r[1]);case 3:return!e.call(this,r[0],r[1],r[2])}return!e.apply(this,r)}}var Wl=BE;function $E(e,r){var s=L(e)?xr:ln;return s(e,Wl(ge(r,3)))}var qt=$E;function GE(e,r){var s;return Ge(e,function(n,i,o){return s=r(n,i,o),!s}),!!s}var jl=GE;function WE(e,r,s){var n=L(e)?en:jl;if(s&&Dt(e,r,s))r=void 0;return n(e,ge(r,3))}var ss=WE;var jE=1/0,KE=!(Vt&&1/kr(new Vt([,-0]))[1]==jE)?le:function(e){return new Vt(e)},Kl=KE;var zE=200;function VE(e,r,s){var n=-1,i=Js,o=e.length,c=!0,u=[],a=u;if(s)c=!1,i=Zs;else if(o>=zE){var f=r?null:Kl(e);if(f)return kr(f);c=!1,i=Cr,a=new Nr}else a=r?[]:u;e:while(++n<o){var d=e[n],m=r?r(d):d;if(d=s||d!==0?d:0,c&&m===m){var g=a.length;while(g--)if(a[g]===m)continue e;if(r)a.push(m);u.push(d)}else if(!i(a,m,s)){if(a!==u)a.push(m);u.push(d)}}return u}var zl=VE;function HE(e){return e&&e.length?zl(e):[]}var wr=HE;function Pr(e){if(console&&console.error)console.error(`Error: ${e}`)}function ns(e){if(console&&console.warn)console.warn(`Warning: ${e}`)}function is(e){let r=new Date().getTime(),s=e();return{time:new Date().getTime()-r,value:s}}function os(e){function r(){}r.prototype=e;let s=new r;function n(){return typeof s.bar}return n(),n(),e;(0,eval)(e)}function YE(e){if(XE(e))return e.LABEL;else return e.name}function XE(e){return Se(e.LABEL)&&e.LABEL!==""}class Qe{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),x(this.definition,(r)=>{r.accept(e)})}}class J extends Qe{constructor(e){super([]);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}set definition(e){}get definition(){if(this.referencedRule!==void 0)return this.referencedRule.definition;return[]}accept(e){e.visit(this)}}class je extends Qe{constructor(e){super(e.definition);this.orgText="",Ne(this,We(e,(r)=>r!==void 0))}}class Z extends Qe{constructor(e){super(e.definition);this.ignoreAmbiguities=!1,Ne(this,We(e,(r)=>r!==void 0))}}class re extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class Ee extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class ye extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class B extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class he extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class de extends Qe{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,Ne(this,We(e,(r)=>r!==void 0))}}class w{constructor(e){this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}accept(e){e.visit(this)}}function un(e){return y(e,Dr)}function Dr(e){function r(s){return y(s,Dr)}if(e instanceof J){let s={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};if(Se(e.label))s.label=e.label;return s}else if(e instanceof Z)return{type:"Alternative",definition:r(e.definition)};else if(e instanceof re)return{type:"Option",idx:e.idx,definition:r(e.definition)};else if(e instanceof Ee)return{type:"RepetitionMandatory",idx:e.idx,definition:r(e.definition)};else if(e instanceof ye)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:Dr(new w({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof he)return{type:"RepetitionWithSeparator",idx:e.idx,separator:Dr(new w({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof B)return{type:"Repetition",idx:e.idx,definition:r(e.definition)};else if(e instanceof de)return{type:"Alternation",idx:e.idx,definition:r(e.definition)};else if(e instanceof w){let s={type:"Terminal",name:e.terminalType.name,label:YE(e.terminalType),idx:e.idx};if(Se(e.label))s.terminalLabel=e.label;let n=e.terminalType.PATTERN;if(e.terminalType.PATTERN)s.pattern=Je(n)?n.source:n;return s}else if(e instanceof je)return{type:"Rule",name:e.name,orgText:e.orgText,definition:r(e.definition)};else throw Error("non exhaustive match")}class Ke{visit(e){let r=e;switch(r.constructor){case J:return this.visitNonTerminal(r);case Z:return this.visitAlternative(r);case re:return this.visitOption(r);case Ee:return this.visitRepetitionMandatory(r);case ye:return this.visitRepetitionMandatoryWithSeparator(r);case he:return this.visitRepetitionWithSeparator(r);case B:return this.visitRepetition(r);case de:return this.visitAlternation(r);case w:return this.visitTerminal(r);case je:return this.visitRule(r);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 ai(e){return e instanceof Z||e instanceof re||e instanceof B||e instanceof Ee||e instanceof ye||e instanceof he||e instanceof w||e instanceof je}function rr(e,r=[]){if(e instanceof re||e instanceof B||e instanceof he)return!0;if(e instanceof de)return ss(e.definition,(n)=>rr(n,r));else if(e instanceof J&&te(r,e))return!1;else if(e instanceof Qe){if(e instanceof J)r.push(e);return ve(e.definition,(n)=>rr(n,r))}else return!1}function li(e){return e instanceof de}function ze(e){if(e instanceof J)return"SUBRULE";else if(e instanceof re)return"OPTION";else if(e instanceof de)return"OR";else if(e instanceof Ee)return"AT_LEAST_ONE";else if(e instanceof ye)return"AT_LEAST_ONE_SEP";else if(e instanceof he)return"MANY_SEP";else if(e instanceof B)return"MANY";else if(e instanceof w)return"CONSUME";else throw Error("non exhaustive match")}class Jt{walk(e,r=[]){x(e.definition,(s,n)=>{let i=fe(e.definition,n+1);if(s instanceof J)this.walkProdRef(s,i,r);else if(s instanceof w)this.walkTerminal(s,i,r);else if(s instanceof Z)this.walkFlat(s,i,r);else if(s instanceof re)this.walkOption(s,i,r);else if(s instanceof Ee)this.walkAtLeastOne(s,i,r);else if(s instanceof ye)this.walkAtLeastOneSep(s,i,r);else if(s instanceof he)this.walkManySep(s,i,r);else if(s instanceof B)this.walkMany(s,i,r);else if(s instanceof de)this.walkOr(s,i,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,s){}walkProdRef(e,r,s){}walkFlat(e,r,s){let n=r.concat(s);this.walk(e,n)}walkOption(e,r,s){let n=r.concat(s);this.walk(e,n)}walkAtLeastOne(e,r,s){let n=[new re({definition:e.definition})].concat(r,s);this.walk(e,n)}walkAtLeastOneSep(e,r,s){let n=Vl(e,r,s);this.walk(e,n)}walkMany(e,r,s){let n=[new re({definition:e.definition})].concat(r,s);this.walk(e,n)}walkManySep(e,r,s){let n=Vl(e,r,s);this.walk(e,n)}walkOr(e,r,s){let n=r.concat(s);x(e.definition,(i)=>{let o=new Z({definition:[i]});this.walk(o,n)})}}function Vl(e,r,s){return[new re({definition:[new w({terminalType:e.separator})].concat(e.definition)})].concat(r,s)}function sr(e){if(e instanceof J)return sr(e.referencedRule);else if(e instanceof w)return ZE(e);else if(ai(e))return qE(e);else if(li(e))return JE(e);else throw Error("non exhaustive match")}function qE(e){let r=[],s=e.definition,n=0,i=s.length>n,o,c=!0;while(i&&c)o=s[n],c=rr(o),r=r.concat(sr(o)),n=n+1,i=s.length>n;return wr(r)}function JE(e){let r=y(e.definition,(s)=>sr(s));return wr(xe(r))}function ZE(e){return[e.terminalType]}var fn="_~IN~_";class Hl extends Jt{constructor(e){super();this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,s){}walkProdRef(e,r,s){let n=QE(e.referencedRule,e.idx)+this.topProd.name,i=r.concat(s),o=new Z({definition:i}),c=sr(o);this.follows[n]=c}}function Yl(e){let r={};return x(e,(s)=>{let n=new Hl(s).startWalking();Ne(r,n)}),r}function QE(e,r){return e.name+r+fn}function k(e){return e.charCodeAt(0)}function hn(e,r){if(Array.isArray(e))e.forEach(function(s){r.push(s)});else r.push(e)}function Fr(e,r){if(e[r]===!0)throw"duplicate flag "+r;let s=e[r];e[r]=!0}function nr(e){if(e===void 0)throw Error("Internal Error - Should never get here!");return!0}function as(){throw Error("Internal Error - Should never get here!")}function ci(e){return e.type==="Character"}var ls=[];for(let e=k("0");e<=k("9");e++)ls.push(e);var cs=[k("_")].concat(ls);for(let e=k("a");e<=k("z");e++)cs.push(e);for(let e=k("A");e<=k("Z");e++)cs.push(e);var ui=[k(" "),k("\f"),k(`
1
+ import{t,l,V,C,ee,R,F,z,P,U,q,j,p,h,K,Sp,ft,Ze,Xe,Ur,Rt,Ft,Lt,gt}from"./index-xsts4pqm.js";import{vn}from"./index-pxtff3ez.js";var ks={};vn(ks,{default:()=>dt});var Ms={};vn(Ms,{default:()=>He});var Bs={};vn(Bs,{default:()=>ri});var df=typeof global=="object"&&global&&global.Object===Object&&global,bs=df;var pf=typeof self=="object"&&self&&self.Object===Object&&self,mf=bs||pf||Function("return this")(),pe=mf;var gf=pe.Symbol,Oe=gf;var to=Object.prototype,{hasOwnProperty:Tf,toString:Ef}=to,es=Oe?Oe.toStringTag:void 0;function yf(e){var r=Tf.call(e,es),s=e[es];try{e[es]=void 0;var n=!0}catch(o){}var i=Ef.call(e);if(n)if(r)e[es]=s;else delete e[es];return i}var ro=yf;var Af=Object.prototype,xf=Af.toString;function Sf(e){return xf.call(e)}var so=Sf;var Rf="[object Null]",Of="[object Undefined]",no=Oe?Oe.toStringTag:void 0;function Lf(e){if(e==null)return e===void 0?Of:Rf;return no&&no in Object(e)?ro(e):so(e)}var Pe=Lf;function If(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}var ne=If;var Nf="[object AsyncFunction]",bf="[object Function]",Cf="[object GeneratorFunction]",vf="[object Proxy]";function kf(e){if(!ne(e))return!1;var r=Pe(e);return r==bf||r==Cf||r==Nf||r==vf}var Ue=kf;var _f=pe["__core-js_shared__"],Cs=_f;var io=function(){var e=/[^.]+$/.exec(Cs&&Cs.keys&&Cs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Mf(e){return!!io&&io in e}var oo=Mf;var wf=Function.prototype,Pf=wf.toString;function Uf(e){if(e!=null){try{return Pf.call(e)}catch(r){}try{return e+""}catch(r){}}return""}var It=Uf;var Df=/[\\^$.*+?()[\]{}|]/g,Ff=/^\[object .+?Constructor\]$/,Bf=Function.prototype,$f=Object.prototype,Gf=Bf.toString,Wf=$f.hasOwnProperty,jf=RegExp("^"+Gf.call(Wf).replace(Df,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(e){if(!ne(e)||oo(e))return!1;var r=Ue(e)?jf:Ff;return r.test(It(e))}var ao=Kf;function zf(e,r){return e==null?void 0:e[r]}var lo=zf;function Vf(e,r){var s=lo(e,r);return ao(s)?s:void 0}var $e=Vf;var Hf=function(){try{var e=$e(Object,"defineProperty");return e({},"",{}),e}catch(r){}}(),hr=Hf;function Yf(e,r,s){if(r=="__proto__"&&hr)hr(e,r,{configurable:!0,enumerable:!0,value:s,writable:!0});else e[r]=s}var dr=Yf;function Xf(e,r){return e===r||e!==e&&r!==r}var ct=Xf;var qf=Object.prototype,Jf=qf.hasOwnProperty;function Zf(e,r,s){var n=e[r];if(!(Jf.call(e,r)&&ct(n,s))||s===void 0&&!(r in e))dr(e,r,s)}var Pt=Zf;function Qf(e,r,s,n){var i=!s;s||(s={});var o=-1,c=r.length;while(++o<c){var u=r[o],a=n?n(s[u],e[u],u,s,e):void 0;if(a===void 0)a=e[u];if(i)dr(s,u,a);else Pt(s,u,a)}return s}var ut=Qf;function eh(e){return e}var st=eh;function th(e,r,s){switch(s.length){case 0:return e.call(r);case 1:return e.call(r,s[0]);case 2:return e.call(r,s[0],s[1]);case 3:return e.call(r,s[0],s[1],s[2])}return e.apply(r,s)}var co=th;var uo=Math.max;function rh(e,r,s){return r=uo(r===void 0?e.length-1:r,0),function(){var n=arguments,i=-1,o=uo(n.length-r,0),c=Array(o);while(++i<o)c[i]=n[r+i];i=-1;var u=Array(r+1);while(++i<r)u[i]=n[i];return u[r]=s(c),co(e,this,u)}}var fo=rh;function sh(e){return function(){return e}}var ho=sh;var nh=!hr?st:function(e,r){return hr(e,"toString",{configurable:!0,enumerable:!1,value:ho(r),writable:!0})},po=nh;var ih=800,oh=16,ah=Date.now;function lh(e){var r=0,s=0;return function(){var n=ah(),i=oh-(n-s);if(s=n,i>0){if(++r>=ih)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}var mo=lh;var ch=mo(po),go=ch;function uh(e,r){return go(fo(e,r,st),e+"")}var pr=uh;var fh=9007199254740991;function hh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=fh}var mr=hh;function dh(e){return e!=null&&mr(e.length)&&!Ue(e)}var me=dh;var ph=9007199254740991,mh=/^(?:0|[1-9]\d*)$/;function gh(e,r){var s=typeof e;return r=r==null?ph:r,!!r&&(s=="number"||s!="symbol"&&mh.test(e))&&(e>-1&&e%1==0&&e<r)}var Ut=gh;function Th(e,r,s){if(!ne(s))return!1;var n=typeof r;if(n=="number"?me(s)&&Ut(r,s.length):n=="string"&&(r in s))return ct(s[r],e);return!1}var Dt=Th;function Eh(e){return pr(function(r,s){var n=-1,i=s.length,o=i>1?s[i-1]:void 0,c=i>2?s[2]:void 0;if(o=e.length>3&&typeof o=="function"?(i--,o):void 0,c&&Dt(s[0],s[1],c))o=i<3?void 0:o,i=1;r=Object(r);while(++n<i){var u=s[n];if(u)e(r,u,n,o)}return r})}var To=Eh;var yh=Object.prototype;function Ah(e){var r=e&&e.constructor,s=typeof r=="function"&&r.prototype||yh;return e===s}var ht=Ah;function xh(e,r){var s=-1,n=Array(e);while(++s<e)n[s]=r(s);return n}var Eo=xh;function Sh(e){return e!=null&&typeof e=="object"}var ue=Sh;var Rh="[object Arguments]";function Oh(e){return ue(e)&&Pe(e)==Rh}var Qn=Oh;var yo=Object.prototype,{hasOwnProperty:Lh,propertyIsEnumerable:Ih}=yo,Nh=Qn(function(){return arguments}())?Qn:function(e){return ue(e)&&Lh.call(e,"callee")&&!Ih.call(e,"callee")},Bt=Nh;var bh=Array.isArray,L=bh;function Ch(){return!1}var Ao=Ch;var Ro=typeof ks=="object"&&ks&&!ks.nodeType&&ks,xo=Ro&&typeof vs=="object"&&vs&&!vs.nodeType&&vs,vh=xo&&xo.exports===Ro,So=vh?pe.Buffer:void 0,kh=So?So.isBuffer:void 0,_h=kh||Ao,dt=_h;var Mh="[object Arguments]",wh="[object Array]",Ph="[object Boolean]",Uh="[object Date]",Dh="[object Error]",Fh="[object Function]",Bh="[object Map]",$h="[object Number]",Gh="[object Object]",Wh="[object RegExp]",jh="[object Set]",Kh="[object String]",zh="[object WeakMap]",Vh="[object ArrayBuffer]",Hh="[object DataView]",Yh="[object Float32Array]",Xh="[object Float64Array]",qh="[object Int8Array]",Jh="[object Int16Array]",Zh="[object Int32Array]",Qh="[object Uint8Array]",ed="[object Uint8ClampedArray]",td="[object Uint16Array]",rd="[object Uint32Array]",X={};X[Yh]=X[Xh]=X[qh]=X[Jh]=X[Zh]=X[Qh]=X[ed]=X[td]=X[rd]=!0;X[Mh]=X[wh]=X[Vh]=X[Ph]=X[Hh]=X[Uh]=X[Dh]=X[Fh]=X[Bh]=X[$h]=X[Gh]=X[Wh]=X[jh]=X[Kh]=X[zh]=!1;function sd(e){return ue(e)&&mr(e.length)&&!!X[Pe(e)]}var Oo=sd;function nd(e){return function(r){return e(r)}}var pt=nd;var Lo=typeof Ms=="object"&&Ms&&!Ms.nodeType&&Ms,ts=Lo&&typeof _s=="object"&&_s&&!_s.nodeType&&_s,id=ts&&ts.exports===Lo,ei=id&&bs.process,od=function(){try{var e=ts&&ts.require&&ts.require("util").types;if(e)return e;return ei&&ei.binding&&ei.binding("util")}catch(r){}}(),He=od;var Io=He&&He.isTypedArray,ad=Io?pt(Io):Oo,gr=ad;var ld=Object.prototype,cd=ld.hasOwnProperty;function ud(e,r){var s=L(e),n=!s&&Bt(e),i=!s&&!n&&dt(e),o=!s&&!n&&!i&&gr(e),c=s||n||i||o,u=c?Eo(e.length,String):[],a=u.length;for(var f in e)if((r||cd.call(e,f))&&!(c&&(f=="length"||i&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Ut(f,a))))u.push(f);return u}var ws=ud;function fd(e,r){return function(s){return e(r(s))}}var Ps=fd;var hd=Ps(Object.keys,Object),No=hd;var dd=Object.prototype,pd=dd.hasOwnProperty;function md(e){if(!ht(e))return No(e);var r=[];for(var s in Object(e))if(pd.call(e,s)&&s!="constructor")r.push(s);return r}var Us=md;function gd(e){return me(e)?ws(e):Us(e)}var W=gd;var Td=Object.prototype,Ed=Td.hasOwnProperty,yd=To(function(e,r){if(ht(r)||me(r)){ut(r,W(r),e);return}for(var s in r)if(Ed.call(r,s))Pt(e,s,r[s])}),Ne=yd;function Ad(){this.__data__=[],this.size=0}var bo=Ad;function xd(e,r){var s=e.length;while(s--)if(ct(e[s][0],r))return s;return-1}var $t=xd;var Sd=Array.prototype,Rd=Sd.splice;function Od(e){var r=this.__data__,s=$t(r,e);if(s<0)return!1;var n=r.length-1;if(s==n)r.pop();else Rd.call(r,s,1);return--this.size,!0}var Co=Od;function Ld(e){var r=this.__data__,s=$t(r,e);return s<0?void 0:r[s][1]}var vo=Ld;function Id(e){return $t(this.__data__,e)>-1}var ko=Id;function Nd(e,r){var s=this.__data__,n=$t(s,e);if(n<0)++this.size,s.push([e,r]);else s[n][1]=r;return this}var _o=Nd;function Tr(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}Tr.prototype.clear=bo;Tr.prototype.delete=Co;Tr.prototype.get=vo;Tr.prototype.has=ko;Tr.prototype.set=_o;var Gt=Tr;function bd(){this.__data__=new Gt,this.size=0}var Mo=bd;function Cd(e){var r=this.__data__,s=r.delete(e);return this.size=r.size,s}var wo=Cd;function vd(e){return this.__data__.get(e)}var Po=vd;function kd(e){return this.__data__.has(e)}var Uo=kd;var _d=$e(pe,"Map"),Wt=_d;var Md=$e(Object,"create"),Nt=Md;function wd(){this.__data__=Nt?Nt(null):{},this.size=0}var Do=wd;function Pd(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var Fo=Pd;var Ud="__lodash_hash_undefined__",Dd=Object.prototype,Fd=Dd.hasOwnProperty;function Bd(e){var r=this.__data__;if(Nt){var s=r[e];return s===Ud?void 0:s}return Fd.call(r,e)?r[e]:void 0}var Bo=Bd;var $d=Object.prototype,Gd=$d.hasOwnProperty;function Wd(e){var r=this.__data__;return Nt?r[e]!==void 0:Gd.call(r,e)}var $o=Wd;var jd="__lodash_hash_undefined__";function Kd(e,r){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Nt&&r===void 0?jd:r,this}var Go=Kd;function Er(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}Er.prototype.clear=Do;Er.prototype.delete=Fo;Er.prototype.get=Bo;Er.prototype.has=$o;Er.prototype.set=Go;var ti=Er;function zd(){this.size=0,this.__data__={hash:new ti,map:new(Wt||Gt),string:new ti}}var Wo=zd;function Vd(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}var jo=Vd;function Hd(e,r){var s=e.__data__;return jo(r)?s[typeof r=="string"?"string":"hash"]:s.map}var jt=Hd;function Yd(e){var r=jt(this,e).delete(e);return this.size-=r?1:0,r}var Ko=Yd;function Xd(e){return jt(this,e).get(e)}var zo=Xd;function qd(e){return jt(this,e).has(e)}var Vo=qd;function Jd(e,r){var s=jt(this,e),n=s.size;return s.set(e,r),this.size+=s.size==n?0:1,this}var Ho=Jd;function yr(e){var r=-1,s=e==null?0:e.length;this.clear();while(++r<s){var n=e[r];this.set(n[0],n[1])}}yr.prototype.clear=Wo;yr.prototype.delete=Ko;yr.prototype.get=zo;yr.prototype.has=Vo;yr.prototype.set=Ho;var er=yr;var Zd=200;function Qd(e,r){var s=this.__data__;if(s instanceof Gt){var n=s.__data__;if(!Wt||n.length<Zd-1)return n.push([e,r]),this.size=++s.size,this;s=this.__data__=new er(n)}return s.set(e,r),this.size=s.size,this}var Yo=Qd;function Ar(e){var r=this.__data__=new Gt(e);this.size=r.size}Ar.prototype.clear=Mo;Ar.prototype.delete=wo;Ar.prototype.get=Po;Ar.prototype.has=Uo;Ar.prototype.set=Yo;var Kt=Ar;function ep(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(r(e[s],s,e)===!1)break;return e}var Ds=ep;function tp(e,r){return e&&ut(r,W(r),e)}var Xo=tp;function rp(e){var r=[];if(e!=null)for(var s in Object(e))r.push(s);return r}var qo=rp;var sp=Object.prototype,np=sp.hasOwnProperty;function ip(e){if(!ne(e))return qo(e);var r=ht(e),s=[];for(var n in e)if(!(n=="constructor"&&(r||!np.call(e,n))))s.push(n);return s}var Jo=ip;function op(e){return me(e)?ws(e,!0):Jo(e)}var zt=op;function ap(e,r){return e&&ut(r,zt(r),e)}var Zo=ap;var ra=typeof Bs=="object"&&Bs&&!Bs.nodeType&&Bs,Qo=ra&&typeof Fs=="object"&&Fs&&!Fs.nodeType&&Fs,lp=Qo&&Qo.exports===ra,ea=lp?pe.Buffer:void 0,ta=ea?ea.allocUnsafe:void 0;function cp(e,r){if(r)return e.slice();var s=e.length,n=ta?ta(s):new e.constructor(s);return e.copy(n),n}var ri=cp;function up(e,r){var s=-1,n=e.length;r||(r=Array(n));while(++s<n)r[s]=e[s];return r}var sa=up;function fp(e,r){var s=-1,n=e==null?0:e.length,i=0,o=[];while(++s<n){var c=e[s];if(r(c,s,e))o[i++]=c}return o}var xr=fp;function hp(){return[]}var $s=hp;var dp=Object.prototype,pp=dp.propertyIsEnumerable,na=Object.getOwnPropertySymbols,mp=!na?$s:function(e){if(e==null)return[];return e=Object(e),xr(na(e),function(r){return pp.call(e,r)})},Sr=mp;function gp(e,r){return ut(e,Sr(e),r)}var ia=gp;function Tp(e,r){var s=-1,n=r.length,i=e.length;while(++s<n)e[i+s]=r[s];return e}var Rr=Tp;var Ep=Ps(Object.getPrototypeOf,Object),Gs=Ep;var yp=Object.getOwnPropertySymbols,Ap=!yp?$s:function(e){var r=[];while(e)Rr(r,Sr(e)),e=Gs(e);return r},Ws=Ap;function xp(e,r){return ut(e,Ws(e),r)}var oa=xp;function Rp(e,r,s){var n=r(e);return L(e)?n:Rr(n,s(e))}var js=Rp;function Op(e){return js(e,W,Sr)}var rs=Op;function Lp(e){return js(e,zt,Ws)}var Ks=Lp;var Ip=$e(pe,"DataView"),zs=Ip;var Np=$e(pe,"Promise"),Vs=Np;var bp=$e(pe,"Set"),Vt=bp;var Cp=$e(pe,"WeakMap"),Hs=Cp;var aa="[object Map]",vp="[object Object]",la="[object Promise]",ca="[object Set]",ua="[object WeakMap]",fa="[object DataView]",kp=It(zs),_p=It(Wt),Mp=It(Vs),wp=It(Vt),Pp=It(Hs),tr=Pe;if(zs&&tr(new zs(new ArrayBuffer(1)))!=fa||Wt&&tr(new Wt)!=aa||Vs&&tr(Vs.resolve())!=la||Vt&&tr(new Vt)!=ca||Hs&&tr(new Hs)!=ua)tr=function(e){var r=Pe(e),s=r==vp?e.constructor:void 0,n=s?It(s):"";if(n)switch(n){case kp:return fa;case _p:return aa;case Mp:return la;case wp:return ca;case Pp:return ua}return r};var nt=tr;var Up=Object.prototype,Dp=Up.hasOwnProperty;function Fp(e){var r=e.length,s=new e.constructor(r);if(r&&typeof e[0]=="string"&&Dp.call(e,"index"))s.index=e.index,s.input=e.input;return s}var ha=Fp;var Bp=pe.Uint8Array,Or=Bp;function $p(e){var r=new e.constructor(e.byteLength);return new Or(r).set(new Or(e)),r}var Lr=$p;function Gp(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}var da=Gp;var Wp=/\w*$/;function jp(e){var r=new e.constructor(e.source,Wp.exec(e));return r.lastIndex=e.lastIndex,r}var pa=jp;var ma=Oe?Oe.prototype:void 0,ga=ma?ma.valueOf:void 0;function Kp(e){return ga?Object(ga.call(e)):{}}var Ta=Kp;function zp(e,r){var s=r?Lr(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}var Ea=zp;var Vp="[object Boolean]",Hp="[object Date]",Yp="[object Map]",Xp="[object Number]",qp="[object RegExp]",Jp="[object Set]",Zp="[object String]",Qp="[object Symbol]",em="[object ArrayBuffer]",tm="[object DataView]",rm="[object Float32Array]",sm="[object Float64Array]",nm="[object Int8Array]",im="[object Int16Array]",om="[object Int32Array]",am="[object Uint8Array]",lm="[object Uint8ClampedArray]",cm="[object Uint16Array]",um="[object Uint32Array]";function fm(e,r,s){var n=e.constructor;switch(r){case em:return Lr(e);case Vp:case Hp:return new n(+e);case tm:return da(e,s);case rm:case sm:case nm:case im:case om:case am:case lm:case cm:case um:return Ea(e,s);case Yp:return new n;case Xp:case Zp:return new n(e);case qp:return pa(e);case Jp:return new n;case Qp:return Ta(e)}}var ya=fm;var Aa=Object.create,hm=function(){function e(){}return function(r){if(!ne(r))return{};if(Aa)return Aa(r);e.prototype=r;var s=new e;return e.prototype=void 0,s}}(),xa=hm;function dm(e){return typeof e.constructor=="function"&&!ht(e)?xa(Gs(e)):{}}var Sa=dm;var pm="[object Map]";function mm(e){return ue(e)&&nt(e)==pm}var Ra=mm;var Oa=He&&He.isMap,gm=Oa?pt(Oa):Ra,La=gm;var Tm="[object Set]";function Em(e){return ue(e)&&nt(e)==Tm}var Ia=Em;var Na=He&&He.isSet,ym=Na?pt(Na):Ia,ba=ym;var Am=1,xm=2,Sm=4,Ca="[object Arguments]",Rm="[object Array]",Om="[object Boolean]",Lm="[object Date]",Im="[object Error]",va="[object Function]",Nm="[object GeneratorFunction]",bm="[object Map]",Cm="[object Number]",ka="[object Object]",vm="[object RegExp]",km="[object Set]",_m="[object String]",Mm="[object Symbol]",wm="[object WeakMap]",Pm="[object ArrayBuffer]",Um="[object DataView]",Dm="[object Float32Array]",Fm="[object Float64Array]",Bm="[object Int8Array]",$m="[object Int16Array]",Gm="[object Int32Array]",Wm="[object Uint8Array]",jm="[object Uint8ClampedArray]",Km="[object Uint16Array]",zm="[object Uint32Array]",H={};H[Ca]=H[Rm]=H[Pm]=H[Um]=H[Om]=H[Lm]=H[Dm]=H[Fm]=H[Bm]=H[$m]=H[Gm]=H[bm]=H[Cm]=H[ka]=H[vm]=H[km]=H[_m]=H[Mm]=H[Wm]=H[jm]=H[Km]=H[zm]=!0;H[Im]=H[va]=H[wm]=!1;function Ys(e,r,s,n,i,o){var c,u=r&Am,a=r&xm,f=r&Sm;if(s)c=i?s(e,n,i,o):s(e);if(c!==void 0)return c;if(!ne(e))return e;var d=L(e);if(d){if(c=ha(e),!u)return sa(e,c)}else{var m=nt(e),g=m==va||m==Nm;if(dt(e))return ri(e,u);if(m==ka||m==Ca||g&&!i){if(c=a||g?{}:Sa(e),!u)return a?oa(e,Zo(c,e)):ia(e,Xo(c,e))}else{if(!H[m])return i?e:{};c=ya(e,m,u)}}o||(o=new Kt);var E=o.get(e);if(E)return E;if(o.set(e,c),ba(e))e.forEach(function(I){c.add(Ys(I,r,s,I,e,o))});else if(La(e))e.forEach(function(I,A){c.set(A,Ys(I,r,s,A,e,o))});var b=f?a?Ks:rs:a?zt:W,v=d?void 0:b(e);return Ds(v||e,function(I,A){if(v)A=I,I=e[A];Pt(c,A,Ys(I,r,s,A,e,o))}),c}var _a=Ys;var Vm=4;function Hm(e){return _a(e,Vm)}var Y=Hm;function Ym(e){var r=-1,s=e==null?0:e.length,n=0,i=[];while(++r<s){var o=e[r];if(o)i[n++]=o}return i}var mt=Ym;var Ma=Object.prototype,Xm=Ma.hasOwnProperty,qm=pr(function(e,r){e=Object(e);var s=-1,n=r.length,i=n>2?r[2]:void 0;if(i&&Dt(r[0],r[1],i))n=1;while(++s<n){var o=r[s],c=zt(o),u=-1,a=c.length;while(++u<a){var f=c[u],d=e[f];if(d===void 0||ct(d,Ma[f])&&!Xm.call(e,f))e[f]=o[f]}}return e}),Ir=qm;var Jm="__lodash_hash_undefined__";function Zm(e){return this.__data__.set(e,Jm),this}var wa=Zm;function Qm(e){return this.__data__.has(e)}var Pa=Qm;function Xs(e){var r=-1,s=e==null?0:e.length;this.__data__=new er;while(++r<s)this.add(e[r])}Xs.prototype.add=Xs.prototype.push=wa;Xs.prototype.has=Pa;var Nr=Xs;function eg(e,r,s,n){var i=e.length,o=s+(n?1:-1);while(n?o--:++o<i)if(r(e[o],o,e))return o;return-1}var qs=eg;function tg(e){return e!==e}var Ua=tg;function rg(e,r,s){var n=s-1,i=e.length;while(++n<i)if(e[n]===r)return n;return-1}var Da=rg;function sg(e,r,s){return r===r?Da(e,r,s):qs(e,Ua,s)}var br=sg;function ng(e,r){var s=e==null?0:e.length;return!!s&&br(e,r,0)>-1}var Js=ng;function ig(e,r,s){var n=-1,i=e==null?0:e.length;while(++n<i)if(s(r,e[n]))return!0;return!1}var Zs=ig;function og(e,r){var s=-1,n=e==null?0:e.length,i=Array(n);while(++s<n)i[s]=r(e[s],s,e);return i}var Tt=og;function ag(e,r){return e.has(r)}var Cr=ag;var lg=200;function cg(e,r,s,n){var i=-1,o=Js,c=!0,u=e.length,a=[],f=r.length;if(!u)return a;if(s)r=Tt(r,pt(s));if(n)o=Zs,c=!1;else if(r.length>=lg)o=Cr,c=!1,r=new Nr(r);e:while(++i<u){var d=e[i],m=s==null?d:s(d);if(d=n||d!==0?d:0,c&&m===m){var g=f;while(g--)if(r[g]===m)continue e;a.push(d)}else if(!o(r,m,n))a.push(d)}return a}var Fa=cg;var Ba=Oe?Oe.isConcatSpreadable:void 0;function ug(e){return L(e)||Bt(e)||!!(Ba&&e&&e[Ba])}var $a=ug;function Ga(e,r,s,n,i){var o=-1,c=e.length;s||(s=$a),i||(i=[]);while(++o<c){var u=e[o];if(r>0&&s(u))if(r>1)Ga(u,r-1,s,n,i);else Rr(i,u);else if(!n)i[i.length]=u}return i}var vr=Ga;function fg(e){return ue(e)&&me(e)}var si=fg;var hg=pr(function(e,r){return si(e)?Fa(e,vr(r,1,si,!0)):[]}),Ht=hg;function dg(e,r,s){var n=-1,i=e.length;if(r<0)r=-r>i?0:i+r;if(s=s>i?i:s,s<0)s+=i;i=r>s?0:s-r>>>0,r>>>=0;var o=Array(i);while(++n<i)o[n]=e[n+r];return o}var Qs=dg;var pg=/\s/;function mg(e){var r=e.length;while(r--&&pg.test(e.charAt(r)));return r}var Wa=mg;var gg=/^\s+/;function Tg(e){return e?e.slice(0,Wa(e)+1).replace(gg,""):e}var ja=Tg;var Eg="[object Symbol]";function yg(e){return typeof e=="symbol"||ue(e)&&Pe(e)==Eg}var Yt=yg;var Ka=NaN,Ag=/^[-+]0x[0-9a-f]+$/i,xg=/^0b[01]+$/i,Sg=/^0o[0-7]+$/i,Rg=parseInt;function Og(e){if(typeof e=="number")return e;if(Yt(e))return Ka;if(ne(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=ne(r)?r+"":r}if(typeof e!="string")return e===0?e:+e;e=ja(e);var s=xg.test(e);return s||Sg.test(e)?Rg(e.slice(2),s?2:8):Ag.test(e)?Ka:+e}var za=Og;var Va=1/0,Lg=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function Ig(e){if(!e)return e===0?e:0;if(e=za(e),e===Va||e===-Va){var r=e<0?-1:1;return r*Lg}return e===e?e:0}var Ha=Ig;function Ng(e){var r=Ha(e),s=r%1;return r===r?s?r-s:r:0}var Et=Ng;function bg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:Et(r),Qs(e,r<0?0:r,n)}var fe=bg;function Cg(e,r,s){var n=e==null?0:e.length;if(!n)return[];return r=s||r===void 0?1:Et(r),r=n-r,Qs(e,0,r<0?0:r)}var bt=Cg;function vg(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(!r(e[s],s,e))return!1;return!0}var Ya=vg;function kg(e){return function(r,s,n){var i=-1,o=Object(r),c=n(r),u=c.length;while(u--){var a=c[e?u:++i];if(s(o[a],a,o)===!1)break}return r}}var Xa=kg;var _g=Xa(),qa=_g;function Mg(e,r){return e&&qa(e,r,W)}var Ja=Mg;function wg(e,r){return function(s,n){if(s==null)return s;if(!me(s))return e(s,n);var i=s.length,o=r?i:-1,c=Object(s);while(r?o--:++o<i)if(n(c[o],o,c)===!1)break;return s}}var Za=wg;var Pg=Za(Ja),Ge=Pg;function Ug(e,r){var s=!0;return Ge(e,function(n,i,o){return s=!!r(n,i,o),s}),s}var Qa=Ug;function Dg(e,r){var s=-1,n=e==null?0:e.length;while(++s<n)if(r(e[s],s,e))return!0;return!1}var en=Dg;var Fg=1,Bg=2;function $g(e,r,s,n,i,o){var c=s&Fg,u=e.length,a=r.length;if(u!=a&&!(c&&a>u))return!1;var f=o.get(e),d=o.get(r);if(f&&d)return f==r&&d==e;var m=-1,g=!0,E=s&Bg?new Nr:void 0;o.set(e,r),o.set(r,e);while(++m<u){var b=e[m],v=r[m];if(n)var I=c?n(v,b,m,r,e,o):n(b,v,m,e,r,o);if(I!==void 0){if(I)continue;g=!1;break}if(E){if(!en(r,function(A,O){if(!Cr(E,O)&&(b===A||i(b,A,s,n,o)))return E.push(O)})){g=!1;break}}else if(!(b===v||i(b,v,s,n,o))){g=!1;break}}return o.delete(e),o.delete(r),g}var tn=$g;function Gg(e){var r=-1,s=Array(e.size);return e.forEach(function(n,i){s[++r]=[i,n]}),s}var el=Gg;function Wg(e){var r=-1,s=Array(e.size);return e.forEach(function(n){s[++r]=n}),s}var kr=Wg;var jg=1,Kg=2,zg="[object Boolean]",Vg="[object Date]",Hg="[object Error]",Yg="[object Map]",Xg="[object Number]",qg="[object RegExp]",Jg="[object Set]",Zg="[object String]",Qg="[object Symbol]",eT="[object ArrayBuffer]",tT="[object DataView]",tl=Oe?Oe.prototype:void 0,ni=tl?tl.valueOf:void 0;function rT(e,r,s,n,i,o,c){switch(s){case tT:if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case eT:if(e.byteLength!=r.byteLength||!o(new Or(e),new Or(r)))return!1;return!0;case zg:case Vg:case Xg:return ct(+e,+r);case Hg:return e.name==r.name&&e.message==r.message;case qg:case Zg:return e==r+"";case Yg:var u=el;case Jg:var a=n&jg;if(u||(u=kr),e.size!=r.size&&!a)return!1;var f=c.get(e);if(f)return f==r;n|=Kg,c.set(e,r);var d=tn(u(e),u(r),n,i,o,c);return c.delete(e),d;case Qg:if(ni)return ni.call(e)==ni.call(r)}return!1}var rl=rT;var sT=1,nT=Object.prototype,iT=nT.hasOwnProperty;function oT(e,r,s,n,i,o){var c=s&sT,u=rs(e),a=u.length,f=rs(r),d=f.length;if(a!=d&&!c)return!1;var m=a;while(m--){var g=u[m];if(!(c?g in r:iT.call(r,g)))return!1}var E=o.get(e),b=o.get(r);if(E&&b)return E==r&&b==e;var v=!0;o.set(e,r),o.set(r,e);var I=c;while(++m<a){g=u[m];var A=e[g],O=r[g];if(n)var T=c?n(O,A,g,r,e,o):n(A,O,g,e,r,o);if(!(T===void 0?A===O||i(A,O,s,n,o):T)){v=!1;break}I||(I=g=="constructor")}if(v&&!I){var _=e.constructor,Q=r.constructor;if(_!=Q&&(("constructor"in e)&&("constructor"in r))&&!(typeof _=="function"&&_ instanceof _&&typeof Q=="function"&&Q instanceof Q))v=!1}return o.delete(e),o.delete(r),v}var sl=oT;var aT=1,nl="[object Arguments]",il="[object Array]",rn="[object Object]",lT=Object.prototype,ol=lT.hasOwnProperty;function cT(e,r,s,n,i,o){var c=L(e),u=L(r),a=c?il:nt(e),f=u?il:nt(r);a=a==nl?rn:a,f=f==nl?rn:f;var d=a==rn,m=f==rn,g=a==f;if(g&&dt(e)){if(!dt(r))return!1;c=!0,d=!1}if(g&&!d)return o||(o=new Kt),c||gr(e)?tn(e,r,s,n,i,o):rl(e,r,a,s,n,i,o);if(!(s&aT)){var E=d&&ol.call(e,"__wrapped__"),b=m&&ol.call(r,"__wrapped__");if(E||b){var v=E?e.value():e,I=b?r.value():r;return o||(o=new Kt),i(v,I,s,n,o)}}if(!g)return!1;return o||(o=new Kt),sl(e,r,s,n,i,o)}var al=cT;function ll(e,r,s,n,i){if(e===r)return!0;if(e==null||r==null||!ue(e)&&!ue(r))return e!==e&&r!==r;return al(e,r,s,n,ll,i)}var sn=ll;var uT=1,fT=2;function hT(e,r,s,n){var i=s.length,o=i,c=!n;if(e==null)return!o;e=Object(e);while(i--){var u=s[i];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}while(++i<o){u=s[i];var a=u[0],f=e[a],d=u[1];if(c&&u[2]){if(f===void 0&&!(a in e))return!1}else{var m=new Kt;if(n)var g=n(f,d,a,e,r,m);if(!(g===void 0?sn(d,f,uT|fT,n,m):g))return!1}}return!0}var cl=hT;function dT(e){return e===e&&!ne(e)}var nn=dT;function pT(e){var r=W(e),s=r.length;while(s--){var n=r[s],i=e[n];r[s]=[n,i,nn(i)]}return r}var ul=pT;function mT(e,r){return function(s){if(s==null)return!1;return s[e]===r&&(r!==void 0||(e in Object(s)))}}var on=mT;function gT(e){var r=ul(e);if(r.length==1&&r[0][2])return on(r[0][0],r[0][1]);return function(s){return s===e||cl(s,e,r)}}var fl=gT;var TT=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ET=/^\w*$/;function yT(e,r){if(L(e))return!1;var s=typeof e;if(s=="number"||s=="symbol"||s=="boolean"||e==null||Yt(e))return!0;return ET.test(e)||!TT.test(e)||r!=null&&e in Object(r)}var _r=yT;var AT="Expected a function";function ii(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw TypeError(AT);var s=function(){var n=arguments,i=r?r.apply(this,n):n[0],o=s.cache;if(o.has(i))return o.get(i);var c=e.apply(this,n);return s.cache=o.set(i,c)||o,c};return s.cache=new(ii.Cache||er),s}ii.Cache=er;var hl=ii;var xT=500;function ST(e){var r=hl(e,function(n){if(s.size===xT)s.clear();return n}),s=r.cache;return r}var dl=ST;var RT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,OT=/\\(\\)?/g,LT=dl(function(e){var r=[];if(e.charCodeAt(0)===46)r.push("");return e.replace(RT,function(s,n,i,o){r.push(i?o.replace(OT,"$1"):n||s)}),r}),pl=LT;var IT=1/0,ml=Oe?Oe.prototype:void 0,gl=ml?ml.toString:void 0;function Tl(e){if(typeof e=="string")return e;if(L(e))return Tt(e,Tl)+"";if(Yt(e))return gl?gl.call(e):"";var r=e+"";return r=="0"&&1/e==-IT?"-0":r}var El=Tl;function NT(e){return e==null?"":El(e)}var yl=NT;function bT(e,r){if(L(e))return e;return _r(e,r)?[e]:pl(yl(e))}var Xt=bT;var CT=1/0;function vT(e){if(typeof e=="string"||Yt(e))return e;var r=e+"";return r=="0"&&1/e==-CT?"-0":r}var yt=vT;function kT(e,r){r=Xt(r,e);var s=0,n=r.length;while(e!=null&&s<n)e=e[yt(r[s++])];return s&&s==n?e:void 0}var Mr=kT;function _T(e,r,s){var n=e==null?void 0:Mr(e,r);return n===void 0?s:n}var Al=_T;function MT(e,r){return e!=null&&r in Object(e)}var xl=MT;function wT(e,r,s){r=Xt(r,e);var n=-1,i=r.length,o=!1;while(++n<i){var c=yt(r[n]);if(!(o=e!=null&&s(e,c)))break;e=e[c]}if(o||++n!=i)return o;return i=e==null?0:e.length,!!i&&mr(i)&&Ut(c,i)&&(L(e)||Bt(e))}var an=wT;function PT(e,r){return e!=null&&an(e,r,xl)}var Sl=PT;var UT=1,DT=2;function FT(e,r){if(_r(e)&&nn(r))return on(yt(e),r);return function(s){var n=Al(s,e);return n===void 0&&n===r?Sl(s,e):sn(r,n,UT|DT)}}var Rl=FT;function BT(e){return function(r){return r==null?void 0:r[e]}}var Ol=BT;function $T(e){return function(r){return Mr(r,e)}}var Ll=$T;function GT(e){return _r(e)?Ol(yt(e)):Ll(e)}var Il=GT;function WT(e){if(typeof e=="function")return e;if(e==null)return st;if(typeof e=="object")return L(e)?Rl(e[0],e[1]):fl(e);return Il(e)}var ge=WT;function jT(e,r,s){var n=L(e)?Ya:Qa;if(s&&Dt(e,r,s))r=void 0;return n(e,ge(r,3))}var ve=jT;function KT(e,r){var s=[];return Ge(e,function(n,i,o){if(r(n,i,o))s.push(n)}),s}var ln=KT;function zT(e,r){var s=L(e)?xr:ln;return s(e,ge(r,3))}var ke=zT;function VT(e){return function(r,s,n){var i=Object(r);if(!me(r)){var o=ge(s,3);r=W(r),s=function(u){return o(i[u],u,i)}}var c=e(r,s,n);return c>-1?i[o?r[c]:c]:void 0}}var Nl=VT;var HT=Math.max;function YT(e,r,s){var n=e==null?0:e.length;if(!n)return-1;var i=s==null?0:Et(s);if(i<0)i=HT(n+i,0);return qs(e,ge(r,3),i)}var bl=YT;var XT=Nl(bl),At=XT;function qT(e){return e&&e.length?e[0]:void 0}var Le=qT;function JT(e,r){var s=-1,n=me(e)?Array(e.length):[];return Ge(e,function(i,o,c){n[++s]=r(i,o,c)}),n}var Cl=JT;function ZT(e,r){var s=L(e)?Tt:Cl;return s(e,ge(r,3))}var y=ZT;function QT(e,r){return vr(y(e,r),1)}var De=QT;function eE(e){var r=e==null?0:e.length;return r?vr(e,1):[]}var xe=eE;function tE(e){return typeof e=="function"?e:st}var vl=tE;function rE(e,r){var s=L(e)?Ds:Ge;return s(e,vl(r))}var x=rE;function sE(e,r,s,n){var i=-1,o=e==null?0:e.length;while(++i<o){var c=e[i];r(n,c,s(c),e)}return n}var kl=sE;function nE(e,r,s,n){return Ge(e,function(i,o,c){r(n,i,s(i),c)}),n}var _l=nE;function iE(e,r){return function(s,n){var i=L(s)?kl:_l,o=r?r():{};return i(s,e,ge(n,2),o)}}var Ml=iE;var oE=Object.prototype,aE=oE.hasOwnProperty,lE=Ml(function(e,r,s){if(aE.call(e,s))e[s].push(r);else dr(e,s,[r])}),oi=lE;var cE=Object.prototype,uE=cE.hasOwnProperty;function fE(e,r){return e!=null&&uE.call(e,r)}var wl=fE;function hE(e,r){return e!=null&&an(e,r,wl)}var S=hE;var dE="[object String]";function pE(e){return typeof e=="string"||!L(e)&&ue(e)&&Pe(e)==dE}var Se=pE;function mE(e,r){return Tt(r,function(s){return e[s]})}var Pl=mE;function gE(e){return e==null?[]:Pl(e,W(e))}var G=gE;var TE=Math.max;function EE(e,r,s,n){e=me(e)?e:G(e),s=s&&!n?Et(s):0;var i=e.length;if(s<0)s=TE(i+s,0);return Se(e)?s<=i&&e.indexOf(r,s)>-1:!!i&&br(e,r,s)>-1}var te=EE;var yE=Math.max;function AE(e,r,s){var n=e==null?0:e.length;if(!n)return-1;var i=s==null?0:Et(s);if(i<0)i=yE(n+i,0);return br(e,r,i)}var cn=AE;var xE="[object Map]",SE="[object Set]",RE=Object.prototype,OE=RE.hasOwnProperty;function LE(e){if(e==null)return!0;if(me(e)&&(L(e)||typeof e=="string"||typeof e.splice=="function"||dt(e)||gr(e)||Bt(e)))return!e.length;var r=nt(e);if(r==xE||r==SE)return!e.size;if(ht(e))return!Us(e).length;for(var s in e)if(OE.call(e,s))return!1;return!0}var M=LE;var IE="[object RegExp]";function NE(e){return ue(e)&&Pe(e)==IE}var Ul=NE;var Dl=He&&He.isRegExp,bE=Dl?pt(Dl):Ul,Je=bE;function CE(e){return e===void 0}var _e=CE;function vE(e){var r=e==null?0:e.length;return r?e[r-1]:void 0}var it=vE;function kE(){}var le=kE;function _E(e,r,s,n){if(!ne(e))return e;r=Xt(r,e);var i=-1,o=r.length,c=o-1,u=e;while(u!=null&&++i<o){var a=yt(r[i]),f=s;if(a==="__proto__"||a==="constructor"||a==="prototype")return e;if(i!=c){var d=u[a];if(f=n?n(d,a,u):void 0,f===void 0)f=ne(d)?d:Ut(r[i+1])?[]:{}}Pt(u,a,f),u=u[a]}return e}var Fl=_E;function ME(e,r,s){var n=-1,i=r.length,o={};while(++n<i){var c=r[n],u=Mr(e,c);if(s(u,c))Fl(o,Xt(c,e),u)}return o}var Bl=ME;function wE(e,r){if(e==null)return{};var s=Tt(Ks(e),function(n){return[n]});return r=ge(r),Bl(e,s,function(n,i){return r(n,i[0])})}var We=wE;function PE(e,r,s,n){var i=-1,o=e==null?0:e.length;if(n&&o)s=e[++i];while(++i<o)s=r(s,e[i],i,e);return s}var $l=PE;function UE(e,r,s,n,i){return i(e,function(o,c,u){s=n?(n=!1,o):r(s,o,c,u)}),s}var Gl=UE;function DE(e,r,s){var n=L(e)?$l:Gl,i=arguments.length<3;return n(e,ge(r,4),s,i,Ge)}var Te=DE;var FE="Expected a function";function BE(e){if(typeof e!="function")throw TypeError(FE);return function(){var r=arguments;switch(r.length){case 0:return!e.call(this);case 1:return!e.call(this,r[0]);case 2:return!e.call(this,r[0],r[1]);case 3:return!e.call(this,r[0],r[1],r[2])}return!e.apply(this,r)}}var Wl=BE;function $E(e,r){var s=L(e)?xr:ln;return s(e,Wl(ge(r,3)))}var qt=$E;function GE(e,r){var s;return Ge(e,function(n,i,o){return s=r(n,i,o),!s}),!!s}var jl=GE;function WE(e,r,s){var n=L(e)?en:jl;if(s&&Dt(e,r,s))r=void 0;return n(e,ge(r,3))}var ss=WE;var jE=1/0,KE=!(Vt&&1/kr(new Vt([,-0]))[1]==jE)?le:function(e){return new Vt(e)},Kl=KE;var zE=200;function VE(e,r,s){var n=-1,i=Js,o=e.length,c=!0,u=[],a=u;if(s)c=!1,i=Zs;else if(o>=zE){var f=r?null:Kl(e);if(f)return kr(f);c=!1,i=Cr,a=new Nr}else a=r?[]:u;e:while(++n<o){var d=e[n],m=r?r(d):d;if(d=s||d!==0?d:0,c&&m===m){var g=a.length;while(g--)if(a[g]===m)continue e;if(r)a.push(m);u.push(d)}else if(!i(a,m,s)){if(a!==u)a.push(m);u.push(d)}}return u}var zl=VE;function HE(e){return e&&e.length?zl(e):[]}var wr=HE;function Pr(e){if(console&&console.error)console.error(`Error: ${e}`)}function ns(e){if(console&&console.warn)console.warn(`Warning: ${e}`)}function is(e){let r=new Date().getTime(),s=e();return{time:new Date().getTime()-r,value:s}}function os(e){function r(){}r.prototype=e;let s=new r;function n(){return typeof s.bar}return n(),n(),e;(0,eval)(e)}function YE(e){if(XE(e))return e.LABEL;else return e.name}function XE(e){return Se(e.LABEL)&&e.LABEL!==""}class Qe{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),x(this.definition,(r)=>{r.accept(e)})}}class J extends Qe{constructor(e){super([]);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}set definition(e){}get definition(){if(this.referencedRule!==void 0)return this.referencedRule.definition;return[]}accept(e){e.visit(this)}}class je extends Qe{constructor(e){super(e.definition);this.orgText="",Ne(this,We(e,(r)=>r!==void 0))}}class Z extends Qe{constructor(e){super(e.definition);this.ignoreAmbiguities=!1,Ne(this,We(e,(r)=>r!==void 0))}}class re extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class Ee extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class ye extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class B extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class he extends Qe{constructor(e){super(e.definition);this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}}class de extends Qe{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,Ne(this,We(e,(r)=>r!==void 0))}}class w{constructor(e){this.idx=1,Ne(this,We(e,(r)=>r!==void 0))}accept(e){e.visit(this)}}function un(e){return y(e,Dr)}function Dr(e){function r(s){return y(s,Dr)}if(e instanceof J){let s={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};if(Se(e.label))s.label=e.label;return s}else if(e instanceof Z)return{type:"Alternative",definition:r(e.definition)};else if(e instanceof re)return{type:"Option",idx:e.idx,definition:r(e.definition)};else if(e instanceof Ee)return{type:"RepetitionMandatory",idx:e.idx,definition:r(e.definition)};else if(e instanceof ye)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:Dr(new w({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof he)return{type:"RepetitionWithSeparator",idx:e.idx,separator:Dr(new w({terminalType:e.separator})),definition:r(e.definition)};else if(e instanceof B)return{type:"Repetition",idx:e.idx,definition:r(e.definition)};else if(e instanceof de)return{type:"Alternation",idx:e.idx,definition:r(e.definition)};else if(e instanceof w){let s={type:"Terminal",name:e.terminalType.name,label:YE(e.terminalType),idx:e.idx};if(Se(e.label))s.terminalLabel=e.label;let n=e.terminalType.PATTERN;if(e.terminalType.PATTERN)s.pattern=Je(n)?n.source:n;return s}else if(e instanceof je)return{type:"Rule",name:e.name,orgText:e.orgText,definition:r(e.definition)};else throw Error("non exhaustive match")}class Ke{visit(e){let r=e;switch(r.constructor){case J:return this.visitNonTerminal(r);case Z:return this.visitAlternative(r);case re:return this.visitOption(r);case Ee:return this.visitRepetitionMandatory(r);case ye:return this.visitRepetitionMandatoryWithSeparator(r);case he:return this.visitRepetitionWithSeparator(r);case B:return this.visitRepetition(r);case de:return this.visitAlternation(r);case w:return this.visitTerminal(r);case je:return this.visitRule(r);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 ai(e){return e instanceof Z||e instanceof re||e instanceof B||e instanceof Ee||e instanceof ye||e instanceof he||e instanceof w||e instanceof je}function rr(e,r=[]){if(e instanceof re||e instanceof B||e instanceof he)return!0;if(e instanceof de)return ss(e.definition,(n)=>rr(n,r));else if(e instanceof J&&te(r,e))return!1;else if(e instanceof Qe){if(e instanceof J)r.push(e);return ve(e.definition,(n)=>rr(n,r))}else return!1}function li(e){return e instanceof de}function ze(e){if(e instanceof J)return"SUBRULE";else if(e instanceof re)return"OPTION";else if(e instanceof de)return"OR";else if(e instanceof Ee)return"AT_LEAST_ONE";else if(e instanceof ye)return"AT_LEAST_ONE_SEP";else if(e instanceof he)return"MANY_SEP";else if(e instanceof B)return"MANY";else if(e instanceof w)return"CONSUME";else throw Error("non exhaustive match")}class Jt{walk(e,r=[]){x(e.definition,(s,n)=>{let i=fe(e.definition,n+1);if(s instanceof J)this.walkProdRef(s,i,r);else if(s instanceof w)this.walkTerminal(s,i,r);else if(s instanceof Z)this.walkFlat(s,i,r);else if(s instanceof re)this.walkOption(s,i,r);else if(s instanceof Ee)this.walkAtLeastOne(s,i,r);else if(s instanceof ye)this.walkAtLeastOneSep(s,i,r);else if(s instanceof he)this.walkManySep(s,i,r);else if(s instanceof B)this.walkMany(s,i,r);else if(s instanceof de)this.walkOr(s,i,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,s){}walkProdRef(e,r,s){}walkFlat(e,r,s){let n=r.concat(s);this.walk(e,n)}walkOption(e,r,s){let n=r.concat(s);this.walk(e,n)}walkAtLeastOne(e,r,s){let n=[new re({definition:e.definition})].concat(r,s);this.walk(e,n)}walkAtLeastOneSep(e,r,s){let n=Vl(e,r,s);this.walk(e,n)}walkMany(e,r,s){let n=[new re({definition:e.definition})].concat(r,s);this.walk(e,n)}walkManySep(e,r,s){let n=Vl(e,r,s);this.walk(e,n)}walkOr(e,r,s){let n=r.concat(s);x(e.definition,(i)=>{let o=new Z({definition:[i]});this.walk(o,n)})}}function Vl(e,r,s){return[new re({definition:[new w({terminalType:e.separator})].concat(e.definition)})].concat(r,s)}function sr(e){if(e instanceof J)return sr(e.referencedRule);else if(e instanceof w)return ZE(e);else if(ai(e))return qE(e);else if(li(e))return JE(e);else throw Error("non exhaustive match")}function qE(e){let r=[],s=e.definition,n=0,i=s.length>n,o,c=!0;while(i&&c)o=s[n],c=rr(o),r=r.concat(sr(o)),n=n+1,i=s.length>n;return wr(r)}function JE(e){let r=y(e.definition,(s)=>sr(s));return wr(xe(r))}function ZE(e){return[e.terminalType]}var fn="_~IN~_";class Hl extends Jt{constructor(e){super();this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,s){}walkProdRef(e,r,s){let n=QE(e.referencedRule,e.idx)+this.topProd.name,i=r.concat(s),o=new Z({definition:i}),c=sr(o);this.follows[n]=c}}function Yl(e){let r={};return x(e,(s)=>{let n=new Hl(s).startWalking();Ne(r,n)}),r}function QE(e,r){return e.name+r+fn}function k(e){return e.charCodeAt(0)}function hn(e,r){if(Array.isArray(e))e.forEach(function(s){r.push(s)});else r.push(e)}function Fr(e,r){if(e[r]===!0)throw"duplicate flag "+r;let s=e[r];e[r]=!0}function nr(e){if(e===void 0)throw Error("Internal Error - Should never get here!");return!0}function as(){throw Error("Internal Error - Should never get here!")}function ci(e){return e.type==="Character"}var ls=[];for(let e=k("0");e<=k("9");e++)ls.push(e);var cs=[k("_")].concat(ls);for(let e=k("a");e<=k("z");e++)cs.push(e);for(let e=k("A");e<=k("Z");e++)cs.push(e);var ui=[k(" "),k("\f"),k(`
2
2
  `),k("\r"),k("\t"),k("\v"),k("\t"),k(" "),k(" "),k(" "),k(" "),k(" "),k(" "),k(" "),k(" "),k(" "),k(" "),k(" "),k(" "),k(" "),k("\u2028"),k("\u2029"),k(" "),k(" "),k(" "),k("\uFEFF")];var ey=/[0-9a-fA-F]/,dn=/[0-9]/,ty=/[1-9]/;class pn{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 r=this.disjunction();this.consumeChar("/");let s={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};while(this.isRegExpFlag())switch(this.popChar()){case"g":Fr(s,"global");break;case"i":Fr(s,"ignoreCase");break;case"m":Fr(s,"multiLine");break;case"u":Fr(s,"unicode");break;case"y":Fr(s,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:s,value:r,loc:this.loc(0)}}disjunction(){let e=[],r=this.idx;e.push(this.alternative());while(this.peekChar()==="|")this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(r)}}alternative(){let e=[],r=this.idx;while(this.isTerm())e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(r)}}term(){if(this.isAssertion())return this.assertion();else return 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"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":r="Lookbehind";break;case"!":r="NegativeLookbehind"}break}}nr(r);let s=this.disjunction();return this.consumeChar(")"),{type:r,value:s,loc:this.loc(e)}}return as()}quantifier(e=!1){let r=void 0,s=this.idx;switch(this.popChar()){case"*":r={atLeast:0,atMost:1/0};break;case"+":r={atLeast:1,atMost:1/0};break;case"?":r={atLeast:0,atMost:1};break;case"{":let n=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:n,atMost:n};break;case",":let i;if(this.isDigit())i=this.integerIncludingZero(),r={atLeast:n,atMost:i};else r={atLeast:n,atMost:1/0};this.consumeChar("}");break}if(e===!0&&r===void 0)return;nr(r);break}if(e===!0&&r===void 0)return;if(nr(r)){if(this.peekChar(0)==="?")this.consumeChar("?"),r.greedy=!1;else r.greedy=!0;return r.type="Quantifier",r.loc=this.loc(s),r}}atom(){let e,r=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter())e=this.patternCharacter();if(nr(e)){if(e.loc=this.loc(r),this.isQuantifier())e.quantifier=this.quantifier();return e}return as()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[k(`
3
3
  `),k("\r"),k("\u2028"),k("\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,r=!1;switch(this.popChar()){case"d":e=ls;break;case"D":e=ls,r=!0;break;case"s":e=ui;break;case"S":e=ui,r=!0;break;case"w":e=cs;break;case"W":e=cs,r=!0;break}if(nr(e))return{type:"Set",value:e,complement:r};return as()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=k("\f");break;case"n":e=k(`
4
4
  `);break;case"r":e=k("\r");break;case"t":e=k("\t");break;case"v":e=k("\v");break}if(nr(e))return{type:"Character",value:e};return as()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:k("\x00")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:k(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
@@ -41,7 +41,7 @@ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;r.
41
41
  Root cause: ${r.errMsg}.
42
42
  For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;else if(r.issue===se.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
43
43
  The problem is in the <${e.name}> Token Type
44
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;else throw Error("non exhaustive match")}function cc(e){return y(e,(s)=>{if(Se(s))return s.charCodeAt(0);else return s})}function di(e,r,s){if(e[r]===void 0)e[r]=[s];else e[r].push(s)}var $r=256,An=[];function xt(e){return e<$r?e:An[e]}function Sy(){if(M(An)){An=Array(65536);for(let e=0;e<65536;e++)An[e]=e>255?255+~~(e/255):e}}function Ct(e,r){let s=e.tokenTypeIdx;if(s===r.tokenTypeIdx)return!0;else return r.isParent===!0&&r.categoryMatchesMap[s]===!0}function Wr(e,r){return e.tokenTypeIdx===r.tokenTypeIdx}var uc=1,hc={};function vt(e){let r=Ry(e);Oy(r),Iy(r),Ly(r),x(r,(s)=>{s.isParent=s.categoryMatches.length>0})}function Ry(e){let r=Y(e),s=e,n=!0;while(n){s=mt(xe(y(s,(o)=>o.CATEGORIES)));let i=Ht(s,r);if(r=r.concat(i),M(i))n=!1;else s=i}return r}function Oy(e){x(e,(r)=>{if(!pi(r))hc[uc]=r,r.tokenTypeIdx=uc++;if(fc(r)&&!L(r.CATEGORIES))r.CATEGORIES=[r.CATEGORIES];if(!fc(r))r.CATEGORIES=[];if(!Ny(r))r.categoryMatches=[];if(!by(r))r.categoryMatchesMap={}})}function Ly(e){x(e,(r)=>{r.categoryMatches=[],x(r.categoryMatchesMap,(s,n)=>{r.categoryMatches.push(hc[n].tokenTypeIdx)})})}function Iy(e){x(e,(r)=>{dc([],r)})}function dc(e,r){x(e,(s)=>{r.categoryMatchesMap[s.tokenTypeIdx]=!0}),x(r.CATEGORIES,(s)=>{let n=e.concat(r);if(!te(n,s))dc(n,s)})}function pi(e){return S(e,"tokenTypeIdx")}function fc(e){return S(e,"CATEGORIES")}function Ny(e){return S(e,"categoryMatches")}function by(e){return S(e,"categoryMatchesMap")}function pc(e){return S(e,"tokenTypeIdx")}var mi={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,r,s,n,i,o){return`unexpected character: ->${e.charAt(r)}<- at offset: ${r}, skipped ${s} characters.`}};var se;(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"})(se||(se={}));var fs={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
44
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;else throw Error("non exhaustive match")}function cc(e){return y(e,(s)=>{if(Se(s))return s.charCodeAt(0);else return s})}function di(e,r,s){if(e[r]===void 0)e[r]=[s];else e[r].push(s)}var $r=256,yn=[];function xt(e){return e<$r?e:yn[e]}function Sy(){if(M(yn)){yn=Array(65536);for(let e=0;e<65536;e++)yn[e]=e>255?255+~~(e/255):e}}function Ct(e,r){let s=e.tokenTypeIdx;if(s===r.tokenTypeIdx)return!0;else return r.isParent===!0&&r.categoryMatchesMap[s]===!0}function Wr(e,r){return e.tokenTypeIdx===r.tokenTypeIdx}var uc=1,hc={};function vt(e){let r=Ry(e);Oy(r),Iy(r),Ly(r),x(r,(s)=>{s.isParent=s.categoryMatches.length>0})}function Ry(e){let r=Y(e),s=e,n=!0;while(n){s=mt(xe(y(s,(o)=>o.CATEGORIES)));let i=Ht(s,r);if(r=r.concat(i),M(i))n=!1;else s=i}return r}function Oy(e){x(e,(r)=>{if(!pi(r))hc[uc]=r,r.tokenTypeIdx=uc++;if(fc(r)&&!L(r.CATEGORIES))r.CATEGORIES=[r.CATEGORIES];if(!fc(r))r.CATEGORIES=[];if(!Ny(r))r.categoryMatches=[];if(!by(r))r.categoryMatchesMap={}})}function Ly(e){x(e,(r)=>{r.categoryMatches=[],x(r.categoryMatchesMap,(s,n)=>{r.categoryMatches.push(hc[n].tokenTypeIdx)})})}function Iy(e){x(e,(r)=>{dc([],r)})}function dc(e,r){x(e,(s)=>{r.categoryMatchesMap[s.tokenTypeIdx]=!0}),x(r.CATEGORIES,(s)=>{let n=e.concat(r);if(!te(n,s))dc(n,s)})}function pi(e){return S(e,"tokenTypeIdx")}function fc(e){return S(e,"CATEGORIES")}function Ny(e){return S(e,"categoryMatches")}function by(e){return S(e,"categoryMatchesMap")}function pc(e){return S(e,"tokenTypeIdx")}var mi={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,r,s,n,i,o){return`unexpected character: ->${e.charAt(r)}<- at offset: ${r}, skipped ${s} characters.`}};var se;(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"})(se||(se={}));var fs={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
45
45
  `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:mi,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(fs);class ie{constructor(e,r=fs){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(n,i)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let o=Array(this.traceInitIndent+1).join("\t");if(this.traceInitIndent<this.traceInitMaxIdent)console.log(`${o}--> <${n}>`);let{time:c,value:u}=is(i),a=c>10?console.warn:console.log;if(this.traceInitIndent<this.traceInitMaxIdent)a(`${o}<-- <${n}> time: ${c}ms`);return this.traceInitIndent--,u}else return i()},typeof r==="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
46
46
  a boolean 2nd argument is no longer supported`);this.config=Ne({},fs,r);let s=this.config.traceInitPerf;if(s===!0)this.traceInitMaxIdent=1/0,this.traceInitPerf=!0;else if(typeof s==="number")this.traceInitMaxIdent=s,this.traceInitPerf=!0;this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let n,i=!0;if(this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===fs.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ac;else if(this.config.lineTerminatorCharacters===fs.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
47
47
  For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(r.safeMode&&r.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');if(this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),L(e))n={modes:{defaultMode:Y(e)},defaultMode:Gr};else i=!1,n=Y(e)}),this.config.skipValidations===!1)this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(sc(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(nc(n,this.trackStartLines,this.config.lineTerminatorCharacters))});n.modes=n.modes?n.modes:{},x(n.modes,(c,u)=>{n.modes[u]=qt(c,(a)=>_e(a))});let o=W(n.modes);if(x(n.modes,(c,u)=>{this.TRACE_INIT(`Mode: <${u}> processing`,()=>{if(this.modes.push(u),this.config.skipValidations===!1)this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(rc(c,o))});if(M(this.lexerDefinitionErrors)){vt(c);let a;this.TRACE_INIT("analyzeTokenTypes",()=>{a=tc(c,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[u]=a.patternIdxToConfig,this.charCodeToPatternIdxToConfig[u]=a.charCodeToPatternIdxToConfig,this.emptyGroups=Ne({},this.emptyGroups,a.emptyGroups),this.hasCustom=a.hasCustom||this.hasCustom,this.canModeBeOptimized[u]=a.canBeOptimized}})}),this.defaultMode=n.defaultMode,!M(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let u=y(this.lexerDefinitionErrors,(a)=>a.message).join(`-----------------------
@@ -51,12 +51,12 @@ a boolean 2nd argument is no longer supported`);this.config=Ne({},fs,r);let s=th
51
51
  Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Xl()}),this.TRACE_INIT("toFastProperties",()=>{os(this)})})}tokenize(e,r=this.defaultMode){if(!M(this.lexerDefinitionErrors)){let n=y(this.lexerDefinitionErrors,(i)=>i.message).join(`-----------------------
52
52
  `);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
53
53
  `+n)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let s,n,i,o,c,u,a,f,d,m,g,E,b,v,I,A=e,O=A.length,T=0,_=0,Q=this.hasCustom?0:Math.floor(e.length/10),Ce=Array(Q),Xr=[],St=this.trackStartLines?1:void 0,lt=this.trackStartLines?1:void 0,qr=ic(this.emptyGroups),ff=this.trackStartLines,qn=this.config.lineTerminatorsPattern,Ns=0,Mt=[],Jr=[],Zr=[],Ji=[];Object.freeze(Ji);let Qr=!1,hf=(Be)=>{if(Zr.length===1&&Be.tokenType.PUSH_MODE===void 0){let Ye=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(Be);Xr.push({offset:Be.startOffset,line:Be.startLine,column:Be.startColumn,length:Be.image.length,message:Ye})}else{Zr.pop();let Ye=it(Zr);Mt=this.patternIdxToConfig[Ye],Jr=this.charCodeToPatternIdxToConfig[Ye],Ns=Mt.length;let Jn=this.canModeBeOptimized[Ye]&&this.config.safeMode===!1;if(Jr&&Jn)Qr=!0;else Qr=!1}};function Zi(Be){Zr.push(Be),Jr=this.charCodeToPatternIdxToConfig[Be],Mt=this.patternIdxToConfig[Be],Ns=Mt.length,Ns=Mt.length;let Ye=this.canModeBeOptimized[Be]&&this.config.safeMode===!1;if(Jr&&Ye)Qr=!0;else Qr=!1}Zi.call(this,r);let rt,Qi=this.config.recoveryEnabled;while(T<O){u=null,d=-1;let Be=A.charCodeAt(T),Ye;if(Qr){let we=xt(Be),qe=Jr[we];Ye=qe!==void 0?qe:Ji}else Ye=Mt;let Jn=Ye.length;for(s=0;s<Jn;s++){rt=Ye[s];let we=rt.pattern;a=null;let qe=rt.short;if(qe!==!1){if(Be===qe)d=1,u=we}else if(rt.isCustom===!0)if(I=we.exec(A,T,Ce,qr),I!==null){if(u=I[0],d=u.length,I.payload!==void 0)a=I.payload}else u=null;else we.lastIndex=T,d=this.matchLength(we,e,T);if(d!==-1){if(c=rt.longerAlt,c!==void 0){u=e.substring(T,T+d);let wt=c.length;for(i=0;i<wt;i++){let Ot=Mt[c[i]],Qt=Ot.pattern;if(f=null,Ot.isCustom===!0)if(I=Qt.exec(A,T,Ce,qr),I!==null){if(o=I[0],I.payload!==void 0)f=I.payload}else o=null;else Qt.lastIndex=T,o=this.match(Qt,e,T);if(o&&o.length>u.length){u=o,d=o.length,a=f,rt=Ot;break}}}break}}if(d!==-1){if(m=rt.group,m!==void 0)if(u=u!==null?u:e.substring(T,T+d),g=rt.tokenTypeIdx,E=this.createTokenInstance(u,T,g,rt.tokenType,St,lt,d),this.handlePayload(E,a),m===!1)_=this.addToken(Ce,_,E);else qr[m].push(E);if(ff===!0&&rt.canLineTerminator===!0){let we=0,qe,wt;qn.lastIndex=0;do if(u=u!==null?u:e.substring(T,T+d),qe=qn.test(u),qe===!0)wt=qn.lastIndex-1,we++;while(qe===!0);if(we!==0)St=St+we,lt=d-wt,this.updateTokenEndLineColumnLocation(E,m,wt,we,St,lt,d);else lt=this.computeNewColumn(lt,d)}else lt=this.computeNewColumn(lt,d);T=T+d,this.handleModes(rt,hf,Zi,E)}else{let we=T,qe=St,wt=lt,Ot=Qi===!1;while(Ot===!1&&T<O){T++;for(n=0;n<Ns;n++){let Qt=Mt[n],{pattern:Zn,short:eo}=Qt;if(eo!==!1){if(A.charCodeAt(T)===eo)Ot=!0}else if(Qt.isCustom===!0)Ot=Zn.exec(A,T,Ce,qr)!==null;else Zn.lastIndex=T,Ot=Zn.exec(e)!==null;if(Ot===!0)break}}if(b=T-we,lt=this.computeNewColumn(lt,b),v=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(A,we,b,qe,wt,it(Zr)),Xr.push({offset:we,line:qe,column:wt,length:b,message:v}),Qi===!1)break}}if(!this.hasCustom)Ce.length=_;return{tokens:Ce,groups:qr,errors:Xr}}handleModes(e,r,s,n){if(e.pop===!0){let i=e.push;if(r(n),i!==void 0)s.call(this,i)}else if(e.push!==void 0)s.call(this,e.push)}updateTokenEndLineColumnLocation(e,r,s,n,i,o,c){let u,a;if(r!==void 0){if(u=s===c-1,a=u?-1:0,!(n===1&&u===!0))e.endLine=i+a,e.endColumn=o-1+-a}}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,s,n){return{image:e,startOffset:r,tokenTypeIdx:s,tokenType:n}}createStartOnlyToken(e,r,s,n,i,o){return{image:e,startOffset:r,startLine:i,startColumn:o,tokenTypeIdx:s,tokenType:n}}createFullToken(e,r,s,n,i,o,c){return{image:e,startOffset:r,endOffset:r+c-1,startLine:i,endLine:i,startColumn:o,endColumn:o+c-1,tokenTypeIdx:s,tokenType:n}}addTokenUsingPush(e,r,s){return e.push(s),r}addTokenUsingMemberAccess(e,r,s){return e[r]=s,r++,r}handlePayloadNoCustom(e,r){}handlePayloadWithCustom(e,r){if(r!==null)e.payload=r}match(e,r,s){if(e.test(r)===!0)return r.substring(s,e.lastIndex);return null}matchLength(e,r,s){if(e.test(r)===!0)return e.lastIndex-s;return-1}}ie.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.";ie.NA=/NOT_APPLICABLE/;function ar(e){if(gi(e))return e.LABEL;else return e.name}function gi(e){return Se(e.LABEL)&&e.LABEL!==""}var Cy="parent",mc="categories",gc="label",Tc="group",Ec="push_mode",yc="pop_mode",Ac="longer_alt",xc="line_breaks",Sc="start_chars_hint";function N(e){return vy(e)}function vy(e){let r=e.pattern,s={};if(s.name=e.name,!_e(r))s.PATTERN=r;if(S(e,Cy))throw`The parent property is no longer supported.
54
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;if(S(e,mc))s.CATEGORIES=e[mc];if(vt([s]),S(e,gc))s.LABEL=e[gc];if(S(e,Tc))s.GROUP=e[Tc];if(S(e,yc))s.POP_MODE=e[yc];if(S(e,Ec))s.PUSH_MODE=e[Ec];if(S(e,Ac))s.LONGER_ALT=e[Ac];if(S(e,xc))s.LINE_BREAKS=e[xc];if(S(e,Sc))s.START_CHARS_HINT=e[Sc];return s}var Ve=N({name:"EOF",pattern:ie.NA});vt([Ve]);function lr(e,r,s,n,i,o,c,u){return{image:r,startOffset:s,endOffset:n,startLine:i,endLine:o,startColumn:c,endColumn:u,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function hs(e,r){return Ct(e,r)}var xn={buildMismatchTokenMessage({expected:e,actual:r,previous:s,ruleName:n}){return`Expecting ${gi(e)?`--> ${ar(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${r.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:r}){return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:r,previous:s,customUserDescription:n,ruleName:i}){let u=`
54
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;if(S(e,mc))s.CATEGORIES=e[mc];if(vt([s]),S(e,gc))s.LABEL=e[gc];if(S(e,Tc))s.GROUP=e[Tc];if(S(e,yc))s.POP_MODE=e[yc];if(S(e,Ec))s.PUSH_MODE=e[Ec];if(S(e,Ac))s.LONGER_ALT=e[Ac];if(S(e,xc))s.LINE_BREAKS=e[xc];if(S(e,Sc))s.START_CHARS_HINT=e[Sc];return s}var Ve=N({name:"EOF",pattern:ie.NA});vt([Ve]);function lr(e,r,s,n,i,o,c,u){return{image:r,startOffset:s,endOffset:n,startLine:i,endLine:o,startColumn:c,endColumn:u,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function hs(e,r){return Ct(e,r)}var An={buildMismatchTokenMessage({expected:e,actual:r,previous:s,ruleName:n}){return`Expecting ${gi(e)?`--> ${ar(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${r.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:r}){return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:r,previous:s,customUserDescription:n,ruleName:i}){let u=`
55
55
  but found: '`+Le(r).image+"'";if(n)return"Expecting: "+n+u;else{let a=Te(e,(g,E)=>g.concat(E),[]),f=y(a,(g)=>`[${y(g,(E)=>ar(E)).join(", ")}]`);return`Expecting: one of these possible Token sequences:
56
56
  ${y(f,(g,E)=>` ${E+1}. ${g}`).join(`
57
57
  `)}`+u}},buildEarlyExitMessage({expectedIterationPaths:e,actual:r,customUserDescription:s,ruleName:n}){let c=`
58
58
  but found: '`+Le(r).image+"'";if(s)return"Expecting: "+s+c;else return`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::
59
- <${y(e,(f)=>`[${y(f,(d)=>ar(d)).join(",")}]`).join(" ,")}>`+c}};Object.freeze(xn);var Rc={buildRuleNotFoundError(e,r){return"Invalid grammar, reference to a rule which is not defined: ->"+r.nonTerminalName+`<-
59
+ <${y(e,(f)=>`[${y(f,(d)=>ar(d)).join(",")}]`).join(" ,")}>`+c}};Object.freeze(An);var Rc={buildRuleNotFoundError(e,r){return"Invalid grammar, reference to a rule which is not defined: ->"+r.nonTerminalName+`<-
60
60
  inside top level rule: ->`+e.name+"<-"}},ot={buildDuplicateFoundError(e,r){function s(d){if(d instanceof w)return d.terminalType.name;else if(d instanceof J)return d.nonTerminalName;else return""}let n=e.name,i=Le(r),o=i.idx,c=ze(i),u=s(i),a=o>0,f=`->${c}${a?o:""}<- ${u?`with argument: ->${u}<-`:""}
61
61
  appears more than once (${r.length} times) in the top level rule: ->${n}<-.
62
62
  For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
@@ -83,7 +83,7 @@ rule: <${r}> can be invoked from itself (directly or indirectly)
83
83
  without consuming any Tokens. The grammar path that causes this is:
84
84
  ${n}
85
85
  To fix this refactor your grammar to remove the left recursion.
86
- see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let r;if(e.topLevelRule instanceof je)r=e.topLevelRule.name;else r=e.topLevelRule;return`Duplicate definition, rule: ->${r}<- is already defined in the grammar: ->${e.grammarName}<-`}};function Oc(e,r){let s=new Lc(e,r);return s.resolveRefs(),s.errors}class Lc extends Ke{constructor(e,r){super();this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){x(G(this.nameToTopRule),(e)=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(!r){let s=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:s,type:Re.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}else e.referencedRule=r}}class Ic extends Jt{constructor(e,r){super();this.topProd=e,this.path=r,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=Y(this.path.ruleStack).reverse(),this.occurrenceStack=Y(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){if(!this.found)super.walk(e,r)}walkProdRef(e,r,s){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let n=r.concat(s);this.updateExpectedNext(),this.walk(e.referencedRule,n)}}updateExpectedNext(){if(M(this.ruleStack))this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0;else this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop()}}class Ti extends Ic{constructor(e,r){super(e,r);this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,s){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let n=r.concat(s),i=new Z({definition:n});this.possibleTokTypes=sr(i),this.found=!0}}}class ds extends Jt{constructor(e,r){super();this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Ei extends ds{walkMany(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkMany(e,r,s)}}class Sn extends ds{walkManySep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkManySep(e,r,s)}}class yi extends ds{walkAtLeastOne(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOne(e,r,s)}}class Rn extends ds{walkAtLeastOneSep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOneSep(e,r,s)}}function On(e,r,s=[]){s=Y(s);let n=[],i=0;function o(u){return u.concat(fe(e,i+1))}function c(u){let a=On(o(u),r,s);return n.concat(a)}while(s.length<r&&i<e.length){let u=e[i];if(u instanceof Z)return c(u.definition);else if(u instanceof J)return c(u.definition);else if(u instanceof re)n=c(u.definition);else if(u instanceof Ee){let a=u.definition.concat([new B({definition:u.definition})]);return c(a)}else if(u instanceof ye){let a=[new Z({definition:u.definition}),new B({definition:[new w({terminalType:u.separator})].concat(u.definition)})];return c(a)}else if(u instanceof he){let a=u.definition.concat([new B({definition:[new w({terminalType:u.separator})].concat(u.definition)})]);n=c(a)}else if(u instanceof B){let a=u.definition.concat([new B({definition:u.definition})]);n=c(a)}else if(u instanceof de)return x(u.definition,(a)=>{if(M(a.definition)===!1)n=c(a.definition)}),n;else if(u instanceof w)s.push(u.terminalType);else throw Error("non exhaustive match");i++}return n.push({partialPath:s,suffixDef:fe(e,i)}),n}function Ln(e,r,s,n){let o=["EXIT_NONE_TERMINAL"],c="EXIT_ALTERNATIVE",u=!1,a=r.length,f=a-n-1,d=[],m=[];m.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});while(!M(m)){let g=m.pop();if(g==="EXIT_ALTERNATIVE"){if(u&&it(m).idx<=f)m.pop();continue}let{def:E,idx:b,ruleStack:v,occurrenceStack:I}=g;if(M(E))continue;let A=E[0];if(A==="EXIT_NONE_TERMINAL"){let O={idx:b,def:fe(E),ruleStack:bt(v),occurrenceStack:bt(I)};m.push(O)}else if(A instanceof w)if(b<a-1){let O=b+1,T=r[O];if(s(T,A.terminalType)){let _={idx:O,def:fe(E),ruleStack:v,occurrenceStack:I};m.push(_)}}else if(b===a-1)d.push({nextTokenType:A.terminalType,nextTokenOccurrence:A.idx,ruleStack:v,occurrenceStack:I}),u=!0;else throw Error("non exhaustive match");else if(A instanceof J){let O=Y(v);O.push(A.nonTerminalName);let T=Y(I);T.push(A.idx);let _={idx:b,def:A.definition.concat(o,fe(E)),ruleStack:O,occurrenceStack:T};m.push(_)}else if(A instanceof re){let O={idx:b,def:fe(E),ruleStack:v,occurrenceStack:I};m.push(O),m.push("EXIT_ALTERNATIVE");let T={idx:b,def:A.definition.concat(fe(E)),ruleStack:v,occurrenceStack:I};m.push(T)}else if(A instanceof Ee){let O=new B({definition:A.definition,idx:A.idx}),T=A.definition.concat([O],fe(E)),_={idx:b,def:T,ruleStack:v,occurrenceStack:I};m.push(_)}else if(A instanceof ye){let O=new w({terminalType:A.separator}),T=new B({definition:[O].concat(A.definition),idx:A.idx}),_=A.definition.concat([T],fe(E)),Q={idx:b,def:_,ruleStack:v,occurrenceStack:I};m.push(Q)}else if(A instanceof he){let O={idx:b,def:fe(E),ruleStack:v,occurrenceStack:I};m.push(O),m.push("EXIT_ALTERNATIVE");let T=new w({terminalType:A.separator}),_=new B({definition:[T].concat(A.definition),idx:A.idx}),Q=A.definition.concat([_],fe(E)),Ce={idx:b,def:Q,ruleStack:v,occurrenceStack:I};m.push(Ce)}else if(A instanceof B){let O={idx:b,def:fe(E),ruleStack:v,occurrenceStack:I};m.push(O),m.push("EXIT_ALTERNATIVE");let T=new B({definition:A.definition,idx:A.idx}),_=A.definition.concat([T],fe(E)),Q={idx:b,def:_,ruleStack:v,occurrenceStack:I};m.push(Q)}else if(A instanceof de)for(let O=A.definition.length-1;O>=0;O--){let T=A.definition[O],_={idx:b,def:T.definition.concat(fe(E)),ruleStack:v,occurrenceStack:I};m.push(_),m.push("EXIT_ALTERNATIVE")}else if(A instanceof Z)m.push({idx:b,def:A.definition.concat(fe(E)),ruleStack:v,occurrenceStack:I});else if(A instanceof je)m.push(ky(A,b,v,I));else throw Error("non exhaustive match")}return d}function ky(e,r,s,n){let i=Y(s);i.push(e.name);let o=Y(n);return o.push(1),{idx:r,def:e.definition,ruleStack:i,occurrenceStack:o}}var oe;(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"})(oe||(oe={}));function In(e){if(e instanceof re||e==="Option")return oe.OPTION;else if(e instanceof B||e==="Repetition")return oe.REPETITION;else if(e instanceof Ee||e==="RepetitionMandatory")return oe.REPETITION_MANDATORY;else if(e instanceof ye||e==="RepetitionMandatoryWithSeparator")return oe.REPETITION_MANDATORY_WITH_SEPARATOR;else if(e instanceof he||e==="RepetitionWithSeparator")return oe.REPETITION_WITH_SEPARATOR;else if(e instanceof de||e==="Alternation")return oe.ALTERNATION;else throw Error("non exhaustive match")}function bc(e,r,s,n,i,o){let c=ps(e,r,s),u=Pc(c)?Wr:Ct;return o(c,n,u,i)}function Cc(e,r,s,n,i,o){let c=ms(e,r,i,s),u=Pc(c)?Wr:Ct;return o(c[0],u,n)}function vc(e,r,s,n){let i=e.length,o=ve(e,(c)=>ve(c,(u)=>u.length===1));if(r)return function(c){let u=y(c,(a)=>a.GATE);for(let a=0;a<i;a++){let f=e[a],d=f.length,m=u[a];if(m!==void 0&&m.call(this)===!1)continue;e:for(let g=0;g<d;g++){let E=f[g],b=E.length;for(let v=0;v<b;v++){let I=this.LA(v+1);if(s(I,E[v])===!1)continue e}return a}}return};else if(o&&!n){let c=y(e,(a)=>xe(a)),u=Te(c,(a,f,d)=>(x(f,(m)=>{if(!S(a,m.tokenTypeIdx))a[m.tokenTypeIdx]=d;x(m.categoryMatches,(g)=>{if(!S(a,g))a[g]=d})}),a),{});return function(){let a=this.LA(1);return u[a.tokenTypeIdx]}}else return function(){for(let c=0;c<i;c++){let u=e[c],a=u.length;e:for(let f=0;f<a;f++){let d=u[f],m=d.length;for(let g=0;g<m;g++){let E=this.LA(g+1);if(s(E,d[g])===!1)continue e}return c}}return}}function kc(e,r,s){let n=ve(e,(o)=>o.length===1),i=e.length;if(n&&!s){let o=xe(e);if(o.length===1&&M(o[0].categoryMatches)){let u=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===u}}else{let c=Te(o,(u,a,f)=>(u[a.tokenTypeIdx]=!0,x(a.categoryMatches,(d)=>{u[d]=!0}),u),[]);return function(){let u=this.LA(1);return c[u.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let c=e[o],u=c.length;for(let a=0;a<u;a++){let f=this.LA(a+1);if(r(f,c[a])===!1)continue e}return!0}return!1}}class _c extends Jt{constructor(e,r,s){super();this.topProd=e,this.targetOccurrence=r,this.targetProdType=s}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,s,n){if(e.idx===this.targetOccurrence&&this.targetProdType===r)return this.restDef=s.concat(n),!0;return!1}walkOption(e,r,s){if(!this.checkIsTarget(e,oe.OPTION,r,s))super.walkOption(e,r,s)}walkAtLeastOne(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_MANDATORY,r,s))super.walkOption(e,r,s)}walkAtLeastOneSep(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR,r,s))super.walkOption(e,r,s)}walkMany(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION,r,s))super.walkOption(e,r,s)}walkManySep(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_WITH_SEPARATOR,r,s))super.walkOption(e,r,s)}}class xi extends Ke{constructor(e,r,s){super();this.targetOccurrence=e,this.targetProdType=r,this.targetRef=s,this.result=[]}checkIsTarget(e,r){if(e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef))this.result=e.definition}visitOption(e){this.checkIsTarget(e,oe.OPTION)}visitRepetition(e){this.checkIsTarget(e,oe.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,oe.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,oe.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,oe.ALTERNATION)}}function Nc(e){let r=Array(e);for(let s=0;s<e;s++)r[s]=[];return r}function Ai(e){let r=[""];for(let s=0;s<e.length;s++){let n=e[s],i=[];for(let o=0;o<r.length;o++){let c=r[o];i.push(c+"_"+n.tokenTypeIdx);for(let u=0;u<n.categoryMatches.length;u++){let a="_"+n.categoryMatches[u];i.push(c+a)}}r=i}return r}function _y(e,r,s){for(let n=0;n<e.length;n++){if(n===s)continue;let i=e[n];for(let o=0;o<r.length;o++){let c=r[o];if(i[c]===!0)return!1}}return!0}function Mc(e,r){let s=y(e,(c)=>On([c],1)),n=Nc(s.length),i=y(s,(c)=>{let u={};return x(c,(a)=>{let f=Ai(a.partialPath);x(f,(d)=>{u[d]=!0})}),u}),o=s;for(let c=1;c<=r;c++){let u=o;o=Nc(u.length);for(let a=0;a<u.length;a++){let f=u[a];for(let d=0;d<f.length;d++){let m=f[d].partialPath,g=f[d].suffixDef,E=Ai(m);if(_y(i,E,a)||M(g)||m.length===r){let v=n[a];if(Nn(v,m)===!1){v.push(m);for(let I=0;I<E.length;I++){let A=E[I];i[a][A]=!0}}}else{let v=On(g,c+1,m);o[a]=o[a].concat(v),x(v,(I)=>{let A=Ai(I.partialPath);x(A,(O)=>{i[a][O]=!0})})}}}}return n}function ps(e,r,s,n){let i=new xi(e,oe.ALTERNATION,n);return r.accept(i),Mc(i.result,s)}function ms(e,r,s,n){let i=new xi(e,s);r.accept(i);let o=i.result,u=new _c(r,e,s).startWalking(),a=new Z({definition:o}),f=new Z({definition:u});return Mc([a,f],n)}function Nn(e,r){e:for(let s=0;s<e.length;s++){let n=e[s];if(n.length!==r.length)continue;for(let i=0;i<n.length;i++){let o=r[i],c=n[i];if((o===c||c.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}return!1}function wc(e,r){return e.length<r.length&&ve(e,(s,n)=>{let i=r[n];return s===i||i.categoryMatchesMap[s.tokenTypeIdx]})}function Pc(e){return ve(e,(r)=>ve(r,(s)=>ve(s,(n)=>M(n.categoryMatches))))}function Uc(e){let r=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return y(r,(s)=>Object.assign({type:Re.CUSTOM_LOOKAHEAD_VALIDATION},s))}function Dc(e,r,s,n){let i=De(e,(a)=>My(a,s)),o=By(e,r,s),c=De(e,(a)=>Uy(a,s)),u=De(e,(a)=>Py(a,e,n,s));return i.concat(o,c,u)}function My(e,r){let s=new Bc;e.accept(s);let n=s.allProductions,i=oi(n,wy),o=We(i,(u)=>u.length>1);return y(G(o),(u)=>{let a=Le(u),f=r.buildDuplicateFoundError(e,u),d=ze(a),m={message:f,type:Re.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:d,occurrence:a.idx},g=Fc(a);if(g)m.parameter=g;return m})}function wy(e){return`${ze(e)}_#_${e.idx}_#_${Fc(e)}`}function Fc(e){if(e instanceof w)return e.terminalType.name;else if(e instanceof J)return e.nonTerminalName;else return""}class Bc extends Ke{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 Py(e,r,s,n){let i=[];if(Te(r,(c,u)=>{if(u.name===e.name)return c+1;return c},0)>1){let c=n.buildDuplicateRuleNameError({topLevelRule:e,grammarName:s});i.push({message:c,type:Re.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function $c(e,r,s){let n=[],i;if(!te(r,e))i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${s}<-as it is not defined in any of the super grammars `,n.push({message:i,type:Re.INVALID_RULE_OVERRIDE,ruleName:e});return n}function Si(e,r,s,n=[]){let i=[],o=bn(r.definition);if(M(o))return[];else{let c=e.name;if(te(o,e))i.push({message:s.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:n}),type:Re.LEFT_RECURSION,ruleName:c});let a=Ht(o,n.concat([e])),f=De(a,(d)=>{let m=Y(n);return m.push(d),Si(e,d,s,m)});return i.concat(f)}}function bn(e){let r=[];if(M(e))return r;let s=Le(e);if(s instanceof J)r.push(s.referencedRule);else if(s instanceof Z||s instanceof re||s instanceof Ee||s instanceof ye||s instanceof he||s instanceof B)r=r.concat(bn(s.definition));else if(s instanceof de)r=xe(y(s.definition,(o)=>bn(o.definition)));else if(s instanceof w);else throw Error("non exhaustive match");let n=rr(s),i=e.length>1;if(n&&i){let o=fe(e);return r.concat(bn(o))}else return r}class Cn extends Ke{constructor(){super(...arguments);this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Gc(e,r){let s=new Cn;e.accept(s);let n=s.alternations;return De(n,(o)=>{let c=bt(o.definition);return De(c,(u,a)=>{let f=Ln([u],[],Ct,1);if(M(f))return[{message:r.buildEmptyAlternationError({topLevelRule:e,alternation:o,emptyChoiceIdx:a}),type:Re.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:o.idx,alternative:a+1}];else return[]})})}function Wc(e,r,s){let n=new Cn;e.accept(n);let i=n.alternations;return i=qt(i,(c)=>c.ignoreAmbiguities===!0),De(i,(c)=>{let u=c.idx,a=c.maxLookahead||r,f=ps(u,e,a,c),d=Dy(f,c,e,s),m=Fy(f,c,e,s);return d.concat(m)})}class jc extends Ke{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 Uy(e,r){let s=new Cn;e.accept(s);let n=s.alternations;return De(n,(o)=>{if(o.definition.length>255)return[{message:r.buildTooManyAlternativesError({topLevelRule:e,alternation:o}),type:Re.TOO_MANY_ALTS,ruleName:e.name,occurrence:o.idx}];else return[]})}function Kc(e,r,s){let n=[];return x(e,(i)=>{let o=new jc;i.accept(o);let c=o.allProductions;x(c,(u)=>{let a=In(u),f=u.maxLookahead||r,d=u.idx,g=ms(d,i,a,f)[0];if(M(xe(g))){let E=s.buildEmptyRepetitionError({topLevelRule:i,repetition:u});n.push({message:E,type:Re.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function Dy(e,r,s,n){let i=[],o=Te(e,(u,a,f)=>{if(r.definition[f].ignoreAmbiguities===!0)return u;return x(a,(d)=>{let m=[f];if(x(e,(g,E)=>{if(f!==E&&Nn(g,d)&&r.definition[E].ignoreAmbiguities!==!0)m.push(E)}),m.length>1&&!Nn(i,d))i.push(d),u.push({alts:m,path:d})}),u},[]);return y(o,(u)=>{let a=y(u.alts,(d)=>d+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:a,prefixPath:u.path}),type:Re.AMBIGUOUS_ALTS,ruleName:s.name,occurrence:r.idx,alternatives:u.alts}})}function Fy(e,r,s,n){let i=Te(e,(c,u,a)=>{let f=y(u,(d)=>({idx:a,path:d}));return c.concat(f)},[]);return mt(De(i,(c)=>{if(r.definition[c.idx].ignoreAmbiguities===!0)return[];let{idx:a,path:f}=c,d=ke(i,(g)=>r.definition[g.idx].ignoreAmbiguities!==!0&&g.idx<a&&wc(g.path,f));return y(d,(g)=>{let E=[g.idx+1,a+1],b=r.idx===0?"":r.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:E,prefixPath:g.path}),type:Re.AMBIGUOUS_PREFIX_ALTS,ruleName:s.name,occurrence:b,alternatives:E}})}))}function By(e,r,s){let n=[],i=y(r,(o)=>o.name);return x(e,(o)=>{let c=o.name;if(te(i,c)){let u=s.buildNamespaceConflictError(o);n.push({message:u,type:Re.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:c})}}),n}function zc(e){let r=Ir(e,{errMsgProvider:Rc}),s={};return x(e.rules,(n)=>{s[n.name]=n}),Oc(s,r.errMsgProvider)}function Vc(e){return e=Ir(e,{errMsgProvider:ot}),Dc(e.rules,e.tokenTypes,e.errMsgProvider,e.grammarName)}var Hc="MismatchedTokenException",Yc="NoViableAltException",Xc="EarlyExitException",qc="NotAllInputParsedException",Jc=[Hc,Yc,Xc,qc];Object.freeze(Jc);function Zt(e){return te(Jc,e.name)}class gs extends Error{constructor(e,r){super(e);if(this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}}class jr extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Hc}}class vn extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Yc}}class kn extends gs{constructor(e,r){super(e,r);this.name=qc}}class _n extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Xc}}var Ri={},Oi="InRuleRecoveryException";class Zc extends Error{constructor(e){super(e);this.name=Oi}}class Li{initRecoverable(e){if(this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=S(e,"recoveryEnabled")?e.recoveryEnabled:Fe.recoveryEnabled,this.recoveryEnabled)this.attemptInRepetitionRecovery=$y}getTokenToInsert(e){let r=lr(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,s,n){let i=this.findReSyncTokenType(),o=this.exportLexerState(),c=[],u=!1,a=this.LA(1),f=this.LA(1),d=()=>{let m=this.LA(0),g=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:a,previous:m,ruleName:this.getCurrRuleFullName()}),E=new jr(g,a,this.LA(0));E.resyncedTokens=bt(c),this.SAVE_ERROR(E)};while(!u)if(this.tokenMatcher(f,n)){d();return}else if(s.call(this)){d(),e.apply(this,r);return}else if(this.tokenMatcher(f,i))u=!0;else f=this.SKIP_TOKEN(),this.addToResyncTokens(f,c);this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,r,s){if(s===!1)return!1;if(this.tokenMatcher(this.LA(1),e))return!1;if(this.isBackTracking())return!1;if(this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))return!1;return!0}getFollowsForInRuleRecovery(e,r){let s=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(s)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let s=this.SKIP_TOKEN();return this.consumeToken(),s}throw new Zc("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(M(r))return!1;let s=this.LA(1);return At(r,(i)=>this.tokenMatcher(s,i))!==void 0}canRecoverWithSingleTokenDeletion(e){if(!this.canTokenTypeBeDeletedInRecovery(e))return!1;return this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),s=this.getFollowSetFromFollowKey(r);return te(s,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),s=2;while(!0){let n=At(e,(i)=>hs(r,i));if(n!==void 0)return n;r=this.LA(s),s++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Ri;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),s=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(s)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return y(e,(s,n)=>{if(n===0)return Ri;return{ruleName:this.shortRuleNameToFullName(s),idxInCallingRule:r[n],inRule:this.shortRuleNameToFullName(e[n-1])}})}flattenFollowSet(){let e=y(this.buildFullFollowKeyStack(),(r)=>this.getFollowSetFromFollowKey(r));return xe(e)}getFollowSetFromFollowKey(e){if(e===Ri)return[Ve];let r=e.ruleName+e.idxInCallingRule+fn+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){if(!this.tokenMatcher(e,Ve))r.push(e);return r}reSyncTo(e){let r=[],s=this.LA(1);while(this.tokenMatcher(s,e)===!1)s=this.SKIP_TOKEN(),this.addToResyncTokens(s,r);return bt(r)}attemptInRepetitionRecovery(e,r,s,n,i,o,c){}getCurrentGrammarPath(e,r){let s=this.getHumanReadableRuleStack(),n=Y(this.RULE_OCCURRENCE_STACK);return{ruleStack:s,occurrenceStack:n,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return y(this.RULE_STACK,(e)=>this.shortRuleNameToFullName(e))}}function $y(e,r,s,n,i,o,c){let u=this.getKeyForAutomaticLookahead(n,i),a=this.firstAfterRepMap[u];if(a===void 0){let g=this.getCurrRuleFullName(),E=this.getGAstProductions()[g];a=new o(E,i).startWalking(),this.firstAfterRepMap[u]=a}let f=a.token,d=a.occurrence,m=a.isEndOfRule;if(this.RULE_STACK.length===1&&m&&f===void 0)f=Ve,d=1;if(f===void 0||d===void 0)return;if(this.shouldInRepetitionRecoveryBeTried(f,d,c))this.tryInRepetitionRecovery(e,r,s,f)}var Qc=4,Mn=8;var wn=256,Pn=512,Ts=768,Es=1024,ys=1280,Kr=1536;function Un(e,r,s){return s|r|e}class Dn{constructor(e){var r;this.maxLookahead=(r=e===null||e===void 0?void 0:e.maxLookahead)!==null&&r!==void 0?r:Fe.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(M(r)){let s=this.validateEmptyOrAlternatives(e.rules),n=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...s,...n,...i]}return r}validateNoLeftRecursion(e){return De(e,(r)=>Si(r,r,ot))}validateEmptyOrAlternatives(e){return De(e,(r)=>Gc(r,ot))}validateAmbiguousAlternationAlternatives(e,r){return De(e,(s)=>Wc(s,r,ot))}validateSomeNonEmptyLookaheadPath(e,r){return Kc(e,r,ot)}buildLookaheadForAlternation(e){return bc(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,vc)}buildLookaheadForOptional(e){return Cc(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,In(e.prodType),kc)}}class Ii{initLooksAhead(e){this.dynamicTokensEnabled=S(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Fe.dynamicTokensEnabled,this.maxLookahead=S(e,"maxLookahead")?e.maxLookahead:Fe.maxLookahead,this.lookaheadStrategy=S(e,"lookaheadStrategy")?e.lookaheadStrategy:new Dn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){x(e,(r)=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:s,repetition:n,option:i,repetitionMandatory:o,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:u}=Gy(r);x(s,(a)=>{let f=a.idx===0?"":a.idx;this.TRACE_INIT(`${ze(a)}${f}`,()=>{let d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:a.idx,rule:r,maxLookahead:a.maxLookahead||this.maxLookahead,hasPredicates:a.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),m=Un(this.fullRuleNameToShort[r.name],wn,a.idx);this.setLaFuncCache(m,d)})}),x(n,(a)=>{this.computeLookaheadFunc(r,a.idx,Ts,"Repetition",a.maxLookahead,ze(a))}),x(i,(a)=>{this.computeLookaheadFunc(r,a.idx,Pn,"Option",a.maxLookahead,ze(a))}),x(o,(a)=>{this.computeLookaheadFunc(r,a.idx,Es,"RepetitionMandatory",a.maxLookahead,ze(a))}),x(c,(a)=>{this.computeLookaheadFunc(r,a.idx,Kr,"RepetitionMandatoryWithSeparator",a.maxLookahead,ze(a))}),x(u,(a)=>{this.computeLookaheadFunc(r,a.idx,ys,"RepetitionWithSeparator",a.maxLookahead,ze(a))})})})}computeLookaheadFunc(e,r,s,n,i,o){this.TRACE_INIT(`${o}${r===0?"":r}`,()=>{let c=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:n}),u=Un(this.fullRuleNameToShort[e.name],s,r);this.setLaFuncCache(u,c)})}getKeyForAutomaticLookahead(e,r){let s=this.getLastExplicitRuleShortName();return Un(s,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}}class eu extends Ke{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)}}var Fn=new eu;function Gy(e){Fn.reset(),e.accept(Fn);let r=Fn.dslMethods;return Fn.reset(),r}function Ni(e,r){if(isNaN(e.startOffset)===!0)e.startOffset=r.startOffset,e.endOffset=r.endOffset;else if(e.endOffset<r.endOffset===!0)e.endOffset=r.endOffset}function bi(e,r){if(isNaN(e.startOffset)===!0)e.startOffset=r.startOffset,e.startColumn=r.startColumn,e.startLine=r.startLine,e.endOffset=r.endOffset,e.endColumn=r.endColumn,e.endLine=r.endLine;else if(e.endOffset<r.endOffset===!0)e.endOffset=r.endOffset,e.endColumn=r.endColumn,e.endLine=r.endLine}function tu(e,r,s){if(e.children[s]===void 0)e.children[s]=[r];else e.children[s].push(r)}function ru(e,r,s){if(e.children[r]===void 0)e.children[r]=[s];else e.children[r].push(s)}function Ci(e,r){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:r})}function Wy(e,r){let s=W(e),n=s.length;for(let i=0;i<n;i++){let o=s[i],c=e[o],u=c.length;for(let a=0;a<u;a++){let f=c[a];if(f.tokenTypeIdx===void 0)this[f.name](f.children,r)}}}function su(e,r){let s=function(){};Ci(s,e+"BaseSemantics");let n={visit:function(i,o){if(L(i))i=i[0];if(_e(i))return;return this[i.name](i.children,o)},validateVisitor:function(){let i=jy(this,r);if(!M(i)){let o=y(i,(c)=>c.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
86
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let r;if(e.topLevelRule instanceof je)r=e.topLevelRule.name;else r=e.topLevelRule;return`Duplicate definition, rule: ->${r}<- is already defined in the grammar: ->${e.grammarName}<-`}};function Oc(e,r){let s=new Lc(e,r);return s.resolveRefs(),s.errors}class Lc extends Ke{constructor(e,r){super();this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){x(G(this.nameToTopRule),(e)=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(!r){let s=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:s,type:Re.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}else e.referencedRule=r}}class Ic extends Jt{constructor(e,r){super();this.topProd=e,this.path=r,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=Y(this.path.ruleStack).reverse(),this.occurrenceStack=Y(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){if(!this.found)super.walk(e,r)}walkProdRef(e,r,s){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let n=r.concat(s);this.updateExpectedNext(),this.walk(e.referencedRule,n)}}updateExpectedNext(){if(M(this.ruleStack))this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0;else this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop()}}class Ti extends Ic{constructor(e,r){super(e,r);this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,s){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let n=r.concat(s),i=new Z({definition:n});this.possibleTokTypes=sr(i),this.found=!0}}}class ds extends Jt{constructor(e,r){super();this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Ei extends ds{walkMany(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkMany(e,r,s)}}class xn extends ds{walkManySep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkManySep(e,r,s)}}class yi extends ds{walkAtLeastOne(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOne(e,r,s)}}class Sn extends ds{walkAtLeastOneSep(e,r,s){if(e.idx===this.occurrence){let n=Le(r.concat(s));if(this.result.isEndOfRule=n===void 0,n instanceof w)this.result.token=n.terminalType,this.result.occurrence=n.idx}else super.walkAtLeastOneSep(e,r,s)}}function Rn(e,r,s=[]){s=Y(s);let n=[],i=0;function o(u){return u.concat(fe(e,i+1))}function c(u){let a=Rn(o(u),r,s);return n.concat(a)}while(s.length<r&&i<e.length){let u=e[i];if(u instanceof Z)return c(u.definition);else if(u instanceof J)return c(u.definition);else if(u instanceof re)n=c(u.definition);else if(u instanceof Ee){let a=u.definition.concat([new B({definition:u.definition})]);return c(a)}else if(u instanceof ye){let a=[new Z({definition:u.definition}),new B({definition:[new w({terminalType:u.separator})].concat(u.definition)})];return c(a)}else if(u instanceof he){let a=u.definition.concat([new B({definition:[new w({terminalType:u.separator})].concat(u.definition)})]);n=c(a)}else if(u instanceof B){let a=u.definition.concat([new B({definition:u.definition})]);n=c(a)}else if(u instanceof de)return x(u.definition,(a)=>{if(M(a.definition)===!1)n=c(a.definition)}),n;else if(u instanceof w)s.push(u.terminalType);else throw Error("non exhaustive match");i++}return n.push({partialPath:s,suffixDef:fe(e,i)}),n}function On(e,r,s,n){let o=["EXIT_NONE_TERMINAL"],c="EXIT_ALTERNATIVE",u=!1,a=r.length,f=a-n-1,d=[],m=[];m.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});while(!M(m)){let g=m.pop();if(g==="EXIT_ALTERNATIVE"){if(u&&it(m).idx<=f)m.pop();continue}let{def:E,idx:b,ruleStack:v,occurrenceStack:I}=g;if(M(E))continue;let A=E[0];if(A==="EXIT_NONE_TERMINAL"){let O={idx:b,def:fe(E),ruleStack:bt(v),occurrenceStack:bt(I)};m.push(O)}else if(A instanceof w)if(b<a-1){let O=b+1,T=r[O];if(s(T,A.terminalType)){let _={idx:O,def:fe(E),ruleStack:v,occurrenceStack:I};m.push(_)}}else if(b===a-1)d.push({nextTokenType:A.terminalType,nextTokenOccurrence:A.idx,ruleStack:v,occurrenceStack:I}),u=!0;else throw Error("non exhaustive match");else if(A instanceof J){let O=Y(v);O.push(A.nonTerminalName);let T=Y(I);T.push(A.idx);let _={idx:b,def:A.definition.concat(o,fe(E)),ruleStack:O,occurrenceStack:T};m.push(_)}else if(A instanceof re){let O={idx:b,def:fe(E),ruleStack:v,occurrenceStack:I};m.push(O),m.push("EXIT_ALTERNATIVE");let T={idx:b,def:A.definition.concat(fe(E)),ruleStack:v,occurrenceStack:I};m.push(T)}else if(A instanceof Ee){let O=new B({definition:A.definition,idx:A.idx}),T=A.definition.concat([O],fe(E)),_={idx:b,def:T,ruleStack:v,occurrenceStack:I};m.push(_)}else if(A instanceof ye){let O=new w({terminalType:A.separator}),T=new B({definition:[O].concat(A.definition),idx:A.idx}),_=A.definition.concat([T],fe(E)),Q={idx:b,def:_,ruleStack:v,occurrenceStack:I};m.push(Q)}else if(A instanceof he){let O={idx:b,def:fe(E),ruleStack:v,occurrenceStack:I};m.push(O),m.push("EXIT_ALTERNATIVE");let T=new w({terminalType:A.separator}),_=new B({definition:[T].concat(A.definition),idx:A.idx}),Q=A.definition.concat([_],fe(E)),Ce={idx:b,def:Q,ruleStack:v,occurrenceStack:I};m.push(Ce)}else if(A instanceof B){let O={idx:b,def:fe(E),ruleStack:v,occurrenceStack:I};m.push(O),m.push("EXIT_ALTERNATIVE");let T=new B({definition:A.definition,idx:A.idx}),_=A.definition.concat([T],fe(E)),Q={idx:b,def:_,ruleStack:v,occurrenceStack:I};m.push(Q)}else if(A instanceof de)for(let O=A.definition.length-1;O>=0;O--){let T=A.definition[O],_={idx:b,def:T.definition.concat(fe(E)),ruleStack:v,occurrenceStack:I};m.push(_),m.push("EXIT_ALTERNATIVE")}else if(A instanceof Z)m.push({idx:b,def:A.definition.concat(fe(E)),ruleStack:v,occurrenceStack:I});else if(A instanceof je)m.push(ky(A,b,v,I));else throw Error("non exhaustive match")}return d}function ky(e,r,s,n){let i=Y(s);i.push(e.name);let o=Y(n);return o.push(1),{idx:r,def:e.definition,ruleStack:i,occurrenceStack:o}}var oe;(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"})(oe||(oe={}));function Ln(e){if(e instanceof re||e==="Option")return oe.OPTION;else if(e instanceof B||e==="Repetition")return oe.REPETITION;else if(e instanceof Ee||e==="RepetitionMandatory")return oe.REPETITION_MANDATORY;else if(e instanceof ye||e==="RepetitionMandatoryWithSeparator")return oe.REPETITION_MANDATORY_WITH_SEPARATOR;else if(e instanceof he||e==="RepetitionWithSeparator")return oe.REPETITION_WITH_SEPARATOR;else if(e instanceof de||e==="Alternation")return oe.ALTERNATION;else throw Error("non exhaustive match")}function bc(e,r,s,n,i,o){let c=ps(e,r,s),u=Pc(c)?Wr:Ct;return o(c,n,u,i)}function Cc(e,r,s,n,i,o){let c=ms(e,r,i,s),u=Pc(c)?Wr:Ct;return o(c[0],u,n)}function vc(e,r,s,n){let i=e.length,o=ve(e,(c)=>ve(c,(u)=>u.length===1));if(r)return function(c){let u=y(c,(a)=>a.GATE);for(let a=0;a<i;a++){let f=e[a],d=f.length,m=u[a];if(m!==void 0&&m.call(this)===!1)continue;e:for(let g=0;g<d;g++){let E=f[g],b=E.length;for(let v=0;v<b;v++){let I=this.LA(v+1);if(s(I,E[v])===!1)continue e}return a}}return};else if(o&&!n){let c=y(e,(a)=>xe(a)),u=Te(c,(a,f,d)=>(x(f,(m)=>{if(!S(a,m.tokenTypeIdx))a[m.tokenTypeIdx]=d;x(m.categoryMatches,(g)=>{if(!S(a,g))a[g]=d})}),a),{});return function(){let a=this.LA(1);return u[a.tokenTypeIdx]}}else return function(){for(let c=0;c<i;c++){let u=e[c],a=u.length;e:for(let f=0;f<a;f++){let d=u[f],m=d.length;for(let g=0;g<m;g++){let E=this.LA(g+1);if(s(E,d[g])===!1)continue e}return c}}return}}function kc(e,r,s){let n=ve(e,(o)=>o.length===1),i=e.length;if(n&&!s){let o=xe(e);if(o.length===1&&M(o[0].categoryMatches)){let u=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===u}}else{let c=Te(o,(u,a,f)=>(u[a.tokenTypeIdx]=!0,x(a.categoryMatches,(d)=>{u[d]=!0}),u),[]);return function(){let u=this.LA(1);return c[u.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let c=e[o],u=c.length;for(let a=0;a<u;a++){let f=this.LA(a+1);if(r(f,c[a])===!1)continue e}return!0}return!1}}class _c extends Jt{constructor(e,r,s){super();this.topProd=e,this.targetOccurrence=r,this.targetProdType=s}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,s,n){if(e.idx===this.targetOccurrence&&this.targetProdType===r)return this.restDef=s.concat(n),!0;return!1}walkOption(e,r,s){if(!this.checkIsTarget(e,oe.OPTION,r,s))super.walkOption(e,r,s)}walkAtLeastOne(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_MANDATORY,r,s))super.walkOption(e,r,s)}walkAtLeastOneSep(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR,r,s))super.walkOption(e,r,s)}walkMany(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION,r,s))super.walkOption(e,r,s)}walkManySep(e,r,s){if(!this.checkIsTarget(e,oe.REPETITION_WITH_SEPARATOR,r,s))super.walkOption(e,r,s)}}class xi extends Ke{constructor(e,r,s){super();this.targetOccurrence=e,this.targetProdType=r,this.targetRef=s,this.result=[]}checkIsTarget(e,r){if(e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef))this.result=e.definition}visitOption(e){this.checkIsTarget(e,oe.OPTION)}visitRepetition(e){this.checkIsTarget(e,oe.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,oe.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,oe.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,oe.ALTERNATION)}}function Nc(e){let r=Array(e);for(let s=0;s<e;s++)r[s]=[];return r}function Ai(e){let r=[""];for(let s=0;s<e.length;s++){let n=e[s],i=[];for(let o=0;o<r.length;o++){let c=r[o];i.push(c+"_"+n.tokenTypeIdx);for(let u=0;u<n.categoryMatches.length;u++){let a="_"+n.categoryMatches[u];i.push(c+a)}}r=i}return r}function _y(e,r,s){for(let n=0;n<e.length;n++){if(n===s)continue;let i=e[n];for(let o=0;o<r.length;o++){let c=r[o];if(i[c]===!0)return!1}}return!0}function Mc(e,r){let s=y(e,(c)=>Rn([c],1)),n=Nc(s.length),i=y(s,(c)=>{let u={};return x(c,(a)=>{let f=Ai(a.partialPath);x(f,(d)=>{u[d]=!0})}),u}),o=s;for(let c=1;c<=r;c++){let u=o;o=Nc(u.length);for(let a=0;a<u.length;a++){let f=u[a];for(let d=0;d<f.length;d++){let m=f[d].partialPath,g=f[d].suffixDef,E=Ai(m);if(_y(i,E,a)||M(g)||m.length===r){let v=n[a];if(In(v,m)===!1){v.push(m);for(let I=0;I<E.length;I++){let A=E[I];i[a][A]=!0}}}else{let v=Rn(g,c+1,m);o[a]=o[a].concat(v),x(v,(I)=>{let A=Ai(I.partialPath);x(A,(O)=>{i[a][O]=!0})})}}}}return n}function ps(e,r,s,n){let i=new xi(e,oe.ALTERNATION,n);return r.accept(i),Mc(i.result,s)}function ms(e,r,s,n){let i=new xi(e,s);r.accept(i);let o=i.result,u=new _c(r,e,s).startWalking(),a=new Z({definition:o}),f=new Z({definition:u});return Mc([a,f],n)}function In(e,r){e:for(let s=0;s<e.length;s++){let n=e[s];if(n.length!==r.length)continue;for(let i=0;i<n.length;i++){let o=r[i],c=n[i];if((o===c||c.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}return!1}function wc(e,r){return e.length<r.length&&ve(e,(s,n)=>{let i=r[n];return s===i||i.categoryMatchesMap[s.tokenTypeIdx]})}function Pc(e){return ve(e,(r)=>ve(r,(s)=>ve(s,(n)=>M(n.categoryMatches))))}function Uc(e){let r=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return y(r,(s)=>Object.assign({type:Re.CUSTOM_LOOKAHEAD_VALIDATION},s))}function Dc(e,r,s,n){let i=De(e,(a)=>My(a,s)),o=By(e,r,s),c=De(e,(a)=>Uy(a,s)),u=De(e,(a)=>Py(a,e,n,s));return i.concat(o,c,u)}function My(e,r){let s=new Bc;e.accept(s);let n=s.allProductions,i=oi(n,wy),o=We(i,(u)=>u.length>1);return y(G(o),(u)=>{let a=Le(u),f=r.buildDuplicateFoundError(e,u),d=ze(a),m={message:f,type:Re.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:d,occurrence:a.idx},g=Fc(a);if(g)m.parameter=g;return m})}function wy(e){return`${ze(e)}_#_${e.idx}_#_${Fc(e)}`}function Fc(e){if(e instanceof w)return e.terminalType.name;else if(e instanceof J)return e.nonTerminalName;else return""}class Bc extends Ke{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 Py(e,r,s,n){let i=[];if(Te(r,(c,u)=>{if(u.name===e.name)return c+1;return c},0)>1){let c=n.buildDuplicateRuleNameError({topLevelRule:e,grammarName:s});i.push({message:c,type:Re.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function $c(e,r,s){let n=[],i;if(!te(r,e))i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${s}<-as it is not defined in any of the super grammars `,n.push({message:i,type:Re.INVALID_RULE_OVERRIDE,ruleName:e});return n}function Si(e,r,s,n=[]){let i=[],o=Nn(r.definition);if(M(o))return[];else{let c=e.name;if(te(o,e))i.push({message:s.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:n}),type:Re.LEFT_RECURSION,ruleName:c});let a=Ht(o,n.concat([e])),f=De(a,(d)=>{let m=Y(n);return m.push(d),Si(e,d,s,m)});return i.concat(f)}}function Nn(e){let r=[];if(M(e))return r;let s=Le(e);if(s instanceof J)r.push(s.referencedRule);else if(s instanceof Z||s instanceof re||s instanceof Ee||s instanceof ye||s instanceof he||s instanceof B)r=r.concat(Nn(s.definition));else if(s instanceof de)r=xe(y(s.definition,(o)=>Nn(o.definition)));else if(s instanceof w);else throw Error("non exhaustive match");let n=rr(s),i=e.length>1;if(n&&i){let o=fe(e);return r.concat(Nn(o))}else return r}class bn extends Ke{constructor(){super(...arguments);this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Gc(e,r){let s=new bn;e.accept(s);let n=s.alternations;return De(n,(o)=>{let c=bt(o.definition);return De(c,(u,a)=>{let f=On([u],[],Ct,1);if(M(f))return[{message:r.buildEmptyAlternationError({topLevelRule:e,alternation:o,emptyChoiceIdx:a}),type:Re.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:o.idx,alternative:a+1}];else return[]})})}function Wc(e,r,s){let n=new bn;e.accept(n);let i=n.alternations;return i=qt(i,(c)=>c.ignoreAmbiguities===!0),De(i,(c)=>{let u=c.idx,a=c.maxLookahead||r,f=ps(u,e,a,c),d=Dy(f,c,e,s),m=Fy(f,c,e,s);return d.concat(m)})}class jc extends Ke{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 Uy(e,r){let s=new bn;e.accept(s);let n=s.alternations;return De(n,(o)=>{if(o.definition.length>255)return[{message:r.buildTooManyAlternativesError({topLevelRule:e,alternation:o}),type:Re.TOO_MANY_ALTS,ruleName:e.name,occurrence:o.idx}];else return[]})}function Kc(e,r,s){let n=[];return x(e,(i)=>{let o=new jc;i.accept(o);let c=o.allProductions;x(c,(u)=>{let a=Ln(u),f=u.maxLookahead||r,d=u.idx,g=ms(d,i,a,f)[0];if(M(xe(g))){let E=s.buildEmptyRepetitionError({topLevelRule:i,repetition:u});n.push({message:E,type:Re.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function Dy(e,r,s,n){let i=[],o=Te(e,(u,a,f)=>{if(r.definition[f].ignoreAmbiguities===!0)return u;return x(a,(d)=>{let m=[f];if(x(e,(g,E)=>{if(f!==E&&In(g,d)&&r.definition[E].ignoreAmbiguities!==!0)m.push(E)}),m.length>1&&!In(i,d))i.push(d),u.push({alts:m,path:d})}),u},[]);return y(o,(u)=>{let a=y(u.alts,(d)=>d+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:a,prefixPath:u.path}),type:Re.AMBIGUOUS_ALTS,ruleName:s.name,occurrence:r.idx,alternatives:u.alts}})}function Fy(e,r,s,n){let i=Te(e,(c,u,a)=>{let f=y(u,(d)=>({idx:a,path:d}));return c.concat(f)},[]);return mt(De(i,(c)=>{if(r.definition[c.idx].ignoreAmbiguities===!0)return[];let{idx:a,path:f}=c,d=ke(i,(g)=>r.definition[g.idx].ignoreAmbiguities!==!0&&g.idx<a&&wc(g.path,f));return y(d,(g)=>{let E=[g.idx+1,a+1],b=r.idx===0?"":r.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:s,alternation:r,ambiguityIndices:E,prefixPath:g.path}),type:Re.AMBIGUOUS_PREFIX_ALTS,ruleName:s.name,occurrence:b,alternatives:E}})}))}function By(e,r,s){let n=[],i=y(r,(o)=>o.name);return x(e,(o)=>{let c=o.name;if(te(i,c)){let u=s.buildNamespaceConflictError(o);n.push({message:u,type:Re.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:c})}}),n}function zc(e){let r=Ir(e,{errMsgProvider:Rc}),s={};return x(e.rules,(n)=>{s[n.name]=n}),Oc(s,r.errMsgProvider)}function Vc(e){return e=Ir(e,{errMsgProvider:ot}),Dc(e.rules,e.tokenTypes,e.errMsgProvider,e.grammarName)}var Hc="MismatchedTokenException",Yc="NoViableAltException",Xc="EarlyExitException",qc="NotAllInputParsedException",Jc=[Hc,Yc,Xc,qc];Object.freeze(Jc);function Zt(e){return te(Jc,e.name)}class gs extends Error{constructor(e,r){super(e);if(this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}}class jr extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Hc}}class Cn extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Yc}}class kn extends gs{constructor(e,r){super(e,r);this.name=qc}}class _n extends gs{constructor(e,r,s){super(e,r);this.previousToken=s,this.name=Xc}}var Ri={},Oi="InRuleRecoveryException";class Zc extends Error{constructor(e){super(e);this.name=Oi}}class Li{initRecoverable(e){if(this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=S(e,"recoveryEnabled")?e.recoveryEnabled:Fe.recoveryEnabled,this.recoveryEnabled)this.attemptInRepetitionRecovery=$y}getTokenToInsert(e){let r=lr(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,s,n){let i=this.findReSyncTokenType(),o=this.exportLexerState(),c=[],u=!1,a=this.LA(1),f=this.LA(1),d=()=>{let m=this.LA(0),g=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:a,previous:m,ruleName:this.getCurrRuleFullName()}),E=new jr(g,a,this.LA(0));E.resyncedTokens=bt(c),this.SAVE_ERROR(E)};while(!u)if(this.tokenMatcher(f,n)){d();return}else if(s.call(this)){d(),e.apply(this,r);return}else if(this.tokenMatcher(f,i))u=!0;else f=this.SKIP_TOKEN(),this.addToResyncTokens(f,c);this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,r,s){if(s===!1)return!1;if(this.tokenMatcher(this.LA(1),e))return!1;if(this.isBackTracking())return!1;if(this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))return!1;return!0}getFollowsForInRuleRecovery(e,r){let s=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(s)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let s=this.SKIP_TOKEN();return this.consumeToken(),s}throw new Zc("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(M(r))return!1;let s=this.LA(1);return At(r,(i)=>this.tokenMatcher(s,i))!==void 0}canRecoverWithSingleTokenDeletion(e){if(!this.canTokenTypeBeDeletedInRecovery(e))return!1;return this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),s=this.getFollowSetFromFollowKey(r);return te(s,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),s=2;while(!0){let n=At(e,(i)=>hs(r,i));if(n!==void 0)return n;r=this.LA(s),s++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Ri;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),s=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(s)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return y(e,(s,n)=>{if(n===0)return Ri;return{ruleName:this.shortRuleNameToFullName(s),idxInCallingRule:r[n],inRule:this.shortRuleNameToFullName(e[n-1])}})}flattenFollowSet(){let e=y(this.buildFullFollowKeyStack(),(r)=>this.getFollowSetFromFollowKey(r));return xe(e)}getFollowSetFromFollowKey(e){if(e===Ri)return[Ve];let r=e.ruleName+e.idxInCallingRule+fn+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){if(!this.tokenMatcher(e,Ve))r.push(e);return r}reSyncTo(e){let r=[],s=this.LA(1);while(this.tokenMatcher(s,e)===!1)s=this.SKIP_TOKEN(),this.addToResyncTokens(s,r);return bt(r)}attemptInRepetitionRecovery(e,r,s,n,i,o,c){}getCurrentGrammarPath(e,r){let s=this.getHumanReadableRuleStack(),n=Y(this.RULE_OCCURRENCE_STACK);return{ruleStack:s,occurrenceStack:n,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return y(this.RULE_STACK,(e)=>this.shortRuleNameToFullName(e))}}function $y(e,r,s,n,i,o,c){let u=this.getKeyForAutomaticLookahead(n,i),a=this.firstAfterRepMap[u];if(a===void 0){let g=this.getCurrRuleFullName(),E=this.getGAstProductions()[g];a=new o(E,i).startWalking(),this.firstAfterRepMap[u]=a}let f=a.token,d=a.occurrence,m=a.isEndOfRule;if(this.RULE_STACK.length===1&&m&&f===void 0)f=Ve,d=1;if(f===void 0||d===void 0)return;if(this.shouldInRepetitionRecoveryBeTried(f,d,c))this.tryInRepetitionRecovery(e,r,s,f)}var Qc=4,Mn=8;var wn=256,Pn=512,Ts=768,Es=1024,ys=1280,Kr=1536;function Un(e,r,s){return s|r|e}class Dn{constructor(e){var r;this.maxLookahead=(r=e===null||e===void 0?void 0:e.maxLookahead)!==null&&r!==void 0?r:Fe.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(M(r)){let s=this.validateEmptyOrAlternatives(e.rules),n=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...s,...n,...i]}return r}validateNoLeftRecursion(e){return De(e,(r)=>Si(r,r,ot))}validateEmptyOrAlternatives(e){return De(e,(r)=>Gc(r,ot))}validateAmbiguousAlternationAlternatives(e,r){return De(e,(s)=>Wc(s,r,ot))}validateSomeNonEmptyLookaheadPath(e,r){return Kc(e,r,ot)}buildLookaheadForAlternation(e){return bc(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,vc)}buildLookaheadForOptional(e){return Cc(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Ln(e.prodType),kc)}}class Ii{initLooksAhead(e){this.dynamicTokensEnabled=S(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Fe.dynamicTokensEnabled,this.maxLookahead=S(e,"maxLookahead")?e.maxLookahead:Fe.maxLookahead,this.lookaheadStrategy=S(e,"lookaheadStrategy")?e.lookaheadStrategy:new Dn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){x(e,(r)=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:s,repetition:n,option:i,repetitionMandatory:o,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:u}=Gy(r);x(s,(a)=>{let f=a.idx===0?"":a.idx;this.TRACE_INIT(`${ze(a)}${f}`,()=>{let d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:a.idx,rule:r,maxLookahead:a.maxLookahead||this.maxLookahead,hasPredicates:a.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),m=Un(this.fullRuleNameToShort[r.name],wn,a.idx);this.setLaFuncCache(m,d)})}),x(n,(a)=>{this.computeLookaheadFunc(r,a.idx,Ts,"Repetition",a.maxLookahead,ze(a))}),x(i,(a)=>{this.computeLookaheadFunc(r,a.idx,Pn,"Option",a.maxLookahead,ze(a))}),x(o,(a)=>{this.computeLookaheadFunc(r,a.idx,Es,"RepetitionMandatory",a.maxLookahead,ze(a))}),x(c,(a)=>{this.computeLookaheadFunc(r,a.idx,Kr,"RepetitionMandatoryWithSeparator",a.maxLookahead,ze(a))}),x(u,(a)=>{this.computeLookaheadFunc(r,a.idx,ys,"RepetitionWithSeparator",a.maxLookahead,ze(a))})})})}computeLookaheadFunc(e,r,s,n,i,o){this.TRACE_INIT(`${o}${r===0?"":r}`,()=>{let c=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:n}),u=Un(this.fullRuleNameToShort[e.name],s,r);this.setLaFuncCache(u,c)})}getKeyForAutomaticLookahead(e,r){let s=this.getLastExplicitRuleShortName();return Un(s,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}}class eu extends Ke{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)}}var Fn=new eu;function Gy(e){Fn.reset(),e.accept(Fn);let r=Fn.dslMethods;return Fn.reset(),r}function Ni(e,r){if(isNaN(e.startOffset)===!0)e.startOffset=r.startOffset,e.endOffset=r.endOffset;else if(e.endOffset<r.endOffset===!0)e.endOffset=r.endOffset}function bi(e,r){if(isNaN(e.startOffset)===!0)e.startOffset=r.startOffset,e.startColumn=r.startColumn,e.startLine=r.startLine,e.endOffset=r.endOffset,e.endColumn=r.endColumn,e.endLine=r.endLine;else if(e.endOffset<r.endOffset===!0)e.endOffset=r.endOffset,e.endColumn=r.endColumn,e.endLine=r.endLine}function tu(e,r,s){if(e.children[s]===void 0)e.children[s]=[r];else e.children[s].push(r)}function ru(e,r,s){if(e.children[r]===void 0)e.children[r]=[s];else e.children[r].push(s)}function Ci(e,r){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:r})}function Wy(e,r){let s=W(e),n=s.length;for(let i=0;i<n;i++){let o=s[i],c=e[o],u=c.length;for(let a=0;a<u;a++){let f=c[a];if(f.tokenTypeIdx===void 0)this[f.name](f.children,r)}}}function su(e,r){let s=function(){};Ci(s,e+"BaseSemantics");let n={visit:function(i,o){if(L(i))i=i[0];if(_e(i))return;return this[i.name](i.children,o)},validateVisitor:function(){let i=jy(this,r);if(!M(i)){let o=y(i,(c)=>c.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
87
87
  ${o.join(`
88
88
 
89
89
  `).replace(/\n/g,`
@@ -94,14 +94,14 @@ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleN
94
94
  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.
95
95
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
96
96
  For Further details.`)}if(L(e))this.tokensMap=Te(e,(i,o)=>(i[o.name]=o,i),{});else if(S(e,"modes")&&ve(xe(G(e.modes)),pc)){let i=xe(G(e.modes)),o=wr(i);this.tokensMap=Te(o,(c,u)=>(c[u.name]=u,c),{})}else if(ne(e))this.tokensMap=Y(e);else throw Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Ve;let s=S(e,"modes")?xe(G(e.modes)):G(e),n=ve(s,(i)=>M(i.categoryMatches));this.tokenMatcher=n?Wr:Ct,vt(G(this.tokensMap))}defineRule(e,r,s){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
97
- Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let n=S(s,"resyncEnabled")?s.resyncEnabled:Vr.resyncEnabled,i=S(s,"recoveryValueFunc")?s.recoveryValueFunc:Vr.recoveryValueFunc,o=this.ruleShortNameIdx<<Qc+Mn;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let c;if(this.outputCst===!0)c=function(...f){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),r.apply(this,f);let d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,n,i)}finally{this.ruleFinallyStateUpdate()}};else c=function(...f){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),r.apply(this,f)}catch(d){return this.invokeRuleCatch(d,n,i)}finally{this.ruleFinallyStateUpdate()}};return Object.assign(c,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,s){let n=this.RULE_STACK.length===1,i=r&&!this.isBackTracking()&&this.recoveryEnabled;if(Zt(e)){let o=e;if(i){let c=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(c))if(o.resyncedTokens=this.reSyncTo(c),this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];return u.recoveredNode=!0,u}else return s(e);else{if(this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];u.recoveredNode=!0,o.partialCstResult=u}throw o}}else if(n)return this.moveToTerminatedState(),s(e);else throw o}else throw e}optionInternal(e,r){let s=this.getKeyForAutomaticLookahead(Pn,r);return this.optionInternalLogic(e,r,s)}optionInternalLogic(e,r,s){let n=this.getLaFuncFromCache(s),i;if(typeof e!=="function"){i=e.DEF;let o=e.GATE;if(o!==void 0){let c=n;n=()=>o.call(this)&&c.call(this)}}else i=e;if(n.call(this)===!0)return i.call(this);return}atLeastOneInternal(e,r){let s=this.getKeyForAutomaticLookahead(Es,e);return this.atLeastOneInternalLogic(e,r,s)}atLeastOneInternalLogic(e,r,s){let n=this.getLaFuncFromCache(s),i;if(typeof r!=="function"){i=r.DEF;let o=r.GATE;if(o!==void 0){let c=n;n=()=>o.call(this)&&c.call(this)}}else i=r;if(n.call(this)===!0){let o=this.doSingleRepetition(i);while(n.call(this)===!0&&o===!0)o=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,oe.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],n,Es,e,yi)}atLeastOneSepFirstInternal(e,r){let s=this.getKeyForAutomaticLookahead(Kr,e);this.atLeastOneSepFirstInternalLogic(e,r,s)}atLeastOneSepFirstInternalLogic(e,r,s){let{DEF:n,SEP:i}=r;if(this.getLaFuncFromCache(s).call(this)===!0){n.call(this);let c=()=>this.tokenMatcher(this.LA(1),i);while(this.tokenMatcher(this.LA(1),i)===!0)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,n,Rn],c,Kr,e,Rn)}else throw this.raiseEarlyExitException(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){let s=this.getKeyForAutomaticLookahead(Ts,e);return this.manyInternalLogic(e,r,s)}manyInternalLogic(e,r,s){let n=this.getLaFuncFromCache(s),i;if(typeof r!=="function"){i=r.DEF;let c=r.GATE;if(c!==void 0){let u=n;n=()=>c.call(this)&&u.call(this)}}else i=r;let o=!0;while(n.call(this)===!0&&o===!0)o=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],n,Ts,e,Ei,o)}manySepFirstInternal(e,r){let s=this.getKeyForAutomaticLookahead(ys,e);this.manySepFirstInternalLogic(e,r,s)}manySepFirstInternalLogic(e,r,s){let{DEF:n,SEP:i}=r;if(this.getLaFuncFromCache(s).call(this)===!0){n.call(this);let c=()=>this.tokenMatcher(this.LA(1),i);while(this.tokenMatcher(this.LA(1),i)===!0)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,n,Sn],c,ys,e,Sn)}}repetitionSepSecondInternal(e,r,s,n,i){while(s())this.CONSUME(r),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,s,n,i],s,Kr,e,i)}doSingleRepetition(e){let r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){let s=this.getKeyForAutomaticLookahead(wn,r),n=L(e)?e:e.DEF,o=this.getLaFuncFromCache(s).call(this,n);if(o!==void 0)return n[o].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new kn(r,e))}}subruleInternal(e,r,s){let n;try{let i=s!==void 0?s.ARGS:void 0;return this.subruleIdx=r,n=e.apply(this,i),this.cstPostNonTerminal(n,s!==void 0&&s.LABEL!==void 0?s.LABEL:e.ruleName),n}catch(i){throw this.subruleInternalError(i,s,e.ruleName)}}subruleInternalError(e,r,s){if(Zt(e)&&e.partialCstResult!==void 0)this.cstPostNonTerminal(e.partialCstResult,r!==void 0&&r.LABEL!==void 0?r.LABEL:s),delete e.partialCstResult;throw e}consumeInternal(e,r,s){let n;try{let i=this.LA(1);if(this.tokenMatcher(i,e)===!0)this.consumeToken(),n=i;else this.consumeInternalError(e,i,s)}catch(i){n=this.consumeInternalRecovery(e,r,i)}return this.cstPostTerminal(s!==void 0&&s.LABEL!==void 0?s.LABEL:e.name,n),n}consumeInternalError(e,r,s){let n,i=this.LA(0);if(s!==void 0&&s.ERR_MSG)n=s.ERR_MSG;else n=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:r,previous:i,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new jr(n,r,i))}consumeInternalRecovery(e,r,s){if(this.recoveryEnabled&&s.name==="MismatchedTokenException"&&!this.isBackTracking()){let n=this.getFollowsForInRuleRecovery(e,r);try{return this.tryInRuleRecovery(e,n)}catch(i){if(i.name===Oi)throw s;else throw i}}else throw s}saveRecogState(){let e=this.errors,r=Y(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:r,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,r,s){this.RULE_OCCURRENCE_STACK.push(s),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(r)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Ve)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class Pi{initErrorHandler(e){this._errors=[],this.errorMessageProvider=S(e,"errorMessageProvider")?e.errorMessageProvider:Fe.errorMessageProvider}SAVE_ERROR(e){if(Zt(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Y(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;else throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return Y(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,s){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],c=ms(e,i,r,this.maxLookahead)[0],u=[];for(let f=1;f<=this.maxLookahead;f++)u.push(this.LA(f));let a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:c,actual:u,previous:this.LA(0),customUserDescription:s,ruleName:n});throw this.SAVE_ERROR(new _n(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let s=this.getCurrRuleFullName(),n=this.getGAstProductions()[s],i=ps(e,n,this.maxLookahead),o=[];for(let a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));let c=this.LA(0),u=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:o,previous:c,customUserDescription:r,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new vn(u,this.LA(1),c))}}class Ui{initContentAssist(){}computeContentAssist(e,r){let s=this.gastProductionsCache[e];if(_e(s))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Ln([s],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=Le(e.ruleStack),n=this.getGAstProductions()[r];return new Ti(n,e).startWalking()}}var $n={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze($n);var iu=!0,ou=Math.pow(2,Mn)-1,lu=N({name:"RECORDING_PHASE_TOKEN",pattern:ie.NA});vt([lu]);var cu=lr(lu,`This IToken indicates the Parser is in Recording Phase
97
+ Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let n=S(s,"resyncEnabled")?s.resyncEnabled:Vr.resyncEnabled,i=S(s,"recoveryValueFunc")?s.recoveryValueFunc:Vr.recoveryValueFunc,o=this.ruleShortNameIdx<<Qc+Mn;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let c;if(this.outputCst===!0)c=function(...f){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),r.apply(this,f);let d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,n,i)}finally{this.ruleFinallyStateUpdate()}};else c=function(...f){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),r.apply(this,f)}catch(d){return this.invokeRuleCatch(d,n,i)}finally{this.ruleFinallyStateUpdate()}};return Object.assign(c,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,s){let n=this.RULE_STACK.length===1,i=r&&!this.isBackTracking()&&this.recoveryEnabled;if(Zt(e)){let o=e;if(i){let c=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(c))if(o.resyncedTokens=this.reSyncTo(c),this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];return u.recoveredNode=!0,u}else return s(e);else{if(this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];u.recoveredNode=!0,o.partialCstResult=u}throw o}}else if(n)return this.moveToTerminatedState(),s(e);else throw o}else throw e}optionInternal(e,r){let s=this.getKeyForAutomaticLookahead(Pn,r);return this.optionInternalLogic(e,r,s)}optionInternalLogic(e,r,s){let n=this.getLaFuncFromCache(s),i;if(typeof e!=="function"){i=e.DEF;let o=e.GATE;if(o!==void 0){let c=n;n=()=>o.call(this)&&c.call(this)}}else i=e;if(n.call(this)===!0)return i.call(this);return}atLeastOneInternal(e,r){let s=this.getKeyForAutomaticLookahead(Es,e);return this.atLeastOneInternalLogic(e,r,s)}atLeastOneInternalLogic(e,r,s){let n=this.getLaFuncFromCache(s),i;if(typeof r!=="function"){i=r.DEF;let o=r.GATE;if(o!==void 0){let c=n;n=()=>o.call(this)&&c.call(this)}}else i=r;if(n.call(this)===!0){let o=this.doSingleRepetition(i);while(n.call(this)===!0&&o===!0)o=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,oe.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],n,Es,e,yi)}atLeastOneSepFirstInternal(e,r){let s=this.getKeyForAutomaticLookahead(Kr,e);this.atLeastOneSepFirstInternalLogic(e,r,s)}atLeastOneSepFirstInternalLogic(e,r,s){let{DEF:n,SEP:i}=r;if(this.getLaFuncFromCache(s).call(this)===!0){n.call(this);let c=()=>this.tokenMatcher(this.LA(1),i);while(this.tokenMatcher(this.LA(1),i)===!0)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,n,Sn],c,Kr,e,Sn)}else throw this.raiseEarlyExitException(e,oe.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){let s=this.getKeyForAutomaticLookahead(Ts,e);return this.manyInternalLogic(e,r,s)}manyInternalLogic(e,r,s){let n=this.getLaFuncFromCache(s),i;if(typeof r!=="function"){i=r.DEF;let c=r.GATE;if(c!==void 0){let u=n;n=()=>c.call(this)&&u.call(this)}}else i=r;let o=!0;while(n.call(this)===!0&&o===!0)o=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],n,Ts,e,Ei,o)}manySepFirstInternal(e,r){let s=this.getKeyForAutomaticLookahead(ys,e);this.manySepFirstInternalLogic(e,r,s)}manySepFirstInternalLogic(e,r,s){let{DEF:n,SEP:i}=r;if(this.getLaFuncFromCache(s).call(this)===!0){n.call(this);let c=()=>this.tokenMatcher(this.LA(1),i);while(this.tokenMatcher(this.LA(1),i)===!0)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,n,xn],c,ys,e,xn)}}repetitionSepSecondInternal(e,r,s,n,i){while(s())this.CONSUME(r),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,s,n,i],s,Kr,e,i)}doSingleRepetition(e){let r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){let s=this.getKeyForAutomaticLookahead(wn,r),n=L(e)?e:e.DEF,o=this.getLaFuncFromCache(s).call(this,n);if(o!==void 0)return n[o].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new kn(r,e))}}subruleInternal(e,r,s){let n;try{let i=s!==void 0?s.ARGS:void 0;return this.subruleIdx=r,n=e.apply(this,i),this.cstPostNonTerminal(n,s!==void 0&&s.LABEL!==void 0?s.LABEL:e.ruleName),n}catch(i){throw this.subruleInternalError(i,s,e.ruleName)}}subruleInternalError(e,r,s){if(Zt(e)&&e.partialCstResult!==void 0)this.cstPostNonTerminal(e.partialCstResult,r!==void 0&&r.LABEL!==void 0?r.LABEL:s),delete e.partialCstResult;throw e}consumeInternal(e,r,s){let n;try{let i=this.LA(1);if(this.tokenMatcher(i,e)===!0)this.consumeToken(),n=i;else this.consumeInternalError(e,i,s)}catch(i){n=this.consumeInternalRecovery(e,r,i)}return this.cstPostTerminal(s!==void 0&&s.LABEL!==void 0?s.LABEL:e.name,n),n}consumeInternalError(e,r,s){let n,i=this.LA(0);if(s!==void 0&&s.ERR_MSG)n=s.ERR_MSG;else n=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:r,previous:i,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new jr(n,r,i))}consumeInternalRecovery(e,r,s){if(this.recoveryEnabled&&s.name==="MismatchedTokenException"&&!this.isBackTracking()){let n=this.getFollowsForInRuleRecovery(e,r);try{return this.tryInRuleRecovery(e,n)}catch(i){if(i.name===Oi)throw s;else throw i}}else throw s}saveRecogState(){let e=this.errors,r=Y(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:r,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,r,s){this.RULE_OCCURRENCE_STACK.push(s),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(r)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Ve)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class Pi{initErrorHandler(e){this._errors=[],this.errorMessageProvider=S(e,"errorMessageProvider")?e.errorMessageProvider:Fe.errorMessageProvider}SAVE_ERROR(e){if(Zt(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Y(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;else throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return Y(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,s){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],c=ms(e,i,r,this.maxLookahead)[0],u=[];for(let f=1;f<=this.maxLookahead;f++)u.push(this.LA(f));let a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:c,actual:u,previous:this.LA(0),customUserDescription:s,ruleName:n});throw this.SAVE_ERROR(new _n(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let s=this.getCurrRuleFullName(),n=this.getGAstProductions()[s],i=ps(e,n,this.maxLookahead),o=[];for(let a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));let c=this.LA(0),u=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:o,previous:c,customUserDescription:r,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Cn(u,this.LA(1),c))}}class Ui{initContentAssist(){}computeContentAssist(e,r){let s=this.gastProductionsCache[e];if(_e(s))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return On([s],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=Le(e.ruleStack),n=this.getGAstProductions()[r];return new Ti(n,e).startWalking()}}var $n={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze($n);var iu=!0,ou=Math.pow(2,Mn)-1,lu=N({name:"RECORDING_PHASE_TOKEN",pattern:ie.NA});vt([lu]);var cu=lr(lu,`This IToken indicates the Parser is in Recording Phase
98
98
  See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(cu);var zy={name:`This CSTNode indicates the Parser is in Recording Phase
99
99
  See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Di{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 r=e>0?e:"";this[`CONSUME${r}`]=function(s,n){return this.consumeInternalRecord(s,e,n)},this[`SUBRULE${r}`]=function(s,n){return this.subruleInternalRecord(s,e,n)},this[`OPTION${r}`]=function(s){return this.optionInternalRecord(s,e)},this[`OR${r}`]=function(s){return this.orInternalRecord(s,e)},this[`MANY${r}`]=function(s){this.manyInternalRecord(e,s)},this[`MANY_SEP${r}`]=function(s){this.manySepFirstInternalRecord(e,s)},this[`AT_LEAST_ONE${r}`]=function(s){this.atLeastOneInternalRecord(e,s)},this[`AT_LEAST_ONE_SEP${r}`]=function(s){this.atLeastOneSepFirstInternalRecord(e,s)}}this.consume=function(e,r,s){return this.consumeInternalRecord(r,e,s)},this.subrule=function(e,r,s){return this.subruleInternalRecord(r,e,s)},this.option=function(e,r){return this.optionInternalRecord(r,e)},this.or=function(e,r){return this.orInternalRecord(r,e)},this.many=function(e,r){this.manyInternalRecord(e,r)},this.atLeastOne=function(e,r){this.atLeastOneInternalRecord(e,r)},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 r=0;r<10;r++){let s=r>0?r:"";delete e[`CONSUME${s}`],delete e[`SUBRULE${s}`],delete e[`OPTION${s}`],delete e[`OR${s}`],delete e[`MANY${s}`],delete e[`MANY_SEP${s}`],delete e[`AT_LEAST_ONE${s}`],delete e[`AT_LEAST_ONE_SEP${s}`]}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,r){return()=>!0}LA_RECORD(e){return zr}topLevelRuleRecord(e,r){try{let s=new je({definition:[],name:e});return s.name=e,this.recordingProdStack.push(s),r.call(this),this.recordingProdStack.pop(),s}catch(s){if(s.KNOWN_RECORDER_ERROR!==!0)try{s.message=s.message+`
100
100
  This error was thrown during the "grammar recording phase" For more info see:
101
101
  https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch(n){throw s}throw s}}optionInternalRecord(e,r){return As.call(this,re,e,r)}atLeastOneInternalRecord(e,r){As.call(this,Ee,r,e)}atLeastOneSepFirstInternalRecord(e,r){As.call(this,ye,r,e,iu)}manyInternalRecord(e,r){As.call(this,B,r,e)}manySepFirstInternalRecord(e,r){As.call(this,he,r,e,iu)}orInternalRecord(e,r){return Vy.call(this,e,r)}subruleInternalRecord(e,r,s){if(Bn(r),!e||S(e,"ruleName")===!1){let c=Error(`<SUBRULE${au(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
102
102
  inside top level rule: <${this.recordingProdStack[0].name}>`);throw c.KNOWN_RECORDER_ERROR=!0,c}let n=it(this.recordingProdStack),i=e.ruleName,o=new J({idx:r,nonTerminalName:i,label:s===null||s===void 0?void 0:s.LABEL,referencedRule:void 0});return n.definition.push(o),this.outputCst?zy:$n}consumeInternalRecord(e,r,s){if(Bn(r),!pi(e)){let o=Error(`<CONSUME${au(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
103
103
  inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}let n=it(this.recordingProdStack),i=new w({idx:r,terminalType:e,label:s===null||s===void 0?void 0:s.LABEL});return n.definition.push(i),cu}}function As(e,r,s,n=!1){Bn(s);let i=it(this.recordingProdStack),o=Ue(r)?r:r.DEF,c=new e({definition:[],idx:s});if(n)c.separator=r.SEP;if(S(r,"MAX_LOOKAHEAD"))c.maxLookahead=r.MAX_LOOKAHEAD;return this.recordingProdStack.push(c),o.call(this),i.definition.push(c),this.recordingProdStack.pop(),$n}function Vy(e,r){Bn(r);let s=it(this.recordingProdStack),n=L(e)===!1,i=n===!1?e:e.DEF,o=new de({definition:[],idx:r,ignoreAmbiguities:n&&e.IGNORE_AMBIGUITIES===!0});if(S(e,"MAX_LOOKAHEAD"))o.maxLookahead=e.MAX_LOOKAHEAD;let c=ss(i,(u)=>Ue(u.GATE));return o.hasPredicates=c,s.definition.push(o),x(i,(u)=>{let a=new Z({definition:[]});if(o.definition.push(a),S(u,"IGNORE_AMBIGUITIES"))a.ignoreAmbiguities=u.IGNORE_AMBIGUITIES;else if(S(u,"GATE"))a.ignoreAmbiguities=!0;this.recordingProdStack.push(a),u.ALT.call(this),this.recordingProdStack.pop()}),$n}function au(e){return e===0?"":`${e}`}function Bn(e){if(e<0||e>ou){let r=Error(`Invalid DSL Method idx value: <${e}>
104
- Idx value must be a none negative value smaller than ${ou+1}`);throw r.KNOWN_RECORDER_ERROR=!0,r}}class Fi{initPerformanceTracer(e){if(S(e,"traceInitPerf")){let r=e.traceInitPerf,s=typeof r==="number";this.traceInitMaxIdent=s?r:1/0,this.traceInitPerf=s?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=Fe.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;let s=Array(this.traceInitIndent+1).join("\t");if(this.traceInitIndent<this.traceInitMaxIdent)console.log(`${s}--> <${e}>`);let{time:n,value:i}=is(r),o=n>10?console.warn:console.log;if(this.traceInitIndent<this.traceInitMaxIdent)o(`${s}<-- <${e}> time: ${n}ms`);return this.traceInitIndent--,i}else return r()}}function uu(e,r){r.forEach((s)=>{let n=s.prototype;Object.getOwnPropertyNames(n).forEach((i)=>{if(i==="constructor")return;let o=Object.getOwnPropertyDescriptor(n,i);if(o&&(o.get||o.set))Object.defineProperty(e.prototype,i,o);else e.prototype[i]=s.prototype[i]})})}var zr=lr(Ve,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(zr);var Fe=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:xn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Vr=Object.freeze({recoveryValueFunc:()=>{return},resyncEnabled:!0}),Re;(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"})(Re||(Re={}));class xs{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{os(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),x(this.definedRulesNames,(n)=>{let o=this[n].originalGrammarAction,c;this.TRACE_INIT(`${n} Rule`,()=>{c=this.topLevelRuleRecord(n,o)}),this.gastProductionsCache[n]=c})}finally{this.disableRecording()}});let s=[];if(this.TRACE_INIT("Grammar Resolving",()=>{s=zc({rules:G(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(s)}),this.TRACE_INIT("Grammar Validations",()=>{if(M(s)&&this.skipValidations===!1){let n=Vc({rules:G(this.gastProductionsCache),tokenTypes:G(this.tokensMap),errMsgProvider:ot,grammarName:r}),i=Uc({lookaheadStrategy:this.lookaheadStrategy,rules:G(this.gastProductionsCache),tokenTypes:G(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(n,i)}}),M(this.definitionErrors)){if(this.recoveryEnabled)this.TRACE_INIT("computeAllProdsFollows",()=>{let n=Yl(G(this.gastProductionsCache));this.resyncFollows=n});this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var n,i;(i=(n=this.lookaheadStrategy).initialize)===null||i===void 0||i.call(n,{rules:G(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(G(this.gastProductionsCache))})}if(!xs.DEFER_DEFINITION_ERRORS_HANDLING&&!M(this.definitionErrors))throw e=y(this.definitionErrors,(n)=>n.message),Error(`Parser Definition Errors detected:
104
+ Idx value must be a none negative value smaller than ${ou+1}`);throw r.KNOWN_RECORDER_ERROR=!0,r}}class Fi{initPerformanceTracer(e){if(S(e,"traceInitPerf")){let r=e.traceInitPerf,s=typeof r==="number";this.traceInitMaxIdent=s?r:1/0,this.traceInitPerf=s?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=Fe.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;let s=Array(this.traceInitIndent+1).join("\t");if(this.traceInitIndent<this.traceInitMaxIdent)console.log(`${s}--> <${e}>`);let{time:n,value:i}=is(r),o=n>10?console.warn:console.log;if(this.traceInitIndent<this.traceInitMaxIdent)o(`${s}<-- <${e}> time: ${n}ms`);return this.traceInitIndent--,i}else return r()}}function uu(e,r){r.forEach((s)=>{let n=s.prototype;Object.getOwnPropertyNames(n).forEach((i)=>{if(i==="constructor")return;let o=Object.getOwnPropertyDescriptor(n,i);if(o&&(o.get||o.set))Object.defineProperty(e.prototype,i,o);else e.prototype[i]=s.prototype[i]})})}var zr=lr(Ve,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(zr);var Fe=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:An,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Vr=Object.freeze({recoveryValueFunc:()=>{return},resyncEnabled:!0}),Re;(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"})(Re||(Re={}));class xs{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{os(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),x(this.definedRulesNames,(n)=>{let o=this[n].originalGrammarAction,c;this.TRACE_INIT(`${n} Rule`,()=>{c=this.topLevelRuleRecord(n,o)}),this.gastProductionsCache[n]=c})}finally{this.disableRecording()}});let s=[];if(this.TRACE_INIT("Grammar Resolving",()=>{s=zc({rules:G(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(s)}),this.TRACE_INIT("Grammar Validations",()=>{if(M(s)&&this.skipValidations===!1){let n=Vc({rules:G(this.gastProductionsCache),tokenTypes:G(this.tokensMap),errMsgProvider:ot,grammarName:r}),i=Uc({lookaheadStrategy:this.lookaheadStrategy,rules:G(this.gastProductionsCache),tokenTypes:G(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(n,i)}}),M(this.definitionErrors)){if(this.recoveryEnabled)this.TRACE_INIT("computeAllProdsFollows",()=>{let n=Yl(G(this.gastProductionsCache));this.resyncFollows=n});this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var n,i;(i=(n=this.lookaheadStrategy).initialize)===null||i===void 0||i.call(n,{rules:G(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(G(this.gastProductionsCache))})}if(!xs.DEFER_DEFINITION_ERRORS_HANDLING&&!M(this.definitionErrors))throw e=y(this.definitionErrors,(n)=>n.message),Error(`Parser Definition Errors detected:
105
105
  ${e.join(`
106
106
  -------------------------------
107
107
  `)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let s=this;if(s.initErrorHandler(r),s.initLexerAdapter(),s.initLooksAhead(r),s.initRecognizerEngine(e,r),s.initRecoverable(r),s.initTreeBuilder(r),s.initContentAssist(),s.initGastRecorder(r),s.initPerformanceTracer(r),S(r,"ignoredIssues"))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.