pi-outpost 0.32.4 → 0.34.0

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 (188) hide show
  1. package/dist/contract/README.md +120 -1
  2. package/dist/contract/conformance/README.md +29 -5
  3. package/dist/contract/conformance/index.json +115 -0
  4. package/dist/contract/conformance/invalid/unknown-version.json +1 -1
  5. package/dist/contract/conformance/invalid/v3-timeline-comparison-without-reference.json +123 -0
  6. package/dist/contract/conformance/invalid/v3-timeline-contradictory-change.json +128 -0
  7. package/dist/contract/conformance/invalid/v3-timeline-dependency-cycle.json +124 -0
  8. package/dist/contract/conformance/invalid/v3-timeline-dependency-on-removed.json +125 -0
  9. package/dist/contract/conformance/invalid/v3-timeline-duplicate-dependency.json +125 -0
  10. package/dist/contract/conformance/invalid/v3-timeline-duplicate-identifier.json +120 -0
  11. package/dist/contract/conformance/invalid/v3-timeline-empty-task-endpoint.json +124 -0
  12. package/dist/contract/conformance/invalid/v3-timeline-impossible-date.json +101 -0
  13. package/dist/contract/conformance/invalid/v3-timeline-inverted-activity.json +120 -0
  14. package/dist/contract/conformance/invalid/v3-timeline-inverted-range.json +120 -0
  15. package/dist/contract/conformance/invalid/v3-timeline-milestone-outside-range.json +120 -0
  16. package/dist/contract/conformance/invalid/v3-timeline-period-outside-range.json +139 -0
  17. package/dist/contract/conformance/invalid/v3-timeline-presentation-property.json +121 -0
  18. package/dist/contract/conformance/invalid/v3-timeline-previous-outside-range.json +128 -0
  19. package/dist/contract/conformance/invalid/v3-timeline-previous-wrong-shape.json +128 -0
  20. package/dist/contract/conformance/invalid/v3-timeline-reference-outside-range.json +140 -0
  21. package/dist/contract/conformance/invalid/v3-timeline-self-dependency.json +124 -0
  22. package/dist/contract/conformance/invalid/v3-timeline-under-version-2.json +120 -0
  23. package/dist/contract/conformance/invalid/v3-timeline-unknown-dependency-type.json +121 -0
  24. package/dist/contract/conformance/invalid/v3-timeline-unresolved-dependency-endpoint.json +120 -0
  25. package/dist/contract/conformance/invalid/v3-timeline-unsupported-scale.json +120 -0
  26. package/dist/contract/conformance/invalid/v3-timeline-with-target.json +123 -0
  27. package/dist/contract/conformance/valid/v3-timeline-calendar.json +140 -0
  28. package/dist/contract/conformance/valid/v3-timeline-compared.json +142 -0
  29. package/dist/contract/conformance/valid/v3-timeline-empty-task-and-anonymous-separator.json +35 -0
  30. package/dist/contract/conformance/valid/v3-timeline-four-dependency-types.json +61 -0
  31. package/dist/contract/conformance/valid/v3-timeline-programme.json +44 -0
  32. package/dist/contract/conformance/valid/v3-timeline-quarter-scale.json +42 -0
  33. package/dist/contract/conformance/valid/v3-timeline-single-day-activity.json +27 -0
  34. package/dist/contract/conformance/valid/v3-timeline-unsatisfied-dependency.json +45 -0
  35. package/dist/contract/conformance/valid/v3-timeline-week-scale.json +35 -0
  36. package/dist/contract/conformance/version-1.lock.json +2 -2
  37. package/dist/contract/schemas/structured-exchange-3.json +1263 -0
  38. package/dist/contract/schemas/structured-exchange-profile-registry-2.json +94 -0
  39. package/dist/contract/structured-exchange-project-setup.md +36 -0
  40. package/dist/contract/validate-structured-exchange.mjs +1981 -174
  41. package/dist/pi-outpost-tools.mjs +4556 -1130
  42. package/dist/pi-outpost.mjs +5733 -1898
  43. package/dist/pi-outpost.sea.mjs +2 -2
  44. package/dist/sea-prep.blob +2 -2
  45. package/dist/skills/structured-exchange/SKILL.md +90 -378
  46. package/dist/skills/structured-exchange/references/enriched-contract.md +158 -0
  47. package/dist/skills/structured-exchange/references/figures.md +52 -0
  48. package/dist/skills/structured-exchange/references/graphs-and-tables.md +115 -0
  49. package/dist/skills/structured-exchange/references/proposals.md +86 -0
  50. package/dist/skills/structured-exchange/references/timelines.md +87 -0
  51. package/dist/skills/structured-exchange/structured-exchange-3.json +1263 -0
  52. package/dist/skills/structured-exchange/structured-exchange-profile-registry-2.json +94 -0
  53. package/dist/skills/structured-exchange-project/SKILL.md +22 -0
  54. package/dist/web/assets/{PdfViewer-DHIy06i5.js → PdfViewer-9kadnb9W.js} +2 -2
  55. package/dist/web/assets/{abnfDiagram-VCTEODGH-0IqI620v.js → abnfDiagram-YUKMZFIV-BUZ7jF1I.js} +1 -1
  56. package/dist/web/assets/architecture-WOLXFQ4H-CxBmyj2Z.js +1 -0
  57. package/dist/web/assets/architectureDiagram-47P4ROYG-BAvert-J.js +36 -0
  58. package/dist/web/assets/{blockDiagram-OSKFZWR5-sw0nzjYC.js → blockDiagram-E7TT5TSB-CXQT_J2x.js} +16 -5
  59. package/dist/web/assets/c4Diagram-CRA5TL53-Byqo5aDs.js +38 -0
  60. package/dist/web/assets/channel-D3nE3SyW.js +1 -0
  61. package/dist/web/assets/chunk-2BW5OAIV-D9dSVCv2.js +10 -0
  62. package/dist/web/assets/chunk-3YJQHVM4-D6IQcIQB.js +2 -0
  63. package/dist/web/assets/chunk-4EA7E6EY-BxZ_5HMn.js +1 -0
  64. package/dist/web/assets/{chunk-F27PBJKO-C6rqX2gT.js → chunk-7TKQ45FW-G9TsFldk.js} +1 -1
  65. package/dist/web/assets/{chunk-SVP7TREG-CYXVRfc0.js → chunk-AW2ZBBNX-nmg5rsd5.js} +3 -3
  66. package/dist/web/assets/{chunk-GVQU2GXP-BtSmWzHA.js → chunk-DBDB3WZW-BwVIGLtu.js} +1 -1
  67. package/dist/web/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
  68. package/dist/web/assets/chunk-E2ZNV5FY-VD95O25Z.js +72 -0
  69. package/dist/web/assets/chunk-EU5HNXII-CSnybkPb.js +213 -0
  70. package/dist/web/assets/chunk-FVRAUYC3-TBqluQ8N.js +2 -0
  71. package/dist/web/assets/{chunk-PWAF6VOD-Dup_NAkl.js → chunk-HJ2JQQFS-BiLMpVsO.js} +1 -1
  72. package/dist/web/assets/chunk-HTAEGDNF-QDOAuhR5.js +1 -0
  73. package/dist/web/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
  74. package/dist/web/assets/{chunk-POPQ4Y6H-BrnPOTT-.js → chunk-KQW6MTUR-_WxFaX97.js} +1 -1
  75. package/dist/web/assets/chunk-NGNAAXSQ-BW1P8EP7.js +136 -0
  76. package/dist/web/assets/chunk-NTY3LDVX-BI0Pj8F6.js +1 -0
  77. package/dist/web/assets/chunk-VPRB5NB3-BBDlNNll.js +129 -0
  78. package/dist/web/assets/chunk-XC4XBNZT-Ba1ra4Jd.js +62 -0
  79. package/dist/web/assets/classDiagram-v2-K4WV4PDN-CksBjG_q.js +217 -0
  80. package/dist/web/assets/{conversationExport-CfUybHMU.js → conversationExport-q-9NUHuj.js} +1 -1
  81. package/dist/web/assets/cynefin-EF2NZ3EQ-ucJDz_S5.js +1 -0
  82. package/dist/web/assets/{cynefinDiagram-5FMLGOSQ-BKvXEDID.js → cynefinDiagram-3GCD6N5R-qPxcNdaa.js} +1 -1
  83. package/dist/web/assets/dagre-W4DXFKR2-ChflYJGj.js +4 -0
  84. package/dist/web/assets/diagram-2UJZ2QOL-Bi9ngdu2.js +200 -0
  85. package/dist/web/assets/{diagram-VX7I27RA-D5POkb-9.js → diagram-OVF4WLC6-iSSbF5Cd.js} +10 -10
  86. package/dist/web/assets/{diagram-S7CK7UJ4-DTvEAe9r.js → diagram-PFPMY2P6-BeEOD8rR.js} +2 -2
  87. package/dist/web/assets/{diagram-Z3DM3KII-CC2Mxm4H.js → diagram-UMYRVEAY-BckO6iZI.js} +1 -1
  88. package/dist/web/assets/{diagram-UQ7AKVKN-CVGEkml-.js → diagram-YEKJPTXX-BzzDIAmO.js} +2 -2
  89. package/dist/web/assets/diagram-ZIFT7M5P-ByjWOPbN.js +3 -0
  90. package/dist/web/assets/{docxExport-ErgwApAZ.js → docxExport-BO7j3Xnv.js} +1 -1
  91. package/dist/web/assets/{ebnfDiagram-PWID7BFC-CbDy2vxX.js → ebnfDiagram-VR2GEFS7-DRp-A5JC.js} +1 -1
  92. package/dist/web/assets/elk-IJKZMXRS-QzeiQ3l1.js +27 -0
  93. package/dist/web/assets/{erDiagram-2YWLMYGG-DUdStx-7.js → erDiagram-O2IAPWRE-BewZvI56.js} +15 -15
  94. package/dist/web/assets/eventmodeling-K75KTNOO-CX7X0bsf.js +1 -0
  95. package/dist/web/assets/flowDiagram-OXPTDLAJ-CSIHFoeR.js +1 -0
  96. package/dist/web/assets/ganttDiagram-R7TSEDQI-BT8Lcdwc.js +292 -0
  97. package/dist/web/assets/gitGraph-VSP46ZUC-BxYbaxeg.js +1 -0
  98. package/dist/web/assets/gitGraphDiagram-XJZIOB7I-B0fqVCqP.js +106 -0
  99. package/dist/web/assets/index-DcqvxkHN.css +2 -0
  100. package/dist/web/assets/index-eTp_lQUc.js +350 -0
  101. package/dist/web/assets/info-OHQRW6UA-DV3PDKXA.js +1 -0
  102. package/dist/web/assets/infoDiagram-5W2HQ5XZ-DfHpZ9RG.js +2 -0
  103. package/dist/web/assets/{ishikawaDiagram-5VMMS53U-D-gYpOUM.js → ishikawaDiagram-K3B6WC7H-DuwLwL9k.js} +2 -2
  104. package/dist/web/assets/{journeyDiagram-EYS64GPL-B0WqOtZ4.js → journeyDiagram-COXZFDF6-CMOfweZO.js} +4 -4
  105. package/dist/web/assets/{kanban-definition-UXKFOSKX-DIrVFtP3.js → kanban-definition-P3RFRI5V-DjHhlDbk.js} +9 -9
  106. package/dist/web/assets/{line-CuEhAU65.js → line-CGIAMPkR.js} +1 -1
  107. package/dist/web/assets/loadReferencedImage-DZ5eApE4.js +2 -0
  108. package/dist/web/assets/{mermaid-parser.core-CzCh9EE1.js → mermaid-parser.core-C18KmsD9.js} +6 -6
  109. package/dist/web/assets/mermaid.core-C9srNL3b.js +44 -0
  110. package/dist/web/assets/{mindmap-definition-THT77NOG-CBH0Z9AJ.js → mindmap-definition-LZFPQGKD-C38HXkG2.js} +24 -24
  111. package/dist/web/assets/packet-JDAUHWVQ-Br-8ADK6.js +1 -0
  112. package/dist/web/assets/{pdf-6mG9havR.js → pdf-C3f6Vjz7.js} +1 -1
  113. package/dist/web/assets/{pegDiagram-XKGWAZYB-BNpTWHo8.js → pegDiagram-BGZESJAR-Be49dM_b.js} +1 -1
  114. package/dist/web/assets/pie-XZMESJXO-68ykK6i1.js +1 -0
  115. package/dist/web/assets/{pieDiagram-E7YTZNPT-CZ34Q1W-.js → pieDiagram-CAPJLFHJ-DVOWjXQ_.js} +2 -2
  116. package/dist/web/assets/{quadrantDiagram-AXDQQJYC-C5aFQsIe.js → quadrantDiagram-GDMTTRAM-8la_R53U.js} +3 -3
  117. package/dist/web/assets/radar-ABXABTNO-K00ZGu13.js +1 -0
  118. package/dist/web/assets/railroad-I3PHUGI6-W7QuDysT.js +1 -0
  119. package/dist/web/assets/railroad-abnf-LNEFI6M7-DR6CNkaK.js +1 -0
  120. package/dist/web/assets/railroad-ebnf-DWYD2UWJ-dAhaGv5L.js +1 -0
  121. package/dist/web/assets/railroad-peg-JR7BVNR7-DwoiiDdE.js +1 -0
  122. package/dist/web/assets/{railroadDiagram-O6MQD6OU-B0ctRtRT.js → railroadDiagram-SM67HX2B-BuSjCs02.js} +1 -1
  123. package/dist/web/assets/{requirementDiagram-IS5BZ75X-BuOtNPGm.js → requirementDiagram-X7JNWC4A-3uq8m_5E.js} +11 -11
  124. package/dist/web/assets/{sankeyDiagram-P5KCCOFB-CybICPpQ.js → sankeyDiagram-UM26HJRW-BB9_G8bN.js} +3 -3
  125. package/dist/web/assets/sequenceDiagram-ZO4K6R2Y-CGehVq9k.js +169 -0
  126. package/dist/web/assets/stateDiagram-v2-TBUQTH76-CwMywh5s.js +291 -0
  127. package/dist/web/assets/swimlanes-N4OXWK64-CqjihurI.js +1 -0
  128. package/dist/web/assets/swimlanesDiagram-K3J5GTZL-Blk5ohUI.js +8 -0
  129. package/dist/web/assets/timeline-definition-YOQAKGHF-BtKnuY5Y.js +120 -0
  130. package/dist/web/assets/treeView-D4JQ5SDB-Dy4jC4wa.js +1 -0
  131. package/dist/web/assets/treemap-SAJKECNS-CHtGJD8P.js +1 -0
  132. package/dist/web/assets/usecaseDiagram-VIAY4XPW-BjnstWbR.js +328 -0
  133. package/dist/web/assets/vennDiagram-BLWOH2XV-o_EtJWVA.js +34 -0
  134. package/dist/web/assets/wardley-7MLQ67FV-BTheL3FW.js +1 -0
  135. package/dist/web/assets/{wardleyDiagram-VM6X3IG4-CzB2tR_t.js → wardleyDiagram-YMQ3BMBF-Bp_sv2v4.js} +3 -3
  136. package/dist/web/assets/xychartDiagram-TAQBALBS-C0IpEfij.js +7 -0
  137. package/dist/web/index.html +2 -2
  138. package/package.json +3 -3
  139. package/dist/web/assets/architecture-7GRP2DOG-BqTZwqCY.js +0 -1
  140. package/dist/web/assets/architectureDiagram-5GKGNRK7-BEGSAGSn.js +0 -36
  141. package/dist/web/assets/c4Diagram-7LVT6UL2-C6wQYxBC.js +0 -38
  142. package/dist/web/assets/channel-CbMG5PZq.js +0 -1
  143. package/dist/web/assets/chunk-3NF5O7KM-Dni31-nE.js +0 -168
  144. package/dist/web/assets/chunk-4HAMMTFA-hiqoLVtf.js +0 -62
  145. package/dist/web/assets/chunk-75Z2AOVW-1k7HRGrm.js +0 -2
  146. package/dist/web/assets/chunk-DU6HZSFF-Dy05V--k.js +0 -127
  147. package/dist/web/assets/chunk-FOHPRMQF-DHwB1DNv.js +0 -161
  148. package/dist/web/assets/chunk-GMAD6QVW-Bi5Ne8OE.js +0 -72
  149. package/dist/web/assets/chunk-HLEWEB6X-yamDqy1M.js +0 -206
  150. package/dist/web/assets/chunk-L3NEJ4N5-CQSamtuJ.js +0 -1
  151. package/dist/web/assets/chunk-OSK3NFVY-S95igUko.js +0 -10
  152. package/dist/web/assets/chunk-P2QGCYS3-BPor-azX.js +0 -1
  153. package/dist/web/assets/chunk-ZLD2IHE6-D0uZMMWb.js +0 -231
  154. package/dist/web/assets/classDiagram-CYGNFDIV-2Yl201cv.js +0 -1
  155. package/dist/web/assets/classDiagram-v2-TLXNO2FR-2Yl201cv.js +0 -1
  156. package/dist/web/assets/cynefin-OW5HDTMX-ua6bZIWp.js +0 -1
  157. package/dist/web/assets/dagre-OS7QT2EB-BRxaZdm2.js +0 -4
  158. package/dist/web/assets/dagre-PrKaheQc.js +0 -1
  159. package/dist/web/assets/diagram-VSXAHHWV-Dkh-RvzE.js +0 -3
  160. package/dist/web/assets/eventmodeling-NTZA5JFV-Bw8wULv_.js +0 -1
  161. package/dist/web/assets/flowDiagram-T62WH6J4-Dp4v9IDN.js +0 -1
  162. package/dist/web/assets/ganttDiagram-EL5Y4UJY-6dI1H52q.js +0 -292
  163. package/dist/web/assets/gitGraph-4MIJSDKK-UXnB0IFr.js +0 -1
  164. package/dist/web/assets/gitGraphDiagram-WWUBYQGX-B_wXPpx0.js +0 -106
  165. package/dist/web/assets/index-9y9n2Dul.css +0 -2
  166. package/dist/web/assets/index-COu8CnNa.js +0 -350
  167. package/dist/web/assets/info-A6RAGUB7-C2WWyNzF.js +0 -1
  168. package/dist/web/assets/infoDiagram-FKFFQAWI-DY65_ndC.js +0 -2
  169. package/dist/web/assets/loadReferencedImage-DgHMXQNZ.js +0 -2
  170. package/dist/web/assets/mermaid.core-BmGW_v8T.js +0 -44
  171. package/dist/web/assets/packet-AYTQ26CC-BYG_KViO.js +0 -1
  172. package/dist/web/assets/pie-WAS4IAKB-wBoUHr8R.js +0 -1
  173. package/dist/web/assets/radar-RG4KPBEZ-D4K5XP7X.js +0 -1
  174. package/dist/web/assets/railroad-74A4TZTK-Haum25Us.js +0 -1
  175. package/dist/web/assets/railroad-abnf-HS5TGJTU-D-kbOsoZ.js +0 -1
  176. package/dist/web/assets/railroad-ebnf-LZEXJU2U-CWtixpZf.js +0 -1
  177. package/dist/web/assets/railroad-peg-WCYAUIDC-BeY7arxf.js +0 -1
  178. package/dist/web/assets/sequenceDiagram-WJ2MYXX4-Dvo8sl8e.js +0 -162
  179. package/dist/web/assets/stateDiagram-XQSTLZYL-BcM-hGJa.js +0 -1
  180. package/dist/web/assets/stateDiagram-v2-IH3M54BS-hYgwFLzv.js +0 -1
  181. package/dist/web/assets/swimlanes-V6O3JKXN-mOOjKnlm.js +0 -1
  182. package/dist/web/assets/swimlanesDiagram-JKAHXJPX-C_yinM3f.js +0 -8
  183. package/dist/web/assets/timeline-definition-24CTP7MA-DuwMztTy.js +0 -120
  184. package/dist/web/assets/treeView-Q6P3EWNA-BT4vRttT.js +0 -1
  185. package/dist/web/assets/treemap-WGGIJYW6-Df6GHCE2.js +0 -1
  186. package/dist/web/assets/vennDiagram-4TSXK5OY-BbcbGn7o.js +0 -34
  187. package/dist/web/assets/wardley-WFR3VGLG-L_G3ydHA.js +0 -1
  188. package/dist/web/assets/xychartDiagram-S5SC5T6Z-CKHwJboP.js +0 -7
