@agent-workshop/adoc-webapp 0.1.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.
- package/LICENSE +5 -0
- package/THIRD_PARTY_NOTICES.md +49 -0
- package/dist/assets/app.css +406 -0
- package/dist/assets/app.js +201 -0
- package/dist/assets/chunks/abnfDiagram-YUKMZFIV-UTBMKFXS.js +1 -0
- package/dist/assets/chunks/architecture-WOLXFQ4H-S6WNHT5H.js +1 -0
- package/dist/assets/chunks/architectureDiagram-47P4ROYG-SQCOEPXG.js +36 -0
- package/dist/assets/chunks/blockDiagram-E7TT5TSB-F5DSMBHI.js +140 -0
- package/dist/assets/chunks/c4Diagram-CRA5TL53-G4W35RYC.js +38 -0
- package/dist/assets/chunks/chunk-2TCGAX73.js +1 -0
- package/dist/assets/chunks/chunk-35SWHG2Z.js +1 -0
- package/dist/assets/chunks/chunk-4UKVVSLZ.js +2 -0
- package/dist/assets/chunks/chunk-56PLA4MI.js +1 -0
- package/dist/assets/chunks/chunk-6QSLXF4I.js +1 -0
- package/dist/assets/chunks/chunk-7DQROAU7.js +1 -0
- package/dist/assets/chunks/chunk-7FXP6RHI.js +1 -0
- package/dist/assets/chunks/chunk-7ITQOSYJ.js +15 -0
- package/dist/assets/chunks/chunk-7W3KTJUJ.js +1 -0
- package/dist/assets/chunks/chunk-ABLFMIK7.js +1 -0
- package/dist/assets/chunks/chunk-AVITUR4K.js +1 -0
- package/dist/assets/chunks/chunk-AVJJGJEF.js +1 -0
- package/dist/assets/chunks/chunk-BYKZQKZN.js +1 -0
- package/dist/assets/chunks/chunk-CBAFHIQV.js +213 -0
- package/dist/assets/chunks/chunk-CMFTFM5L.js +1 -0
- package/dist/assets/chunks/chunk-E2AIA637.js +14 -0
- package/dist/assets/chunks/chunk-ENUKY65A.js +72 -0
- package/dist/assets/chunks/chunk-EPS7YYLR.js +2 -0
- package/dist/assets/chunks/chunk-FDHLSHAZ.js +1 -0
- package/dist/assets/chunks/chunk-GBOXGTKU.js +1 -0
- package/dist/assets/chunks/chunk-GDF64WIG.js +1 -0
- package/dist/assets/chunks/chunk-GTJDAHEV.js +2 -0
- package/dist/assets/chunks/chunk-H57PPMTP.js +1 -0
- package/dist/assets/chunks/chunk-HHYS5L3R.js +1 -0
- package/dist/assets/chunks/chunk-INV6BDXO.js +2 -0
- package/dist/assets/chunks/chunk-IR3NHMOO.js +1 -0
- package/dist/assets/chunks/chunk-KLF2A562.js +1 -0
- package/dist/assets/chunks/chunk-LZTAJOGZ.js +1 -0
- package/dist/assets/chunks/chunk-M3XBBO6R.js +135 -0
- package/dist/assets/chunks/chunk-NBZPV65B.js +62 -0
- package/dist/assets/chunks/chunk-NCTJNXDF.js +1 -0
- package/dist/assets/chunks/chunk-O4U2B2FP.js +339 -0
- package/dist/assets/chunks/chunk-OB665XPY.js +1 -0
- package/dist/assets/chunks/chunk-OFD4YTIR.js +10 -0
- package/dist/assets/chunks/chunk-PHKIAKHS.js +1 -0
- package/dist/assets/chunks/chunk-R4OZRASH.js +32 -0
- package/dist/assets/chunks/chunk-UAGOPMXU.js +1 -0
- package/dist/assets/chunks/chunk-UAQETDSH.js +3 -0
- package/dist/assets/chunks/chunk-UORYZEAD.js +1 -0
- package/dist/assets/chunks/chunk-W4ELJFHG.js +1 -0
- package/dist/assets/chunks/chunk-WBPRABWA.js +136 -0
- package/dist/assets/chunks/chunk-XISCFCXG.js +88 -0
- package/dist/assets/chunks/chunk-XLJVPE6C.js +1 -0
- package/dist/assets/chunks/chunk-XQHNSJKC.js +1 -0
- package/dist/assets/chunks/chunk-XYDA52BE.js +1 -0
- package/dist/assets/chunks/chunk-YAHQK6MQ.js +1 -0
- package/dist/assets/chunks/chunk-ZGUCZDEK.js +1 -0
- package/dist/assets/chunks/chunk-ZRBDUQXP.js +1 -0
- package/dist/assets/chunks/classDiagram-v2-K4WV4PDN-EMBTPOHC.js +217 -0
- package/dist/assets/chunks/cose-bilkent-JH36ORCC-CNYFETCT.js +1 -0
- package/dist/assets/chunks/cynefin-EF2NZ3EQ-2AP5N5QY.js +1 -0
- package/dist/assets/chunks/cynefinDiagram-3GCD6N5R-WVTLESK3.js +62 -0
- package/dist/assets/chunks/dagre-W4DXFKR2-FPRZGQVB.js +4 -0
- package/dist/assets/chunks/diagram-2UJZ2QOL-VPSSQLZN.js +200 -0
- package/dist/assets/chunks/diagram-OVF4WLC6-PZ2RN37Y.js +24 -0
- package/dist/assets/chunks/diagram-PFPMY2P6-5GPN6RRZ.js +30 -0
- package/dist/assets/chunks/diagram-UMYRVEAY-OHFOPEFR.js +24 -0
- package/dist/assets/chunks/diagram-YEKJPTXX-PFA7KRZC.js +41 -0
- package/dist/assets/chunks/diagram-ZIFT7M5P-XOPZR7XN.js +3 -0
- package/dist/assets/chunks/ebnfDiagram-VR2GEFS7-MAGCN3HN.js +1 -0
- package/dist/assets/chunks/elk-IJKZMXRS-FZ2NQWIX.js +27 -0
- package/dist/assets/chunks/erDiagram-O2IAPWRE-746JHX2P.js +99 -0
- package/dist/assets/chunks/eventmodeling-K75KTNOO-FKRVI4N2.js +1 -0
- package/dist/assets/chunks/flowDiagram-OXPTDLAJ-XYHRK7XD.js +1 -0
- package/dist/assets/chunks/ganttDiagram-R7TSEDQI-DN5XENJA.js +292 -0
- package/dist/assets/chunks/gitGraph-VSP46ZUC-YT36MSRW.js +1 -0
- package/dist/assets/chunks/gitGraphDiagram-XJZIOB7I-NXP267LJ.js +106 -0
- package/dist/assets/chunks/info-OHQRW6UA-BRTC44VB.js +1 -0
- package/dist/assets/chunks/infoDiagram-5W2HQ5XZ-RT6YEU7N.js +2 -0
- package/dist/assets/chunks/ishikawaDiagram-K3B6WC7H-EJP5H2KV.js +70 -0
- package/dist/assets/chunks/journeyDiagram-COXZFDF6-M6MBFVND.js +139 -0
- package/dist/assets/chunks/kanban-definition-P3RFRI5V-WBYRNWVT.js +89 -0
- package/dist/assets/chunks/katex-42FXWECD.js +257 -0
- package/dist/assets/chunks/mermaid.core-SMXJOLYJ.js +18 -0
- package/dist/assets/chunks/mindmap-definition-LZFPQGKD-KVJVOCR5.js +96 -0
- package/dist/assets/chunks/packet-JDAUHWVQ-SGFXPYMB.js +1 -0
- package/dist/assets/chunks/pegDiagram-BGZESJAR-ECEGDREM.js +1 -0
- package/dist/assets/chunks/pie-XZMESJXO-LSQBPXPC.js +1 -0
- package/dist/assets/chunks/pieDiagram-CAPJLFHJ-D75MPXOK.js +39 -0
- package/dist/assets/chunks/quadrantDiagram-GDMTTRAM-HMUXMSEH.js +7 -0
- package/dist/assets/chunks/radar-ABXABTNO-TPYHBLNO.js +1 -0
- package/dist/assets/chunks/railroad-I3PHUGI6-WWIXL3LY.js +1 -0
- package/dist/assets/chunks/railroad-abnf-LNEFI6M7-DHJUY4R6.js +1 -0
- package/dist/assets/chunks/railroad-ebnf-DWYD2UWJ-4OJ4ECXX.js +1 -0
- package/dist/assets/chunks/railroad-peg-JR7BVNR7-VUOBDVLQ.js +1 -0
- package/dist/assets/chunks/railroadDiagram-SM67HX2B-Z757I54E.js +1 -0
- package/dist/assets/chunks/requirementDiagram-X7JNWC4A-7BW46JLY.js +84 -0
- package/dist/assets/chunks/sankeyDiagram-UM26HJRW-273BIID3.js +40 -0
- package/dist/assets/chunks/sequenceDiagram-ZO4K6R2Y-KG23HXTI.js +169 -0
- package/dist/assets/chunks/sizeCapture-INFHLROL-5N3POCQZ.js +1 -0
- package/dist/assets/chunks/stateDiagram-v2-TBUQTH76-AIML3PSW.js +291 -0
- package/dist/assets/chunks/swimlanes-N4OXWK64-TBFQZWAR.js +1 -0
- package/dist/assets/chunks/swimlanesDiagram-K3J5GTZL-TREAP6RB.js +8 -0
- package/dist/assets/chunks/timeline-definition-YOQAKGHF-QHTD5EBR.js +120 -0
- package/dist/assets/chunks/treeView-D4JQ5SDB-JJEYBPMW.js +1 -0
- package/dist/assets/chunks/treemap-SAJKECNS-I3YRCM2B.js +1 -0
- package/dist/assets/chunks/usecaseDiagram-VIAY4XPW-GNNFV4RS.js +370 -0
- package/dist/assets/chunks/vennDiagram-BLWOH2XV-YE23JXYX.js +34 -0
- package/dist/assets/chunks/wardley-7MLQ67FV-AKOGXXNF.js +1 -0
- package/dist/assets/chunks/wardleyDiagram-YMQ3BMBF-D7XYLZCZ.js +78 -0
- package/dist/assets/chunks/xychartDiagram-TAQBALBS-AT4Y7JWY.js +7 -0
- package/dist/assets/fonts/D2Coding-Bold.woff2 +0 -0
- package/dist/assets/fonts/D2Coding-OFL.txt +97 -0
- package/dist/assets/fonts/D2Coding.woff2 +0 -0
- package/dist/assets/fonts/Pretendard-LICENSE.txt +94 -0
- package/dist/assets/fonts/PretendardVariable.woff2 +0 -0
- package/dist/assets/fonts/SymbolsNerdFont-LICENSE.txt +21 -0
- package/dist/assets/fonts/SymbolsNerdFontMono.woff2 +0 -0
- package/dist/assets/xterm.css +285 -0
- package/dist/index.html +14 -0
- package/dist/licenses/@braintree__sanitize-url@7.1.2/LICENSE +21 -0
- package/dist/licenses/@chevrotain__cst-dts-gen@13.2.0/LICENSE.txt +202 -0
- package/dist/licenses/@chevrotain__gast@13.2.0/LICENSE.txt +202 -0
- package/dist/licenses/@chevrotain__regexp-to-ast@13.2.0/LICENSE.txt +202 -0
- package/dist/licenses/@chevrotain__utils@13.2.0/LICENSE.txt +202 -0
- package/dist/licenses/@iconify__utils@3.1.7/license.txt +21 -0
- package/dist/licenses/@mermaid-js__parser@2.0.1/LICENSE +21 -0
- package/dist/licenses/@remix-run__route-pattern@0.22.1/LICENSE +21 -0
- package/dist/licenses/@upsetjs__venn.js@2.0.0/LICENSE +22 -0
- package/dist/licenses/@xterm__addon-fit@0.11.0/LICENSE +19 -0
- package/dist/licenses/@xterm__xterm@6.0.0/LICENSE +21 -0
- package/dist/licenses/chevrotain@13.2.0/LICENSE.txt +202 -0
- package/dist/licenses/cookie-es@3.1.1/LICENSE +28 -0
- package/dist/licenses/cose-base@1.0.3/LICENSE +21 -0
- package/dist/licenses/cose-base@2.2.0/LICENSE +21 -0
- package/dist/licenses/cytoscape-cose-bilkent@4.1.0/LICENSE +21 -0
- package/dist/licenses/cytoscape-fcose@2.2.0/LICENSE +19 -0
- package/dist/licenses/cytoscape@3.34.3/LICENSE +19 -0
- package/dist/licenses/cytoscape@3.34.3/license-update.mjs +32 -0
- package/dist/licenses/d3-array@2.12.1/LICENSE +27 -0
- package/dist/licenses/d3-array@3.2.4/LICENSE +13 -0
- package/dist/licenses/d3-axis@3.0.0/LICENSE +13 -0
- package/dist/licenses/d3-brush@3.0.0/LICENSE +13 -0
- package/dist/licenses/d3-chord@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-color@3.1.0/LICENSE +13 -0
- package/dist/licenses/d3-contour@4.0.2/LICENSE +13 -0
- package/dist/licenses/d3-delaunay@6.0.4/LICENSE +14 -0
- package/dist/licenses/d3-dispatch@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-drag@3.0.0/LICENSE +13 -0
- package/dist/licenses/d3-dsv@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-ease@3.0.1/LICENSE +28 -0
- package/dist/licenses/d3-fetch@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-force@3.0.0/LICENSE +13 -0
- package/dist/licenses/d3-format@3.1.2/LICENSE +13 -0
- package/dist/licenses/d3-geo@3.1.1/LICENSE +34 -0
- package/dist/licenses/d3-hierarchy@3.1.2/LICENSE +13 -0
- package/dist/licenses/d3-interpolate@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-path@1.0.9/LICENSE +27 -0
- package/dist/licenses/d3-path@3.1.0/LICENSE +13 -0
- package/dist/licenses/d3-polygon@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-quadtree@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-random@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-sankey@0.12.3/LICENSE +27 -0
- package/dist/licenses/d3-scale-chromatic@3.1.0/LICENSE +28 -0
- package/dist/licenses/d3-scale@4.0.2/LICENSE +13 -0
- package/dist/licenses/d3-selection@3.0.0/LICENSE +13 -0
- package/dist/licenses/d3-shape@1.3.7/LICENSE +27 -0
- package/dist/licenses/d3-shape@3.2.0/LICENSE +13 -0
- package/dist/licenses/d3-time-format@4.1.0/LICENSE +13 -0
- package/dist/licenses/d3-time@3.1.0/LICENSE +13 -0
- package/dist/licenses/d3-timer@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-transition@3.0.1/LICENSE +13 -0
- package/dist/licenses/d3-zoom@3.0.0/LICENSE +13 -0
- package/dist/licenses/d3@7.9.0/LICENSE +13 -0
- package/dist/licenses/dagre-d3-es@7.0.14/LICENSE.md +23 -0
- package/dist/licenses/dayjs@1.11.23/LICENSE +21 -0
- package/dist/licenses/delaunator@5.1.0/LICENSE +15 -0
- package/dist/licenses/dompurify@3.4.16/LICENSE +202 -0
- package/dist/licenses/dompurify@3.4.16/LICENSE-MPL +373 -0
- package/dist/licenses/elkjs@0.9.3/LICENSE.md +264 -0
- package/dist/licenses/es-toolkit@1.52.0/LICENSE +21 -0
- package/dist/licenses/es-toolkit@1.52.0/NOTICE +39 -0
- package/dist/licenses/internmap@1.0.1/LICENSE +13 -0
- package/dist/licenses/internmap@2.0.3/LICENSE +13 -0
- package/dist/licenses/katex@0.16.47/LICENSE +21 -0
- package/dist/licenses/khroma@2.1.0/license +21 -0
- package/dist/licenses/layout-base@1.0.2/LICENSE +21 -0
- package/dist/licenses/layout-base@2.0.1/LICENSE +21 -0
- package/dist/licenses/lodash-es@4.18.1/LICENSE +47 -0
- package/dist/licenses/lucide-react@1.50.0/LICENSE +43 -0
- package/dist/licenses/lucide-react@1.50.0/copyright.mjs +22 -0
- package/dist/licenses/marked@16.4.2/LICENSE.md +44 -0
- package/dist/licenses/mermaid@12.1.0/LICENSE +21 -0
- package/dist/licenses/packages.json +945 -0
- package/dist/licenses/pretendard@1.3.9/LICENSE.txt +94 -0
- package/dist/licenses/react-dom@19.3.0/LICENSE +21 -0
- package/dist/licenses/react-router@8.4.0/LICENSE.md +23 -0
- package/dist/licenses/react@19.3.0/LICENSE +21 -0
- package/dist/licenses/robust-predicates@3.0.3/LICENSE +24 -0
- package/dist/licenses/roughjs@4.6.6/LICENSE +21 -0
- package/dist/licenses/scheduler@0.28.0/LICENSE +21 -0
- package/dist/licenses/stylis@4.4.0/LICENSE +21 -0
- package/dist/licenses/ts-dedent@2.3.0/LICENSE +21 -0
- package/dist/licenses/uuid@14.0.2/LICENSE.md +9 -0
- package/package.json +44 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import{a as Mn}from"./chunk-BYKZQKZN.js";import{b as _n,c as xn}from"./chunk-GBOXGTKU.js";import{a as wn}from"./chunk-7DQROAU7.js";import"./chunk-XYDA52BE.js";import"./chunk-IR3NHMOO.js";import"./chunk-OFD4YTIR.js";import"./chunk-ZRBDUQXP.js";import"./chunk-NBZPV65B.js";import"./chunk-NCTJNXDF.js";import"./chunk-ZGUCZDEK.js";import{b as kn}from"./chunk-ENUKY65A.js";import"./chunk-HHYS5L3R.js";import{b as Cn,c as bn,d as Ue,e as vn}from"./chunk-KLF2A562.js";import{q as Nn}from"./chunk-GTJDAHEV.js";import"./chunk-XLJVPE6C.js";import{$ as Ns,C as Sn,I as Rn,U as yn,V as kt,W as Ls,X as Ct,Y as Is,Z as On,_ as Ln,r as An}from"./chunk-M3XBBO6R.js";import{b as gn,h as In}from"./chunk-W4ELJFHG.js";import{a as l}from"./chunk-UAGOPMXU.js";import"./chunk-PHKIAKHS.js";function Pe(t){console&&console.error&&console.error(`Error: ${t}`)}function Ze(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Qe(t){let e=new Date().getTime(),s=t();return{time:new Date().getTime()-e,value:s}}function et(t){function e(){}e.prototype=t;let s=new e;function n(){return typeof s.bar}return n(),n(),t;(0,eval)(t)}function Vr(t){return zr(t)?t.LABEL:t.name}function zr(t){return typeof t.LABEL=="string"&&t.LABEL!==""}var ee=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(s=>{s.accept(e)})}},k=class extends ee{constructor(e){super([]),this.idx=1,Object.assign(this,le(e))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},X=class extends ee{constructor(e){super(e.definition),this.orgText="",Object.assign(this,le(e))}},C=class extends ee{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,le(e))}},b=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},F=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},B=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},N=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},w=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},U=class extends ee{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,le(e))}},O=class{constructor(e){this.idx=1,Object.assign(this,le(e))}accept(e){e.visit(this)}};function bt(t){return t.map(De)}function De(t){function e(s){return s.map(De)}if(t instanceof k){let s={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return typeof t.label=="string"&&(s.label=t.label),s}else{if(t instanceof C)return{type:"Alternative",definition:e(t.definition)};if(t instanceof b)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof F)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof B)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:De(new O({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof w)return{type:"RepetitionWithSeparator",idx:t.idx,separator:De(new O({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof N)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof U)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof O){let s={type:"Terminal",name:t.terminalType.name,label:Vr(t.terminalType),idx:t.idx};typeof t.label=="string"&&(s.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(s.pattern=n instanceof RegExp?n.source:n),s}else{if(t instanceof X)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}function le(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}var Y=class{visit(e){let s=e;switch(s.constructor){case k:return this.visitNonTerminal(s);case C:return this.visitAlternative(s);case b:return this.visitOption(s);case F:return this.visitRepetitionMandatory(s);case B:return this.visitRepetitionMandatoryWithSeparator(s);case w:return this.visitRepetitionWithSeparator(s);case N:return this.visitRepetition(s);case U:return this.visitAlternation(s);case O:return this.visitTerminal(s);case X:return this.visitRule(s);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 ks(t){return t instanceof C||t instanceof b||t instanceof N||t instanceof F||t instanceof B||t instanceof w||t instanceof O||t instanceof X}function Oe(t,e=[]){return t instanceof b||t instanceof N||t instanceof w?!0:t instanceof U?t.definition.some(n=>Oe(n,e)):t instanceof k&&e.includes(t)?!1:t instanceof ee?(t instanceof k&&e.push(t),t.definition.every(n=>Oe(n,e))):!1}function Cs(t){return t instanceof U}function Z(t){if(t instanceof k)return"SUBRULE";if(t instanceof b)return"OPTION";if(t instanceof U)return"OR";if(t instanceof F)return"AT_LEAST_ONE";if(t instanceof B)return"AT_LEAST_ONE_SEP";if(t instanceof w)return"MANY_SEP";if(t instanceof N)return"MANY";if(t instanceof O)return"CONSUME";throw Error("non exhaustive match")}var de=class{walk(e,s=[]){e.definition.forEach((n,i)=>{let r=e.definition.slice(i+1);if(n instanceof k)this.walkProdRef(n,r,s);else if(n instanceof O)this.walkTerminal(n,r,s);else if(n instanceof C)this.walkFlat(n,r,s);else if(n instanceof b)this.walkOption(n,r,s);else if(n instanceof F)this.walkAtLeastOne(n,r,s);else if(n instanceof B)this.walkAtLeastOneSep(n,r,s);else if(n instanceof w)this.walkManySep(n,r,s);else if(n instanceof N)this.walkMany(n,r,s);else if(n instanceof U)this.walkOr(n,r,s);else throw Error("non exhaustive match")})}walkTerminal(e,s,n){}walkProdRef(e,s,n){}walkFlat(e,s,n){let i=s.concat(n);this.walk(e,i)}walkOption(e,s,n){let i=s.concat(n);this.walk(e,i)}walkAtLeastOne(e,s,n){let i=[new b({definition:e.definition})].concat(s,n);this.walk(e,i)}walkAtLeastOneSep(e,s,n){let i=Un(e,s,n);this.walk(e,i)}walkMany(e,s,n){let i=[new b({definition:e.definition})].concat(s,n);this.walk(e,i)}walkManySep(e,s,n){let i=Un(e,s,n);this.walk(e,i)}walkOr(e,s,n){let i=s.concat(n);e.definition.forEach(r=>{let o=new C({definition:[r]});this.walk(o,i)})}};function Un(t,e,s){return[new b({definition:[new O({terminalType:t.separator})].concat(t.definition)})].concat(e,s)}function Le(t){if(t instanceof k)return Le(t.referencedRule);if(t instanceof O)return Yr(t);if(ks(t))return Hr(t);if(Cs(t))return Xr(t);throw Error("non exhaustive match")}function Hr(t){let e=[],s=t.definition,n=0,i=s.length>n,r,o=!0;for(;i&&o;)r=s[n],o=Oe(r),e=e.concat(Le(r)),n=n+1,i=s.length>n;return[...new Set(e)]}function Xr(t){let e=t.definition.map(s=>Le(s));return[...new Set(e.flat())]}function Yr(t){return[t.terminalType]}var vt="_~IN~_";var bs=class extends de{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,s,n){}walkProdRef(e,s,n){let i=qr(e.referencedRule,e.idx)+this.topProd.name,r=s.concat(n),o=new C({definition:r}),c=Le(o);this.follows[i]=c}};function Pn(t){let e={};return t.forEach(s=>{let n=new bs(s).startWalking();Object.assign(e,n)}),e}function qr(t,e){return t.name+e+vt}function S(t){return t.charCodeAt(0)}function _t(t,e){Array.isArray(t)?t.forEach(function(s){e.push(s)}):e.push(t)}function Fe(t,e){if(t[e]===!0)throw"duplicate flag "+e;let s=t[e];t[e]=!0}function Ie(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function tt(){throw Error("Internal Error - Should never get here!")}function vs(t){return t.type==="Character"}var st=[];for(let t=S("0");t<=S("9");t++)st.push(t);var nt=[S("_")].concat(st);for(let t=S("a");t<=S("z");t++)nt.push(t);for(let t=S("A");t<=S("Z");t++)nt.push(t);var _s=[S(" "),S("\f"),S(`
|
|
2
|
+
`),S("\r"),S(" "),S("\v"),S(" "),S("\xA0"),S("\u1680"),S("\u2000"),S("\u2001"),S("\u2002"),S("\u2003"),S("\u2004"),S("\u2005"),S("\u2006"),S("\u2007"),S("\u2008"),S("\u2009"),S("\u200A"),S("\u2028"),S("\u2029"),S("\u202F"),S("\u205F"),S("\u3000"),S("\uFEFF")];var Jr=/[0-9a-fA-F]/,xt=/[0-9]/,Zr=/[1-9]/,it=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 s=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":Fe(n,"global");break;case"i":Fe(n,"ignoreCase");break;case"m":Fe(n,"multiLine");break;case"u":Fe(n,"unicode");break;case"y":Fe(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:s,loc:this.loc(0)}}disjunction(){let e=[],s=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(s)}}alternative(){let e=[],s=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(s)}}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 s;switch(this.popChar()){case"=":s="Lookahead";break;case"!":s="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":s="Lookbehind";break;case"!":s="NegativeLookbehind"}break}}Ie(s);let n=this.disjunction();return this.consumeChar(")"),{type:s,value:n,loc:this.loc(e)}}return tt()}quantifier(e=!1){let s,n=this.idx;switch(this.popChar()){case"*":s={atLeast:0,atMost:1/0};break;case"+":s={atLeast:1,atMost:1/0};break;case"?":s={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":s={atLeast:i,atMost:i};break;case",":let r;this.isDigit()?(r=this.integerIncludingZero(),s={atLeast:i,atMost:r}):s={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&s===void 0)return;Ie(s);break}if(!(e===!0&&s===void 0)&&Ie(s))return this.peekChar(0)==="?"?(this.consumeChar("?"),s.greedy=!1):s.greedy=!0,s.type="Quantifier",s.loc=this.loc(n),s}atom(){let e,s=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Ie(e)?(e.loc=this.loc(s),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):tt()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[S(`
|
|
3
|
+
`),S("\r"),S("\u2028"),S("\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,s=!1;switch(this.popChar()){case"d":e=st;break;case"D":e=st,s=!0;break;case"s":e=_s;break;case"S":e=_s,s=!0;break;case"w":e=nt;break;case"W":e=nt,s=!0;break}return Ie(e)?{type:"Set",value:e,complement:s}:tt()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=S("\f");break;case"n":e=S(`
|
|
4
|
+
`);break;case"r":e=S("\r");break;case"t":e=S(" ");break;case"v":e=S("\v");break}return Ie(e)?{type:"Character",value:e}:tt()}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:S("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:S(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
5
|
+
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:S(e)}}}characterClass(){let e=[],s=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),s=!0);this.isClassAtom();){let n=this.classAtom(),i=n.type==="Character";if(vs(n)&&this.isRangeDash()){this.consumeChar("-");let r=this.classAtom(),o=r.type==="Character";if(vs(r)){if(r.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:r.value})}else _t(n.value,e),e.push(S("-")),_t(r.value,e)}else _t(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:s,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:S("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;this.consumeChar("("),this.peekChar(0)==="?"?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;let s=this.disjunction();this.consumeChar(")");let n={type:"Group",capturing:e,value:s};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(Zr.test(e)===!1)throw Error("Expecting a positive integer");for(;xt.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(xt.test(e)===!1)throw Error("Expecting an integer");for(;xt.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:S(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 xt.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 s="";for(let i=0;i<e;i++){let r=this.popChar();if(Jr.test(r)===!1)throw Error("Expecting a HexDecimal digits");s+=r}return{type:"Character",value:parseInt(s,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}}};var Ae=class{visitChildren(e){for(let s in e){let n=e[s];e.hasOwnProperty(s)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}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);break}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){}};var Mt={},Qr=new it;function Ne(t){let e=t.toString();if(Mt.hasOwnProperty(e))return Mt[e];{let s=Qr.pattern(e);return Mt[e]=s,s}}function Dn(){Mt={}}var Bn="Complement Sets are not supported for first char optimization",rt=`Unable to use "first char" lexer optimizations:
|
|
10
|
+
`;function $n(t,e=!1){try{let s=Ne(t);return xs(s.value,{},s.flags.ignoreCase)}catch(s){if(s.message===Bn)e&&Ze(`${rt} Unable to optimize: < ${t.toString()} >
|
|
11
|
+
Complement Sets cannot be automatically optimized.
|
|
12
|
+
This will disable the lexer's first char optimizations.
|
|
13
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";e&&(n=`
|
|
14
|
+
This will disable the lexer's first char optimizations.
|
|
15
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Pe(`${rt}
|
|
16
|
+
Failed parsing: < ${t.toString()} >
|
|
17
|
+
Using the @chevrotain/regexp-to-ast library
|
|
18
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function xs(t,e,s){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)xs(t.value[i],e,s);break;case"Alternative":let n=t.value;for(let i=0;i<n.length;i++){let r=n[i];switch(r.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let o=r;switch(o.type){case"Character":wt(o.value,e,s);break;case"Set":if(o.complement===!0)throw Error(Bn);o.value.forEach(a=>{if(typeof a=="number")wt(a,e,s);else{let h=a;if(s===!0)for(let d=h.from;d<=h.to;d++)wt(d,e,s);else{for(let d=h.from;d<=h.to&&d<Be;d++)wt(d,e,s);if(h.to>=Be){let d=h.from>=Be?h.from:Be,u=h.to,p=he(d),E=he(u);for(let R=p;R<=E;R++)e[R]=R}}}});break;case"Group":xs(o.value,e,s);break;default:throw Error("Non Exhaustive Match")}let c=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&Ms(o)===!1||o.type!=="Group"&&c===!1)break}break;default:throw Error("non exhaustive match!")}return Object.values(e)}function wt(t,e,s){let n=he(t);e[n]=n,s===!0&&ea(t,e)}function ea(t,e){let s=String.fromCharCode(t),n=s.toUpperCase();if(n!==s){let i=he(n.charCodeAt(0));e[i]=i}else{let i=s.toLowerCase();if(i!==s){let r=he(i.charCodeAt(0));e[r]=r}}}function Fn(t,e){return t.value.find(s=>{if(typeof s=="number")return e.includes(s);{let n=s;return e.find(i=>n.from<=i&&i<=n.to)!==void 0}})}function Ms(t){let e=t.quantifier;return e&&e.atLeast===0?!0:t.value?Array.isArray(t.value)?t.value.every(Ms):Ms(t.value):!1}var ws=class extends Ae{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?Fn(e,this.targetCharCodes)===void 0&&(this.found=!0):Fn(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Ut(t,e){if(e instanceof RegExp){let s=Ne(e),n=new ws(t);return n.visit(s),n.found}else{for(let s of e){let n=s.charCodeAt(0);if(t.includes(n))return!0}return!1}}var ke="PATTERN",$e="defaultMode",Pt="modes",Ft=0,at=1,Bt=2,$t=3;function jn(t,e){e=Object.assign({safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
19
|
+
`],tracer:(T,f)=>f()},e);let s=e.tracer;s("initCharCodeToOptimizedIndexMap",()=>{Sa()});let n;s("Reject Lexer.NA",()=>{n=t.filter(T=>T[ke]!==_.NA)});let i=!1,r;s("Transform Patterns",()=>{i=!1,r=n.map(T=>{let f=T[ke];if(f instanceof RegExp){let m=f.source;return m.length===1&&m!=="^"&&m!=="$"&&m!=="."&&!f.ignoreCase?m:m.length===2&&m[0]==="\\"&&!["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"].includes(m[1])?m[1]:Gn(f)}else{if(typeof f=="function")return i=!0,{exec:f};if(typeof f=="object")return i=!0,f;if(typeof f=="string"){if(f.length===1)return f;{let m=f.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),D=new RegExp(m);return Gn(D)}}else throw Error("non exhaustive match")}})});let o,c,a,h,d;s("misc mapping",()=>{o=n.map(T=>T.tokenTypeIdx),c=n.map(T=>{let f=T.GROUP;if(f!==_.SKIPPED){if(typeof f=="string")return f;if(f===void 0)return!1;throw Error("non exhaustive match")}}),a=n.map(T=>{let f=T.LONGER_ALT;if(f)return Array.isArray(f)?f.map(D=>n.indexOf(D)):[n.indexOf(f)]}),h=n.map(T=>T.PUSH_MODE),d=n.map(T=>Object.hasOwn(T,"POP_MODE"))});let u;s("Line Terminator Handling",()=>{let T=Yn(e.lineTerminatorCharacters);u=n.map(f=>!1),e.positionTracking!=="onlyOffset"&&(u=n.map(f=>Object.hasOwn(f,"LINE_BREAKS")?!!f.LINE_BREAKS:Xn(f,T)===!1&&Ut(T,f.PATTERN)))});let p,E,R,y;s("Misc Mapping #2",()=>{p=n.map(zn),E=r.map(ga),R=n.reduce((T,f)=>{let m=f.GROUP;return typeof m=="string"&&m!==_.SKIPPED&&(T[m]=[]),T},{}),y=r.map((T,f)=>{let m=c[f]===void 0&&a[f]===void 0?ta(n[f].PATTERN):void 0;return{pattern:r[f],asciiClass:m,longerAlt:a[f],canLineTerminator:u[f],matchType:m!==void 0?$t:E[f]!==!1?Ft:p[f]?at:Bt,short:E[f],group:c[f],push:h[f],pop:d[f],tokenTypeIdx:o[f],tokenType:n[f]}})});let I=!0,g=[];return e.safeMode||s("First Char Optimization",()=>{g=n.reduce((T,f,m)=>{if(typeof f.PATTERN=="string"){let D=f.PATTERN.charCodeAt(0),re=he(D);Us(T,re,y[m])}else if(Array.isArray(f.START_CHARS_HINT)){let D;f.START_CHARS_HINT.forEach(re=>{let ge=typeof re=="string"?re.charCodeAt(0):re,Re=he(ge);D!==Re&&(D=Re,Us(T,Re,y[m]))})}else if(f.PATTERN instanceof RegExp)if(f.PATTERN.unicode)I=!1,e.ensureOptimizations&&Pe(`${rt} Unable to analyze < ${f.PATTERN.toString()} > pattern.
|
|
20
|
+
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
21
|
+
This will disable the lexer's first char optimizations.
|
|
22
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let D=$n(f.PATTERN,e.ensureOptimizations);D.length===0&&(I=!1),D.forEach(re=>{Us(T,re,y[m])})}else e.ensureOptimizations&&Pe(`${rt} TokenType: <${f.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
23
|
+
This will disable the lexer's first char optimizations.
|
|
24
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),I=!1;return T},[])}),{emptyGroups:R,patternIdxToConfig:y,charCodeToPatternIdxToConfig:g,hasCustom:i,canBeOptimized:I}}function ta(t){var e,s;if(!(t instanceof RegExp)||t.flags!=="")return;let n;try{n=Ne(t)}catch{return}if(n.value.value.length!==1||n.value.value[0].value.length!==1)return;let i=n.value.value[0].value[0],r;for(;i.type==="Group";){if(i.capturing||i.quantifier!==void 0&&r!==void 0||i.value.value.length!==1||i.value.value[0].value.length!==1)return;r=(e=i.quantifier)!==null&&e!==void 0?e:r,i=i.value.value[0].value[0]}if(i.type!=="Set"||i.complement||i.quantifier!==void 0&&r!==void 0||(r=(s=i.quantifier)!==null&&s!==void 0?s:r,r?.atLeast!==1||r.atMost!==1/0||!r.greedy))return;let o=new Uint8Array(128);for(let c of i.value){let a=typeof c=="number"?c:c.from,h=typeof c=="number"?c:c.to;if(a<0||h>=o.length)return;o.fill(1,a,h+1)}return o}function Wn(t,e){let s=[],n=na(t);s=s.concat(n.errors);let i=ia(n.valid),r=i.valid;return s=s.concat(i.errors),s=s.concat(sa(r)),s=s.concat(da(r)),s=s.concat(pa(r,e)),s=s.concat(fa(r)),s}function sa(t){let e=[],s=t.filter(n=>n[ke]instanceof RegExp);return e=e.concat(aa(s)),e=e.concat(la(s)),e=e.concat(ha(s)),e=e.concat(ua(s)),e=e.concat(oa(s)),e}function na(t){let e=t.filter(i=>!Object.hasOwn(i,ke)),s=e.map(i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:v.MISSING_PATTERN,tokenTypes:[i]})),n=t.filter(i=>!e.includes(i));return{errors:s,valid:n}}function ia(t){let e=t.filter(i=>{let r=i[ke];return!(r instanceof RegExp)&&typeof r!="function"&&!Object.hasOwn(r,"exec")&&typeof r!="string"}),s=e.map(i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:v.INVALID_PATTERN,tokenTypes:[i]})),n=t.filter(i=>!e.includes(i));return{errors:s,valid:n}}var ra=/[^\\][$]/;function aa(t){class e extends Ae{constructor(){super(...arguments),this.found=!1}visitEndAnchor(r){this.found=!0}}return t.filter(i=>{let r=i.PATTERN;try{let o=Ne(r),c=new e;return c.visit(o),c.found}catch{return ra.test(r.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
|
|
25
|
+
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
26
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:v.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function oa(t){return t.filter(n=>n.PATTERN.test("")).map(n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:v.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var ca=/[^\\[][\^]|^\^/;function la(t){class e extends Ae{constructor(){super(...arguments),this.found=!1}visitStartAnchor(r){this.found=!0}}return t.filter(i=>{let r=i.PATTERN;try{let o=Ne(r),c=new e;return c.visit(o),c.found}catch{return ca.test(r.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
|
|
27
|
+
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
28
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:v.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function ha(t){return t.filter(n=>{let i=n[ke];return i instanceof RegExp&&(i.multiline||i.global)}).map(n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:v.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function ua(t){let e=[],s=t.map(r=>t.reduce((o,c)=>(r.PATTERN.source===c.PATTERN.source&&!e.includes(c)&&c.PATTERN!==_.NA&&(e.push(c),o.push(c)),o),[]));return s=s.filter(Boolean),s.filter(r=>r.length>1).map(r=>{let o=r.map(a=>a.name);return{message:`The same RegExp pattern ->${r[0].PATTERN}<-has been used in all of the following Token Types: ${o.join(", ")} <-`,type:v.DUPLICATE_PATTERNS_FOUND,tokenTypes:r}})}function da(t){return t.filter(n=>{if(!Object.hasOwn(n,"GROUP"))return!1;let i=n.GROUP;return i!==_.SKIPPED&&i!==_.NA&&typeof i!="string"}).map(n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:v.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function pa(t,e){return t.filter(i=>i.PUSH_MODE!==void 0&&!e.includes(i.PUSH_MODE)).map(i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:v.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function fa(t){let e=[],s=t.reduce((n,i,r)=>{let o=i.PATTERN;return o===_.NA||(typeof o=="string"?n.push({str:o,idx:r,tokenType:i}):o instanceof RegExp&&Ea(o)&&n.push({str:o.source,idx:r,tokenType:i})),n},[]);return t.forEach((n,i)=>{s.forEach(({str:r,idx:o,tokenType:c})=>{if(i<o&&ma(r,n.PATTERN)){let a=`Token: ->${c.name}<- can never be matched.
|
|
29
|
+
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
|
|
30
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:a,type:v.UNREACHABLE_PATTERN,tokenTypes:[n,c]})}})}),e}function ma(t,e){if(e instanceof RegExp){if(Ta(e))return!1;let s=e.exec(t);return s!==null&&s.index===0}else{if(typeof e=="function")return e(t,0,[],{});if(Object.hasOwn(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function Ea(t){return[".","\\","[","]","|","^","$","(",")","?","*","+","{"].find(s=>t.source.indexOf(s)!==-1)===void 0}function Ta(t){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source)}function Gn(t){let e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function Kn(t,e,s){let n=[];return Object.hasOwn(t,$e)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+$e+`> property in its definition
|
|
31
|
+
`,type:v.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(t,Pt)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Pt+`> property in its definition
|
|
32
|
+
`,type:v.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(t,Pt)&&Object.hasOwn(t,$e)&&!Object.hasOwn(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${$e}: <${t.defaultMode}>which does not exist
|
|
33
|
+
`,type:v.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(t,Pt)&&Object.keys(t.modes).forEach(i=>{let r=t.modes[i];r.forEach((o,c)=>{o===void 0?n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${c}>
|
|
34
|
+
`,type:v.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(o,"LONGER_ALT")&&(Array.isArray(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT]).forEach(h=>{h!==void 0&&!r.includes(h)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${h.name}> on token <${o.name}> outside of mode <${i}>
|
|
35
|
+
`,type:v.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),n}function Vn(t,e,s){let n=[],i=!1,o=Object.values(t.modes||{}).flat().filter(Boolean).filter(a=>a[ke]!==_.NA),c=Yn(s);return e&&o.forEach(a=>{let h=Xn(a,c);if(h!==!1){let u={message:Aa(a,h),type:h.issue,tokenType:a};n.push(u)}else Object.hasOwn(a,"LINE_BREAKS")?a.LINE_BREAKS===!0&&(i=!0):Ut(c,a.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
|
|
36
|
+
This Lexer has been defined to track line and column information,
|
|
37
|
+
But none of the Token Types can be identified as matching a line terminator.
|
|
38
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
39
|
+
for details.`,type:v.NO_LINE_BREAKS_FLAGS}),n}function zn(t){let e=t.PATTERN;if(e instanceof RegExp)return!1;if(typeof e=="function")return!0;if(Object.hasOwn(e,"exec"))return!0;if(typeof e=="string")return!1;throw Error("non exhaustive match")}function ga(t){return typeof t=="string"&&t.length===1?t.charCodeAt(0):!1}var Hn={test:function(t){let e=t.length;for(let s=this.lastIndex;s<e;s++){let n=t.charCodeAt(s);if(n===10)return this.lastIndex=s+1,!0;if(n===13)return t.charCodeAt(s+1)===10?this.lastIndex=s+2:this.lastIndex=s+1,!0}return!1},lastIndex:0};function Xn(t,e){if(Object.hasOwn(t,"LINE_BREAKS"))return!1;if(t.PATTERN instanceof RegExp){try{Ut(e,t.PATTERN)}catch(s){return{issue:v.IDENTIFY_TERMINATOR,errMsg:s.message}}return!1}else{if(typeof t.PATTERN=="string")return!1;if(zn(t))return{issue:v.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function Aa(t,e){if(e.issue===v.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
40
|
+
The problem is in the <${t.name}> Token Type
|
|
41
|
+
Root cause: ${e.errMsg}.
|
|
42
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===v.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
43
|
+
The problem is in the <${t.name}> Token Type
|
|
44
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Yn(t){return t.map(s=>typeof s=="string"?s.charCodeAt(0):s)}function Us(t,e,s){t[e]===void 0?t[e]=[s]:t[e].push(s)}var Be=256,Dt=[];function he(t){return t<Be?t:Dt[t]}function Sa(){if(Dt.length===0){Dt=new Array(65536);for(let t=0;t<65536;t++)Dt[t]=t>255?255+~~(t/255):t}}function pe(t,e){let s=t.tokenTypeIdx;return s===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[s]===!0}function Ge(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}var qn=1,Zn={};function fe(t){let e=Ra(t);ya(e),La(e),Oa(e),e.forEach(s=>{s.isParent=s.categoryMatches.length>0})}function Ra(t){let e=[...t],s=t,n=!0;for(;n;){s=s.map(r=>r.CATEGORIES).flat().filter(Boolean);let i=s.filter(r=>!e.includes(r));e=e.concat(i),i.length===0?n=!1:s=i}return e}function ya(t){t.forEach(e=>{Ps(e)||(Zn[qn]=e,e.tokenTypeIdx=qn++),Jn(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Jn(e)||(e.CATEGORIES=[]),Ia(e)||(e.categoryMatches=[]),Na(e)||(e.categoryMatchesMap={})})}function Oa(t){t.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(s=>{e.categoryMatches.push(Zn[s].tokenTypeIdx)})})}function La(t){t.forEach(e=>{Qn([],e)})}function Qn(t,e){t.forEach(s=>{e.categoryMatchesMap[s.tokenTypeIdx]=!0}),e.CATEGORIES.forEach(s=>{let n=t.concat(e);n.includes(s)||Qn(n,s)})}function Ps(t){return Object.hasOwn(t??{},"tokenTypeIdx")}function Jn(t){return Object.hasOwn(t??{},"CATEGORIES")}function Ia(t){return Object.hasOwn(t??{},"categoryMatches")}function Na(t){return Object.hasOwn(t??{},"categoryMatchesMap")}function ei(t){return Object.hasOwn(t??{},"tokenTypeIdx")}var Ds={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,s,n,i,r){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${s} characters.`}};var v;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(v||(v={}));var ot={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
45
|
+
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Ds,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ot);var _=class{constructor(e,s=ot){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,r)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let o=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${o}--> <${i}>`);let{time:c,value:a}=Qe(r),h=c>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&h(`${o}<-- <${i}> time: ${c}ms`),this.traceInitIndent--,a}else return r()},typeof s=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
46
|
+
a boolean 2nd argument is no longer supported`);this.config=Object.assign({},ot,s);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 i,r=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===ot.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Hn;else if(this.config.lineTerminatorCharacters===ot.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
47
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(s.safeMode&&s.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)?i={modes:{defaultMode:[...e]},defaultMode:$e}:(r=!1,i=Object.assign({},e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Kn(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Vn(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},Object.entries(i.modes).forEach(([c,a])=>{i.modes[c]=a.filter(h=>h!==void 0)});let o=Object.keys(i.modes);if(Object.entries(i.modes).forEach(([c,a])=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Wn(a,o))}),this.lexerDefinitionErrors.length===0){fe(a);let h;this.TRACE_INIT("analyzeTokenTypes",()=>{h=jn(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:s.positionTracking,ensureOptimizations:s.ensureOptimizations,safeMode:s.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=h.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=h.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,h.emptyGroups),this.hasCustom=h.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=h.canBeOptimized}})}),this.defaultMode=i.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let a=this.lexerDefinitionErrors.map(h=>h.message).join(`-----------------------
|
|
48
|
+
`);throw new Error(`Errors detected in definition of Lexer:
|
|
49
|
+
`+a)}this.lexerDefinitionWarning.forEach(c=>{Ze(c.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(r&&(this.handleModes=()=>{}),this.trackStartLines===!1&&(this.computeNewColumn=c=>c),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 c=Object.entries(this.canModeBeOptimized).reduce((a,[h,d])=>(d===!1&&a.push(h),a),[]);if(s.ensureOptimizations&&c.length>0)throw Error(`Lexer Modes: < ${c.join(", ")} > cannot be optimized.
|
|
50
|
+
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
51
|
+
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Dn()}),this.TRACE_INIT("toFastProperties",()=>{et(this)})})}tokenize(e,s=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let i=this.lexerDefinitionErrors.map(r=>r.message).join(`-----------------------
|
|
52
|
+
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
53
|
+
`+i)}return this.tokenizeInternal(e,s)}tokenizeInternal(e,s){let n,i,r,o,c,a,h,d,u,p,E,R,y,I,g,T=e,f=T.length,m=0,D=0,re=this.hasCustom?0:Math.floor(e.length/10),ge=new Array(re),Re=[],Xe=this.trackStartLines?1:void 0,ce=this.trackStartLines?1:void 0,we={};for(let G=0;G<this.cachedGroupKeys.length;G++)we[this.cachedGroupKeys[G]]=[];let Wr=this.trackStartLines,As=this.config.lineTerminatorsPattern,Ss=0,ye=[],Ye=[],qe=[],mn=[];Object.freeze(mn);let Je=!1,Kr=G=>{if(qe.length===1&&G.tokenType.PUSH_MODE===void 0){let se=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(G);Re.push({offset:G.startOffset,line:G.startLine,column:G.startColumn,length:G.image.length,message:se})}else{qe.pop();let se=qe.at(-1);ye=this.patternIdxToConfig[se],Ye=this.charCodeToPatternIdxToConfig[se],Ss=ye.length;let Rs=this.canModeBeOptimized[se]&&this.config.safeMode===!1;Ye&&Rs?Je=!0:Je=!1}};function En(G){qe.push(G),Ye=this.charCodeToPatternIdxToConfig[G],ye=this.patternIdxToConfig[G],Ss=ye.length;let se=this.canModeBeOptimized[G]&&this.config.safeMode===!1;Ye&&se?Je=!0:Je=!1}En.call(this,s);let te,Tn=this.config.recoveryEnabled;for(;m<f;){a=null,u=-1;let G=T.charCodeAt(m),se;if(Je){let K=he(G),J=Ye[K];se=J!==void 0?J:mn}else se=ye;let Rs=se.length;for(n=0;n<Rs;n++){te=se[n];let K=te.pattern;switch(h=null,te.matchType){case Ft:G===te.short&&(u=1,a=K);break;case at:g=K.exec(T,m,ge,we),g!==null?(a=g[0],u=a.length,g.payload!==void 0&&(h=g.payload)):a=null;break;case $t:{let J=te.asciiClass;if(J[G]!==1){K.lastIndex=0;break}let H=m+1;for(;J[T.charCodeAt(H)]===1;)H++;u=H-m,K.lastIndex=H;break}case Bt:K.lastIndex=m,u=this.matchLength(K,e,m);break}if(u!==-1){if(c=te.longerAlt,c!==void 0){a=e.substring(m,m+u);let J=c.length;for(r=0;r<J;r++){let H=ye[c[r]],ue=H.pattern;if(d=null,H.matchType===at?(g=ue.exec(T,m,ge,we),g!==null?(o=g[0],g.payload!==void 0&&(d=g.payload)):o=null):(ue.lastIndex=m,o=this.match(ue,e,m)),o&&o.length>a.length){a=o,u=o.length,h=d,te=H;break}}}break}}if(u!==-1){if(p=te.group,p!==void 0&&(a=a!==null?a:e.substring(m,m+u),E=te.tokenTypeIdx,R=this.createTokenInstance(a,m,E,te.tokenType,Xe,ce,u),this.handlePayload(R,h),p===!1?D=this.addToken(ge,D,R):we[p].push(R)),Wr===!0&&te.canLineTerminator===!0){let K=0,J,H;As.lastIndex=0;do a=a!==null?a:e.substring(m,m+u),J=As.test(a),J===!0&&(H=As.lastIndex-1,K++);while(J===!0);K!==0?(Xe=Xe+K,ce=u-H,this.updateTokenEndLineColumnLocation(R,p,H,K,Xe,ce,u)):ce=this.computeNewColumn(ce,u)}else ce=this.computeNewColumn(ce,u);m=m+u,this.handleModes(te,Kr,En,R)}else{let K=m,J=Xe,H=ce,ue=Tn===!1;for(;ue===!1&&m<f;)for(m++,i=0;i<Ss;i++){let ys=ye[i],Os=ys.pattern;switch(ys.matchType){case Ft:T.charCodeAt(m)===ys.short&&(ue=!0);break;case at:ue=Os.exec(T,m,ge,we)!==null;break;case $t:case Bt:Os.lastIndex=m,ue=Os.exec(e)!==null;break}if(ue===!0)break}if(y=m-K,ce=this.computeNewColumn(ce,y),I=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(T,K,y,J,H,qe.at(-1)),Re.push({offset:K,line:J,column:H,length:y,message:I}),Tn===!1)break}}return this.hasCustom||(ge.length=D),{tokens:ge,groups:we,errors:Re}}handleModes(e,s,n,i){if(e.pop===!0){let r=e.push;s(i),r!==void 0&&n.call(this,r)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,s,n,i,r,o,c){let a,h;s!==void 0&&(a=n===c-1,h=a?-1:0,i===1&&a===!0||(e.endLine=r+h,e.endColumn=o-1+-h))}computeNewColumn(e,s){return e+s}createOffsetOnlyToken(e,s,n,i){return{image:e,startOffset:s,tokenTypeIdx:n,tokenType:i}}createStartOnlyToken(e,s,n,i,r,o){return{image:e,startOffset:s,startLine:r,startColumn:o,tokenTypeIdx:n,tokenType:i}}createFullToken(e,s,n,i,r,o,c){return{image:e,startOffset:s,endOffset:s+c-1,startLine:r,endLine:r,startColumn:o,endColumn:o+c-1,tokenTypeIdx:n,tokenType:i}}addTokenUsingPush(e,s,n){return e.push(n),s}addTokenUsingMemberAccess(e,s,n){return e[s]=n,s++,s}handlePayloadNoCustom(e,s){}handlePayloadWithCustom(e,s){s!==null&&(e.payload=s)}match(e,s,n){return e.test(s)===!0?s.substring(n,e.lastIndex):null}matchLength(e,s,n){return e.test(s)===!0?e.lastIndex-n:-1}};_.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.";_.NA=/NOT_APPLICABLE/;function Ce(t){return Fs(t)?t.LABEL:t.name}function Fs(t){return typeof t.LABEL=="string"&&t.LABEL!==""}var ka="parent",ti="categories",si="label",ni="group",ii="push_mode",ri="pop_mode",ai="longer_alt",oi="line_breaks",ci="start_chars_hint";function A(t){return Ca(t)}function Ca(t){let e=t.pattern,s={};if(s.name=t.name,e!==void 0&&(s.PATTERN=e),Object.hasOwn(t,ka))throw`The parent property is no longer supported.
|
|
54
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(t,ti)&&(s.CATEGORIES=t[ti]),fe([s]),Object.hasOwn(t,si)&&(s.LABEL=t[si]),Object.hasOwn(t,ni)&&(s.GROUP=t[ni]),Object.hasOwn(t,ri)&&(s.POP_MODE=t[ri]),Object.hasOwn(t,ii)&&(s.PUSH_MODE=t[ii]),Object.hasOwn(t,ai)&&(s.LONGER_ALT=t[ai]),Object.hasOwn(t,oi)&&(s.LINE_BREAKS=t[oi]),Object.hasOwn(t,ci)&&(s.START_CHARS_HINT=t[ci]),s}var Q=A({name:"EOF",pattern:_.NA});fe([Q]);function be(t,e,s,n,i,r,o,c){return{image:e,startOffset:s,endOffset:n,startLine:i,endLine:r,startColumn:o,endColumn:c,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function ct(t,e){return pe(t,e)}var Gt={buildMismatchTokenMessage({expected:t,actual:e,previous:s,ruleName:n}){return`Expecting ${Fs(t)?`--> ${Ce(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:s,customUserDescription:n,ruleName:i}){let r="Expecting: ",c=`
|
|
55
|
+
but found: '`+e[0].image+"'";if(n)return r+n+c;{let u=`one of these possible Token sequences:
|
|
56
|
+
${t.reduce((p,E)=>p.concat(E),[]).map(p=>`[${p.map(E=>Ce(E)).join(", ")}]`).map((p,E)=>` ${E+1}. ${p}`).join(`
|
|
57
|
+
`)}`;return r+u+c}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:s,ruleName:n}){let i="Expecting: ",o=`
|
|
58
|
+
but found: '`+e[0].image+"'";if(s)return i+s+o;{let a=`expecting at least one iteration which starts with one of these possible Token sequences::
|
|
59
|
+
<${t.map(h=>`[${h.map(d=>Ce(d)).join(",")}]`).join(" ,")}>`;return i+a+o}}};Object.freeze(Gt);var li={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
|
|
60
|
+
inside top level rule: ->`+t.name+"<-"}},ae={buildDuplicateFoundError(t,e){function s(d){return d instanceof O?d.terminalType.name:d instanceof k?d.nonTerminalName:""}let n=t.name,i=e[0],r=i.idx,o=Z(i),c=s(i),a=r>0,h=`->${o}${a?r:""}<- ${c?`with argument: ->${c}<-`:""}
|
|
61
|
+
appears more than once (${e.length} times) in the top level rule: ->${n}<-.
|
|
62
|
+
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
63
|
+
`;return h=h.replace(/[ \t]+/g," "),h=h.replace(/\s\s+/g,`
|
|
64
|
+
`),h},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
|
|
65
|
+
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
|
|
66
|
+
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
67
|
+
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
68
|
+
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){let e=t.prefixPath.map(i=>Ce(i)).join(", "),s=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
|
69
|
+
in <OR${s}> inside <${t.topLevelRule.name}> Rule,
|
|
70
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
71
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
72
|
+
For Further details.`},buildAlternationAmbiguityError(t){let e=t.alternation.idx===0?"":t.alternation.idx,s=t.prefixPath.length===0,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${e}> inside <${t.topLevelRule.name}> Rule,
|
|
73
|
+
`;if(s)n+=`These alternatives are all empty (match no tokens), making them indistinguishable.
|
|
74
|
+
Only the last alternative may be empty.
|
|
75
|
+
`;else{let i=t.prefixPath.map(r=>Ce(r)).join(", ");n+=`<${i}> may appears as a prefix path in all these alternatives.
|
|
76
|
+
`}return n+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
77
|
+
For Further details.`,n},buildEmptyRepetitionError(t){let e=Z(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
|
|
78
|
+
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
79
|
+
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
|
|
80
|
+
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
81
|
+
has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){let e=t.topLevelRule.name,s=t.leftRecursionPath.map(r=>r.name),n=`${e} --> ${s.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
|
|
82
|
+
rule: <${e}> can be invoked from itself (directly or indirectly)
|
|
83
|
+
without consuming any Tokens. The grammar path that causes this is:
|
|
84
|
+
${n}
|
|
85
|
+
To fix this refactor your grammar to remove the left recursion.
|
|
86
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof X?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function hi(t,e){let s=new Bs(t,e);return s.resolveRefs(),s.errors}var Bs=class extends Y{constructor(e,s){super(),this.nameToTopRule=e,this.errMsgProvider=s,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let s=this.nameToTopRule[e.nonTerminalName];if(s)e.referencedRule=s;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:j.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var $s=class extends de{constructor(e,s){super(),this.topProd=e,this.path=s,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,s=[]){this.found||super.walk(e,s)}walkProdRef(e,s,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=s.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},jt=class extends $s{constructor(e,s){super(e,s),this.path=s,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,s,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=s.concat(n),r=new C({definition:i});this.possibleTokTypes=Le(r),this.found=!0}}},je=class extends de{constructor(e,s){super(),this.topRule=e,this.occurrence=s,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Wt=class extends je{walkMany(e,s,n){if(e.idx===this.occurrence){let i=s.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof O&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,s,n)}},lt=class extends je{walkManySep(e,s,n){if(e.idx===this.occurrence){let i=s.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof O&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,s,n)}},Kt=class extends je{walkAtLeastOne(e,s,n){if(e.idx===this.occurrence){let i=s.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof O&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,s,n)}},ht=class extends je{walkAtLeastOneSep(e,s,n){if(e.idx===this.occurrence){let i=s.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof O&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,s,n)}};function Vt(t,e,s=[]){s=[...s];let n=[],i=0;function r(c){return c.concat(t.slice(i+1))}function o(c){let a=Vt(r(c),e,s);return n.concat(a)}for(;s.length<e&&i<t.length;){let c=t[i];if(c instanceof C)return o(c.definition);if(c instanceof k)return o(c.definition);if(c instanceof b)n=o(c.definition);else if(c instanceof F){let a=c.definition.concat([new N({definition:c.definition})]);return o(a)}else if(c instanceof B){let a=[new C({definition:c.definition}),new N({definition:[new O({terminalType:c.separator})].concat(c.definition)})];return o(a)}else if(c instanceof w){let a=c.definition.concat([new N({definition:[new O({terminalType:c.separator})].concat(c.definition)})]);n=o(a)}else if(c instanceof N){let a=c.definition.concat([new N({definition:c.definition})]);n=o(a)}else{if(c instanceof U)return c.definition.forEach(a=>{a.definition.length!==0&&(n=o(a.definition))}),n;if(c instanceof O)s.push(c.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:s,suffixDef:t.slice(i)}),n}function ui(t,e,s,n){let i="EXIT_NONE_TERMINAL",r=[i],o="EXIT_ALTERNATIVE",c=!1,a=e.length,h=a-n-1,d=[],u=[];for(u.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});u.length!==0;){let p=u.pop();if(p===o){c&&u.at(-1).idx<=h&&u.pop();continue}let E=p.def,R=p.idx,y=p.ruleStack,I=p.occurrenceStack;if(E.length===0)continue;let g=E[0];if(g===i){let T={idx:R,def:E.slice(1),ruleStack:y.slice(0,-1),occurrenceStack:I.slice(0,-1)};u.push(T)}else if(g instanceof O)if(R<a-1){let T=R+1,f=e[T];if(s(f,g.terminalType)){let m={idx:T,def:E.slice(1),ruleStack:y,occurrenceStack:I};u.push(m)}}else if(R===a-1)d.push({nextTokenType:g.terminalType,nextTokenOccurrence:g.idx,ruleStack:y,occurrenceStack:I}),c=!0;else throw Error("non exhaustive match");else if(g instanceof k){let T=[...y];T.push(g.nonTerminalName);let f=[...I];f.push(g.idx);let m={idx:R,def:g.definition.concat(r,E.slice(1)),ruleStack:T,occurrenceStack:f};u.push(m)}else if(g instanceof b){let T={idx:R,def:E.slice(1),ruleStack:y,occurrenceStack:I};u.push(T),u.push(o);let f={idx:R,def:g.definition.concat(E.slice(1)),ruleStack:y,occurrenceStack:I};u.push(f)}else if(g instanceof F){let T=new N({definition:g.definition,idx:g.idx}),f=g.definition.concat([T],E.slice(1)),m={idx:R,def:f,ruleStack:y,occurrenceStack:I};u.push(m)}else if(g instanceof B){let T=new O({terminalType:g.separator}),f=new N({definition:[T].concat(g.definition),idx:g.idx}),m=g.definition.concat([f],E.slice(1)),D={idx:R,def:m,ruleStack:y,occurrenceStack:I};u.push(D)}else if(g instanceof w){let T={idx:R,def:E.slice(1),ruleStack:y,occurrenceStack:I};u.push(T),u.push(o);let f=new O({terminalType:g.separator}),m=new N({definition:[f].concat(g.definition),idx:g.idx}),D=g.definition.concat([m],E.slice(1)),re={idx:R,def:D,ruleStack:y,occurrenceStack:I};u.push(re)}else if(g instanceof N){let T={idx:R,def:E.slice(1),ruleStack:y,occurrenceStack:I};u.push(T),u.push(o);let f=new N({definition:g.definition,idx:g.idx}),m=g.definition.concat([f],E.slice(1)),D={idx:R,def:m,ruleStack:y,occurrenceStack:I};u.push(D)}else if(g instanceof U)for(let T=g.definition.length-1;T>=0;T--){let f=g.definition[T],m={idx:R,def:f.definition.concat(E.slice(1)),ruleStack:y,occurrenceStack:I};u.push(m),u.push(o)}else if(g instanceof C)u.push({idx:R,def:g.definition.concat(E.slice(1)),ruleStack:y,occurrenceStack:I});else if(g instanceof X)u.push(ba(g,R,y,I));else throw Error("non exhaustive match")}return d}function ba(t,e,s,n){let i=[...s];i.push(t.name);let r=[...n];return r.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:r}}var x;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(x||(x={}));function Ht(t){if(t instanceof b||t==="Option")return x.OPTION;if(t instanceof N||t==="Repetition")return x.REPETITION;if(t instanceof F||t==="RepetitionMandatory")return x.REPETITION_MANDATORY;if(t instanceof B||t==="RepetitionMandatoryWithSeparator")return x.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof w||t==="RepetitionWithSeparator")return x.REPETITION_WITH_SEPARATOR;if(t instanceof U||t==="Alternation")return x.ALTERNATION;throw Error("non exhaustive match")}function pi(t,e,s,n,i,r){let o=ut(t,e,s),c=Ai(o)?Ge:pe;return r(o,n,c,i)}function fi(t,e,s,n,i,r){let o=dt(t,e,i,s),c=Ai(o)?Ge:pe;return r(o[0],c,n)}function mi(t,e,s,n){let i=t.length,r=t.every(o=>o.every(c=>c.length===1));if(e)return function(o){let c=o.map(a=>a.GATE);for(let a=0;a<i;a++){let h=t[a],d=h.length,u=c[a];if(!(u!==void 0&&u.call(this)===!1))e:for(let p=0;p<d;p++){let E=h[p],R=E.length;for(let y=0;y<R;y++){let I=this.LA_FAST(y+1);if(s(I,E[y])===!1)continue e}return a}}};if(r&&!n){let c=t.map(a=>a.flat()).reduce((a,h,d)=>(h.forEach(u=>{u.tokenTypeIdx in a||(a[u.tokenTypeIdx]=d),u.categoryMatches.forEach(p=>{Object.hasOwn(a,p)||(a[p]=d)})}),a),{});return function(){let a=this.LA_FAST(1);return c[a.tokenTypeIdx]}}else return function(){for(let o=0;o<i;o++){let c=t[o],a=c.length;e:for(let h=0;h<a;h++){let d=c[h],u=d.length;for(let p=0;p<u;p++){let E=this.LA_FAST(p+1);if(s(E,d[p])===!1)continue e}return o}}}}function Ei(t,e,s){let n=t.every(r=>r.length===1),i=t.length;if(n&&!s){let r=t.flat();if(r.length===1&&r[0].categoryMatches.length===0){let c=r[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===c}}else{let o=r.reduce((c,a,h)=>(c[a.tokenTypeIdx]=!0,a.categoryMatches.forEach(d=>{c[d]=!0}),c),[]);return function(){let c=this.LA_FAST(1);return o[c.tokenTypeIdx]===!0}}}else return function(){e:for(let r=0;r<i;r++){let o=t[r],c=o.length;for(let a=0;a<c;a++){let h=this.LA_FAST(a+1);if(e(h,o[a])===!1)continue e}return!0}return!1}}var js=class extends de{constructor(e,s,n){super(),this.topProd=e,this.targetOccurrence=s,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,s,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===s?(this.restDef=n.concat(i),!0):!1}walkOption(e,s,n){this.checkIsTarget(e,x.OPTION,s,n)||super.walkOption(e,s,n)}walkAtLeastOne(e,s,n){this.checkIsTarget(e,x.REPETITION_MANDATORY,s,n)||super.walkOption(e,s,n)}walkAtLeastOneSep(e,s,n){this.checkIsTarget(e,x.REPETITION_MANDATORY_WITH_SEPARATOR,s,n)||super.walkOption(e,s,n)}walkMany(e,s,n){this.checkIsTarget(e,x.REPETITION,s,n)||super.walkOption(e,s,n)}walkManySep(e,s,n){this.checkIsTarget(e,x.REPETITION_WITH_SEPARATOR,s,n)||super.walkOption(e,s,n)}},zt=class extends Y{constructor(e,s,n){super(),this.targetOccurrence=e,this.targetProdType=s,this.targetRef=n,this.result=[]}checkIsTarget(e,s){e.idx===this.targetOccurrence&&this.targetProdType===s&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,x.OPTION)}visitRepetition(e){this.checkIsTarget(e,x.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,x.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,x.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,x.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,x.ALTERNATION)}};function di(t){let e=new Array(t);for(let s=0;s<t;s++)e[s]=[];return e}function Gs(t){let e=[""];for(let s=0;s<t.length;s++){let n=t[s],i=[];for(let r=0;r<e.length;r++){let o=e[r];i.push(o+"_"+n.tokenTypeIdx);for(let c=0;c<n.categoryMatches.length;c++){let a="_"+n.categoryMatches[c];i.push(o+a)}}e=i}return e}function va(t,e,s){for(let n=0;n<t.length;n++){if(n===s)continue;let i=t[n];for(let r=0;r<e.length;r++){let o=e[r];if(i[o]===!0)return!1}}return!0}function Ti(t,e){let s=t.map(o=>Vt([o],1)),n=di(s.length),i=s.map(o=>{let c={};return o.forEach(a=>{Gs(a.partialPath).forEach(d=>{c[d]=!0})}),c}),r=s;for(let o=1;o<=e;o++){let c=r;r=di(c.length);for(let a=0;a<c.length;a++){let h=c[a];for(let d=0;d<h.length;d++){let u=h[d].partialPath,p=h[d].suffixDef,E=Gs(u);if(va(i,E,a)||p.length===0||u.length===e){let y=n[a];if(Xt(y,u)===!1){y.push(u);for(let I=0;I<E.length;I++){let g=E[I];i[a][g]=!0}}}else{let y=Vt(p,o+1,u);r[a]=r[a].concat(y),y.forEach(I=>{Gs(I.partialPath).forEach(T=>{i[a][T]=!0})})}}}}return n}function ut(t,e,s,n){let i=new zt(t,x.ALTERNATION,n);return e.accept(i),Ti(i.result,s)}function dt(t,e,s,n){let i=new zt(t,s);e.accept(i);let r=i.result,c=new js(e,t,s).startWalking(),a=new C({definition:r}),h=new C({definition:c});return Ti([a,h],n)}function Xt(t,e){e:for(let s=0;s<t.length;s++){let n=t[s];if(n.length===e.length){for(let i=0;i<n.length;i++){let r=e[i],o=n[i];if((r===o||o.categoryMatchesMap[r.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function gi(t,e){return t.length<e.length&&t.every((s,n)=>{let i=e[n];return s===i||i.categoryMatchesMap[s.tokenTypeIdx]})}function Ai(t){return t.every(e=>e.every(s=>s.every(n=>n.categoryMatches.length===0)))}function Si(t){return t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName}).map(s=>Object.assign({type:j.CUSTOM_LOOKAHEAD_VALIDATION},s))}function Ri(t,e,s,n){let i=t.flatMap(a=>_a(a,s)),r=Da(t,e,s),o=t.flatMap(a=>wa(a,s)),c=t.flatMap(a=>Ma(a,t,n,s));return i.concat(r,o,c)}function _a(t,e){let s=new Ws;t.accept(s);let n=s.allProductions,i=Object.groupBy(n,xa),r=Object.fromEntries(Object.entries(i).filter(([c,a])=>a.length>1));return Object.values(r).map(c=>{let a=c[0],h=e.buildDuplicateFoundError(t,c),d=Z(a),u={message:h,type:j.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:d,occurrence:a.idx},p=yi(a);return p&&(u.parameter=p),u})}function xa(t){return`${Z(t)}_#_${t.idx}_#_${yi(t)}`}function yi(t){return t instanceof O?t.terminalType.name:t instanceof k?t.nonTerminalName:""}var Ws=class extends Y{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 Ma(t,e,s,n){let i=[];if(e.reduce((o,c)=>c.name===t.name?o+1:o,0)>1){let o=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:s});i.push({message:o,type:j.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function Oi(t,e,s){let n=[],i;return e.includes(t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${s}<-as it is not defined in any of the super grammars `,n.push({message:i,type:j.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Vs(t,e,s,n=[]){let i=[],r=Yt(e.definition);if(r.length===0)return[];{let o=t.name;r.includes(t)&&i.push({message:s.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:j.LEFT_RECURSION,ruleName:o});let a=n.concat([t]),d=r.filter(u=>!a.includes(u)).flatMap(u=>{let p=[...n];return p.push(u),Vs(t,u,s,p)});return i.concat(d)}}function Yt(t){let e=[];if(t.length===0)return e;let s=t[0];if(s instanceof k)e.push(s.referencedRule);else if(s instanceof C||s instanceof b||s instanceof F||s instanceof B||s instanceof w||s instanceof N)e=e.concat(Yt(s.definition));else if(s instanceof U)e=s.definition.map(r=>Yt(r.definition)).flat();else if(!(s instanceof O))throw Error("non exhaustive match");let n=Oe(s),i=t.length>1;if(n&&i){let r=t.slice(1);return e.concat(Yt(r))}else return e}var pt=class extends Y{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Li(t,e){let s=new pt;return t.accept(s),s.alternations.flatMap(r=>r.definition.slice(0,-1).flatMap((c,a)=>ui([c],[],pe,1).length===0?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:r,emptyChoiceIdx:a}),type:j.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:r.idx,alternative:a+1}]:[]))}function Ii(t,e,s){let n=new pt;t.accept(n);let i=n.alternations;return i=i.filter(o=>o.ignoreAmbiguities!==!0),i.flatMap(o=>{let c=o.idx,a=o.maxLookahead||e,h=ut(c,t,a,o),d=Ua(h,o,t,s),u=Pa(h,o,t,s);return d.concat(u)})}var Ks=class extends Y{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 wa(t,e){let s=new pt;return t.accept(s),s.alternations.flatMap(r=>r.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:r}),type:j.TOO_MANY_ALTS,ruleName:t.name,occurrence:r.idx}]:[])}function Ni(t,e,s){let n=[];return t.forEach(i=>{let r=new Ks;i.accept(r),r.allProductions.forEach(c=>{let a=Ht(c),h=c.maxLookahead||e,d=c.idx;if(dt(d,i,a,h)[0].flat().length===0){let E=s.buildEmptyRepetitionError({topLevelRule:i,repetition:c});n.push({message:E,type:j.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function Ua(t,e,s,n){let i=[];return t.reduce((c,a,h)=>(e.definition[h].ignoreAmbiguities===!0||a.forEach(d=>{let u=[h];t.forEach((p,E)=>{h!==E&&Xt(p,d)&&e.definition[E].ignoreAmbiguities!==!0&&u.push(E)}),u.length>1&&!Xt(i,d)&&(i.push(d),c.push({alts:u,path:d}))}),c),[]).map(c=>{let a=c.alts.map(d=>d+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:s,alternation:e,ambiguityIndices:a,prefixPath:c.path}),type:j.AMBIGUOUS_ALTS,ruleName:s.name,occurrence:e.idx,alternatives:c.alts}})}function Pa(t,e,s,n){let i=t.reduce((o,c,a)=>{let h=c.map(d=>({idx:a,path:d}));return o.concat(h)},[]);return i.flatMap(o=>{if(e.definition[o.idx].ignoreAmbiguities===!0)return[];let a=o.idx,h=o.path;return i.filter(p=>e.definition[p.idx].ignoreAmbiguities!==!0&&p.idx<a&&gi(p.path,h)).map(p=>{let E=[p.idx+1,a+1],R=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:s,alternation:e,ambiguityIndices:E,prefixPath:p.path}),type:j.AMBIGUOUS_PREFIX_ALTS,ruleName:s.name,occurrence:R,alternatives:E}})})}function Da(t,e,s){let n=[],i=e.map(r=>r.name);return t.forEach(r=>{let o=r.name;if(i.includes(o)){let c=s.buildNamespaceConflictError(r);n.push({message:c,type:j.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),n}function ki(t){let e=Object.assign({errMsgProvider:li},t),s={};return t.rules.forEach(n=>{s[n.name]=n}),hi(s,e.errMsgProvider)}function Ci(t){var e;let s=(e=t.errMsgProvider)!==null&&e!==void 0?e:ae;return Ri(t.rules,t.tokenTypes,s,t.grammarName)}var bi="MismatchedTokenException",vi="NoViableAltException",_i="EarlyExitException",xi="NotAllInputParsedException",Mi=[bi,vi,_i,xi];Object.freeze(Mi);function Se(t){return Mi.includes(t.name)}var We=class extends Error{constructor(e,s){super(e),this.token=s,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},ve=class extends We{constructor(e,s,n){super(e,s),this.previousToken=n,this.name=bi}},ft=class extends We{constructor(e,s,n){super(e,s),this.previousToken=n,this.name=vi}},mt=class extends We{constructor(e,s){super(e,s),this.name=xi}},Et=class extends We{constructor(e,s,n){super(e,s),this.previousToken=n,this.name=_i}};var zs={},Xs="InRuleRecoveryException",Hs=class extends Error{constructor(e){super(e),this.name=Xs}},qt=class{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,"recoveryEnabled")?e.recoveryEnabled:q.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Fa)}getTokenToInsert(e){let s=be(e,"",-1,-1,-1,-1,-1,-1);return s.isInsertedInRecovery=!0,s}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,s,n,i){let r=this.findReSyncTokenType(),o=this.exportLexerState(),c=[],a=!1,h=this.LA_FAST(1),d=this.LA_FAST(1),u=()=>{let p=this.LA(0),E=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:h,previous:p,ruleName:this.getCurrRuleFullName()}),R=new ve(E,h,this.LA(0));R.resyncedTokens=c.slice(0,-1),this.SAVE_ERROR(R)};for(;!a;)if(this.tokenMatcher(d,i)){u();return}else if(n.call(this)){u(),e.apply(this,s);return}else this.tokenMatcher(d,r)?a=!0:(d=this.SKIP_TOKEN(),this.addToResyncTokens(d,c));this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,s,n){return!(n===!1||this.tokenMatcher(this.LA_FAST(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,s)))}getNextPossibleTokenTypes(e){let s=e.ruleStack[0],i=this.getGAstProductions()[s];return new jt(i,e).startWalking()}getFollowsForInRuleRecovery(e,s){let n=this.getCurrentGrammarPath(e,s);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,s){if(this.canRecoverWithSingleTokenInsertion(e,s))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Hs("sad sad panda")}canPerformInRuleRecovery(e,s){return this.canRecoverWithSingleTokenInsertion(e,s)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,s){if(!this.canTokenTypeBeInsertedInRecovery(e)||s.length===0)return!1;let n=this.LA_FAST(1);return s.find(r=>this.tokenMatcher(n,r))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let s=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(s).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),s=this.LA_FAST(1),n=2;for(;;){let i=e.find(r=>ct(s,r));if(i!==void 0)return i;s=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return zs;let e=this.currRuleShortName,s=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:s,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,s=this.RULE_OCCURRENCE_STACK,n=this.RULE_STACK_IDX+1,i=new Array(n);for(let r=0;r<n;r++)r===0?i[r]=zs:i[r]={ruleName:this.shortRuleNameToFullName(e[r]),idxInCallingRule:s[r],inRule:this.shortRuleNameToFullName(e[r-1])};return i}flattenFollowSet(){return this.buildFullFollowKeyStack().map(s=>this.getFollowSetFromFollowKey(s)).flat()}getFollowSetFromFollowKey(e){if(e===zs)return[Q];let s=e.ruleName+e.idxInCallingRule+vt+e.inRule;return this.resyncFollows[s]}addToResyncTokens(e,s){return this.tokenMatcher(e,Q)||s.push(e),s}reSyncTo(e){let s=[],n=this.LA_FAST(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,s);return s.slice(0,-1)}attemptInRepetitionRecovery(e,s,n,i,r,o,c){}getCurrentGrammarPath(e,s){let n=this.getHumanReadableRuleStack(),i=this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:s}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,s=new Array(e);for(let n=0;n<e;n++)s[n]=this.shortRuleNameToFullName(this.RULE_STACK[n]);return s}};function Fa(t,e,s,n,i,r,o){var c,a,h;let d=n|i,u=(c=(a=this.firstAfterRepMap)[h=this.currRuleShortName])!==null&&c!==void 0?c:a[h]=[],p=u[d];if(p===void 0){let I=this.getCurrRuleFullName(),g=this.getGAstProductions()[I];p=new r(g,i).startWalking(),u[d]=p}let E=p.token,R=p.occurrence,y=p.isEndOfRule;this.RULE_STACK_IDX===0&&y&&E===void 0&&(E=Q,R=1),!(E===void 0||R===void 0)&&this.shouldInRepetitionRecoveryBeTried(E,R,o)&&this.tryInRepetitionRecovery(t,e,s,E)}var Tt=class{constructor(e){var s;this.maxLookahead=(s=e?.maxLookahead)!==null&&s!==void 0?s:q.maxLookahead}validate(e){let s=this.validateNoLeftRecursion(e.rules);if(s.length===0){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),r=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...s,...n,...i,...r]}return s}validateNoLeftRecursion(e){return e.flatMap(s=>Vs(s,s,ae))}validateEmptyOrAlternatives(e){return e.flatMap(s=>Li(s,ae))}validateAmbiguousAlternationAlternatives(e,s){return e.flatMap(n=>Ii(n,s,ae))}validateSomeNonEmptyLookaheadPath(e,s){return Ni(e,s,ae)}buildLookaheadForAlternation(e){return pi(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,mi)}buildLookaheadForOptional(e){return fi(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Ht(e.prodType),Ei)}};var Zt=class{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:q.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,"maxLookahead")?e.maxLookahead:q.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,"lookaheadStrategy")?e.lookaheadStrategy:new Tt({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(s=>{this.TRACE_INIT(`${s.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:r,repetitionMandatory:o,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:a}=Ba(s);n.forEach(h=>{let d=h.idx===0?"":h.idx;this.TRACE_INIT(`${Z(h)}${d}`,()=>{let u=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:h.idx,rule:s,maxLookahead:h.maxLookahead||this.maxLookahead,hasPredicates:h.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[s.name],256|h.idx,u)})}),i.forEach(h=>{this.computeLookaheadFunc(s,h.idx,768,"Repetition",h.maxLookahead,Z(h))}),r.forEach(h=>{this.computeLookaheadFunc(s,h.idx,512,"Option",h.maxLookahead,Z(h))}),o.forEach(h=>{this.computeLookaheadFunc(s,h.idx,1024,"RepetitionMandatory",h.maxLookahead,Z(h))}),c.forEach(h=>{this.computeLookaheadFunc(s,h.idx,1536,"RepetitionMandatoryWithSeparator",h.maxLookahead,Z(h))}),a.forEach(h=>{this.computeLookaheadFunc(s,h.idx,1280,"RepetitionWithSeparator",h.maxLookahead,Z(h))})})})}computeLookaheadFunc(e,s,n,i,r,o){this.TRACE_INIT(`${o}${s===0?"":s}`,()=>{let c=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:s,rule:e,maxLookahead:r||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i});this.setLaFuncCache(this.fullRuleNameToShort[e.name],n|s,c)})}setLaFuncCache(e,s,n){let i=this.lookAheadFuncsCache[e];i===void 0&&(i=[],this.lookAheadFuncsCache[e]=i),i[s]=n}},Ys=class extends Y{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)}},Jt=new Ys;function Ba(t){Jt.reset(),t.accept(Jt);let e=Jt.dslMethods;return Jt.reset(),e}function Zs(t,e){t.startOffset===-1?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function Qs(t,e){t.startOffset===-1?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function wi(t,e,s){t.children[s]===void 0?t.children[s]=[e]:t.children[s].push(e)}function Ui(t,e,s){t.children[e]===void 0?t.children[e]=[s]:t.children[e].push(s)}var $a="name";function en(t,e){Object.defineProperty(t,$a,{enumerable:!1,configurable:!0,writable:!1,value:e})}function Ga(t,e){let s=Object.keys(t),n=s.length;for(let i=0;i<n;i++){let r=s[i],o=t[r],c=o.length;for(let a=0;a<c;a++){let h=o[a];h.tokenTypeIdx===void 0&&this[h.name](h.children,e)}}}function Pi(t,e){let s=function(){};en(s,t+"BaseSemantics");let n={visit:function(i,r){if(Array.isArray(i)&&(i=i[0]),i!==void 0)return this[i.name](i.children,r)},validateVisitor:function(){let i=ja(this,e);if(i.length!==0){let r=i.map(o=>o.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
87
|
+
${r.join(`
|
|
88
|
+
|
|
89
|
+
`).replace(/\n/g,`
|
|
90
|
+
`)}`)}}};return s.prototype=n,s.prototype.constructor=s,s._RULE_NAMES=e,s}function Di(t,e,s){let n=function(){};en(n,t+"BaseSemanticsWithDefaults");let i=Object.create(s.prototype);return e.forEach(r=>{i[r]=Ga}),n.prototype=i,n.prototype.constructor=n,n}var tn;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(tn||(tn={}));function ja(t,e){return Wa(t,e)}function Wa(t,e){return e.filter(i=>typeof t[i]!="function").map(i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:tn.MISSING_METHOD,methodName:i})).filter(Boolean)}var ss=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,"nodeLocationTracking")?e.nodeLocationTracking:q.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{};else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Qs,this.setNodeLocationFromNode=Qs,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=Zs,this.setNodeLocationFromNode=Zs,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 s=this.LA_FAST(1);e.location={startOffset:s.startOffset,startLine:s.startLine,startColumn:s.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let s={name:e,children:Object.create(null)};this.setInitialNodeLocation(s),this.CST_STACK.push(s)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let s=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=s.startOffset?(n.endOffset=s.endOffset,n.endLine=s.endLine,n.endColumn=s.endColumn):(n.startOffset=-1,n.startLine=-1,n.startColumn=-1)}cstPostRuleOnlyOffset(e){let s=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=s.startOffset?n.endOffset=s.endOffset:n.startOffset=-1}cstPostTerminal(e,s){let n=this.CST_STACK[this.CST_STACK.length-1];wi(n,s,e),this.setNodeLocationFromToken(n.location,s)}cstPostNonTerminal(e,s){let n=this.CST_STACK[this.CST_STACK.length-1];Ui(n,s,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=Pi(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let e=Di(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]}};var ns=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)):me}LA_FAST(e){let s=this.currIdx+e;return this.tokVector[s]}LA(e){let s=this.currIdx+e;return s<0||this.tokVectorLength<=s?me:this.tokVector[s]}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()}};var is=class{ACTION(e){return e.call(this)}consume(e,s,n){return this.consumeInternal(s,e,n)}subrule(e,s,n){return this.subruleInternal(s,e,n)}option(e,s){return this.optionInternal(s,e)}or(e,s){return this.orInternal(s,e)}many(e,s){return this.manyInternal(e,s)}atLeastOne(e,s){return this.atLeastOneInternal(e,s)}CONSUME(e,s){return this.consumeInternal(e,0,s)}CONSUME1(e,s){return this.consumeInternal(e,1,s)}CONSUME2(e,s){return this.consumeInternal(e,2,s)}CONSUME3(e,s){return this.consumeInternal(e,3,s)}CONSUME4(e,s){return this.consumeInternal(e,4,s)}CONSUME5(e,s){return this.consumeInternal(e,5,s)}CONSUME6(e,s){return this.consumeInternal(e,6,s)}CONSUME7(e,s){return this.consumeInternal(e,7,s)}CONSUME8(e,s){return this.consumeInternal(e,8,s)}CONSUME9(e,s){return this.consumeInternal(e,9,s)}SUBRULE(e,s){return this.subruleInternal(e,0,s)}SUBRULE1(e,s){return this.subruleInternal(e,1,s)}SUBRULE2(e,s){return this.subruleInternal(e,2,s)}SUBRULE3(e,s){return this.subruleInternal(e,3,s)}SUBRULE4(e,s){return this.subruleInternal(e,4,s)}SUBRULE5(e,s){return this.subruleInternal(e,5,s)}SUBRULE6(e,s){return this.subruleInternal(e,6,s)}SUBRULE7(e,s){return this.subruleInternal(e,7,s)}SUBRULE8(e,s){return this.subruleInternal(e,8,s)}SUBRULE9(e,s){return this.subruleInternal(e,9,s)}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,s,n=Ke){if(this.definedRulesNames.includes(e)){let o={message:ae.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:j.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(o)}this.definedRulesNames.push(e);let i=this.defineRule(e,s,n);return this[e]=i,i}OVERRIDE_RULE(e,s,n=Ke){let i=Oi(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let r=this.defineRule(e,s,n);return this[e]=r,r}BACKTRACK(e,s){var n;let i=(n=e.coreRule)!==null&&n!==void 0?n:e;return function(){this.isBackTrackingStack.push(1);let r=this.saveRecogState();try{return i.apply(this,s),!0}catch(o){if(Se(o))return!1;throw o}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return bt(Object.values(this.gastProductionsCache))}};var rs=class{initRecognizerEngine(e,s){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=Ge,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(s,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
91
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
92
|
+
For Further details.`);if(Array.isArray(e)){if(e.length===0)throw Error(`A Token Vocabulary cannot be empty.
|
|
93
|
+
Note that the first argument for the parser constructor
|
|
94
|
+
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
95
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
96
|
+
For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((r,o)=>(r[o.name]=o,r),{});else if(Object.hasOwn(e,"modes")&&Object.values(e.modes).flat().every(ei)){let r=Object.values(e.modes).flat(),o=[...new Set(r)];this.tokensMap=o.reduce((c,a)=>(c[a.name]=a,c),{})}else if(typeof e=="object"&&e!==null)this.tokensMap=Object.assign({},e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Q;let i=(Object.hasOwn(e,"modes")?Object.values(e.modes).flat():Object.values(e)).every(r=>{var o;return((o=r.categoryMatches)===null||o===void 0?void 0:o.length)==0});this.tokenMatcher=i?Ge:pe,fe(Object.values(this.tokensMap))}defineRule(e,s,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
97
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=Object.hasOwn(n,"resyncEnabled")?n.resyncEnabled:Ke.resyncEnabled,r=Object.hasOwn(n,"recoveryValueFunc")?n.recoveryValueFunc:Ke.recoveryValueFunc,o=this.ruleShortNameIdx++;this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let c;return this.outputCst===!0?c=function(...u){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),s.apply(this,u);let p=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(p),p}catch(p){return this.invokeRuleCatch(p,i,r)}finally{this.ruleFinallyStateUpdate()}}:c=function(...u){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),s.apply(this,u)}catch(p){return this.invokeRuleCatch(p,i,r)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...u){this.onBeforeParse(e);try{return c.apply(this,u)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:s,coreRule:c})}invokeRuleCatch(e,s,n){let i=this.RULE_STACK_IDX===0,r=s&&!this.isBackTracking()&&this.recoveryEnabled;if(Se(e)){let o=e;if(r){let c=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(c))if(o.resyncedTokens=this.reSyncTo(c),this.outputCst){let a=this.CST_STACK[this.CST_STACK.length-1];return a.recoveredNode=!0,a}else return n(e);else{if(this.outputCst){let a=this.CST_STACK[this.CST_STACK.length-1];a.recoveredNode=!0,o.partialCstResult=a}throw o}}else{if(i)return this.moveToTerminatedState(),n(e);throw o}}else throw e}optionInternal(e,s){let n=512|s;return this.optionInternalLogic(e,s,n)}optionInternalLogic(e,s,n){let i=this.currRuleLookaheadFuncs[n],r;if(typeof e!="function"){r=e.DEF;let o=e.GATE;if(o!==void 0){let c=i;i=()=>o.call(this)&&c.call(this)}}else r=e;if(i.call(this)===!0)return r.call(this)}atLeastOneInternal(e,s){let n=1024|e;return this.atLeastOneInternalLogic(e,s,n)}atLeastOneInternalLogic(e,s,n){let i=this.currRuleLookaheadFuncs[n],r;if(typeof s!="function"){r=s.DEF;let o=s.GATE;if(o!==void 0){let c=i;i=()=>o.call(this)&&c.call(this)}}else r=s;if(i.call(this)===!0){let o=this.doSingleRepetition(r);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(r)}else throw this.raiseEarlyExitException(e,x.REPETITION_MANDATORY,s.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,s],i,1024,e,Kt)}atLeastOneSepFirstInternal(e,s){let n=1536|e;this.atLeastOneSepFirstInternalLogic(e,s,n)}atLeastOneSepFirstInternalLogic(e,s,n){let i=s.DEF,r=s.SEP;if(this.currRuleLookaheadFuncs[n].call(this)===!0){i.call(this);let c=()=>this.tokenMatcher(this.LA_FAST(1),r);for(;this.tokenMatcher(this.LA_FAST(1),r)===!0;)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,c,i,ht],c,1536,e,ht)}else throw this.raiseEarlyExitException(e,x.REPETITION_MANDATORY_WITH_SEPARATOR,s.ERR_MSG)}manyInternal(e,s){let n=768|e;return this.manyInternalLogic(e,s,n)}manyInternalLogic(e,s,n){let i=this.currRuleLookaheadFuncs[n],r;if(typeof s!="function"){r=s.DEF;let c=s.GATE;if(c!==void 0){let a=i;i=()=>c.call(this)&&a.call(this)}}else r=s;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,s],i,768,e,Wt,o)}manySepFirstInternal(e,s){let n=1280|e;this.manySepFirstInternalLogic(e,s,n)}manySepFirstInternalLogic(e,s,n){let i=s.DEF,r=s.SEP;if(this.currRuleLookaheadFuncs[n].call(this)===!0){i.call(this);let c=()=>this.tokenMatcher(this.LA_FAST(1),r);for(;this.tokenMatcher(this.LA_FAST(1),r)===!0;)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,c,i,lt],c,1280,e,lt)}}repetitionSepSecondInternal(e,s,n,i,r){for(;n();)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,n,i,r],n,1536,e,r)}doSingleRepetition(e){let s=this.getLexerPosition();return e.call(this),this.getLexerPosition()>s}orInternal(e,s){let n=256|s,i=Array.isArray(e)?e:e.DEF,o=this.currRuleLookaheadFuncs[n].call(this,i);if(o!==void 0)return i[o].ALT.call(this);this.raiseNoAltException(s,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,s,n){let i;try{let r=n!==void 0?n.ARGS:void 0;return this.subruleIdx=s,i=e.coreRule.apply(this,r),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(r){throw this.subruleInternalError(r,n,e.ruleName)}}subruleInternalError(e,s,n){throw Se(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,s!==void 0&&s.LABEL!==void 0?s.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,s,n){let i;try{let r=this.LA_FAST(1);this.tokenMatcher(r,e)===!0?(this.consumeToken(),i=r):this.consumeInternalError(e,r,n)}catch(r){i=this.consumeInternalRecovery(e,s,r)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i}consumeInternalError(e,s,n){let i,r=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:s,previous:r,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new ve(i,s,r))}consumeInternalRecovery(e,s,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,s);try{return this.tryInRuleRecovery(e,i)}catch(r){throw r.name===Xs?n:r}}else throw n}saveRecogState(){let e=this.errors,s=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:s,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let s=e.RULE_STACK;for(let n=0;n<s.length;n++)this.RULE_STACK[n]=s[n];this.RULE_STACK_IDX=s.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,s,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(s)}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),Q)}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 s=0;s<this.maxLookahead+1;s++)this.tokVector.push(me)}onAfterParse(e){if(this.isAtEndOfInput()===!1){let s=this.LA(1),n=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:s,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new mt(n,s))}for(;this.tokVector.at(-1)===me;)this.tokVector.pop()}};var as=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,"errorMessageProvider")?e.errorMessageProvider:q.errorMessageProvider}SAVE_ERROR(e){if(Se(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,s,n){let i=this.getCurrRuleFullName(),r=this.getGAstProductions()[i],c=dt(e,r,s,this.maxLookahead)[0],a=[];for(let d=1;d<=this.maxLookahead;d++)a.push(this.LA(d));let h=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:c,actual:a,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new Et(h,this.LA(1),this.LA(0)))}raiseNoAltException(e,s){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],r=ut(e,i,this.maxLookahead),o=[];for(let h=1;h<=this.maxLookahead;h++)o.push(this.LA(h));let c=this.LA(0),a=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:o,previous:c,customUserDescription:s,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new ft(a,this.LA(1),c))}};var ls={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ls);var Fi=!0,Bi=255,Gi=A({name:"RECORDING_PHASE_TOKEN",pattern:_.NA});fe([Gi]);var ji=be(Gi,`This IToken indicates the Parser is in Recording Phase
|
|
98
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(ji);var Ka={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
99
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},os=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 s=e>0?e:"";this[`CONSUME${s}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${s}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},this[`OPTION${s}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${s}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${s}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${s}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${s}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${s}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,s,n){return this.consumeInternalRecord(s,e,n)},this.subrule=function(e,s,n){return this.subruleInternalRecord(s,e,n)},this.option=function(e,s){return this.optionInternalRecord(s,e)},this.or=function(e,s){return this.orInternalRecord(s,e)},this.many=function(e,s){this.manyInternalRecord(e,s)},this.atLeastOne=function(e,s){this.atLeastOneInternalRecord(e,s)},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 s=0;s<10;s++){let n=s>0?s:"";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,s){return()=>!0}LA_RECORD(e){return me}topLevelRuleRecord(e,s){try{let n=new X({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),s.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
|
|
100
|
+
This error was thrown during the "grammar recording phase" For more info see:
|
|
101
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,s){return At.call(this,b,e,s)}atLeastOneInternalRecord(e,s){At.call(this,F,s,e)}atLeastOneSepFirstInternalRecord(e,s){At.call(this,B,s,e,Fi)}manyInternalRecord(e,s){At.call(this,N,s,e)}manySepFirstInternalRecord(e,s){At.call(this,w,s,e,Fi)}orInternalRecord(e,s){return Va.call(this,e,s)}subruleInternalRecord(e,s,n){if(cs(s),!e||!Object.hasOwn(e,"ruleName")){let c=new Error(`<SUBRULE${$i(s)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
102
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw c.KNOWN_RECORDER_ERROR=!0,c}let i=this.recordingProdStack.at(-1),r=e.ruleName,o=new k({idx:s,nonTerminalName:r,label:n?.LABEL,referencedRule:void 0});return i.definition.push(o),this.outputCst?Ka:ls}consumeInternalRecord(e,s,n){if(cs(s),!Ps(e)){let o=new Error(`<CONSUME${$i(s)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
103
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}let i=this.recordingProdStack.at(-1),r=new O({idx:s,terminalType:e,label:n?.LABEL});return i.definition.push(r),ji}};function At(t,e,s,n=!1){cs(s);let i=this.recordingProdStack.at(-1),r=typeof e=="function"?e:e.DEF,o=new t({definition:[],idx:s});return n&&(o.separator=e.SEP),Object.hasOwn(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),r.call(this),i.definition.push(o),this.recordingProdStack.pop(),ls}function Va(t,e){cs(e);let s=this.recordingProdStack.at(-1),n=Array.isArray(t)===!1,i=n===!1?t:t.DEF,r=new U({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});Object.hasOwn(t,"MAX_LOOKAHEAD")&&(r.maxLookahead=t.MAX_LOOKAHEAD);let o=i.some(c=>typeof c.GATE=="function");return r.hasPredicates=o,s.definition.push(r),i.forEach(c=>{let a=new C({definition:[]});r.definition.push(a),Object.hasOwn(c,"IGNORE_AMBIGUITIES")?a.ignoreAmbiguities=c.IGNORE_AMBIGUITIES:Object.hasOwn(c,"GATE")&&(a.ignoreAmbiguities=!0),this.recordingProdStack.push(a),c.ALT.call(this),this.recordingProdStack.pop()}),ls}function $i(t){return t===0?"":`${t}`}function cs(t){if(t<0||t>Bi){let e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
104
|
+
Idx value must be a none negative value smaller than ${Bi+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var hs=class{initPerformanceTracer(e){if(Object.hasOwn(e,"traceInitPerf")){let s=e.traceInitPerf,n=typeof s=="number";this.traceInitMaxIdent=n?s:1/0,this.traceInitPerf=n?s>0:s}else this.traceInitMaxIdent=0,this.traceInitPerf=q.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,s){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:i,value:r}=Qe(s),o=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${n}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,r}else return s()}};function Wi(t,e){e.forEach(s=>{let n=s.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let r=Object.getOwnPropertyDescriptor(n,i);r&&(r.get||r.set)?Object.defineProperty(t.prototype,i,r):t.prototype[i]=s.prototype[i]})})}var me=be(Q,"",-1,-1,-1,-1,-1,-1);Object.freeze(me);var q=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Gt,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ke=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),j;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(j||(j={}));var St=class t{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 e;this.selfAnalysisDone=!0;let s=this.className;this.TRACE_INIT("toFastProps",()=>{et(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach(i=>{let o=this[i].originalGrammarAction,c;this.TRACE_INIT(`${i} Rule`,()=>{c=this.topLevelRuleRecord(i,o)}),this.gastProductionsCache[i]=c})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=ki({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(n.length===0&&this.skipValidations===!1){let i=Ci({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:ae,grammarName:s}),r=Si({lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:s});this.definitionErrors=this.definitionErrors.concat(i,r)}}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=Pn(Object.values(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,r;(r=(i=this.lookaheadStrategy).initialize)===null||r===void 0||r.call(i,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw e=this.definitionErrors.map(i=>i.message),new Error(`Parser Definition Errors detected:
|
|
105
|
+
${e.join(`
|
|
106
|
+
-------------------------------
|
|
107
|
+
`)}`)})}constructor(e,s){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(s),n.initLexerAdapter(),n.initLooksAhead(s),n.initRecognizerEngine(e,s),n.initRecoverable(s),n.initTreeBuilder(s),n.initGastRecorder(s),n.initPerformanceTracer(s),Object.hasOwn(s,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
108
|
+
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
109
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
110
|
+
For further details.`);this.skipValidations=Object.hasOwn(s,"skipValidations")?s.skipValidations:q.skipValidations}};St.DEFER_DEFINITION_ERRORS_HANDLING=!1;Wi(St,[qt,Zt,ss,ns,rs,is,as,os,hs]);var Rt=class extends St{constructor(e,s=q){let n=Object.assign({},s);n.outputCst=!0,super(e,n)}};var ze=l(t=>t!==void 0&&t>=0,"isKnownLocation");function Zi(t,e){let s=t.lexer.tokenize(e);if(s.errors.length>0){let i=s.errors[0],r=ze(i.offset)?i.offset:e.length,o=r+(ze(i.length)?i.length:0);throw new Error(`Error lexing ${t.diagramType} diagram: ${i.message} at line ${i.line??1}, column ${i.column??1} [${r},${o})`)}t.parser.input=s.tokens;let n=t.entry();if(t.parser.errors.length>0)throw new Error(`Error parsing ${t.diagramType} diagram: ${t.parser.errors[0].message}`);t.visit(n)}l(Zi,"runChevrotainParse");var M={SOLID_ARROW:0,BACK_ARROW:1,LINE_SOLID:2,CIRCLE_ARROW:3,CROSS_ARROW:4,CIRCLE_ARROW_REVERSED:5,CROSS_ARROW_REVERSED:6},Ha="LR",Xa=An.usecase,hn=l(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:Ha,relationshipCounter:0,noteCounter:0,accTitle:"",accDescription:"",ast:void 0,config:structuredClone(Xa)}),"createModel"),Ya=l(t=>{if(!(t.actors instanceof Map)||!(t.useCases instanceof Map)||!(t.systemBoundaries instanceof Map)||!Array.isArray(t.relationships)||!(t.notes instanceof Map)||!(t.jsonNodes instanceof Map)||!(t.classDefs instanceof Map)||!(t.symbols instanceof Map)||!["TB","TD","BT","RL","LR"].includes(t.direction)||!Number.isSafeInteger(t.relationshipCounter)||t.relationshipCounter<0||!Number.isSafeInteger(t.noteCounter)||t.noteCounter<0||typeof t.accTitle!="string"||typeof t.accDescription!="string"||!t.config)throw new Error("Cannot commit an incomplete usecase model")},"assertCompleteModel"),L=hn(),qa=l(()=>structuredClone(L.config),"getConfig"),Ja=l(()=>L.ast,"getAST"),Za=l(t=>{let e=structuredClone(t);Ya(e);let s=Ls(),n=Is();try{kt(e.accTitle),Ct(e.accDescription),L=e}catch(i){throw kt(s),Ct(n),i}},"commit"),Qa=l(()=>{L=hn(),yn()},"clear"),eo=l(()=>L.actors,"getActors"),to=l(t=>L.actors.get(t),"getActor"),so=l(()=>L.useCases,"getUseCases"),no=l(t=>L.useCases.get(t),"getUseCase"),io=l(()=>L.systemBoundaries,"getSystemBoundaries"),ro=l(t=>L.systemBoundaries.get(t),"getSystemBoundary"),ao=l(()=>L.relationships,"getRelationships"),oo=l(()=>L.notes,"getNotes"),co=l(t=>L.notes.get(t),"getNote"),lo=l(()=>L.jsonNodes,"getJsonNodes"),ho=l(t=>L.jsonNodes.get(t),"getJsonNode"),uo=l(()=>L.classDefs,"getClassDefs"),po=l(t=>L.classDefs.get(t),"getClassDef"),Qi=l(()=>L.direction,"getDirection"),_e=l(t=>{let e=new Map;for(let s of["default",...t]){let n=L.classDefs.get(s);if(n)for(let i of n.styles){let r=i.trim(),o=r.indexOf(":"),c=(o===-1?r:r.slice(0,o)).trim();c&&e.set(c,r)}}return[...e.values()]},"getCompiledStyles"),fo=l(t=>t.replaceAll("~","~0").replaceAll("/","~1"),"escapeJsonPointerPart"),Ki=l(t=>typeof t=="string"?t:t===null?"null":String(t),"displayJsonScalar"),mo=l((t,e,s=n=>n)=>{let n=[],i=l((o,c,a)=>{n.push({key:s(o),accessibleKey:s(c),value:s(a)})},"append"),r=l((o,c,a)=>{if(Array.isArray(o)){if(o.length===0){i(c,c,"[]");return}if(o.every(d=>d===null||["string","number","boolean"].includes(typeof d))){for(let[d,u]of o.entries())i(d===0?c:"",c,Ki(u));return}for(let[d,u]of o.entries())r(u,`${c}[${d}]`,`${a}/${d}`);return}if(o!==null&&typeof o=="object"){let h=o,d=e[a]??Object.keys(h);if(d.length===0){i(c,c,"{}");return}for(let u of d){let p=c?`${c}.${u}`:u;r(h[u],p,`${a}/${fo(u)}`)}return}i(c,c,Ki(o))},"visit");return r(t,"",""),n},"flattenJsonRows"),Eo=l(t=>{switch(t.type){case"hollow":return"usecaseActorHollow";case"awesome":return"usecaseActorAwesome";case"icon":return"usecaseActorIcon";case"normal":return"usecaseActor"}},"actorShape"),To=l(t=>t.shape==="ellipse"?t.business?"usecaseBusiness":"usecaseEllipse":t.shape,"useCaseShape"),go=l(t=>{switch(t){case M.SOLID_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point"};case M.BACK_ARROW:return{arrowTypeStart:"arrow_point",arrowTypeEnd:"none"};case M.CIRCLE_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_circle"};case M.CROSS_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_cross"};case M.CIRCLE_ARROW_REVERSED:return{arrowTypeStart:"arrow_circle",arrowTypeEnd:"none"};case M.CROSS_ARROW_REVERSED:return{arrowTypeStart:"arrow_cross",arrowTypeEnd:"none"};case M.LINE_SOLID:return{arrowTypeStart:"none",arrowTypeEnd:"none"}}},"associationMarkers"),Ao=l(t=>{switch(t.type){case"include":case"extend":return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point",pattern:"dotted",label:t.type,labelType:"text"};case"generalization":return{arrowTypeStart:"none",arrowTypeEnd:"extension",pattern:"solid"};case"association":return{...go(t.arrowType),pattern:"solid",...t.label?{label:t.label}:{},...t.labelType?{labelType:t.labelType}:{}}}},"relationshipVisuals"),So=l(t=>t.animate||t.animation?[`edge-animation-${t.animation??"fast"}`]:[],"animationClasses"),yt=l((...t)=>t.filter(e=>!!e).join(" "),"classNames"),Ro=l(()=>{let t=Ns(),e={...L.config,...t.usecase},s=l(a=>Rn(a,t),"sanitize"),n=l(a=>s(L.actors.get(a)?.label??L.useCases.get(a)?.label??L.jsonNodes.get(a)?.id??L.notes.get(a)?.label??a),"endpointLabel"),i=[],r=[],o=0,c=0;for(let a of L.actors.values())i.push({id:a.id,label:s(a.label),labelType:a.labelType,shape:Eo(a),isGroup:!1,padding:10,look:t.look,colorIndex:o++,cssClasses:yt("default","usecase-actor",`usecase-actor-${a.type}`,a.business&&"usecase-business",...a.classes),cssStyles:[...a.styles],cssCompiledStyles:_e(a.classes),actorType:a.type,business:a.business,...a.icon?{icon:a.icon}:{},...a.stereotype?{stereotype:s(a.stereotype)}:{},...a.parentId?{parentId:a.parentId}:{}});for(let a of L.useCases.values())i.push({id:a.id,label:s(a.label),labelType:a.labelType,shape:To(a),isGroup:!1,padding:a.shape==="ellipse"?20:10,look:t.look,colorIndex:o++,cssClasses:yt("default","usecase-element",`usecase-${a.shape}`,a.business&&"usecase-business",...a.classes),cssStyles:[...a.styles],cssCompiledStyles:_e(a.classes),business:a.business,...a.stereotype?{stereotype:s(a.stereotype)}:{},...a.parentId?{parentId:a.parentId}:{}});for(let a of L.notes.values())i.push({id:a.id,label:s(a.label),labelType:a.labelType,shape:"note",isGroup:!1,padding:10,look:t.look,cssClasses:"default usecase-note",cssStyles:[],cssCompiledStyles:_e([]),noteTarget:a.target,noteTargetLabel:s(L.actors.get(a.target)?.label??L.useCases.get(a.target)?.label??L.jsonNodes.get(a.target)?.id??a.target)});for(let a of L.jsonNodes.values())i.push({id:a.id,label:s(a.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:t.look,cssClasses:yt("default","usecase-json-table",...a.classes),cssStyles:[...a.styles],cssCompiledStyles:_e(a.classes),jsonRows:mo(a.value,a.propertyOrder,s)});for(let a of L.systemBoundaries.values())i.push({id:a.id,label:s(a.label),labelType:a.labelType,shape:"usecaseSystemBoundary",isGroup:!0,padding:20,look:t.look,colorIndex:c++,cssClasses:yt("default","system-boundary",`system-boundary-${a.type}`,...a.classes),cssStyles:[...a.styles],cssCompiledStyles:_e(a.classes),boundaryType:a.type});for(let a of L.relationships){let{label:h,...d}=Ao(a);r.push({id:a.id,start:a.source,end:a.target,source:a.source,target:a.target,sourceLabel:n(a.source),targetLabel:n(a.target),type:"edge",relationshipType:a.type,internal:!1,...d,...h!==void 0?{label:s(h)}:{},labelpos:"c",classes:yt("default","relationship",`relationship-${a.type}`,...a.classes,...So(a)),style:[...a.styles],cssCompiledStyles:_e(a.classes),animate:a.animate,...a.animation?{animation:a.animation}:{},look:t.look,thickness:"normal",minlen:a.minlen,isUserDefinedId:a.explicitId})}for(let a of L.notes.values())r.push({id:`${a.id}-edge`,start:a.id,end:a.target,source:a.id,target:a.target,type:"edge",relationshipType:"note",sourceLabel:n(a.id),targetLabel:n(a.target),internal:!0,pattern:"dotted",arrowTypeStart:"none",arrowTypeEnd:"none",labelpos:"c",classes:"default relationship relationship-note",style:[],cssCompiledStyles:_e([]),animate:!1,look:t.look,thickness:"normal",minlen:1,isUserDefinedId:!1});for(let a of i)a.wrappingWidth??=e.wrappingWidth,!a.isGroup&&!a.shape.startsWith("usecaseActor")&&(a.minWidth??=e.minNodeWidth),(a.shape==="usecaseEllipse"||a.shape==="usecaseBusiness")&&(a.spreadPorts=!0);return{nodes:i,edges:r,config:t,type:"usecase",layoutAlgorithm:"dagre",direction:Qi(),nodeSpacing:e.nodeSpacing,rankSpacing:e.rankSpacing,actorFontSize:e.actorFontSize,actorFontFamily:e.actorFontFamily,actorFontWeight:e.actorFontWeight,usecaseFontSize:e.usecaseFontSize,usecaseFontFamily:e.usecaseFontFamily,usecaseFontWeight:e.usecaseFontWeight,diagramPadding:e.diagramPadding,useMaxWidth:e.useMaxWidth,markers:["point","circle","cross","extension"]}},"getData"),Ts={getConfig:qa,createModel:hn,commit:Za,getAST:Ja,clear:Qa,setDiagramTitle:On,getDiagramTitle:Ln,setAccTitle:kt,getAccTitle:Ls,setAccDescription:Ct,getAccDescription:Is,getActors:eo,getActor:to,getUseCases:so,getUseCase:no,getSystemBoundaries:io,getSystemBoundary:ro,getRelationships:ao,getNotes:oo,getNote:co,getJsonNodes:lo,getJsonNode:ho,getClassDefs:uo,getClassDef:po,getDirection:Qi,getData:Ro};function Me(t,e,s){let n=[s];return n.index=e,n.input=t,n}l(Me,"customMatch");var yo=l((t,e)=>{if(t[e]!=='"'||t[e+1]!=="`")return null;for(let s=e+2;s<t.length-1;s++)if(t[s]==="`"&&t[s+1]==='"')return Me(t,e,t.slice(e,s+2));return null},"matchMarkdownString"),Oo=l((t,e)=>{if(t[e]!=="%"||t[e+1]!=="%")return null;for(let n=e-1;n>=0;n--){let i=t[n];if(i===`
|
|
111
|
+
`||i==="\r")break;if(i!==" "&&i!==" ")return null}let s=e+2;for(;s<t.length&&t[s]!==`
|
|
112
|
+
`&&t[s]!=="\r";)s++;return Me(t,e,t.slice(e,s))},"matchComment"),er=l((t,e)=>{for(let s=e-1;s>=0;s--){let n=t[s];if(n===`
|
|
113
|
+
`||n==="\r")return!0;if(n!==" "&&n!==" ")return!1}return!0},"isIndentedLineStart"),tr=l((t,e,s)=>{if(!er(t,e))return null;let n=s.exec(t.slice(e));return n?Me(t,e,n[0]):null},"matchAccessibilityLine"),Lo=l((t,e)=>{if(!er(t,e))return null;let s=/^accDescr[\t ]*{/.exec(t.slice(e));if(!s)return null;let n=t.indexOf("}",e+s[0].length);return n===-1?null:Me(t,e,t.slice(e,n+1))},"matchAccDescrBlock"),Io=l((t,e)=>{if(t[e]!=="{")return null;let s=0,n=!1,i=!1;for(let r=e;r<t.length;r++){let o=t[r];if(n){i?i=!1:o==="\\"?i=!0:o==='"'&&(n=!1);continue}if(o==='"')n=!0;else if(o==="{")s++;else if(o==="}"&&--s===0)return Me(t,e,t.slice(e,r+1))}return null},"matchJsonObject"),No=l((t,e)=>{let s=t.indexOf(">>",e);if(s===-1||/[\n\r]/.test(t.slice(e,s)))return null;let n=t.slice(e,s);return n.trim()?Me(t,e,n):null},"matchStereotypeText"),W=A({name:"LABEL_TEXT",pattern:_.NA}),He=A({name:"WORD",pattern:_.NA,categories:W}),un=A({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:W}),P=A({name:"IDENTIFIER",pattern:/\w+/,longer_alt:un,categories:He}),ko=A({name:"HWS",pattern:/[\t ]+/,group:_.SKIPPED}),Te=A({name:"MARKDOWN_STRING",pattern:yo,start_chars_hint:['"'],line_breaks:!0}),Co=A({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),nn=A({name:"COMMENT",pattern:Oo,start_chars_hint:["%"],line_breaks:!1}),Ee=A({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),sr=A({name:"ACC_DESCR_BLOCK",pattern:Lo,start_chars_hint:["a"],line_breaks:!0}),bo=/^accTitle[\t ]*:[^\n\r]*/,vo=/^accDescr[\t ]*:[^\n\r]*/,nr=A({name:"ACC_TITLE_LINE",pattern:l((t,e)=>tr(t,e,bo),"pattern"),start_chars_hint:["a"],line_breaks:!1}),ir=A({name:"ACC_DESCR_LINE",pattern:l((t,e)=>tr(t,e,vo),"pattern"),start_chars_hint:["a"],line_breaks:!1}),rr=A({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),dn=A({name:"JSON_OBJECT_LITERAL",pattern:Io,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),ar=A({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),$=l((t,e)=>A({name:t,pattern:e,longer_alt:P,categories:He}),"keyword"),or=$("USECASE",/usecase-beta/),rn=$("ACTOR",/actor/),cr=$("SYSTEM_BOUNDARY",/systemBoundary/),lr=$("END",/end/),hr=$("DIRECTION",/direction/),ur=$("TD",/TD/),dr=$("TB",/TB/),pr=$("BT",/BT/),fr=$("LR",/LR/),mr=$("RL",/RL/),Er=$("NOTE",/note/),Tr=$("FOR",/for/),_o=$("JSON",/json/),gr=$("CLASS_DEF",/classDef/),Ar=$("CLASS",/class/),Sr=$("STYLE",/style/),Rr=$("INCLUDE",/include/i),yr=$("EXTEND",/extend/i),Or=$("TRUE",/true/),Lr=$("FALSE",/false/),Ir=A({name:"GENERALIZATION",pattern:/--\|>/}),Nr=A({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),kr=A({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),pn=A({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),fn=A({name:"STEREOTYPE_TEXT",pattern:No,line_breaks:!1}),Cr=A({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),br=A({name:"CLASS_SEPARATOR",pattern:/:::/}),us=A({name:"FORWARD_SOLID",pattern:/--+>/}),vr=A({name:"BACKWARD_SOLID",pattern:/<--+/}),ds=A({name:"FORWARD_CIRCLE",pattern:/--o/}),_r=A({name:"BACKWARD_CIRCLE",pattern:/o--/}),ps=A({name:"FORWARD_CROSS",pattern:/--x/}),xr=A({name:"BACKWARD_CROSS",pattern:/x--/}),ne=A({name:"MARKERLESS_SOLID",pattern:/--+/}),an=A({name:"METADATA_START",pattern:/@{/}),fs=A({name:"AT",pattern:/@/,categories:W}),Mr=A({name:"LBRACE",pattern:/{/}),on=A({name:"RBRACE",pattern:/}/}),ms=A({name:"LBRACKET",pattern:/\[/}),Es=A({name:"RBRACKET",pattern:/]/}),Ot=A({name:"LPAREN",pattern:/\(/}),Lt=A({name:"RPAREN",pattern:/\)/}),oe=A({name:"COMMA",pattern:/,/,categories:W}),It=A({name:"COLON",pattern:/:/,categories:W}),wr=A({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:W}),ie=A({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),cn=A({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:W}),Ur=A({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:W}),Pr=A({name:"DASH",pattern:/-/,categories:W}),Dr=A({name:"DOT",pattern:/\./,categories:W}),Fr=A({name:"PERCENT",pattern:/%/,categories:W}),Br=A({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:W}),xo=A({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:W}),Mo=A({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:W}),$r=[W,He,ko,Te,Co,nn,Ee,sr,nr,ir,rr,or,rn,cr,lr,hr,ur,dr,pr,fr,mr,Er,Tr,_o,gr,Ar,Sr,Rr,yr,Or,Lr,Ir,Nr,kr,br,us,vr,ds,_r,ps,xr,ne,an,fs,Mr,on,ms,Es,Ot,Lt,oe,It,wr,ie,cn,P,un,Ur,Pr,Dr,Fr,Br,xo,Mo],wo={defaultMode:"defaultMode",modes:{defaultMode:[...$r],jsonBody:[dn,ar],stereotype:[pn,fn,Cr]}},Uo=[...$r,dn,ar,pn,fn,Cr],Po=new _(wo),Vi=l(t=>ct(t,W)||t.tokenType===ie||t.tokenType===Te,"isLabelToken"),Do={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},Fo=class extends Rt{static{l(this,"UsecaseParser")}constructor(){super(Uo,{nodeLocationTracking:"full"}),this.RULE("start",()=>{this.CONSUME(or),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:l(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:l(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:l(()=>this.isStatementStart(),"GATE"),ALT:l(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:l(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:l(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:l(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:l(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:l(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:l(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:l(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:l(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:l(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:l(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:l(()=>this.isMetadataAssignment(),"GATE"),ALT:l(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:l(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:l(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:l(()=>this.CONSUME(Ee),"ALT")},{ALT:l(()=>this.CONSUME(Q),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(Ee)}),this.RULE("commentLine",()=>{this.CONSUME(nn),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(nr),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:l(()=>this.CONSUME(ir),"ALT")},{ALT:l(()=>this.CONSUME(sr),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME(rn),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:l(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(oe),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:l(()=>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:l(()=>{this.CONSUME(P),this.OPTION(()=>{this.CONSUME(Ot),this.SUBRULE(this.nodeLabel),this.CONSUME(Lt)})},"ALT")},{ALT:l(()=>this.CONSUME(ie),"ALT")},{ALT:l(()=>this.CONSUME(Te),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(rn),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(oe),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:l(()=>{this.CONSUME(P),this.OPTION(()=>{this.OR2([{ALT:l(()=>{this.CONSUME(Ot),this.SUBRULE(this.nodeLabel),this.CONSUME(Lt)},"ALT")},{ALT:l(()=>{this.CONSUME(ms),this.SUBRULE2(this.nodeLabel),this.CONSUME(Es)},"ALT")}])})},"ALT")},{ALT:l(()=>this.CONSUME(ie),"ALT")},{ALT:l(()=>this.CONSUME(Te),"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:l(()=>this.CONSUME(ie),"ALT")},{ALT:l(()=>this.CONSUME(Te),"ALT")},{ALT:l(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:l(()=>this.LA(1).tokenType===P&&this.LA(2).tokenType===fs,"GATE"),DEF:l(()=>{this.CONSUME(P),this.CONSUME(fs)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:l(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:l(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:l(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:l(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:l(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:l(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:l(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:l(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(us)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(vr),this.OPTION({GATE:l(()=>this.LA(0).image==="<--"&&this.hasLabeledRight([ne]),"GATE"),DEF:l(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(ne)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(ne),this.OPTION({GATE:l(()=>this.LA(0).image==="--"&&this.hasLabeledRight([us,ne,ds,ps]),"GATE"),DEF:l(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:l(()=>this.CONSUME(us),"ALT")},{ALT:l(()=>this.CONSUME2(ne),"ALT")},{ALT:l(()=>this.CONSUME(ds),"ALT")},{ALT:l(()=>this.CONSUME(ps),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(ds)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(_r),this.OPTION({GATE:l(()=>this.hasLabeledRight([ne]),"GATE"),DEF:l(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(ne)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(ps)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(xr),this.OPTION({GATE:l(()=>this.hasLabeledRight([ne]),"GATE"),DEF:l(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(ne)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:l(()=>this.CONSUME(ie),"ALT")},{ALT:l(()=>this.CONSUME(Te),"ALT")},{ALT:l(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:l(()=>{this.CONSUME(Nr),this.CONSUME(It),this.OR2([{ALT:l(()=>this.CONSUME(Rr),"ALT")},{ALT:l(()=>this.CONSUME(yr),"ALT")}])},"ALT")},{ALT:l(()=>this.CONSUME(Ir),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(an),this.MANY(()=>this.CONSUME(Ee)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(oe)),this.MANY3(()=>this.CONSUME2(Ee))}),this.CONSUME(on)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:l(()=>this.CONSUME(P),"ALT")},{ALT:l(()=>this.CONSUME(ie),"ALT")}]),this.CONSUME(It),this.OR2([{ALT:l(()=>this.CONSUME2(P),"ALT")},{ALT:l(()=>this.CONSUME2(ie),"ALT")},{ALT:l(()=>this.CONSUME(Or),"ALT")},{ALT:l(()=>this.CONSUME(Lr),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:l(()=>{this.CONSUME(oe),this.MANY(()=>this.CONSUME(Ee))},"ALT")},{ALT:l(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(Ee)),this.OPTION(()=>this.CONSUME2(oe)),this.MANY2(()=>this.CONSUME3(Ee))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(cr),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(lr),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:l(()=>{this.CONSUME(P),this.OPTION(()=>{this.OR2([{ALT:l(()=>{this.CONSUME(Ot),this.SUBRULE(this.nodeLabel),this.CONSUME(Lt)},"ALT")},{ALT:l(()=>{this.CONSUME(ms),this.SUBRULE2(this.nodeLabel),this.CONSUME(Es)},"ALT")}])})},"ALT")},{ALT:l(()=>this.CONSUME(ie),"ALT")},{ALT:l(()=>this.CONSUME(Te),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:l(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:l(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:l(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:l(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:l(()=>{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:l(()=>this.CONSUME(P),"ALT")},{ALT:l(()=>this.CONSUME(ie),"ALT")},{ALT:l(()=>this.CONSUME(Te),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(Er),this.CONSUME(Tr),this.CONSUME(P),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(kr),this.CONSUME(fn),this.CONSUME(pn)}),this.RULE("classSuffix",()=>{this.CONSUME(br),this.CONSUME(P),this.MANY(()=>{this.CONSUME(oe),this.CONSUME2(P)})}),this.RULE("jsonStatement",()=>{this.CONSUME(rr),this.CONSUME(dn),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(hr),this.OR([{ALT:l(()=>this.CONSUME(ur),"ALT")},{ALT:l(()=>this.CONSUME(dr),"ALT")},{ALT:l(()=>this.CONSUME(pr),"ALT")},{ALT:l(()=>this.CONSUME(fr),"ALT")},{ALT:l(()=>this.CONSUME(mr),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(gr),this.CONSUME(P),this.MANY(()=>{this.CONSUME(oe),this.CONSUME2(P)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME(Ar),this.CONSUME(P),this.MANY(()=>{this.CONSUME(oe),this.CONSUME2(P)}),this.CONSUME3(P),this.MANY2(()=>{this.CONSUME2(oe),this.CONSUME4(P)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(Sr),this.CONSUME(P),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(oe),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:l(()=>this.CONSUME(He),"ALT")},{ALT:l(()=>this.CONSUME(cn),"ALT")},{ALT:l(()=>{this.CONSUME(ne),this.CONSUME2(He)},"ALT")}]),this.CONSUME(It),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:l(()=>this.CONSUME(He),"ALT")},{ALT:l(()=>this.CONSUME(ie),"ALT")},{ALT:l(()=>this.CONSUME(un),"ALT")},{ALT:l(()=>this.CONSUME(wr),"ALT")},{ALT:l(()=>this.CONSUME(cn),"ALT")},{ALT:l(()=>this.CONSUME(Ur),"ALT")},{ALT:l(()=>this.CONSUME(Pr),"ALT")},{ALT:l(()=>this.CONSUME(Dr),"ALT")},{ALT:l(()=>this.CONSUME(Fr),"ALT")},{ALT:l(()=>this.CONSUME(Br),"ALT")},{ALT:l(()=>this.CONSUME(It),"ALT")},{ALT:l(()=>this.CONSUME(Ot),"ALT")},{ALT:l(()=>this.CONSUME(Lt),"ALT")},{ALT:l(()=>this.CONSUME(ms),"ALT")},{ALT:l(()=>this.CONSUME(Es),"ALT")},{ALT:l(()=>this.CONSUME(Mr),"ALT")},{ALT:l(()=>this.CONSUME(on),"ALT")},{ALT:l(()=>this.CONSUME(fs),"ALT")},{ALT:l(()=>this.CONSUME(ne),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let t=this.LA(1).tokenType;return(t===P||t===ie||t===Te)&&this.LA(2).tokenType===an}isStatementStart(){let t=this.LA(1).tokenType;return t!==Q&&t!==Ee&&t!==nn}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===P&&Do[this.LA(1).image.toLowerCase()]===!0}hasLabeledRight(t){if(!Vi(this.LA(1)))return!1;for(let e=2;;e++){let s=this.LA(e);if(t.includes(s.tokenType))return!0;if(!Vi(s))return!1}}},Nt=new Fo,zi=class extends Error{constructor(t,e,s){super(`${t} (line ${e}, column ${s})`),this.line=e,this.column=s,this.name="UsecaseJsonError"}static{l(this,"UsecaseJsonError")}},ln=l((t,e,s,n)=>{let i=s,r=n,o=Math.min(Math.max(e,0),t.length);for(let c=0;c<o;c++){let a=t[c];a==="\r"?(i++,r=1):a===`
|
|
114
|
+
`?(c===0||t[c-1]!=="\r")&&(i++,r=1):r++}return{line:i,column:r}},"locationAtOffset"),Bo=l((t,e,s,n)=>{let i=/\bposition (\d+)\b/u.exec(t);if(i)return ln(e,Number.parseInt(i[1],10),s,n);let r=/\bline (\d+) column (\d+)\b/u.exec(t);if(r){let o=Number.parseInt(r[1],10),c=Number.parseInt(r[2],10);return{line:s+o-1,column:o===1?n+c-1:c}}if(/unexpected end|end of json input/iu.test(t))return ln(e,e.length,s,n)},"locationFromErrorMessage"),V=class extends Error{constructor(t){super("Invalid JSON token"),this.offset=t}static{l(this,"JsonWalkError")}},Hi=class{constructor(t){this.text=t,this.offset=0,this.propertyOrder={}}static{l(this,"PropertyOrderCollector")}collect(){if(this.skipWhitespace(),this.collectValue(""),this.skipWhitespace(),this.offset!==this.text.length)throw new V(this.offset);return this.propertyOrder}collectValue(t){this.skipWhitespace();let e=this.text[this.offset];if(e==="{")this.collectObject(t);else if(e==="[")this.collectArray(t);else if(e==='"')this.readString(!1);else if(e==="t")this.consumeLiteral("true");else if(e==="f")this.consumeLiteral("false");else if(e==="n")this.consumeLiteral("null");else if(e==="-"||e>="0"&&e<="9")this.consumeNumber();else throw new V(this.offset)}collectObject(t){this.offset++;let e=[],s=new Set;if(this.propertyOrder[t]=e,this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}for(;this.offset<this.text.length;){if(this.text[this.offset]!=='"')throw new V(this.offset);let n=this.readString(!0),i=`${t}/${n.replaceAll("~","~0").replaceAll("/","~1")}`;if(s.has(n)?this.deletePointerSubtree(i):(s.add(n),e.push(n)),this.skipWhitespace(),this.text[this.offset]!==":")throw new V(this.offset);if(this.offset++,this.collectValue(i),this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}if(this.text[this.offset]!==",")throw new V(this.offset);this.offset++,this.skipWhitespace()}throw new V(this.offset)}collectArray(t){if(this.offset++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}let e=0;for(;this.offset<this.text.length;){if(this.collectValue(`${t}/${e}`),e++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}if(this.text[this.offset]!==",")throw new V(this.offset);this.offset++,this.skipWhitespace()}throw new V(this.offset)}readString(t){this.offset++;let e="";for(;this.offset<this.text.length;){let s=this.offset,n=this.text[this.offset++];if(n==='"')return e;if(n.charCodeAt(0)<32)throw new V(s);if(n!=="\\"){t&&(e+=n);continue}let i=this.offset,r=this.text[this.offset++];switch(r){case'"':case"\\":case"/":t&&(e+=r);break;case"b":t&&(e+="\b");break;case"f":t&&(e+="\f");break;case"n":t&&(e+=`
|
|
115
|
+
`);break;case"r":t&&(e+="\r");break;case"t":t&&(e+=" ");break;case"u":{let o=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(o))throw new V(this.offset);t&&(e+=String.fromCharCode(Number.parseInt(o,16))),this.offset+=4;break}default:throw new V(i)}}throw new V(this.offset)}consumeLiteral(t){let e=0;for(let s of t){if(this.text[this.offset+e]!==s)throw new V(this.offset+e);e++}this.offset+=t.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 V(this.offset);if(this.text[this.offset]==="."){if(this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new V(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 V(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}}skipWhitespace(){for(;this.offset<this.text.length;){let t=this.text[this.offset];if(t!==" "&&t!==" "&&t!==`
|
|
116
|
+
`&&t!=="\r")return;this.offset++}}deletePointerSubtree(t){let e=`${t}/`;for(let s of Object.keys(this.propertyOrder))(s===t||s.startsWith(e))&&delete this.propertyOrder[s]}};function Gr(t,e,s){let n;try{n=JSON.parse(t)}catch(i){let r=i instanceof Error?i.message:String(i),o=Bo(r,t,e,s);if(!o){let c=0;try{new Hi(t).collect()}catch(a){a instanceof V&&(c=a.offset)}o=ln(t,c,e,s)}throw new zi(`Invalid JSON: ${r}`,o.line,o.column)}if(typeof n!="object"||n===null||Array.isArray(n))throw new zi("JSON value must have an object root",e,s);return{value:n,propertyOrder:new Hi(t).collect()}}l(Gr,"parseOrderedJsonObject");var $o=l(t=>({shape:t.type==="normal"?"actor":t.type==="hollow"?"actor-hollow":t.type==="awesome"?"actor-awesome":"actor-icon",...t.label===t.id?{}:{label:t.label},...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"actor",actorType:t.type,business:t.business,labelType:t.labelType,...t.icon?{icon:t.icon}:{},...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{}}}),"actorNode"),Go=l(t=>({shape:t.shape,...t.label===t.id?{}:{label:t.label},...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"usecase",useCaseShape:t.shape,business:t.business,labelType:t.labelType,...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{}}}),"useCaseNode"),jo=l(t=>({label:t.label,shape:"note",attrs:{kind:"note",target:t.target,labelType:t.labelType}}),"noteNode"),Wo=l(t=>({label:t.id,shape:"json-table",...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"json",value:t.value,propertyOrder:t.propertyOrder,labelType:"text"}}),"jsonNode"),Ko=l(t=>({id:t.id,source:t.source,target:t.target,...t.label?{label:t.label}:{},...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{relationshipType:t.type,arrowType:t.arrowType,minlen:t.minlen,explicitId:t.explicitId,animate:t.animate,...t.animation?{animation:t.animation}:{},...t.labelType?{labelType:t.labelType}:{}}}),"relationshipEdge"),Vo=l(t=>({id:`${t.id}-edge`,source:t.id,target:t.target,attrs:{relationshipType:"note",arrowType:M.LINE_SOLID,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),zo=l((t,e,s,n)=>{let i={};for(let a of t.getActors().values())i[a.id]=$o(a);for(let a of t.getUseCases().values())i[a.id]=Go(a);for(let a of t.getNotes().values())i[a.id]=jo(a);for(let a of t.getJsonNodes().values())i[a.id]=Wo(a);let r={};for(let a of t.getSystemBoundaries().values())r[a.id]={...a.label===a.id?{}:{title:a.label},nodes:[...a.members],...a.classes.length?{classes:[...a.classes]}:{},...a.styles.length?{styles:[...a.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:a.type,labelType:a.labelType}};let o={};for(let a of t.getClassDefs().values())o[a.id]={styles:[...a.styles]};let c=t.getDirection();return{version:1,diagramType:"usecase",source:e,header:{keyword:"usecase",direction:c==="TD"?"TB":c,span:s},...t.getAccTitle()?{accTitle:t.getAccTitle()}:{},...t.getAccDescription()?{accDescr:t.getAccDescription()}:{},nodes:i,edges:[...t.getRelationships().map(Ko),...[...t.getNotes().values()].map(Vo)],groups:r,classDefs:o,statements:n}},"buildUsecaseGraphAST"),z=l(t=>`line ${t.line}, column ${t.column} [${t.span[0]},${t.span[1]})`,"locationText"),Xi=l(t=>t===void 0?"":` (label "${t}")`,"labelSuffix"),xe=l(t=>t.generated?t.label:void 0,"generatedFrom"),sn=l((t,e)=>{for(let s of e)t.includes(s)||t.push(s)},"pushUnique"),Ho=class{constructor(t){this.db=t,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=t.createModel()}static{l(this,"UsecaseModelBuilder")}reset(t){this.model=this.db.createModel(),this.source=t,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(t){this.elements.push(t)}addBoundary(t){this.boundaries.push(t)}addJson(t){this.jsonDrafts.push(t)}addRelationship(t){this.relationshipDrafts.push(t)}addNote(t){this.noteDrafts.push(t)}addMetadataAssignment(t,e,s,n){this.metadataAssignments.push({target:t,targetLocation:e,metadata:s,statement:n})}addClassDef(t,e){this.classDefinitions.push({ids:t,styles:e})}addClassAssignment(t,e){this.classAssignments.push({targets:t,classes:e})}addStyleAssignment(t,e,s){this.styleAssignments.push({target:t,location:e,styles:s})}setDirection(t){this.directions.push(t==="TD"?"TB":t)}setAccTitle(t){this.model.accTitle=t}setAccDescription(t){this.model.accDescription=t}setStatements(t){this.statements=t}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(t){let e=new Map,s=new Map,n=new Map,i=new Map;for(let a of this.relationshipDrafts)this.recordFirst(i,a.source.id,a.source.location.span[0]),this.recordFirst(i,a.target.id,a.target.location.span[0]);for(let a of this.elements)this.recordFirst(i,a.id,a.location.span[0]);for(let a of this.boundaries)this.recordFirst(i,a.id,a.location.span[0]);for(let a of this.jsonDrafts)this.recordFirst(i,a.id,a.location.span[0]);let r=[...this.elements.map(a=>({offset:a.location.span[0],type:"element",value:a})),...this.boundaries.map(a=>({offset:a.location.span[0],type:"boundary",value:a})),...this.jsonDrafts.map(a=>({offset:a.location.span[0],type:"json",value:a})),...this.relationshipDrafts.filter(a=>a.explicitId).map(a=>({offset:a.explicitIdLocation.span[0],type:"edge",value:a}))].sort((a,h)=>a.offset-h.offset);for(let a of r)a.type==="element"?this.collectElement(a.value,e,s):a.type==="boundary"?this.collectBoundary(a.value,e,n):a.type==="json"?this.registerUnique(e,a.value.id,"json",a.value.location,!1):this.registerUnique(e,a.value.explicitId,"edge",a.value.explicitIdLocation,!1);this.materializeElements(s,i),this.materializeBoundaries(n,i),this.materializeJson(i);let o=this.materializeRelationships(e,s,i);this.reorderElements(s,i),this.applyMetadataAssignments(e,s,n,o),this.validateAndRefreshElements(s),this.refreshBoundaries(n,s),this.materializeNotes(e),this.applyClassDefinitions(),this.applyClassesAndStyles(e,o),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...e].map(([a,h])=>[a,h.kind]));let c=zo(this,this.source,t,this.statements);return this.model.ast=c,this.db.commit(this.model),c}collectElement(t,e,s){let n=e.get(t.id),i=xe({generated:t.generated,label:t.label.text});n&&n.kind!==t.kind&&this.conflict(`ID '${t.id}' is declared as both ${n.kind} and ${t.kind}`,t.location,n.location,i,xe(n)),n&&(n.generated||t.generated)&&this.conflict(`Generated ID '${t.id}' collides with another declaration`,t.location,n.location,i,xe(n));let r=s.get(t.id);if(!r){let o={kind:t.kind,id:t.id,label:t.label,location:t.location,generated:t.generated,classes:[...t.classes],...t.parentId?{parentId:t.parentId,parentLocation:t.parentLocation}:{},...t.shape?{shape:t.shape}:{},...t.stereotype?{stereotype:t.stereotype,stereotypeLocation:t.location}:{}};this.applyDeclarationMetadata(o,t.metadata),s.set(t.id,o),e.set(t.id,{kind:t.kind,location:t.location,generated:t.generated,label:t.label.text});return}(r.label.text!==t.label.text||r.label.type!==t.label.type)&&this.conflict(`ID '${t.id}' has conflicting labels`,t.location,r.location),t.shape&&r.shape&&t.shape!==r.shape&&this.conflict(`Use case '${t.id}' has conflicting shapes`,t.location,r.location),t.parentId&&r.parentId&&t.parentId!==r.parentId&&this.conflict(`Element '${t.id}' belongs to more than one system boundary`,t.parentLocation??t.location,r.parentLocation??r.location),t.stereotype&&r.stereotype&&t.stereotype!==r.stereotype&&this.conflict(`Element '${t.id}' has conflicting stereotypes`,t.location,r.stereotypeLocation??r.location),r.shape??=t.shape,r.parentId??=t.parentId,r.parentLocation??=t.parentLocation,r.stereotype??=t.stereotype,r.stereotypeLocation??=t.stereotype?t.location:void 0,sn(r.classes,t.classes),this.applyDeclarationMetadata(r,t.metadata)}collectBoundary(t,e,s){let n=e.get(t.id),i=xe({generated:t.generated,label:t.label.text});n&&n.kind!=="boundary"&&this.conflict(`ID '${t.id}' is declared as both ${n.kind} and boundary`,t.location,n.location,i,xe(n)),n&&(n.generated||t.generated)&&this.conflict(`Generated ID '${t.id}' collides with another declaration`,t.location,n.location,i,xe(n));let r=s.get(t.id);if(r){(r.label.text!==t.label.text||r.label.type!==t.label.type)&&this.conflict(`Boundary '${t.id}' has conflicting titles`,t.location,r.location),sn(r.classes,t.classes);return}s.set(t.id,{id:t.id,label:t.label,location:t.location,generated:t.generated,classes:[...t.classes],styles:[],members:[]}),e.set(t.id,{kind:"boundary",location:t.location,generated:t.generated,label:t.label.text})}materializeElements(t,e){for(let s of[...t.values()].sort((n,i)=>(e.get(n.id)??0)-(e.get(i.id)??0)))this.setElementModel(s)}materializeBoundaries(t,e){for(let s of[...t.values()].sort((n,i)=>(e.get(n.id)??0)-(e.get(i.id)??0)))this.model.systemBoundaries.set(s.id,{id:s.id,label:s.label.text,labelType:s.label.type,type:s.type??"rect",members:[],classes:[...s.classes],styles:[...s.styles]})}materializeJson(t){for(let e of[...this.jsonDrafts].sort((s,n)=>(t.get(s.id)??0)-(t.get(n.id)??0)))this.model.jsonNodes.set(e.id,{id:e.id,value:e.value,propertyOrder:e.propertyOrder,classes:[...e.classes],styles:[]})}materializeRelationships(t,e,s){let n=new Map,i=0;for(let r of this.relationshipDrafts){let o=this.resolveEndpoint(r.source,t,e,s),c=this.resolveEndpoint(r.target,t,e,s);this.validateRelationship(r,o,c,t);let a=r.explicitId??`edge-${i++}`,h={id:a,explicitId:!!r.explicitId,source:r.source.id,target:r.target.id,type:r.type,arrowType:r.arrowType,...r.label?{label:r.label.text,labelType:r.label.type}:{},minlen:r.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(h),n.set(a,{draft:r,relationship:h})}return this.model.relationshipCounter=i,n}resolveEndpoint(t,e,s,n){if(t.classesOnReference&&!t.declaration)throw new Error(`Relationship endpoint '${t.id}' uses ::: without declaring the node at ${z(t.location)}`);let i=e.get(t.id);return i?i.kind:(s.set(t.id,{kind:"usecase",id:t.id,label:t.label,location:t.location,generated:t.generated,shape:"ellipse",classes:[]}),e.set(t.id,{kind:"usecase",location:t.location,generated:t.generated,label:t.label.text}),this.recordFirst(n,t.id,t.location.span[0]),"usecase")}reorderElements(t,e){let s=new Map(this.model.actors),n=new Map(this.model.useCases);this.model.actors.clear(),this.model.useCases.clear();for(let i of[...t.values()].sort((r,o)=>(e.get(r.id)??0)-(e.get(o.id)??0))){!s.has(i.id)&&!n.has(i.id)&&this.setElementModel(i);let r=s.get(i.id)??this.model.actors.get(i.id),o=n.get(i.id)??this.model.useCases.get(i.id);r?this.model.actors.set(i.id,r):o&&this.model.useCases.set(i.id,o)}}applyMetadataAssignments(t,e,s,n){for(let i of this.metadataAssignments){let r=t.get(i.target);if(!r){let o=this.inferMetadataKind(i.metadata);throw new Error(`Metadata target '${i.target}' is unresolved${o?` (metadata implies ${o})`:""} at ${z(i.targetLocation)}`)}if(r.kind==="actor"||r.kind==="usecase")this.applyStandaloneElementMetadata(e.get(i.target),i.metadata);else if(r.kind==="boundary"){let o=s.get(i.target);for(let c of i.metadata.properties)(c.key!=="type"||c.value!=="rect"&&c.value!=="package")&&this.invalidMetadata(i.target,r.kind,c),o.type=c.value}else if(r.kind==="edge"){let o=n.get(i.target);if(!o)throw new Error(`Metadata target '${i.target}' is not an explicit edge at ${z(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 c of i.metadata.properties)c.key==="animate"&&typeof c.value=="boolean"?o.relationship.animate=c.value:c.key==="animation"&&(c.value==="fast"||c.value==="slow")?(o.relationship.animation=c.value,o.relationship.animate=!0):this.invalidMetadata(i.target,r.kind,c)}else for(let o of i.metadata.properties)this.invalidMetadata(i.target,r.kind,o)}for(let{relationship:i}of n.values())i.animation&&(i.animate=!0)}applyStandaloneElementMetadata(t,e){for(let s of e.properties)t.kind==="actor"?this.applyActorProperty(t,s,!0):s.key==="business"&&typeof s.value=="boolean"?t.business=s.value:this.invalidMetadata(t.id,t.kind,s)}applyDeclarationMetadata(t,e){if(e)for(let s of e.properties)t.kind==="actor"?this.applyActorProperty(t,s,!1):s.key==="business"&&typeof s.value=="boolean"?(t.business!==void 0&&t.business!==s.value&&this.conflict(`Use case '${t.id}' has conflicting business metadata`,s.location,t.location),t.business=s.value):this.invalidMetadata(t.id,t.kind,s)}applyActorProperty(t,e,s){e.key==="type"&&(e.value==="normal"||e.value==="hollow"||e.value==="awesome")?(!s&&t.actorType!==void 0&&t.actorType!==e.value&&this.conflict(`Actor '${t.id}' has conflicting type metadata`,e.location,t.location),t.actorType=e.value):e.key==="icon"&&typeof e.value=="string"?(!s&&t.icon!==void 0&&t.icon!==e.value&&this.conflict(`Actor '${t.id}' has conflicting icon metadata`,e.location,t.location),t.icon=e.value):e.key==="business"&&typeof e.value=="boolean"?(!s&&t.business!==void 0&&t.business!==e.value&&this.conflict(`Actor '${t.id}' has conflicting business metadata`,e.location,t.location),t.business=e.value):this.invalidMetadata(t.id,t.kind,e)}validateAndRefreshElements(t){for(let e of t.values()){let s=e.icon?"icon":e.actorType??"normal";if(e.kind==="actor"){if(e.icon&&e.actorType&&e.actorType!=="normal")throw new Error(`Actor '${e.id}' cannot combine icon with type '${e.actorType}' at ${z(e.location)}`);if(e.business&&(s==="icon"||s==="awesome"))throw new Error(`Business actor '${e.id}' must use normal or hollow geometry at ${z(e.location)}`)}else if((e.shape??"ellipse")==="rect"&&e.business)throw new Error(`Rectangular use case '${e.id}' cannot be a business use case at ${z(e.location)}`);this.setElementModel(e)}}refreshBoundaries(t,e){for(let s of t.values())s.members.length=0;for(let s of[...this.elements].sort((n,i)=>n.location.span[0]-i.location.span[0])){if(!s.parentId)continue;let n=t.get(s.parentId);if(!n)throw new Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${z(s.parentLocation??s.location)}`);n.members.includes(s.id)||n.members.push(s.id)}for(let s of e.values())if(s.parentId&&!t.has(s.parentId))throw new Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${z(s.parentLocation??s.location)}`);for(let s of t.values()){let n=this.model.systemBoundaries.get(s.id);n.type=s.type??"rect",n.members=[...s.members],n.classes=[...s.classes],n.styles=[...s.styles]}}materializeNotes(t){let e=0;for(let s of this.noteDrafts){let n=t.get(s.target);if(!n)throw new Error(`Note target '${s.target}' is unresolved at ${z(s.targetLocation)}`);n.kind!=="actor"&&n.kind!=="usecase"&&this.conflict(`Note target '${s.target}' must be an actor or use case, not ${n.kind}`,s.targetLocation,n.location);let i=`note-${e++}`;this.model.notes.set(i,{id:i,target:s.target,label:s.label.text,labelType:s.label.type})}this.model.noteCounter=e}applyClassDefinitions(){for(let t of this.classDefinitions)for(let e of t.ids)this.model.classDefs.set(e,{id:e,styles:[...t.styles]})}applyClassesAndStyles(t,e){for(let s of this.classAssignments)for(let n of s.targets)sn(this.getStylable(n.id,t,e,n.location).classes,s.classes);for(let s of this.styleAssignments)this.getStylable(s.target,t,e,s.location).styles.push(...s.styles)}getStylable(t,e,s,n){let i=e.get(t)?.kind,r=i==="actor"?this.model.actors.get(t):i==="usecase"?this.model.useCases.get(t):i==="boundary"?this.model.systemBoundaries.get(t):i==="json"?this.model.jsonNodes.get(t):i==="edge"?s.get(t)?.relationship:void 0;if(!r)throw new Error(`Class/style target '${t}' is unresolved or anonymous at ${z(n)}`);return r}validateRelationship(t,e,s,n){let i=l(r=>r==="actor"||r==="usecase"||r==="json","allowed");if(i(e)||this.conflict(`Relationship source '${t.source.id}' cannot be ${e}`,t.source.location,n.get(t.source.id).location),i(s)||this.conflict(`Relationship target '${t.target.id}' cannot be ${s}`,t.target.location,n.get(t.target.id).location),(t.type==="include"||t.type==="extend")&&(e!=="usecase"||s!=="usecase"))throw new Error(`${t.type} relationship requires use-case endpoints at ${z(t.location)}`);if(t.type==="generalization"&&(e!=="actor"&&e!=="usecase"||e!==s))throw new Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${z(t.location)}`);if(t.type==="association"&&(e==="json"||s==="json")&&![0,1,2].includes(t.arrowType))throw new Error(`JSON relationship '${t.source.id}' to '${t.target.id}' permits only point, reversed-point, or markerless solid association at ${z(t.location)}`)}setElementModel(t){if(t.kind==="actor"){let e=t.icon?"icon":t.actorType??"normal";this.model.useCases.delete(t.id),this.model.actors.set(t.id,{id:t.id,label:t.label.text,labelType:t.label.type,type:e,...t.icon?{icon:t.icon}:{},business:t.business??!1,...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{},classes:[...t.classes],styles:this.model.actors.get(t.id)?.styles??[]})}else this.model.actors.delete(t.id),this.model.useCases.set(t.id,{id:t.id,label:t.label.text,labelType:t.label.type,shape:t.shape??"ellipse",business:t.business??!1,...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{},classes:[...t.classes],styles:this.model.useCases.get(t.id)?.styles??[]})}inferMetadataKind(t){let e=new Set(["actor","usecase","boundary","edge"]);for(let s of t.properties)if(s.key==="icon")e.clear(),e.add("actor");else if(s.key==="animate"||s.key==="animation")e.clear(),e.add("edge");else if(s.key==="type")e.clear(),s.value==="rect"||s.value==="package"?e.add("boundary"):(s.value==="normal"||s.value==="hollow"||s.value==="awesome")&&e.add("actor");else if(s.key==="business")e.delete("boundary"),e.delete("edge");else return;return e.size===1?[...e][0]:void 0}invalidMetadata(t,e,s){throw new Error(`Metadata property '${s.key}' is invalid for ${e} '${t}' at ${z(s.location)}`)}registerUnique(t,e,s,n,i){let r=t.get(e);r&&this.conflict(`ID '${e}' is declared more than once (${r.kind} and ${s})`,n,r.location,void 0,xe(r)),t.set(e,{kind:s,location:n,generated:i})}recordFirst(t,e,s){let n=t.get(e);(n===void 0||s<n)&&t.set(e,s)}conflict(t,e,s,n,i){throw new Error(`${t} at ${z(e)}${Xi(n)}; previous declaration at ${z(s)}${Xi(i)}`)}},Xo=Nt.getBaseCstVisitorConstructor(),Yo=class extends Xo{constructor(){super(),this.builder=new Ho(Ts),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{l(this,"UsecaseVisitor")}build(t,e){this.source=e,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(e),this.visit(t)}start(t){let e=this.tokens(t,"USECASE")[0],s=[];for(let n of this.nodes(t,"line"))s.push(this.visit(n));this.builder.setStatements(s),this.builder.finalize(this.tokenSpan(e))}line(t){let e=this.firstNode(t,"blankLine","commentLine","statement");return this.wrap(e,this.visit(e))}statement(t){return this.visit(this.firstNode(t,"accTitleStatement","accDescrStatement","directionStatement","actorStatement","systemBoundaryStatement","noteStatement","jsonStatement","classDefStatement","classStatement","styleStatement","metadataAssignmentStatement","entityStatement"))}lineEnd(t){}blankLine(t){return{kind:"blank",span:this.tokenSpan(this.tokens(t,"NEWLINE")[0])}}commentLine(t){return{kind:"comment",span:this.tokenSpan(this.tokens(t,"COMMENT")[0])}}accTitleStatement(t){let e=this.tokens(t,"ACC_TITLE_LINE")[0].image;return this.builder.setAccTitle(e.slice(e.indexOf(":")+1).trim()),{kind:"accTitle",span:[0,0]}}accDescrStatement(t){let e=this.tokens(t,"ACC_DESCR_LINE")[0],s=this.tokens(t,"ACC_DESCR_BLOCK")[0],n=e?e.image.slice(e.image.indexOf(":")+1).trim():s.image.slice(s.image.indexOf("{")+1,s.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(n),{kind:"accDescr",span:[0,0]}}actorStatement(t){let e=this.nodes(t,"actorItem"),s=e.map(a=>this.visit(a)),n=this.nodes(t,"relationTail")[0],i=s.map((a,h)=>this.actorOccurrence(e[h],a,!0));for(let a of s)this.builder.addElement(this.actorDraft(a));if(!n)return{kind:"node",span:[0,0],nodes:i};let r=this.visit(n);r.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(r.target));let o=this.relationshipDraft(s[0],r,this.nodeLocation(n));this.builder.addRelationship(o);let c=o.explicitId??`edge-${this.anonymousEdge++}`;return i.push(this.entityOccurrence(this.nodes(n.children,"entityName")[0],r.target,r.target.explicitDeclaration)),{kind:"edge",span:[0,0],nodes:i,edges:[{id:c,span:[0,0],...o.explicitIdLocation?{idSpan:o.explicitIdLocation.span}:{},...o.label?{labelSpan:o.label.span}:{}}]}}actorItem(t){let e=this.visit(this.nodes(t,"actorName")[0]),s=this.nodes(t,"metadata")[0],n=this.nodes(t,"stereotype")[0],i=this.nodes(t,"classSuffix")[0],r=i?this.visit(i):{classes:[],spans:[]};return{...e,...s?{metadata:this.visit(s)}:{},...n?{stereotype:this.visit(n)}:{},classes:r.classes,classSpans:r.spans}}actorName(t){let e=this.tokens(t,"IDENTIFIER")[0],s=this.tokens(t,"PLAIN_STRING")[0]??this.tokens(t,"MARKDOWN_STRING")[0];if(e){let i=this.nodes(t,"nodeLabel")[0],r=i?this.visit(i):this.tokenLabel(e);return{id:e.image,label:r,location:this.tokenLocation(e),generated:!1,classes:[],classSpans:[]}}let n=this.tokenLabel(s);return{id:this.generateId(n.text),label:n,location:this.tokenLocation(s),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(t){let e=this.nodes(t,"actorItem"),s=e.map(n=>this.visit(n));for(let n of s)this.builder.addElement(this.actorDraft(n));return{kind:"node",span:[0,0],nodes:s.map((n,i)=>this.actorOccurrence(e[i],n,!0))}}entityStatement(t){let e=this.nodes(t,"entityName"),s=this.visit(e[0]),n=this.nodes(t,"relationTail")[0];if(!n)return s.explicitDeclaration=!0,s.shape??="ellipse",this.builder.addElement(this.entityDraft(s)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(e[0],s,!0)]};s.explicitDeclaration&&this.builder.addElement(this.entityDraft(s));let i=this.visit(n);i.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(i.target));let r={source:this.endpoint(s),target:this.endpoint(i.target),location:this.nodeLocation(n),...i.explicitId?{explicitId:i.explicitId,explicitIdLocation:i.explicitIdLocation}:{},...i.arrow};this.builder.addRelationship(r);let o=r.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(e[0],s,s.explicitDeclaration),this.entityOccurrence(this.nodes(n.children,"entityName")[0],i.target,i.target.explicitDeclaration)],edges:[{id:o,span:[0,0],...r.explicitIdLocation?{idSpan:r.explicitIdLocation.span}:{},...r.label?{labelSpan:r.label.span}:{}}]}}entityName(t){let e=this.tokens(t,"IDENTIFIER")[0],s=this.tokens(t,"PLAIN_STRING")[0]??this.tokens(t,"MARKDOWN_STRING")[0],n=this.nodes(t,"nodeLabel")[0],i=this.nodes(t,"useCaseMetadata")[0],r=this.nodes(t,"stereotype")[0],o=this.nodes(t,"classSuffix")[0],c=o?this.visit(o):{classes:[],spans:[]};if(e){let h=n?this.visit(n):this.tokenLabel(e),d=n?this.tokens(t,"LBRACKET").length?"rect":"ellipse":void 0;return{id:e.image,label:h,location:this.tokenLocation(e),generated:!1,...d?{shape:d}:{},...i?{metadata:this.visit(i)}:{},...r?{stereotype:this.visit(r)}:{},classes:c.classes,classSpans:c.spans,explicitDeclaration:!!(d||i||r)}}let a=this.tokenLabel(s);return{id:this.generateId(a.text),label:a,location:this.tokenLocation(s),generated:!0,...i?{metadata:this.visit(i)}:{},...r?{stereotype:this.visit(r)}:{},classes:c.classes,classSpans:c.spans,explicitDeclaration:!!(i||r)}}nodeLabel(t){let e=this.allTokens(t);if(e.length===1&&(e[0].tokenType.name==="PLAIN_STRING"||e[0].tokenType.name==="MARKDOWN_STRING"))return this.tokenLabel(e[0]);let s=[e[0].startOffset,(e.at(-1).endOffset??e.at(-1).startOffset)+1];return{text:this.source.slice(s[0],s[1]),type:"text",span:s}}useCaseMetadata(t){return this.visit(this.nodes(t,"metadata")[0])}relationTail(t){let e=this.tokens(t,"IDENTIFIER")[0];return{...e?{explicitId:e.image,explicitIdLocation:this.tokenLocation(e)}:{},arrow:this.visit(this.nodes(t,"arrow")[0]),target:this.visit(this.nodes(t,"entityName")[0])}}arrow(t){return this.visit(this.firstNode(t,"semanticRelation","forwardSolidOperator","backwardSolidOperator","markerlessSolidOperator","forwardCircleOperator","backwardCircleOperator","forwardCrossOperator","backwardCrossOperator"))}edgeLabel(t){return this.nodeLabel(t)}semanticRelation(t){if(this.tokens(t,"GENERALIZATION").length)return{type:"generalization",arrowType:M.SOLID_ARROW,minlen:1};let e=this.tokens(t,"INCLUDE").length?"include":"extend",s=this.tokens(t,e==="include"?"INCLUDE":"EXTEND")[0];return{type:e,arrowType:M.SOLID_ARROW,label:{text:e,type:"text",span:this.tokenSpan(s)},minlen:1}}metadata(t){return{properties:this.nodes(t,"metadataProperty").map(e=>this.visit(e)),location:this.ctxLocation(t)}}metadataProperty(t){let e=this.allTokens(t).filter(o=>o.tokenType.name!=="COLON"),s=e[0],n=e[1],i=n.tokenType.name==="TRUE"?!0:n.tokenType.name==="FALSE"?!1:this.decodePlain(n),r=[s.startOffset,(n.endOffset??n.startOffset)+1];return{key:this.decodePlain(s),value:i,span:r,keySpan:this.contentSpan(s),valueSpan:this.contentSpan(n),location:this.tokenLocation(s)}}metadataSeparator(t){}systemBoundaryStatement(t){let e=this.visit(this.nodes(t,"systemBoundaryName")[0]),s=this.nodes(t,"classSuffix")[0],n=s?this.visit(s):{classes:[],spans:[]};e.classes=n.classes,this.builder.addBoundary(e);let i=this.parentBoundary;this.parentBoundary={id:e.id,location:e.location};let r=this.nodes(t,"systemBoundaryContent")[0],o=r?this.visit(r):[];this.parentBoundary=i;let c=this.tokens(t,"END")[0],a=this.nodes(t,"metadata")[0],h=a?this.visit(a):void 0,d={kind:"group",span:[0,0],group:e.id,idSpan:e.location.span,titleSpan:e.label.span,endSpan:this.tokenSpan(c),classSpans:n.spans,...h?{metadata:h.properties.map(({key:u,span:p,keySpan:E,valueSpan:R})=>({key:u,span:p,keySpan:E,valueSpan:R}))}:{},...o.length?{children:o}:{}};return h&&this.builder.addMetadataAssignment(e.id,e.location,h,d),d}systemBoundaryName(t){let e=this.tokens(t,"IDENTIFIER")[0];if(e){let i=this.nodes(t,"nodeLabel")[0];return{id:e.image,label:i?this.visit(i):this.tokenLabel(e),location:this.tokenLocation(e),generated:!1,classes:[]}}let s=this.tokens(t,"PLAIN_STRING")[0]??this.tokens(t,"MARKDOWN_STRING")[0],n=this.tokenLabel(s);return{id:this.generateId(n.text),label:n,location:this.tokenLocation(s),generated:!0,classes:[]}}systemBoundaryContent(t){return[...this.nodes(t,"blankLine"),...this.nodes(t,"commentLine"),...this.nodes(t,"boundaryElement")].sort((s,n)=>(s.location?.startOffset??0)-(n.location?.startOffset??0)).map(s=>this.wrap(s,this.visit(s)))}boundaryElement(t){let e=this.nodes(t,"actorDeclarationOnly")[0];if(e)return this.visit(e);let s=this.nodes(t,"entityName")[0],n=this.visit(s);return n.explicitDeclaration=!0,n.shape??="ellipse",this.builder.addElement(this.entityDraft(n)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(s,n,!0)]}}metadataAssignmentStatement(t){let e=this.visit(this.nodes(t,"metadataAssignmentTarget")[0]),s=this.visit(this.nodes(t,"metadata")[0]),n={kind:"metadata",span:[0,0],nodes:[{id:e.id,span:e.location.span,idSpan:e.location.span}],metadata:s.properties.map(({key:i,span:r,keySpan:o,valueSpan:c})=>({key:i,span:r,keySpan:o,valueSpan:c}))};return this.builder.addMetadataAssignment(e.id,e.location,s,n),n}metadataAssignmentTarget(t){let e=this.allTokens(t)[0],s=this.tokenLabel(e);return{id:e.tokenType.name==="IDENTIFIER"?e.image:this.generateId(s.text),location:this.tokenLocation(e)}}noteStatement(t){let e=this.tokens(t,"IDENTIFIER")[0],s=this.visit(this.nodes(t,"nodeLabel")[0]);return this.builder.addNote({target:e.image,targetLocation:this.tokenLocation(e),label:s,location:this.ctxLocation(t)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:s.span,nodes:[{id:e.image,span:this.tokenSpan(e),idSpan:this.tokenSpan(e)}]}}stereotype(t){let e=this.tokens(t,"STEREOTYPE_TEXT")[0];return{value:e.image.trim(),span:this.tokenSpan(e)}}classSuffix(t){let e=this.tokens(t,"IDENTIFIER");return{classes:e.map(s=>s.image),spans:e.map(s=>this.tokenSpan(s))}}jsonStatement(t){let e=this.tokens(t,"JSON_DECLARATION_START")[0],s=this.tokens(t,"JSON_OBJECT_LITERAL")[0],n=/^json[\t ]+(\w+)/.exec(e.image),i=n[1],r=n[0].length-i.length,o={span:[e.startOffset+r,e.startOffset+r+i.length],line:e.startLine??1,column:(e.startColumn??1)+r},c=Gr(s.image,s.startLine??1,s.startColumn??1),a=this.nodes(t,"classSuffix")[0],h=a?this.visit(a):{classes:[],spans:[]},d={id:i,value:c.value,propertyOrder:c.propertyOrder,location:o,classes:h.classes};return this.builder.addJson(d),{kind:"json",span:[0,0],nodes:[{id:i,span:o.span,idSpan:o.span,defines:!0,classSpans:h.spans}],classSpans:h.spans}}directionStatement(t){let e=this.allTokens(t).find(s=>["TD","TB","BT","RL","LR"].includes(s.tokenType.name));return this.builder.setDirection(e.image),{kind:"direction",span:[0,0]}}classDefStatement(t){let e=this.tokens(t,"IDENTIFIER"),s=this.visit(this.nodes(t,"styles")[0]);return this.builder.addClassDef(e.map(n=>n.image),s),{kind:"classDef",span:[0,0],ref:e[0].image,refSpan:this.tokenSpan(e[0])}}classStatement(t){let e=this.tokens(t,"IDENTIFIER"),s=1;for(;s<e.length&&this.source.slice((e[s-1].endOffset??e[s-1].startOffset)+1,e[s].startOffset).includes(",");s++);let n=e.slice(0,s).map(r=>({id:r.image,location:this.tokenLocation(r)})),i=e.slice(s).map(r=>r.image);return this.builder.addClassAssignment(n,i),{kind:"classAssign",span:[0,0],ref:i[0],refSpan:this.tokenSpan(e[s]),nodes:n.map(({id:r,location:o})=>({id:r,span:o.span,idSpan:o.span}))}}styleStatement(t){let e=this.tokens(t,"IDENTIFIER")[0],s=this.visit(this.nodes(t,"styles")[0]);return this.builder.addStyleAssignment(e.image,this.tokenLocation(e),s),{kind:"style",span:[0,0],nodes:[{id:e.image,span:this.tokenSpan(e),idSpan:this.tokenSpan(e)}]}}styles(t){return this.nodes(t,"styleValue").map(e=>this.visit(e))}styleValue(t){let e=this.allTokens(t),s=[e[0].startOffset,(e.at(-1).endOffset??e.at(-1).startOffset)+1];return this.source.slice(s[0],s[1]).replaceAll("\\,",",")}styleComponent(t){return this.allTokens(t).map(e=>e.image).join("")}forwardSolidOperator(t){let e=this.tokens(t,"FORWARD_SOLID")[0];return{type:"association",arrowType:M.SOLID_ARROW,minlen:this.solidMinlen(e)}}backwardSolidOperator(t){let e=this.tokens(t,"BACKWARD_SOLID")[0],s=this.nodes(t,"edgeLabel")[0],n=s?this.tokens(t,"MARKERLESS_SOLID").at(-1):e;return{type:"association",arrowType:M.BACK_ARROW,minlen:this.solidMinlen(n),...s?{label:this.visit(s)}:{}}}markerlessSolidOperator(t){let e=this.nodes(t,"edgeLabel")[0],s=this.allTokens(t);if(!e)return{type:"association",arrowType:M.LINE_SOLID,minlen:this.solidMinlen(this.tokens(t,"MARKERLESS_SOLID")[0])};let n=s.at(-1),i=n.tokenType.name==="FORWARD_SOLID"?M.SOLID_ARROW:n.tokenType.name==="FORWARD_CIRCLE"?M.CIRCLE_ARROW:n.tokenType.name==="FORWARD_CROSS"?M.CROSS_ARROW:M.LINE_SOLID;return{type:"association",arrowType:i,label:this.visit(e),minlen:i===M.SOLID_ARROW||i===M.LINE_SOLID?this.solidMinlen(n):1}}forwardCircleOperator(t){return{type:"association",arrowType:M.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(t){let e=this.nodes(t,"edgeLabel")[0];return{type:"association",arrowType:M.CIRCLE_ARROW_REVERSED,minlen:1,...e?{label:this.visit(e)}:{}}}forwardCrossOperator(t){return{type:"association",arrowType:M.CROSS_ARROW,minlen:1}}backwardCrossOperator(t){let e=this.nodes(t,"edgeLabel")[0];return{type:"association",arrowType:M.CROSS_ARROW_REVERSED,minlen:1,...e?{label:this.visit(e)}:{}}}actorDraft(t){return{id:t.id,kind:"actor",label:t.label,location:t.location,generated:t.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...t.metadata?{metadata:t.metadata}:{},...t.stereotype?{stereotype:t.stereotype.value,stereotypeSpan:t.stereotype.span}:{},classes:t.classes}}entityDraft(t){return{id:t.id,kind:"usecase",label:t.label,location:t.location,generated:t.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...t.shape?{shape:t.shape}:{},...t.metadata?{metadata:t.metadata}:{},...t.stereotype?{stereotype:t.stereotype.value,stereotypeSpan:t.stereotype.span}:{},classes:t.classes}}endpoint(t,e=t.explicitDeclaration??!0){return{id:t.id,label:t.label,location:t.location,generated:t.generated,declaration:e,classesOnReference:t.classes.length>0}}relationshipDraft(t,e,s){return{source:this.endpoint(t,!0),target:this.endpoint(e.target),location:s,...e.explicitId?{explicitId:e.explicitId,explicitIdLocation:e.explicitIdLocation}:{},...e.arrow}}actorOccurrence(t,e,s){return{id:e.id,span:this.nodeSpan(t),idSpan:e.location.span,labelSpan:e.label.span,...s?{defines:!0}:{},...e.stereotype?{stereotypeSpan:e.stereotype.span}:{},...e.metadata?{metadata:e.metadata.properties.map(({key:n,span:i,keySpan:r,valueSpan:o})=>({key:n,span:i,keySpan:r,valueSpan:o}))}:{},...e.classSpans.length?{classSpans:e.classSpans}:{}}}entityOccurrence(t,e,s){return this.actorOccurrence(t,e,s)}wrap(t,e){if(e.kind==="blank"||e.kind==="comment")return e;e.span=this.nodeSpan(t);for(let s of e.edges??[])s.span=e.span;return e}tokenLabel(t){let e=t.tokenType.name==="MARKDOWN_STRING"?"markdown":"text",s=e==="markdown"?2:t.tokenType.name==="PLAIN_STRING"?1:0,n=this.tokenSpan(t,s);return{text:this.source.slice(n[0],n[1]),type:e,span:n}}decodePlain(t){return t.tokenType.name==="PLAIN_STRING"?t.image.slice(1,-1):t.image}contentSpan(t){return this.tokenSpan(t,t.tokenType.name==="PLAIN_STRING"?1:t.tokenType.name==="MARKDOWN_STRING"?2:0)}generateId(t){return t.replace(/\W/g,"_")}solidMinlen(t){return Math.max(1,(t.image.match(/-/g)?.length??2)-1)}nodeLocation(t){let e=this.allTokens(t.children)[0];return{span:this.nodeSpan(t),line:e.startLine??1,column:e.startColumn??1}}ctxLocation(t){let e=this.allTokens(t).filter(i=>i.tokenType.name!=="NEWLINE"&&i.tokenType.name!=="EOF"),s=e[0],n=e.at(-1);return{span:[s.startOffset,Math.min(this.source.length,(n.endOffset??n.startOffset+n.image.length-1)+1)],line:s.startLine??1,column:s.startColumn??1}}tokenLocation(t){let e=t.tokenType.name==="PLAIN_STRING"?1:t.tokenType.name==="MARKDOWN_STRING"?2:0;return{span:this.tokenSpan(t,e),line:t.startLine??1,column:(t.startColumn??1)+e}}nodeSpan(t){let e=this.allTokens(t.children).filter(i=>i.tokenType.name!=="NEWLINE"&&i.tokenType.name!=="EOF"),s=e[0],n=e.at(-1);if(!s||!n)throw new Error("Usecase CST node has no source token");return[s.startOffset,Math.min(this.source.length,(n.endOffset??n.startOffset+n.image.length-1)+1)]}tokenSpan(t,e=0){return[t.startOffset+e,Math.min(this.source.length,(t.endOffset??t.startOffset+t.image.length-1)+1-e)]}nodes(t,e){return(t[e]??[]).filter(s=>"children"in s)}tokens(t,e){return(t[e]??[]).filter(s=>"tokenTypeIdx"in s)}firstNode(t,...e){for(let s of e){let n=this.nodes(t,s)[0];if(n)return n}throw new Error(`Usecase CST is missing one of: ${e.join(", ")}`)}allTokens(t){let e=[];for(let s of Object.values(t))for(let n of s)"tokenTypeIdx"in n?e.push(n):e.push(...this.allTokens(n.children));return e.sort((s,n)=>s.startOffset-n.startOffset)}},qo=new Yo,Jo={parse:l(async t=>{Ts.clear(),Nt.input=[];try{Zi({diagramType:"usecase",lexer:Po,parser:Nt,entry:l(()=>Nt.start(),"entry"),visit:l(e=>qo.build(e,t),"visit")},t)}catch(e){Ts.clear();let s=Nt.errors[0];if(s){let{token:n}=s,i=ze(n.startOffset)?n.startOffset:t.length,r=ze(n.endOffset)?n.endOffset+1:i,o=ze(n.startLine)?n.startLine:t.slice(0,i).split(/\r\n|\r|\n/).length,c=Math.max(t.lastIndexOf(`
|
|
117
|
+
`,i-1),t.lastIndexOf("\r",i-1)),a=ze(n.startColumn)?n.startColumn:i-c,h=e instanceof Error?e.message:String(e);throw new Error(`${h} at line ${o}, column ${a} [${i},${r})`)}throw e}},"parse")},Zo=["point","circle","cross","extension"],jr={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},Yi=l((t,e)=>{let[s,n]=[t,e].map(i=>i.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${s}-${n}`},"usecaseDomId"),Qo=l(t=>`usecase-${t.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),gs=l((t,e)=>e!=="markdown"?t:kn(t).map(s=>s.map(n=>n.content).join(" ")).join(`
|
|
118
|
+
`),"getAccessibleLabel"),ec=l(t=>{let e=gs(t.label??t.id,t.labelType);if(jr[t.shape]){let n=t.actorType&&t.actorType!=="normal"?`${t.actorType} `:"",i=t.business?"business ":"",r=t.stereotype?`, stereotype ${t.stereotype}`:"";return`${i}${n}actor ${e}${r}`}if(t.shape==="note")return`Note for ${t.noteTargetLabel??t.noteTarget??""}: ${e}`;if(t.shape==="usecaseJsonTable"){let n=(t.jsonRows??[]).map(i=>`${i.accessibleKey}: ${i.value}`).join("; ");return n?`${e}: ${n}`:e}let s=t.stereotype?`, stereotype ${t.stereotype}`:"";return`${t.business?"business ":""}use case ${e}${s}`},"getUsecaseNodeAccessibleName"),tc=l(t=>`${t.boundaryType} system boundary ${gs(t.label??t.id,t.labelType)}`,"getUsecaseBoundaryAccessibleName"),sc=l(t=>t.relationshipType==="note"?"":`${t.relationshipType==="association"&&t.label?`association ${gs(t.label,t.labelType)}`:t.relationshipType} from ${t.sourceLabel} to ${t.targetLabel}`,"getUsecaseEdgeAccessibleName"),Ve=l(t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"escapePlainLabel"),qi=l(t=>t.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),nc=l((t,e)=>{t.diagramId=e,t.markers=[...Zo];for(let s of t.nodes){let n=s;if(n.domId=Qo(s.id),s.label!==void 0&&s.labelType==="text"&&(s.label=Ve(s.label)),s.stereotype&&(s.stereotype=Ve(s.stereotype)),!s.isGroup&&s.shape==="usecaseJsonTable"&&(s.jsonRows=s.jsonRows?.map(i=>({...i,key:Ve(i.key),value:Ve(i.value)}))),!s.isGroup&&(s.shape==="usecaseEllipse"||s.shape==="rect")&&s.stereotype){let i=s.label??Ve(s.id);s.label=`\xAB${qi(s.stereotype)}\xBB<br/>${s.labelType==="text"?qi(i):i}`,s.labelType="markdown",n.hasFoldedStereotype=!0,delete s.stereotype}}for(let s of t.edges)s.label!==void 0&&s.labelType==="text"&&(s.label=Ve(s.label));return t},"prepareUsecaseLayoutData"),ic=l((t,e,s)=>{for(let i of e.nodes){let r=typeof i.domId=="string"?i.domId:Yi(e.diagramId,i.id),o=t.select(`#${r}`),c=i.isGroup?"boundary":jr[i.shape]?"actor":i.shape==="note"?"note":i.shape==="usecaseJsonTable"?"json":"usecase",a=s.nodes.get(i.id)??i.id;if(o.attr("data-usecase-id",i.id).attr("data-usecase-kind",c).attr("role","img").attr("aria-label",a),!i.isGroup&&(i.shape==="usecaseEllipse"||i.shape==="rect")&&"hasFoldedStereotype"in i&&i.hasFoldedStereotype===!0){let h=o.node(),d=h?.querySelector(".nodeLabel"),u=d?.querySelector("p")??d,p=u?.firstChild;if(u&&p?.nodeType===3){let E=u.ownerDocument.createElement("span");E.className="usecase-stereotype",u.insertBefore(E,p),E.appendChild(p)}else h?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}let n=new Map(e.edges.map(i=>[i.id,i]));t.selectAll('path[data-et="edge"]').each(function(){let i=n.get(this.getAttribute("data-id")??"");if(!i)return;let r=In(this);r.attr("id",Yi(e.diagramId,i.id)).attr("data-usecase-id",i.id).attr("data-usecase-kind",i.internal?"note-connector":"relationship"),i.internal?r.attr("aria-hidden","true"):r.attr("role","img").attr("aria-label",s.edges.get(i.id)??i.id)})},"annotateUsecaseElements"),Ji=l((t,e)=>{t.style("--mermaid-usecase-actor-font-size",`${e.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",e.actorFontFamily).style("--mermaid-usecase-actor-font-weight",e.actorFontWeight).style("--mermaid-usecase-font-size",`${e.usecaseFontSize}px`).style("--mermaid-usecase-font-family",e.usecaseFontFamily).style("--mermaid-usecase-font-weight",e.usecaseFontWeight)},"applyUsecaseFonts"),rc=l(async(t,e,s,n)=>{gn.info("Drawing usecase diagram (unified)",e);let{layout:i}=Ns(),r=n.db,o=r.getData(),c=new Map(o.nodes.map(u=>[u.id,gs(u.label??u.id,u.labelType)])),a={nodes:new Map(o.nodes.map(u=>[u.id,u.isGroup?tc(u):ec(u.shape==="note"?{...u,noteTargetLabel:c.get(u.noteTarget??"")}:u)])),edges:new Map(o.edges.map(u=>[u.id,sc({...u,sourceLabel:c.get(u.source)??u.sourceLabel,targetLabel:c.get(u.target)??u.targetLabel})]))},h=Mn(e,o.config.securityLevel);o.layoutAlgorithm=xn(i),nc(o,e),Ji(h,o),await _n(o,h),ic(h,o,a);let d=o.diagramPadding;Nn.insertTitle(h,"usecaseDiagramTitleText",0,r.getDiagramTitle?.()??""),wn(h,d,"usecaseDiagram",o.useMaxWidth),Ji(h,o)},"draw"),ac={draw:rc},oc=l(t=>({actorBkg:t.usecaseActorBkg??t.actorBkg??t.mainBkg,actorBorder:t.usecaseActorBorder??t.actorBorder??t.primaryColor,bkg:t.usecaseBkg??t.mainBkg,border:t.usecaseBorder??t.nodeBorder??t.primaryColor,boundaryBkg:t.usecaseBoundaryBkg??t.clusterBkg,boundaryBorder:t.usecaseBoundaryBorder??t.clusterBorder,includeLine:t.usecaseIncludeLine??t.lineColor,extendLine:t.usecaseExtendLine??t.lineColor}),"roleColors"),cc=l(t=>{let{theme:e,bkgColorArray:s,borderColorArray:n}=t;if(!bn(e,n))return"";let i=Sn().usecase?.colorScheme==="rotate",r=Ue(t.look),o=r==="handDrawn",c=Cn(s),a="";for(let h=0;h<vn(n);h++){let d=n[h],u=c?`fill: ${s[h%s.length]};`:"",p=`[data-look="${r}"][data-color-id="color-${h}"]`;a+=`
|
|
119
|
+
|
|
120
|
+
& ${p}.system-boundary rect.boundary-body,
|
|
121
|
+
& ${p}.system-boundary rect.boundary-tab,
|
|
122
|
+
& ${p}.system-boundary .boundary-body path,
|
|
123
|
+
& ${p}.system-boundary .boundary-tab path {
|
|
124
|
+
stroke: ${d};
|
|
125
|
+
${u}
|
|
126
|
+
}
|
|
127
|
+
`,i&&(a+=`
|
|
128
|
+
|
|
129
|
+
/* Use case bodies -- \`.usecase-element\` covers the ellipse form, the \`[Rect]\` form and
|
|
130
|
+
the business variant.
|
|
131
|
+
|
|
132
|
+
Element selectors only, never a bare \`path\`. Under the handDrawn look roughjs draws
|
|
133
|
+
the body as a *pair* of paths, an outline stroked in the border colour and a hachure
|
|
134
|
+
fill stroked in the background colour, with no class to tell them apart. Stroking
|
|
135
|
+
both repaints the fill lines as border colour and the shape collapses into a solid
|
|
136
|
+
block -- which is what \`.usecase-element path\` did. So handDrawn bodies keep the
|
|
137
|
+
theme's uniform colours, exactly as handDrawn flowchart nodes do. */
|
|
138
|
+
& ${p}.usecase-element ellipse,
|
|
139
|
+
& ${p}.usecase-element rect {
|
|
140
|
+
stroke: ${d};
|
|
141
|
+
${u}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* The business marker is a single classed path, so it can be reached safely by name --
|
|
145
|
+
without it the marker keeps the uniform border beside a palette-coloured body. No
|
|
146
|
+
\`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
|
|
147
|
+
& ${p}.usecase-element .usecase-business-marker {
|
|
148
|
+
stroke: ${d};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Actor glyphs, mirroring the uniform rule further down. The fill goes on the glyph
|
|
152
|
+
group, never on its children, so the hollow variant's own \`fill="none"\` keeps
|
|
153
|
+
winning and a hollow actor stays hollow. Same reason as above for not descending
|
|
154
|
+
into the handDrawn paths. */
|
|
155
|
+
& ${p}.usecase-actor .usecase-actor-shape,
|
|
156
|
+
& ${p}.usecase-actor .usecase-actor-hollow,
|
|
157
|
+
& ${p}.usecase-actor .usecase-actor-awesome,
|
|
158
|
+
& ${p}.usecase-actor .usecase-actor-icon {
|
|
159
|
+
stroke: ${d};
|
|
160
|
+
${u}
|
|
161
|
+
}
|
|
162
|
+
${o?"":`
|
|
163
|
+
/* The group rule above reaches the glyph by inheritance, which the neo look breaks: it
|
|
164
|
+
ships a \`[data-look="neo"].node path { stroke }\` rule that hits the glyph's own paths,
|
|
165
|
+
and a value set directly on the child always beats one inherited from the parent,
|
|
166
|
+
whatever the parent rule's specificity. So name the children too.
|
|
167
|
+
|
|
168
|
+
Emitted for every look *except* handDrawn, where roughjs draws the glyph as an
|
|
169
|
+
outline path plus a hachure fill path stroked in the fill colour, indistinguishable
|
|
170
|
+
in CSS -- stroking both turns a hollow actor into a solid disc. Deliberately no
|
|
171
|
+
\`fill\` either way, so the hollow variant's own \`fill="none"\` keeps winning. */
|
|
172
|
+
& ${p}.usecase-actor .usecase-actor-glyph path,
|
|
173
|
+
& ${p}.usecase-actor .usecase-actor-glyph circle {
|
|
174
|
+
stroke: ${d};
|
|
175
|
+
}
|
|
176
|
+
`}
|
|
177
|
+
`)}return a},"genColor"),lc=l(t=>{let e=oc(t),s=Ue(t.look)==="handDrawn";return`
|
|
178
|
+
${cc(t)}
|
|
179
|
+
& .usecase-actor {
|
|
180
|
+
color: ${t.actorTextColor??t.primaryTextColor};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
& .usecase-actor-shape,
|
|
184
|
+
& .usecase-actor-hollow,
|
|
185
|
+
& .usecase-actor-awesome,
|
|
186
|
+
& .usecase-actor-icon {
|
|
187
|
+
fill: ${e.actorBkg};
|
|
188
|
+
stroke: ${e.actorBorder};
|
|
189
|
+
stroke-width: 2px;
|
|
190
|
+
}
|
|
191
|
+
${s?"":`
|
|
192
|
+
/* The rule above colours the glyph group and lets its children inherit, which the neo
|
|
193
|
+
look breaks: it ships a \`[data-look="neo"].node path { stroke }\` rule that lands on
|
|
194
|
+
the glyph's own paths, and a value set directly on a child always beats one inherited
|
|
195
|
+
from its parent, whatever the parent rule's specificity. Since neo is the default look,
|
|
196
|
+
without this every actor renders in the node border colour rather than the actor
|
|
197
|
+
colour the rule above asks for.
|
|
198
|
+
|
|
199
|
+
\`.node\` is in the selector to outrank that neo rule rather than tie with it: both
|
|
200
|
+
would otherwise be one attribute plus one class plus one element, leaving the winner to
|
|
201
|
+
depend on which stylesheet is concatenated last.
|
|
202
|
+
|
|
203
|
+
Stroke only: the hollow variant's own \`fill="none"\` has to keep winning. */
|
|
204
|
+
& .node.usecase-actor .usecase-actor-glyph path,
|
|
205
|
+
& .node.usecase-actor .usecase-actor-glyph circle {
|
|
206
|
+
stroke: ${e.actorBorder};
|
|
207
|
+
}
|
|
208
|
+
`}
|
|
209
|
+
& .usecase-actor .nodeLabel,
|
|
210
|
+
& .actor-label {
|
|
211
|
+
color: ${t.actorTextColor??t.primaryTextColor};
|
|
212
|
+
fill: ${t.actorTextColor??t.primaryTextColor};
|
|
213
|
+
font-family: var(--mermaid-usecase-actor-font-family, ${t.fontFamily});
|
|
214
|
+
font-size: var(--mermaid-usecase-actor-font-size, 14px);
|
|
215
|
+
font-weight: var(--mermaid-usecase-actor-font-weight, normal);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
& .usecase-element ellipse,
|
|
219
|
+
& .usecase-element rect,
|
|
220
|
+
& .usecase-business ellipse,
|
|
221
|
+
& .usecase-business rect {
|
|
222
|
+
fill: ${e.bkg};
|
|
223
|
+
stroke: ${e.border};
|
|
224
|
+
stroke-width: 2px;
|
|
225
|
+
}
|
|
226
|
+
${s?"":`
|
|
227
|
+
/* The same interception the actor glyph hits, one element down: neo ships
|
|
228
|
+
\`[data-look="neo"].node rect { stroke: nodeBorder }\`, which outranks the plain
|
|
229
|
+
\`.usecase-element rect\` above, so a use case written in the \`[Rect]\` form kept the node
|
|
230
|
+
border colour while its ellipse siblings took the role colour. An \`<ellipse>\` has no
|
|
231
|
+
equivalent neo rule and is already correct; restating it here costs nothing and means
|
|
232
|
+
the two forms cannot drift apart again.
|
|
233
|
+
|
|
234
|
+
Qualified with \`[data-look]\` *and* \`.node\` to land strictly above that rule rather than
|
|
235
|
+
tie with it -- on a tie the later stylesheet would win, which is how neo took this in
|
|
236
|
+
the first place. Skipped under handDrawn, where roughjs draws paths and neither element
|
|
237
|
+
exists. */
|
|
238
|
+
& [data-look="${Ue(t.look)}"].node.usecase-element ellipse,
|
|
239
|
+
& [data-look="${Ue(t.look)}"].node.usecase-element rect {
|
|
240
|
+
fill: ${e.bkg};
|
|
241
|
+
stroke: ${e.border};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* The business marker is a \`<path>\`, so it loses to \`[data-look="neo"].node path\` the same
|
|
245
|
+
way. No \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
|
|
246
|
+
& [data-look="${Ue(t.look)}"].node.usecase-element .usecase-business-marker {
|
|
247
|
+
stroke: ${e.border};
|
|
248
|
+
}
|
|
249
|
+
`}
|
|
250
|
+
& .usecase-element .nodeLabel,
|
|
251
|
+
& .usecase-label {
|
|
252
|
+
color: ${t.primaryTextColor};
|
|
253
|
+
fill: ${t.primaryTextColor};
|
|
254
|
+
font-family: var(--mermaid-usecase-font-family, ${t.fontFamily});
|
|
255
|
+
font-size: var(--mermaid-usecase-font-size, 12px);
|
|
256
|
+
font-weight: var(--mermaid-usecase-font-weight, normal);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
& .usecase-stereotype,
|
|
260
|
+
& .usecase-business-marker {
|
|
261
|
+
color: ${t.primaryTextColor};
|
|
262
|
+
fill: ${t.primaryTextColor};
|
|
263
|
+
stroke: ${e.border};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
& .system-boundary rect.boundary-body,
|
|
267
|
+
& .system-boundary rect.boundary-tab,
|
|
268
|
+
& .system-boundary-package-tab {
|
|
269
|
+
fill: ${e.boundaryBkg};
|
|
270
|
+
stroke: ${e.boundaryBorder};
|
|
271
|
+
stroke-width: 1px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
& .system-boundary-title text {
|
|
275
|
+
fill: ${t.titleColor??t.primaryTextColor};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Only the span, never the <p> inside it: the renderer puts a user-supplied
|
|
279
|
+
'color' on the span, and that has to stay inheritable by its children. */
|
|
280
|
+
& .system-boundary-title span {
|
|
281
|
+
color: ${t.titleColor??t.primaryTextColor};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
& .usecase-note {
|
|
285
|
+
fill: ${t.noteBkgColor};
|
|
286
|
+
stroke: ${t.noteBorderColor};
|
|
287
|
+
color: ${t.noteTextColor};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
& .usecase-note .nodeLabel {
|
|
291
|
+
color: ${t.noteTextColor};
|
|
292
|
+
fill: ${t.noteTextColor};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
& .usecase-json-table,
|
|
296
|
+
& .usecase-json-table rect,
|
|
297
|
+
& .usecase-json-cell {
|
|
298
|
+
fill: ${t.mainBkg};
|
|
299
|
+
stroke: ${t.nodeBorder??t.primaryColor};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
& .usecase-json-title,
|
|
303
|
+
& .usecase-json-key,
|
|
304
|
+
& .usecase-json-value {
|
|
305
|
+
color: ${t.primaryTextColor};
|
|
306
|
+
fill: ${t.primaryTextColor};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
& .relationship {
|
|
310
|
+
fill: none;
|
|
311
|
+
stroke: ${t.lineColor};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
& .relationship-include,
|
|
315
|
+
& .relationship-extend,
|
|
316
|
+
& .relationship-note {
|
|
317
|
+
stroke-dasharray: 3;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/* Include and extend are both dashed, which is a weak distinction at small sizes. The
|
|
321
|
+
tokens default to \`lineColor\`, so a theme that does not set them is unchanged. */
|
|
322
|
+
& .relationship-include {
|
|
323
|
+
stroke: ${e.includeLine};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
& .relationship-extend {
|
|
327
|
+
stroke: ${e.extendLine};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
& .relationship.edge-animation-fast,
|
|
331
|
+
& .relationship.edge-animation-slow {
|
|
332
|
+
stroke-linecap: round;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
& .edgeLabel,
|
|
336
|
+
& .edgeLabel p {
|
|
337
|
+
background-color: ${t.edgeLabelBackground};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
& .labelBkg {
|
|
341
|
+
background-color: ${t.edgeLabelBackground};
|
|
342
|
+
padding: 0 2px;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
& .edgeLabel .label rect {
|
|
346
|
+
fill: ${t.edgeLabelBackground};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
& .relationship-label,
|
|
350
|
+
& .edgeLabel {
|
|
351
|
+
color: ${t.primaryTextColor};
|
|
352
|
+
fill: ${t.primaryTextColor};
|
|
353
|
+
font-family: ${t.fontFamily};
|
|
354
|
+
font-size: 10px;
|
|
355
|
+
font-weight: normal;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
& .marker,
|
|
359
|
+
& .marker.point,
|
|
360
|
+
& .marker.circle,
|
|
361
|
+
& .marker.cross {
|
|
362
|
+
fill: ${t.lineColor};
|
|
363
|
+
stroke: ${t.lineColor};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
& .marker.extension {
|
|
367
|
+
fill: ${t.mainBkg};
|
|
368
|
+
stroke: ${t.lineColor};
|
|
369
|
+
}
|
|
370
|
+
`},"getStyles"),hc=lc,rd={parser:Jo,db:Ts,renderer:ac,styles:hc};export{rd as diagram};
|