fix: correct base path in docs build, add Pages deploy workflow

Site was committed with base='/' (assumes repo-root domain), but
GitHub Pages serves this repo at /vjailbreak-docs/, breaking all
absolute asset/link paths. Rebuilt with BASE=vjailbreak-docs to
match. Also adds the Actions-based deploy workflow (mirrors
platform9/vjailbreak) so future pushes to gh-pages rebuild and
deploy automatically instead of relying on manual commits.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
OmkarDeshpande7andClaude Sonnet 5 committed 2026-09-12 22:57:13 +05:30
1 parent 94a0a48b23
commit d322caf561
286 files changed
+20586 -2861

No files matched your search

+128
View File
@@ -0,0 +1,128 @@
import{_ as ft}from"./preload-helper.B8mdA2x2.js";import{bA as hc,bB as pc,aU as ll,bk as mc,aY as gc,aV as te,ar as yc,as as Zs,ba as Tc,bd as ul,be as cl,bb as Rc,bp as ea,au as Et,av as D,aW as ta,aQ as vc}from"./mermaid.core.BEB2s8mj.js";import{k as Ot,j as ks,g as Ut,S as Ac,w as Ec,x as kc,c as dl,v as z,y as fl,l as $c,z as xc,A as Sc,B as Ic,C as Cc,a as hl,d as C,i as Ye,r as le,f as $e,D as Y}from"./_baseUniq.BZ7nxk36.js";import{j as $s,m as $,d as Nc,f as Ne,g as bt,h as N,i as xs,l as Pt,e as wc}from"./_basePickBy.Dx0k5icg.js";import{c as re}from"./clone.BpaVmew-.js";var _c=Object.prototype,Lc=_c.hasOwnProperty,ke=hc(function(n,e){if(pc(e)||ll(e)){mc(e,Ot(e),n);return}for(var t in e)Lc.call(e,t)&&gc(n,t,e[t])});function pl(n,e,t){var r=-1,i=n.length;e<0&&(e=-e>i?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=n[r+e];return s}function Mn(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 Oc(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 bc(n,e,t,r){return ks(n,function(i,s,a){e(r,i,t(i),a)}),r}function Pc(n,e){return function(t,r){var i=te(t)?Oc:bc,s=e?e():{};return i(t,n,Ut(r),s)}}var Mc=200;function Dc(n,e,t,r){var i=-1,s=Ec,a=!0,o=n.length,l=[],u=e.length;if(!o)return l;e.length>=Mc&&(s=kc,a=!1,e=new Ac(e));e:for(;++i<o;){var c=n[i],d=c;if(c=c!==0?c:0,a&&d===d){for(var h=u;h--;)if(e[h]===d)continue e;l.push(c)}else s(e,d,r)||l.push(c)}return l}var Xr=yc(function(n,e){return Zs(n)?Dc(n,dl(e,1,Zs,!0)):[]});function Q(n,e,t){var r=n==null?0:n.length;return r?(e=e===void 0?1:$s(e),pl(n,e<0?0:e,r)):[]}function Ln(n,e,t){var r=n==null?0:n.length;return r?(e=e===void 0?1:$s(e),e=r-e,pl(n,0,e<0?0:e)):[]}function Fc(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 Gc(n,e){var t=!0;return ks(n,function(r,i,s){return t=!!e(r,i,s),t}),t}function be(n,e,t){var r=te(n)?Fc:Gc;return r(n,Ut(e))}function Pe(n){return n&&n.length?n[0]:void 0}function Ee(n,e){return dl($(n,e))}var Uc=Object.prototype,Bc=Uc.hasOwnProperty,Vc=Pc(function(n,e,t){Bc.call(n,t)?n[t].push(e):Tc(n,t,[e])}),Kc="[object String]";function he(n){return typeof n=="string"||!te(n)&&ul(n)&&cl(n)==Kc}var Wc=Math.max;function de(n,e,t,r){n=ll(n)?n:z(n),t=t?$s(t):0;var i=n.length;return t<0&&(t=Wc(i+t,0)),he(n)?t<=i&&n.indexOf(e,t)>-1:!!i&&fl(n,e,t)>-1}function na(n,e,t){var r=n==null?0:n.length;if(!r)return-1;var i=0;return fl(n,e,i)}var jc="[object RegExp]";function Hc(n){return ul(n)&&cl(n)==jc}var ra=ea&&ea.isRegExp,Xe=ra?Rc(ra):Hc,zc="Expected a function";function qc(n){if(typeof n!="function")throw new TypeError(zc);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 Me(n,e){if(n==null)return{};var t=$c(xc(n),function(r){return[r]});return e=Ut(e),Nc(n,t,function(r,i){return e(r,i[0])})}function Jr(n,e){var t=te(n)?Sc:Ic;return t(n,qc(Ut(e)))}function Yc(n,e){var t;return ks(n,function(r,i,s){return t=e(r,i,s),!t}),!!t}function ml(n,e,t){var r=te(n)?Cc:Yc;return r(n,Ut(e))}function Ss(n){return n&&n.length?hl(n):[]}function Xc(n,e){return n&&n.length?hl(n,Ut(e)):[]}function ae(n){return typeof n=="object"&&n!==null&&typeof n.$type=="string"}function Ue(n){return typeof n=="object"&&n!==null&&typeof n.$refText=="string"}function Jc(n){return typeof n=="object"&&n!==null&&typeof n.name=="string"&&typeof n.type=="string"&&typeof n.path=="string"}function fr(n){return typeof n=="object"&&n!==null&&ae(n.container)&&Ue(n.reference)&&typeof n.message=="string"}class gl{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.allSubtypes[e]=i,i}}}function On(n){return typeof n=="object"&&n!==null&&Array.isArray(n.content)}function yl(n){return typeof n=="object"&&n!==null&&typeof n.tokenType=="object"}function Tl(n){return On(n)&&typeof n.fullText=="string"}class Z{constructor(e,t){this.startFn=e,this.nextFn=t}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let t=0,r=e.next();for(;!r.done;)t++,r=e.next();return t}toArray(){const e=[],t=this.iterator();let r;do r=t.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,t){const r=this.map(i=>[e?e(i):i,t?t(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return neLine truncated
`),w("\r"),w(" "),w("\v"),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w("\u2028"),w("\u2029"),w(" "),w(" "),w(" "),w("\uFEFF")],Sd=/[0-9a-fA-F]/,er=/[0-9]/,Id=/[1-9]/;class Cl{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":jt(r,"global");break;case"i":jt(r,"ignoreCase");break;case"m":jt(r,"multiLine");break;case"u":jt(r,"unicode");break;case"y":jt(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}Ct(t);const r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return xd()}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;Ct(t);break}if(!(e===!0&&t===void 0)&&Ct(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()),Ct(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[w(`
`),w("\r"),w("\u2028"),w("\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=Nr;break;case"D":e=Nr,t=!0;break;case"s":e=la;break;case"S":e=la,t=!0;break;case"w":e=wr;break;case"W":e=wr,t=!0;break}if(Ct(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=w("\f");break;case"n":e=w(`
`);break;case"r":e=w("\r");break;case"t":e=w(" ");break;case"v":e=w("\v");break}if(Ct(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:w("\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:w(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:w(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,oa(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,oa(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else Ti(r.value,e),e.push(w("-")),Ti(i.value,e)}else Ti(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:w("\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(Id.test(e)===!1)throw Error("Expecting a positive integer");for(;er.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(er.test(e)===!1)throw Error("Expecting an integer");for(;er.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:w(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 er.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(Sd.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 ei{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 Cd=/\r?\n/gm,Nd=new Cl;class wd extends ei{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=ti(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 Ri=new wd;function _d(n){try{return typeof n=="string"&&(n=new RegExp(n)),n=n.toString(),Ri.reset(n),Ri.visit(Nd.pattern(n)),Ri.multiline}catch{return!1}}const Ld=`\f
\r \v              \u2028\u2029   \uFEFF`.split("");function ji(n){const e=typeof n=="string"?new RegExp(n):n;return Ld.some(t=>e.test(t))}function ti(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Od(n){return Array.prototype.map.call(n,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:ti(e)).join("")}function bd(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(u){s+=t.substr(r,u),r+=u}function l(u){s+="(?:"+t.substr(r,u)+"|$)",r+=u}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=>we(e)&&e.entry)}function Dd(n){return n.rules.filter(e=>kt(e)&&e.hidden)}function Nl(n,e){const t=new Set,r=Md(n);if(!r)return new Set(n.rules);const i=[r].concat(Dd(n));for(const a of i)wl(a,t,e);const s=new Set;for(const a of n.rules)(t.has(a.name)||kt(a)&&a.hidden)&&s.add(a);return s}function wl(n,e,t){e.add(n.name),Fn(n).forEach(r=>{if(Tt(r)||t){const i=r.rule.ref;i&&!e.has(i.name)&&wl(i,e,t)}})}function Fd(n){if(n.terminal)return n.terminal;if(n.type.ref){const e=Ll(n.type.ref);return e?.terminal}}function Gd(n){return n.hidden&&!ji(bs(n))}function Ud(n,e){return!n||!e?[]:_s(n,e,n.astNode,!0)}function _l(n,e,t){if(!n||!e)return;const r=_s(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 _s(n,e,t,r){if(!r){const i=Zr(n.grammarSource,gt);if(i&&i.feature===e)return[n]}return On(n)&&n.astNode===t?n.content.flatMap(i=>_s(i,e,t,!1)):[]}function Bd(n,e,t){if(!n)return;const r=Vd(n,e,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 Vd(n,e,t){if(n.astNode!==t)return[];if(yt(n.grammarSource)&&n.grammarSource.value===e)return[n];const r=Vi(n).iterator();let i;const s=[];do if(i=r.next(),!i.done){const a=i.value;a.astNode===t?yt(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):r.prune()}while(!i.done);return s}function Kd(n){var e;const t=n.astNode;for(;t===((e=n.container)===null||e===void 0?void 0:e.astNode);){const r=Zr(n.grammarSource,gt);if(r)return r;n=n.container}}function Ll(n){let e=n;return vl(e)&&(Qr(e.$container)?e=e.$container.$container:we(e.$container)?e=e.$container:Dn(e.$container)),Ol(n,e,new Map)}function Ol(n,e,t){var r;function i(s,a){let o;return Zr(s,gt)||(o=Ol(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 Fn(e)){if(gt(s)&&s.feature.toLowerCase()==="name")return t.set(n,s),s;if(Tt(s)&&we(s.rule.ref))return i(s,s.rule.ref);if(hd(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function bl(n){return Pl(n,new Set)}function Pl(n,e){if(e.has(n))return!0;e.add(n);for(const t of Fn(n))if(Tt(t)){if(!t.rule.ref||we(t.rule.ref)&&!Pl(t.rule.ref,e))return!1}else{if(gt(t))return!1;if(Qr(t))return!1}return!!n.definition}function Ls(n){if(n.inferredType)return n.inferredType.name;if(n.dataType)return n.dataType;if(n.returnType){const e=n.returnType.ref;if(e){if(we(e))return e.name;if(Al(e)||El(e))return e.name}}}function Os(n){var e;if(we(n))return bl(n)?n.name:(e=Ls(n))!==null&&e!==void 0?e:n.name;if(Al(n)||El(n)||fd(n))return n.name;if(Qr(n)){const t=Wd(n);if(t)return t}else if(vl(n))return n.name;throw new Error("Cannot get name of Unknown Type")}function Wd(n){var e;if(n.inferredType)return n.inferredType.name;if(!((e=n.type)===null||e===void 0)&&e.ref)return Os(n.type.ref)}function jd(n){var e,t,r;return kt(n)?(t=(e=n.type)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"string":(r=Ls(n))!==null&&r!==void 0?r:n.name}function bs(n){const e={s:!1,i:!1,u:!1},t=Bt(n.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(t,r)}const Ps=/[\s\S]/.source;function Bt(n,e){if(Td(n))return Hd(n);if(Rd(n))return zd(n);if(pd(n))return Xd(n);if(vd(n)){const t=n.rule.ref;if(!t)throw new Error("Missing rule reference.");return qe(Bt(t.definition),{cardinality:n.cardinality,lookahead:n.lookahead})}else{if(gd(n))return Yd(n);if(Ad(n))return qd(n);if(yd(n)){const t=n. Line truncated
`;function ff(n,e=!1){try{const t=ri(n);return zi(t.value,{},t.flags.ignoreCase)}catch(t){if(t.message===Ul)e&&Ml(`${Lr} 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.`),Hi(`${Lr}
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 zi(n,e,t){switch(n.type){case"Disjunction":for(let i=0;i<n.value.length;i++)zi(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":tr(a.value,e,t);break;case"Set":if(a.complement===!0)throw Error(Ul);C(a.value,l=>{if(typeof l=="number")tr(l,e,t);else{const u=l;if(t===!0)for(let c=u.from;c<=u.to;c++)tr(c,e,t);else{for(let c=u.from;c<=u.to&&c<$n;c++)tr(c,e,t);if(u.to>=$n){const c=u.from>=$n?u.from:$n,d=u.to,h=et(c),f=et(d);for(let m=h;m<=f;m++)e[m]=m}}}});break;case"Group":zi(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"&&qi(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return z(e)}function tr(n,e,t){const r=et(n);e[r]=r,t===!0&&hf(n,e)}function hf(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 ca(n,e){return bt(n.value,t=>{if(typeof t=="number")return de(e,t);{const r=t;return bt(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function qi(n){const e=n.quantifier;return e&&e.atLeast===0?!0:n.value?te(n.value)?be(n.value,qi):qi(n.value):!1}class pf extends ei{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){de(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?ca(e,this.targetCharCodes)===void 0&&(this.found=!0):ca(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Ms(n,e){if(e instanceof RegExp){const t=ri(e),r=new pf(n);return r.visit(t),r.found}else return bt(e,t=>de(n,t.charCodeAt(0)))!==void 0}const Rt="PATTERN",kn="defaultMode",nr="modes";let Bl=typeof new RegExp("(?:)").sticky=="boolean";function mf(n,e){e=xs(e,{useSticky:Bl,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:(E,R)=>R()});const t=e.tracer;t("initCharCodeToOptimizedIndexMap",()=>{Ff()});let r;t("Reject Lexer.NA",()=>{r=Jr(n,E=>E[Rt]===fe.NA)});let i=!1,s;t("Transform Patterns",()=>{i=!1,s=$(r,E=>{const R=E[Rt];if(Xe(R)){const I=R.source;return I.length===1&&I!=="^"&&I!=="$"&&I!=="."&&!R.ignoreCase?I:I.length===2&&I[0]==="\\"&&!de(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],I[1])?I[1]:e.useSticky?fa(R):da(R)}else{if(Et(R))return i=!0,{exec:R};if(typeof R=="object")return i=!0,R;if(typeof R=="string"){if(R.length===1)return R;{const I=R.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),F=new RegExp(I);return e.useSticky?fa(F):da(F)}}else throw Error("non exhaustive match")}})});let a,o,l,u,c;t("misc mapping",()=>{a=$(r,E=>E.tokenTypeIdx),o=$(r,E=>{const R=E.GROUP;if(R!==fe.SKIPPED){if(he(R))return R;if(Ye(R))return!1;throw Error("non exhaustive match")}}),l=$(r,E=>{const R=E.LONGER_ALT;if(R)return te(R)?$(R,F=>na(r,F)):[na(r,R)]}),u=$(r,E=>E.PUSH_MODE),c=$(r,E=>N(E,"POP_MODE"))});let d;t("Line Terminator Handling",()=>{const E=Wl(e.lineTerminatorCharacters);d=$(r,R=>!1),e.positionTracking!=="onlyOffset"&&(d=$(r,R=>N(R,"LINE_BREAKS")?!!R.LINE_BREAKS:Kl(R,E)===!1&&Ms(E,R.PATTERN)))});let h,f,m,g;t("Misc Mapping #2",()=>{h=$(r,Vl),f=$(s,Pf),m=le(r,(E,R)=>{const I=R.GROUP;return he(I)&&I!==fe.SKIPPED&&(E[I]=[]),E},{}),g=$(s,(E,R)=>({pattern:s[R],longerAlt:l[R],canLineTerminator:d[R],isCustom:h[R],short:f[R],group:o[R],push:u[R],pop:c[R],tokenTypeIdx:a[R],tokenType:r[R]}))});let A=!0,T=[];return e.safeMode||t("First Char Optimization",()=>{T=le(r,(E,R,I)=>{if(typeof R.PATTERN=="string"){const F=R.PATTERN.charCodeAt(0),ie=et(F);Ai(E,ie,g[I])}else if(te(R.START_CHARS_HINT)){let F;C(R.START_CHARS_HINT,ie=>{const _e=typeof ie=="string"?ie.charCodeAt(0):ie,ye=et(_e);F!==ye&&(F=ye,Ai(E,ye,g[I]))})}else if(Xe(R.PATTERN))if(R.PATTERN.unicode)A=!1,e.ensureOptimizations&&Hi(`${Lr} Unable to analyze < ${R.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 F=ff(R.PATTERN,e.ensureOptimizations);D(F)&&(A=!1),C(F,ie=>{Ai(E,ie,g[I])})}else e.ensureOptimizations&&Hi(`${Lr} TokenType: <${R.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`),A=!1;return E},[])}),{emptyGroups:m,patternIdxToConfig:g,charCodeToPatternIdxToConfig:T,hasCustom:i,canBeOptimized:A}}function gf(n,e){let t=[];const r=Tf(n);t=t.concat(r.errors);const i=Rf(r.valid),s=i.valid;return t=t.concat(i.errors),t=t.concat(yf(s)),t=t.concat(If(s)),t=t.concat(Cf(s,e)),t=t.concat(Nf(s)),t}function yf(n){let e=[];const t=$e(n,r=>Xe(r[Rt]));return e=e.concat(Af(t)),e=e.concat($f(t)),e=e.concat(xf(t)),e=e.concat(Sf(t)),e=e.concat(Ef(t)),e}function Tf(n){const e=$e(n,i=>!N(i,Rt)),t=$(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:j.MISSING_PATTERN,tokenTypes:[i]})),r=Xr(n,e);return{errors:t,valid:r}}function Rf(n){const e=$e(n,i=>{const s=i[Rt];return!Xe(s)&&!Et(s)&&!N(s,"exec")&&!he(s)}),t=$(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:j.INVALID_PATTERN,tokenTypes:[i]})),r=Xr(n,e);return{errors:t,valid:r}}const vf=/[^\\][$]/;function Af(n){class e extends ei{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const t=$e(n,i=>{const s=i.PATTERN;try{const a=ri(s),o=new e;return o.visit(a),o.found}catch{return vf.test(s.source)}});return $(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:j.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Ef(n){const e=$e(n,r=>r.PATTERN.test(""));return $(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:j.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const kf=/[^\\[][\^]|^\^/;function $f(n){class e extends ei{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const t=$e(n,i=>{const s=i.PATTERN;try{const a=ri(s),o=new e;return o.visit(a),o.found}catch{return kf.test(s.source)}});return $(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:j.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function xf(n){const e=$e(n,r=>{const i=r[Rt];return i instanceof RegExp&&(i.multiline||i.global)});return $(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:j.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function Sf(n){const e=[];let t=$(n,s=>le(n,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!de(e,o)&&o.PATTERN!==fe.NA&&(e.push(o),a.push(o)),a),[]));t=Mn(t);const r=$e(t,s=>s.length>1);return $(r,s=>{const a=$(s,l=>l.name);return{message:`The same RegExp pattern ->${Pe(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:j.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function If(n){const e=$e(n,r=>{if(!N(r,"GROUP"))return!1;const i=r.GROUP;return i!==fe.SKIPPED&&i!==fe.NA&&!he(i)});return $(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:j.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function Cf(n,e){const t=$e(n,i=>i.PUSH_MODE!==void 0&&!de(e,i.PUSH_MODE));return $(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:j.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function Nf(n){const e=[],t=le(n,(r,i,s)=>{const a=i.PATTERN;return a===fe.NA||(he(a)?r.push({str:a,idx:s,tokenType:i}):Xe(a)&&_f(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);return C(n,(r,i)=>{C(t,({str:s,idx:a,tokenType:o})=>{if(i<a&&wf(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:j.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}function wf(n,e){if(Xe(e)){const t=e.exec(n);return t!==null&&t.index===0}else{if(Et(e))return e(n,0,[],{});if(N(e,"exec"))return e.exec(n,0,[],{});if(typeof e=="string")return e===n;throw Error("non exhaustive match")}}function _f(n){return bt([".","\\","[","]","|","^","$","(",")","?","*","+","{"],t=>n.source.indexOf(t)!==-1)===void 0}function da(n){const e=n.ignoreCase?"i":"";return new RegExp(`^(?:${n.source})`,e)}function fa(n){const e=n.ignoreCase?"iy":"y";return new RegExp(`${n.source}`,e)}function Lf(n,e,t){const r=[];return N(n,kn)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+kn+`> property in its definition
`,type:j.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),N(n,nr)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+nr+`> property in its definition
`,type:j.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),N(n,nr)&&N(n,kn)&&!N(n.modes,n.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${kn}: <${n.defaultMode}>which does not exist
`,type:j.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),N(n,nr)&&C(n.modes,(i,s)=>{C(i,(a,o)=>{if(Ye(a))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
`,type:j.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(N(a,"LONGER_ALT")){const l=te(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];C(l,u=>{!Ye(u)&&!de(i,u)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${a.name}> outside of mode <${s}>
`,type:j.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function Of(n,e,t){const r=[];let i=!1;const s=Mn(Ne(z(n.modes))),a=Jr(s,l=>l[Rt]===fe.NA),o=Wl(t);return e&&C(a,l=>{const u=Kl(l,o);if(u!==!1){const d={message:Df(l,u),type:u.issue,tokenType:l};r.push(d)}else N(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):Ms(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:j.NO_LINE_BREAKS_FLAGS}),r}function bf(n){const e={},t=Ot(n);return C(t,r=>{const i=n[r];if(te(i))e[r]=[];else throw Error("non exhaustive match")}),e}function Vl(n){const e=n.PATTERN;if(Xe(e))return!1;if(Et(e))return!0;if(N(e,"exec"))return!0;if(he(e))return!1;throw Error("non exhaustive match")}function Pf(n){return he(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 Kl(n,e){if(N(n,"LINE_BREAKS"))return!1;if(Xe(n.PATTERN)){try{Ms(e,n.PATTERN)}catch(t){return{issue:j.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if(he(n.PATTERN))return!1;if(Vl(n))return{issue:j.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function Df(n,e){if(e.issue===j.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===j.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 Wl(n){return $(n,t=>he(t)?t.charCodeAt(0):t)}function Ai(n,e,t){n[e]===void 0?n[e]=[t]:n[e].push(t)}const $n=256;let gr=[];function et(n){return n<$n?n:gr[n]}function Ff(){if(D(gr)){gr=new Array(65536);for(let n=0;n<65536;n++)gr[n]=n>255?255+~~(n/255):n}}function Un(n,e){const t=n.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}function Or(n,e){return n.tokenTypeIdx===e.tokenTypeIdx}let ha=1;const jl={};function Bn(n){const e=Gf(n);Uf(e),Vf(e),Bf(e),C(e,t=>{t.isParent=t.categoryMatches.length>0})}function Gf(n){let e=re(n),t=n,r=!0;for(;r;){t=Mn(Ne($(t,s=>s.CATEGORIES)));const i=Xr(t,e);e=e.concat(i),D(i)?r=!1:t=i}return e}function Uf(n){C(n,e=>{zl(e)||(jl[ha]=e,e.tokenTypeIdx=ha++),pa(e)&&!te(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),pa(e)||(e.CATEGORIES=[]),Kf(e)||(e.categoryMatches=[]),Wf(e)||(e.categoryMatchesMap={})})}function Bf(n){C(n,e=>{e.categoryMatches=[],C(e.categoryMatchesMap,(t,r)=>{e.categoryMatches.push(jl[r].tokenTypeIdx)})})}function Vf(n){C(n,e=>{Hl([],e)})}function Hl(n,e){C(n,t=>{e.categoryMatchesMap[t.tokenTypeIdx]=!0}),C(e.CATEGORIES,t=>{const r=n.concat(e);de(r,t)||Hl(r,t)})}function zl(n){return N(n,"tokenTypeIdx")}function pa(n){return N(n,"CATEGORIES")}function Kf(n){return N(n,"categoryMatches")}function Wf(n){return N(n,"categoryMatchesMap")}function jf(n){return N(n,"tokenTypeIdx")}const Yi={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 j;(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"})(j||(j={}));const xn={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Yi,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(xn);class fe{constructor(e,t=xn){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}=Dl(s),u=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${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=ke({},xn,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===xn.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Mf;else if(this.config.lineTerminatorCharacters===xn.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),te(e)?i={modes:{defaultMode:re(e)},defaultMode:kn}:(s=!1,i=re(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Lf(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Of(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},C(i.modes,(o,l)=>{i.modes[l]=Jr(o,u=>Ye(u))});const a=Ot(i.modes);if(C(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(gf(o,a))}),D(this.lexerDefinitionErrors)){Bn(o);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=mf(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=u.charCodeToPatternIdxToConfig,this.emptyGroups=ke({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!D(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const l=$(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+l)}C(this.lexerDefinitionWarning,o=>{Ml(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(Bl?(this.chopInput=ta,this.match=this.matchWithTest):(this.updateLastIndex=Y,this.match=this.matchWithExec),s&&(this.handleModes=Y),this.trackStartLines===!1&&(this.computeNewColumn=ta),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Y),/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=le(this.canModeBeOptimized,(l,u,c)=>(u===!1&&l.push(c),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",()=>{df()}),this.TRACE_INIT("toFastProperties",()=>{Fl(this)})})}tokenize(e,t=this.defaultMode){if(!D(this.lexerDefinitionErrors)){const i=$(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,u,c,d,h,f,m,g,A,T;const E=e,R=E.length;let I=0,F=0;const ie=this.hasCustom?0:Math.floor(e.length/10),_e=new Array(ie),ye=[];let Fe=this.trackStartLines?1:void 0,Ie=this.trackStartLines?1:void 0;const k=bf(this.emptyGroups),y=this.trackStartLines,S=this.config.lineTerminatorsPattern;let x=0,O=[],L=[];const _=[],Te=[];Object.freeze(Te);let q;function K(){return O}function ct(se){const Ce=et(se),It=L[Ce];return It===void 0?Te:It}const fc=se=>{if(_.length===1&&se.tokenType.PUSH_MODE===void 0){const Ce=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(se);ye.push({offset:se.startOffset,line:se.startLine,column:se.startColumn,length:se.image.length,message:Ce})}else{_.pop();const Ce=Pt(_);O=this.patternIdxToConfig[Ce],L=this.charCodeToPatternIdxToConfig[Ce],x=O.length;const It=this.canModeBeOptimized[Ce]&&this.config.safeMode===!1;L&&It?q=ct:q=K}};function Xs(se){_.push(se),L=this.charCodeToPatternIdxToConfig[se],O=this.patternIdxToConfig[se],x=O.length,x=O.length;const Ce=this.canModeBeOptimized[se]&&this.config.safeMode===!1;L&&Ce?q=ct:q=K}Xs.call(this,t);let Le;const Js=this.config.recoveryEnabled;for(;I<R;){l=null;const se=E.charCodeAt(I),Ce=q(se),It=Ce.length;for(r=0;r<It;r++){Le=Ce[r];const Re=Le.pattern;u=null;const Ve=Le.short;if(Ve!==!1?se===Ve&&(l=Re):Le.isCustom===!0?(T=Re.exec(E,I,_e,k),T!==null?(l=T[0],T.payload!==void 0&&(u=T.payload)):l=null):(this.updateLastIndex(Re,I),l=this.match(Re,e,I)),l!==null){if(o=Le.longerAlt,o!==void 0){const Qe=o.length;for(s=0;s<Qe;s++){const Ke=O[o[s]],dt=Ke.pattern;if(c=null,Ke.isCustom===!0?(T=dt.exec(E,I,_e,k),T!==null?(a=T[0],T.payload!==void 0&&(c=T.payload)):a=null):(this.updateLastIndex(dt,I),a=this.match(dt,e,I)),a&&a.length>l.length){l=a,u=c,Le=Ke;break}}}break}}if(l!==null){if(d=l.length,h=Le.group,h!==void 0&&(f=Le.tokenTypeIdx,m=this.createTokenInstance(l,I,f,Le.tokenType,Fe,Ie,d),this.handlePayload(m,u),h===!1?F=this.addToken(_e,F,m):k[h].push(m)),e=this.chopInput(e,d),I=I+d,Ie=this.computeNewColumn(Ie,d),y===!0&&Le.canLineTerminator===!0){let Re=0,Ve,Qe;S.lastIndex=0;do Ve=S.test(l),Ve===!0&&(Qe=S.lastIndex-1,Re++);while(Ve===!0);Re!==0&&(Fe=Fe+Re,Ie=d-Qe,this.updateTokenEndLineColumnLocation(m,h,Qe,Re,Fe,Ie,d))}this.handleModes(Le,fc,Xs,m)}else{const Re=I,Ve=Fe,Qe=Ie;let Ke=Js===!1;for(;Ke===!1&&I<R;)for(e=this.chopInput(e,1),I++,i=0;i<x;i++){const dt=O[i],fi=dt.pattern,Qs=dt.short;if(Qs!==!1?E.charCodeAt(I)===Qs&&(Ke=!0):dt.isCustom===!0?Ke=fi.exec(E,I,_e,k)!==null:(this.updateLastIndex(fi,I),Ke=fi.exec(e)!==null),Ke===!0)break}if(g=I-Re,Ie=this.computeNewColumn(Ie,g),A=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(E,Re,g,Ve,Qe),ye.push({offset:Re,line:Ve,column:Qe,length:g,message:A}),Js===!1)break}}return this.hasCustom||(_e.length=F),{tokens:_e,groups:k,errors:ye}}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,u;t!==void 0&&(l=r===o-1,u=l?-1:0,i===1&&l===!0||(e.endLine=s+u,e.endColumn=a-1+-u))}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}}fe.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 example to completely ignore whitespace.";fe.NA=/NOT_APPLICABLE/;function Lt(n){return ql(n)?n.LABEL:n.name}function ql(n){return he(n.LABEL)&&n.LABEL!==""}const Hf="parent",ma="categories",ga="label",ya="group",Ta="push_mode",Ra="pop_mode",va="longer_alt",Aa="line_breaks",Ea="start_chars_hint";function Yl(n){return zf(n)}function zf(n){const e=n.pattern,t={};if(t.name=n.name,Ye(e)||(t.PATTERN=e),N(n,Hf))throw`The parent property is no longer supported.
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return N(n,ma)&&(t.CATEGORIES=n[ma]),Bn([t]),N(n,ga)&&(t.LABEL=n[ga]),N(n,ya)&&(t.GROUP=n[ya]),N(n,Ra)&&(t.POP_MODE=n[Ra]),N(n,Ta)&&(t.PUSH_MODE=n[Ta]),N(n,va)&&(t.LONGER_ALT=n[va]),N(n,Aa)&&(t.LINE_BREAKS=n[Aa]),N(n,Ea)&&(t.START_CHARS_HINT=n[Ea]),t}const tt=Yl({name:"EOF",pattern:fe.NA});Bn([tt]);function Ds(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 Xl(n,e){return Un(n,e)}const wt={buildMismatchTokenMessage({expected:n,actual:e,previous:t,ruleName:r}){return`Expecting ${ql(n)?`--> ${Lt(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: '`+Pe(e).image+"'";if(r)return s+r+o;{const l=le(n,(h,f)=>h.concat(f),[]),u=$(l,h=>`[${$(h,f=>Lt(f)).join(", ")}]`),d=`one of these possible Token sequences:
${$(u,(h,f)=>` ${f+1}. ${h}`).join(`
`)}`;return s+d+o}},buildEarlyExitMessage({expectedIterationPaths:n,actual:e,customUserDescription:t,ruleName:r}){const i="Expecting: ",a=`
but found: '`+Pe(e).image+"'";if(t)return i+t+a;{const l=`expecting at least one iteration which starts with one of these possible Token sequences::
<${$(n,u=>`[${$(u,c=>Lt(c)).join(",")}]`).join(" ,")}>`;return i+l+a}}};Object.freeze(wt);const qf={buildRuleNotFoundError(n,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+n.name+"<-"}},mt={buildDuplicateFoundError(n,e){function t(c){return c instanceof G?c.terminalType.name:c instanceof ue?c.nonTerminalName:""}const r=n.name,i=Pe(e),s=i.idx,a=Ge(i),o=t(i),l=s>0;let u=`->${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 u=u.replace(/[ \t]+/g," "),u=u.replace(/\s\s+/g,`
`),u},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=$(n.prefixPath,i=>Lt(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=$(n.prefixPath,i=>Lt(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=Ge(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=$(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 Vt?e=n.topLevelRule.name:e=n.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${n.grammarName}<-`}};function Yf(n,e){const t=new Xf(n,e);return t.resolveRefs(),t.errors}class Xf extends Kt{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){C(z(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 Jf extends ni{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=re(this.path.ruleStack).reverse(),this.occurrenceStack=re(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 Qf extends Jf{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 pe({definition:i});this.possibleTokTypes=Gn(s),this.found=!0}}}class ii extends ni{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 Zf extends ii{walkMany(e,t,r){if(e.idx===this.occurrence){const i=Pe(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof G&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,t,r)}}class ka extends ii{walkManySep(e,t,r){if(e.idx===this.occurrence){const i=Pe(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof G&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,t,r)}}class eh extends ii{walkAtLeastOne(e,t,r){if(e.idx===this.occurrence){const i=Pe(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof G&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,t,r)}}class $a extends ii{walkAtLeastOneSep(e,t,r){if(e.idx===this.occurrence){const i=Pe(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof G&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,t,r)}}function Xi(n,e,t=[]){t=re(t);let r=[],i=0;function s(o){return o.concat(Q(n,i+1))}function a(o){const l=Xi(s(o),e,t);return r.concat(l)}for(;t.length<e&&i<n.length;){const o=n[i];if(o instanceof pe)return a(o.definition);if(o instanceof ue)return a(o.definition);if(o instanceof ne)r=a(o.definition);else if(o instanceof xe){const l=o.definition.concat([new W({definition:o.definition})]);return a(l)}else if(o instanceof Se){const l=[new pe({definition:o.definition}),new W({definition:[new G({terminalType:o.separator})].concat(o.definition)})];return a(l)}else if(o instanceof me){const l=o.definition.concat([new W({definition:[new G({terminalType:o.separator})].concat(o.definition)})]);r=a(l)}else if(o instanceof W){const l=o.definition.concat([new W({definition:o.definition})]);r=a(l)}else{if(o instanceof ge)return C(o.definition,l=>{D(l.definition)===!1&&(r=a(l.definition))}),r;if(o instanceof G)t.push(o.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:t,suffixDef:Q(n,i)}),r}function Jl(n,e,t,r){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const l=e.length,u=l-r-1,c=[],d=[];for(d.push({idx:-1,def:n,ruleStack:[],occurrenceStack:[]});!D(d);){const h=d.pop();if(h===a){o&&Pt(d).idx<=u&&d.pop();continue}const f=h.def,m=h.idx,g=h.ruleStack,A=h.occurrenceStack;if(D(f))continue;const T=f[0];if(T===i){const E={idx:m,def:Q(f),ruleStack:Ln(g),occurrenceStack:Ln(A)};d.push(E)}else if(T instanceof G)if(m<l-1){const E=m+1,R=e[E];if( Line truncated
${s.join(`
`).replace(/\n/g,`
`)}`)}}};return t.prototype=r,t.prototype.constructor=t,t._RULE_NAMES=e,t}function Bh(n,e,t){const r=function(){};fu(r,n+"BaseSemanticsWithDefaults");const i=Object.create(t.prototype);return C(e,s=>{i[s]=Gh}),r.prototype=i,r.prototype.constructor=r,r}var ts;(function(n){n[n.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",n[n.MISSING_METHOD=1]="MISSING_METHOD"})(ts||(ts={}));function Vh(n,e){return Kh(n,e)}function Kh(n,e){const t=$e(e,i=>Et(n[i])===!1),r=$(t,i=>({msg:`Missing visitor method: <${i}> on ${n.constructor.name} CST Visitor.`,type:ts.MISSING_METHOD,methodName:i}));return Mn(r)}class Wh{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=N(e,"nodeLocationTracking")?e.nodeLocationTracking:Je.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Y,this.cstFinallyStateUpdate=Y,this.cstPostTerminal=Y,this.cstPostNonTerminal=Y,this.cstPostRule=Y;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Ca,this.setNodeLocationFromNode=Ca,this.cstPostRule=Y,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Y,this.setNodeLocationFromNode=Y,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Ia,this.setNodeLocationFromNode=Ia,this.cstPostRule=Y,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Y,this.setNodeLocationFromNode=Y,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Y,this.setNodeLocationFromNode=Y,this.cstPostRule=Y,this.setInitialNodeLocation=Y;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];Mh(r,t,e),this.setNodeLocationFromToken(r.location,t)}cstPostNonTerminal(e,t){const r=this.CST_STACK[this.CST_STACK.length-1];Dh(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(Ye(this.baseCstVisitorConstructor)){const e=Uh(this.className,Ot(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Ye(this.baseCstVisitorWithDefaultsConstructor)){const e=Bh(this.className,Ot(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 jh{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Mr}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Mr:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class Hh{ACTION(e){return e.call(this)}consume(e,t,r){return this.consumeInternal(t,e,r)}subrule(e,t,r){return this.subruleInternal(t,e,r)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(eLine truncated
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details.`);if(te(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(te(e))this.tokensMap=le(e,(s,a)=>(s[a.name]=a,s),{});else if(N(e,"modes")&&be(Ne(z(e.modes)),jf)){const s=Ne(z(e.modes)),a=Ss(s);this.tokensMap=le(a,(o,l)=>(o[l.name]=l,o),{})}else if(vc(e))this.tokensMap=re(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=N(e,"modes")?Ne(z(e.modes)):z(e),i=be(r,s=>D(s.categoryMatches));this.tokenMatcher=i?Or:Un,Bn(z(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=N(r,"resyncEnabled")?r.resyncEnabled:Dr.resyncEnabled,s=N(r,"recoveryValueFunc")?r.recoveryValueFunc:Dr.recoveryValueFunc,a=this.ruleShortNameIdx<<Lh+it;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...c){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,c);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(...c){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,c)}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(br(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(du,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(Zi,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,B.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,Zi,e,eh)}atLeastOneSepFirstInternal(e,t){const r=this.getKeyForAutomaticLookahead(Tr,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,$a],o,Tr,e,$a)}else throw this.raiseEarlyExitException(e,B.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){const r=this.getKeyForAutomaticLookahead(Qi,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,Qi,e,Zf,a)}manySepFirstInternal(e,t){const r=this.getKeyForAutomaticLookahead(es,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,ka],o,es,e,ka)}}repetitionSepSecondInternal(e,t,r,i,s){for(;r();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,i,s],r,Tr,e,s)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const r=this.getKeyForAutomaticLookahead(cu,t),i=te(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Ih(t,e))}}subruleInternal(e,t,r){let i;try{const s=r!==void 0?r.ARGS:void 0;return this.subruleIdx=t,i=e.apply(this,s),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,r,e.ruleName)}}subruleInternalError(e,t,r){throw br(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,t,r){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeT Line truncated
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(pu);const Xh={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Jh{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 Mr}topLevelRuleRecord(e,t){try{const r=new Vt({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 Ht.call(this,ne,e,t)}atLeastOneInternalRecord(e,t){Ht.call(this,xe,t,e)}atLeastOneSepFirstInternalRecord(e,t){Ht.call(this,Se,t,e,Na)}manyInternalRecord(e,t){Ht.call(this,W,t,e)}manySepFirstInternalRecord(e,t){Ht.call(this,me,t,e,Na)}orInternalRecord(e,t){return Qh.call(this,e,t)}subruleInternalRecord(e,t,r){if(Pr(t),!e||N(e,"ruleName")===!1){const o=new Error(`<SUBRULE${_a(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=Pt(this.recordingProdStack),s=e.ruleName,a=new ue({idx:t,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?Xh:li}consumeInternalRecord(e,t,r){if(Pr(t),!zl(e)){const a=new Error(`<CONSUME${_a(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=Pt(this.recordingProdStack),s=new G({idx:t,terminalType:e,label:r?.LABEL});return i.definition.push(s),pu}}function Ht(n,e,t,r=!1){Pr(t);const i=Pt(this.recordingProdStack),s=Et(e)?e:e.DEF,a=new n({definition:[],idx:t});return r&&(a.separator=e.SEP),N(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),li}function Qh(n,e){Pr(e);const t=Pt(this.recordingProdStack),r=te(n)===!1,i=r===!1?n:n.DEF,s=new ge({definition:[],idx:e,ignoreAmbiguities:r&&n.IGNORE_AMBIGUITIES===!0});N(n,"MAX_LOOKAHEAD")&&(s.maxLookahead=n.MAX_LOOKAHEAD);const a=ml(i,o=>Et(o.GATE));return s.hasPredicates=a,t.definition.push(s),C(i,o=>{const l=new pe({definition:[]});s.definition.push(l),N(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:N(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),li}function _a(n){return n===0?"":`${n}`}function Pr(n){if(n<0||n>wa){const e=new Error(`Invalid DSL Method idx value: <${n}>
Idx value must be a none negative value smaller than ${wa+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class Zh{initPerformanceTracer(e){if(N(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=Je.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}=Dl(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 ep(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 Mr=Ds(tt,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Mr);const Je=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:wt,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Dr=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 La(n=void 0){return function(){return n}}class Vn{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",()=>{Fl(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),C(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=$h({rules:z(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(D(r)&&this.skipValidations===!1){const i=xh({rules:z(this.gastProductionsCache),tokenTypes:z(this.tokensMap),errMsgProvider:mt,grammarName:t}),s=uh({lookaheadStrategy:this.lookaheadStrategy,rules:z(this.gastProductionsCache),tokenTypes:z(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(i,s)}}),D(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=lf(z(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:z(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(z(this.gastProductionsCache))})),!Vn.DEFER_DEFINITION_ERRORS_HANDLING&&!D(this.definitionErrors))throw e=$(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),N(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=N(t,"skipValidations")?t.skipValidations:Je.skipValidations}}Vn.DEFER_DEFINITION_ERRORS_HANDLING=!1;ep(Vn,[wh,Oh,Wh,jh,zh,Hh,qh,Yh,Jh,Zh]);class tp extends Vn{constructor(e,t=Je){const r=re(t);r.outputCst=!1,super(e,r)}}function Mt(n,e,t){return`${n.name}_${e}_${t}`}const nt=1,np=2,mu=4,gu=5,Kn=7,rp=8,ip=9,sp=10,ap=11,yu=12;class Bs{constructor(e){this.target=e}isEpsilon(){return!1}}class Vs extends Bs{constructor(e,t){super(e),this.tokenType=t}}class Tu extends Bs{constructor(e){super(e)}isEpsilon(){return!0}}class Ks extends Bs{constructor(e,t,r){super(e),this.rule=t,this.followState=r}isEpsilon(){return!0}}function op(n){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};lp(e,n);const t=n.length;for(let r=0;r<t;r++){const i=n[r],s=$t(e,i,i);s!==void 0&&Rp(e,i,s)}return e}function lp(n,e){const t=e.length;for(let r=0;r<t;r++){const i=e[r],s=X(n,i,void 0,{type:np}),a=X(n,i,void 0,{type:Kn});s.stop=a,n.ruleToStartState.set(i,s),n.ruleToStopState.set(i,a)}}function Ru(n,e,t){return t instanceof G?Ws(n,e,t.terminalType,t):t instanceof ue?Tp(n,e,t):t instanceof ge?hp(n,e,t):t instanceof ne?pp(n,e,t):t instanceof W?up(n,e,t):t instanceof me?cp(n,e,t):t instanceof xe?dp(n,e,t):t instanceof Se?fp(n,e,t):$t(n,e,t)}function up(n,e,t){const r=X(n,e,t,{type:gu});st(n,r);const i=Wt(n,e,r,t,$t(n,e,t));return Au(n,e,t,i)}function cp(n,e,t){const r=X(n,e,t,{type:gu});st(n,r);const i=Wt(n,e,r,t,$t(n,e,t)),s=Ws(n,e,t.separator,t);return Au(n,e,t,i,s)}function dp(n,e,t){const r=X(n,e,t,{type:mu});st(n,r);const i=Wt(n,e,r,t,$t(n,e,t));return vu(n,e,t,i)}function fp(n,e,t){const r=X(n,e,t,{type:mu});st(n,r);const i=Wt(n,e,r,t,$t(n,e,t)),s=Ws(n,e,t.separator,t);return vu(n,e,t,i,s)}function hp(n,e,t){const r=X(n,e,t,{type:nt});st(n,r);const i=$(t.definition,a=>Ru(n,e,a));return Wt(n,e,r,t,...i)}function pp(n,e,t){const r=X(n,e,t,{type:nt});st(n,r);const i=Wt(n,e,r,t,$t(n,e,t));return mp(n,e,t,i)}function $t(n,e,t){const r=$e($(t.definition,i=>Ru(n,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:yp(n,r)}function vu(n,e,t,r,i){const s=r.left,a=r.right,o=X(n,e,t,{type:ap});st(n,o);const l=X(n,e,t,{type:yu});return s.loopback=o,l.loopback=o,n.decisionMap[Mt(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",t.idx)]=o,H(a,o),i===void 0?(H(o,s),H(o,l)):(H(o,l),H(o,i.left),H(i.right,s)),{left:s,right:l}}function Au(n,e,t,r,i){const s=r.left,a=r.right,o=X(n,e,t,{type:sp});st(n,o);const l=X(n,e,t,{type:yu}),u=X(n,e,t,{type:ip});return o.loopback=u,l.loopback=u,H(o,s),H(o,l),H(a,u),i!==void 0?(H(u,l),H(u,i.left),H(i.right,s)):H(u,o),n.decisionMap[Mt(e,i?"RepetitionWithSeparator":"Repetition",t.idx)]=o,{left:o,right:l}}function mp(n,e,t,r){const i=r.left,s=r.right;return H(i,s),n.decisionMap[Mt(e,"Option",t.idx)]=i,r}function st(n,e){return n.decisionStates.push(e),e.decision=n.decisionStates.length-1,e.decision}function Wt(n,e,t,r,...i){const s=X(n,e,r,{type:rp,start:t});t.end=s;for(const o of i)o!==void 0?(H(t,o.left),H(o.right,s)):H(t,s);const a={left:t,right:s};return n.decisionMap[Mt(e,gp(r),r.idx)]=t,a}function gp(n){if(n instanceof ge)return"Alternation";if(n instanceof ne)return"Option";if(n instanceof W)return"Repetition";if(n instanceof me)return"RepetitionWithSeparator";if(n instanceof xe)return"RepetitionMandatory";if(n instanceof Se)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function yp(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 Ks,u=o,c=e[s+1].left;a.left.type===nt&&a.right.type===nt&&o!==void 0&&(l&&u.followState===a.right||o.target===a.right)?(l?u.followState=c:o.target=c,vp(n,a.right)):H(a.right,c)}const r=e[0],i=e[t-1];return{left:r.left,right:i.right}}function Ws(n,e,t,r){const i=X(n,e,r,{type:nt}),s=X(n,e,r,{type:nt});return js(i,new Vs(s,t)),{left:i,right:s}}function Tp(n,e,t){const r=t.referencedRule,i=n.ruleToStartState.get(r),s=X(n,e,t,{type:nt}),a=X(n,e,t,{type:nt}),o=new Ks(i,r,a);return js(s,o),{left:s,right:a}}function Rp(n,e,t){const r=n.ruleToStartState.get(e);H(r,t.left);const i=n.ruleToStopState.get(e);return H(t.right,i),{left:r,right:i}}function H(n,e){const t=new Tu(e);js(n,t)}function X(n,e,t,r){const i=Object.assign({atn:n,production:t,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:n.states.length},r);return n.states.push(i),i}function js(n,e){n.transitions.length===0&&(n.epsilonOnlyTransitions=e.isEpsilon()),n.transitions.push(e)}function vp(n,e){n.states.splice(n.states.indexOf(e),1)}const Fr={};class ns{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const t=Eu(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return $(this.configs,e=>e.alt)}get key(){let e="";fo Line truncated
<${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 Cp(n){if(n instanceof ue)return"SUBRULE";if(n instanceof ne)return"OPTION";if(n instanceof ge)return"OR";if(n instanceof xe)return"AT_LEAST_ONE";if(n instanceof Se)return"AT_LEAST_ONE_SEP";if(n instanceof me)return"MANY_SEP";if(n instanceof W)return"MANY";if(n instanceof G)return"CONSUME";throw Error("non exhaustive match")}function Np(n,e,t){const r=Ee(e.configs.elements,s=>s.state.transitions),i=Xc(r.filter(s=>s instanceof Vs).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:t,possibleTokenTypes:i,tokenPath:n}}function wp(n,e){return n.edges[e.tokenTypeIdx]}function _p(n,e,t){const r=new ns,i=[];for(const a of n.elements){if(t.is(a.alt)===!1)continue;if(a.state.type===Kn){i.push(a);continue}const o=a.state.transitions.length;for(let l=0;l<o;l++){const u=a.state.transitions[l],c=Lp(u,e);c!==void 0&&r.add({state:c,alt:a.alt,stack:a.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new ns;for(const a of r.elements)Gr(a,s)}if(i.length>0&&!Mp(s))for(const a of i)s.add(a);return s}function Lp(n,e){if(n instanceof Vs&&Xl(e,n.tokenType))return n.target}function Op(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 $u(n){return{configs:n,edges:{},isAcceptState:!1,prediction:-1}}function Pa(n,e,t,r){return r=xu(n,r),e.edges[t.tokenTypeIdx]=r,r}function xu(n,e){if(e===Fr)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 bp(n){const e=new ns,t=n.transitions.length;for(let r=0;r<t;r++){const s={state:n.transitions[r].target,alt:r,stack:[]};Gr(s,e)}return e}function Gr(n,e){const t=n.state;if(t.type===Kn){if(n.stack.length>0){const i=[...n.stack],a={state:i.pop(),alt:n.alt,stack:i};Gr(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=Pp(n,s);a!==void 0&&Gr(a,e)}}function Pp(n,e){if(e instanceof Tu)return{state:e.target,alt:n.alt,stack:n.stack};if(e instanceof Ks){const t=[...n.stack,e.followState];return{state:e.target,alt:n.alt,stack:t}}}function Mp(n){for(const e of n.elements)if(e.state.type===Kn)return!0;return!1}function Dp(n){for(const e of n.elements)if(e.state.type!==Kn)return!1;return!0}function Fp(n){if(Dp(n))return!0;const e=Gp(n.elements);return Up(e)&&!Bp(e)}function Gp(n){const e=new Map;for(const t of n){const r=Eu(t,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[t.alt]=!0}return e}function Up(n){for(const e of Array.from(n.values()))if(Object.keys(e).length>1)return!0;return!1}function Bp(n){for(const e of Array.from(n.values()))if(Object.keys(e).length===1)return!0;return!1}var Ma;(function(n){function e(t){return typeof t=="string"}n.is=e})(Ma||(Ma={}));var rs;(function(n){function e(t){return typeof t=="string"}n.is=e})(rs||(rs={}));var Da;(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})(Da||(Da={}));var Ur;(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})(Ur||(Ur={}));var P;(function(n){function e(r,i){return r===Number.MAX_VALUE&&(r=Ur.MAX_VALUE),i===Number.MAX_VALUE&&(i=Ur.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})(P||(P={}));var b;(function(n){function e(r,i,s,a){if(p.uinteger(r)&&p.uinteger(i)&&p.uinteger(s)&&p.uinteger(a))return{start:P.create(r,i),end:P.create(s,a)};if(P.is(r)&&P.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)&&P.is(i.start)&&P.is(i.end)}n.is=t})(b||(b={}));var Br;(function(n){function e(r,i){return{uri:r,range:i}}n.create=e;function t(r){let i=r;return p.objectLiteral(i)&&b.is(i.range)&&(p.string(i.uri)||p.undefined(i.uri))}n.is=t})(Br||(Br={}));var Fa;(function(n){function e(r,i,s,a){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:a}}n.create=e;function t(r){let i=r;return p.objectLiteral(i)&&b.is(i.targetRange)&&p.string(i.targetUri)&&b.is(i.targetSelectionRange)&&(b.is(i.originSelectionRange)||p.undefined(i.originSelectionRange))}n.is=t})(Fa||(Fa={}));var is;(function(n){function e(r,i,s,a){return{red:r,green:i,blue:s,alpha:a}}n.create=e;function t(r){const i=r;return p.objectLiteral(i)&&p.numberRange(i.red,0,1)&&p.numberRange(i.green,0,1)&&p.numberRange(i.blue,0,1)&&p.numberRange(i.alpha,0,1)}n.is=t})(is||(is={}));var Ga;(function(n){function e(r,i){return{range:r,color:i}}n.create=e;function t(r){const i=r;return p.objectLiteral(i)&&b.is(i.range)&&is.is(i.color)}n.is=t})(Ga||(Ga={}));var Ua;(function(n){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}n.create=e;function t(r){const i=r;return p.objectLiteral(i)&&p.string(i.label)&&(p.undefined(i.textEdit Line truncated
`,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 P.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 P.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(f){return typeof f<"u"}n.defined=t;function r(f){return typeof f>"u"}n.undefined=r;function i(f){return f===!0||f===!1}n.boolean=i;function s(f){return e.call(f)==="[object String]"}n.string=s;function a(f){return e.call(f)==="[object Number]"}n.number=a;function o(f,m,g){return e.call(f)==="[object Number]"&&m<=f&&f<=g}n.numberRange=o;function l(f){return e.call(f)==="[object Number]"&&-2147483648<=f&&f<=2147483647}n.integer=l;function u(f){return e.call(f)==="[object Number]"&&0<=f&&f<=2147483647}n.uinteger=u;function c(f){return e.call(f)==="[object Function]"}n.func=c;function d(f){return f!==null&&typeof f=="object"}n.objectLiteral=d;function h(f,m){return Array.isArray(f)&&f.every(m)}n.typedArray=h})(p||(p={}));class Kp{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?e:this.rootNode}buildRootNode(e){return this.rootNode=new Iu(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const t=new Hs;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){const r=new gs(e.startOffset,e.image.length,Ki(e),e.tokenType,!t);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)}}addHiddenNodes(e){const t=[];for(const s of e){const a=new gs(s.startOffset,s.image.length,Ki(s),s.tokenType,!0);a.root=this.rootNode,t.push(a)}let r=this.current,i=!1;if(r.content.length>0){r.content.push(...t);return}for(;r.container;){const s=r.container.content.indexOf(r);if(s>0){r.container.content.splice(s,0,...t),i=!0;break}r=r.container}i||this.rootNode.content.unshift(...t)}construct(e){const t=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=t;const r=this.nodeStack.pop();r?.content.length===0&&this.removeNode(r)}}class Su{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 gs extends Su{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 Hs extends Su{constructor(){super(...arguments),this.content=new zs(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:P.create(0,0),end:P.create(0,0)}}get firstNonHiddenNode(){for(const e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){const t=this.content[e];if(!t.hidden)return t}return this.content[this.content.length-1]}}class zs extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,zs.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...r){return this.addParents(r),super.splice(e,t,...r)}addParents(e){for(const t of e)t.container=this.parent}}class Iu extends Hs{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const ys=Symbol("Datatype");function Si(n){return n.$type===ys}const Fo="​",Cu=n=>n.endsWith(Fo)?n:n+Fo;class Nu{constructor(e){this._unor Line truncated
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return u}}function r(u){return u.charAt(0)==="^"?u.substring(1):u}n.convertID=r;function i(u){return parseInt(u)}n.convertInt=i;function s(u){return BigInt(u)}n.convertBigint=s;function a(u){return new Date(u)}n.convertDate=a;function o(u){return Number(u)}n.convertNumber=o;function l(u){return u.toLowerCase()==="true"}n.convertBoolean=l})(We||(We={}));var ht={},ir={},Go;function Du(){if(Go)return ir;Go=1,Object.defineProperty(ir,"__esModule",{value:!0});let n;function e(){if(n===void 0)throw new Error("No runtime abstraction layer installed");return n}return function(t){function r(i){if(i===void 0)throw new Error("No runtime abstraction layer provided");n=i}t.install=r}(e||(e={})),ir.default=e,ir}var J={},Uo;function om(){if(Uo)return J;Uo=1,Object.defineProperty(J,"__esModule",{value:!0}),J.stringArray=J.array=J.func=J.error=J.number=J.string=J.boolean=void 0;function n(o){return o===!0||o===!1}J.boolean=n;function e(o){return typeof o=="string"||o instanceof String}J.string=e;function t(o){return typeof o=="number"||o instanceof Number}J.number=t;function r(o){return o instanceof Error}J.error=r;function i(o){return typeof o=="function"}J.func=i;function s(o){return Array.isArray(o)}J.array=s;function a(o){return s(o)&&o.every(l=>e(l))}return J.stringArray=a,J}var pt={},Bo;function Fu(){if(Bo)return pt;Bo=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.Emitter=pt.Event=void 0;const n=Du();var e;(function(i){const s={dispose(){}};i.None=function(){return s}})(e||(pt.Event=e={}));class t{add(s,a=null,o){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(s),this._contexts.push(a),Array.isArray(o)&&o.push({dispose:()=>this.remove(s,a)})}remove(s,a=null){if(!this._callbacks)return;let o=!1;for(let l=0,u=this._callbacks.length;l<u;l++)if(this._callbacks[l]===s)if(this._contexts[l]===a){this._callbacks.splice(l,1),this._contexts.splice(l,1);return}else o=!0;if(o)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...s){if(!this._callbacks)return[];const a=[],o=this._callbacks.slice(0),l=this._contexts.slice(0);for(let u=0,c=o.length;u<c;u++)try{a.push(o[u].apply(l[u],s))}catch(d){(0,n.default)().console.error(d)}return a}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class r{constructor(s){this._options=s}get event(){return this._event||(this._event=(s,a,o)=>{this._callbacks||(this._callbacks=new t),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,a);const l={dispose:()=>{this._callbacks&&(this._callbacks.remove(s,a),l.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(o)&&o.push(l),l}),this._event}fire(s){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return pt.Emitter=r,r._noop=function(){},pt}var Vo;function lm(){if(Vo)return ht;Vo=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht.CancellationTokenSource=ht.CancellationToken=void 0;const n=Du(),e=om(),t=Fu();var r;(function(o){o.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:t.Event.None}),o.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:t.Event.None});function l(u){const c=u;return c&&(c===o.None||c===o.Cancelled||e.boolean(c.isCancellationRequested)&&!!c.onCancellationRequested)}o.is=l})(r||(ht.CancellationToken=r={}));const i=Object.freeze(function(o,l){const u=(0,n.default)().timer.setTimeout(o.bind(l),0);return{dispose(){u.dispose()}}});class s{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?i:(this._emitter||(this._emitter=new t.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class a{get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=r.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=r.None}}return ht.CancellationTokenSource=a,ht}var V=lm();function um(){return new Promise(n=>{typeof setImmediate>"u"?setTimeout(n,0):setImmediate(n)})}let Rr=0,cm=10;function dm(){return Rr=performance.now(),new V.CancellationTokenSource}const Hr=Symbol("OperationCancelled");function ui(n){return n===Hr}async function Ae(n){if(n===V.CancellationToken.None)return;const e=performance.now();if(e-Rr>=cm&&(Rr=e,await um(),Rr=performance.now()),n.isCancellationRequested)throw Hr}class qs{constructor(){this.promise=new Promise((e Line truncated
${t}`),this.inline?`{${e}}`:e}toMarkdown(e){var t,r;return(r=(t=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=ng(this.name,t,e??{});if(typeof s=="string")return s}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":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 ng(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=As(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:rg(e,a)}}function rg(n,e){try{return At.parse(n,!0),`[${e}](${n})`}catch{return n}}class Es{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 qu{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}}function Xo(n){return n.endsWith(`
`)?`
`:`
`}class ig{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const t=this.commentProvider.getComment(e);if(t&&jm(t))return Wm(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=Ze(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 sg{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var t;return xm(e)?e.$comment:(t=id(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||t===void 0?void 0:t.text}}class ag{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}}class og{constructor(){this.previousTokenSource=new V.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const t=dm();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,r=V.CancellationToken.None){const i=new qs,s={action:t,deferred:i,cancellationToken:r};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){ui(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class lg{constructor(e){this.grammarElementIdMap=new Wo,this.tokenTypeIdMap=new Wo,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(t=>Object.assign(Object.assign({},t),{message:t.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const t=new Map,r=new Map;for(const i of _t(e))t.set(i,{});if(e.$cstNode)for(const i of Vi(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)):Ue(o)?a.push(this.dehydrateReference(o,t)):a.push(o)}else ae(s)?r[i]=this.dehydrateAstNode(s,t):Ue(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 Tl(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=t.astNodes.get(e.astNode),On(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,t)):yl(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,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,r)}}createHydrationContext(e){const t=new Map,r=new Map;for(const s of _t(e))t.set(s,{});let i;if(e.$cstNode)for(const s of Vi(e.$cstNode)){let a;"fullText"in s?(a=new Iu(s.fullText),i=a):"content"in s?a=new Hs:"tokenType"in s&&(a=this.hydrateCstLeafNode(s)),a&&(r.set(s,a),a.root=i)}return{astNodes:t,cstNodes:r}}hydrateAstNode(e,t){const r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=t.cstNodes.get(e.$cstNode));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.setParent(this.hydrateAstNode(o,t),r)):Ue(o)?a.push(this.hydrateReference(o,r,i,t)):a.push(o)}else ae(s)?r[i]=this.setParent(th Line truncated
`)}}},di=class extends ci{static{v(this,"CommonValueConverter")}runCustomConverter(n,e,t){}},ut=class extends Pu{static{v(this,"AbstractMermaidTokenBuilder")}constructor(n){super(),this.keywords=new Set(n)}buildKeywordTokens(n,e,t){const r=super.buildKeywordTokens(n,e,t);return r.forEach(i=>{this.keywords.has(i.name)&&i.PATTERN!==void 0&&(i.PATTERN=new RegExp(i.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),r}};(class extends ut{static{v(this,"CommonTokenBuilder")}});var Jg=class extends ut{static{v(this,"GitGraphTokenBuilder")}constructor(){super(["gitGraph"])}},Ju={parser:{TokenBuilder:v(()=>new Jg,"TokenBuilder"),ValueConverter:v(()=>new di,"ValueConverter")}};function Qu(n=lt){const e=oe(ot(n),St),t=oe(at({shared:e}),Wg,Ju);return e.ServiceRegistry.register(t),{shared:e,GitGraph:t}}v(Qu,"createGitGraphServices");var Qg=class extends ut{static{v(this,"InfoTokenBuilder")}constructor(){super(["info","showInfo"])}},Zu={parser:{TokenBuilder:v(()=>new Qg,"TokenBuilder"),ValueConverter:v(()=>new di,"ValueConverter")}};function ec(n=lt){const e=oe(ot(n),St),t=oe(at({shared:e}),Ug,Zu);return e.ServiceRegistry.register(t),{shared:e,Info:t}}v(ec,"createInfoServices");var Zg=class extends ut{static{v(this,"PacketTokenBuilder")}constructor(){super(["packet"])}},tc={parser:{TokenBuilder:v(()=>new Zg,"TokenBuilder"),ValueConverter:v(()=>new di,"ValueConverter")}};function nc(n=lt){const e=oe(ot(n),St),t=oe(at({shared:e}),Bg,tc);return e.ServiceRegistry.register(t),{shared:e,Packet:t}}v(nc,"createPacketServices");var ey=class extends ut{static{v(this,"PieTokenBuilder")}constructor(){super(["pie","showData"])}},ty=class extends ci{static{v(this,"PieValueConverter")}runCustomConverter(n,e,t){if(n.name==="PIE_SECTION_LABEL")return e.replace(/"/g,"").trim()}},rc={parser:{TokenBuilder:v(()=>new ey,"TokenBuilder"),ValueConverter:v(()=>new ty,"ValueConverter")}};function ic(n=lt){const e=oe(ot(n),St),t=oe(at({shared:e}),Vg,rc);return e.ServiceRegistry.register(t),{shared:e,Pie:t}}v(ic,"createPieServices");var ny=class extends ut{static{v(this,"ArchitectureTokenBuilder")}constructor(){super(["architecture"])}},ry=class extends ci{static{v(this,"ArchitectureValueConverter")}runCustomConverter(n,e,t){if(n.name==="ARCH_ICON")return e.replace(/[()]/g,"").trim();if(n.name==="ARCH_TEXT_ICON")return e.replace(/["()]/g,"");if(n.name==="ARCH_TITLE")return e.replace(/[[\]]/g,"").trim()}},sc={parser:{TokenBuilder:v(()=>new ny,"TokenBuilder"),ValueConverter:v(()=>new ry,"ValueConverter")}};function ac(n=lt){const e=oe(ot(n),St),t=oe(at({shared:e}),Kg,sc);return e.ServiceRegistry.register(t),{shared:e,Architecture:t}}v(ac,"createArchitectureServices");var iy=class extends ut{static{v(this,"RadarTokenBuilder")}constructor(){super(["radar-beta"])}},oc={parser:{TokenBuilder:v(()=>new iy,"TokenBuilder"),ValueConverter:v(()=>new di,"ValueConverter")}};function lc(n=lt){const e=oe(ot(n),St),t=oe(at({shared:e}),jg,oc);return e.ServiceRegistry.register(t),{shared:e,Radar:t}}v(lc,"createRadarServices");var sy=class extends ut{static{v(this,"TreemapTokenBuilder")}constructor(){super(["treemap"])}},ay=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,oy=class extends ci{static{v(this,"TreemapValueConverter")}runCustomConverter(n,e,t){if(n.name==="NUMBER2")return parseFloat(e.replace(/,/g,""));if(n.name==="SEPARATOR")return e.substring(1,e.length-1);if(n.name==="STRING2")return e.substring(1,e.length-1);if(n.name==="INDENTATION")return e.length;if(n.name==="ClassDef"){if(typeof e!="string")return e;const r=ay.exec(e);if(r)return{$type:"ClassDefStatement",className:r[1],styleText:r[2]||void 0}}}};function uc(n){const e=n.validation.TreemapValidator,t=n.validation.ValidationRegistry;if(t){const r={Treemap:e.checkSingleRoot.bind(e)};t.register(r,e)}}v(uc,"registerValidationChecks");var ly=class{static{v(this,"TreemapValidator")}checkSingleRoot(n,e){let t;for(const r of n.TreemapRows)r.item&&(t===void 0&&r.indent===void 0?t=0:r.indent===void 0?e("error","Multiple root nodes are not allowed in a treemap.",{node:r,property:"item"}):t!==void 0&&t>=parseInt(r.indent,10)&&e("error","Multiple root nodes are not allowed in a treemap.",{node:r,property:"item"}))}},cc={parser:{TokenBuilder:v(()=>new sy,"TokenBuilder"),ValueConverter:v(()=>new oy,"ValueConverter")},validation:{TreemapValidator:v(()=>new ly,"TreemapValidator")}};function dc(n=lt){const e=oe(ot(n),St),t=oe(at({shared:e}),Hg,cc);return e.ServiceRegistry.register(t),uc(t),{shared:e,Treemap:t}}v(dc,"createTreemapServices");var je={},uy={info:v(async()=>{const{createInfoServices:n}=await ft(async()=>{const{createInfoServices:t}=await Promise.resolve().then(()=>fy);return{createInfoServices:t}},void 0),e=n().Info.parser.LangiumParser;je.info=e},"info"),packet:v(async()=>{const{createPacketServices:n}=await ft(async()=>{const{createPacketServices:t}=await Promise.resolve().then(()=>hy);return{createPacketServices:t}},void 0),e=n().Packet.parser.LangiumParser;je.packet=e},"packet"),pie:v(async()=>{const{create Line truncated
`),t=n.parserErrors.map(r=>r.message).join(`
`);super(`Parsing failed: ${e} ${t}`),this.result=n}static{v(this,"MermaidParseError")}};const fy=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:Zu,createInfoServices:ec},Symbol.toStringTag,{value:"Module"})),hy=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:tc,createPacketServices:nc},Symbol.toStringTag,{value:"Module"})),py=Object.freeze(Object.defineProperty({__proto__:null,PieModule:rc,createPieServices:ic},Symbol.toStringTag,{value:"Module"})),my=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:sc,createArchitectureServices:ac},Symbol.toStringTag,{value:"Module"})),gy=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:Ju,createGitGraphServices:Qu},Symbol.toStringTag,{value:"Module"})),yy=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:oc,createRadarServices:lc},Symbol.toStringTag,{value:"Module"})),Ty=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:cc,createTreemapServices:dc},Symbol.toStringTag,{value:"Module"}));export{cy as p};