import{_asEn}from"./index-DNCGxUDM.js";import{bBasOh,bCasxh,aVasbd,blasDh,aZasMh,aWasje,arasFh,asasbl,bbasGh,beas_d,bfasId,bcasUh,bqas_l,auasYn,avasae,aXasqh,aRasjh,bDaszh}from"./mermaid.core-CFUktQ8s.js";import{kasqr,jastl,gasHr,SasBh,wasWh,xasVh,casPd,vas$e,yas$d,lasKh,zasHh,AasYh,BasXh,CasJh,aasLd,dasq,iastn,rasJe,fasht,DasFe}from"./_baseUniq-T1y-Xwdr.js";import{jasnl,masM,dasQh,fasyt,gasjr,hasz,iasrl,lasjn,easZh}from"./_basePickBy-8KTOl_Ov.js";import{casBe}from"./clone-4l7SFgdX.js";varep=Object.prototype,tp=ep.hasOwnProperty,ft=Oh(function(t,e){if(xh(e)||bd(e)){Dh(e,qr(e),t);return}for(varnine)tp.call(e,n)&&Mh(t,n,e[n])});functionOd(t,e,n){varr=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(vars=Array(i);++r<i;)s[r]=t[r+e];returns}functionns(t){for(vare=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){vars=t[e];s&&(i[r++]=s)}returni}functionnp(t,e,n,r){for(vari=-1,s=t==null?0:t.length;++i<s;){vara=t[i];e(r,a,n(a),t)}returnr}functionrp(t,e,n,r){returntl(t,function(i,s,a){e(r,i,n(i),a)}),r}functionip(t,e){returnfunction(n,r){vari=je(n)?np:rp,s=e?e():{};returni(n,t,Hr(r),s)}}varsp=200;functionap(t,e,n,r){vari=-1,s=Wh,a=!0,o=t.length,c=[],l=e.length;if(!o)returnc;e.length>=sp&&(s=Vh,a=!1,e=newBh(e));e:for(;++i<o;){varu=t[i],f=u;if(u=u!==0?u:0,a&&f===f){for(varm=l;m--;)if(e[m]===f)continuee;c.push(u)}elses(e,f,r)||c.push(u)}returnc}var_a=Fh(function(t,e){returnbl(t)?ap(t,Pd(e,1,bl,!0)):[]});functionGe(t,e,n){varr=t==null?0:t.length;returnr?(e=e===void0?1:nl(e),Od(t,e<0?0:e,r)):[]}functionzi(t,e,n){varr=t==null?0:t.length;returnr?(e=e===void0?1:nl(e),e=r-e,Od(t,0,e<0?0:e)):[]}functionop(t,e){for(varn=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}functioncp(t,e){varn=!0;returntl(t,function(r,i,s){returnn=!!e(r,i,s),n}),n}functionkt(t,e,n){varr=je(t)?op:cp;returnr(t,Hr(e))}functionwt(t){returnt&&t.length?t[0]:void0}functiondt(t,e){returnPd(M(t,e))}varlp=Object.prototype,up=lp.hasOwnProperty,dp=ip(function(t,e,n){up.call(t,n)?t[n].push(e):Gh(t,n,[e])}),fp="[object String]";functionnt(t){returntypeoft=="string"||!je(t)&&_d(t)&&Id(t)==fp}varhp=Math.max;functionet(t,e,n,r){t=bd(t)?t:$e(t),n=n?nl(n):0;vari=t.length;returnn<0&&(n=hp(i+n,0)),nt(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&$d(t,e,n)>-1}functionIl(t,e,n){varr=t==null?0:t.length;if(!r)return-1;vari=0;return$d(t,e,i)}varpp="[object RegExp]";functionmp(t){return_d(t)&&Id(t)==pp}varPl=_l&&_l.isRegExp,nn=Pl?Uh(Pl):mp,gp="Expected a function";functionyp(t){if(typeoft!="function")thrownewTypeError(gp);returnfunction(){vare=arguments;switch(e.length){case0:return!t.call(this);case1:return!t.call(this,e[0]);case2:return!t.call(this,e[0],e[1]);case3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}functionNt(t,e){if(t==null)return{};varn=Kh(Hh(t),function(r){return[r]});returne=Hr(e),Qh(t,n,function(r,i){returne(r,i[0])})}functionIa(t,e){varn=je(t)?Yh:Xh;returnn(t,yp(Hr(e)))}functionTp(t,e){varn;returntl(t,function(r,i,s){returnn=e(r,i,s),!n}),!!n}functionxd(t,e,n){varr=je(t)?Jh:Tp;returnr(t,Hr(e))}functionil(t){returnt&&t.length?Ld(t):[]}functionRp(t,e){returnt&&t.length?Ld(t,Hr(e)):[]}functionWe(t){returntypeoft=="object"&&t!==null&&typeoft.$type=="string"}functionSt(t){returntypeoft=="object"&&t!==null&&typeoft.$refText=="string"&&"ref"int}functionun(t){returntypeoft=="object"&&t!==null&&typeoft.$refText=="string"&&"items"int}functionvp(t){returntypeoft=="object"&&t!==null&&typeoft.name=="string"&&typeoft.type=="string"&&typeoft.path=="string"}functionfi(t){returntypeoft=="object"&&t!==null&&typeoft.info=="object"&&typeoft.message=="string"}classDd{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){returnObject.keys(this.types)}getReferenceType(e){constn=this.types[e.container.$type];if(!n)thrownewError(`Type ${e.container.$type||"undefined"} not found.`);constr=n.properties[e.property]?.ref
`: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 n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,jl(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,jl(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else Ya(r.value,e),e.push(W("-")),Ya(i.value,e)}else Ya(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
\r\v\u2028\u2029\uFEFF`.split("");function Kd(t){const e=typeof t=="string"?new RegExp(t):t;return tm.some(n=>e.test(n))}function xa(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nm(t,e){const n=rm(t),r=e.match(n);return!!r&&r[0].length>0}function rm(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",a;function o(l){s+=n.substr(r,l),r+=l}function c(l){s+="(?:"+n.substr(r,l)+"|$)",r+=l}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?n[r+2]==="{"?c(n.indexOf("}",r)-r+1):c(6):c(2);break;case"p":case"P":e.unicode?c(n.indexOf("}",r)-r+1):c(2);break;case"k":c(n.indexOf(">",r)-r+1);break;default:c(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(n)||[],c(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(n),a?o(a[0].length):c(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":a=r,r+=3,i(),s+=n.substr(a,r-a);break;case"<":switch(n[r+3]){case"=":case"!":a=r,r+=4,i(),s+=n.substr(a,r-a);break;default:o(n.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else o(1),s+=i()+"|$)";break;case")":return++r,s;default:c(1);break}return s}return new RegExp(i(),t.flags)}function im(t){return t.rules.find(e=>sn(e)&&e.entry)}function sm(t){return t.rules.filter(e=>an(e)&&e.hidden)}function Hd(t,e){const n=new Set,r=im(t);if(!r)return new Set(t.rules);const i=[r].concat(sm(t));for(const a of i)Yd(a,n,e);const s=new Set;for(const a of t.rules)(n.has(a.name)||an(a)&&a.hidden)&&s.add(a);return s}function Yd(t,e,n){e.add(t.name),rs(t).forEach(r=>{if(Wn(r)||n){const i=r.rule.ref;i&&!e.has(i.name)&&Yd(i,e,n)}})}function am(t){if(t.terminal)return t.terminal;if(t.type.ref)return Jd(t.type.ref)?.terminal}function om(t){return t.hidden&&!Kd(ll(t))}function cm(t,e){return!t||!e?[]:cl(t,e,t.astNode,!0)}function Xd(t,e,n){if(!t||!e)return;const r=cl(t,e,t.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function cl(t,e,n,r){if(!r){const i=Pa(t.grammarSource,zn);if(i&&i.feature===e)return[t]}return Bi(t)&&t.astNode===n?t.content.flatMap(i=>cl(i,e,n,!1)):[]}function lm(t,e,n){if(!t)return;const r=um(t,e,t?.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function um(t,e,n){if(t.astNode!==n)return[];if(Bn(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=wo(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const a=i.value;a.astNode===n?Bn(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):r.prune()}while(!i.done);return s}function dm(t){const e=t.astNode;for(;e===t.container?.astNode;){const n=Pa(t.grammarSource,zn);if(n)return n;t=t.container}}function Jd(t){let e=t;return jd(e)&&($a(e.$container)?e=e.$container.$container:is(e.$container)?e=e.$container:ss(e.$container)),Qd(t,e,new Map)}function Qd(t,e,n){function r(i,s){let a;return Pa(i,zn)||(a=Qd(s,s,n)),n.set(t,a),a}if(n.has(t))return n.get(t);n.set(t,void 0);for(const i of rs(e)){if(zn(i)&&i.feature.toLowerCase()==="name")return n.set(t,i),i;if(Wn(i)&&sn(i.rule.ref))return r(i,i.rule.ref);if(xp(i)&&i.typeRef?.ref)return r(i,i.typeRef.ref)}}function Zd(t){return ef(t,new Set)}function ef(t,e){if(e.has(t))return!0;e.add(t);for(const n of rs(t))if(Wn(n)){if(!n.rule.ref||sn(n.rule.ref)&&!ef(n.rule.ref,e)||ca(n.rule.ref))return!1}else{if(zn(n))return!1;if($a(n))return!1}return!!t.definition}function tf(t){if(!an(t)){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){const e=t.returnType.ref;if(e)return e.name}}}function Wi(t){if(is(t))return sn(t)&&Zd(t)?t.name:tf(t)??t.name;if(_p(t)||Gp(t)||Op(t))return t.name;if($a(t)){const e=fm(t);if(e)return e}else if(jd(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function fm(t){if(t.inferredType)return t.inferredType.name;if(t.type?.ref)return Wi(t.type.ref)}functio
`;functionLm(t,e=!1){try{constn=Ma(t);return_o(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===of)e&&nf(`${ha} Unable to optimize: < ${t.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{letr="";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.`),bo(`${ha}
Failed parsing: < ${t.toString()} >
Using the @chevrotain/regexp-to-ast library
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function_o(t,e,n){switch(t.type){case"Disjunction":for(leti=0;i<t.value.length;i++)_o(t.value[i],e,n);break;case"Alternative":constr=t.value;for(leti=0;i<r.length;i++){consts=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}consta=s;switch(a.type){case"Character":Os(a.value,e,n);break;case"Set":if(a.complement===!0)throwError(of);q(a.value,c=>{if(typeofc=="number")Os(c,e,n);else{constl=c;if(n===!0)for(letu=l.from;u<=l.to;u++)Os(u,e,n);else{for(letu=l.from;u<=l.to&&u<Fi;u++)Os(u,e,n);if(l.to>=Fi){constu=l.from>=Fi?l.from:Fi,f=l.to,m=dn(u),p=dn(f);for(letA=m;A<=p;A++)e[A]=A}}}});break;case"Group":_o(a.value,e,n);break;default:throwError("Non Exhaustive Match")}consto=a.quantifier!==void0&&a.quantifier.atLeast===0;if(a.type==="Group"&&Io(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throwError("non exhaustive match!")}return$e(e)}functionOs(t,e,n){constr=dn(t);e[r]=r,n===!0&&Om(t,e)}functionOm(t,e){constn=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){consti=dn(r.charCodeAt(0));e[i]=i}else{consti=n.toLowerCase();if(i!==n){consts=dn(i.charCodeAt(0));e[s]=s}}}functionWl(t,e){returnjr(t.value,n=>{if(typeofn=="number")returnet(e,n);{constr=n;returnjr(e,i=>r.from<=i&&i<=r.to)!==void0}})}functionIo(t){conste=t.quantifier;returne&&e.atLeast===0?!0:t.value?je(t.value)?kt(t.value,Io):Io(t.value):!1}classxmextendsOa{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){et(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Wl(e,this.targetCharCodes)===void0&&(this.found=!0):Wl(e,this.targetCharCodes)!==void0&&(this.found=!0)}}functiondl(t,e){if(einstanceofRegExp){constn=Ma(e),r=newxm(t);returnr.visit(n),r.found}elsereturnjr(e,n=>et(t,n.charCodeAt(0)))!==void0}constVn="PATTERN",Mi="defaultMode",xs="modes";functionDm(t,e){e=rl(e,{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
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{constH=Lm(k.PATTERN,e.ensureOptimizations);ae(H)&&(I=!1),q(H,K=>{Qa(w,K,b[P])})}elsee.ensureOptimizations&&bo(`${ha} TokenType: <${k.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`),I=!1;returnw},[])}),{emptyGroups:A,patternIdxToConfig:b,charCodeToPatternIdxToConfig:C,hasCustom:i,canBeOptimized:I}}functionMm(t,e){letn=[];constr=Gm(t);n=n.concat(r.errors);consti=Um(r.valid),s=i.valid;returnn=n.concat(i.errors),n=n.concat(Fm(s)),n=n.concat(Hm(s)),n=n.concat(Ym(s,e)),n=n.concat(Xm(s)),n}functionFm(t){lete=[];constn=ht(t,r=>nn(r[Vn]));returne=e.concat(jm(n)),e=e.concat(Wm(n)),e=e.concat(Vm(n)),e=e.concat(Km(n)),e=e.concat(zm(n)),e}functionGm(t){conste=ht(t,i=>!z(i,Vn)),n=M(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Se.MISSING_PATTERN,tokenTypes:[i]})),r=_a(t,e);return{errors:n,valid:r}}functionUm(t){conste=ht(t,i=>{consts=i[Vn];return!nn(s)&&!Yn(s)&&!z(s,"exec")&&!nt(s)}),n=M(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:Se.INVALID_PATTERN,tokenTypes:[i]})),r=_a(t,e);return{errors:n,valid:r}}constqm=/[^\\][$]/;functionjm(t){classeextendsOa{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}constn=ht(t,i=>{consts=i.PATTERN;try{consta=Ma(s),o=newe;returno.visit(a),o.found}catch{returnqm.test(s.source)}});returnM(n,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:Se.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}functionzm(t){conste=ht(t,r=>r.PATTERN.test(""));returnM(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:Se.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}constBm=/[^\\[][\^]|^\^/;functionWm(t){classeextendsOa{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}constn=ht(t,i=>{consts=i.PATTERN;try{consta=Ma(s),o=newe;returno.visit(a),o.found}catch{returnBm.test(s.source)}});returnM(n,i=>({message:`Unexpected RegExp Anchor Error:
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Se.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}functionVm(t){conste=ht(t,r=>{consti=r[Vn];returniinstanceofRegExp&&(i.multiline||i.global)});returnM(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Se.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}functionKm(t){conste=[];letn=M(t,s=>Je(t,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!et(e,o)&&o.PATTERN!==tt.NA&&(e.push(o),a.push(o)),a),[]));n=ns(n);constr=ht(n,s=>s.length>1);returnM(r,s=>{consta=M(s,c=>c.name);return{message:`The same RegExp pattern ->${wt(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:Se.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}functionHm(t){conste=ht(t,r=>{if(!z(r,"GROUP"))return!1;consti=r.GROUP;returni!==tt.SKIPPED&&i!==tt.NA&&!nt(i)});returnM(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Se.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}functionYm(t,e){constn=ht(t,i=>i.PUSH_MODE!==void0&&!et(e,i.PUSH_MODE));returnM(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Se.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}functionXm(t){conste=[],n=Je(t,(r,i,s)=>{consta=i.PATTERN;returna===tt.NA||(nt(a)?r.push({str:a,idx:s,tokenType:i}):nn(a)&&Qm(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);returnq(t,(r,i)=>{q(n,({str:s,idx:a,tokenType:o})=>{if(i<a&&Jm(s,r.PATTERN)){constc=`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:c,type:Se.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}functionJm(t,e){if(nn(e)){if(Zm(e))return!1;constn=e.exec(t);returnn!==null&&n.index===0}else{if(Yn(e))returne(t,0,[],{});if(z(e,"exec"))returne.exec(t,0,[],{});if(typeofe=="string")returne===t;throwError("non exhaustive match")}}functionQm(t){returnjr([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void0}functionZm(t){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source)}functionVl(t){conste=t.ignoreCase?"iy":"y";returnnewRegExp(`${t.source}`,e)}functioneg(t,e,n){constr=[];returnz(t,Mi)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Mi+`> property in its definition
`,type:Se.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),z(t,xs)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+xs+`> property in its definition
`,type:Se.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),z(t,xs)&&z(t,Mi)&&!z(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Mi}: <${t.defaultMode}>which does not exist
`,type:Se.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),z(t,xs)&&q(t.modes,(i,s)=>{q(i,(a,o)=>{if(tn(a))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
`,type:Se.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});elseif(z(a,"LONGER_ALT")){constc=je(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];q(c,l=>{!tn(l)&&!et(i,l)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${l.name}> on token <${a.name}> outside of mode <${s}>
`,type:Se.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}functiontg(t,e,n){constr=[];leti=!1;consts=ns(yt($e(t.modes))),a=Ia(s,c=>c[Vn]===tt.NA),o=uf(n);returne&&q(a,c=>{constl=lf(c,o);if(l!==!1){constf={message:sg(c,l),type:l.issue,tokenType:c};r.push(f)}elsez(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):dl(o,c.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:Se.NO_LINE_BREAKS_FLAGS}),r}functionng(t){conste={},n=qr(t);returnq(n,r=>{consti=t[r];if(je(i))e[r]=[];elsethrowError("non exhaustive match")}),e}functioncf(t){conste=t.PATTERN;if(nn(e))return!1;if(Yn(e))return!0;if(z(e,"exec"))return!0;if(nt(e))return!1;throwError("non exhaustive match")}functionrg(t){returnnt(t)&&t.length===1?t.charCodeAt(0):!1}constig={test:function(t){conste=t.length;for(letn=this.lastIndex;n<e;n++){constr=t.charCodeAt(n);if(r===10)returnthis.lastIndex=n+1,!0;if(r===13)returnt.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};functionlf(t,e){if(z(t,"LINE_BREAKS"))return!1;if(nn(t.PATTERN)){try{dl(e,t.PATTERN)}catch(n){return{issue:Se.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(nt(t.PATTERN))return!1;if(cf(t))return{issue:Se.CUSTOM_LINE_BREAK};throwError("non exhaustive match")}}functionsg(t,e){if(e.issue===Se.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
The problem is in the <${t.name}> Token Type
Root cause: ${e.errMsg}.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===Se.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
The problem is in the <${t.name}> Token Type
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throwError("non exhaustive match")}functionuf(t){returnM(t,n=>nt(n)?n.charCodeAt(0):n)}functionQa(t,e,n){t[e]===void0?t[e]=[n]:t[e].push(n)}constFi=256;letea=[];functiondn(t){returnt<Fi?t:ea[t]}functionag(){if(ae(ea)){ea=newArray(65536);for(lett=0;t<65536;t++)ea[t]=t>255?255+~~(t/255):t}}functionos(t,e){constn=t.tokenTypeIdx;returnn===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}functionpa(t,e){returnt.tokenTypeIdx===e.tokenTypeIdx}letKl=1;constdf={};functioncs(t){conste=og(t);cg(e),ug(e),lg(e),q(e,n=>{n.isParent=n.categoryMatches.length>0})}functionog(t){lete=Be(t),n=t,r=!0;for(;r;){n=ns(yt(M(n,s=>s.CATEGORIES)));consti=_a(n,e);e=e.concat(i),ae(i)?r=!1:n=i}returne}functioncg(t){q(t,e=>{hf(e)||(df[Kl]=e,e.tokenTypeIdx=Kl++),Hl(e)&&!je(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Hl(e)||(e.CATEGORIES=[]),dg(e)||(e.categoryMatches=[]),fg(e)||(e.categoryMatchesMap={})})}functionlg(t){q(t,e=>{e.categoryMatches=[],q(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(df[r].tokenTypeIdx)})})}functionug(t){q(t,e=>{ff([],e)})}functionff(t,e){q(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),q(e.CATEGORIES,n=>{constr=t.concat(e);et(r,n)||ff(r,n)})}functionhf(t){returnz(t,"tokenTypeIdx")}functionHl(t){returnz(t,"CATEGORIES")}functiondg(t){returnz(t,"categoryMatches")}functionfg(t){returnz(t,"categoryMatchesMap")}functionhg(t){returnz(t,"tokenTypeIdx")}constPo={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i,s){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};varSe;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(Se||(Se={}));constGi={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Po,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Gi);classtt{constructor(e,n=Gi){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++;consta=newArray(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${i}>`);const{time:o,value:c}=rf(s),l=o>10?console.warn:console.log;returnthis.traceInitIndent<this.traceInitMaxIdent&&l(`${a}<-- <${i}> time: ${o}ms`),this.traceInitIndent--,c}elsereturns()},typeofn=="boolean")throwError(`The second argument to the Lexer constructor is now an ILexerConfig Object.
a boolean 2nd argument is no longer supported`);this.config=ft({},Gi,n);constr=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeofr=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{leti,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Gi.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ig;elseif(this.config.lineTerminatorCharacters===Gi.lineTerminatorCharacters)throwError(`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(n.safeMode&&n.ensureOptimizations)throwError('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),je(e)?i={modes:{defaultMode:Be(e)},defaultMode:Mi}:(s=!1,i=Be(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(eg(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(tg(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},q(i.modes,(o,c)=>{i.modes[c]=Ia(o,l=>tn(l))});consta=qr(i.modes);if(q(i.modes,(o,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Mm(o,a))}),ae(this.lexerDefinitionErrors)){cs(o);letl;this.TRACE_INIT("analyzeTokenTypes",()=>{l=Dm(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=l.charCodeToPatternIdxToConfig,this.emptyGroups=ft({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=l.canBeOptimized}})}),this.defaultMode=i.defaultMode,!ae(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){constc=M(this.lexerDefinitionErrors,l=>l.message).join(`-----------------------
`);thrownewError(`Errors detected in definition of Lexer:
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",()=>{$m()}),this.TRACE_INIT("toFastProperties",()=>{sf(this)})})}tokenize(e,n=this.defaultMode){if(!ae(this.lexerDefinitionErrors)){consti=M(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
`);thrownewError(`Unable to Tokenize because Errors detected in definition of Lexer:
`+i)}returnthis.tokenizeInternal(e,n)}tokenizeInternal(e,n){letr,i,s,a,o,c,l,u,f,m,p,A,b,I,C;constw=e,k=w.length;letP=0,H=0;constK=this.hasCustom?0:Math.floor(e.length/10),J=newArray(K),oe=[];letue=this.trackStartLines?1:void0,de=this.trackStartLines?1:void0;const_=ng(this.emptyGroups),T=this.trackStartLines,g=this.config.lineTerminatorsPattern;letS=0,y=[],R=[];constE=[],O=[];Object.freeze(O);letD=!1;constx=B=>{if(E.length===1&&B.tokenType.PUSH_MODE===void0){constne=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(B);oe.push({offset:B.startOffset,line:B.startLine,column:B.startColumn,length:B.image.length,message:ne})}else{E.pop();constne=jn(E);y=this.patternIdxToConfig[ne],R=this.charCodeToPatternIdxToConfig[ne],S=y.length;constOe=this.canModeBeOptimized[ne]&&this.config.safeMode===!1;R&&Oe?D=!0:D=!1}};functionj(B){E.push(B),R=this.charCodeToPatternIdxToConfig[B],y=this.patternIdxToConfig[B],S=y.length,S=y.length;constne=this.canModeBeOptimized[B]&&this.config.safeMode===!1;R&&ne?D=!0:D=!1}j.call(this,n);letG;constie=this.config.recoveryEnabled;for(;P<k;){c=null,f=-1;constB=w.charCodeAt(P);letne;if(D){constRe=dn(B),fe=R[Re];ne=fe!==void0?fe:O}elsene=y;constOe=ne.length;for(r=0;r<Oe;r++){G=ne[r];constRe=G.pattern;l=null;constfe=G.short;if(fe!==!1?B===fe&&(f=1,c=Re):G.isCustom===!0?(C=Re.exec(w,P,J,_),C!==null?(c=C[0],f=c.length,C.payload!==void0&&(l=C.payload)):c=null):(Re.lastIndex=P,f=this.matchLength(Re,e,P)),f!==-1){if(o=G.longerAlt,o!==void0){c=e.substring(P,P+f);constIe=o.length;for(s=0;s<Ie;s++){constxe=y[o[s]],be=xe.pattern;if(u=null,xe.isCustom===!0?(C=be.exec(w,P,J,_),C!==null?(a=C[0],C.payload!==void0&&(u=C.payload)):a=null):(be.lastIndex=P,a=this.match(be,e,P)),a&&a.length>c.length){c=a,f=a.length,l=u,G=xe;break}}}break}}if(f!==-1){if(m=G.group,m!==void0&&(c=c!==null?c:e.substring(P,P+f),p=G.tokenTypeIdx,A=this.createTokenInstance(c,P,p,G.tokenType,ue,de,f),this.handlePayload(A,l),m===!1?H=this.addToken(J,H,A):_[m].push(A)),T===!0&&G.canLineTerminator===!0){letRe=0,fe,Ie;g.lastIndex=0;doc=c!==null?c:e.substring(P,P+f),fe=g.test(c),fe===!0&&(Ie=g.lastIndex-1,Re++);while(fe===!0);Re!==0?(ue=ue+Re,de=f-Ie,this.updateTokenEndLineColumnLocation(A,m,Ie,Re,ue,de,f)):de=this.computeNewColumn(de,f)}elsede=this.computeNewColumn(de,f);P=P+f,this.handleModes(G,x,j,A)}else{constRe=P,fe=ue,Ie=de;letxe=ie===!1;for(;xe===!1&&P<k;)for(P++,i=0;i<S;i++){constbe=y[i],Z=be.pattern,at=be.short;if(at!==!1?w.charCodeAt(P)===at&&(xe=!0):be.isCustom===!0?xe=Z.exec(w,P,J,_)!==null:(Z.lastIndex=P,xe=Z.exec(e)!==null),xe===!0)break}if(b=P-Re,de=this.computeNewColumn(de,b),I=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(w,Re,b,fe,Ie,jn(E)),oe.push({offset:Re,line:fe,column:Ie,length:b,message:I}),ie===!1)break}}returnthis.hasCustom||(J.length=H),{tokens:J,groups:_,errors:oe}}handleModes(e,n,r,i){if(e.pop===!0){consts=e.push;n(i),s!==void0&&r.call(this,s)}elsee.push!==void0&&r.call(this,e.push)}updateTokenEndLineColumnLocation(e,n,r,i,s,a,o){letc,l;n!==void0&&(c=r===o-1,l=c?-1:0,i===1&&c===!0||(e.endLine=s+l,e.endColumn=a-1+-l))}computeNewColumn(e,n){returne+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,s,a){return{image:e,startOffset:n,startLine:s,startColumn:a,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:n+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){returne.push(r),n}addTokenUsingMemberAccess(e,n,r){returne[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}match(e,n,r){returne.test(n)===!0?n.substring(r,e.lastIndex):null}matchLength(e,n,r){returne.test(n)===!0?e.lastIndex-r:-1}}tt.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";tt.NA=/NOT_APPLICABLE/;functionSr(t){return
See:https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return z(t,Yl)&&(n.CATEGORIES=t[Yl]),cs([n]),z(t,Xl)&&(n.LABEL=t[Xl]),z(t,Jl)&&(n.GROUP=t[Jl]),z(t,Zl)&&(n.POP_MODE=t[Zl]),z(t,Ql)&&(n.PUSH_MODE=t[Ql]),z(t,eu)&&(n.LONGER_ALT=t[eu]),z(t,tu)&&(n.LINE_BREAKS=t[tu]),z(t,nu)&&(n.START_CHARS_HINT=t[nu]),n}const fn=mf({name:"EOF",pattern:tt.NA});cs([fn]);function fl(t,e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function gf(t,e){return os(t,e)}const Er={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${pf(t)?`--> ${Sr(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",o=`
butfound:'`+wt(e).image+"'";if(r)return s+r+o;{const c=Je(t,(m,p)=>m.concat(p),[]),l=M(c,m=>`[${M(m,p=>Sr(p)).join(",")}]`),f=`one of these possible Token sequences:
but found: '`+wt(e).image+"'";if(n)return i+n+a;{const c=`expecting at least one iteration which starts with one of these possible Token sequences::
<${M(t,l=>`[${M(l,u=>Sr(u)).join(",")}]`).join(" ,")}>`;return i+c+a}}};Object.freeze(Er);const gg={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+t.name+"<-"}},Un={buildDuplicateFoundError(t,e){function n(u){return u instanceof le?u.terminalType.name:u instanceof Qe?u.nonTerminalName:""}const r=t.name,i=wt(e),s=i.idx,a=$t(i),o=n(i),c=s>0;let l=`->${a}${c?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
`),l},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.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(t){const e=M(t.prefixPath,i=>Sr(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in <OR${n}> inside <${t.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
For Further details.`},buildAlternationAmbiguityError(t){const e=t.alternation.idx===0?"":t.alternation.idx,n=t.prefixPath.length===0;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${e}> inside <${t.topLevelRule.name}> Rule,
`;if(n)r+=`These alternatives are all empty (match no tokens), making them indistinguishable.
Only the last alternative may be empty.
`;else{const i=M(t.prefixPath,s=>Sr(s)).join(", ");r+=`<${i}> may appears as a prefix path in all these alternatives.
For Further details.`,r},buildEmptyRepetitionError(t){let e=$t(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=M(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.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.
For Further details.`);if(je(e)){if(ae(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.
For Further details.`)}if(je(e))this.tokensMap=Je(e,(s,a)=>(s[a.name]=a,s),{});else if(z(e,"modes")&&kt(yt($e(e.modes)),hg)){const s=yt($e(e.modes)),a=il(s);this.tokensMap=Je(a,(o,c)=>(o[c.name]=c,o),{})}else if(jh(e))this.tokensMap=Be(e);else throw new Error("<tokensDictionary>argumentmustbeAnArrayofTokenconstructors,AdictionaryofTokenconstructorsoranIMultiModeLexerDefinition");this.tokensMap.EOF=fn;const r=z(e,"modes")?yt($e(e.modes)):$e(e),i=kt(r,s=>ae(s.categoryMatches));this.tokenMatcher=i?pa:os,cs($e(this.tokensMap))}defineRule(e,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Of);const Ty={name:`This CSTNode indicates the Parser is in Recording Phase
Idx value must be a none negative value smaller than ${uu+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class Ey{initPerformanceTracer(e){if(z(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=rn.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){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}=rf(n),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function Ay(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const ya=fl(fn,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(ya);const rn=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Er,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ta=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Ze;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(Ze||(Ze={}));function fu(t=void 0){return function(){return t}}class ls{static performSelfAnalysis(e){throw Error("The**static**`performSelfAnalysis`methodhasbeendeprecated.\nUsethe**instance**methodwiththesamenameinstead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{sf(this)}),this.TRACE_INIT("GrammarRecording",()=>{try{this.enableRecording(),q(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("GrammarResolving",()=>{r=Vg({rules:$e(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("GrammarValidations",()=>{if(ae(r)&&this.skipValidations===!1){const i=Kg({rules:$e(this.gastProductionsCache),tokenTypes:$e(this.tokensMap),errMsgProvider:Un,grammarName:n}),s=Pg({lookaheadStrategy:this.lookaheadStrategy,rules:$e(this.gastProductionsCache),tokenTypes:$e(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),ae(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=_m($e(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:$e(this.gastProductionsCache)}),this.preComputeLookaheadFunctions($e(this.gastProductionsCache))})),!ls.DEFER_DEFINITION_ERRORS_HANDLING&&!ae(this.definitionErrors))throw e=M(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
${e.join(`
-------------------------------
`)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),z(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
`;class r{constructor(s="utf-8"){this._encoding=s,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(s){const a=typeof s=="string"?this.fromString(s,this._encoding):s;this._chunks.push(a),this._totalLength+=a.byteLength}tryReadHeaders(s=!1){if(this._chunks.length===0)return;let a=0,o=0,c=0,l=0;e:for(;o<this._chunks.length;){const p=this._chunks[o];for(c=0;c<p.length;){switch(p[c]){case t:switch(a){case 0:a=1;break;case 2:a=3;break;default:a=0}break;case e:switch(a){case 1:a=2;break;case 3:a=4,c++;break e;default:a=0}break;default:a=0}c++}l+=p.byteLength,o++}if(a!==4)return;const u=this._read(l+c),f=new Map,m=this.toString(u,"ascii").split(n);if(m.length<2)return f;for(let p=0;p<m.length-2;p++){const A=m[p],b=A.indexOf(":");if(b===-1)throw new Error(`Message header must separate key and value using ':'
${JSON.stringify(h.error,void 0,4)}`):E.error("Receivedresponsemessagewithoutid.Nofurthererrorinformationprovided.");else{const N=h.id,L=Ie.get(N);if(Ns(h,L),L!==void 0){Ie.delete(N);try{if(h.error){const F=h.error;L.reject(new r.ResponseError(F.code,F.message,F.data))}else if(h.result!==void 0)L.resolve(h.result);else throw new Error("Shouldneverhappen.")}catch(F){F.message?E.error(`Response handler '${L.method}' failed with message: ${F.message}`):E.error(`Response handler '${L.method}' failed unexpectedly.`)}}}}function As(h){if(Dt())return;let N,L;if(h.method===o.type.method){const F=h.params.id;xe.delete(F),tr(h);return}else{const F=ne.get(h.method);F&&(L=F.handler,N=F.type)}if(L||B)try{if(tr(h),L)if(h.params===void 0)N!==void 0&&N.numberOfParams!==0&&N.parameterStructures!==r.ParameterStructures.byName&&E.error(`Notification ${h.method} defines ${N.numberOfParams} params but received none.`),L();else if(Array.isArray(h.params)){const F=h.params;h.method===l.type.method&&F.length===2&&c.is(F[0])?L({token:F[0],value:F[1]}):(N!==void 0&&(N.parameterStructures===r.ParameterStructures.byName&&E.error(`Notification ${h.method} defines parameters by name but received parameters by position`),N.numberOfParams!==h.params.length&&E.error(`Notification ${h.method} defines ${N.numberOfParams} params but received ${F.length} arguments`)),L(...F))}else N!==void 0&&N.parameterStructures===r.ParameterStructures.byPosition&&E.error(`Notification ${h.method} defines parameters by position but received parameters by name`),L(h.params);else B&&B(h.method,h.params)}catch(F){F.message?E.error(`Notification handler '${h.method}' failed with message: ${F.message}`):E.error(`Notification handler '${h.method}' failed unexpectedly.`)}else ni.fire(h)}function Ss(h){if(!h){E.error("Receivedemptymessage.");return}E.error(`Received message which is neither a response nor a notification message:
`);super(`Parsingfailed:${n}${r}`),this.result=e}},$(Ur,"MermaidParseError"),Ur);const gE=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:vh,createInfoServices:Eh},Symbol.toStringTag,{value:"Module"})),yE=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:Ah,createPacketServices:Sh},Symbol.toStringTag,{value:"Module"})),TE=Object.freeze(Object.defineProperty({__proto__:null,PieModule:kh,createPieServices:Ch},Symbol.toStringTag,{value:"Module"})),RE=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:wh,createArchitectureServices:Nh},Symbol.toStringTag,{value:"Module"})),vE=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:Th,createGitGraphServices:Rh},Symbol.toStringTag,{value:"Module"})),EE=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:bh,createRadarServices:_h},Symbol.toStringTag,{value:"Module"})),AE=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:Ph,createTreemapServices:$h},Symbol.toStringTag,{value:"Module"}));export{pE as p};