@@ -0,0 +1,328 @@
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-oBChb5qS.js";import{C as r,H as i,U as a,_ as o,a as s,b as c,f as l,q as u,v as d,y as f,z as p}from"./chunk-VPRB5NB3-BBDlNNll.js";import{_ as m}from"./chunk-3YJQHVM4-D6IQcIQB.js";import"./chunk-HJ2JQQFS-BiLMpVsO.js";import{i as h}from"./chunk-E2ZNV5FY-VD95O25Z.js";import"./chunk-4EA7E6EY-BxZ_5HMn.js";import{a as g,i as _,o as ee,r as v}from"./chunk-J5ZVWO5B-oDCd-gWO.js";import"./chunk-XC4XBNZT-Ba1ra4Jd.js";import"./chunk-DBDB3WZW-BwVIGLtu.js";import"./chunk-2BW5OAIV-D9dSVCv2.js";import{t as te}from"./chunk-XXDRQBXY-BvKO0v-W.js";import{t as ne}from"./chunk-KQW6MTUR-_WxFaX97.js";import"./chunk-NTY3LDVX-BI0Pj8F6.js";import{a as re,i as ie}from"./mermaid.core-C9srNL3b.js";function ae(e){console&&console.error&&console.error(`Error: ${e}`)}function y(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function oe(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function se(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e}function ce(e){return le(e)?e.LABEL:e.name}function le(e){return typeof e.LABEL==`string`&&e.LABEL!==``}var b=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},x=class extends b{constructor(e){super([]),this.idx=1,Object.assign(this,j(e))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},S=class extends b{constructor(e){super(e.definition),this.orgText=``,Object.assign(this,j(e))}},C=class extends b{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,j(e))}},w=class extends b{constructor(e){super(e.definition),this.idx=1,Object.assign(this,j(e))}},T=class extends b{constructor(e){super(e.definition),this.idx=1,Object.assign(this,j(e))}},E=class extends b{constructor(e){super(e.definition),this.idx=1,Object.assign(this,j(e))}},D=class extends b{constructor(e){super(e.definition),this.idx=1,Object.assign(this,j(e))}},O=class extends b{constructor(e){super(e.definition),this.idx=1,Object.assign(this,j(e))}},k=class extends b{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,j(e))}},A=class{constructor(e){this.idx=1,Object.assign(this,j(e))}accept(e){e.visit(this)}};function ue(e){return e.map(de)}function de(e){function t(e){return e.map(de)}if(e instanceof x){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return typeof e.label==`string`&&(t.label=e.label),t}if(e instanceof C)return{type:`Alternative`,definition:t(e.definition)};if(e instanceof w)return{type:`Option`,idx:e.idx,definition:t(e.definition)};if(e instanceof T)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};if(e instanceof E)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:de(new A({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof O)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:de(new A({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof D)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};if(e instanceof k)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};if(e instanceof A){let t={type:`Terminal`,name:e.terminalType.name,label:ce(e.terminalType),idx:e.idx};typeof e.label==`string`&&(t.terminalLabel=e.label);let n=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=n instanceof RegExp?n.source:n),t}if(e instanceof S)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error(`non exhaustive match`)}function j(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var fe=class{visit(e){let t=e;switch(t.constructor){case x:return this.visitNonTerminal(t);case C:return this.visitAlternative(t);case w:return this.visitOption(t);case T:return this.visitRepetitionMandatory(t);case E:return this.visitRepetitionMandatoryWithSeparator(t);case O:return this.visitRepetitionWithSeparator(t);case D:return this.visitRepetition(t);case k:return this.visitAlternation(t);case A:return this.visitTerminal(t);case S:return this.visitRule(t);default:throw Error(`non exhaustive match`)}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function pe(e){return e instanceof C||e instanceof w||e instanceof D||e instanceof T||e instanceof E||e instanceof O||e instanceof A||e instanceof S}function me(e,t=[]){return e instanceof w||e instanceof D||e instanceof O?!0:e instanceof k?e.definition.some(e=>me(e,t)):e instanceof x&&t.includes(e)?!1:e instanceof b&&(e instanceof x&&t.push(e),e.definition.every(e=>me(e,t)))}function he(e){return e instanceof k}function M(e){if(e instanceof x)return`SUBRULE`;if(e instanceof w)return`OPTION`;if(e instanceof k)return`OR`;if(e instanceof T)return`AT_LEAST_ONE`;if(e instanceof E)return`AT_LEAST_ONE_SEP`;if(e instanceof O)return`MANY_SEP`;if(e instanceof D)return`MANY`;if(e instanceof A)return`CONSUME`;throw Error(`non exhaustive match`)}var ge=class{walk(e,t=[]){e.definition.forEach((n,r)=>{let i=e.definition.slice(r+1);if(n instanceof x)this.walkProdRef(n,i,t);else if(n instanceof A)this.walkTerminal(n,i,t);else if(n instanceof C)this.walkFlat(n,i,t);else if(n instanceof w)this.walkOption(n,i,t);else if(n instanceof T)this.walkAtLeastOne(n,i,t);else if(n instanceof E)this.walkAtLeastOneSep(n,i,t);else if(n instanceof O)this.walkManySep(n,i,t);else if(n instanceof D)this.walkMany(n,i,t);else if(n instanceof k)this.walkOr(n,i,t);else throw Error(`non exhaustive match`)})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){let r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){let r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){let r=[new w({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){let r=_e(e,t,n);this.walk(e,r)}walkMany(e,t,n){let r=[new w({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){let r=_e(e,t,n);this.walk(e,r)}walkOr(e,t,n){let r=t.concat(n);e.definition.forEach(e=>{let t=new C({definition:[e]});this.walk(t,r)})}};function _e(e,t,n){return[new w({definition:[new A({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function ve(e){if(e instanceof x)return ve(e.referencedRule);if(e instanceof A)return xe(e);if(pe(e))return ye(e);if(he(e))return be(e);throw Error(`non exhaustive match`)}function ye(e){let t=[],n=e.definition,r=0,i=n.length>r,a,o=!0;for(;i&&o;)a=n[r],o=me(a),t=t.concat(ve(a)),r+=1,i=n.length>r;return[...new Set(t)]}function be(e){let t=e.definition.map(e=>ve(e));return[...new Set(t.flat())]}function xe(e){return[e.terminalType]}var Se=`_~IN~_`,Ce=class extends ge{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){let r=Te(e.referencedRule,e.idx)+this.topProd.name,i=ve(new C({definition:t.concat(n)}));this.follows[r]=i}};function we(e){let t={};return e.forEach(e=>{let n=new Ce(e).startWalking();Object.assign(t,n)}),t}function Te(e,t){return e.name+t+Se}function N(e){return e.charCodeAt(0)}function Ee(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function De(e,t){if(e[t]===!0)throw`duplicate flag `+t;e[t],e[t]=!0}function Oe(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function ke(){throw Error(`Internal Error - Should never get here!`)}function Ae(e){return e.type===`Character`}var je=[];for(let e=N(`0`);e<=N(`9`);e++)je.push(e);var Me=[N(`_`)].concat(je);for(let e=N(`a`);e<=N(`z`);e++)Me.push(e);for(let e=N(`A`);e<=N(`Z`);e++)Me.push(e);var Ne=[N(` `),N(`\f`),N(`
2
+ `),N(`\r`),N(` `),N(`\v`),N(` `),N(`\xA0`),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(` `),N(`\u2028`),N(`\u2029`),N(` `),N(` `),N(` `),N(``)],Pe=/[0-9a-fA-F]/,Fe=/[0-9]/,Ie=/[1-9]/,Le=class{constructor(){this.idx=0,this.input=``,this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);let t=this.disjunction();this.consumeChar(`/`);let n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case`g`:De(n,`global`);break;case`i`:De(n,`ignoreCase`);break;case`m`:De(n,`multiLine`);break;case`u`:De(n,`unicode`);break;case`y`:De(n,`sticky`)}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:this.consumeChar(`?`);let t;switch(this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break;case`<`:switch(this.popChar()){case`=`:t=`Lookbehind`;break;case`!`:t=`NegativeLookbehind`}}Oe(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return ke()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:let n=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:n,atMost:n};break;case`,`:let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar(`}`)}if(e===!0&&t===void 0)return;Oe(t)}if((e!==!0||t!==void 0)&&Oe(t))return this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t}atom(){let e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group()}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Oe(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):ke()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[N(`
3
+ `),N(`\r`),N(`\u2028`),N(`\u2029`)]}}atomEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:`GroupBackReference`,value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case`d`:e=je;break;case`D`:e=je,t=!0;break;case`s`:e=Ne;break;case`S`:e=Ne,t=!0;break;case`w`:e=Me;break;case`W`:e=Me,t=!0}return Oe(e)?{type:`Set`,value:e,complement:t}:ke()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=N(`\f`);break;case`n`:e=N(`
4
+ `);break;case`r`:e=N(`\r`);break;case`t`:e=N(` `);break;case`v`:e=N(`\v`)}return Oe(e)?{type:`Character`,value:e}:ke()}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:N(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:N(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
5
+ `:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:N(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,Ae(t)&&this.isRangeDash()){this.consumeChar(`-`);let n=this.classAtom();if(n.type,Ae(n)){if(n.value<t.value)throw Error(`Range out of order in character class`);e.push({from:t.value,to:n.value})}else Ee(t.value,e),e.push(N(`-`)),Ee(n.value,e)}else Ee(t.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,value:e}}classAtom(){switch(this.peekChar()){case`]`:case`
6
+ `:case`\r`:case`\u2028`:case`\u2029`:throw Error(`TBD`);case`\\`:return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`b`:return this.consumeChar(`b`),{type:`Character`,value:N(`\b`)};case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar(`(`),this.peekChar(0)){case`?`:this.consumeChar(`?`),this.consumeChar(`:`),e=!1;break;default:this.groupIdx++}let t=this.disjunction();this.consumeChar(`)`);let n={type:`Group`,capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(Ie.test(e)===!1)throw Error(`Expecting a positive integer`);for(;Fe.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Fe.test(e)===!1)throw Error(`Expecting an integer`);for(;Fe.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
7
+ `:case`\r`:case`\u2028`:case`\u2029`:case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:throw Error(`TBD`);default:return{type:`Character`,value:N(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case`g`:case`i`:case`m`:case`u`:case`y`:return!0;default:return!1}}isRangeDash(){return this.peekChar()===`-`&&this.isClassAtom(1)}isDigit(){return Fe.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case`]`:case`
8
+ `:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case`.`:case`\\`:case`[`:case`(`:return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case`^`:case`$`:return!0;case`\\`:switch(this.peekChar(1)){case`b`:case`B`:return!0;default:return!1}case`(`:return this.peekChar(1)===`?`&&(this.peekChar(2)===`=`||this.peekChar(2)===`!`||this.peekChar(2)===`<`&&(this.peekChar(3)===`=`||this.peekChar(3)===`!`));default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:case`/`:case`
9
+ `:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}parseHexDigits(e){let t=``;for(let n=0;n<e;n++){let e=this.popChar();if(Pe.test(e)===!1)throw Error(`Expecting a HexDecimal digits`);t+=e}return{type:`Character`,value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error(`Expected: '`+e+`' but found: '`+this.input[this.idx]+`' at offset: `+this.idx);if(this.idx>=this.input.length)throw Error(`Unexpected end of input`);this.idx++}loc(e){return{begin:e,end:this.idx}}},Re=class{visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this):this.visit(n))}}visit(e){switch(e.type){case`Pattern`:this.visitPattern(e);break;case`Flags`:this.visitFlags(e);break;case`Disjunction`:this.visitDisjunction(e);break;case`Alternative`:this.visitAlternative(e);break;case`StartAnchor`:this.visitStartAnchor(e);break;case`EndAnchor`:this.visitEndAnchor(e);break;case`WordBoundary`:this.visitWordBoundary(e);break;case`NonWordBoundary`:this.visitNonWordBoundary(e);break;case`Lookahead`:this.visitLookahead(e);break;case`NegativeLookahead`:this.visitNegativeLookahead(e);break;case`Lookbehind`:this.visitLookbehind(e);break;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);break;case`Character`:this.visitCharacter(e);break;case`Set`:this.visitSet(e);break;case`Group`:this.visitGroup(e);break;case`GroupBackReference`:this.visitGroupBackReference(e);break;case`Quantifier`:this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},ze={},Be=new Le;function Ve(e){let t=e.toString();if(ze.hasOwnProperty(t))return ze[t];{let e=Be.pattern(t);return ze[t]=e,e}}function He(){ze={}}var Ue=`Complement Sets are not supported for first char optimization`,We=`Unable to use "first char" lexer optimizations:
10
+ `;function Ge(e,t=!1){try{let t=Ve(e);return Ke(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===Ue)t&&y(`${We}\tUnable to optimize: < ${e.toString()} >\n Complement Sets cannot be automatically optimized.
11
+ This will disable the lexer's first char optimizations.
12
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n=``;t&&(n=`
13
+ This will disable the lexer's first char optimizations.
14
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),ae(`${We}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Ke(e,t,n){switch(e.type){case`Disjunction`:for(let r=0;r<e.value.length;r++)Ke(e.value[r],t,n);break;case`Alternative`:let r=e.value;for(let e=0;e<r.length;e++){let i=r[e];switch(i.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`Lookbehind`:case`NegativeLookbehind`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}let a=i;switch(a.type){case`Character`:qe(a.value,t,n);break;case`Set`:if(a.complement===!0)throw Error(Ue);a.value.forEach(e=>{if(typeof e==`number`)qe(e,t,n);else{let r=e;if(n===!0)for(let e=r.from;e<=r.to;e++)qe(e,t,n);else{for(let e=r.from;e<=r.to&&e<256;e++)qe(e,t,n);if(r.to>=256){let e=r.from>=256?r.from:256,n=r.to,i=P(e),a=P(n);for(let e=i;e<=a;e++)t[e]=e}}}});break;case`Group`:Ke(a.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}let o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type===`Group`&&Xe(a)===!1||a.type!==`Group`&&o===!1)break}break;default:throw Error(`non exhaustive match!`)}return Object.values(t)}function qe(e,t,n){let r=P(e);t[r]=r,n===!0&&Je(e,t)}function Je(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let e=P(r.charCodeAt(0));t[e]=e}else{let e=n.toLowerCase();if(e!==n){let n=P(e.charCodeAt(0));t[n]=n}}}function Ye(e,t){return e.value.find(e=>{if(typeof e==`number`)return t.includes(e);{let n=e;return t.find(e=>n.from<=e&&e<=n.to)!==void 0}})}function Xe(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?Array.isArray(e.value)?e.value.every(Xe):Xe(e.value):!1}var Ze=class extends Re{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case`Lookahead`:this.visitLookahead(e);return;case`NegativeLookahead`:this.visitNegativeLookahead(e);return;case`Lookbehind`:this.visitLookbehind(e);return;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?Ye(e,this.targetCharCodes)===void 0&&(this.found=!0):Ye(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Qe(e,t){if(t instanceof RegExp){let n=Ve(t),r=new Ze(e);return r.visit(n),r.found}for(let n of t){let t=n.charCodeAt(0);if(e.includes(t))return!0}return!1}var $e=`PATTERN`,et=`defaultMode`;function tt(e,t){t=Object.assign({safeMode:!1,positionTracking:`full`,lineTerminatorCharacters:[`\r`,`
15
+ `],tracer:(e,t)=>t()},t);let n=t.tracer;n(`initCharCodeToOptimizedIndexMap`,()=>{jt()});let r;n(`Reject Lexer.NA`,()=>{r=e.filter(e=>e[$e]!==I.NA)});let i=!1,a;n(`Transform Patterns`,()=>{i=!1,a=r.map(e=>{let t=e[$e];if(t instanceof RegExp){let e=t.source;return e.length===1&&e!==`^`&&e!==`$`&&e!==`.`&&!t.ignoreCase?e:e.length===2&&e[0]===`\\`&&![`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`].includes(e[1])?e[1]:bt(t)}if(typeof t==`function`)return i=!0,{exec:t};if(typeof t==`object`)return i=!0,t;if(typeof t==`string`){if(t.length===1)return t;{let e=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`);return bt(new RegExp(e))}}throw Error(`non exhaustive match`)})});let o,s,c,l,u;n(`misc mapping`,()=>{o=r.map(e=>e.tokenTypeIdx),s=r.map(e=>{let t=e.GROUP;if(t!==I.SKIPPED){if(typeof t==`string`)return t;if(t===void 0)return!1;throw Error(`non exhaustive match`)}}),c=r.map(e=>{let t=e.LONGER_ALT;if(t)return Array.isArray(t)?t.map(e=>r.indexOf(e)):[r.indexOf(t)]}),l=r.map(e=>e.PUSH_MODE),u=r.map(e=>Object.hasOwn(e,`POP_MODE`))});let d;n(`Line Terminator Handling`,()=>{let e=Ot(t.lineTerminatorCharacters);d=r.map(e=>!1),t.positionTracking!==`onlyOffset`&&(d=r.map(t=>Object.hasOwn(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:Et(t,e)===!1&&Qe(e,t.PATTERN)))});let f,p,m,h;n(`Misc Mapping #2`,()=>{f=r.map(Ct),p=a.map(wt),m=r.reduce((e,t)=>{let n=t.GROUP;return typeof n==`string`&&n!==I.SKIPPED&&(e[n]=[]),e},{}),h=a.map((e,t)=>{let n=s[t]===void 0&&c[t]===void 0?nt(r[t].PATTERN):void 0;return{pattern:a[t],asciiClass:n,longerAlt:c[t],canLineTerminator:d[t],matchType:n===void 0?p[t]===!1?f[t]?1:2:0:3,short:p[t],group:s[t],push:l[t],pop:u[t],tokenTypeIdx:o[t],tokenType:r[t]}})});let g=!0,_=[];return t.safeMode||n(`First Char Optimization`,()=>{_=r.reduce((e,n,r)=>{if(typeof n.PATTERN==`string`)kt(e,P(n.PATTERN.charCodeAt(0)),h[r]);else if(Array.isArray(n.START_CHARS_HINT)){let t;n.START_CHARS_HINT.forEach(n=>{let i=P(typeof n==`string`?n.charCodeAt(0):n);t!==i&&(t=i,kt(e,i,h[r]))})}else if(n.PATTERN instanceof RegExp){if(n.PATTERN.unicode)g=!1,t.ensureOptimizations&&ae(`${We}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n The regexp unicode flag is not currently supported by the regexp-to-ast library.
16
+ This will disable the lexer's first char optimizations.
17
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let i=Ge(n.PATTERN,t.ensureOptimizations);i.length===0&&(g=!1),i.forEach(t=>{kt(e,t,h[r])})}}else t.ensureOptimizations&&ae(`${We}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n This will disable the lexer's first char optimizations.
18
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),g=!1;return e},[])}),{emptyGroups:m,patternIdxToConfig:h,charCodeToPatternIdxToConfig:_,hasCustom:i,canBeOptimized:g}}function nt(e){if(!(e instanceof RegExp)||e.flags!==``)return;let t;try{t=Ve(e)}catch{return}if(t.value.value.length!==1||t.value.value[0].value.length!==1)return;let n=t.value.value[0].value[0],r;for(;n.type===`Group`;){if(n.capturing||n.quantifier!==void 0&&r!==void 0||n.value.value.length!==1||n.value.value[0].value.length!==1)return;r=n.quantifier??r,n=n.value.value[0].value[0]}if(n.type!==`Set`||n.complement||n.quantifier!==void 0&&r!==void 0||(r=n.quantifier??r,r?.atLeast!==1||r.atMost!==1/0||!r.greedy))return;let i=new Uint8Array(128);for(let e of n.value){let t=typeof e==`number`?e:e.from,n=typeof e==`number`?e:e.to;if(t<0||n>=i.length)return;i.fill(1,t,n+1)}return i}function rt(e,t){let n=[],r=at(e);n=n.concat(r.errors);let i=ot(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(it(a)),n=n.concat(mt(a)),n=n.concat(ht(a,t)),n=n.concat(gt(a)),n}function it(e){let t=[],n=e.filter(e=>e[$e]instanceof RegExp);return t=t.concat(ct(n)),t=t.concat(dt(n)),t=t.concat(ft(n)),t=t.concat(pt(n)),t=t.concat(lt(n)),t}function at(e){let t=e.filter(e=>!Object.hasOwn(e,$e));return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:F.MISSING_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}function ot(e){let t=e.filter(e=>{let t=e[$e];return!(t instanceof RegExp)&&typeof t!=`function`&&!Object.hasOwn(t,`exec`)&&typeof t!=`string`});return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.`,type:F.INVALID_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}var st=/[^\\][$]/;function ct(e){class t extends Re{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ve(n),r=new t;return r.visit(e),r.found}catch{return st.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
19
+ Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
20
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:F.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}function lt(e){return e.filter(e=>e.PATTERN.test(``)).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:F.EMPTY_MATCH_PATTERN,tokenTypes:[e]}))}var ut=/[^\\[][\^]|^\^/;function dt(e){class t extends Re{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ve(n),r=new t;return r.visit(e),r.found}catch{return ut.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
21
+ Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
22
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:F.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}function ft(e){return e.filter(e=>{let t=e[$e];return t instanceof RegExp&&(t.multiline||t.global)}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:F.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}))}function pt(e){let t=[],n=e.map(n=>e.reduce((e,r)=>n.PATTERN.source===r.PATTERN.source&&!t.includes(r)&&r.PATTERN!==I.NA?(t.push(r),e.push(r),e):e,[]));return n=n.filter(Boolean),n.filter(e=>e.length>1).map(e=>{let t=e.map(e=>e.name);return{message:`The same RegExp pattern ->${e[0].PATTERN}<-has been used in all of the following Token Types: ${t.join(`, `)} <-`,type:F.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}function mt(e){return e.filter(e=>{if(!Object.hasOwn(e,`GROUP`))return!1;let t=e.GROUP;return t!==I.SKIPPED&&t!==I.NA&&typeof t!=`string`}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:F.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}))}function ht(e,t){return e.filter(e=>e.PUSH_MODE!==void 0&&!t.includes(e.PUSH_MODE)).map(e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:F.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))}function gt(e){let t=[],n=e.reduce((e,t,n)=>{let r=t.PATTERN;return r===I.NA||(typeof r==`string`?e.push({str:r,idx:n,tokenType:t}):r instanceof RegExp&&vt(r)&&e.push({str:r.source,idx:n,tokenType:t})),e},[]);return e.forEach((e,r)=>{n.forEach(({str:n,idx:i,tokenType:a})=>{if(r<i&&_t(n,e.PATTERN)){let n=`Token: ->${a.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:F.UNREACHABLE_PATTERN,tokenTypes:[e,a]})}})}),t}function _t(e,t){if(t instanceof RegExp){if(yt(t))return!1;let n=t.exec(e);return n!==null&&n.index===0}if(typeof t==`function`)return t(e,0,[],{});if(Object.hasOwn(t,`exec`))return t.exec(e,0,[],{});if(typeof t==`string`)return t===e;throw Error(`non exhaustive match`)}function vt(e){return[`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`].find(t=>e.source.indexOf(t)!==-1)===void 0}function yt(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(e.source)}function bt(e){let t=e.ignoreCase?`iy`:`y`;return RegExp(`${e.source}`,t)}function xt(e,t,n){let r=[];return Object.hasOwn(e,`defaultMode`)||r.push({message:`A MultiMode Lexer cannot be initialized without a <defaultMode> property in its definition
23
+ `,type:F.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(e,`modes`)||r.push({message:`A MultiMode Lexer cannot be initialized without a <modes> property in its definition
24
+ `,type:F.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(e,`modes`)&&Object.hasOwn(e,`defaultMode`)&&!Object.hasOwn(e.modes,e.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${et}: <${e.defaultMode}>which does not exist\n`,type:F.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(e,`modes`)&&Object.keys(e.modes).forEach(t=>{let n=e.modes[t];n.forEach((e,i)=>{e===void 0?r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${t}> at index: <${i}>\n`,type:F.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(e,`LONGER_ALT`)&&(Array.isArray(e.LONGER_ALT)?e.LONGER_ALT:[e.LONGER_ALT]).forEach(i=>{i!==void 0&&!n.includes(i)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${e.name}> outside of mode <${t}>\n`,type:F.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),r}function St(e,t,n){let r=[],i=!1,a=Object.values(e.modes||{}).flat().filter(Boolean).filter(e=>e[$e]!==I.NA),o=Ot(n);return t&&a.forEach(e=>{let t=Et(e,o);if(t!==!1){let n={message:Dt(e,t),type:t.issue,tokenType:e};r.push(n)}else Object.hasOwn(e,`LINE_BREAKS`)?e.LINE_BREAKS===!0&&(i=!0):Qe(o,e.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
25
+ This Lexer has been defined to track line and column information,
26
+ But none of the Token Types can be identified as matching a line terminator.
27
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
28
+ for details.`,type:F.NO_LINE_BREAKS_FLAGS}),r}function Ct(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if(typeof t==`function`||Object.hasOwn(t,`exec`))return!0;if(typeof t==`string`)return!1;throw Error(`non exhaustive match`)}function wt(e){return typeof e==`string`&&e.length===1&&e.charCodeAt(0)}var Tt={test:function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let t=e.charCodeAt(n);if(t===10)return this.lastIndex=n+1,!0;if(t===13)return this.lastIndex=e.charCodeAt(n+1)===10?n+2:n+1,!0}return!1},lastIndex:0};function Et(e,t){if(Object.hasOwn(e,`LINE_BREAKS`))return!1;if(e.PATTERN instanceof RegExp){try{Qe(t,e.PATTERN)}catch(e){return{issue:F.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(typeof e.PATTERN==`string`)return!1;if(Ct(e))return{issue:F.CUSTOM_LINE_BREAK};throw Error(`non exhaustive match`)}function Dt(e,t){if(t.issue===F.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
29
+ \tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===F.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
30
+ \tThe problem is in the <${e.name}> Token Type\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}function Ot(e){return e.map(e=>typeof e==`string`?e.charCodeAt(0):e)}function kt(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}var At=[];function P(e){return e<256?e:At[e]}function jt(){if(At.length===0){At=Array(65536);for(let e=0;e<65536;e++)At[e]=e>255?255+~~(e/255):e}}function Mt(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx||t.isParent===!0&&t.categoryMatchesMap[n]===!0}function Nt(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}var Pt=1,Ft={};function It(e){let t=Lt(e);Rt(t),Bt(t),zt(t),t.forEach(e=>{e.isParent=e.categoryMatches.length>0})}function Lt(e){let t=[...e],n=e,r=!0;for(;r;){n=n.map(e=>e.CATEGORIES).flat().filter(Boolean);let e=n.filter(e=>!t.includes(e));t=t.concat(e),e.length===0?r=!1:n=e}return t}function Rt(e){e.forEach(e=>{Ht(e)||(Ft[Pt]=e,e.tokenTypeIdx=Pt++),Ut(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Ut(e)||(e.CATEGORIES=[]),Wt(e)||(e.categoryMatches=[]),Gt(e)||(e.categoryMatchesMap={})})}function zt(e){e.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push(Ft[t].tokenTypeIdx)})})}function Bt(e){e.forEach(e=>{Vt([],e)})}function Vt(e,t){e.forEach(e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),t.CATEGORIES.forEach(n=>{let r=e.concat(t);r.includes(n)||Vt(r,n)})}function Ht(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}function Ut(e){return Object.hasOwn(e??{},`CATEGORIES`)}function Wt(e){return Object.hasOwn(e??{},`categoryMatches`)}function Gt(e){return Object.hasOwn(e??{},`categoryMatchesMap`)}function Kt(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}var qt={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,n,r,i,a){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`}},F;(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`})(F||={});var Jt={deferDefinitionErrorsHandling:!1,positionTracking:`full`,lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
31
+ `,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:qt,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Jt);var I=class{constructor(e,t=Jt){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:r,value:i}=oe(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},typeof t==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
32
+ a boolean 2nd argument is no longer supported`);this.config=Object.assign({},Jt,t);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n==`number`&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT(`Lexer Constructor`,()=>{let n,r=!0;this.TRACE_INIT(`Lexer Config handling`,()=>{if(this.config.lineTerminatorsPattern===Jt.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Tt;else if(this.config.lineTerminatorCharacters===Jt.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
33
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error(`"safeMode" and "ensureOptimizations" flags are mutually exclusive.`);this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?n={modes:{defaultMode:[...e]},defaultMode:et}:(r=!1,n=Object.assign({},e))}),this.config.skipValidations===!1&&(this.TRACE_INIT(`performRuntimeChecks`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(xt(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT(`performWarningRuntimeChecks`,()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(St(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},Object.entries(n.modes).forEach(([e,t])=>{n.modes[e]=t.filter(e=>e!==void 0)});let i=Object.keys(n.modes);if(Object.entries(n.modes).forEach(([e,n])=>{this.TRACE_INIT(`Mode: <${e}> processing`,()=>{if(this.modes.push(e),this.config.skipValidations===!1&&this.TRACE_INIT(`validatePatterns`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(rt(n,i))}),this.lexerDefinitionErrors.length===0){It(n);let r;this.TRACE_INIT(`analyzeTokenTypes`,()=>{r=tt(n,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[e]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[e]=r.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[e]=r.canBeOptimized}})}),this.defaultMode=n.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
34
+ `);throw Error(`Errors detected in definition of Lexer:
35
+ `+e)}this.lexerDefinitionWarning.forEach(e=>{y(e.message)}),this.TRACE_INIT(`Choosing sub-methods implementations`,()=>{if(r&&(this.handleModes=()=>{}),this.trackStartLines===!1&&(this.computeNewColumn=e=>e),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=()=>{}),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT(`Failed Optimization Warnings`,()=>{let e=Object.entries(this.canModeBeOptimized).reduce((e,[t,n])=>(n===!1&&e.push(t),e),[]);if(t.ensureOptimizations&&e.length>0)throw Error(`Lexer Modes: < ${e.join(`, `)} > cannot be optimized.\n Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
36
+ Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT(`clearRegExpParserCache`,()=>{He()}),this.TRACE_INIT(`toFastProperties`,()=>{se(this)})})}tokenize(e,t=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
37
+ `);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
38
+ `+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=e,ee=_.length,v=0,te=0,ne=this.hasCustom?0:Math.floor(e.length/10),re=Array(ne),ie=[],ae=this.trackStartLines?1:void 0,y=this.trackStartLines?1:void 0,oe={};for(let e=0;e<this.cachedGroupKeys.length;e++)oe[this.cachedGroupKeys[e]]=[];let se=this.trackStartLines,ce=this.config.lineTerminatorsPattern,le=0,b=[],x=[],S=[],C=[];Object.freeze(C);let w=!1,T=e=>{if(S.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);ie.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{S.pop();let e=S.at(-1);b=this.patternIdxToConfig[e],x=this.charCodeToPatternIdxToConfig[e],le=b.length;let t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;w=!!(x&&t)}};function E(e){S.push(e),x=this.charCodeToPatternIdxToConfig[e],b=this.patternIdxToConfig[e],le=b.length;let t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;w=!!(x&&t)}E.call(this,t);let D,O=this.config.recoveryEnabled;for(;v<ee;){s=null,u=-1;let t=_.charCodeAt(v),ne;if(w){let e=P(t),n=x[e];ne=n===void 0?C:n}else ne=b;let k=ne.length;for(n=0;n<k;n++){D=ne[n];let r=D.pattern;switch(c=null,D.matchType){case 0:t===D.short&&(u=1,s=r);break;case 1:g=r.exec(_,v,re,oe),g===null?s=null:(s=g[0],u=s.length,g.payload!==void 0&&(c=g.payload));break;case 3:{let e=D.asciiClass;if(e[t]!==1){r.lastIndex=0;break}let n=v+1;for(;e[_.charCodeAt(n)]===1;)n++;u=n-v,r.lastIndex=n;break}case 2:r.lastIndex=v,u=this.matchLength(r,e,v)}if(u!==-1){if(o=D.longerAlt,o!==void 0){s=e.substring(v,v+u);let t=o.length;for(i=0;i<t;i++){let t=b[o[i]],n=t.pattern;if(l=null,t.matchType===1?(g=n.exec(_,v,re,oe),g===null?a=null:(a=g[0],g.payload!==void 0&&(l=g.payload))):(n.lastIndex=v,a=this.match(n,e,v)),a&&a.length>s.length){s=a,u=a.length,c=l,D=t;break}}}break}}if(u!==-1){if(d=D.group,d!==void 0&&(s=s===null?e.substring(v,v+u):s,f=D.tokenTypeIdx,p=this.createTokenInstance(s,v,f,D.tokenType,ae,y,u),this.handlePayload(p,c),d===!1?te=this.addToken(re,te,p):oe[d].push(p)),se===!0&&D.canLineTerminator===!0){let t=0,n,r;ce.lastIndex=0;do s=s===null?e.substring(v,v+u):s,n=ce.test(s),n===!0&&(r=ce.lastIndex-1,t++);while(n===!0);t===0?y=this.computeNewColumn(y,u):(ae+=t,y=u-r,this.updateTokenEndLineColumnLocation(p,d,r,t,ae,y,u))}else y=this.computeNewColumn(y,u);v+=u,this.handleModes(D,T,E,p)}else{let t=v,n=ae,i=y,a=O===!1;for(;a===!1&&v<ee;)for(v++,r=0;r<le;r++){let t=b[r],n=t.pattern;switch(t.matchType){case 0:_.charCodeAt(v)===t.short&&(a=!0);break;case 1:a=n.exec(_,v,re,oe)!==null;break;case 3:case 2:n.lastIndex=v,a=n.exec(e)!==null}if(a===!0)break}if(m=v-t,y=this.computeNewColumn(y,m),h=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(_,t,m,n,i,S.at(-1)),ie.push({offset:t,line:n,column:i,length:m,message:h}),O===!1)break}}return this.hasCustom||(re.length=te),{tokens:re,groups:oe,errors:ie}}handleModes(e,t,n,r){if(e.pop===!0){let i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,n,r,i,a,o){let s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,(r!==1||s!==!0)&&(e.endLine=i+c,e.endColumn=a-1+-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,n){return e.test(t)===!0?t.substring(n,e.lastIndex):null}matchLength(e,t,n){return e.test(t)===!0?e.lastIndex-n:-1}};I.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.`,I.NA=/NOT_APPLICABLE/;function Yt(e){return Xt(e)?e.LABEL:e.name}function Xt(e){return typeof e.LABEL==`string`&&e.LABEL!==``}var Zt=`parent`,Qt=`categories`,$t=`label`,en=`group`,tn=`push_mode`,nn=`pop_mode`,rn=`longer_alt`,an=`line_breaks`,on=`start_chars_hint`;function L(e){return sn(e)}function sn(e){let t=e.pattern,n={};if(n.name=e.name,t!==void 0&&(n.PATTERN=t),Object.hasOwn(e,Zt))throw`The parent property is no longer supported.
39
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(e,Qt)&&(n.CATEGORIES=e[Qt]),It([n]),Object.hasOwn(e,$t)&&(n.LABEL=e[$t]),Object.hasOwn(e,en)&&(n.GROUP=e[en]),Object.hasOwn(e,nn)&&(n.POP_MODE=e[nn]),Object.hasOwn(e,tn)&&(n.PUSH_MODE=e[tn]),Object.hasOwn(e,rn)&&(n.LONGER_ALT=e[rn]),Object.hasOwn(e,an)&&(n.LINE_BREAKS=e[an]),Object.hasOwn(e,on)&&(n.START_CHARS_HINT=e[on]),n}var R=L({name:`EOF`,pattern:I.NA});It([R]);function cn(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function ln(e,t){return Mt(e,t)}var un={buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:r}){return`Expecting ${Xt(e)?`--> ${Yt(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return`Redundant input, expecting EOF but found: `+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let a=`
40
+ but found: '`+t[0].image+`'`;return r?`Expecting: `+r+a:`Expecting: one of these possible Token sequences:\n${e.reduce((e,t)=>e.concat(t),[]).map(e=>`[${e.map(e=>Yt(e)).join(`, `)}]`).map((e,t)=>` ${t+1}. ${e}`).join(`
41
+ `)}`+a},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){let i=`
42
+ but found: '`+t[0].image+`'`;return n?`Expecting: `+n+i:`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::\n <${e.map(e=>`[${e.map(e=>Yt(e)).join(`,`)}]`).join(` ,`)}>`+i}};Object.freeze(un);var dn={buildRuleNotFoundError(e,t){return`Invalid grammar, reference to a rule which is not defined: ->`+t.nonTerminalName+`<-
43
+ inside top level rule: ->`+e.name+`<-`}},fn={buildDuplicateFoundError(e,t){function n(e){return e instanceof A?e.terminalType.name:e instanceof x?e.nonTerminalName:``}let r=e.name,i=t[0],a=i.idx,o=M(i),s=n(i),c=`->${o}${a>0?a:``}<- ${s?`with argument: ->${s}<-`:``}
44
+ appears more than once (${t.length} times) in the top level rule: ->${r}<-.
45
+ For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
46
+ `;return c=c.replace(/[ \t]+/g,` `),c=c.replace(/\s\s+/g,`
47
+ `),c},buildNamespaceConflictError(e){return`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(e){let t=e.prefixPath.map(e=>Yt(e)).join(`, `),n=e.alternation.idx===0?``:e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(` ,`)}> due to common lookahead prefix\nin <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details.`},buildAlternationAmbiguityError(e){let t=e.alternation.idx===0?``:e.alternation.idx,n=e.prefixPath.length===0,r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(` ,`)}> in <OR${t}> inside <${e.topLevelRule.name}> Rule,\n`;if(n)r+=`These alternatives are all empty (match no tokens), making them indistinguishable.
48
+ Only the last alternative may be empty.
49
+ `;else{let t=e.prefixPath.map(e=>Yt(e)).join(`, `);r+=`<${t}> may appears as a prefix path in all these alternatives.\n`}return r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
50
+ For Further details.`,r},buildEmptyRepetitionError(e){let t=M(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError(e){return`deprecated`},buildEmptyAlternationError(e){return`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`},buildTooManyAlternativesError(e){return`An Alternation cannot have more than 256 alternatives:\n<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\n has ${e.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(e){let t=e.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${t}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${`${t} --> ${e.leftRecursionPath.map(e=>e.name).concat([t]).join(` --> `)}`}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return`deprecated`},buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof S?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};function pn(e,t){let n=new mn(e,t);return n.resolveRefs(),n.errors}var mn=class extends fe{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:V.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},hn=class extends ge{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName=``,this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error(`The path does not start with the walker's top Rule!`);return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName=``,this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},gn=class extends hn{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName=``,this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new C({definition:t.concat(n)});this.possibleTokTypes=ve(e),this.found=!0}}},_n=class extends ge{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},vn=class extends _n{walkMany(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof A&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}},yn=class extends _n{walkManySep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof A&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}},bn=class extends _n{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof A&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}},xn=class extends _n{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof A&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}};function Sn(e,t,n=[]){n=[...n];let r=[],i=0;function a(t){return t.concat(e.slice(i+1))}function o(e){let i=Sn(a(e),t,n);return r.concat(i)}for(;n.length<t&&i<e.length;){let t=e[i];if(t instanceof C||t instanceof x)return o(t.definition);if(t instanceof w)r=o(t.definition);else if(t instanceof T)return o(t.definition.concat([new D({definition:t.definition})]));else if(t instanceof E)return o([new C({definition:t.definition}),new D({definition:[new A({terminalType:t.separator})].concat(t.definition)})]);else if(t instanceof O)r=o(t.definition.concat([new D({definition:[new A({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof D)r=o(t.definition.concat([new D({definition:t.definition})]));else if(t instanceof k)return t.definition.forEach(e=>{e.definition.length!==0&&(r=o(e.definition))}),r;else if(t instanceof A)n.push(t.terminalType);else throw Error(`non exhaustive match`);i++}return r.push({partialPath:n,suffixDef:e.slice(i)}),r}function Cn(e,t,n,r){let i=`EXIT_NONE_TERMINAL`,a=[i],o=`EXIT_ALTERNATIVE`,s=!1,c=t.length,l=c-r-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});d.length!==0;){let e=d.pop();if(e===o){s&&d.at(-1).idx<=l&&d.pop();continue}let r=e.def,f=e.idx,p=e.ruleStack,m=e.occurrenceStack;if(r.length===0)continue;let h=r[0];if(h===i){let e={idx:f,def:r.slice(1),ruleStack:p.slice(0,-1),occurrenceStack:m.slice(0,-1)};d.push(e)}else if(h instanceof A){if(f<c-1){let e=f+1,i=t[e];if(n(i,h.terminalType)){let t={idx:e,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(t)}}else if(f===c-1)u.push({nextTokenType:h.terminalType,nextTokenOccurrence:h.idx,ruleStack:p,occurrenceStack:m}),s=!0;else throw Error(`non exhaustive match`)}else if(h instanceof x){let e=[...p];e.push(h.nonTerminalName);let t=[...m];t.push(h.idx);let n={idx:f,def:h.definition.concat(a,r.slice(1)),ruleStack:e,occurrenceStack:t};d.push(n)}else if(h instanceof w){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t={idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof T){let e=new D({definition:h.definition,idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof E){let e=new D({definition:[new A({terminalType:h.separator})].concat(h.definition),idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof O){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new D({definition:[new A({terminalType:h.separator})].concat(h.definition),idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof D){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new D({definition:h.definition,idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof k)for(let e=h.definition.length-1;e>=0;e--){let t={idx:f,def:h.definition[e].definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t),d.push(o)}else if(h instanceof C)d.push({idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m});else if(h instanceof S)d.push(wn(h,f,p,m));else throw Error(`non exhaustive match`)}return u}function wn(e,t,n,r){let i=[...n];i.push(e.name);let a=[...r];return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}var z;(function(e){e[e.OPTION=0]=`OPTION`,e[e.REPETITION=1]=`REPETITION`,e[e.REPETITION_MANDATORY=2]=`REPETITION_MANDATORY`,e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]=`REPETITION_MANDATORY_WITH_SEPARATOR`,e[e.REPETITION_WITH_SEPARATOR=4]=`REPETITION_WITH_SEPARATOR`,e[e.ALTERNATION=5]=`ALTERNATION`})(z||={});function Tn(e){if(e instanceof w||e===`Option`)return z.OPTION;if(e instanceof D||e===`Repetition`)return z.REPETITION;if(e instanceof T||e===`RepetitionMandatory`)return z.REPETITION_MANDATORY;if(e instanceof E||e===`RepetitionMandatoryWithSeparator`)return z.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof O||e===`RepetitionWithSeparator`)return z.REPETITION_WITH_SEPARATOR;if(e instanceof k||e===`Alternation`)return z.ALTERNATION;throw Error(`non exhaustive match`)}function En(e,t,n,r,i,a){let o=In(e,t,n);return a(o,r,Bn(o)?Nt:Mt,i)}function Dn(e,t,n,r,i,a){let o=Ln(e,t,i,n),s=Bn(o)?Nt:Mt;return a(o[0],s,r)}function On(e,t,n,r){let i=e.length,a=e.every(e=>e.every(e=>e.length===1));if(t)return function(t){let r=t.map(e=>e.GATE);for(let t=0;t<i;t++){let i=e[t],a=i.length,o=r[t];if(o===void 0||o.call(this)!==!1)nextPath:for(let e=0;e<a;e++){let r=i[e],a=r.length;for(let e=0;e<a;e++)if(n(this.LA_FAST(e+1),r[e])===!1)continue nextPath;return t}}};if(a&&!r){let t=e.map(e=>e.flat()).reduce((e,t,n)=>(t.forEach(t=>{t.tokenTypeIdx in e||(e[t.tokenTypeIdx]=n),t.categoryMatches.forEach(t=>{Object.hasOwn(e,t)||(e[t]=n)})}),e),{});return function(){let e=this.LA_FAST(1);return t[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){let r=e[t],i=r.length;nextPath:for(let e=0;e<i;e++){let i=r[e],a=i.length;for(let e=0;e<a;e++)if(n(this.LA_FAST(e+1),i[e])===!1)continue nextPath;return t}}}}function kn(e,t,n){let r=e.every(e=>e.length===1),i=e.length;if(r&&!n){let t=e.flat();if(t.length===1&&t[0].categoryMatches.length===0){let e=t[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===e}}{let e=t.reduce((e,t,n)=>(e[t.tokenTypeIdx]=!0,t.categoryMatches.forEach(t=>{e[t]=!0}),e),[]);return function(){let t=this.LA_FAST(1);return e[t.tokenTypeIdx]===!0}}}return function(){nextPath:for(let n=0;n<i;n++){let r=e[n],i=r.length;for(let e=0;e<i;e++)if(t(this.LA_FAST(e+1),r[e])===!1)continue nextPath;return!0}return!1}}var An=class extends ge{constructor(e,t,n){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)}walkOption(e,t,n){this.checkIsTarget(e,z.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,z.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,z.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,z.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,z.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}},jn=class extends fe{constructor(e,t,n){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=n,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,z.OPTION)}visitRepetition(e){this.checkIsTarget(e,z.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,z.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,z.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,z.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,z.ALTERNATION)}};function Mn(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function Nn(e){let t=[``];for(let n=0;n<e.length;n++){let r=e[n],i=[];for(let e=0;e<t.length;e++){let n=t[e];i.push(n+`_`+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){let t=`_`+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function Pn(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;let i=e[r];for(let e=0;e<t.length;e++)if(i[t[e]]===!0)return!1}return!0}function Fn(e,t){let n=e.map(e=>Sn([e],1)),r=Mn(n.length),i=n.map(e=>{let t={};return e.forEach(e=>{Nn(e.partialPath).forEach(e=>{t[e]=!0})}),t}),a=n;for(let e=1;e<=t;e++){let n=a;a=Mn(n.length);for(let o=0;o<n.length;o++){let s=n[o];for(let n=0;n<s.length;n++){let c=s[n].partialPath,l=s[n].suffixDef,u=Nn(c);if(Pn(i,u,o)||l.length===0||c.length===t){let e=r[o];if(Rn(e,c)===!1){e.push(c);for(let e=0;e<u.length;e++){let t=u[e];i[o][t]=!0}}}else{let t=Sn(l,e+1,c);a[o]=a[o].concat(t),t.forEach(e=>{Nn(e.partialPath).forEach(e=>{i[o][e]=!0})})}}}}return r}function In(e,t,n,r){let i=new jn(e,z.ALTERNATION,r);return t.accept(i),Fn(i.result,n)}function Ln(e,t,n,r){let i=new jn(e,n);t.accept(i);let a=i.result,o=new An(t,e,n).startWalking();return Fn([new C({definition:a}),new C({definition:o})],r)}function Rn(e,t){compareOtherPath:for(let n=0;n<e.length;n++){let r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){let n=t[e],i=r[e];if(n!==i&&i.categoryMatchesMap[n.tokenTypeIdx]===void 0)continue compareOtherPath}return!0}}return!1}function zn(e,t){return e.length<t.length&&e.every((e,n)=>{let r=t[n];return e===r||r.categoryMatchesMap[e.tokenTypeIdx]})}function Bn(e){return e.every(e=>e.every(e=>e.every(e=>e.categoryMatches.length===0)))}function Vn(e){return e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}).map(e=>Object.assign({type:V.CUSTOM_LOOKAHEAD_VALIDATION},e))}function Hn(e,t,n,r){let i=e.flatMap(e=>Un(e,n)),a=ar(e,t,n),o=e.flatMap(e=>tr(e,n)),s=e.flatMap(t=>qn(t,e,r,n));return i.concat(a,o,s)}function Un(e,t){let n=new Kn;e.accept(n);let r=n.allProductions,i=Object.groupBy(r,Wn),a=Object.fromEntries(Object.entries(i).filter(([e,t])=>t.length>1));return Object.values(a).map(n=>{let r=n[0],i=t.buildDuplicateFoundError(e,n),a=M(r),o={message:i,type:V.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:r.idx},s=Gn(r);return s&&(o.parameter=s),o})}function Wn(e){return`${M(e)}_#_${e.idx}_#_${Gn(e)}`}function Gn(e){return e instanceof A?e.terminalType.name:e instanceof x?e.nonTerminalName:``}var Kn=class extends fe{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 qn(e,t,n,r){let i=[];if(t.reduce((t,n)=>n.name===e.name?t+1:t,0)>1){let t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:V.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function Jn(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:V.INVALID_RULE_OVERRIDE,ruleName:e})),r}function Yn(e,t,n,r=[]){let i=[],a=Xn(t.definition);if(a.length===0)return[];{let t=e.name;a.includes(e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:V.LEFT_RECURSION,ruleName:t});let o=r.concat([e]),s=a.filter(e=>!o.includes(e)).flatMap(t=>{let i=[...r];return i.push(t),Yn(e,t,n,i)});return i.concat(s)}}function Xn(e){let t=[];if(e.length===0)return t;let n=e[0];if(n instanceof x)t.push(n.referencedRule);else if(n instanceof C||n instanceof w||n instanceof T||n instanceof E||n instanceof O||n instanceof D)t=t.concat(Xn(n.definition));else if(n instanceof k)t=n.definition.map(e=>Xn(e.definition)).flat();else if(!(n instanceof A))throw Error(`non exhaustive match`);let r=me(n),i=e.length>1;if(r&&i){let n=e.slice(1);return t.concat(Xn(n))}return t}var Zn=class extends fe{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Qn(e,t){let n=new Zn;return e.accept(n),n.alternations.flatMap(n=>n.definition.slice(0,-1).flatMap((r,i)=>Cn([r],[],Mt,1).length===0?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:V.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]))}function $n(e,t,n){let r=new Zn;e.accept(r);let i=r.alternations;return i=i.filter(e=>e.ignoreAmbiguities!==!0),i.flatMap(r=>{let i=r.idx,a=In(i,e,r.maxLookahead||t,r),o=rr(a,r,e,n),s=ir(a,r,e,n);return o.concat(s)})}var er=class extends fe{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 tr(e,t){let n=new Zn;return e.accept(n),n.alternations.flatMap(n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:V.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[])}function nr(e,t,n){let r=[];return e.forEach(e=>{let i=new er;e.accept(i),i.allProductions.forEach(i=>{let a=Tn(i),o=i.maxLookahead||t,s=i.idx;if(Ln(s,e,a,o)[0].flat().length===0){let t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:V.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),r}function rr(e,t,n,r){let i=[];return e.reduce((n,r,a)=>(t.definition[a].ignoreAmbiguities===!0||r.forEach(r=>{let o=[a];e.forEach((e,n)=>{a!==n&&Rn(e,r)&&t.definition[n].ignoreAmbiguities!==!0&&o.push(n)}),o.length>1&&!Rn(i,r)&&(i.push(r),n.push({alts:o,path:r}))}),n),[]).map(e=>{let i=e.alts.map(e=>e+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:V.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}})}function ir(e,t,n,r){let i=e.reduce((e,t,n)=>{let r=t.map(e=>({idx:n,path:e}));return e.concat(r)},[]);return i.flatMap(e=>{if(t.definition[e.idx].ignoreAmbiguities===!0)return[];let a=e.idx,o=e.path;return i.filter(e=>t.definition[e.idx].ignoreAmbiguities!==!0&&e.idx<a&&zn(e.path,o)).map(e=>{let i=[e.idx+1,a+1],o=t.idx===0?``:t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:V.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:o,alternatives:i}})})}function ar(e,t,n){let r=[],i=t.map(e=>e.name);return e.forEach(e=>{let t=e.name;if(i.includes(t)){let i=n.buildNamespaceConflictError(e);r.push({message:i,type:V.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),r}function or(e){let t=Object.assign({errMsgProvider:dn},e),n={};return e.rules.forEach(e=>{n[e.name]=e}),pn(n,t.errMsgProvider)}function sr(e){let t=e.errMsgProvider??fn;return Hn(e.rules,e.tokenTypes,t,e.grammarName)}var cr=`MismatchedTokenException`,lr=`NoViableAltException`,ur=`EarlyExitException`,dr=`NotAllInputParsedException`,fr=[cr,lr,ur,dr];Object.freeze(fr);function pr(e){return fr.includes(e.name)}var mr=class extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},hr=class extends mr{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=cr}},gr=class extends mr{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=lr}},_r=class extends mr{constructor(e,t){super(e,t),this.name=dr}},vr=class extends mr{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=ur}},yr={},br=`InRuleRecoveryException`,xr=class extends Error{constructor(e){super(e),this.name=br}},Sr=class{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,`recoveryEnabled`)?e.recoveryEnabled:B.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Cr)}getTokenToInsert(e){let t=cn(e,``,-1,-1,-1,-1,-1,-1);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,r){let i=this.findReSyncTokenType(),a=this.exportLexerState(),o=[],s=!1,c=this.LA_FAST(1),l=this.LA_FAST(1),u=()=>{let e=this.LA(0),t=new hr(this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:e,ruleName:this.getCurrRuleFullName()}),c,this.LA(0));t.resyncedTokens=o.slice(0,-1),this.SAVE_ERROR(t)};for(;!s;)if(this.tokenMatcher(l,r)){u();return}else if(n.call(this)){u(),e.apply(this,t);return}else this.tokenMatcher(l,i)?s=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,n){return!(n===!1||this.tokenMatcher(this.LA_FAST(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getNextPossibleTokenTypes(e){let t=e.ruleStack[0],n=this.getGAstProductions()[t];return new gn(n,e).startWalking()}getFollowsForInRuleRecovery(e,t){let n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new xr(`sad sad panda`)}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||t.length===0)return!1;let n=this.LA_FAST(1);return t.find(e=>this.tokenMatcher(n,e))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(t).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA_FAST(1),n=2;for(;;){let r=e.find(e=>ln(t,e));if(r!==void 0)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return yr;let e=this.currRuleShortName,t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK,n=this.RULE_STACK_IDX+1,r=Array(n);for(let i=0;i<n;i++)i===0?r[i]=yr:r[i]={ruleName:this.shortRuleNameToFullName(e[i]),idxInCallingRule:t[i],inRule:this.shortRuleNameToFullName(e[i-1])};return r}flattenFollowSet(){return this.buildFullFollowKeyStack().map(e=>this.getFollowSetFromFollowKey(e)).flat()}getFollowSetFromFollowKey(e){if(e===yr)return[R];let t=e.ruleName+e.idxInCallingRule+Se+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,R)||t.push(e),t}reSyncTo(e){let t=[],n=this.LA_FAST(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return t.slice(0,-1)}attemptInRepetitionRecovery(e,t,n,r,i,a,o){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,t=Array(e);for(let n=0;n<e;n++)t[n]=this.shortRuleNameToFullName(this.RULE_STACK[n]);return t}};function Cr(e,t,n,r,i,a,o){var s,c;let l=r|i,u=(s=this.firstAfterRepMap)[c=this.currRuleShortName]??(s[c]=[]),d=u[l];if(d===void 0){let e=this.getCurrRuleFullName(),t=this.getGAstProductions()[e];d=new a(t,i).startWalking(),u[l]=d}let f=d.token,p=d.occurrence,m=d.isEndOfRule;this.RULE_STACK_IDX===0&&m&&f===void 0&&(f=R,p=1),f!==void 0&&p!==void 0&&this.shouldInRepetitionRecoveryBeTried(f,p,o)&&this.tryInRepetitionRecovery(e,t,n,f)}var wr=1024,Tr=1280,Er=1536,Dr=class{constructor(e){this.maxLookahead=e?.maxLookahead??B.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(t.length===0){let n=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...r,...i]}return t}validateNoLeftRecursion(e){return e.flatMap(e=>Yn(e,e,fn))}validateEmptyOrAlternatives(e){return e.flatMap(e=>Qn(e,fn))}validateAmbiguousAlternationAlternatives(e,t){return e.flatMap(e=>$n(e,t,fn))}validateSomeNonEmptyLookaheadPath(e,t){return nr(e,t,fn)}buildLookaheadForAlternation(e){return En(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,On)}buildLookaheadForOptional(e){return Dn(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Tn(e.prodType),kn)}},Or=class{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,`dynamicTokensEnabled`)?e.dynamicTokensEnabled:B.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,`maxLookahead`)?e.maxLookahead:B.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,`lookaheadStrategy`)?e.lookaheadStrategy:new Dr({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{let{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:o}=Ar(e);t.forEach(t=>{let n=t.idx===0?``:t.idx;this.TRACE_INIT(`${M(t)}${n}`,()=>{let n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[e.name],256|t.idx,n)})}),n.forEach(t=>{this.computeLookaheadFunc(e,t.idx,768,`Repetition`,t.maxLookahead,M(t))}),r.forEach(t=>{this.computeLookaheadFunc(e,t.idx,512,`Option`,t.maxLookahead,M(t))}),i.forEach(t=>{this.computeLookaheadFunc(e,t.idx,wr,`RepetitionMandatory`,t.maxLookahead,M(t))}),a.forEach(t=>{this.computeLookaheadFunc(e,t.idx,Er,`RepetitionMandatoryWithSeparator`,t.maxLookahead,M(t))}),o.forEach(t=>{this.computeLookaheadFunc(e,t.idx,Tr,`RepetitionWithSeparator`,t.maxLookahead,M(t))})})})}computeLookaheadFunc(e,t,n,r,i,a){this.TRACE_INIT(`${a}${t===0?``:t}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r});this.setLaFuncCache(this.fullRuleNameToShort[e.name],n|t,a)})}setLaFuncCache(e,t,n){let r=this.lookAheadFuncsCache[e];r===void 0&&(r=[],this.lookAheadFuncsCache[e]=r),r[t]=n}},kr=new class extends fe{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}};function Ar(e){kr.reset(),e.accept(kr);let t=kr.dslMethods;return kr.reset(),t}function jr(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset)}function Mr(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function Nr(e,t,n){e.children[n]===void 0?e.children[n]=[t]:e.children[n].push(t)}function Pr(e,t,n){e.children[t]===void 0?e.children[t]=[n]:e.children[t].push(n)}var Fr=`name`;function Ir(e,t){Object.defineProperty(e,Fr,{enumerable:!1,configurable:!0,writable:!1,value:t})}function Lr(e,t){let n=Object.keys(e),r=n.length;for(let i=0;i<r;i++){let r=e[n[i]],a=r.length;for(let e=0;e<a;e++){let n=r[e];n.tokenTypeIdx===void 0&&this[n.name](n.children,t)}}}function Rr(e,t){let n=function(){};return Ir(n,e+`BaseSemantics`),n.prototype={visit:function(e,t){if(Array.isArray(e)&&(e=e[0]),e!==void 0)return this[e.name](e.children,t)},validateVisitor:function(){let e=Vr(this,t);if(e.length!==0){let t=e.map(e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join(`
51
+
52
+ `).replace(/\n/g,`
53
+ `)}`)}}},n.prototype.constructor=n,n._RULE_NAMES=t,n}function zr(e,t,n){let r=function(){};Ir(r,e+`BaseSemanticsWithDefaults`);let i=Object.create(n.prototype);return t.forEach(e=>{i[e]=Lr}),r.prototype=i,r.prototype.constructor=r,r}var Br;(function(e){e[e.REDUNDANT_METHOD=0]=`REDUNDANT_METHOD`,e[e.MISSING_METHOD=1]=`MISSING_METHOD`})(Br||={});function Vr(e,t){return Hr(e,t)}function Hr(e,t){return t.filter(t=>typeof e[t]!=`function`).map(t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:Br.MISSING_METHOD,methodName:t})).filter(Boolean)}var Ur=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,`nodeLocationTracking`)?e.nodeLocationTracking:B.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{};else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Mr,this.setNodeLocationFromNode=Mr,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=jr,this.setNodeLocationFromNode=jr,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(e){let t=this.LA_FAST(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=-1,n.startLine=-1,n.startColumn=-1)}cstPostRuleOnlyOffset(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=-1}cstPostTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];Nr(n,t,e),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];Pr(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}get currCSTNode(){let e=this;return e.CST_STACK[e.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let e=Rr(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let e=zr(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}},Wr=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error(`Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.`);this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):si}LA_FAST(e){let t=this.currIdx+e;return this.tokVector[t]}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?si:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}},Gr=class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,n=ci){if(this.definedRulesNames.includes(e)){let t={message:fn.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:V.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=ci){let r=Jn(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);let i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){let n=e.coreRule??e;return function(){this.isBackTrackingStack.push(1);let e=this.saveRecogState();try{return n.apply(this,t),!0}catch(e){if(pr(e))return!1;throw e}finally{this.reloadRecogState(e),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return ue(Object.values(this.gastProductionsCache))}},Kr=class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=Nt,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(t,`serializedGrammar`))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
54
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
55
+ For Further details.`);if(Array.isArray(e)){if(e.length===0)throw Error(`A Token Vocabulary cannot be empty.
56
+ Note that the first argument for the parser constructor
57
+ 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.
58
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
59
+ For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((e,t)=>(e[t.name]=t,e),{});else if(Object.hasOwn(e,`modes`)&&Object.values(e.modes).flat().every(Kt)){let t=Object.values(e.modes).flat(),n=[...new Set(t)];this.tokensMap=n.reduce((e,t)=>(e[t.name]=t,e),{})}else if(typeof e==`object`&&e)this.tokensMap=Object.assign({},e);else throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap.EOF=R;let n=(Object.hasOwn(e,`modes`)?Object.values(e.modes).flat():Object.values(e)).every(e=>e.categoryMatches?.length==0);this.tokenMatcher=n?Nt:Mt,It(Object.values(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let r=Object.hasOwn(n,`resyncEnabled`)?n.resyncEnabled:ci.resyncEnabled,i=Object.hasOwn(n,`recoveryValueFunc`)?n.recoveryValueFunc:ci.recoveryValueFunc,a=this.ruleShortNameIdx++;this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return o=this.outputCst===!0?function(...n){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);let r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...t){this.onBeforeParse(e);try{return o.apply(this,t)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:o})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK_IDX===0,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(pr(e)){let t=e;if(i){let r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){let n=512|t;return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r=this.currRuleLookaheadFuncs[n],i;if(typeof e!=`function`){i=e.DEF;let t=e.GATE;if(t!==void 0){let e=r;r=()=>t.call(this)&&e.call(this)}}else i=e;if(r.call(this)===!0)return i.call(this)}atLeastOneInternal(e,t){let n=wr|e;return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r=this.currRuleLookaheadFuncs[n],i;if(typeof t!=`function`){i=t.DEF;let e=t.GATE;if(e!==void 0){let t=r;r=()=>e.call(this)&&t.call(this)}}else i=t;if(r.call(this)===!0){let e=this.doSingleRepetition(i);for(;r.call(this)===!0&&e===!0;)e=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,z.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],r,wr,e,bn)}atLeastOneSepFirstInternal(e,t){let n=Er|e;this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(this.currRuleLookaheadFuncs[n].call(this)===!0){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;this.tokenMatcher(this.LA_FAST(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,xn],t,Er,e,xn)}else throw this.raiseEarlyExitException(e,z.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let n=768|e;return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r=this.currRuleLookaheadFuncs[n],i;if(typeof t!=`function`){i=t.DEF;let e=t.GATE;if(e!==void 0){let t=r;r=()=>e.call(this)&&t.call(this)}}else i=t;let a=!0;for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],r,768,e,vn,a)}manySepFirstInternal(e,t){let n=Tr|e;this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(this.currRuleLookaheadFuncs[n].call(this)===!0){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;this.tokenMatcher(this.LA_FAST(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,yn],t,Tr,e,yn)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,Er,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=256|t,r=Array.isArray(e)?e:e.DEF,i=this.currRuleLookaheadFuncs[n].call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,n){let r;try{let i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.coreRule.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw pr(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{let t=this.LA_FAST(1);this.tokenMatcher(t,e)===!0?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r,i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new hr(r,t,i))}consumeInternalRecovery(e,t,n){if(this.recoveryEnabled&&n.name===`MismatchedTokenException`&&!this.isBackTracking()){let r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===`InRuleRecoveryException`?n:e}}throw n}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let e=0;e<t.length;e++)this.RULE_STACK[e]=t[e];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=n,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),R)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let e=0;e<this.maxLookahead+1;e++)this.tokVector.push(si)}onAfterParse(e){if(this.isAtEndOfInput()===!1){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new _r(t,e))}for(;this.tokVector.at(-1)===si;)this.tokVector.pop()}},qr=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,`errorMessageProvider`)?e.errorMessageProvider:B.errorMessageProvider}SAVE_ERROR(e){if(pr(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],a=Ln(e,i,t,this.maxLookahead)[0],o=[];for(let e=1;e<=this.maxLookahead;e++)o.push(this.LA(e));let s=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new vr(s,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),r=this.getGAstProductions()[n],i=In(e,r,this.maxLookahead),a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let o=this.LA(0),s=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:a,previous:o,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new gr(s,this.LA(1),o))}},Jr={description:`This Object indicates the Parser is during Recording Phase`};Object.freeze(Jr);var Yr=!0,Xr=255,Zr=L({name:`RECORDING_PHASE_TOKEN`,pattern:I.NA});It([Zr]);var Qr=cn(Zr,`This IToken indicates the Parser is in Recording Phase
60
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Qr);var $r={name:`This CSTNode indicates the Parser is in Recording Phase
61
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},ei=class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT(`Enable Recording`,()=>{for(let e=0;e<10;e++){let t=e>0?e:``;this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT(`Deleting Recording methods`,()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:``;delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return si}topLevelRuleRecord(e,t){try{let n=new S({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(e.KNOWN_RECORDER_ERROR!==!0)try{e.message+=`
62
+ This error was thrown during the "grammar recording phase" For more info see:
63
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return ti.call(this,w,e,t)}atLeastOneInternalRecord(e,t){ti.call(this,T,t,e)}atLeastOneSepFirstInternalRecord(e,t){ti.call(this,E,t,e,Yr)}manyInternalRecord(e,t){ti.call(this,D,t,e)}manySepFirstInternalRecord(e,t){ti.call(this,O,t,e,Yr)}orInternalRecord(e,t){return ni.call(this,e,t)}subruleInternalRecord(e,t,n){if(ii(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${ri(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=e.ruleName,a=new x({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?$r:Jr}consumeInternalRecord(e,t,n){if(ii(t),!Ht(e)){let n=Error(`<CONSUME${ri(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=new A({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),Qr}};function ti(e,t,n,r=!1){ii(n);let i=this.recordingProdStack.at(-1),a=typeof t==`function`?t:t.DEF,o=new e({definition:[],idx:n});return r&&(o.separator=t.SEP),Object.hasOwn(t,`MAX_LOOKAHEAD`)&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),a.call(this),i.definition.push(o),this.recordingProdStack.pop(),Jr}function ni(e,t){ii(t);let n=this.recordingProdStack.at(-1),r=Array.isArray(e)===!1,i=r===!1?e:e.DEF,a=new k({definition:[],idx:t,ignoreAmbiguities:r&&e.IGNORE_AMBIGUITIES===!0});return Object.hasOwn(e,`MAX_LOOKAHEAD`)&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=i.some(e=>typeof e.GATE==`function`),n.definition.push(a),i.forEach(e=>{let t=new C({definition:[]});a.definition.push(t),Object.hasOwn(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Object.hasOwn(e,`GATE`)&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),Jr}function ri(e){return e===0?``:`${e}`}function ii(e){if(e<0||e>Xr){let t=Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than 256`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var ai=class{initPerformanceTracer(e){if(Object.hasOwn(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=B.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:r,value:i}=oe(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}};function oi(e,t){t.forEach(t=>{let n=t.prototype;Object.getOwnPropertyNames(n).forEach(r=>{if(r===`constructor`)return;let i=Object.getOwnPropertyDescriptor(n,r);i&&(i.get||i.set)?Object.defineProperty(e.prototype,r,i):e.prototype[r]=t.prototype[r]})})}var si=cn(R,``,-1,-1,-1,-1,-1,-1);Object.freeze(si);var B=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:un,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),ci=Object.freeze({recoveryValueFunc:()=>void 0,resyncEnabled:!0}),V;(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`})(V||={});var li=class e{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT(`performSelfAnalysis`,()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT(`toFastProps`,()=>{se(this)}),this.TRACE_INIT(`Grammar Recording`,()=>{try{this.enableRecording(),this.definedRulesNames.forEach(e=>{let t=this[e].originalGrammarAction,n;this.TRACE_INIT(`${e} Rule`,()=>{n=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=n})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT(`Grammar Resolving`,()=>{r=or({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT(`Grammar Validations`,()=>{if(r.length===0&&this.skipValidations===!1){let e=sr({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:fn,grammarName:n}),t=Vn({lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(e,t)}}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT(`computeAllProdsFollows`,()=>{let e=we(Object.values(this.gastProductionsCache));this.resyncFollows=e}),this.TRACE_INIT(`ComputeLookaheadFunctions`,()=>{var e,t;(t=(e=this.lookaheadStrategy).initialize)==null||t.call(e,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw t=this.definitionErrors.map(e=>e.message),Error(`Parser Definition Errors detected:\n ${t.join(`
64
+ -------------------------------
65
+ `)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initGastRecorder(t),n.initPerformanceTracer(t),Object.hasOwn(t,`ignoredIssues`))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
66
+ Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
67
+ See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
68
+ For further details.`);this.skipValidations=Object.hasOwn(t,`skipValidations`)?t.skipValidations:B.skipValidations}};li.DEFER_DEFINITION_ERRORS_HANDLING=!1,oi(li,[Sr,Or,Ur,Wr,Kr,Gr,qr,ei,ai]);var ui=class extends li{constructor(e,t=B){let n=Object.assign({},t);n.outputCst=!0,super(e,n)}},di=e(e=>e!==void 0&&e>=0,`isKnownLocation`);function fi(e,t){let n=e.lexer.tokenize(t);if(n.errors.length>0){let r=n.errors[0],i=di(r.offset)?r.offset:t.length,a=i+(di(r.length)?r.length:0);throw Error(`Error lexing ${e.diagramType} diagram: ${r.message} at line ${r.line??1}, column ${r.column??1} [${i},${a})`)}e.parser.input=n.tokens;let r=e.entry();if(e.parser.errors.length>0)throw Error(`Error parsing ${e.diagramType} diagram: ${e.parser.errors[0].message}`);e.visit(r)}e(fi,`runChevrotainParse`);var H={SOLID_ARROW:0,BACK_ARROW:1,LINE_SOLID:2,CIRCLE_ARROW:3,CROSS_ARROW:4,CIRCLE_ARROW_REVERSED:5,CROSS_ARROW_REVERSED:6},pi=`LR`,mi=l.usecase,hi=e(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:pi,relationshipCounter:0,noteCounter:0,accTitle:``,accDescription:``,ast:void 0,config:structuredClone(mi)}),`createModel`),gi=e(e=>{if(!(e.actors instanceof Map)||!(e.useCases instanceof Map)||!(e.systemBoundaries instanceof Map)||!Array.isArray(e.relationships)||!(e.notes instanceof Map)||!(e.jsonNodes instanceof Map)||!(e.classDefs instanceof Map)||!(e.symbols instanceof Map)||![`TB`,`TD`,`BT`,`RL`,`LR`].includes(e.direction)||!Number.isSafeInteger(e.relationshipCounter)||e.relationshipCounter<0||!Number.isSafeInteger(e.noteCounter)||e.noteCounter<0||typeof e.accTitle!=`string`||typeof e.accDescription!=`string`||!e.config)throw Error(`Cannot commit an incomplete usecase model`)},`assertCompleteModel`),U=hi(),_i=e(()=>structuredClone(U.config),`getConfig`),vi=e(()=>U.ast,`getAST`),yi=e(e=>{let t=structuredClone(e);gi(t);let n=d(),r=o();try{a(t.accTitle),i(t.accDescription),U=t}catch(e){throw a(n),i(r),e}},`commit`),bi=e(()=>{U=hi(),s()},`clear`),xi=e(()=>U.actors,`getActors`),Si=e(e=>U.actors.get(e),`getActor`),Ci=e(()=>U.useCases,`getUseCases`),wi=e(e=>U.useCases.get(e),`getUseCase`),Ti=e(()=>U.systemBoundaries,`getSystemBoundaries`),Ei=e(e=>U.systemBoundaries.get(e),`getSystemBoundary`),Di=e(()=>U.relationships,`getRelationships`),Oi=e(()=>U.notes,`getNotes`),ki=e(e=>U.notes.get(e),`getNote`),Ai=e(()=>U.jsonNodes,`getJsonNodes`),ji=e(e=>U.jsonNodes.get(e),`getJsonNode`),Mi=e(()=>U.classDefs,`getClassDefs`),Ni=e(e=>U.classDefs.get(e),`getClassDef`),Pi=e(()=>U.direction,`getDirection`),Fi=e(e=>{let t=new Map;for(let n of[`default`,...e]){let e=U.classDefs.get(n);if(e)for(let n of e.styles){let e=n.trim(),r=e.indexOf(`:`),i=(r===-1?e:e.slice(0,r)).trim();i&&t.set(i,e)}}return[...t.values()]},`getCompiledStyles`),Ii=e(e=>e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`),`escapeJsonPointerPart`),Li=e(e=>typeof e==`string`?e:e===null?`null`:String(e),`displayJsonScalar`),Ri=e((t,n,r=e=>e)=>{let i=[],a=e((e,t,n)=>{i.push({key:r(e),accessibleKey:r(t),value:r(n)})},`append`),o=e((e,t,r)=>{if(Array.isArray(e)){if(e.length===0){a(t,t,`[]`);return}if(e.every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))){for(let[n,r]of e.entries())a(n===0?t:``,t,Li(r));return}for(let[n,i]of e.entries())o(i,`${t}[${n}]`,`${r}/${n}`);return}if(typeof e==`object`&&e){let i=e,s=n[r]??Object.keys(i);if(s.length===0){a(t,t,`{}`);return}for(let e of s){let n=t?`${t}.${e}`:e;o(i[e],n,`${r}/${Ii(e)}`)}return}a(t,t,Li(e))},`visit`);return o(t,``,``),i},`flattenJsonRows`),zi=e(e=>{switch(e.type){case`hollow`:return`usecaseActorHollow`;case`awesome`:return`usecaseActorAwesome`;case`icon`:return`usecaseActorIcon`;case`normal`:return`usecaseActor`}},`actorShape`),Bi=e(e=>e.shape===`ellipse`?e.business?`usecaseBusiness`:`usecaseEllipse`:e.shape,`useCaseShape`),Vi=e(e=>{switch(e){case H.SOLID_ARROW:return{arrowTypeStart:`none`,arrowTypeEnd:`arrow_point`};case H.BACK_ARROW:return{arrowTypeStart:`arrow_point`,arrowTypeEnd:`none`};case H.CIRCLE_ARROW:return{arrowTypeStart:`none`,arrowTypeEnd:`arrow_circle`};case H.CROSS_ARROW:return{arrowTypeStart:`none`,arrowTypeEnd:`arrow_cross`};case H.CIRCLE_ARROW_REVERSED:return{arrowTypeStart:`arrow_circle`,arrowTypeEnd:`none`};case H.CROSS_ARROW_REVERSED:return{arrowTypeStart:`arrow_cross`,arrowTypeEnd:`none`};case H.LINE_SOLID:return{arrowTypeStart:`none`,arrowTypeEnd:`none`}}},`associationMarkers`),Hi=e(e=>{switch(e.type){case`include`:case`extend`:return{arrowTypeStart:`none`,arrowTypeEnd:`arrow_point`,pattern:`dotted`,label:e.type,labelType:`text`};case`generalization`:return{arrowTypeStart:`none`,arrowTypeEnd:`extension`,pattern:`solid`};case`association`:return{...Vi(e.arrowType),pattern:`solid`,...e.label?{label:e.label}:{},...e.labelType?{labelType:e.labelType}:{}}}},`relationshipVisuals`),Ui=e(e=>e.animate||e.animation?[`edge-animation-${e.animation??`fast`}`]:[],`animationClasses`),Wi=e((...e)=>e.filter(e=>!!e).join(` `),`classNames`),Gi={getConfig:_i,createModel:hi,commit:yi,getAST:vi,clear:bi,setDiagramTitle:u,getDiagramTitle:r,setAccTitle:a,getAccTitle:d,setAccDescription:i,getAccDescription:o,getActors:xi,getActor:Si,getUseCases:Ci,getUseCase:wi,getSystemBoundaries:Ti,getSystemBoundary:Ei,getRelationships:Di,getNotes:Oi,getNote:ki,getJsonNodes:Ai,getJsonNode:ji,getClassDefs:Mi,getClassDef:Ni,getDirection:Pi,getData:e(()=>{let t=c(),n={...U.config,...t.usecase},r=e(e=>p(e,t),`sanitize`),i=e(e=>r(U.actors.get(e)?.label??U.useCases.get(e)?.label??U.jsonNodes.get(e)?.id??U.notes.get(e)?.label??e),`endpointLabel`),a=[],o=[],s=0,l=0;for(let e of U.actors.values())a.push({id:e.id,label:r(e.label),labelType:e.labelType,shape:zi(e),isGroup:!1,padding:10,look:t.look,colorIndex:s++,cssClasses:Wi(`default`,`usecase-actor`,`usecase-actor-${e.type}`,e.business&&`usecase-business`,...e.classes),cssStyles:[...e.styles],cssCompiledStyles:Fi(e.classes),actorType:e.type,business:e.business,...e.icon?{icon:e.icon}:{},...e.stereotype?{stereotype:r(e.stereotype)}:{},...e.parentId?{parentId:e.parentId}:{}});for(let e of U.useCases.values())a.push({id:e.id,label:r(e.label),labelType:e.labelType,shape:Bi(e),isGroup:!1,padding:e.shape===`ellipse`?20:10,look:t.look,colorIndex:s++,cssClasses:Wi(`default`,`usecase-element`,`usecase-${e.shape}`,e.business&&`usecase-business`,...e.classes),cssStyles:[...e.styles],cssCompiledStyles:Fi(e.classes),business:e.business,...e.stereotype?{stereotype:r(e.stereotype)}:{},...e.parentId?{parentId:e.parentId}:{}});for(let e of U.notes.values())a.push({id:e.id,label:r(e.label),labelType:e.labelType,shape:`note`,isGroup:!1,padding:10,look:t.look,cssClasses:`default usecase-note`,cssStyles:[],cssCompiledStyles:Fi([]),noteTarget:e.target,noteTargetLabel:r(U.actors.get(e.target)?.label??U.useCases.get(e.target)?.label??U.jsonNodes.get(e.target)?.id??e.target)});for(let e of U.jsonNodes.values())a.push({id:e.id,label:r(e.id),labelType:`text`,shape:`usecaseJsonTable`,isGroup:!1,padding:10,look:t.look,cssClasses:Wi(`default`,`usecase-json-table`,...e.classes),cssStyles:[...e.styles],cssCompiledStyles:Fi(e.classes),jsonRows:Ri(e.value,e.propertyOrder,r)});for(let e of U.systemBoundaries.values())a.push({id:e.id,label:r(e.label),labelType:e.labelType,shape:`usecaseSystemBoundary`,isGroup:!0,padding:20,look:t.look,colorIndex:l++,cssClasses:Wi(`default`,`system-boundary`,`system-boundary-${e.type}`,...e.classes),cssStyles:[...e.styles],cssCompiledStyles:Fi(e.classes),boundaryType:e.type});for(let e of U.relationships){let{label:n,...a}=Hi(e);o.push({id:e.id,start:e.source,end:e.target,source:e.source,target:e.target,sourceLabel:i(e.source),targetLabel:i(e.target),type:`edge`,relationshipType:e.type,internal:!1,...a,...n===void 0?{}:{label:r(n)},labelpos:`c`,classes:Wi(`default`,`relationship`,`relationship-${e.type}`,...e.classes,...Ui(e)),style:[...e.styles],cssCompiledStyles:Fi(e.classes),animate:e.animate,...e.animation?{animation:e.animation}:{},look:t.look,thickness:`normal`,minlen:e.minlen,isUserDefinedId:e.explicitId})}for(let e of U.notes.values())o.push({id:`${e.id}-edge`,start:e.id,end:e.target,source:e.id,target:e.target,type:`edge`,relationshipType:`note`,sourceLabel:i(e.id),targetLabel:i(e.target),internal:!0,pattern:`dotted`,arrowTypeStart:`none`,arrowTypeEnd:`none`,labelpos:`c`,classes:`default relationship relationship-note`,style:[],cssCompiledStyles:Fi([]),animate:!1,look:t.look,thickness:`normal`,minlen:1,isUserDefinedId:!1});for(let e of a)e.wrappingWidth??=n.wrappingWidth,!e.isGroup&&!e.shape.startsWith(`usecaseActor`)&&(e.minWidth??=n.minNodeWidth),(e.shape===`usecaseEllipse`||e.shape===`usecaseBusiness`)&&(e.spreadPorts=!0);return{nodes:a,edges:o,config:t,type:`usecase`,layoutAlgorithm:`dagre`,direction:Pi(),nodeSpacing:n.nodeSpacing,rankSpacing:n.rankSpacing,actorFontSize:n.actorFontSize,actorFontFamily:n.actorFontFamily,actorFontWeight:n.actorFontWeight,usecaseFontSize:n.usecaseFontSize,usecaseFontFamily:n.usecaseFontFamily,usecaseFontWeight:n.usecaseFontWeight,diagramPadding:n.diagramPadding,useMaxWidth:n.useMaxWidth,markers:[`point`,`circle`,`cross`,`extension`]}},`getData`)};function Ki(e,t,n){let r=[n];return r.index=t,r.input=e,r}e(Ki,`customMatch`);var qi=e((e,t)=>{if(e[t]!==`"`||e[t+1]!=="`")return null;for(let n=t+2;n<e.length-1;n++)if(e[n]==="`"&&e[n+1]===`"`)return Ki(e,t,e.slice(t,n+2));return null},`matchMarkdownString`),Ji=e((e,t)=>{if(e[t]!==`%`||e[t+1]!==`%`)return null;for(let n=t-1;n>=0;n--){let t=e[n];if(t===`
69
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return null}let n=t+2;for(;n<e.length&&e[n]!==`
70
+ `&&e[n]!==`\r`;)n++;return Ki(e,t,e.slice(t,n))},`matchComment`),Yi=e((e,t)=>{for(let n=t-1;n>=0;n--){let t=e[n];if(t===`
71
+ `||t===`\r`)return!0;if(t!==` `&&t!==` `)return!1}return!0},`isIndentedLineStart`),Xi=e((e,t,n)=>{if(!Yi(e,t))return null;let r=n.exec(e.slice(t));return r?Ki(e,t,r[0]):null},`matchAccessibilityLine`),Zi=e((e,t)=>{if(!Yi(e,t))return null;let n=/^accDescr[\t ]*{/.exec(e.slice(t));if(!n)return null;let r=e.indexOf(`}`,t+n[0].length);return r===-1?null:Ki(e,t,e.slice(t,r+1))},`matchAccDescrBlock`),Qi=e((e,t)=>{if(e[t]!==`{`)return null;let n=0,r=!1,i=!1;for(let a=t;a<e.length;a++){let o=e[a];if(r){i?i=!1:o===`\\`?i=!0:o===`"`&&(r=!1);continue}if(o===`"`)r=!0;else if(o===`{`)n++;else if(o===`}`&&--n===0)return Ki(e,t,e.slice(t,a+1))}return null},`matchJsonObject`),$i=e((e,t)=>{let n=e.indexOf(`>>`,t);if(n===-1||/[\n\r]/.test(e.slice(t,n)))return null;let r=e.slice(t,n);return r.trim()?Ki(e,t,r):null},`matchStereotypeText`),W=L({name:`LABEL_TEXT`,pattern:I.NA}),ea=L({name:`WORD`,pattern:I.NA,categories:W}),ta=L({name:`NUMBER`,pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:W}),G=L({name:`IDENTIFIER`,pattern:/\w+/,longer_alt:ta,categories:ea}),na=L({name:`HWS`,pattern:/[\t ]+/,group:I.SKIPPED}),K=L({name:`MARKDOWN_STRING`,pattern:qi,start_chars_hint:[`"`],line_breaks:!0}),ra=L({name:`UNCLOSED_MARKDOWN_STRING`,pattern:/"`[^]*/,line_breaks:!0}),ia=L({name:`COMMENT`,pattern:Ji,start_chars_hint:[`%`],line_breaks:!1}),q=L({name:`NEWLINE`,pattern:/\r\n|\n|\r/,line_breaks:!0}),aa=L({name:`ACC_DESCR_BLOCK`,pattern:Zi,start_chars_hint:[`a`],line_breaks:!0}),oa=/^accTitle[\t ]*:[^\n\r]*/,sa=/^accDescr[\t ]*:[^\n\r]*/,ca=L({name:`ACC_TITLE_LINE`,pattern:e((e,t)=>Xi(e,t,oa),`pattern`),start_chars_hint:[`a`],line_breaks:!1}),la=L({name:`ACC_DESCR_LINE`,pattern:e((e,t)=>Xi(e,t,sa),`pattern`),start_chars_hint:[`a`],line_breaks:!1}),ua=L({name:`JSON_DECLARATION_START`,pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:`jsonBody`}),da=L({name:`JSON_OBJECT_LITERAL`,pattern:Qi,start_chars_hint:[`{`],line_breaks:!0,pop_mode:!0}),fa=L({name:`UNCLOSED_JSON_OBJECT_LITERAL`,pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),J=e((e,t)=>L({name:e,pattern:t,longer_alt:G,categories:ea}),`keyword`),pa=J(`USECASE`,/usecase-beta/),ma=J(`ACTOR`,/actor/),ha=J(`SYSTEM_BOUNDARY`,/systemBoundary/),ga=J(`END`,/end/),_a=J(`DIRECTION`,/direction/),va=J(`TD`,/TD/),ya=J(`TB`,/TB/),ba=J(`BT`,/BT/),xa=J(`LR`,/LR/),Sa=J(`RL`,/RL/),Ca=J(`NOTE`,/note/),wa=J(`FOR`,/for/),Ta=J(`JSON`,/json/),Ea=J(`CLASS_DEF`,/classDef/),Da=J(`CLASS`,/class/),Oa=J(`STYLE`,/style/),ka=J(`INCLUDE`,/include/i),Aa=J(`EXTEND`,/extend/i),ja=J(`TRUE`,/true/),Ma=J(`FALSE`,/false/),Na=L({name:`GENERALIZATION`,pattern:/--\|>/}),Pa=L({name:`DEPENDENCY_ARROW`,pattern:/\.\.>/}),Fa=L({name:`STEREOTYPE_START`,pattern:/<</,push_mode:`stereotype`}),Ia=L({name:`STEREOTYPE_END`,pattern:/>>/,pop_mode:!0}),La=L({name:`STEREOTYPE_TEXT`,pattern:$i,line_breaks:!1}),Ra=L({name:`UNCLOSED_STEREOTYPE_TEXT`,pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),za=L({name:`CLASS_SEPARATOR`,pattern:/:::/}),Ba=L({name:`FORWARD_SOLID`,pattern:/--+>/}),Va=L({name:`BACKWARD_SOLID`,pattern:/<--+/}),Ha=L({name:`FORWARD_CIRCLE`,pattern:/--o/}),Ua=L({name:`BACKWARD_CIRCLE`,pattern:/o--/}),Wa=L({name:`FORWARD_CROSS`,pattern:/--x/}),Ga=L({name:`BACKWARD_CROSS`,pattern:/x--/}),Y=L({name:`MARKERLESS_SOLID`,pattern:/--+/}),Ka=L({name:`METADATA_START`,pattern:/@{/}),qa=L({name:`AT`,pattern:/@/,categories:W}),Ja=L({name:`LBRACE`,pattern:/{/}),Ya=L({name:`RBRACE`,pattern:/}/}),Xa=L({name:`LBRACKET`,pattern:/\[/}),Za=L({name:`RBRACKET`,pattern:/]/}),Qa=L({name:`LPAREN`,pattern:/\(/}),$a=L({name:`RPAREN`,pattern:/\)/}),X=L({name:`COMMA`,pattern:/,/,categories:W}),eo=L({name:`COLON`,pattern:/:/,categories:W}),to=L({name:`HASH_COLOR`,pattern:/#[\dA-Fa-f]+/,categories:W}),Z=L({name:`PLAIN_STRING`,pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),no=L({name:`CSS_IDENTIFIER`,pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:W}),ro=L({name:`CSS_ESCAPED_COMMA`,pattern:/\\,/,categories:W}),io=L({name:`DASH`,pattern:/-/,categories:W}),ao=L({name:`DOT`,pattern:/\./,categories:W}),oo=L({name:`PERCENT`,pattern:/%/,categories:W}),so=L({name:`CSS_PUNCTUATION`,pattern:/[!#$&*+/=?^_|~]/,categories:W}),co=[W,ea,na,K,ra,ia,q,aa,ca,la,ua,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,za,Ba,Va,Ha,Ua,Wa,Ga,Y,Ka,qa,Ja,Ya,Xa,Za,Qa,$a,X,eo,to,Z,no,G,ta,ro,io,ao,oo,so,L({name:`LABEL_PUNCTUATION`,pattern:/[;<>\\`]/,categories:W}),L({name:`LABEL_SYMBOL`,pattern:/[^\t\n\r !-~]+/,categories:W})],lo={defaultMode:`defaultMode`,modes:{defaultMode:[...co],jsonBody:[da,fa],stereotype:[Ia,La,Ra]}},uo=[...co,da,fa,Ia,La,Ra],fo=new I(lo),po=e(e=>ln(e,W)||e.tokenType===Z||e.tokenType===K,`isLabelToken`),mo={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},ho=new class extends ui{static{e(this,`UsecaseParser`)}constructor(){super(uo,{nodeLocationTracking:`full`}),this.RULE(`start`,()=>{this.CONSUME(pa),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE(`line`,()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.blankLine),`ALT`)},{ALT:e(()=>this.SUBRULE(this.commentLine),`ALT`)},{GATE:e(()=>this.isStatementStart(),`GATE`),ALT:e(()=>this.SUBRULE(this.statement),`ALT`)}])}),this.RULE(`statement`,()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.accTitleStatement),`ALT`)},{ALT:e(()=>this.SUBRULE(this.accDescrStatement),`ALT`)},{ALT:e(()=>this.SUBRULE(this.directionStatement),`ALT`)},{ALT:e(()=>this.SUBRULE(this.actorStatement),`ALT`)},{ALT:e(()=>this.SUBRULE(this.systemBoundaryStatement),`ALT`)},{ALT:e(()=>this.SUBRULE(this.noteStatement),`ALT`)},{ALT:e(()=>this.SUBRULE(this.jsonStatement),`ALT`)},{ALT:e(()=>this.SUBRULE(this.classDefStatement),`ALT`)},{ALT:e(()=>this.SUBRULE(this.classStatement),`ALT`)},{ALT:e(()=>this.SUBRULE(this.styleStatement),`ALT`)},{GATE:e(()=>this.isMetadataAssignment(),`GATE`),ALT:e(()=>this.SUBRULE(this.metadataAssignmentStatement),`ALT`)},{GATE:e(()=>!this.isForbiddenPlantUmlStatement(),`GATE`),ALT:e(()=>this.SUBRULE(this.entityStatement),`ALT`)}])}),this.RULE(`lineEnd`,()=>{this.OR([{ALT:e(()=>this.CONSUME(q),`ALT`)},{ALT:e(()=>this.CONSUME(R),`ALT`)}])}),this.RULE(`blankLine`,()=>{this.CONSUME(q)}),this.RULE(`commentLine`,()=>{this.CONSUME(ia),this.SUBRULE(this.lineEnd)}),this.RULE(`accTitleStatement`,()=>{this.CONSUME(ca),this.SUBRULE(this.lineEnd)}),this.RULE(`accDescrStatement`,()=>{this.OR([{ALT:e(()=>this.CONSUME(la),`ALT`)},{ALT:e(()=>this.CONSUME(aa),`ALT`)}]),this.SUBRULE(this.lineEnd)}),this.RULE(`actorStatement`,()=>{this.CONSUME(ma),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:e(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(X),this.SUBRULE2(this.actorItem)}),`ALT`)},{ALT:e(()=>this.SUBRULE(this.relationTail),`ALT`)}])}),this.SUBRULE(this.lineEnd)}),this.RULE(`actorItem`,()=>{this.SUBRULE(this.actorName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.stereotype)),this.OPTION3(()=>this.SUBRULE(this.classSuffix))}),this.RULE(`actorName`,()=>{this.OR([{ALT:e(()=>{this.CONSUME(G),this.OPTION(()=>{this.CONSUME(Qa),this.SUBRULE(this.nodeLabel),this.CONSUME($a)})},`ALT`)},{ALT:e(()=>this.CONSUME(Z),`ALT`)},{ALT:e(()=>this.CONSUME(K),`ALT`)}])}),this.RULE(`actorDeclarationOnly`,()=>{this.CONSUME(ma),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(X),this.SUBRULE2(this.actorItem)}),this.SUBRULE(this.lineEnd)}),this.RULE(`entityStatement`,()=>{this.SUBRULE(this.entityName),this.OPTION(()=>this.SUBRULE(this.relationTail)),this.SUBRULE(this.lineEnd)}),this.RULE(`entityName`,()=>{this.OR([{ALT:e(()=>{this.CONSUME(G),this.OPTION(()=>{this.OR2([{ALT:e(()=>{this.CONSUME(Qa),this.SUBRULE(this.nodeLabel),this.CONSUME($a)},`ALT`)},{ALT:e(()=>{this.CONSUME(Xa),this.SUBRULE2(this.nodeLabel),this.CONSUME(Za)},`ALT`)}])})},`ALT`)},{ALT:e(()=>this.CONSUME(Z),`ALT`)},{ALT:e(()=>this.CONSUME(K),`ALT`)}]),this.OPTION2(()=>this.SUBRULE(this.useCaseMetadata)),this.OPTION3(()=>this.SUBRULE(this.stereotype)),this.OPTION4(()=>this.SUBRULE(this.classSuffix))}),this.RULE(`nodeLabel`,()=>{this.OR([{ALT:e(()=>this.CONSUME(Z),`ALT`)},{ALT:e(()=>this.CONSUME(K),`ALT`)},{ALT:e(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),`ALT`)}])}),this.RULE(`useCaseMetadata`,()=>{this.SUBRULE(this.metadata)}),this.RULE(`relationTail`,()=>{this.OPTION({GATE:e(()=>this.LA(1).tokenType===G&&this.LA(2).tokenType===qa,`GATE`),DEF:e(()=>{this.CONSUME(G),this.CONSUME(qa)},`DEF`)}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE(`arrow`,()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.semanticRelation),`ALT`)},{ALT:e(()=>this.SUBRULE(this.forwardSolidOperator),`ALT`)},{ALT:e(()=>this.SUBRULE(this.backwardSolidOperator),`ALT`)},{ALT:e(()=>this.SUBRULE(this.markerlessSolidOperator),`ALT`)},{ALT:e(()=>this.SUBRULE(this.forwardCircleOperator),`ALT`)},{ALT:e(()=>this.SUBRULE(this.backwardCircleOperator),`ALT`)},{ALT:e(()=>this.SUBRULE(this.forwardCrossOperator),`ALT`)},{ALT:e(()=>this.SUBRULE(this.backwardCrossOperator),`ALT`)}])}),this.RULE(`forwardSolidOperator`,()=>{this.CONSUME(Ba)}),this.RULE(`backwardSolidOperator`,()=>{this.CONSUME(Va),this.OPTION({GATE:e(()=>this.LA(0).image===`<--`&&this.hasLabeledRight([Y]),`GATE`),DEF:e(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Y)},`DEF`)})}),this.RULE(`markerlessSolidOperator`,()=>{this.CONSUME(Y),this.OPTION({GATE:e(()=>this.LA(0).image===`--`&&this.hasLabeledRight([Ba,Y,Ha,Wa]),`GATE`),DEF:e(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:e(()=>this.CONSUME(Ba),`ALT`)},{ALT:e(()=>this.CONSUME2(Y),`ALT`)},{ALT:e(()=>this.CONSUME(Ha),`ALT`)},{ALT:e(()=>this.CONSUME(Wa),`ALT`)}])},`DEF`)})}),this.RULE(`forwardCircleOperator`,()=>{this.CONSUME(Ha)}),this.RULE(`backwardCircleOperator`,()=>{this.CONSUME(Ua),this.OPTION({GATE:e(()=>this.hasLabeledRight([Y]),`GATE`),DEF:e(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Y)},`DEF`)})}),this.RULE(`forwardCrossOperator`,()=>{this.CONSUME(Wa)}),this.RULE(`backwardCrossOperator`,()=>{this.CONSUME(Ga),this.OPTION({GATE:e(()=>this.hasLabeledRight([Y]),`GATE`),DEF:e(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Y)},`DEF`)})}),this.RULE(`edgeLabel`,()=>{this.OR([{ALT:e(()=>this.CONSUME(Z),`ALT`)},{ALT:e(()=>this.CONSUME(K),`ALT`)},{ALT:e(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),`ALT`)}])}),this.RULE(`semanticRelation`,()=>{this.OR([{ALT:e(()=>{this.CONSUME(Pa),this.CONSUME(eo),this.OR2([{ALT:e(()=>this.CONSUME(ka),`ALT`)},{ALT:e(()=>this.CONSUME(Aa),`ALT`)}])},`ALT`)},{ALT:e(()=>this.CONSUME(Na),`ALT`)}])}),this.RULE(`metadata`,()=>{this.CONSUME(Ka),this.MANY(()=>this.CONSUME(q)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(X)),this.MANY3(()=>this.CONSUME2(q))}),this.CONSUME(Ya)}),this.RULE(`metadataProperty`,()=>{this.OR([{ALT:e(()=>this.CONSUME(G),`ALT`)},{ALT:e(()=>this.CONSUME(Z),`ALT`)}]),this.CONSUME(eo),this.OR2([{ALT:e(()=>this.CONSUME2(G),`ALT`)},{ALT:e(()=>this.CONSUME2(Z),`ALT`)},{ALT:e(()=>this.CONSUME(ja),`ALT`)},{ALT:e(()=>this.CONSUME(Ma),`ALT`)}])}),this.RULE(`metadataSeparator`,()=>{this.OR([{ALT:e(()=>{this.CONSUME(X),this.MANY(()=>this.CONSUME(q))},`ALT`)},{ALT:e(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(q)),this.OPTION(()=>this.CONSUME2(X)),this.MANY2(()=>this.CONSUME3(q))},`ALT`)}])}),this.RULE(`systemBoundaryStatement`,()=>{this.CONSUME(ha),this.SUBRULE(this.systemBoundaryName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd),this.SUBRULE(this.systemBoundaryContent),this.CONSUME(ga),this.SUBRULE2(this.lineEnd)}),this.RULE(`systemBoundaryName`,()=>{this.OR([{ALT:e(()=>{this.CONSUME(G),this.OPTION(()=>{this.OR2([{ALT:e(()=>{this.CONSUME(Qa),this.SUBRULE(this.nodeLabel),this.CONSUME($a)},`ALT`)},{ALT:e(()=>{this.CONSUME(Xa),this.SUBRULE2(this.nodeLabel),this.CONSUME(Za)},`ALT`)}])})},`ALT`)},{ALT:e(()=>this.CONSUME(Z),`ALT`)},{ALT:e(()=>this.CONSUME(K),`ALT`)}])}),this.RULE(`systemBoundaryContent`,()=>{this.MANY(()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.blankLine),`ALT`)},{ALT:e(()=>this.SUBRULE(this.commentLine),`ALT`)},{ALT:e(()=>this.SUBRULE(this.boundaryElement),`ALT`)}])})}),this.RULE(`boundaryElement`,()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.actorDeclarationOnly),`ALT`)},{ALT:e(()=>{this.SUBRULE(this.entityName),this.SUBRULE(this.lineEnd)},`ALT`)}])}),this.RULE(`metadataAssignmentStatement`,()=>{this.SUBRULE(this.metadataAssignmentTarget),this.SUBRULE(this.metadata),this.SUBRULE(this.lineEnd)}),this.RULE(`metadataAssignmentTarget`,()=>{this.OR([{ALT:e(()=>this.CONSUME(G),`ALT`)},{ALT:e(()=>this.CONSUME(Z),`ALT`)},{ALT:e(()=>this.CONSUME(K),`ALT`)}])}),this.RULE(`noteStatement`,()=>{this.CONSUME(Ca),this.CONSUME(wa),this.CONSUME(G),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE(`stereotype`,()=>{this.CONSUME(Fa),this.CONSUME(La),this.CONSUME(Ia)}),this.RULE(`classSuffix`,()=>{this.CONSUME(za),this.CONSUME(G),this.MANY(()=>{this.CONSUME(X),this.CONSUME2(G)})}),this.RULE(`jsonStatement`,()=>{this.CONSUME(ua),this.CONSUME(da),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE(`directionStatement`,()=>{this.CONSUME(_a),this.OR([{ALT:e(()=>this.CONSUME(va),`ALT`)},{ALT:e(()=>this.CONSUME(ya),`ALT`)},{ALT:e(()=>this.CONSUME(ba),`ALT`)},{ALT:e(()=>this.CONSUME(xa),`ALT`)},{ALT:e(()=>this.CONSUME(Sa),`ALT`)}]),this.SUBRULE(this.lineEnd)}),this.RULE(`classDefStatement`,()=>{this.CONSUME(Ea),this.CONSUME(G),this.MANY(()=>{this.CONSUME(X),this.CONSUME2(G)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE(`classStatement`,()=>{this.CONSUME(Da),this.CONSUME(G),this.MANY(()=>{this.CONSUME(X),this.CONSUME2(G)}),this.CONSUME3(G),this.MANY2(()=>{this.CONSUME2(X),this.CONSUME4(G)}),this.SUBRULE(this.lineEnd)}),this.RULE(`styleStatement`,()=>{this.CONSUME(Oa),this.CONSUME(G),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE(`styles`,()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(X),this.SUBRULE2(this.styleValue)})}),this.RULE(`styleValue`,()=>{this.OR([{ALT:e(()=>this.CONSUME(ea),`ALT`)},{ALT:e(()=>this.CONSUME(no),`ALT`)},{ALT:e(()=>{this.CONSUME(Y),this.CONSUME2(ea)},`ALT`)}]),this.CONSUME(eo),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE(`styleComponent`,()=>{this.OR([{ALT:e(()=>this.CONSUME(ea),`ALT`)},{ALT:e(()=>this.CONSUME(Z),`ALT`)},{ALT:e(()=>this.CONSUME(ta),`ALT`)},{ALT:e(()=>this.CONSUME(to),`ALT`)},{ALT:e(()=>this.CONSUME(no),`ALT`)},{ALT:e(()=>this.CONSUME(ro),`ALT`)},{ALT:e(()=>this.CONSUME(io),`ALT`)},{ALT:e(()=>this.CONSUME(ao),`ALT`)},{ALT:e(()=>this.CONSUME(oo),`ALT`)},{ALT:e(()=>this.CONSUME(so),`ALT`)},{ALT:e(()=>this.CONSUME(eo),`ALT`)},{ALT:e(()=>this.CONSUME(Qa),`ALT`)},{ALT:e(()=>this.CONSUME($a),`ALT`)},{ALT:e(()=>this.CONSUME(Xa),`ALT`)},{ALT:e(()=>this.CONSUME(Za),`ALT`)},{ALT:e(()=>this.CONSUME(Ja),`ALT`)},{ALT:e(()=>this.CONSUME(Ya),`ALT`)},{ALT:e(()=>this.CONSUME(qa),`ALT`)},{ALT:e(()=>this.CONSUME(Y),`ALT`)}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===G||e===Z||e===K)&&this.LA(2).tokenType===Ka}isStatementStart(){let e=this.LA(1).tokenType;return e!==R&&e!==q&&e!==ia}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===G&&mo[this.LA(1).image.toLowerCase()]===!0}hasLabeledRight(e){if(!po(this.LA(1)))return!1;for(let t=2;;t++){let n=this.LA(t);if(e.includes(n.tokenType))return!0;if(!po(n))return!1}}},go=class extends Error{constructor(e,t,n){super(`${e} (line ${t}, column ${n})`),this.line=t,this.column=n,this.name=`UsecaseJsonError`}static{e(this,`UsecaseJsonError`)}},_o=e((e,t,n,r)=>{let i=n,a=r,o=Math.min(Math.max(t,0),e.length);for(let t=0;t<o;t++){let n=e[t];n===`\r`?(i++,a=1):n===`
72
+ `?(t===0||e[t-1]!==`\r`)&&(i++,a=1):a++}return{line:i,column:a}},`locationAtOffset`),vo=e((e,t,n,r)=>{let i=/\bposition (\d+)\b/u.exec(e);if(i)return _o(t,Number.parseInt(i[1],10),n,r);let a=/\bline (\d+) column (\d+)\b/u.exec(e);if(a){let e=Number.parseInt(a[1],10),t=Number.parseInt(a[2],10);return{line:n+e-1,column:e===1?r+t-1:t}}if(/unexpected end|end of json input/iu.test(e))return _o(t,t.length,n,r)},`locationFromErrorMessage`),Q=class extends Error{constructor(e){super(`Invalid JSON token`),this.offset=e}static{e(this,`JsonWalkError`)}},yo=class{constructor(e){this.text=e,this.offset=0,this.propertyOrder={}}static{e(this,`PropertyOrderCollector`)}collect(){if(this.skipWhitespace(),this.collectValue(``),this.skipWhitespace(),this.offset!==this.text.length)throw new Q(this.offset);return this.propertyOrder}collectValue(e){this.skipWhitespace();let t=this.text[this.offset];if(t===`{`)this.collectObject(e);else if(t===`[`)this.collectArray(e);else if(t===`"`)this.readString(!1);else if(t===`t`)this.consumeLiteral(`true`);else if(t===`f`)this.consumeLiteral(`false`);else if(t===`n`)this.consumeLiteral(`null`);else if(t===`-`||t>=`0`&&t<=`9`)this.consumeNumber();else throw new Q(this.offset)}collectObject(e){this.offset++;let t=[],n=new Set;if(this.propertyOrder[e]=t,this.skipWhitespace(),this.text[this.offset]===`}`){this.offset++;return}for(;this.offset<this.text.length;){if(this.text[this.offset]!==`"`)throw new Q(this.offset);let r=this.readString(!0),i=`${e}/${r.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`;if(n.has(r)?this.deletePointerSubtree(i):(n.add(r),t.push(r)),this.skipWhitespace(),this.text[this.offset]!==`:`)throw new Q(this.offset);if(this.offset++,this.collectValue(i),this.skipWhitespace(),this.text[this.offset]===`}`){this.offset++;return}if(this.text[this.offset]!==`,`)throw new Q(this.offset);this.offset++,this.skipWhitespace()}throw new Q(this.offset)}collectArray(e){if(this.offset++,this.skipWhitespace(),this.text[this.offset]===`]`){this.offset++;return}let t=0;for(;this.offset<this.text.length;){if(this.collectValue(`${e}/${t}`),t++,this.skipWhitespace(),this.text[this.offset]===`]`){this.offset++;return}if(this.text[this.offset]!==`,`)throw new Q(this.offset);this.offset++,this.skipWhitespace()}throw new Q(this.offset)}readString(e){this.offset++;let t=``;for(;this.offset<this.text.length;){let n=this.offset,r=this.text[this.offset++];if(r===`"`)return t;if(r.charCodeAt(0)<32)throw new Q(n);if(r!==`\\`){e&&(t+=r);continue}let i=this.offset,a=this.text[this.offset++];switch(a){case`"`:case`\\`:case`/`:e&&(t+=a);break;case`b`:e&&(t+=`\b`);break;case`f`:e&&(t+=`\f`);break;case`n`:e&&(t+=`
73
+ `);break;case`r`:e&&(t+=`\r`);break;case`t`:e&&(t+=` `);break;case`u`:{let n=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(n))throw new Q(this.offset);e&&(t+=String.fromCharCode(Number.parseInt(n,16))),this.offset+=4;break}default:throw new Q(i)}}throw new Q(this.offset)}consumeLiteral(e){let t=0;for(let n of e){if(this.text[this.offset+t]!==n)throw new Q(this.offset+t);t++}this.offset+=e.length}consumeNumber(){if(this.text[this.offset]===`-`&&this.offset++,this.text[this.offset]===`0`)this.offset++;else if(this.text[this.offset]>=`1`&&this.text[this.offset]<=`9`)for(;this.text[this.offset]>=`0`&&this.text[this.offset]<=`9`;)this.offset++;else throw new Q(this.offset);if(this.text[this.offset]===`.`){if(this.offset++,this.text[this.offset]<`0`||this.text[this.offset]>`9`)throw new Q(this.offset);for(;this.text[this.offset]>=`0`&&this.text[this.offset]<=`9`;)this.offset++}if(this.text[this.offset]===`e`||this.text[this.offset]===`E`){if(this.offset++,(this.text[this.offset]===`+`||this.text[this.offset]===`-`)&&this.offset++,this.text[this.offset]<`0`||this.text[this.offset]>`9`)throw new Q(this.offset);for(;this.text[this.offset]>=`0`&&this.text[this.offset]<=`9`;)this.offset++}}skipWhitespace(){for(;this.offset<this.text.length;){let e=this.text[this.offset];if(e!==` `&&e!==` `&&e!==`
74
+ `&&e!==`\r`)return;this.offset++}}deletePointerSubtree(e){let t=`${e}/`;for(let n of Object.keys(this.propertyOrder))(n===e||n.startsWith(t))&&delete this.propertyOrder[n]}};function bo(e,t,n){let r;try{r=JSON.parse(e)}catch(r){let i=r instanceof Error?r.message:String(r),a=vo(i,e,t,n);if(!a){let r=0;try{new yo(e).collect()}catch(e){e instanceof Q&&(r=e.offset)}a=_o(e,r,t,n)}throw new go(`Invalid JSON: ${i}`,a.line,a.column)}if(typeof r!=`object`||!r||Array.isArray(r))throw new go(`JSON value must have an object root`,t,n);return{value:r,propertyOrder:new yo(e).collect()}}e(bo,`parseOrderedJsonObject`);var xo=e(e=>({shape:e.type===`normal`?`actor`:e.type===`hollow`?`actor-hollow`:e.type===`awesome`?`actor-awesome`:`actor-icon`,...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:`actor`,actorType:e.type,business:e.business,labelType:e.labelType,...e.icon?{icon:e.icon}:{},...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),`actorNode`),So=e(e=>({shape:e.shape,...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:`usecase`,useCaseShape:e.shape,business:e.business,labelType:e.labelType,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),`useCaseNode`),Co=e(e=>({label:e.label,shape:`note`,attrs:{kind:`note`,target:e.target,labelType:e.labelType}}),`noteNode`),wo=e(e=>({label:e.id,shape:`json-table`,...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:`json`,value:e.value,propertyOrder:e.propertyOrder,labelType:`text`}}),`jsonNode`),To=e(e=>({id:e.id,source:e.source,target:e.target,...e.label?{label:e.label}:{},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{relationshipType:e.type,arrowType:e.arrowType,minlen:e.minlen,explicitId:e.explicitId,animate:e.animate,...e.animation?{animation:e.animation}:{},...e.labelType?{labelType:e.labelType}:{}}}),`relationshipEdge`),Eo=e(e=>({id:`${e.id}-edge`,source:e.id,target:e.target,attrs:{relationshipType:`note`,arrowType:H.LINE_SOLID,pattern:`dotted`,minlen:1,explicitId:!1,animate:!1,internal:!0}}),`noteEdge`),Do=e((e,t,n,r)=>{let i={};for(let t of e.getActors().values())i[t.id]=xo(t);for(let t of e.getUseCases().values())i[t.id]=So(t);for(let t of e.getNotes().values())i[t.id]=Co(t);for(let t of e.getJsonNodes().values())i[t.id]=wo(t);let a={};for(let t of e.getSystemBoundaries().values())a[t.id]={...t.label===t.id?{}:{title:t.label},nodes:[...t.members],...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:`systemBoundary`,boundaryType:t.type,labelType:t.labelType}};let o={};for(let t of e.getClassDefs().values())o[t.id]={styles:[...t.styles]};let s=e.getDirection();return{version:1,diagramType:`usecase`,source:t,header:{keyword:`usecase`,direction:s===`TD`?`TB`:s,span:n},...e.getAccTitle()?{accTitle:e.getAccTitle()}:{},...e.getAccDescription()?{accDescr:e.getAccDescription()}:{},nodes:i,edges:[...e.getRelationships().map(To),...[...e.getNotes().values()].map(Eo)],groups:a,classDefs:o,statements:r}},`buildUsecaseGraphAST`),$=e(e=>`line ${e.line}, column ${e.column} [${e.span[0]},${e.span[1]})`,`locationText`),Oo=e(e=>e===void 0?``:` (label "${e}")`,`labelSuffix`),ko=e(e=>e.generated?e.label:void 0,`generatedFrom`),Ao=e((e,t)=>{for(let n of t)e.includes(n)||e.push(n)},`pushUnique`),jo=class{constructor(e){this.db=e,this.source=``,this.statements=[],this.elements=[],this.boundaries=[],this.jsonDrafts=[],this.relationshipDrafts=[],this.noteDrafts=[],this.metadataAssignments=[],this.classAssignments=[],this.styleAssignments=[],this.classDefinitions=[],this.directions=[],this.model=e.createModel()}static{e(this,`UsecaseModelBuilder`)}reset(e){this.model=this.db.createModel(),this.source=e,this.statements=[],this.elements.length=0,this.boundaries.length=0,this.jsonDrafts.length=0,this.relationshipDrafts.length=0,this.noteDrafts.length=0,this.metadataAssignments.length=0,this.classAssignments.length=0,this.styleAssignments.length=0,this.classDefinitions.length=0,this.directions.length=0}addElement(e){this.elements.push(e)}addBoundary(e){this.boundaries.push(e)}addJson(e){this.jsonDrafts.push(e)}addRelationship(e){this.relationshipDrafts.push(e)}addNote(e){this.noteDrafts.push(e)}addMetadataAssignment(e,t,n,r){this.metadataAssignments.push({target:e,targetLocation:t,metadata:n,statement:r})}addClassDef(e,t){this.classDefinitions.push({ids:e,styles:t})}addClassAssignment(e,t){this.classAssignments.push({targets:e,classes:t})}addStyleAssignment(e,t,n){this.styleAssignments.push({target:e,location:t,styles:n})}setDirection(e){this.directions.push(e===`TD`?`TB`:e)}setAccTitle(e){this.model.accTitle=e}setAccDescription(e){this.model.accDescription=e}setStatements(e){this.statements=e}getActors(){return this.model.actors}getUseCases(){return this.model.useCases}getSystemBoundaries(){return this.model.systemBoundaries}getRelationships(){return this.model.relationships}getNotes(){return this.model.notes}getJsonNodes(){return this.model.jsonNodes}getClassDefs(){return this.model.classDefs}getDirection(){return this.model.direction}getAccTitle(){return this.model.accTitle}getAccDescription(){return this.model.accDescription}finalize(e){let t=new Map,n=new Map,r=new Map,i=new Map;for(let e of this.relationshipDrafts)this.recordFirst(i,e.source.id,e.source.location.span[0]),this.recordFirst(i,e.target.id,e.target.location.span[0]);for(let e of this.elements)this.recordFirst(i,e.id,e.location.span[0]);for(let e of this.boundaries)this.recordFirst(i,e.id,e.location.span[0]);for(let e of this.jsonDrafts)this.recordFirst(i,e.id,e.location.span[0]);let a=[...this.elements.map(e=>({offset:e.location.span[0],type:`element`,value:e})),...this.boundaries.map(e=>({offset:e.location.span[0],type:`boundary`,value:e})),...this.jsonDrafts.map(e=>({offset:e.location.span[0],type:`json`,value:e})),...this.relationshipDrafts.filter(e=>e.explicitId).map(e=>({offset:e.explicitIdLocation.span[0],type:`edge`,value:e}))].sort((e,t)=>e.offset-t.offset);for(let e of a)e.type===`element`?this.collectElement(e.value,t,n):e.type===`boundary`?this.collectBoundary(e.value,t,r):e.type===`json`?this.registerUnique(t,e.value.id,`json`,e.value.location,!1):this.registerUnique(t,e.value.explicitId,`edge`,e.value.explicitIdLocation,!1);this.materializeElements(n,i),this.materializeBoundaries(r,i),this.materializeJson(i);let o=this.materializeRelationships(t,n,i);this.reorderElements(n,i),this.applyMetadataAssignments(t,n,r,o),this.validateAndRefreshElements(n),this.refreshBoundaries(r,n),this.materializeNotes(t),this.applyClassDefinitions(),this.applyClassesAndStyles(t,o),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...t].map(([e,t])=>[e,t.kind]));let s=Do(this,this.source,e,this.statements);return this.model.ast=s,this.db.commit(this.model),s}collectElement(e,t,n){let r=t.get(e.id),i=ko({generated:e.generated,label:e.label.text});r&&r.kind!==e.kind&&this.conflict(`ID '${e.id}' is declared as both ${r.kind} and ${e.kind}`,e.location,r.location,i,ko(r)),r&&(r.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,r.location,i,ko(r));let a=n.get(e.id);if(!a){let r={kind:e.kind,id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],...e.parentId?{parentId:e.parentId,parentLocation:e.parentLocation}:{},...e.shape?{shape:e.shape}:{},...e.stereotype?{stereotype:e.stereotype,stereotypeLocation:e.location}:{}};this.applyDeclarationMetadata(r,e.metadata),n.set(e.id,r),t.set(e.id,{kind:e.kind,location:e.location,generated:e.generated,label:e.label.text});return}(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`ID '${e.id}' has conflicting labels`,e.location,a.location),e.shape&&a.shape&&e.shape!==a.shape&&this.conflict(`Use case '${e.id}' has conflicting shapes`,e.location,a.location),e.parentId&&a.parentId&&e.parentId!==a.parentId&&this.conflict(`Element '${e.id}' belongs to more than one system boundary`,e.parentLocation??e.location,a.parentLocation??a.location),e.stereotype&&a.stereotype&&e.stereotype!==a.stereotype&&this.conflict(`Element '${e.id}' has conflicting stereotypes`,e.location,a.stereotypeLocation??a.location),a.shape??=e.shape,a.parentId??=e.parentId,a.parentLocation??=e.parentLocation,a.stereotype??=e.stereotype,a.stereotypeLocation??=e.stereotype?e.location:void 0,Ao(a.classes,e.classes),this.applyDeclarationMetadata(a,e.metadata)}collectBoundary(e,t,n){let r=t.get(e.id),i=ko({generated:e.generated,label:e.label.text});r&&r.kind!==`boundary`&&this.conflict(`ID '${e.id}' is declared as both ${r.kind} and boundary`,e.location,r.location,i,ko(r)),r&&(r.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,r.location,i,ko(r));let a=n.get(e.id);if(a){(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`Boundary '${e.id}' has conflicting titles`,e.location,a.location),Ao(a.classes,e.classes);return}n.set(e.id,{id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],styles:[],members:[]}),t.set(e.id,{kind:`boundary`,location:e.location,generated:e.generated,label:e.label.text})}materializeElements(e,t){for(let n of[...e.values()].sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0)))this.setElementModel(n)}materializeBoundaries(e,t){for(let n of[...e.values()].sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0)))this.model.systemBoundaries.set(n.id,{id:n.id,label:n.label.text,labelType:n.label.type,type:n.type??`rect`,members:[],classes:[...n.classes],styles:[...n.styles]})}materializeJson(e){for(let t of[...this.jsonDrafts].sort((t,n)=>(e.get(t.id)??0)-(e.get(n.id)??0)))this.model.jsonNodes.set(t.id,{id:t.id,value:t.value,propertyOrder:t.propertyOrder,classes:[...t.classes],styles:[]})}materializeRelationships(e,t,n){let r=new Map,i=0;for(let a of this.relationshipDrafts){let o=this.resolveEndpoint(a.source,e,t,n),s=this.resolveEndpoint(a.target,e,t,n);this.validateRelationship(a,o,s,e);let c=a.explicitId??`edge-${i++}`,l={id:c,explicitId:!!a.explicitId,source:a.source.id,target:a.target.id,type:a.type,arrowType:a.arrowType,...a.label?{label:a.label.text,labelType:a.label.type}:{},minlen:a.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(l),r.set(c,{draft:a,relationship:l})}return this.model.relationshipCounter=i,r}resolveEndpoint(e,t,n,r){if(e.classesOnReference&&!e.declaration)throw Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${$(e.location)}`);let i=t.get(e.id);return i?i.kind:(n.set(e.id,{kind:`usecase`,id:e.id,label:e.label,location:e.location,generated:e.generated,shape:`ellipse`,classes:[]}),t.set(e.id,{kind:`usecase`,location:e.location,generated:e.generated,label:e.label.text}),this.recordFirst(r,e.id,e.location.span[0]),`usecase`)}reorderElements(e,t){let n=new Map(this.model.actors),r=new Map(this.model.useCases);this.model.actors.clear(),this.model.useCases.clear();for(let i of[...e.values()].sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0))){!n.has(i.id)&&!r.has(i.id)&&this.setElementModel(i);let e=n.get(i.id)??this.model.actors.get(i.id),t=r.get(i.id)??this.model.useCases.get(i.id);e?this.model.actors.set(i.id,e):t&&this.model.useCases.set(i.id,t)}}applyMetadataAssignments(e,t,n,r){for(let i of this.metadataAssignments){let a=e.get(i.target);if(!a){let e=this.inferMetadataKind(i.metadata);throw Error(`Metadata target '${i.target}' is unresolved${e?` (metadata implies ${e})`:``} at ${$(i.targetLocation)}`)}if(a.kind===`actor`||a.kind===`usecase`)this.applyStandaloneElementMetadata(t.get(i.target),i.metadata);else if(a.kind===`boundary`){let e=n.get(i.target);for(let t of i.metadata.properties)(t.key!==`type`||t.value!==`rect`&&t.value!==`package`)&&this.invalidMetadata(i.target,a.kind,t),e.type=t.value}else if(a.kind===`edge`){let e=r.get(i.target);if(!e)throw Error(`Metadata target '${i.target}' is not an explicit edge at ${$(i.targetLocation)}`);i.statement.kind=`edgeMetadata`,i.statement.edges=[{id:i.target,span:i.statement.span,idSpan:i.targetLocation.span,...i.statement.metadata?{metadata:i.statement.metadata}:{}}],delete i.statement.nodes;for(let t of i.metadata.properties)t.key===`animate`&&typeof t.value==`boolean`?e.relationship.animate=t.value:t.key===`animation`&&(t.value===`fast`||t.value===`slow`)?(e.relationship.animation=t.value,e.relationship.animate=!0):this.invalidMetadata(i.target,a.kind,t)}else for(let e of i.metadata.properties)this.invalidMetadata(i.target,a.kind,e)}for(let{relationship:e}of r.values())e.animation&&(e.animate=!0)}applyStandaloneElementMetadata(e,t){for(let n of t.properties)e.kind===`actor`?this.applyActorProperty(e,n,!0):n.key===`business`&&typeof n.value==`boolean`?e.business=n.value:this.invalidMetadata(e.id,e.kind,n)}applyDeclarationMetadata(e,t){if(t)for(let n of t.properties)e.kind===`actor`?this.applyActorProperty(e,n,!1):n.key===`business`&&typeof n.value==`boolean`?(e.business!==void 0&&e.business!==n.value&&this.conflict(`Use case '${e.id}' has conflicting business metadata`,n.location,e.location),e.business=n.value):this.invalidMetadata(e.id,e.kind,n)}applyActorProperty(e,t,n){t.key===`type`&&(t.value===`normal`||t.value===`hollow`||t.value===`awesome`)?(!n&&e.actorType!==void 0&&e.actorType!==t.value&&this.conflict(`Actor '${e.id}' has conflicting type metadata`,t.location,e.location),e.actorType=t.value):t.key===`icon`&&typeof t.value==`string`?(!n&&e.icon!==void 0&&e.icon!==t.value&&this.conflict(`Actor '${e.id}' has conflicting icon metadata`,t.location,e.location),e.icon=t.value):t.key===`business`&&typeof t.value==`boolean`?(!n&&e.business!==void 0&&e.business!==t.value&&this.conflict(`Actor '${e.id}' has conflicting business metadata`,t.location,e.location),e.business=t.value):this.invalidMetadata(e.id,e.kind,t)}validateAndRefreshElements(e){for(let t of e.values()){let e=t.icon?`icon`:t.actorType??`normal`;if(t.kind===`actor`){if(t.icon&&t.actorType&&t.actorType!==`normal`)throw Error(`Actor '${t.id}' cannot combine icon with type '${t.actorType}' at ${$(t.location)}`);if(t.business&&(e===`icon`||e===`awesome`))throw Error(`Business actor '${t.id}' must use normal or hollow geometry at ${$(t.location)}`)}else if((t.shape??`ellipse`)===`rect`&&t.business)throw Error(`Rectangular use case '${t.id}' cannot be a business use case at ${$(t.location)}`);this.setElementModel(t)}}refreshBoundaries(e,t){for(let t of e.values())t.members.length=0;for(let t of[...this.elements].sort((e,t)=>e.location.span[0]-t.location.span[0])){if(!t.parentId)continue;let n=e.get(t.parentId);if(!n)throw Error(`Parent boundary '${t.parentId}' for '${t.id}' is unresolved at ${$(t.parentLocation??t.location)}`);n.members.includes(t.id)||n.members.push(t.id)}for(let n of t.values())if(n.parentId&&!e.has(n.parentId))throw Error(`Parent boundary '${n.parentId}' for '${n.id}' is unresolved at ${$(n.parentLocation??n.location)}`);for(let t of e.values()){let e=this.model.systemBoundaries.get(t.id);e.type=t.type??`rect`,e.members=[...t.members],e.classes=[...t.classes],e.styles=[...t.styles]}}materializeNotes(e){let t=0;for(let n of this.noteDrafts){let r=e.get(n.target);if(!r)throw Error(`Note target '${n.target}' is unresolved at ${$(n.targetLocation)}`);r.kind!==`actor`&&r.kind!==`usecase`&&this.conflict(`Note target '${n.target}' must be an actor or use case, not ${r.kind}`,n.targetLocation,r.location);let i=`note-${t++}`;this.model.notes.set(i,{id:i,target:n.target,label:n.label.text,labelType:n.label.type})}this.model.noteCounter=t}applyClassDefinitions(){for(let e of this.classDefinitions)for(let t of e.ids)this.model.classDefs.set(t,{id:t,styles:[...e.styles]})}applyClassesAndStyles(e,t){for(let n of this.classAssignments)for(let r of n.targets)Ao(this.getStylable(r.id,e,t,r.location).classes,n.classes);for(let n of this.styleAssignments)this.getStylable(n.target,e,t,n.location).styles.push(...n.styles)}getStylable(e,t,n,r){let i=t.get(e)?.kind,a=i===`actor`?this.model.actors.get(e):i===`usecase`?this.model.useCases.get(e):i===`boundary`?this.model.systemBoundaries.get(e):i===`json`?this.model.jsonNodes.get(e):i===`edge`?n.get(e)?.relationship:void 0;if(!a)throw Error(`Class/style target '${e}' is unresolved or anonymous at ${$(r)}`);return a}validateRelationship(t,n,r,i){let a=e(e=>e===`actor`||e===`usecase`||e===`json`,`allowed`);if(a(n)||this.conflict(`Relationship source '${t.source.id}' cannot be ${n}`,t.source.location,i.get(t.source.id).location),a(r)||this.conflict(`Relationship target '${t.target.id}' cannot be ${r}`,t.target.location,i.get(t.target.id).location),(t.type===`include`||t.type===`extend`)&&(n!==`usecase`||r!==`usecase`))throw Error(`${t.type} relationship requires use-case endpoints at ${$(t.location)}`);if(t.type===`generalization`&&(n!==`actor`&&n!==`usecase`||n!==r))throw Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${$(t.location)}`);if(t.type===`association`&&(n===`json`||r===`json`)&&![0,1,2].includes(t.arrowType))throw Error(`JSON relationship '${t.source.id}' to '${t.target.id}' permits only point, reversed-point, or markerless solid association at ${$(t.location)}`)}setElementModel(e){if(e.kind===`actor`){let t=e.icon?`icon`:e.actorType??`normal`;this.model.useCases.delete(e.id),this.model.actors.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:t,...e.icon?{icon:e.icon}:{},business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.actors.get(e.id)?.styles??[]})}else this.model.actors.delete(e.id),this.model.useCases.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,shape:e.shape??`ellipse`,business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.useCases.get(e.id)?.styles??[]})}inferMetadataKind(e){let t=new Set([`actor`,`usecase`,`boundary`,`edge`]);for(let n of e.properties)if(n.key===`icon`)t.clear(),t.add(`actor`);else if(n.key===`animate`||n.key===`animation`)t.clear(),t.add(`edge`);else if(n.key===`type`)t.clear(),n.value===`rect`||n.value===`package`?t.add(`boundary`):(n.value===`normal`||n.value===`hollow`||n.value===`awesome`)&&t.add(`actor`);else if(n.key===`business`)t.delete(`boundary`),t.delete(`edge`);else return;return t.size===1?[...t][0]:void 0}invalidMetadata(e,t,n){throw Error(`Metadata property '${n.key}' is invalid for ${t} '${e}' at ${$(n.location)}`)}registerUnique(e,t,n,r,i){let a=e.get(t);a&&this.conflict(`ID '${t}' is declared more than once (${a.kind} and ${n})`,r,a.location,void 0,ko(a)),e.set(t,{kind:n,location:r,generated:i})}recordFirst(e,t,n){let r=e.get(t);(r===void 0||n<r)&&e.set(t,n)}conflict(e,t,n,r,i){throw Error(`${e} at ${$(t)}${Oo(r)}; previous declaration at ${$(n)}${Oo(i)}`)}},Mo=ho.getBaseCstVisitorConstructor(),No=new class extends Mo{constructor(){super(),this.builder=new jo(Gi),this.source=``,this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{e(this,`UsecaseVisitor`)}build(e,t){this.source=t,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(t),this.visit(e)}start(e){let t=this.tokens(e,`USECASE`)[0],n=[];for(let t of this.nodes(e,`line`))n.push(this.visit(t));this.builder.setStatements(n),this.builder.finalize(this.tokenSpan(t))}line(e){let t=this.firstNode(e,`blankLine`,`commentLine`,`statement`);return this.wrap(t,this.visit(t))}statement(e){return this.visit(this.firstNode(e,`accTitleStatement`,`accDescrStatement`,`directionStatement`,`actorStatement`,`systemBoundaryStatement`,`noteStatement`,`jsonStatement`,`classDefStatement`,`classStatement`,`styleStatement`,`metadataAssignmentStatement`,`entityStatement`))}lineEnd(e){}blankLine(e){return{kind:`blank`,span:this.tokenSpan(this.tokens(e,`NEWLINE`)[0])}}commentLine(e){return{kind:`comment`,span:this.tokenSpan(this.tokens(e,`COMMENT`)[0])}}accTitleStatement(e){let t=this.tokens(e,`ACC_TITLE_LINE`)[0].image;return this.builder.setAccTitle(t.slice(t.indexOf(`:`)+1).trim()),{kind:`accTitle`,span:[0,0]}}accDescrStatement(e){let t=this.tokens(e,`ACC_DESCR_LINE`)[0],n=this.tokens(e,`ACC_DESCR_BLOCK`)[0],r=t?t.image.slice(t.image.indexOf(`:`)+1).trim():n.image.slice(n.image.indexOf(`{`)+1,n.image.lastIndexOf(`}`)).trim();return this.builder.setAccDescription(r),{kind:`accDescr`,span:[0,0]}}actorStatement(e){let t=this.nodes(e,`actorItem`),n=t.map(e=>this.visit(e)),r=this.nodes(e,`relationTail`)[0],i=n.map((e,n)=>this.actorOccurrence(t[n],e,!0));for(let e of n)this.builder.addElement(this.actorDraft(e));if(!r)return{kind:`node`,span:[0,0],nodes:i};let a=this.visit(r);a.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(a.target));let o=this.relationshipDraft(n[0],a,this.nodeLocation(r));this.builder.addRelationship(o);let s=o.explicitId??`edge-${this.anonymousEdge++}`;return i.push(this.entityOccurrence(this.nodes(r.children,`entityName`)[0],a.target,a.target.explicitDeclaration)),{kind:`edge`,span:[0,0],nodes:i,edges:[{id:s,span:[0,0],...o.explicitIdLocation?{idSpan:o.explicitIdLocation.span}:{},...o.label?{labelSpan:o.label.span}:{}}]}}actorItem(e){let t=this.visit(this.nodes(e,`actorName`)[0]),n=this.nodes(e,`metadata`)[0],r=this.nodes(e,`stereotype`)[0],i=this.nodes(e,`classSuffix`)[0],a=i?this.visit(i):{classes:[],spans:[]};return{...t,...n?{metadata:this.visit(n)}:{},...r?{stereotype:this.visit(r)}:{},classes:a.classes,classSpans:a.spans}}actorName(e){let t=this.tokens(e,`IDENTIFIER`)[0],n=this.tokens(e,`PLAIN_STRING`)[0]??this.tokens(e,`MARKDOWN_STRING`)[0];if(t){let n=this.nodes(e,`nodeLabel`)[0],r=n?this.visit(n):this.tokenLabel(t);return{id:t.image,label:r,location:this.tokenLocation(t),generated:!1,classes:[],classSpans:[]}}let r=this.tokenLabel(n);return{id:this.generateId(r.text),label:r,location:this.tokenLocation(n),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){let t=this.nodes(e,`actorItem`),n=t.map(e=>this.visit(e));for(let e of n)this.builder.addElement(this.actorDraft(e));return{kind:`node`,span:[0,0],nodes:n.map((e,n)=>this.actorOccurrence(t[n],e,!0))}}entityStatement(e){let t=this.nodes(e,`entityName`),n=this.visit(t[0]),r=this.nodes(e,`relationTail`)[0];if(!r)return n.explicitDeclaration=!0,n.shape??=`ellipse`,this.builder.addElement(this.entityDraft(n)),{kind:`node`,span:[0,0],nodes:[this.entityOccurrence(t[0],n,!0)]};n.explicitDeclaration&&this.builder.addElement(this.entityDraft(n));let i=this.visit(r);i.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(i.target));let a={source:this.endpoint(n),target:this.endpoint(i.target),location:this.nodeLocation(r),...i.explicitId?{explicitId:i.explicitId,explicitIdLocation:i.explicitIdLocation}:{},...i.arrow};this.builder.addRelationship(a);let o=a.explicitId??`edge-${this.anonymousEdge++}`;return{kind:`edge`,span:[0,0],nodes:[this.entityOccurrence(t[0],n,n.explicitDeclaration),this.entityOccurrence(this.nodes(r.children,`entityName`)[0],i.target,i.target.explicitDeclaration)],edges:[{id:o,span:[0,0],...a.explicitIdLocation?{idSpan:a.explicitIdLocation.span}:{},...a.label?{labelSpan:a.label.span}:{}}]}}entityName(e){let t=this.tokens(e,`IDENTIFIER`)[0],n=this.tokens(e,`PLAIN_STRING`)[0]??this.tokens(e,`MARKDOWN_STRING`)[0],r=this.nodes(e,`nodeLabel`)[0],i=this.nodes(e,`useCaseMetadata`)[0],a=this.nodes(e,`stereotype`)[0],o=this.nodes(e,`classSuffix`)[0],s=o?this.visit(o):{classes:[],spans:[]};if(t){let n=r?this.visit(r):this.tokenLabel(t),o=r?this.tokens(e,`LBRACKET`).length?`rect`:`ellipse`:void 0;return{id:t.image,label:n,location:this.tokenLocation(t),generated:!1,...o?{shape:o}:{},...i?{metadata:this.visit(i)}:{},...a?{stereotype:this.visit(a)}:{},classes:s.classes,classSpans:s.spans,explicitDeclaration:!!(o||i||a)}}let c=this.tokenLabel(n);return{id:this.generateId(c.text),label:c,location:this.tokenLocation(n),generated:!0,...i?{metadata:this.visit(i)}:{},...a?{stereotype:this.visit(a)}:{},classes:s.classes,classSpans:s.spans,explicitDeclaration:!!(i||a)}}nodeLabel(e){let t=this.allTokens(e);if(t.length===1&&(t[0].tokenType.name===`PLAIN_STRING`||t[0].tokenType.name===`MARKDOWN_STRING`))return this.tokenLabel(t[0]);let n=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return{text:this.source.slice(n[0],n[1]),type:`text`,span:n}}useCaseMetadata(e){return this.visit(this.nodes(e,`metadata`)[0])}relationTail(e){let t=this.tokens(e,`IDENTIFIER`)[0];return{...t?{explicitId:t.image,explicitIdLocation:this.tokenLocation(t)}:{},arrow:this.visit(this.nodes(e,`arrow`)[0]),target:this.visit(this.nodes(e,`entityName`)[0])}}arrow(e){return this.visit(this.firstNode(e,`semanticRelation`,`forwardSolidOperator`,`backwardSolidOperator`,`markerlessSolidOperator`,`forwardCircleOperator`,`backwardCircleOperator`,`forwardCrossOperator`,`backwardCrossOperator`))}edgeLabel(e){return this.nodeLabel(e)}semanticRelation(e){if(this.tokens(e,`GENERALIZATION`).length)return{type:`generalization`,arrowType:H.SOLID_ARROW,minlen:1};let t=this.tokens(e,`INCLUDE`).length?`include`:`extend`,n=this.tokens(e,t===`include`?`INCLUDE`:`EXTEND`)[0];return{type:t,arrowType:H.SOLID_ARROW,label:{text:t,type:`text`,span:this.tokenSpan(n)},minlen:1}}metadata(e){return{properties:this.nodes(e,`metadataProperty`).map(e=>this.visit(e)),location:this.ctxLocation(e)}}metadataProperty(e){let t=this.allTokens(e).filter(e=>e.tokenType.name!==`COLON`),n=t[0],r=t[1],i=r.tokenType.name===`TRUE`||r.tokenType.name!==`FALSE`&&this.decodePlain(r),a=[n.startOffset,(r.endOffset??r.startOffset)+1];return{key:this.decodePlain(n),value:i,span:a,keySpan:this.contentSpan(n),valueSpan:this.contentSpan(r),location:this.tokenLocation(n)}}metadataSeparator(e){}systemBoundaryStatement(e){let t=this.visit(this.nodes(e,`systemBoundaryName`)[0]),n=this.nodes(e,`classSuffix`)[0],r=n?this.visit(n):{classes:[],spans:[]};t.classes=r.classes,this.builder.addBoundary(t);let i=this.parentBoundary;this.parentBoundary={id:t.id,location:t.location};let a=this.nodes(e,`systemBoundaryContent`)[0],o=a?this.visit(a):[];this.parentBoundary=i;let s=this.tokens(e,`END`)[0],c=this.nodes(e,`metadata`)[0],l=c?this.visit(c):void 0,u={kind:`group`,span:[0,0],group:t.id,idSpan:t.location.span,titleSpan:t.label.span,endSpan:this.tokenSpan(s),classSpans:r.spans,...l?{metadata:l.properties.map(({key:e,span:t,keySpan:n,valueSpan:r})=>({key:e,span:t,keySpan:n,valueSpan:r}))}:{},...o.length?{children:o}:{}};return l&&this.builder.addMetadataAssignment(t.id,t.location,l,u),u}systemBoundaryName(e){let t=this.tokens(e,`IDENTIFIER`)[0];if(t){let n=this.nodes(e,`nodeLabel`)[0];return{id:t.image,label:n?this.visit(n):this.tokenLabel(t),location:this.tokenLocation(t),generated:!1,classes:[]}}let n=this.tokens(e,`PLAIN_STRING`)[0]??this.tokens(e,`MARKDOWN_STRING`)[0],r=this.tokenLabel(n);return{id:this.generateId(r.text),label:r,location:this.tokenLocation(n),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,`blankLine`),...this.nodes(e,`commentLine`),...this.nodes(e,`boundaryElement`)].sort((e,t)=>(e.location?.startOffset??0)-(t.location?.startOffset??0)).map(e=>this.wrap(e,this.visit(e)))}boundaryElement(e){let t=this.nodes(e,`actorDeclarationOnly`)[0];if(t)return this.visit(t);let n=this.nodes(e,`entityName`)[0],r=this.visit(n);return r.explicitDeclaration=!0,r.shape??=`ellipse`,this.builder.addElement(this.entityDraft(r)),{kind:`node`,span:[0,0],nodes:[this.entityOccurrence(n,r,!0)]}}metadataAssignmentStatement(e){let t=this.visit(this.nodes(e,`metadataAssignmentTarget`)[0]),n=this.visit(this.nodes(e,`metadata`)[0]),r={kind:`metadata`,span:[0,0],nodes:[{id:t.id,span:t.location.span,idSpan:t.location.span}],metadata:n.properties.map(({key:e,span:t,keySpan:n,valueSpan:r})=>({key:e,span:t,keySpan:n,valueSpan:r}))};return this.builder.addMetadataAssignment(t.id,t.location,n,r),r}metadataAssignmentTarget(e){let t=this.allTokens(e)[0],n=this.tokenLabel(t);return{id:t.tokenType.name===`IDENTIFIER`?t.image:this.generateId(n.text),location:this.tokenLocation(t)}}noteStatement(e){let t=this.tokens(e,`IDENTIFIER`)[0],n=this.visit(this.nodes(e,`nodeLabel`)[0]);return this.builder.addNote({target:t.image,targetLocation:this.tokenLocation(t),label:n,location:this.ctxLocation(e)}),{kind:`note`,span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:n.span,nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}stereotype(e){let t=this.tokens(e,`STEREOTYPE_TEXT`)[0];return{value:t.image.trim(),span:this.tokenSpan(t)}}classSuffix(e){let t=this.tokens(e,`IDENTIFIER`);return{classes:t.map(e=>e.image),spans:t.map(e=>this.tokenSpan(e))}}jsonStatement(e){let t=this.tokens(e,`JSON_DECLARATION_START`)[0],n=this.tokens(e,`JSON_OBJECT_LITERAL`)[0],r=/^json[\t ]+(\w+)/.exec(t.image),i=r[1],a=r[0].length-i.length,o={span:[t.startOffset+a,t.startOffset+a+i.length],line:t.startLine??1,column:(t.startColumn??1)+a},s=bo(n.image,n.startLine??1,n.startColumn??1),c=this.nodes(e,`classSuffix`)[0],l=c?this.visit(c):{classes:[],spans:[]},u={id:i,value:s.value,propertyOrder:s.propertyOrder,location:o,classes:l.classes};return this.builder.addJson(u),{kind:`json`,span:[0,0],nodes:[{id:i,span:o.span,idSpan:o.span,defines:!0,classSpans:l.spans}],classSpans:l.spans}}directionStatement(e){let t=this.allTokens(e).find(e=>[`TD`,`TB`,`BT`,`RL`,`LR`].includes(e.tokenType.name));return this.builder.setDirection(t.image),{kind:`direction`,span:[0,0]}}classDefStatement(e){let t=this.tokens(e,`IDENTIFIER`),n=this.visit(this.nodes(e,`styles`)[0]);return this.builder.addClassDef(t.map(e=>e.image),n),{kind:`classDef`,span:[0,0],ref:t[0].image,refSpan:this.tokenSpan(t[0])}}classStatement(e){let t=this.tokens(e,`IDENTIFIER`),n=1;for(;n<t.length&&this.source.slice((t[n-1].endOffset??t[n-1].startOffset)+1,t[n].startOffset).includes(`,`);n++);let r=t.slice(0,n).map(e=>({id:e.image,location:this.tokenLocation(e)})),i=t.slice(n).map(e=>e.image);return this.builder.addClassAssignment(r,i),{kind:`classAssign`,span:[0,0],ref:i[0],refSpan:this.tokenSpan(t[n]),nodes:r.map(({id:e,location:t})=>({id:e,span:t.span,idSpan:t.span}))}}styleStatement(e){let t=this.tokens(e,`IDENTIFIER`)[0],n=this.visit(this.nodes(e,`styles`)[0]);return this.builder.addStyleAssignment(t.image,this.tokenLocation(t),n),{kind:`style`,span:[0,0],nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}styles(e){return this.nodes(e,`styleValue`).map(e=>this.visit(e))}styleValue(e){let t=this.allTokens(e),n=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return this.source.slice(n[0],n[1]).replaceAll(`\\,`,`,`)}styleComponent(e){return this.allTokens(e).map(e=>e.image).join(``)}forwardSolidOperator(e){let t=this.tokens(e,`FORWARD_SOLID`)[0];return{type:`association`,arrowType:H.SOLID_ARROW,minlen:this.solidMinlen(t)}}backwardSolidOperator(e){let t=this.tokens(e,`BACKWARD_SOLID`)[0],n=this.nodes(e,`edgeLabel`)[0],r=n?this.tokens(e,`MARKERLESS_SOLID`).at(-1):t;return{type:`association`,arrowType:H.BACK_ARROW,minlen:this.solidMinlen(r),...n?{label:this.visit(n)}:{}}}markerlessSolidOperator(e){let t=this.nodes(e,`edgeLabel`)[0],n=this.allTokens(e);if(!t)return{type:`association`,arrowType:H.LINE_SOLID,minlen:this.solidMinlen(this.tokens(e,`MARKERLESS_SOLID`)[0])};let r=n.at(-1),i=r.tokenType.name===`FORWARD_SOLID`?H.SOLID_ARROW:r.tokenType.name===`FORWARD_CIRCLE`?H.CIRCLE_ARROW:r.tokenType.name===`FORWARD_CROSS`?H.CROSS_ARROW:H.LINE_SOLID;return{type:`association`,arrowType:i,label:this.visit(t),minlen:i===H.SOLID_ARROW||i===H.LINE_SOLID?this.solidMinlen(r):1}}forwardCircleOperator(e){return{type:`association`,arrowType:H.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(e){let t=this.nodes(e,`edgeLabel`)[0];return{type:`association`,arrowType:H.CIRCLE_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}forwardCrossOperator(e){return{type:`association`,arrowType:H.CROSS_ARROW,minlen:1}}backwardCrossOperator(e){let t=this.nodes(e,`edgeLabel`)[0];return{type:`association`,arrowType:H.CROSS_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}actorDraft(e){return{id:e.id,kind:`actor`,label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}entityDraft(e){return{id:e.id,kind:`usecase`,label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.shape?{shape:e.shape}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}endpoint(e,t=e.explicitDeclaration??!0){return{id:e.id,label:e.label,location:e.location,generated:e.generated,declaration:t,classesOnReference:e.classes.length>0}}relationshipDraft(e,t,n){return{source:this.endpoint(e,!0),target:this.endpoint(t.target),location:n,...t.explicitId?{explicitId:t.explicitId,explicitIdLocation:t.explicitIdLocation}:{},...t.arrow}}actorOccurrence(e,t,n){return{id:t.id,span:this.nodeSpan(e),idSpan:t.location.span,labelSpan:t.label.span,...n?{defines:!0}:{},...t.stereotype?{stereotypeSpan:t.stereotype.span}:{},...t.metadata?{metadata:t.metadata.properties.map(({key:e,span:t,keySpan:n,valueSpan:r})=>({key:e,span:t,keySpan:n,valueSpan:r}))}:{},...t.classSpans.length?{classSpans:t.classSpans}:{}}}entityOccurrence(e,t,n){return this.actorOccurrence(e,t,n)}wrap(e,t){if(t.kind===`blank`||t.kind===`comment`)return t;t.span=this.nodeSpan(e);for(let e of t.edges??[])e.span=t.span;return t}tokenLabel(e){let t=e.tokenType.name===`MARKDOWN_STRING`?`markdown`:`text`,n=t===`markdown`?2:+(e.tokenType.name===`PLAIN_STRING`),r=this.tokenSpan(e,n);return{text:this.source.slice(r[0],r[1]),type:t,span:r}}decodePlain(e){return e.tokenType.name===`PLAIN_STRING`?e.image.slice(1,-1):e.image}contentSpan(e){return this.tokenSpan(e,e.tokenType.name===`PLAIN_STRING`?1:e.tokenType.name===`MARKDOWN_STRING`?2:0)}generateId(e){return e.replace(/\W/g,`_`)}solidMinlen(e){return Math.max(1,(e.image.match(/-/g)?.length??2)-1)}nodeLocation(e){let t=this.allTokens(e.children)[0];return{span:this.nodeSpan(e),line:t.startLine??1,column:t.startColumn??1}}ctxLocation(e){let t=this.allTokens(e).filter(e=>e.tokenType.name!==`NEWLINE`&&e.tokenType.name!==`EOF`),n=t[0],r=t.at(-1);return{span:[n.startOffset,Math.min(this.source.length,(r.endOffset??r.startOffset+r.image.length-1)+1)],line:n.startLine??1,column:n.startColumn??1}}tokenLocation(e){let t=e.tokenType.name===`PLAIN_STRING`?1:e.tokenType.name===`MARKDOWN_STRING`?2:0;return{span:this.tokenSpan(e,t),line:e.startLine??1,column:(e.startColumn??1)+t}}nodeSpan(e){let t=this.allTokens(e.children).filter(e=>e.tokenType.name!==`NEWLINE`&&e.tokenType.name!==`EOF`),n=t[0],r=t.at(-1);if(!n||!r)throw Error(`Usecase CST node has no source token`);return[n.startOffset,Math.min(this.source.length,(r.endOffset??r.startOffset+r.image.length-1)+1)]}tokenSpan(e,t=0){return[e.startOffset+t,Math.min(this.source.length,(e.endOffset??e.startOffset+e.image.length-1)+1-t)]}nodes(e,t){return(e[t]??[]).filter(e=>`children`in e)}tokens(e,t){return(e[t]??[]).filter(e=>`tokenTypeIdx`in e)}firstNode(e,...t){for(let n of t){let t=this.nodes(e,n)[0];if(t)return t}throw Error(`Usecase CST is missing one of: ${t.join(`, `)}`)}allTokens(e){let t=[];for(let n of Object.values(e))for(let e of n)`tokenTypeIdx`in e?t.push(e):t.push(...this.allTokens(e.children));return t.sort((e,t)=>e.startOffset-t.startOffset)}},Po={parse:e(async t=>{Gi.clear(),ho.input=[];try{fi({diagramType:`usecase`,lexer:fo,parser:ho,entry:e(()=>ho.start(),`entry`),visit:e(e=>No.build(e,t),`visit`)},t)}catch(e){Gi.clear();let n=ho.errors[0];if(n){let{token:r}=n,i=di(r.startOffset)?r.startOffset:t.length,a=di(r.endOffset)?r.endOffset+1:i,o=di(r.startLine)?r.startLine:t.slice(0,i).split(/\r\n|\r|\n/).length,s=Math.max(t.lastIndexOf(`
75
+ `,i-1),t.lastIndexOf(`\r`,i-1)),c=di(r.startColumn)?r.startColumn:i-s,l=e instanceof Error?e.message:String(e);throw Error(`${l} at line ${o}, column ${c} [${i},${a})`)}throw e}},`parse`)},Fo=[`point`,`circle`,`cross`,`extension`],Io={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},Lo=e((e,t)=>{let[n,r]=[e,t].map(e=>e.replace(/[^\w-]+/g,`_`).replace(/^_+|_+$/g,``)||`element`);return`usecase-${n}-${r}`},`usecaseDomId`),Ro=e(e=>`usecase-${e.replace(/[^\w-]+/g,`_`).replace(/^_+|_+$/g,``)||`element`}`,`usecaseNodeDomId`),zo=e((e,t)=>t===`markdown`?h(e).map(e=>e.map(e=>e.content).join(` `)).join(`
76
+ `):e,`getAccessibleLabel`),Bo=e(e=>{let t=zo(e.label??e.id,e.labelType);if(Io[e.shape]){let n=e.actorType&&e.actorType!==`normal`?`${e.actorType} `:``;return`${e.business?`business `:``}${n}actor ${t}${e.stereotype?`, stereotype ${e.stereotype}`:``}`}if(e.shape===`note`)return`Note for ${e.noteTargetLabel??e.noteTarget??``}: ${t}`;if(e.shape===`usecaseJsonTable`){let n=(e.jsonRows??[]).map(e=>`${e.accessibleKey}: ${e.value}`).join(`; `);return n?`${t}: ${n}`:t}let n=e.stereotype?`, stereotype ${e.stereotype}`:``;return`${e.business?`business `:``}use case ${t}${n}`},`getUsecaseNodeAccessibleName`),Vo=e(e=>`${e.boundaryType} system boundary ${zo(e.label??e.id,e.labelType)}`,`getUsecaseBoundaryAccessibleName`),Ho=e(e=>e.relationshipType===`note`?``:`${e.relationshipType===`association`&&e.label?`association ${zo(e.label,e.labelType)}`:e.relationshipType} from ${e.sourceLabel} to ${e.targetLabel}`,`getUsecaseEdgeAccessibleName`),Uo=e(e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),`escapePlainLabel`),Wo=e(e=>e.replace(/([*[\\\]_`])/g,`\\$1`),`escapeMarkdownMarkers`),Go=e((e,t)=>{e.diagramId=t,e.markers=[...Fo];for(let t of e.nodes){let e=t;if(e.domId=Ro(t.id),t.label!==void 0&&t.labelType===`text`&&(t.label=Uo(t.label)),t.stereotype&&=Uo(t.stereotype),!t.isGroup&&t.shape===`usecaseJsonTable`&&(t.jsonRows=t.jsonRows?.map(e=>({...e,key:Uo(e.key),value:Uo(e.value)}))),!t.isGroup&&(t.shape===`usecaseEllipse`||t.shape===`rect`)&&t.stereotype){let n=t.label??Uo(t.id);t.label=`\xAB${Wo(t.stereotype)}\xBB<br/>${t.labelType===`text`?Wo(n):n}`,t.labelType=`markdown`,e.hasFoldedStereotype=!0,delete t.stereotype}}for(let t of e.edges)t.label!==void 0&&t.labelType===`text`&&(t.label=Uo(t.label));return e},`prepareUsecaseLayoutData`),Ko=e((e,t,r)=>{for(let n of t.nodes){let i=typeof n.domId==`string`?n.domId:Lo(t.diagramId,n.id),a=e.select(`#${i}`),o=n.isGroup?`boundary`:Io[n.shape]?`actor`:n.shape===`note`?`note`:n.shape===`usecaseJsonTable`?`json`:`usecase`,s=r.nodes.get(n.id)??n.id;if(a.attr(`data-usecase-id`,n.id).attr(`data-usecase-kind`,o).attr(`role`,`img`).attr(`aria-label`,s),!n.isGroup&&(n.shape===`usecaseEllipse`||n.shape===`rect`)&&`hasFoldedStereotype`in n&&n.hasFoldedStereotype===!0){let e=a.node(),t=e?.querySelector(`.nodeLabel`),n=t?.querySelector(`p`)??t,r=n?.firstChild;if(n&&r?.nodeType===3){let e=n.ownerDocument.createElement(`span`);e.className=`usecase-stereotype`,n.insertBefore(e,r),e.appendChild(r)}else e?.querySelector(`.label tspan tspan, .label tspan`)?.classList.add(`usecase-stereotype`)}}let i=new Map(t.edges.map(e=>[e.id,e]));e.selectAll(`path[data-et="edge"]`).each(function(){let e=i.get(this.getAttribute(`data-id`)??``);if(!e)return;let a=n(this);a.attr(`id`,Lo(t.diagramId,e.id)).attr(`data-usecase-id`,e.id).attr(`data-usecase-kind`,e.internal?`note-connector`:`relationship`),e.internal?a.attr(`aria-hidden`,`true`):a.attr(`role`,`img`).attr(`aria-label`,r.edges.get(e.id)??e.id)})},`annotateUsecaseElements`),qo=e((e,t)=>{e.style(`--mermaid-usecase-actor-font-size`,`${t.actorFontSize}px`).style(`--mermaid-usecase-actor-font-family`,t.actorFontFamily).style(`--mermaid-usecase-actor-font-weight`,t.actorFontWeight).style(`--mermaid-usecase-font-size`,`${t.usecaseFontSize}px`).style(`--mermaid-usecase-font-family`,t.usecaseFontFamily).style(`--mermaid-usecase-font-weight`,t.usecaseFontWeight)},`applyUsecaseFonts`),Jo={draw:e(async(e,n,r,i)=>{t.info(`Drawing usecase diagram (unified)`,n);let{layout:a}=c(),o=i.db,s=o.getData(),l=new Map(s.nodes.map(e=>[e.id,zo(e.label??e.id,e.labelType)])),u={nodes:new Map(s.nodes.map(e=>[e.id,e.isGroup?Vo(e):Bo(e.shape===`note`?{...e,noteTargetLabel:l.get(e.noteTarget??``)}:e)])),edges:new Map(s.edges.map(e=>[e.id,Ho({...e,sourceLabel:l.get(e.source)??e.sourceLabel,targetLabel:l.get(e.target)??e.targetLabel})]))},d=te(n,s.config.securityLevel);s.layoutAlgorithm=ie(a),Go(s,n),qo(d,s),await re(s,d),Ko(d,s,u);let f=s.diagramPadding;m.insertTitle(d,`usecaseDiagramTitleText`,0,o.getDiagramTitle?.()??``),ne(d,f,`usecaseDiagram`,s.useMaxWidth),qo(d,s)},`draw`)},Yo=e(e=>({actorBkg:e.usecaseActorBkg??e.actorBkg??e.mainBkg,actorBorder:e.usecaseActorBorder??e.actorBorder??e.primaryColor,bkg:e.usecaseBkg??e.mainBkg,border:e.usecaseBorder??e.nodeBorder??e.primaryColor,boundaryBkg:e.usecaseBoundaryBkg??e.clusterBkg,boundaryBorder:e.usecaseBoundaryBorder??e.clusterBorder,includeLine:e.usecaseIncludeLine??e.lineColor,extendLine:e.usecaseExtendLine??e.lineColor}),`roleColors`),Xo=e(e=>{let{theme:t,bkgColorArray:n,borderColorArray:r}=e;if(!_(t,r))return``;let i=f().usecase?.colorScheme===`rotate`,a=ee(e.look),o=a===`handDrawn`,s=v(n),c=``;for(let e=0;e<g(r);e++){let t=r[e],l=s?`fill: ${n[e%n.length]};`:``,u=`[data-look="${a}"][data-color-id="color-${e}"]`;c+=`
77
+
78
+ & ${u}.system-boundary rect.boundary-body,
79
+ & ${u}.system-boundary rect.boundary-tab,
80
+ & ${u}.system-boundary .boundary-body path,
81
+ & ${u}.system-boundary .boundary-tab path {
82
+ stroke: ${t};
83
+ ${l}
84
+ }
85
+ `,i&&(c+=`
86
+
87
+ /* Use case bodies -- \`.usecase-element\` covers the ellipse form, the \`[Rect]\` form and
88
+ the business variant.
89
+
90
+ Element selectors only, never a bare \`path\`. Under the handDrawn look roughjs draws
91
+ the body as a *pair* of paths, an outline stroked in the border colour and a hachure
92
+ fill stroked in the background colour, with no class to tell them apart. Stroking
93
+ both repaints the fill lines as border colour and the shape collapses into a solid
94
+ block -- which is what \`.usecase-element path\` did. So handDrawn bodies keep the
95
+ theme's uniform colours, exactly as handDrawn flowchart nodes do. */
96
+ & ${u}.usecase-element ellipse,
97
+ & ${u}.usecase-element rect {
98
+ stroke: ${t};
99
+ ${l}
100
+ }
101
+
102
+ /* The business marker is a single classed path, so it can be reached safely by name --
103
+ without it the marker keeps the uniform border beside a palette-coloured body. No
104
+ \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
105
+ & ${u}.usecase-element .usecase-business-marker {
106
+ stroke: ${t};
107
+ }
108
+
109
+ /* Actor glyphs, mirroring the uniform rule further down. The fill goes on the glyph
110
+ group, never on its children, so the hollow variant's own \`fill="none"\` keeps
111
+ winning and a hollow actor stays hollow. Same reason as above for not descending
112
+ into the handDrawn paths. */
113
+ & ${u}.usecase-actor .usecase-actor-shape,
114
+ & ${u}.usecase-actor .usecase-actor-hollow,
115
+ & ${u}.usecase-actor .usecase-actor-awesome,
116
+ & ${u}.usecase-actor .usecase-actor-icon {
117
+ stroke: ${t};
118
+ ${l}
119
+ }
120
+ ${o?``:`
121
+ /* The group rule above reaches the glyph by inheritance, which the neo look breaks: it
122
+ ships a \`[data-look="neo"].node path { stroke }\` rule that hits the glyph's own paths,
123
+ and a value set directly on the child always beats one inherited from the parent,
124
+ whatever the parent rule's specificity. So name the children too.
125
+
126
+ Emitted for every look *except* handDrawn, where roughjs draws the glyph as an
127
+ outline path plus a hachure fill path stroked in the fill colour, indistinguishable
128
+ in CSS -- stroking both turns a hollow actor into a solid disc. Deliberately no
129
+ \`fill\` either way, so the hollow variant's own \`fill="none"\` keeps winning. */
130
+ & ${u}.usecase-actor .usecase-actor-glyph path,
131
+ & ${u}.usecase-actor .usecase-actor-glyph circle {
132
+ stroke: ${t};
133
+ }
134
+ `}
135
+ `)}return c},`genColor`),Zo={parser:Po,db:Gi,renderer:Jo,styles:e(e=>{let t=Yo(e),n=ee(e.look)===`handDrawn`;return`
136
+ ${Xo(e)}
137
+ & .usecase-actor {
138
+ color: ${e.actorTextColor??e.primaryTextColor};
139
+ }
140
+
141
+ & .usecase-actor-shape,
142
+ & .usecase-actor-hollow,
143
+ & .usecase-actor-awesome,
144
+ & .usecase-actor-icon {
145
+ fill: ${t.actorBkg};
146
+ stroke: ${t.actorBorder};
147
+ stroke-width: 2px;
148
+ }
149
+ ${n?``:`
150
+ /* The rule above colours the glyph group and lets its children inherit, which the neo
151
+ look breaks: it ships a \`[data-look="neo"].node path { stroke }\` rule that lands on
152
+ the glyph's own paths, and a value set directly on a child always beats one inherited
153
+ from its parent, whatever the parent rule's specificity. Since neo is the default look,
154
+ without this every actor renders in the node border colour rather than the actor
155
+ colour the rule above asks for.
156
+
157
+ \`.node\` is in the selector to outrank that neo rule rather than tie with it: both
158
+ would otherwise be one attribute plus one class plus one element, leaving the winner to
159
+ depend on which stylesheet is concatenated last.
160
+
161
+ Stroke only: the hollow variant's own \`fill="none"\` has to keep winning. */
162
+ & .node.usecase-actor .usecase-actor-glyph path,
163
+ & .node.usecase-actor .usecase-actor-glyph circle {
164
+ stroke: ${t.actorBorder};
165
+ }
166
+ `}
167
+ & .usecase-actor .nodeLabel,
168
+ & .actor-label {
169
+ color: ${e.actorTextColor??e.primaryTextColor};
170
+ fill: ${e.actorTextColor??e.primaryTextColor};
171
+ font-family: var(--mermaid-usecase-actor-font-family, ${e.fontFamily});
172
+ font-size: var(--mermaid-usecase-actor-font-size, 14px);
173
+ font-weight: var(--mermaid-usecase-actor-font-weight, normal);
174
+ }
175
+
176
+ & .usecase-element ellipse,
177
+ & .usecase-element rect,
178
+ & .usecase-business ellipse,
179
+ & .usecase-business rect {
180
+ fill: ${t.bkg};
181
+ stroke: ${t.border};
182
+ stroke-width: 2px;
183
+ }
184
+ ${n?``:`
185
+ /* The same interception the actor glyph hits, one element down: neo ships
186
+ \`[data-look="neo"].node rect { stroke: nodeBorder }\`, which outranks the plain
187
+ \`.usecase-element rect\` above, so a use case written in the \`[Rect]\` form kept the node
188
+ border colour while its ellipse siblings took the role colour. An \`<ellipse>\` has no
189
+ equivalent neo rule and is already correct; restating it here costs nothing and means
190
+ the two forms cannot drift apart again.
191
+
192
+ Qualified with \`[data-look]\` *and* \`.node\` to land strictly above that rule rather than
193
+ tie with it -- on a tie the later stylesheet would win, which is how neo took this in
194
+ the first place. Skipped under handDrawn, where roughjs draws paths and neither element
195
+ exists. */
196
+ & [data-look="${ee(e.look)}"].node.usecase-element ellipse,
197
+ & [data-look="${ee(e.look)}"].node.usecase-element rect {
198
+ fill: ${t.bkg};
199
+ stroke: ${t.border};
200
+ }
201
+
202
+ /* The business marker is a \`<path>\`, so it loses to \`[data-look="neo"].node path\` the same
203
+ way. No \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
204
+ & [data-look="${ee(e.look)}"].node.usecase-element .usecase-business-marker {
205
+ stroke: ${t.border};
206
+ }
207
+ `}
208
+ & .usecase-element .nodeLabel,
209
+ & .usecase-label {
210
+ color: ${e.primaryTextColor};
211
+ fill: ${e.primaryTextColor};
212
+ font-family: var(--mermaid-usecase-font-family, ${e.fontFamily});
213
+ font-size: var(--mermaid-usecase-font-size, 12px);
214
+ font-weight: var(--mermaid-usecase-font-weight, normal);
215
+ }
216
+
217
+ & .usecase-stereotype,
218
+ & .usecase-business-marker {
219
+ color: ${e.primaryTextColor};
220
+ fill: ${e.primaryTextColor};
221
+ stroke: ${t.border};
222
+ }
223
+
224
+ & .system-boundary rect.boundary-body,
225
+ & .system-boundary rect.boundary-tab,
226
+ & .system-boundary-package-tab {
227
+ fill: ${t.boundaryBkg};
228
+ stroke: ${t.boundaryBorder};
229
+ stroke-width: 1px;
230
+ }
231
+
232
+ & .system-boundary-title text {
233
+ fill: ${e.titleColor??e.primaryTextColor};
234
+ }
235
+
236
+ /* Only the span, never the <p> inside it: the renderer puts a user-supplied
237
+ 'color' on the span, and that has to stay inheritable by its children. */
238
+ & .system-boundary-title span {
239
+ color: ${e.titleColor??e.primaryTextColor};
240
+ }
241
+
242
+ & .usecase-note {
243
+ fill: ${e.noteBkgColor};
244
+ stroke: ${e.noteBorderColor};
245
+ color: ${e.noteTextColor};
246
+ }
247
+
248
+ & .usecase-note .nodeLabel {
249
+ color: ${e.noteTextColor};
250
+ fill: ${e.noteTextColor};
251
+ }
252
+
253
+ & .usecase-json-table,
254
+ & .usecase-json-table rect,
255
+ & .usecase-json-cell {
256
+ fill: ${e.mainBkg};
257
+ stroke: ${e.nodeBorder??e.primaryColor};
258
+ }
259
+
260
+ & .usecase-json-title,
261
+ & .usecase-json-key,
262
+ & .usecase-json-value {
263
+ color: ${e.primaryTextColor};
264
+ fill: ${e.primaryTextColor};
265
+ }
266
+
267
+ & .relationship {
268
+ fill: none;
269
+ stroke: ${e.lineColor};
270
+ }
271
+
272
+ & .relationship-include,
273
+ & .relationship-extend,
274
+ & .relationship-note {
275
+ stroke-dasharray: 3;
276
+ }
277
+
278
+ /* Include and extend are both dashed, which is a weak distinction at small sizes. The
279
+ tokens default to \`lineColor\`, so a theme that does not set them is unchanged. */
280
+ & .relationship-include {
281
+ stroke: ${t.includeLine};
282
+ }
283
+
284
+ & .relationship-extend {
285
+ stroke: ${t.extendLine};
286
+ }
287
+
288
+ & .relationship.edge-animation-fast,
289
+ & .relationship.edge-animation-slow {
290
+ stroke-linecap: round;
291
+ }
292
+
293
+ & .edgeLabel,
294
+ & .edgeLabel p {
295
+ background-color: ${e.edgeLabelBackground};
296
+ }
297
+
298
+ & .labelBkg {
299
+ background-color: ${e.edgeLabelBackground};
300
+ padding: 0 2px;
301
+ }
302
+
303
+ & .edgeLabel .label rect {
304
+ fill: ${e.edgeLabelBackground};
305
+ }
306
+
307
+ & .relationship-label,
308
+ & .edgeLabel {
309
+ color: ${e.primaryTextColor};
310
+ fill: ${e.primaryTextColor};
311
+ font-family: ${e.fontFamily};
312
+ font-size: 10px;
313
+ font-weight: normal;
314
+ }
315
+
316
+ & .marker,
317
+ & .marker.point,
318
+ & .marker.circle,
319
+ & .marker.cross {
320
+ fill: ${e.lineColor};
321
+ stroke: ${e.lineColor};
322
+ }
323
+
324
+ & .marker.extension {
325
+ fill: ${e.mainBkg};
326
+ stroke: ${e.lineColor};
327
+ }
328
+ `},`getStyles`)};export{Zo as diagram};