md/assets/gitGraph-F2EDSAW4-CPIvnsTM.js

128 lines
306 KiB
JavaScript
Raw Normal View History

var Lc=Object.defineProperty;var Pc=(n,e,t)=>e in n?Lc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Je=(n,e,t)=>Pc(n,typeof e!="symbol"?e+"":e,t);import{bs as Mc,bt as $c,aQ as no,bu as Dc,aD as Pt,bm as jc,aX as yi,aR as Wt,aV as Z,bv as Uc,bw as Fc,bx as Gc,aM as Bc,by as Xi,bk as Hc,bz as ro,bg as Wc,bA as io,bB as so,bC as ao,bD as Yi,bi as Vc,a_ as Kc,bE as zc,bF as qc,aY as Xc,bG as Yc,bH as oo,aA as b,bn as Ie,aC as pt,az as ze,aF as D,ah as te,aU as Ji,bI as q,bp as Mt,bJ as _e,bK as Jc,bL as yn}from"./index-BYEabZbf.js";import{v as K,b as Qc,a as I,h as S,r as oe,f as Ee}from"./reduce-WYFjpvqP.js";import{c as vi,f as $t,d as _i,m as Zc}from"./min-BolweAfC.js";var eu=Object.prototype,tu=eu.hasOwnProperty,Te=Mc(function(n,e){if($c(e)||no(e)){Dc(e,Pt(e),n);return}for(var t in e)tu.call(e,t)&&jc(n,t,e[t])});function an(n){for(var e=-1,t=n==null?0:n.length,r=0,i=[];++e<t;){var s=n[e];s&&(i[r++]=s)}return i}function nu(n,e,t,r){for(var i=-1,s=n==null?0:n.length;++i<s;){var a=n[i];e(r,a,t(a),n)}return r}function ru(n,e,t,r){return yi(n,function(i,s,a){e(r,i,t(i),a)}),r}function iu(n,e){return function(t,r){var i=Z(t)?nu:ru,s=e?e():{};return i(t,n,Wt(r),s)}}var su=200;function au(n,e,t,r){var i=-1,s=Fc,a=!0,o=n.length,l=[],c=e.length;if(!o)return l;e.length>=su&&(s=Gc,a=!1,e=new Uc(e));e:for(;++i<o;){var u=n[i],d=u;if(u=u!==0?u:0,a&&d===d){for(var f=c;f--;)if(e[f]===d)continue e;l.push(u)}else s(e,d,r)||l.push(u)}return l}var Qn=Bc(function(n,e){return Xi(n)?au(n,Hc(e,1,Xi,!0)):[]});function J(n,e,t){var r=n==null?0:n.length;return r?(e=e===void 0?1:vi(e),ro(n,e<0?0:e,r)):[]}function tn(n,e,t){var r=n==null?0:n.length;return r?(e=e===void 0?1:vi(e),e=r-e,ro(n,0,e<0?0:e)):[]}function ou(n,e){for(var t=-1,r=n==null?0:n.length;++t<r;)if(!e(n[t],t,n))return!1;return!0}function lu(n,e){var t=!0;return yi(n,function(r,i,s){return t=!!e(r,i,s),t}),t}function we(n,e,t){var r=Z(n)?ou:lu;return r(n,Wt(e))}function Le(n){return n&&n.length?n[0]:void 0}var cu=Object.prototype,uu=cu.hasOwnProperty,du=iu(function(n,e,t){uu.call(n,t)?n[t].push(e):Wc(n,t,[e])}),fu="[object String]";function fe(n){return typeof n=="string"||!Z(n)&&io(n)&&so(n)==fu}var hu=Math.max;function ue(n,e,t,r){n=no(n)?n:K(n),t=t&&!r?vi(t):0;var i=n.length;return t<0&&(t=hu(i+t,0)),fe(n)?t<=i&&n.indexOf(e,t)>-1:!!i&&ao(n,e,t)>-1}function Qi(n,e,t){var r=n==null?0:n.length;if(!r)return-1;var i=0;return ao(n,e,i)}var pu="[object RegExp]";function mu(n){return io(n)&&so(n)==pu}var Zi=Yi&&Yi.isRegExp,qe=Zi?Vc(Zi):mu,gu="Expected a function";function yu(n){if(typeof n!="function")throw new TypeError(gu);return function(){var e=arguments;switch(e.length){case 0:return!n.call(this);case 1:return!n.call(this,e[0]);case 2:return!n.call(this,e[0],e[1]);case 3:return!n.call(this,e[0],e[1],e[2])}return!n.apply(this,e)}}function Pe(n,e){if(n==null)return{};var t=Kc(zc(n),function(r){return[r]});return e=Wt(e),qc(n,t,function(r,i){return e(r,i[0])})}function Zn(n,e){var t=Z(n)?Xc:Qc;return t(n,yu(Wt(e)))}function vu(n,e){var t;return yi(n,function(r,i,s){return t=e(r,i,s),!t}),!!t}function lo(n,e,t){var r=Z(n)?Yc:vu;return r(n,Wt(e))}function Ti(n){return n&&n.length?oo(n):[]}function _u(n,e){return n&&n.length?oo(n,Wt(e)):[]}function ae(n){return typeof n=="object"&&n!==null&&typeof n.$type=="string"}function De(n){return typeof n=="object"&&n!==null&&typeof n.$refText=="string"}function Tu(n){return typeof n=="object"&&n!==null&&typeof n.name=="string"&&typeof n.type=="string"&&typeof n.path=="string"}function Rn(n){return typeof n=="object"&&n!==null&&ae(n.container)&&De(n.reference)&&typeof n.message=="string"}class co{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return ae(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[t];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,t);return r[t]=s,s}}getAllSubTypes(e){const t=this.allSubtypes[e];if(t)return t;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubt
`),C("\r"),C(" "),C("\v"),C(" "),C(" "),C(""),C(" "),C(""),C(""),C(""),C(""),C(""),C(""),C(""),C(""),C(""),C(""),C("\u2028"),C("\u2029"),C(""),C(""),C(" "),C("\uFEFF")],ad=/[0-9a-fA-F]/,vn=/[0-9]/,od=/[1-9]/;class Yo{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("/");const t=this.disjunction();this.consumeChar("/");const r={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":Xt(r,"global");break;case"i":Xt(r,"ignoreCase");break;case"m":Xt(r,"multiLine");break;case"u":Xt(r,"unicode");break;case"y":Xt(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:t,loc:this.loc(0)}}disjunction(){const e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){const e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break}vt(t);const r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return sd()}quantifier(e=!1){let t;const r=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),t={atLeast:i,atMost:s}):t={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;vt(t);break}if(!(e===!0&&t===void 0)&&vt(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(r),t}atom(){let e;const t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),vt(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[C(`
`),C("\r"),C("\u2028"),C("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=Cn;break;case"D":e=Cn,t=!0;break;case"s":e=ss;break;case"S":e=ss,t=!0;break;case"w":e=wn;break;case"W":e=wn,t=!0;break}if(vt(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=C("\f");break;case"n":e=C(`
`);break;case"r":e=C("\r");break;case"t":e=C(" ");break;case"v":e=C("\v");break}if(vt(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const 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:C("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:C(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:C(e)}}}characterClass(){const e=[];let t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,is(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,is(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else Tr(r.value,e),e.push(C("-")),Tr(i.value,e)}else Tr(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
`: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:C("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const t=this.disjunction();this.consumeChar(")");const r={type:"Group",capturing:e,value:t};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(od.test(e)===!1)throw Error("Expecting a positive integer");for(;vn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(vn.test(e)===!1)throw Error("Expecting an integer");for(;vn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
`: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:C(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 vn.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
`: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)==="!");default:return!1}}isQuantifier(){const 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`
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let i=0;i<e;i++){const s=this.popChar();if(ad.test(s)===!1)throw Error("Expecting a HexDecimal digits");t+=s}return{type:"Character",value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const 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}}}class rr{visitChildren(e){for(const t in e){const r=e[t];e.hasOwnProperty(t)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.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"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){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const ld=/\r?\n/gm,cd=new Yo;class ud extends rr{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const t=String.fromCharCode(e.value);if(!this.multiline&&t===`
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=ir(t);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){const t=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(t);this.multiline=!!`
`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const Er=new ud;function dd(n){try{return typeof n=="string"&&(n=new RegExp(n)),n=n.toString(),Er.reset(n),Er.visit(cd.pattern(n)),Er.multiline}catch{return!1}}function as(n){return(typeof n=="string"?new RegExp(n):n).test(" ")}function ir(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fd(n){return Array.prototype.map.call(n,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:ir(e)).join("")}function hd(n,e){const t=pd(n),r=e.match(t);return!!r&&r[0].length>0}function pd(n){typeof n=="string"&&(n=new RegExp(n));const e=n,t=n.source;let r=0;function i(){let s="",a;function o(c){s+=t.substr(r,c),r+=c}function l(c){s+="(?:"+t.substr(r,c)+"|$)",r+=c}for(;r<t.length;)switch(t[r]){case"\\":switch(t[r+1]){case"c":l(3);break;case"x":l(4);break;case"u":e.unicode?t[r+2]==="{"?l(t.indexOf("}",r)-r+1):l(6):l(2);break;case"p":case"P":e.unicode?l(t.indexOf("}",r)-r+1):l(2);break;case"k":l(t.indexOf(">",r)-r+1);break;default:l(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(t)||[],l(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(t),a?o(a[0].length):l(1);break;case"(":if(t[r+1]==="?")switch(t[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":a=r,r+=3,i(),s+=t.substr(a,r-a);break;case"<":switch(t[r+3]){case"=":case"!":a=r,r+=4,i(),s+=t.substr(a,r-a);break;default:o(t.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else o(1),s+=i()+"|$)";break;case")":return++r,s;default:l(1);break}return s}return new RegExp(i(),n.flags)}function md(n){return n.rules.find(e=>Se(e)&&e.entry)}function gd(n){return n.rules.filter(e=>mt(e)&&e.hidden)}function Jo(n,e){const t=new Set,r=md(n);if(!r)return new Set(n.rules);const i=[r].concat(gd(n));for(const a of i)Qo(a,t,e);const s=new Set;for(const a of n.rules)(t.has(a.name)||mt(a)&&a.hidden)&&s.add(a);return s}function Qo(n,e,t){e.add(n.name),on(n).forEach(r=>{if(dt(r)||t){const i=r.rule.ref;i&&!e.has(i.name)&&Qo(i,e,t)}})}function yd(n){if(n.terminal)return n.terminal;if(n.type.ref){const e=el(n.type.ref);return e==null?void 0:e.terminal}}function vd(n){return n.hidden&&!Ii(n).test(" ")}function _d(n,e){return!n||!e?[]:Ni(n,e,n.astNode,!0)}function Zo(n,e,t){if(!n||!e)return;const r=Ni(n,e,n.astNode,!0);if(r.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,r.length-1)):t=0,r[t]}function Ni(n,e,t,r){if(!r){const i=nr(n.grammarSource,ct);if(i&&i.feature===e)return[n]}return Dt(n)&&n.astNode===t?n.content.flatMap(i=>Ni(i,e,t,!1)):[]}function Td(n,e,t){if(!n)return;const r=Ed(n,e,n==null?void 0:n.astNode);if(r.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,r.length-1)):t=0,r[t]}function Ed(n,e,t){if(n.astNode!==t)return[];if(ut(n.grammarSource)&&n.grammarSource.value===e)return[n];const r=Pr(n).iterator();let i;const s=[];do if(i=r.next(),!i.done){const a=i.value;a.astNode===t?ut(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):r.prune()}while(!i.done);return s}function Rd(n){var e;const t=n.astNode;for(;t===((e=n.container)===null||e===void 0?void 0:e.astNode);){const r=nr(n.grammarSource,ct);if(r)return r;n=n.container}}function el(n){let e=n;return _o(e)&&(tr(e.$container)?e=e.$container.$container:Se(e.$container)?e=e.$container:er(e.$container)),tl(n,e,new Map)}function tl(n,e,t){var r;function i(s,a){let o;return nr(s,ct)||(o=tl(a,a,t)),t.set(n,o),o}if(t.has(n))return t.get(n);t.set(n,void 0);for(const s of on(e)){if(ct(s)&&s.feature.toLowerCase()==="name")return t.set(n,s),s;if(dt(s)&&Se(s.rule.ref))return i(s,s.rule.ref);if(Wu(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function ki(n){return nl(n,new Set)}function nl(n,e){if(e.has(n))return!0;e.add(n);for(const t of on(n))if(dt(t)){if(!t.rule.ref||Se(t.rule.ref)&&!nl(t.rule.ref,e))return!1
`;function Wd(n,e=!1){try{const t=or(n);return jr(t.value,{},t.flags.ignoreCase)}catch(t){if(t.message===ll)e&&il(`${Ln} Unable to optimize: < ${n.toString()} >
Complement Sets cannot be automatically optimized.
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Dr(`${Ln}
Failed parsing: < ${n.toString()} >
Using the @chevrotain/regexp-to-ast library
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function jr(n,e,t){switch(n.type){case"Disjunction":for(let i=0;i<n.value.length;i++)jr(n.value[i],e,t);break;case"Alternative":const r=n.value;for(let i=0;i<r.length;i++){const s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":_n(a.value,e,t);break;case"Set":if(a.complement===!0)throw Error(ll);I(a.value,l=>{if(typeof l=="number")_n(l,e,t);else{const c=l;if(t===!0)for(let u=c.from;u<=c.to;u++)_n(u,e,t);else{for(let u=c.from;u<=c.to&&u<Zt;u++)_n(u,e,t);if(c.to>=Zt){const u=c.from>=Zt?c.from:Zt,d=c.to,f=et(u),h=et(d);for(let m=f;m<=h;m++)e[m]=m}}}});break;case"Group":jr(a.value,e,t);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&Ur(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return K(e)}function _n(n,e,t){const r=et(n);e[r]=r,t===!0&&Vd(n,e)}function Vd(n,e){const t=String.fromCharCode(n),r=t.toUpperCase();if(r!==t){const i=et(r.charCodeAt(0));e[i]=i}else{const i=t.toLowerCase();if(i!==t){const s=et(i.charCodeAt(0));e[s]=s}}}function ls(n,e){return $t(n.value,t=>{if(typeof t=="number")return ue(e,t);{const r=t;return $t(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Ur(n){const e=n.quantifier;return e&&e.atLeast===0?!0:n.value?Z(n.value)?we(n.value,Ur):Ur(n.value):!1}class Kd extends rr{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}super.visitChildren(e)}}visitCharacter(e){ue(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?ls(e,this.targetCharCodes)===void 0&&(this.found=!0):ls(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function xi(n,e){if(e instanceof RegExp){const t=or(e),r=new Kd(n);return r.visit(t),r.found}else return $t(e,t=>ue(n,t.charCodeAt(0)))!==void 0}const ft="PATTERN",Qt="defaultMode",Tn="modes";let cl=typeof new RegExp("(?:)").sticky=="boolean";function zd(n,e){e=_i(e,{useSticky:cl,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:(E,_)=>_()});const t=e.tracer;t("initCharCodeToOptimizedIndexMap",()=>{yf()});let r;t("Reject Lexer.NA",()=>{r=Zn(n,E=>E[ft]===de.NA)});let i=!1,s;t("Transform Patterns",()=>{i=!1,s=b(r,E=>{const _=E[ft];if(qe(_)){const k=_.source;return k.length===1&&k!=="^"&&k!=="$"&&k!=="."&&!_.ignoreCase?k:k.length===2&&k[0]==="\\"&&!ue(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],k[1])?k[1]:e.useSticky?us(_):cs(_)}else{if(pt(_))return i=!0,{exec:_};if(typeof _=="object")return i=!0,_;if(typeof _=="string"){if(_.length===1)return _;{const k=_.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),j=new RegExp(k);return e.useSticky?us(j):cs(j)}}else throw Error("non exhaustive match")}})});let a,o,l,c,u;t("misc mapping",()=>{a=b(r,E=>E.tokenTypeIdx),o=b(r,E=>{const _=E.GROUP;if(_!==de.SKIPPED){if(fe(_))return _;if(ze(_))return!1;throw Error("non exhaustive match")}}),l=b(r,E=>{const _=E.LONGER_ALT;if(_)return Z(_)?b(_,j=>Qi(r,j)):[Qi(r,_)]}),c=b(r,E=>E.PUSH_MODE),u=b(r,E=>S(E,"POP_MODE"))});let d;t("Line Terminator Handling",()=>{const E=fl(e.lineTerminatorCharacters);d=b(r,_=>!1),e.positionTracking!=="onlyOffset"&&(d=b(r,_=>S(_,"LINE_BREAKS")?!!_.LINE_BREAKS:dl(_,E)===!1&&xi(E,_.PATTERN)))});let f,h,m,g;t("Misc Mapping #2",()=>{f=b(r,ul),h=b(s,pf),m=oe(r,(E,_)=>{const k=_.GROUP;return fe(k)&&k!==de.SKIPPED&&(E[k]=[]),E},{}),g=b(s,(E,_)=>({pattern:s[_],longerAlt:l[_],canLineTerminator:d[_],isCustom:f[_],short:h[_],group:o[_],push:c[_],pop:u[_],tokenTypeIdx:a[_],tokenType:r[_]}))});let T=!0,y=[];return e.safeMode||t("First Char Optimization",()=>{y=oe(r,(E,_,k)=>{if(typeof _.PATTERN=="string"){const j=_.PATTERN.charCodeAt(0),ne=et(j);Ar(E,ne,g[k])}else if(Z(_.START_CHARS_HINT)){let j;I(_.START_CHARS_HINT,ne=>{const xe=typeof ne=="string"?ne.charCodeAt(0):ne,ge=et(xe);j!==ge&&(j=ge,Ar(E,ge,g[k]))})}else if(qe(_.PATTERN))if(_.PATTERN.unicode)T=!1,e.ensureOptimizations&&Dr(`${Ln} Unable to analyze < ${_.PATTERN.toString()} > pattern.
The regexp unicode flag is not currently supported by the regexp-to-ast library.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const j=Wd(_.PATTERN,e.ensureOptimizations);D(j)&&(T=!1),I(j,ne=>{Ar(E,ne,g[k])})}else e.ensureOptimizations&&Dr(`${Ln} TokenType: <${_.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),T=!1;return E},[])}),{emptyGroups:m,patternIdxToConfig:g,charCodeToPatternIdxToConfig:y,hasCustom:i,canBeOptimized:T}}function qd(n,e){let t=[];const r=Yd(n);t=t.concat(r.errors);const i=Jd(r.valid),s=i.valid;return t=t.concat(i.errors),t=t.concat(Xd(s)),t=t.concat(af(s)),t=t.concat(of(s,e)),t=t.concat(lf(s)),t}function Xd(n){let e=[];const t=Ee(n,r=>qe(r[ft]));return e=e.concat(Zd(t)),e=e.concat(nf(t)),e=e.concat(rf(t)),e=e.concat(sf(t)),e=e.concat(ef(t)),e}function Yd(n){const e=Ee(n,i=>!S(i,ft)),t=b(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:W.MISSING_PATTERN,tokenTypes:[i]})),r=Qn(n,e);return{errors:t,valid:r}}function Jd(n){const e=Ee(n,i=>{const s=i[ft];return!qe(s)&&!pt(s)&&!S(s,"exec")&&!fe(s)}),t=b(e,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:W.INVALID_PATTERN,tokenTypes:[i]})),r=Qn(n,e);return{errors:t,valid:r}}const Qd=/[^\\][$]/;function Zd(n){class e extends rr{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const t=Ee(n,i=>{const s=i.PATTERN;try{const a=or(s),o=new e;return o.visit(a),o.found}catch{return Qd.test(s.source)}});return b(t,i=>({message:`Unexpected RegExp Anchor Error:
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:W.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function ef(n){const e=Ee(n,r=>r.PATTERN.test(""));return b(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:W.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const tf=/[^\\[][\^]|^\^/;function nf(n){class e extends rr{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const t=Ee(n,i=>{const s=i.PATTERN;try{const a=or(s),o=new e;return o.visit(a),o.found}catch{return tf.test(s.source)}});return b(t,i=>({message:`Unexpected RegExp Anchor Error:
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:W.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function rf(n){const e=Ee(n,r=>{const i=r[ft];return i instanceof RegExp&&(i.multiline||i.global)});return b(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:W.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function sf(n){const e=[];let t=b(n,s=>oe(n,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!ue(e,o)&&o.PATTERN!==de.NA&&(e.push(o),a.push(o)),a),[]));t=an(t);const r=Ee(t,s=>s.length>1);return b(r,s=>{const a=b(s,l=>l.name);return{message:`The same RegExp pattern ->${Le(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:W.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function af(n){const e=Ee(n,r=>{if(!S(r,"GROUP"))return!1;const i=r.GROUP;return i!==de.SKIPPED&&i!==de.NA&&!fe(i)});return b(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:W.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function of(n,e){const t=Ee(n,i=>i.PUSH_MODE!==void 0&&!ue(e,i.PUSH_MODE));return b(t,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:W.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function lf(n){const e=[],t=oe(n,(r,i,s)=>{const a=i.PATTERN;return a===de.NA||(fe(a)?r.push({str:a,idx:s,tokenType:i}):qe(a)&&uf(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);return I(n,(r,i)=>{I(t,({str:s,idx:a,tokenType:o})=>{if(i<a&&cf(s,r.PATTERN)){const l=`Token: ->${o.name}<- can never be matched.
Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:W.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}function cf(n,e){if(qe(e)){const t=e.exec(n);return t!==null&&t.index===0}else{if(pt(e))return e(n,0,[],{});if(S(e,"exec"))return e.exec(n,0,[],{});if(typeof e=="string")return e===n;throw Error("non exhaustive match")}}function uf(n){return $t([".","\\","[","]","|","^","$","(",")","?","*","+","{"],t=>n.source.indexOf(t)!==-1)===void 0}function cs(n){const e=n.ignoreCase?"i":"";return new RegExp(`^(?:${n.source})`,e)}function us(n){const e=n.ignoreCase?"iy":"y";return new RegExp(`${n.source}`,e)}function df(n,e,t){const r=[];return S(n,Qt)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Qt+`> property in its definition
`,type:W.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),S(n,Tn)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Tn+`> property in its definition
`,type:W.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),S(n,Tn)&&S(n,Qt)&&!S(n.modes,n.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Qt}: <${n.defaultMode}>which does not exist
`,type:W.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),S(n,Tn)&&I(n.modes,(i,s)=>{I(i,(a,o)=>{if(ze(a))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
`,type:W.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(S(a,"LONGER_ALT")){const l=Z(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];I(l,c=>{!ze(c)&&!ue(i,c)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${c.name}> on token <${a.name}> outside of mode <${s}>
`,type:W.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function ff(n,e,t){const r=[];let i=!1;const s=an(Ie(K(n.modes))),a=Zn(s,l=>l[ft]===de.NA),o=fl(t);return e&&I(a,l=>{const c=dl(l,o);if(c!==!1){const d={message:gf(l,c),type:c.issue,tokenType:l};r.push(d)}else S(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):xi(o,l.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
This Lexer has been defined to track line and column information,
But none of the Token Types can be identified as matching a line terminator.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
for details.`,type:W.NO_LINE_BREAKS_FLAGS}),r}function hf(n){const e={},t=Pt(n);return I(t,r=>{const i=n[r];if(Z(i))e[r]=[];else throw Error("non exhaustive match")}),e}function ul(n){const e=n.PATTERN;if(qe(e))return!1;if(pt(e))return!0;if(S(e,"exec"))return!0;if(fe(e))return!1;throw Error("non exhaustive match")}function pf(n){return fe(n)&&n.length===1?n.charCodeAt(0):!1}const mf={test:function(n){const e=n.length;for(let t=this.lastIndex;t<e;t++){const r=n.charCodeAt(t);if(r===10)return this.lastIndex=t+1,!0;if(r===13)return n.charCodeAt(t+1)===10?this.lastIndex=t+2:this.lastIndex=t+1,!0}return!1},lastIndex:0};function dl(n,e){if(S(n,"LINE_BREAKS"))return!1;if(qe(n.PATTERN)){try{xi(e,n.PATTERN)}catch(t){return{issue:W.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if(fe(n.PATTERN))return!1;if(ul(n))return{issue:W.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function gf(n,e){if(e.issue===W.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
The problem is in the <${n.name}> Token Type
Root cause: ${e.errMsg}.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===W.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
The problem is in the <${n.name}> Token Type
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function fl(n){return b(n,t=>fe(t)?t.charCodeAt(0):t)}function Ar(n,e,t){n[e]===void 0?n[e]=[t]:n[e].push(t)}const Zt=256;let Nn=[];function et(n){return n<Zt?n:Nn[n]}function yf(){if(D(Nn)){Nn=new Array(65536);for(let n=0;n<65536;n++)Nn[n]=n>255?255+~~(n/255):n}}function cn(n,e){const t=n.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}function Pn(n,e){return n.tokenTypeIdx===e.tokenTypeIdx}let ds=1;const hl={};function un(n){const e=vf(n);_f(e),Ef(e),Tf(e),I(e,t=>{t.isParent=t.categoryMatches.length>0})}function vf(n){let e=te(n),t=n,r=!0;for(;r;){t=an(Ie(b(t,s=>s.CATEGORIES)));const i=Qn(t,e);e=e.concat(i),D(i)?r=!1:t=i}return e}function _f(n){I(n,e=>{ml(e)||(hl[ds]=e,e.tokenTypeIdx=ds++),fs(e)&&!Z(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),fs(e)||(e.CATEGORIES=[]),Rf(e)||(e.categoryMatches=[]),Af(e)||(e.categoryMatchesMap={})})}function Tf(n){I(n,e=>{e.categoryMatches=[],I(e.categoryMatchesMap,(t,r)=>{e.categoryMatches.push(hl[r].tokenTypeIdx)})})}function Ef(n){I(n,e=>{pl([],e)})}function pl(n,e){I(n,t=>{e.categoryMatchesMap[t.tokenTypeIdx]=!0}),I(e.CATEGORIES,t=>{const r=n.concat(e);ue(r,t)||pl(r,t)})}function ml(n){return S(n,"tokenTypeIdx")}function fs(n){return S(n,"CATEGORIES")}function Rf(n){return S(n,"categoryMatches")}function Af(n){return S(n,"categoryMatchesMap")}function bf(n){return S(n,"tokenTypeIdx")}const Nf={buildUnableToPopLexerModeMessage(n){return`Unable to pop Lexer Mode after encountering Token ->${n.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(n,e,t,r,i){return`unexpected character: ->${n.charAt(e)}<- at offset: ${e}, skipped ${t} characters.`}};var W;(function(n){n[n.MISSING_PATTERN=0]="MISSING_PATTERN",n[n.INVALID_PATTERN=1]="INVALID_PATTERN",n[n.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",n[n.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",n[n.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",n[n.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",n[n.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",n[n.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",n[n.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",n[n.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",n[n.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",n[n.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",n[n.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",n[n.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",n[n.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",n[n.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",n[n.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",n[n.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(W||(W={}));const en={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Nf,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(en);class de{constructor(e,t=en){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${i}>`);const{time:o,value:l}=sl(s),c=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${a}<-- <${i}> time: ${o}ms`),this.traceInitIndent--,l}else return s()},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
a boolean 2nd argument is no longer supported`);this.config=Te({},en,t);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===en.lineTerminatorsPattern)this.config.lineTerminatorsPattern=mf;else if(this.config.lineTerminatorCharacters===en.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Z(e)?i={modes:{defaultMode:te(e)},defaultMode:Qt}:(s=!1,i=te(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(df(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(ff(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},I(i.modes,(o,l)=>{i.modes[l]=Zn(o,c=>ze(c))});const a=Pt(i.modes);if(I(i.modes,(o,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(qd(o,a))}),D(this.lexerDefinitionErrors)){un(o);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=zd(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=c.charCodeToPatternIdxToConfig,this.emptyGroups=Te({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,!D(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const l=b(this.lexerDefinitionErrors,c=>c.message).join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+l)}I(this.lexerDefinitionWarning,o=>{il(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(cl?(this.chopInput=Ji,this.match=this.matchWithTest):(this.updateLastIndex=q,this.match=this.matchWithExec),s&&(this.handleModes=q),this.trackStartLines===!1&&(this.computeNewColumn=Ji),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=q),/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",()=>{const o=oe(this.canModeBeOptimized,(l,c,u)=>(c===!1&&l.push(u),l),[]);if(t.ensureOptimizations&&!D(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized.
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Hd()}),this.TRACE_INIT("toFastProperties",()=>{al(this)})})}tokenize(e,t=this.defaultMode){if(!D(this.lexerDefinitionErrors)){const i=b(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
`+i)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let r,i,s,a,o,l,c,u,d,f,h,m,g,T,y;const E=e,_=E.length;let k=0,j=0;const ne=this.hasCustom?0:Math.floor(e.length/10),xe=new Array(ne),ge=[];let Me=this.trackStartLines?1:void 0,be=this.trackStartLines?1:void 0;const A=hf(this.emptyGroups),v=this.trackStartLines,R=this.config.lineTerminatorsPattern;let N=0,L=[],O=[];const w=[],ye=[];Object.freeze(ye);let z;function B(){return L}function at(re){const Ne=et(re),yt=O[Ne];return yt===void 0?ye:yt}const Oc=re=>{if(w.length===1&&re.tokenType.PUSH_MODE===void 0){const Ne=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(re);ge.push({offset:re.startOffset,line:re.startLine,column:re.startColumn,length:re.image.length,message:Ne})}else{w.pop();const Ne=Mt(w);L=this.patternIdxToConfig[Ne],O=this.charCodeToPatternIdxToConfig[Ne],N=L.length;const yt=this.canModeBeOptimized[Ne]&&this.config.safeMode===!1;O&&yt?z=at:z=B}};function Ki(re){w.push(re),O=this.charCodeToPatternIdxToConfig[re],L=this.patternIdxToConfig[re],N=L.length,N=L.length;const Ne=this.canModeBeOptimized[re]&&this.config.safeMode===!1;O&&Ne?z=at:z=B}Ki.call(this,t);let Ce;const zi=this.config.recoveryEnabled;for(;k<_;){l=null;const re=E.charCodeAt(k),Ne=z(re),yt=Ne.length;for(r=0;r<yt;r++){Ce=Ne[r];const ve=Ce.pattern;c=null;const Be=Ce.short;if(Be!==!1?re===Be&&(l=ve):Ce.isCustom===!0?(y=ve.exec(E,k,xe,A),y!==null?(l=y[0],y.payload!==void 0&&(c=y.payload)):l=null):(this.updateLastIndex(ve,k),l=this.match(ve,e,k)),l!==null){if(o=Ce.longerAlt,o!==void 0){const Ye=o.length;for(s=0;s<Ye;s++){const He=L[o[s]],ot=He.pattern;if(u=null,He.isCustom===!0?(y=ot.exec(E,k,xe,A),y!==null?(a=y[0],y.payload!==void 0&&(u=y.payload)):a=null):(this.updateLastIndex(ot,k),a=this.match(ot,e,k)),a&&a.length>l.length){l=a,c=u,Ce=He;break}}}break}}if(l!==null){if(d=l.length,f=Ce.group,f!==void 0&&(h=Ce.tokenTypeIdx,m=this.createTokenInstance(l,k,h,Ce.tokenType,Me,be,d),this.handlePayload(m,c),f===!1?j=this.addToken(xe,j,m):A[f].push(m)),e=this.chopInput(e,d),k=k+d,be=this.computeNewColumn(be,d),v===!0&&Ce.canLineTerminator===!0){let ve=0,Be,Ye;R.lastIndex=0;do Be=R.test(l),Be===!0&&(Ye=R.lastIndex-1,ve++);while(Be===!0);ve!==0&&(Me=Me+ve,be=d-Ye,this.updateTokenEndLineColumnLocation(m,f,Ye,ve,Me,be,d))}this.handleModes(Ce,Oc,Ki,m)}else{const ve=k,Be=Me,Ye=be;let He=zi===!1;for(;He===!1&&k<_;)for(e=this.chopInput(e,1),k++,i=0;i<N;i++){const ot=L[i],yr=ot.pattern,qi=ot.short;if(qi!==!1?E.charCodeAt(k)===qi&&(He=!0):ot.isCustom===!0?He=yr.exec(E,k,xe,A)!==null:(this.updateLastIndex(yr,k),He=yr.exec(e)!==null),He===!0)break}if(g=k-ve,be=this.computeNewColumn(be,g),T=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(E,ve,g,Be,Ye),ge.push({offset:ve,line:Be,column:Ye,length:g,message:T}),zi===!1)break}}return this.hasCustom||(xe.length=j),{tokens:xe,groups:A,errors:ge}}handleModes(e,t,r,i){if(e.pop===!0){const s=e.push;t(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,r,i,s,a,o){let l,c;t!==void 0&&(l=r===o-1,c=l?-1:0,i===1&&l===!0||(e.endLine=s+c,e.endColumn=a-1+-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,r,i){return{image:e,startOffset:t,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,t,r,i,s,a){return{image:e,startOffset:t,startLine:s,startColumn:a,tokenTypeIdx:r,tokenType:i}}createFullToken(e,t,r,i,s,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,t,r){return e.push(r),t}addTokenUsingMemberAccess(e,t,r){return e[t]=r,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}matchWithTest(e,t,r){return e.test(t)===!0?t.substring(r,e.lastIndex):null}matchWithExec(e,t){const r=e.exec(t);return r!==null?r[0]:null}}de.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for examp
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return S(n,hs)&&(t.CATEGORIES=n[hs]),un([t]),S(n,ps)&&(t.LABEL=n[ps]),S(n,ms)&&(t.GROUP=n[ms]),S(n,ys)&&(t.POP_MODE=n[ys]),S(n,gs)&&(t.PUSH_MODE=n[gs]),S(n,vs)&&(t.LONGER_ALT=n[vs]),S(n,_s)&&(t.LINE_BREAKS=n[_s]),S(n,Ts)&&(t.START_CHARS_HINT=n[Ts]),t}const tt=yl({name:"EOF",pattern:de.NA});un([tt]);function Ci(n,e,t,r,i,s,a,o){return{image:e,startOffset:t,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:n.tokenTypeIdx,tokenType:n}}function vl(n,e){return cn(n,e)}const _t={buildMismatchTokenMessage({expected:n,actual:e,previous:t,ruleName:r}){return`Expecting ${gl(n)?`--> ${Rt(n)} <--`:`token of type --> ${n.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:n,ruleName:e}){return"Redundant input, expecting EOF but found: "+n.image},buildNoViableAltMessage({expectedPathsPerAlt:n,actual:e,previous:t,customUserDescription:r,ruleName:i}){const s="Expecting: ",o=`
but found: '`+Le(e).image+"'";if(r)return s+r+o;{const l=oe(n,(f,h)=>f.concat(h),[]),c=b(l,f=>`[${b(f,h=>Rt(h)).join(", ")}]`),d=`one of these possible Token sequences:
${b(c,(f,h)=>` ${h+1}. ${f}`).join(`
`)}`;return s+d+o}},buildEarlyExitMessage({expectedIterationPaths:n,actual:e,customUserDescription:t,ruleName:r}){const i="Expecting: ",a=`
but found: '`+Le(e).image+"'";if(t)return i+t+a;{const l=`expecting at least one iteration which starts with one of these possible Token sequences::
<${b(n,c=>`[${b(c,u=>Rt(u)).join(",")}]`).join(" ,")}>`;return i+l+a}}};Object.freeze(_t);const Sf={buildRuleNotFoundError(n,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+n.name+"<-"}},lt={buildDuplicateFoundError(n,e){function t(u){return u instanceof U?u.terminalType.name:u instanceof le?u.nonTerminalName:""}const r=n.name,i=Le(e),s=i.idx,a=$e(i),o=t(i),l=s>0;let c=`->${a}${l?s:""}<- ${o?`with argument: ->${o}<-`:""}
appears more than once (${e.length} times) in the top level rule: ->${r}<-.
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
`;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,`
`),c},buildNamespaceConflictError(n){return`Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${n.name}>.
To resolve this make sure each Terminal and Non-Terminal names are unique
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(n){const e=b(n.prefixPath,i=>Rt(i)).join(", "),t=n.alternation.idx===0?"":n.alternation.idx;return`Ambiguous alternatives: <${n.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in <OR${t}> inside <${n.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
For Further details.`},buildAlternationAmbiguityError(n){const e=b(n.prefixPath,i=>Rt(i)).join(", "),t=n.alternation.idx===0?"":n.alternation.idx;let r=`Ambiguous Alternatives Detected: <${n.ambiguityIndices.join(" ,")}> in <OR${t}> inside <${n.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,r},buildEmptyRepetitionError(n){let e=$e(n.repetition);return n.repetition.idx!==0&&(e+=n.repetition.idx),`The repetition <${e}> within Rule <${n.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`},buildTokenNameError(n){return"deprecated"},buildEmptyAlternationError(n){return`Ambiguous empty alternative: <${n.emptyChoiceIdx+1}> in <OR${n.alternation.idx}> inside <${n.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(n){return`An Alternation cannot have more than 256 alternatives:
<OR${n.alternation.idx}> inside <${n.topLevelRule.name}> Rule.
has ${n.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(n){const e=n.topLevelRule.name,t=b(n.leftRecursionPath,s=>s.name),r=`${e} --> ${t.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
rule: <${e}> can be invoked from itself (directly or indirectly)
without consuming any Tokens. The grammar path that causes this is:
${r}
To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(n){return"deprecated"},buildDuplicateRuleNameError(n){let e;return n.topLevelRule instanceof Kt?e=n.topLevelRule.name:e=n.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${n.grammarName}<-`}};function xf(n,e){const t=new Cf(n,e);return t.resolveRefs(),t.errors}class Cf extends zt{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){I(K(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:ce.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class wf extends ar{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=te(this.path.ruleStack).reverse(),this.occurrenceStack=te(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=t.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){D(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Of extends wf{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=t.concat(r),s=new he({definition:i});this.possibleTokTypes=ln(s),this.found=!0}}}class lr extends ar{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Lf extends lr{walkMany(e,t,r){if(e.idx===this.occurrence){const i=Le(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof U&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,t,r)}}class Es extends lr{walkManySep(e,t,r){if(e.idx===this.occurrence){const i=Le(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof U&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,t,r)}}class Pf extends lr{walkAtLeastOne(e,t,r){if(e.idx===this.occurrence){const i=Le(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof U&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,t,r)}}class Rs extends lr{walkAtLeastOneSep(e,t,r){if(e.idx===this.occurrence){const i=Le(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof U&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,t,r)}}function Fr(n,e,t=[]){t=te(t);let r=[],i=0;function s(o){return o.concat(J(n,i+1))}function a(o){const l=Fr(s(o),e,t);return r.concat(l)}for(;t.length<e&&i<n.length;){const o=n[i];if(o instanceof he)return a(o.definition);if(o instanceof le)return a(o.definition);if(o instanceof ee)r=a(o.definition);else if(o instanceof Re){const l=o.definition.concat([new H({definition:o.definition})]);return a(l)}else if(o instanceof Ae){const l=[new he({definition:o.definition}),new H({definition:[new U({terminalType:o.separator})].concat(o.definition)})];return a(l)}else if(o instanceof pe){const l=o.
${s.join(`
`).replace(/\n/g,`
`)}`)}}};return t.prototype=r,t.prototype.constructor=t,t._RULE_NAMES=e,t}function Eh(n,e,t){const r=function(){};Pl(r,n+"BaseSemanticsWithDefaults");const i=Object.create(t.prototype);return I(e,s=>{i[s]=_h}),r.prototype=i,r.prototype.constructor=r,r}var Vr;(function(n){n[n.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",n[n.MISSING_METHOD=1]="MISSING_METHOD"})(Vr||(Vr={}));function Rh(n,e){return Ah(n,e)}function Ah(n,e){const t=Ee(e,i=>pt(n[i])===!1),r=b(t,i=>({msg:`Missing visitor method: <${i}> on ${n.constructor.name} CST Visitor.`,type:Vr.MISSING_METHOD,methodName:i}));return an(r)}class bh{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=S(e,"nodeLocationTracking")?e.nodeLocationTracking:Xe.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=q,this.cstFinallyStateUpdate=q,this.cstPostTerminal=q,this.cstPostNonTerminal=q,this.cstPostRule=q;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ks,this.setNodeLocationFromNode=ks,this.cstPostRule=q,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=q,this.setNodeLocationFromNode=q,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Ns,this.setNodeLocationFromNode=Ns,this.cstPostRule=q,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=q,this.setNodeLocationFromNode=q,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=q,this.setNodeLocationFromNode=q,this.cstPostRule=q,this.setInitialNodeLocation=q;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?(r.endOffset=t.endOffset,r.endLine=t.endLine,r.endColumn=t.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?r.endOffset=t.endOffset:r.startOffset=NaN}cstPostTerminal(e,t){const r=this.CST_STACK[this.CST_STACK.length-1];gh(r,t,e),this.setNodeLocationFromToken(r.location,t)}cstPostNonTerminal(e,t){const r=this.CST_STACK[this.CST_STACK.length-1];yh(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(ze(this.baseCstVisitorConstructor)){const e=Th(this.className,Pt(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(ze(this.baseCstVisitorWithDefaultsConstructor)){const e=Eh(this.className,Pt(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class Nh{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){i
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details.`);if(Z(e)){if(D(e))throw Error(`A Token Vocabulary cannot be empty.
Note that the first argument for the parser constructor
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.
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
For Further details.`)}if(Z(e))this.tokensMap=oe(e,(s,a)=>(s[a.name]=a,s),{});else if(S(e,"modes")&&we(Ie(K(e.modes)),bf)){const s=Ie(K(e.modes)),a=Ti(s);this.tokensMap=oe(a,(o,l)=>(o[l.name]=l,o),{})}else if(Jc(e))this.tokensMap=te(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=tt;const r=S(e,"modes")?Ie(K(e.modes)):K(e),i=we(r,s=>D(s.categoryMatches));this.tokenMatcher=i?Pn:cn,un(K(this.tokensMap))}defineRule(e,t,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=S(r,"resyncEnabled")?r.resyncEnabled:jn.resyncEnabled,s=S(r,"recoveryValueFunc")?r.recoveryValueFunc:jn.recoveryValueFunc,a=this.ruleShortNameIdx<<fh+it;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...u){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,u);const d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...u){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,u)}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,r){const i=this.RULE_STACK.length===1,s=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Mn(e)){const a=e;if(s){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return r(e);else{if(this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,a.partialCstResult=l}throw a}}else{if(i)return this.moveToTerminatedState(),r(e);throw a}}else throw e}optionInternal(e,t){const r=this.getKeyForAutomaticLookahead(Ll,t);return this.optionInternalLogic(e,t,r)}optionInternalLogic(e,t,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const a=e.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,t){const r=this.getKeyForAutomaticLookahead(Hr,e);return this.atLeastOneInternalLogic(e,t,r)}atLeastOneInternalLogic(e,t,r){let i=this.getLaFuncFromCache(r),s;if(typeof t!="function"){s=t.DEF;const a=t.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=t;if(i.call(this)===!0){let a=this.doSingleRepetition(s);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,G.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,Hr,e,Pf)}atLeastOneSepFirstInternal(e,t){const r=this.getKeyForAutomaticLookahead(In,e);this.atLeastOneSepFirstInternalLogic(e,t,r)}atLeastOneSepFirstInternalLogic(e,t,r){const i=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Rs],o,In,e,Rs)}else throw this.raiseEarlyExitException(e,G.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){const r=this.getKeyForAutomaticLookahead(Br,e);return this.manyInternalLogic(e,t,r)}manyInternalLogic(e,t,r){let i=this.getLaFuncFromCache(r),s;if(typeof t!="function"){s=t.DEF;const o=t.GATE;if(o!==void 0){const l=i;i=()=>o.call(this)&&l.call(this)}}else s=t;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,Br,e,Lf,a)}manySepFirstInternal(e,t){const r=this.getKeyForAutomaticLookahead(Wr,e);this.manySepFirstInternalLogic(e,t,r)}manySepFirstInternalLogic(e,t,r){const i=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Es],o,Wr,e,Es)}}repetitionSepSecondInternal(e,t,r,i,s){for(;r();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,i,s],r,In,e,s)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const r=this.getKeyForAutomaticLookahead(Ol,t),i=Z(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a].AL
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze($l);const Ch={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class wh{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++){const t=e>0?e:"";this[`CONSUME${t}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${t}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${t}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${t}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${t}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${t}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${t}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${t}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,t,r){return this.consumeInternalRecord(t,e,r)},this.subrule=function(e,t,r){return this.subruleInternalRecord(t,e,r)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let t=0;t<10;t++){const r=t>0?t:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return Dn}topLevelRuleRecord(e,t){try{const r=new Kt({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
This error was thrown during the "grammar recording phase" For more info see:
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,t){return Yt.call(this,ee,e,t)}atLeastOneInternalRecord(e,t){Yt.call(this,Re,t,e)}atLeastOneSepFirstInternalRecord(e,t){Yt.call(this,Ae,t,e,Is)}manyInternalRecord(e,t){Yt.call(this,H,t,e)}manySepFirstInternalRecord(e,t){Yt.call(this,pe,t,e,Is)}orInternalRecord(e,t){return Oh.call(this,e,t)}subruleInternalRecord(e,t,r){if($n(t),!e||S(e,"ruleName")===!1){const o=new Error(`<SUBRULE${xs(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=Mt(this.recordingProdStack),s=e.ruleName,a=new le({idx:t,nonTerminalName:s,label:r==null?void 0:r.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?Ch:fr}consumeInternalRecord(e,t,r){if($n(t),!ml(e)){const a=new Error(`<CONSUME${xs(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=Mt(this.recordingProdStack),s=new U({idx:t,terminalType:e,label:r==null?void 0:r.LABEL});return i.definition.push(s),$l}}function Yt(n,e,t,r=!1){$n(t);const i=Mt(this.recordingProdStack),s=pt(e)?e:e.DEF,a=new n({definition:[],idx:t});return r&&(a.separator=e.SEP),S(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),fr}function Oh(n,e){$n(e);const t=Mt(this.recordingProdStack),r=Z(n)===!1,i=r===!1?n:n.DEF,s=new me({definition:[],idx:e,ignoreAmbiguities:r&&n.IGNORE_AMBIGUITIES===!0});S(n,"MAX_LOOKAHEAD")&&(s.maxLookahead=n.MAX_LOOKAHEAD);const a=lo(i,o=>pt(o.GATE));return s.hasPredicates=a,t.definition.push(s),I(i,o=>{const l=new he({definition:[]});s.definition.push(l),S(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:S(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),fr}function xs(n){return n===0?"":`${n}`}function $n(n){if(n<0||n>Ss){const e=new Error(`Invalid DSL Method idx value: <${n}>
Idx value must be a none negative value smaller than ${Ss+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class Lh{initPerformanceTracer(e){if(S(e,"traceInitPerf")){const t=e.traceInitPerf,r=typeof t=="number";this.traceInitMaxIdent=r?t:1/0,this.traceInitPerf=r?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Xe.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);const{time:i,value:s}=sl(t),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return t()}}function Ph(n,e){e.forEach(t=>{const r=t.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(n.prototype,i,s):n.prototype[i]=t.prototype[i]})})}const Dn=Ci(tt,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Dn);const Xe=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:_t,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),jn=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var ce;(function(n){n[n.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",n[n.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",n[n.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",n[n.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",n[n.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",n[n.LEFT_RECURSION=5]="LEFT_RECURSION",n[n.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",n[n.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",n[n.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",n[n.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",n[n.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",n[n.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",n[n.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",n[n.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(ce||(ce={}));function Cs(n=void 0){return function(){return n}}class dn{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;const t=this.className;this.TRACE_INIT("toFastProps",()=>{al(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),I(this.definedRulesNames,i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=ih({rules:K(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(D(r)&&this.skipValidations===!1){const i=sh({rules:K(this.gastProductionsCache),tokenTypes:K(this.tokensMap),errMsgProvider:lt,grammarName:t}),s=Hf({lookaheadStrategy:this.lookaheadStrategy,rules:K(this.gastProductionsCache),tokenTypes:K(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(i,s)}}),D(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=Fd(K(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:K(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(K(this.gastProductionsCache))})),!dn.DEFER_DEFINITION_ERRORS_HANDLING&&!D(this.definitionErrors))throw e=b(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
${e.join(`
-------------------------------
`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(t),r.initLexerAdapter(),r.initLooksAhead(t),r.initRecognizerEngine(e,t),r.initRecoverable(t),r.initTreeBuilder(t),r.initContentAssist(),r.initGastRecorder(t),r.initPerformanceTracer(t),S(t,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
For further details.`);this.skipValidations=S(t,"skipValidations")?t.skipValidations:Xe.skipValidations}}dn.DEFER_DEFINITION_ERRORS_HANDLING=!1;Ph(dn,[uh,hh,bh,Nh,Ih,kh,Sh,xh,wh,Lh]);class Mh extends dn{constructor(e,t=Xe){const r=te(t);r.outputCst=!1,super(e,r)}}function jt(n,e,t){return`${n.name}_${e}_${t}`}const nt=1,$h=2,Dl=4,jl=5,fn=7,Dh=8,jh=9,Uh=10,Fh=11,Ul=12;class Pi{constructor(e){this.target=e}isEpsilon(){return!1}}class Mi extends Pi{constructor(e,t){super(e),this.tokenType=t}}class Fl extends Pi{constructor(e){super(e)}isEpsilon(){return!0}}class $i extends Pi{constructor(e,t,r){super(e),this.rule=t,this.followState=r}isEpsilon(){return!0}}function Gh(n){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};Bh(e,n);const t=n.length;for(let r=0;r<t;r++){const i=n[r],s=gt(e,i,i);s!==void 0&&Zh(e,i,s)}return e}function Bh(n,e){const t=e.length;for(let r=0;r<t;r++){const i=e[r],s=X(n,i,void 0,{type:$h}),a=X(n,i,void 0,{type:fn});s.stop=a,n.ruleToStartState.set(i,s),n.ruleToStopState.set(i,a)}}function Gl(n,e,t){return t instanceof U?Di(n,e,t.terminalType,t):t instanceof le?Qh(n,e,t):t instanceof me?zh(n,e,t):t instanceof ee?qh(n,e,t):t instanceof H?Hh(n,e,t):t instanceof pe?Wh(n,e,t):t instanceof Re?Vh(n,e,t):t instanceof Ae?Kh(n,e,t):gt(n,e,t)}function Hh(n,e,t){const r=X(n,e,t,{type:jl});st(n,r);const i=qt(n,e,r,t,gt(n,e,t));return Hl(n,e,t,i)}function Wh(n,e,t){const r=X(n,e,t,{type:jl});st(n,r);const i=qt(n,e,r,t,gt(n,e,t)),s=Di(n,e,t.separator,t);return Hl(n,e,t,i,s)}function Vh(n,e,t){const r=X(n,e,t,{type:Dl});st(n,r);const i=qt(n,e,r,t,gt(n,e,t));return Bl(n,e,t,i)}function Kh(n,e,t){const r=X(n,e,t,{type:Dl});st(n,r);const i=qt(n,e,r,t,gt(n,e,t)),s=Di(n,e,t.separator,t);return Bl(n,e,t,i,s)}function zh(n,e,t){const r=X(n,e,t,{type:nt});st(n,r);const i=b(t.definition,a=>Gl(n,e,a));return qt(n,e,r,t,...i)}function qh(n,e,t){const r=X(n,e,t,{type:nt});st(n,r);const i=qt(n,e,r,t,gt(n,e,t));return Xh(n,e,t,i)}function gt(n,e,t){const r=Ee(b(t.definition,i=>Gl(n,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:Jh(n,r)}function Bl(n,e,t,r,i){const s=r.left,a=r.right,o=X(n,e,t,{type:Fh});st(n,o);const l=X(n,e,t,{type:Ul});return s.loopback=o,l.loopback=o,n.decisionMap[jt(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",t.idx)]=o,V(a,o),i===void 0?(V(o,s),V(o,l)):(V(o,l),V(o,i.left),V(i.right,s)),{left:s,right:l}}function Hl(n,e,t,r,i){const s=r.left,a=r.right,o=X(n,e,t,{type:Uh});st(n,o);const l=X(n,e,t,{type:Ul}),c=X(n,e,t,{type:jh});return o.loopback=c,l.loopback=c,V(o,s),V(o,l),V(a,c),i!==void 0?(V(c,l),V(c,i.left),V(i.right,s)):V(c,o),n.decisionMap[jt(e,i?"RepetitionWithSeparator":"Repetition",t.idx)]=o,{left:o,right:l}}function Xh(n,e,t,r){const i=r.left,s=r.right;return V(i,s),n.decisionMap[jt(e,"Option",t.idx)]=i,r}function st(n,e){return n.decisionStates.push(e),e.decision=n.decisionStates.length-1,e.decision}function qt(n,e,t,r,...i){const s=X(n,e,r,{type:Dh,start:t});t.end=s;for(const o of i)o!==void 0?(V(t,o.left),V(o.right,s)):V(t,s);const a={left:t,right:s};return n.decisionMap[jt(e,Yh(r),r.idx)]=t,a}function Yh(n){if(n instanceof me)return"Alternation";if(n instanceof ee)return"Option";if(n instanceof H)return"Repetition";if(n instanceof pe)return"RepetitionWithSeparator";if(n instanceof Re)return"RepetitionMandatory";if(n instanceof Ae)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function Jh(n,e){const t=e.length;for(let s=0;s<t-1;s++){const a=e[s];let o;a.left.transitions.length===1&&(o=a.left.transitions[0]);const l=o instanceof $i,c=o,u=e[s+1].left;a.left.type===nt&&a.right.type===nt&&o!==void 0&&(l&&c.followState===a.right||o.target===a.right)?(l?c.followState=u:o.target=u,ep(n,a.right)):V(a.right,u)}const r=e[0],i=e[t-1];return{left:r.left,right:i.right}}function Di(n,e,t,r){const i=X(n,e,r,{type:nt}),s=X(n,e,r,{type:nt});return ji(i,new Mi(s,t)),{left:i,right:s}}function Qh(n,e,t){const r=t.referencedRule,i=n.ruleToStartState.get(r),s=X(n,e,t,{type:nt}),a=X(n,e,t
<${e}> may appears as a prefix path in all these alternatives.
`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,r}function lp(n){if(n instanceof le)return"SUBRULE";if(n instanceof ee)return"OPTION";if(n instanceof me)return"OR";if(n instanceof Re)return"AT_LEAST_ONE";if(n instanceof Ae)return"AT_LEAST_ONE_SEP";if(n instanceof pe)return"MANY_SEP";if(n instanceof H)return"MANY";if(n instanceof U)return"CONSUME";throw Error("non exhaustive match")}function cp(n,e,t){const r=_e(e.configs.elements,s=>s.state.transitions),i=_u(r.filter(s=>s instanceof Mi).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:t,possibleTokenTypes:i,tokenPath:n}}function up(n,e){return n.edges[e.tokenTypeIdx]}function dp(n,e,t){const r=new Kr,i=[];for(const a of n.elements){if(t.is(a.alt)===!1)continue;if(a.state.type===fn){i.push(a);continue}const o=a.state.transitions.length;for(let l=0;l<o;l++){const c=a.state.transitions[l],u=fp(c,e);u!==void 0&&r.add({state:u,alt:a.alt,stack:a.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new Kr;for(const a of r.elements)Fn(a,s)}if(i.length>0&&!gp(s))for(const a of i)s.add(a);return s}function fp(n,e){if(n instanceof Mi&&vl(e,n.tokenType))return n.target}function hp(n,e){let t;for(const r of n.elements)if(e.is(r.alt)===!0){if(t===void 0)t=r.alt;else if(t!==r.alt)return}return t}function Kl(n){return{configs:n,edges:{},isAcceptState:!1,prediction:-1}}function Ls(n,e,t,r){return r=zl(n,r),e.edges[t.tokenTypeIdx]=r,r}function zl(n,e){if(e===Un)return e;const t=e.configs.key,r=n.states[t];return r!==void 0?r:(e.configs.finalize(),n.states[t]=e,e)}function pp(n){const e=new Kr,t=n.transitions.length;for(let r=0;r<t;r++){const s={state:n.transitions[r].target,alt:r,stack:[]};Fn(s,e)}return e}function Fn(n,e){const t=n.state;if(t.type===fn){if(n.stack.length>0){const i=[...n.stack],a={state:i.pop(),alt:n.alt,stack:i};Fn(a,e)}else e.add(n);return}t.epsilonOnlyTransitions||e.add(n);const r=t.transitions.length;for(let i=0;i<r;i++){const s=t.transitions[i],a=mp(n,s);a!==void 0&&Fn(a,e)}}function mp(n,e){if(e instanceof Fl)return{state:e.target,alt:n.alt,stack:n.stack};if(e instanceof $i){const t=[...n.stack,e.followState];return{state:e.target,alt:n.alt,stack:t}}}function gp(n){for(const e of n.elements)if(e.state.type===fn)return!0;return!1}function yp(n){for(const e of n.elements)if(e.state.type!==fn)return!1;return!0}function vp(n){if(yp(n))return!0;const e=_p(n.elements);return Tp(e)&&!Ep(e)}function _p(n){const e=new Map;for(const t of n){const r=Wl(t,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[t.alt]=!0}return e}function Tp(n){for(const e of Array.from(n.values()))if(Object.keys(e).length>1)return!0;return!1}function Ep(n){for(const e of Array.from(n.values()))if(Object.keys(e).length===1)return!0;return!1}var Ps;(function(n){function e(t){return typeof t=="string"}n.is=e})(Ps||(Ps={}));var zr;(function(n){function e(t){return typeof t=="string"}n.is=e})(zr||(zr={}));var Ms;(function(n){n.MIN_VALUE=-2147483648,n.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&n.MIN_VALUE<=t&&t<=n.MAX_VALUE}n.is=e})(Ms||(Ms={}));var Gn;(function(n){n.MIN_VALUE=0,n.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&n.MIN_VALUE<=t&&t<=n.MAX_VALUE}n.is=e})(Gn||(Gn={}));var M;(function(n){function e(r,i){return r===Number.MAX_VALUE&&(r=Gn.MAX_VALUE),i===Number.MAX_VALUE&&(i=Gn.MAX_VALUE),{line:r,character:i}}n.create=e;function t(r){let i=r;return p.objectLiteral(i)&&p.uinteger(i.line)&&p.uinteger(i.character)}n.is=t})(M||(M={}));var P;(function(n){function e(r,i,s,a){if(p.uinteger(r)&&p.uinteger(i)&&p.uinteger(s)&&p.uinteger(a))return{start:M.create(r,i),end:M.create(s,a)};if(M.is(r)&&M.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${a}]`)}n.create=e;function t(r){let i=r;return p.objectLiteral(i)&&M.is(i.start)&&M.is(i.end)}n.is=t})(P||(P={}));var Bn;(function(n){function e(r,i){return{uri:r,range:i}}n.create=e;function t(r){let i=r;return p.objectLiteral(i)&&P.is(i.range)&&(p.string(i.uri)||p.undefined(i.uri))}n.is=t})(Bn||(Bn={}));var $s;(function(n){function e(r,i,s,a){return{targetUri:r,targetRange:i,t
`,s==="\r"&&i+1<t.length&&t.charAt(i+1)===`
`&&i++}r&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),r=0,i=t.length;if(i===0)return M.create(0,e);for(;r<i;){let a=Math.floor((r+i)/2);t[a]>e?i=a:r=a+1}let s=r-1;return M.create(s,e-t[s])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let r=t[e.line],i=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}};var p;(function(n){const e=Object.prototype.toString;function t(h){return typeof h<"u"}n.defined=t;function r(h){return typeof h>"u"}n.undefined=r;function i(h){return h===!0||h===!1}n.boolean=i;function s(h){return e.call(h)==="[object String]"}n.string=s;function a(h){return e.call(h)==="[object Number]"}n.number=a;function o(h,m,g){return e.call(h)==="[object Number]"&&m<=h&&h<=g}n.numberRange=o;function l(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}n.integer=l;function c(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}n.uinteger=c;function u(h){return e.call(h)==="[object Function]"}n.func=u;function d(h){return h!==null&&typeof h=="object"}n.objectLiteral=d;function f(h,m){return Array.isArray(h)&&h.every(m)}n.typedArray=f})(p||(p={}));class Ap{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new Xl(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const t=new Ui;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){const r=new ai(e.startOffset,e.image.length,Mr(e),e.tokenType,!1);return r.grammarSource=t,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){const t=e.container;if(t){const r=t.content.indexOf(e);r>=0&&t.content.splice(r,1)}}construct(e){const t=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=t;const r=this.nodeStack.pop();(r==null?void 0:r.content.length)===0&&this.removeNode(r)}addHiddenTokens(e){for(const t of e){const r=new ai(t.startOffset,t.image.length,Mr(t),t.tokenType,!0);r.root=this.rootNode,this.addHiddenToken(this.rootNode,r)}}addHiddenToken(e,t){const{offset:r,end:i}=t;for(let s=0;s<e.content.length;s++){const a=e.content[s],{offset:o,end:l}=a;if(Dt(a)&&r>o&&i<l){this.addHiddenToken(a,t);return}else if(i<=o){e.content.splice(s,0,t);return}}e.content.push(t)}}class ql{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,t;const r=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(t=this.container)===null||t===void 0?void 0:t.astNode;if(!r)throw new Error("This node has no associated AST element");return r}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}}class ai extends ql{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,t,r,i,s=!1){super(),this._hidden=s,this._offset=e,this._tokenType=i,this._length=t,this._range=r}}class Ui extends ql{constructor(){super(...arguments),this.content=new Fi(this)}get children(){return this.content}get offset(){var e,t;return(t=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&t!==void 0?t:0}get length(){return this.end-this.offset}get end(){var e,t;return(t=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&t!==void 0?t:0}get range(){const e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(this._rangeCache===void 0){const{range:r}=e,{range:i}=t;this._rangeCache={start:r.start,end:i.end.line<r.start.line?r.start:i.end}}return this._rangeCache}else return{start:M.create(0,0),end:M.create(0,0)}}get firstNon
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return c}}function r(c){return c.charAt(0)==="^"?c.substring(1):c}n.convertID=r;function i(c){return parseInt(c)}n.convertInt=i;function s(c){return BigInt(c)}n.convertBigint=s;function a(c){return new Date(c)}n.convertDate=a;function o(c){return Number(c)}n.convertNumber=o;function l(c){return c.toLowerCase()==="true"}n.convertBoolean=l})(We||(We={}));var rn={},hr={};Object.defineProperty(hr,"__esModule",{value:!0});let ci;function ui(){if(ci===void 0)throw new Error("No runtime abstraction layer installed");return ci}(function(n){function e(t){if(t===void 0)throw new Error("No runtime abstraction layer provided");ci=t}n.install=e})(ui||(ui={}));hr.default=ui;var se={};Object.defineProperty(se,"__esModule",{value:!0});se.stringArray=se.array=se.func=se.error=se.number=se.string=se.boolean=void 0;function Gp(n){return n===!0||n===!1}se.boolean=Gp;function sc(n){return typeof n=="string"||n instanceof String}se.string=sc;function Bp(n){return typeof n=="number"||n instanceof Number}se.number=Bp;function Hp(n){return n instanceof Error}se.error=Hp;function Wp(n){return typeof n=="function"}se.func=Wp;function ac(n){return Array.isArray(n)}se.array=ac;function Vp(n){return ac(n)&&n.every(e=>sc(e))}se.stringArray=Vp;var Bt={};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.Emitter=Bt.Event=void 0;const Kp=hr;var $a;(function(n){const e={dispose(){}};n.None=function(){return e}})($a||(Bt.Event=$a={}));class zp{add(e,t=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===t){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const t=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,a=r.length;s<a;s++)try{t.push(r[s].apply(i[s],e))}catch(o){(0,Kp.default)().console.error(o)}return t}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class pr{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,r)=>{this._callbacks||(this._callbacks=new zp),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);const i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),i.dispose=pr._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}Bt.Emitter=pr;pr._noop=function(){};var Y;Object.defineProperty(rn,"__esModule",{value:!0});var di=rn.CancellationTokenSource=Y=rn.CancellationToken=void 0;const qp=hr,Xp=se,fi=Bt;var zn;(function(n){n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:fi.Event.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:fi.Event.None});function e(t){const r=t;return r&&(r===n.None||r===n.Cancelled||Xp.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}n.is=e})(zn||(Y=rn.CancellationToken=zn={}));const Yp=Object.freeze(function(n,e){const t=(0,qp.default)().timer.setTimeout(n.bind(e),0);return{dispose(){t.dispose()}}});class Da{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Yp:(this._emitter||(this._emitter=new fi.Emitter),this._emitter.event)}dispose(){this._emitter&&(t
${t}`),this.inline?`{${e}}`:e}toMarkdown(e){var t,r;return(r=(t=e==null?void 0:e.renderTag)===null||t===void 0?void 0:t.call(e,this))!==null&&r!==void 0?r:this.toMarkdownDefault(e)}toMarkdownDefault(e){const t=this.content.toMarkdown(e);if(this.inline){const s=Fm(this.name,t,e??{});if(typeof s=="string")return s}let r="";(e==null?void 0:e.tag)==="italic"||(e==null?void 0:e.tag)===void 0?r="*":(e==null?void 0:e.tag)==="bold"?r="**":(e==null?void 0:e.tag)==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} ${t}`:this.content.inlines.length>1&&(i=`${i}
${t}`),this.inline?`{${i}}`:i}}function Fm(n,e,t){var r,i;if(n==="linkplain"||n==="linkcode"||n==="link"){const s=e.indexOf(" ");let a=e;if(s>0){const l=mi(e,s);a=e.substring(l),e=e.substring(0,s)}return(n==="linkcode"||n==="link"&&t.link==="code")&&(a=`\`${a}\``),(i=(r=t.renderLink)===null||r===void 0?void 0:r.call(t,e,a))!==null&&i!==void 0?i:Gm(e,a)}}function Gm(n,e){try{return Ht.parse(n,!0),`[${e}](${n})`}catch{return n}}class gi{constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;t<this.inlines.length;t++){const r=this.inlines[t],i=this.inlines[t+1];e+=r.toString(),i&&i.range.start.line>r.range.start.line&&(e+=`
`)}return e}toMarkdown(e){let t="";for(let r=0;r<this.inlines.length;r++){const i=this.inlines[r],s=this.inlines[r+1];t+=i.toMarkdown(e),s&&s.range.start.line>i.range.start.line&&(t+=`
`)}return t}}class gc{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}}function za(n){return n.endsWith(`
`)?`
`:`
`}class Bm{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const t=this.commentProvider.getComment(e);if(t&&xm(t))return Sm(t).toMarkdown({renderLink:(i,s)=>this.documentationLinkRenderer(e,i,s),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,t,r){var i;const s=(i=this.findNameInPrecomputedScopes(e,t))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,t);if(s&&s.nameSegment){const a=s.nameSegment.range.start.line+1,o=s.nameSegment.range.start.character+1,l=s.documentUri.with({fragment:`L${a},${o}`});return`[${r}](${l.toString()})`}else return}documentationTagRenderer(e,t){}findNameInPrecomputedScopes(e,t){const i=je(e).precomputedScopes;if(!i)return;let s=e;do{const o=i.get(s).find(l=>l.name===t);if(o)return o;s=s.$container}while(s)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(i=>i.name===t)}}class Hm{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var t;return hm(e)?e.$comment:(t=Iu(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||t===void 0?void 0:t.text}}class Wm{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e){return Promise.resolve(this.syncParser.parse(e))}}class Vm{constructor(){this.previousTokenSource=new di,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const t=new di;return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,r){const i=new Bi,s={action:t,deferred:i,cancellationToken:r??Y.None};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:t,deferred:r,cancellationToken:i})=>{try{const s=await Promise.resolve().then(()=>t(i));r.resolve(s)}catch(s){Gi(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class Km{constructor(e){this.grammarElementIdMap=new Fa,this.tokenTypeIdMap=new Fa,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors.map(t=>Object.assign({},t)),parserErrors:e.parserErrors.map(t=>Object.assign({},t)),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}createDehyrationContext(e){const t=new Map,r=new Map;for(const i of Et(e))t.set(i,{});if(e.$cstNode)for(const i of Pr(e.$cstNode))r.set(i,{});return{astNodes:t,cstNodes:r}}dehydrateAstNode(e,t){const r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)ae(o)?a.push(this.dehydrateAstNode(o,t)):De(o)?a.push(this.dehydrateReference(o,t)):a.push(o)}else ae(s)?r[i]=this.dehydrateAstNode(s,t):De(s)?r[i]=this.dehydrateReference(s,t):s!==void 0&&(r[i]=s);return r}dehydrateReference(e,t){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=t.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,t){const r=t.cstNodes.get(e);return fo(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=t.astNodes.get(e.astNode),Dt(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,t)):uo(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const t=e.value,r=this.createHydrationContext(t);return"$cstNode"in t&&this.hydrateCstNode(t.$cstNode,r),{lexerErrors:e.lexerErrors,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,r)}}createHydrationContext(e){const t=ne
`)}}},x(bt,"AbstractMermaidValueConverter"),bt),Nt,Vi=(Nt=class extends Ac{runCustomConverter(e,t,r){}},x(Nt,"CommonValueConverter"),Nt),kt,gn=(kt=class extends rc{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,r){const i=super.buildKeywordTokens(e,t,r);return i.forEach(s=>{this.keywords.has(s.name)&&s.PATTERN!==void 0&&(s.PATTERN=new RegExp(s.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),i}},x(kt,"AbstractMermaidTokenBuilder"),kt),It;It=class extends gn{},x(It,"CommonTokenBuilder");var St,Pg=(St=class extends gn{constructor(){super(["gitGraph"])}},x(St,"GitGraphTokenBuilder"),St),bc={parser:{TokenBuilder:x(()=>new Pg,"TokenBuilder"),ValueConverter:x(()=>new Vi,"ValueConverter")}};function Nc(n=mn){const e=Ue(pn(n),gr),t=Ue(hn({shared:e}),xg,bc);return e.ServiceRegistry.register(t),{shared:e,GitGraph:t}}x(Nc,"createGitGraphServices");var xt,Mg=(xt=class extends gn{constructor(){super(["info","showInfo"])}},x(xt,"InfoTokenBuilder"),xt),kc={parser:{TokenBuilder:x(()=>new Mg,"TokenBuilder"),ValueConverter:x(()=>new Vi,"ValueConverter")}};function Ic(n=mn){const e=Ue(pn(n),gr),t=Ue(hn({shared:e}),kg,kc);return e.ServiceRegistry.register(t),{shared:e,Info:t}}x(Ic,"createInfoServices");var Ct,$g=(Ct=class extends gn{constructor(){super(["packet-beta"])}},x(Ct,"PacketTokenBuilder"),Ct),Sc={parser:{TokenBuilder:x(()=>new $g,"TokenBuilder"),ValueConverter:x(()=>new Vi,"ValueConverter")}};function xc(n=mn){const e=Ue(pn(n),gr),t=Ue(hn({shared:e}),Ig,Sc);return e.ServiceRegistry.register(t),{shared:e,Packet:t}}x(xc,"createPacketServices");var wt,Dg=(wt=class extends gn{constructor(){super(["pie","showData"])}},x(wt,"PieTokenBuilder"),wt),Ot,jg=(Ot=class extends Ac{runCustomConverter(e,t,r){if(e.name==="PIE_SECTION_LABEL")return t.replace(/"/g,"").trim()}},x(Ot,"PieValueConverter"),Ot),Cc={parser:{TokenBuilder:x(()=>new Dg,"TokenBuilder"),ValueConverter:x(()=>new jg,"ValueConverter")}};function wc(n=mn){const e=Ue(pn(n),gr),t=Ue(hn({shared:e}),Sg,Cc);return e.ServiceRegistry.register(t),{shared:e,Pie:t}}x(wc,"createPieServices");var Tt={},Ug={info:x(async()=>{const{createInfoServices:n}=await yn(async()=>{const{createInfoServices:t}=await Promise.resolve().then(()=>Bg);return{createInfoServices:t}},void 0),e=n().Info.parser.LangiumParser;Tt.info=e},"info"),packet:x(async()=>{const{createPacketServices:n}=await yn(async()=>{const{createPacketServices:t}=await Promise.resolve().then(()=>Hg);return{createPacketServices:t}},void 0),e=n().Packet.parser.LangiumParser;Tt.packet=e},"packet"),pie:x(async()=>{const{createPieServices:n}=await yn(async()=>{const{createPieServices:t}=await Promise.resolve().then(()=>Wg);return{createPieServices:t}},void 0),e=n().Pie.parser.LangiumParser;Tt.pie=e},"pie"),gitGraph:x(async()=>{const{createGitGraphServices:n}=await yn(async()=>{const{createGitGraphServices:t}=await Promise.resolve().then(()=>Vg);return{createGitGraphServices:t}},void 0),e=n().GitGraph.parser.LangiumParser;Tt.gitGraph=e},"gitGraph")};async function Fg(n,e){const t=Ug[n];if(!t)throw new Error(`Unknown diagram type: ${n}`);Tt[n]||await t();const i=Tt[n].parse(e);if(i.lexerErrors.length>0||i.parserErrors.length>0)throw new Gg(i);return i.value}x(Fg,"parse");var Lt,Gg=(Lt=class extends Error{constructor(e){const t=e.lexerErrors.map(i=>i.message).join(`
`),r=e.parserErrors.map(i=>i.message).join(`
`);super(`Parsing failed: ${t} ${r}`),this.result=e}},x(Lt,"MermaidParseError"),Lt);const Bg=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:kc,createInfoServices:Ic},Symbol.toStringTag,{value:"Module"})),Hg=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:Sc,createPacketServices:xc},Symbol.toStringTag,{value:"Module"})),Wg=Object.freeze(Object.defineProperty({__proto__:null,PieModule:Cc,createPieServices:wc},Symbol.toStringTag,{value:"Module"})),Vg=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:bc,createGitGraphServices:Nc},Symbol.toStringTag,{value:"Module"}));export{Fg as p};