package.dist.chunks.mermaid.esm.min.chunk-XVEYI5JQ.mjs Maven / Gradle / Ivy
Show all versions of mermaid Show documentation
import{A as se,B as Js,C as et,D as Pe,G as ac,I as Ve,L as oe,M as Ht,O as ki,R as on,S as oc,a as ue,b as gt,c as Ie,d as fe,e as te,g as yt,i as an,j as Kt,k as Tt,l as de,m as $t,n as I,o as $e,p as Ee,q as xt,r as Ne,s as E,t as Se,w as sc,x as N,y as Ce,z as re}from"./chunk-5ZJXQJOJ.mjs";import{d as M}from"./chunk-YPUTD6PB.mjs";import{M as Ys,d as ic,e as st,z as me}from"./chunk-6BY5RJGC.mjs";import{a,b as vi,c as Vt,d as G,e as nc}from"./chunk-GTKDMUJJ.mjs";var wl=vi(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});var Sl;function Cl(){if(Sl===void 0)throw new Error("No runtime abstraction layer installed");return Sl}a(Cl,"RAL");(function(r){function e(t){if(t===void 0)throw new Error("No runtime abstraction layer provided");Sl=t}a(e,"install"),r.install=e})(Cl||(Cl={}));_l.default=Cl});var od=vi(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.stringArray=we.array=we.func=we.error=we.number=we.string=we.boolean=void 0;function Tm(r){return r===!0||r===!1}a(Tm,"boolean");we.boolean=Tm;function sd(r){return typeof r=="string"||r instanceof String}a(sd,"string");we.string=sd;function xm(r){return typeof r=="number"||r instanceof Number}a(xm,"number");we.number=xm;function Rm(r){return r instanceof Error}a(Rm,"error");we.error=Rm;function Em(r){return typeof r=="function"}a(Em,"func");we.func=Em;function ad(r){return Array.isArray(r)}a(ad,"array");we.array=ad;function Am(r){return ad(r)&&r.every(e=>sd(e))}a(Am,"stringArray");we.stringArray=Am});var Ol=vi(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.Emitter=Jr.Event=void 0;var vm=wl(),ld;(function(r){let e={dispose(){}};r.None=function(){return e}})(ld||(Jr.Event=ld={}));var Ll=class{static{a(this,"CallbackList")}add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:a(()=>this.remove(e,t),"dispose")})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let i=0,s=this._callbacks.length;i{this._callbacks||(this._callbacks=new Ll),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);let i={dispose:a(()=>{this._callbacks&&(this._callbacks.remove(e,t),i.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))},"dispose")};return Array.isArray(n)&&n.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Jr.Emitter=Ds;Ds._noop=function(){}});var cd=vi(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.CancellationTokenSource=Qr.CancellationToken=void 0;var km=wl(),Im=od(),$l=Ol(),Fs;(function(r){r.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$l.Event.None}),r.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$l.Event.None});function e(t){let n=t;return n&&(n===r.None||n===r.Cancelled||Im.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}a(e,"is"),r.is=e})(Fs||(Qr.CancellationToken=Fs={}));var Nm=Object.freeze(function(r,e){let t=(0,km.default)().timer.setTimeout(r.bind(e),0);return{dispose(){t.dispose()}}}),Us=class{static{a(this,"MutableToken")}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?Nm:(this._emitter||(this._emitter=new $l.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Pl=class{static{a(this,"CancellationTokenSource")}get token(){return this._token||(this._token=new Us),this._token}cancel(){this._token?this._token.cancel():this._token=Fs.Cancelled}dispose(){this._token?this._token instanceof Us&&this._token.dispose():this._token=Fs.None}};Qr.CancellationTokenSource=Pl});var pe={};Vt(pe,{AbstractAstReflection:()=>zt,AbstractCstNode:()=>Kn,AbstractLangiumParser:()=>Hn,AbstractParserErrorMessageProvider:()=>Ps,AbstractThreadedAsyncParser:()=>Hl,AstUtils:()=>Fi,BiMap:()=>yr,Cancellation:()=>w,CompositeCstNodeImpl:()=>hr,ContextCache:()=>Tr,CstNodeBuilder:()=>Vn,CstUtils:()=>Si,DONE_RESULT:()=>be,DatatypeSymbol:()=>$s,DefaultAstNodeDescriptionProvider:()=>li,DefaultAstNodeLocator:()=>ui,DefaultAsyncParser:()=>Ri,DefaultCommentProvider:()=>xi,DefaultConfigurationProvider:()=>fi,DefaultDocumentBuilder:()=>di,DefaultDocumentValidator:()=>oi,DefaultHydrator:()=>Ai,DefaultIndexManager:()=>hi,DefaultJsonSerializer:()=>ii,DefaultLangiumDocumentFactory:()=>Xn,DefaultLangiumDocuments:()=>Yn,DefaultLexer:()=>mi,DefaultLinker:()=>Jn,DefaultNameProvider:()=>Qn,DefaultReferenceDescriptionProvider:()=>ci,DefaultReferences:()=>Zn,DefaultScopeComputation:()=>ei,DefaultScopeProvider:()=>ni,DefaultServiceRegistry:()=>si,DefaultTokenBuilder:()=>mr,DefaultValueConverter:()=>gr,DefaultWorkspaceLock:()=>Ei,DefaultWorkspaceManager:()=>pi,Deferred:()=>Ue,Disposable:()=>xr,DisposableCache:()=>rn,DocumentCache:()=>Bs,DocumentState:()=>Y,DocumentValidator:()=>wt,EMPTY_SCOPE:()=>Cm,EMPTY_STREAM:()=>cn,EmptyFileSystem:()=>Ql,EmptyFileSystemProvider:()=>qs,ErrorWithLocation:()=>Jt,GrammarAST:()=>pn,GrammarUtils:()=>Vi,JSDocDocumentationProvider:()=>Ti,LangiumCompletionParser:()=>qn,LangiumParser:()=>zn,LangiumParserErrorMessageProvider:()=>Yr,LeafCstNodeImpl:()=>dr,MapScope:()=>ti,Module:()=>Yl,MultiMap:()=>dt,OperationCancelled:()=>ft,ParserWorker:()=>zl,Reduction:()=>Ar,RegExpUtils:()=>Wi,RootCstNodeImpl:()=>Xr,SimpleCache:()=>ri,StreamImpl:()=>He,StreamScope:()=>tn,TextDocument:()=>Zr,TreeStreamImpl:()=>at,URI:()=>We,UriUtils:()=>Ge,ValidationCategory:()=>sn,ValidationRegistry:()=>ai,ValueConverter:()=>ut,WorkspaceCache:()=>nn,assertUnreachable:()=>bt,createCompletionParser:()=>Il,createDefaultCoreModule:()=>ql,createDefaultSharedCoreModule:()=>Xl,createGrammarConfig:()=>So,createLangiumParser:()=>Nl,delayNextTick:()=>Ml,diagnosticData:()=>Ws,eagerLoad:()=>_d,getDiagnosticRange:()=>xd,inject:()=>zs,interruptAndCheck:()=>Te,isAstNode:()=>ae,isAstNodeDescription:()=>Qs,isAstNodeWithComment:()=>Fl,isCompositeCstNode:()=>Ke,isIMultiModeLexerDefinition:()=>Gl,isJSDoc:()=>Vl,isLeafCstNode:()=>Pt,isLinkingError:()=>qt,isNamed:()=>yd,isOperationCancelled:()=>Gt,isReference:()=>Ae,isRootCstNode:()=>ln,isTokenTypeArray:()=>Rd,isTokenTypeDictionary:()=>Ul,loadGrammarFromJson:()=>Bt,parseJSDoc:()=>jl,prepareLangiumParser:()=>id,setInterruptionPeriod:()=>dd,startCancelableOperation:()=>fd,stream:()=>K,toDiagnosticSeverity:()=>js});var Si={};Vt(Si,{DefaultNameRegexp:()=>Ni,RangeComparison:()=>Rt,compareRange:()=>cc,findCommentNode:()=>ra,findDeclarationNodeAtOffset:()=>Vd,findLeafNodeAtOffset:()=>na,findLeafNodeBeforeOffset:()=>uc,flattenCst:()=>jd,getInteriorNodes:()=>zd,getNextNode:()=>Kd,getPreviousNode:()=>dc,getStartlineNode:()=>Hd,inRange:()=>ta,isChildNode:()=>ea,isCommentNode:()=>Zs,streamCst:()=>Xt,toDocumentSegment:()=>Yt,tokenToRange:()=>vr});function ae(r){return typeof r=="object"&&r!==null&&typeof r.$type=="string"}a(ae,"isAstNode");function Ae(r){return typeof r=="object"&&r!==null&&typeof r.$refText=="string"}a(Ae,"isReference");function Qs(r){return typeof r=="object"&&r!==null&&typeof r.name=="string"&&typeof r.type=="string"&&typeof r.path=="string"}a(Qs,"isAstNodeDescription");function qt(r){return typeof r=="object"&&r!==null&&ae(r.container)&&Ae(r.reference)&&typeof r.message=="string"}a(qt,"isLinkingError");var zt=class{static{a(this,"AbstractAstReflection")}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 n=this.subtypes[e];n||(n=this.subtypes[e]={});let i=n[t];if(i!==void 0)return i;{let s=this.computeIsSubtype(e,t);return n[t]=s,s}}getAllSubTypes(e){let t=this.allSubtypes[e];if(t)return t;{let n=this.getAllTypes(),i=[];for(let s of n)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}};function Ke(r){return typeof r=="object"&&r!==null&&Array.isArray(r.content)}a(Ke,"isCompositeCstNode");function Pt(r){return typeof r=="object"&&r!==null&&typeof r.tokenType=="object"}a(Pt,"isLeafCstNode");function ln(r){return Ke(r)&&typeof r.fullText=="string"}a(ln,"isRootCstNode");var He=class r{static{a(this,"StreamImpl")}constructor(e,t){this.startFn=e,this.nextFn=t}iterator(){let e={state:this.startFn(),next:a(()=>this.nextFn(e.state),"next"),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let e=this.iterator(),t=0,n=e.next();for(;!n.done;)t++,n=e.next();return t}toArray(){let e=[],t=this.iterator(),n;do n=t.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,t){let n=this.map(i=>[e?e(i):i,t?t(i):i]);return new Map(n)}toString(){return this.join()}concat(e){let t=e[Symbol.iterator]();return new r(()=>({first:this.startFn(),firstDone:!1}),n=>{let i;if(!n.firstDone){do if(i=this.nextFn(n.first),!i.done)return i;while(!i.done);n.firstDone=!0}do if(i=t.next(),!i.done)return i;while(!i.done);return be})}join(e=","){let t=this.iterator(),n="",i,s=!1;do i=t.next(),i.done||(s&&(n+=e),n+=Wd(i.value)),s=!0;while(!i.done);return n}indexOf(e,t=0){let n=this.iterator(),i=0,s=n.next();for(;!s.done;){if(i>=t&&s.value===e)return i;s=n.next(),i++}return-1}every(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(!e(n.value))return!1;n=t.next()}return!0}some(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return!0;n=t.next()}return!1}forEach(e){let t=this.iterator(),n=0,i=t.next();for(;!i.done;)e(i.value,n),i=t.next(),n++}map(e){return new r(this.startFn,t=>{let{done:n,value:i}=this.nextFn(t);return n?be:{done:!1,value:e(i)}})}filter(e){return new r(this.startFn,t=>{let n;do if(n=this.nextFn(t),!n.done&&e(n.value))return n;while(!n.done);return be})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,t){let n=this.iterator(),i=t,s=n.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=n.next();return i}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,n){let i=e.next();if(i.done)return n;let s=this.recursiveReduce(e,t,n);return s===void 0?i.value:t(s,i.value)}find(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return n.value;n=t.next()}}findIndex(e){let t=this.iterator(),n=0,i=t.next();for(;!i.done;){if(e(i.value))return n;i=t.next(),n++}return-1}includes(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(n.value===e)return!0;n=t.next()}return!1}flatMap(e){return new r(()=>({this:this.startFn()}),t=>{do{if(t.iterator){let s=t.iterator.next();if(s.done)t.iterator=void 0;else return s}let{done:n,value:i}=this.nextFn(t.this);if(!n){let s=e(i);if(Ii(s))t.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(t.iterator);return be})}flat(e){if(e===void 0&&(e=1),e<=0)return this;let t=e>1?this.flat(e-1):this;return new r(()=>({this:t.startFn()}),n=>{do{if(n.iterator){let o=n.iterator.next();if(o.done)n.iterator=void 0;else return o}let{done:i,value:s}=t.nextFn(n.this);if(!i)if(Ii(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(n.iterator);return be})}head(){let t=this.iterator().next();if(!t.done)return t.value}tail(e=1){return new r(()=>{let t=this.startFn();for(let n=0;n({size:0,state:this.startFn()}),t=>(t.size++,t.size>e?be:this.nextFn(t.state)))}distinct(e){let t=new Set;return this.filter(n=>{let i=e?e(n):n;return t.has(i)?!1:(t.add(i),!0)})}exclude(e,t){let n=new Set;for(let i of e){let s=t?t(i):i;n.add(s)}return this.filter(i=>{let s=t?t(i):i;return!n.has(s)})}};function Wd(r){return typeof r=="string"?r:typeof r>"u"?"undefined":typeof r.toString=="function"?r.toString():Object.prototype.toString.call(r)}a(Wd,"toString");function Ii(r){return!!r&&typeof r[Symbol.iterator]=="function"}a(Ii,"isIterable");var cn=new He(()=>{},()=>be),be=Object.freeze({done:!0,value:void 0});function K(...r){if(r.length===1){let e=r[0];if(e instanceof He)return e;if(Ii(e))return new He(()=>e[Symbol.iterator](),t=>t.next());if(typeof e.length=="number")return new He(()=>({index:0}),t=>t.index1?new He(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){let t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}if(e.array){if(e.arrIndex({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let o=i.iterators[i.iterators.length-1].next();if(o.done)i.iterators.pop();else return i.iterators.push(t(o.value)[Symbol.iterator]()),o}return be})}iterator(){let e={state:this.startFn(),next:a(()=>this.nextFn(e.state),"next"),prune:a(()=>{e.state.pruned=!0},"prune"),[Symbol.iterator]:()=>e};return e}},Ar;(function(r){function e(s){return s.reduce((o,l)=>o+l,0)}a(e,"sum"),r.sum=e;function t(s){return s.reduce((o,l)=>o*l,0)}a(t,"product"),r.product=t;function n(s){return s.reduce((o,l)=>Math.min(o,l))}a(n,"min"),r.min=n;function i(s){return s.reduce((o,l)=>Math.max(o,l))}a(i,"max"),r.max=i})(Ar||(Ar={}));function Xt(r){return new at(r,e=>Ke(e)?e.content:[],{includeRoot:!0})}a(Xt,"streamCst");function jd(r){return Xt(r).filter(Pt)}a(jd,"flattenCst");function ea(r,e){for(;r.container;)if(r=r.container,r===e)return!0;return!1}a(ea,"isChildNode");function vr(r){return{start:{character:r.startColumn-1,line:r.startLine-1},end:{character:r.endColumn,line:r.endLine-1}}}a(vr,"tokenToRange");function Yt(r){if(!r)return;let{offset:e,end:t,range:n}=r;return{range:n,offset:e,end:t,length:t-e}}a(Yt,"toDocumentSegment");var Rt;(function(r){r[r.Before=0]="Before",r[r.After=1]="After",r[r.OverlapFront=2]="OverlapFront",r[r.OverlapBack=3]="OverlapBack",r[r.Inside=4]="Inside"})(Rt||(Rt={}));function cc(r,e){if(r.end.linee.end.line||r.start.line===e.end.line&&r.start.character>e.end.character)return Rt.After;let t=r.start.line>e.start.line||r.start.line===e.start.line&&r.start.character>=e.start.character,n=r.end.lineRt.After}a(ta,"inRange");var Ni=/^[\w\p{L}]$/u;function Vd(r,e,t=Ni){if(r){if(e>0){let n=e-r.offset,i=r.text.charAt(n);t.test(i)||e--}return na(r,e)}}a(Vd,"findDeclarationNodeAtOffset");function ra(r,e){if(r){let t=dc(r,!0);if(t&&Zs(t,e))return t;if(ln(r)){let n=r.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let s=r.content[i];if(Zs(s,e))return s}}}}a(ra,"findCommentNode");function Zs(r,e){return Pt(r)&&e.includes(r.tokenType.name)}a(Zs,"isCommentNode");function na(r,e){if(Pt(r))return r;if(Ke(r)){let t=fc(r,e,!1);if(t)return na(t,e)}}a(na,"findLeafNodeAtOffset");function uc(r,e){if(Pt(r))return r;if(Ke(r)){let t=fc(r,e,!0);if(t)return uc(t,e)}}a(uc,"findLeafNodeBeforeOffset");function fc(r,e,t){let n=0,i=r.content.length-1,s;for(;n<=i;){let o=Math.floor((n+i)/2),l=r.content[o];if(l.offset<=e&&l.end>e)return l;l.end<=e?(s=t?l:void 0,n=o+1):i=o-1}return s}a(fc,"binarySearch");function dc(r,e=!0){for(;r.container;){let t=r.container,n=t.content.indexOf(r);for(;n>0;){n--;let i=t.content[n];if(e||!i.hidden)return i}r=t}}a(dc,"getPreviousNode");function Kd(r,e=!0){for(;r.container;){let t=r.container,n=t.content.indexOf(r),i=t.content.length-1;for(;nvo,findNameAssignment:()=>ji,findNodeForKeyword:()=>Eo,findNodeForProperty:()=>Rn,findNodesForKeyword:()=>mh,findNodesForKeywordInternal:()=>Ao,findNodesForProperty:()=>xo,getActionAtElement:()=>Nc,getActionType:()=>Cc,getAllReachableRules:()=>xn,getCrossReferenceTerminal:()=>yo,getEntryRule:()=>Ac,getExplicitRuleType:()=>ko,getHiddenRules:()=>vc,getRuleType:()=>Io,getTypeName:()=>ir,isArrayCardinality:()=>yh,isArrayOperator:()=>Th,isCommentTerminal:()=>To,isDataType:()=>xh,isDataTypeRule:()=>En,isOptionalCardinality:()=>gh,terminalRegex:()=>Sr});var Jt=class extends Error{static{a(this,"ErrorWithLocation")}constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};function bt(r){throw new Error("Error! The input value was not handled.")}a(bt,"assertUnreachable");var pn={};Vt(pn,{AbstractElement:()=>sa,AbstractRule:()=>un,AbstractType:()=>fn,Action:()=>$a,Alternatives:()=>Pa,ArrayLiteral:()=>aa,ArrayType:()=>oa,Assignment:()=>ba,BooleanLiteral:()=>ca,CharacterRange:()=>Ma,Condition:()=>Ci,Conjunction:()=>fa,CrossReference:()=>Fa,Disjunction:()=>ha,EndOfFile:()=>Ua,Grammar:()=>ma,GrammarImport:()=>pc,Group:()=>Ba,InferredType:()=>ga,Interface:()=>ya,Keyword:()=>Wa,LangiumGrammarAstReflection:()=>kr,LangiumGrammarTerminals:()=>Xd,NamedArgument:()=>mc,NegatedToken:()=>ja,Negation:()=>Ta,NumberLiteral:()=>Ra,Parameter:()=>Ea,ParameterReference:()=>Aa,ParserRule:()=>ka,ReferenceType:()=>Ia,RegexToken:()=>Ka,ReturnType:()=>gc,RuleCall:()=>za,SimpleType:()=>Ca,StringLiteral:()=>_a,TerminalAlternatives:()=>qa,TerminalGroup:()=>Ya,TerminalRule:()=>wi,TerminalRuleCall:()=>Qa,Type:()=>wa,TypeAttribute:()=>yc,TypeDefinition:()=>ia,UnionType:()=>La,UnorderedGroup:()=>Za,UntilToken:()=>eo,ValueLiteral:()=>_i,Wildcard:()=>ro,isAbstractElement:()=>dn,isAbstractRule:()=>Yd,isAbstractType:()=>Jd,isAction:()=>Et,isAlternatives:()=>Pi,isArrayLiteral:()=>rh,isArrayType:()=>la,isAssignment:()=>tt,isBooleanLiteral:()=>ua,isCharacterRange:()=>Da,isCondition:()=>Qd,isConjunction:()=>da,isCrossReference:()=>Qt,isDisjunction:()=>pa,isEndOfFile:()=>Ga,isFeatureName:()=>Zd,isGrammar:()=>nh,isGrammarImport:()=>ih,isGroup:()=>Mt,isInferredType:()=>Li,isInterface:()=>Oi,isKeyword:()=>Je,isNamedArgument:()=>sh,isNegatedToken:()=>Va,isNegation:()=>xa,isNumberLiteral:()=>ah,isParameter:()=>oh,isParameterReference:()=>va,isParserRule:()=>_e,isPrimitiveType:()=>hc,isReferenceType:()=>Na,isRegexToken:()=>Ha,isReturnType:()=>Sa,isRuleCall:()=>rt,isSimpleType:()=>$i,isStringLiteral:()=>lh,isTerminalAlternatives:()=>Xa,isTerminalGroup:()=>Ja,isTerminalRule:()=>Ye,isTerminalRuleCall:()=>bi,isType:()=>hn,isTypeAttribute:()=>ch,isTypeDefinition:()=>eh,isUnionType:()=>Oa,isUnorderedGroup:()=>Mi,isUntilToken:()=>to,isValueLiteral:()=>th,isWildcard:()=>no,reflection:()=>L});var Xd={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},un="AbstractRule";function Yd(r){return L.isInstance(r,un)}a(Yd,"isAbstractRule");var fn="AbstractType";function Jd(r){return L.isInstance(r,fn)}a(Jd,"isAbstractType");var Ci="Condition";function Qd(r){return L.isInstance(r,Ci)}a(Qd,"isCondition");function Zd(r){return hc(r)||r==="current"||r==="entry"||r==="extends"||r==="false"||r==="fragment"||r==="grammar"||r==="hidden"||r==="import"||r==="interface"||r==="returns"||r==="terminal"||r==="true"||r==="type"||r==="infer"||r==="infers"||r==="with"||typeof r=="string"&&/\^?[_a-zA-Z][\w_]*/.test(r)}a(Zd,"isFeatureName");function hc(r){return r==="string"||r==="number"||r==="boolean"||r==="Date"||r==="bigint"}a(hc,"isPrimitiveType");var ia="TypeDefinition";function eh(r){return L.isInstance(r,ia)}a(eh,"isTypeDefinition");var _i="ValueLiteral";function th(r){return L.isInstance(r,_i)}a(th,"isValueLiteral");var sa="AbstractElement";function dn(r){return L.isInstance(r,sa)}a(dn,"isAbstractElement");var aa="ArrayLiteral";function rh(r){return L.isInstance(r,aa)}a(rh,"isArrayLiteral");var oa="ArrayType";function la(r){return L.isInstance(r,oa)}a(la,"isArrayType");var ca="BooleanLiteral";function ua(r){return L.isInstance(r,ca)}a(ua,"isBooleanLiteral");var fa="Conjunction";function da(r){return L.isInstance(r,fa)}a(da,"isConjunction");var ha="Disjunction";function pa(r){return L.isInstance(r,ha)}a(pa,"isDisjunction");var ma="Grammar";function nh(r){return L.isInstance(r,ma)}a(nh,"isGrammar");var pc="GrammarImport";function ih(r){return L.isInstance(r,pc)}a(ih,"isGrammarImport");var ga="InferredType";function Li(r){return L.isInstance(r,ga)}a(Li,"isInferredType");var ya="Interface";function Oi(r){return L.isInstance(r,ya)}a(Oi,"isInterface");var mc="NamedArgument";function sh(r){return L.isInstance(r,mc)}a(sh,"isNamedArgument");var Ta="Negation";function xa(r){return L.isInstance(r,Ta)}a(xa,"isNegation");var Ra="NumberLiteral";function ah(r){return L.isInstance(r,Ra)}a(ah,"isNumberLiteral");var Ea="Parameter";function oh(r){return L.isInstance(r,Ea)}a(oh,"isParameter");var Aa="ParameterReference";function va(r){return L.isInstance(r,Aa)}a(va,"isParameterReference");var ka="ParserRule";function _e(r){return L.isInstance(r,ka)}a(_e,"isParserRule");var Ia="ReferenceType";function Na(r){return L.isInstance(r,Ia)}a(Na,"isReferenceType");var gc="ReturnType";function Sa(r){return L.isInstance(r,gc)}a(Sa,"isReturnType");var Ca="SimpleType";function $i(r){return L.isInstance(r,Ca)}a($i,"isSimpleType");var _a="StringLiteral";function lh(r){return L.isInstance(r,_a)}a(lh,"isStringLiteral");var wi="TerminalRule";function Ye(r){return L.isInstance(r,wi)}a(Ye,"isTerminalRule");var wa="Type";function hn(r){return L.isInstance(r,wa)}a(hn,"isType");var yc="TypeAttribute";function ch(r){return L.isInstance(r,yc)}a(ch,"isTypeAttribute");var La="UnionType";function Oa(r){return L.isInstance(r,La)}a(Oa,"isUnionType");var $a="Action";function Et(r){return L.isInstance(r,$a)}a(Et,"isAction");var Pa="Alternatives";function Pi(r){return L.isInstance(r,Pa)}a(Pi,"isAlternatives");var ba="Assignment";function tt(r){return L.isInstance(r,ba)}a(tt,"isAssignment");var Ma="CharacterRange";function Da(r){return L.isInstance(r,Ma)}a(Da,"isCharacterRange");var Fa="CrossReference";function Qt(r){return L.isInstance(r,Fa)}a(Qt,"isCrossReference");var Ua="EndOfFile";function Ga(r){return L.isInstance(r,Ua)}a(Ga,"isEndOfFile");var Ba="Group";function Mt(r){return L.isInstance(r,Ba)}a(Mt,"isGroup");var Wa="Keyword";function Je(r){return L.isInstance(r,Wa)}a(Je,"isKeyword");var ja="NegatedToken";function Va(r){return L.isInstance(r,ja)}a(Va,"isNegatedToken");var Ka="RegexToken";function Ha(r){return L.isInstance(r,Ka)}a(Ha,"isRegexToken");var za="RuleCall";function rt(r){return L.isInstance(r,za)}a(rt,"isRuleCall");var qa="TerminalAlternatives";function Xa(r){return L.isInstance(r,qa)}a(Xa,"isTerminalAlternatives");var Ya="TerminalGroup";function Ja(r){return L.isInstance(r,Ya)}a(Ja,"isTerminalGroup");var Qa="TerminalRuleCall";function bi(r){return L.isInstance(r,Qa)}a(bi,"isTerminalRuleCall");var Za="UnorderedGroup";function Mi(r){return L.isInstance(r,Za)}a(Mi,"isUnorderedGroup");var eo="UntilToken";function to(r){return L.isInstance(r,eo)}a(to,"isUntilToken");var ro="Wildcard";function no(r){return L.isInstance(r,ro)}a(no,"isWildcard");var kr=class extends zt{static{a(this,"LangiumGrammarAstReflection")}getAllTypes(){return["AbstractElement","AbstractRule","AbstractType","Action","Alternatives","ArrayLiteral","ArrayType","Assignment","BooleanLiteral","CharacterRange","Condition","Conjunction","CrossReference","Disjunction","EndOfFile","Grammar","GrammarImport","Group","InferredType","Interface","Keyword","NamedArgument","NegatedToken","Negation","NumberLiteral","Parameter","ParameterReference","ParserRule","ReferenceType","RegexToken","ReturnType","RuleCall","SimpleType","StringLiteral","TerminalAlternatives","TerminalGroup","TerminalRule","TerminalRuleCall","Type","TypeAttribute","TypeDefinition","UnionType","UnorderedGroup","UntilToken","ValueLiteral","Wildcard"]}computeIsSubtype(e,t){switch(e){case $a:case Pa:case ba:case Ma:case Fa:case Ua:case Ba:case Wa:case ja:case Ka:case za:case qa:case Ya:case Qa:case Za:case eo:case ro:return this.isSubtype(sa,t);case aa:case Ra:case _a:return this.isSubtype(_i,t);case oa:case Ia:case Ca:case La:return this.isSubtype(ia,t);case ca:return this.isSubtype(Ci,t)||this.isSubtype(_i,t);case fa:case ha:case Ta:case Aa:return this.isSubtype(Ci,t);case ga:case ya:case wa:return this.isSubtype(fn,t);case ka:return this.isSubtype(un,t)||this.isSubtype(fn,t);case wi:return this.isSubtype(un,t);default:return!1}}getReferenceType(e){let t=`${e.container.$type}:${e.property}`;switch(t){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return fn;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return un;case"Grammar:usedGrammars":return ma;case"NamedArgument:parameter":case"ParameterReference:parameter":return Ea;case"TerminalRuleCall:rule":return wi;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"AbstractElement":return{name:"AbstractElement",properties:[{name:"cardinality"},{name:"lookahead"}]};case"ArrayLiteral":return{name:"ArrayLiteral",properties:[{name:"elements",defaultValue:[]}]};case"ArrayType":return{name:"ArrayType",properties:[{name:"elementType"}]};case"BooleanLiteral":return{name:"BooleanLiteral",properties:[{name:"true",defaultValue:!1}]};case"Conjunction":return{name:"Conjunction",properties:[{name:"left"},{name:"right"}]};case"Disjunction":return{name:"Disjunction",properties:[{name:"left"},{name:"right"}]};case"Grammar":return{name:"Grammar",properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case"GrammarImport":return{name:"GrammarImport",properties:[{name:"path"}]};case"InferredType":return{name:"InferredType",properties:[{name:"name"}]};case"Interface":return{name:"Interface",properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case"NamedArgument":return{name:"NamedArgument",properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case"Negation":return{name:"Negation",properties:[{name:"value"}]};case"NumberLiteral":return{name:"NumberLiteral",properties:[{name:"value"}]};case"Parameter":return{name:"Parameter",properties:[{name:"name"}]};case"ParameterReference":return{name:"ParameterReference",properties:[{name:"parameter"}]};case"ParserRule":return{name:"ParserRule",properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case"ReferenceType":return{name:"ReferenceType",properties:[{name:"referenceType"}]};case"ReturnType":return{name:"ReturnType",properties:[{name:"name"}]};case"SimpleType":return{name:"SimpleType",properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case"StringLiteral":return{name:"StringLiteral",properties:[{name:"value"}]};case"TerminalRule":return{name:"TerminalRule",properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case"Type":return{name:"Type",properties:[{name:"name"},{name:"type"}]};case"TypeAttribute":return{name:"TypeAttribute",properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case"UnionType":return{name:"UnionType",properties:[{name:"types",defaultValue:[]}]};case"Action":return{name:"Action",properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case"Alternatives":return{name:"Alternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"Assignment":return{name:"Assignment",properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case"CharacterRange":return{name:"CharacterRange",properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case"CrossReference":return{name:"CrossReference",properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case"EndOfFile":return{name:"EndOfFile",properties:[{name:"cardinality"},{name:"lookahead"}]};case"Group":return{name:"Group",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case"Keyword":return{name:"Keyword",properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case"NegatedToken":return{name:"NegatedToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"RegexToken":return{name:"RegexToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case"RuleCall":return{name:"RuleCall",properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"TerminalAlternatives":return{name:"TerminalAlternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalGroup":return{name:"TerminalGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalRuleCall":return{name:"TerminalRuleCall",properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"UnorderedGroup":return{name:"UnorderedGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"UntilToken":return{name:"UntilToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"Wildcard":return{name:"Wildcard",properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}},L=new kr;var Fi={};Vt(Fi,{assignMandatoryProperties:()=>ao,copyAstNode:()=>so,findLocalReferences:()=>fh,findRootNode:()=>Tc,getContainerOfType:()=>Zt,getDocument:()=>ge,hasContainerOfType:()=>uh,linkContentToContainer:()=>Di,streamAllContents:()=>ot,streamAst:()=>Qe,streamContents:()=>mn,streamReferences:()=>Ir});function Di(r){for(let[e,t]of Object.entries(r))e.startsWith("$")||(Array.isArray(t)?t.forEach((n,i)=>{ae(n)&&(n.$container=r,n.$containerProperty=e,n.$containerIndex=i)}):ae(t)&&(t.$container=r,t.$containerProperty=e))}a(Di,"linkContentToContainer");function Zt(r,e){let t=r;for(;t;){if(e(t))return t;t=t.$container}}a(Zt,"getContainerOfType");function uh(r,e){let t=r;for(;t;){if(e(t))return!0;t=t.$container}return!1}a(uh,"hasContainerOfType");function ge(r){let t=Tc(r).$document;if(!t)throw new Error("AST node has no document.");return t}a(ge,"getDocument");function Tc(r){for(;r.$container;)r=r.$container;return r}a(Tc,"findRootNode");function mn(r,e){if(!r)throw new Error("Node must be an AstNode.");let t=e?.range;return new He(()=>({keys:Object.keys(r),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndexmn(t,e))}a(ot,"streamAllContents");function Qe(r,e){if(r){if(e?.range&&!io(r,e.range))return new at(r,()=>[])}else throw new Error("Root node must be an AstNode.");return new at(r,t=>mn(t,e),{includeRoot:!0})}a(Qe,"streamAst");function io(r,e){var t;if(!e)return!0;let n=(t=r.$cstNode)===null||t===void 0?void 0:t.range;return n?ta(n,e):!1}a(io,"isAstNodeInRange");function Ir(r){return new He(()=>({keys:Object.keys(r),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex{Ir(n).forEach(i=>{i.reference.ref===r&&t.push(i.reference)})}),K(t)}a(fh,"findLocalReferences");function ao(r,e){let t=r.getTypeMetaData(e.$type),n=e;for(let i of t.properties)i.defaultValue!==void 0&&n[i.name]===void 0&&(n[i.name]=xc(i.defaultValue))}a(ao,"assignMandatoryProperties");function xc(r){return Array.isArray(r)?[...r.map(xc)]:r}a(xc,"copyDefaultValue");function so(r,e){let t={$type:r.$type};for(let[n,i]of Object.entries(r))if(!n.startsWith("$"))if(ae(i))t[n]=so(i,e);else if(Ae(i))t[n]=e(t,n,i.$refNode,i.$refText);else if(Array.isArray(i)){let s=[];for(let o of i)ae(o)?s.push(so(o,e)):Ae(o)?s.push(e(t,n,o.$refNode,o.$refText)):s.push(o);t[n]=s}else t[n]=i;return Di(t),t}a(so,"copyAstNode");var Wi={};Vt(Wi,{NEWLINE_REGEXP:()=>uo,escapeRegExp:()=>nr,getCaseInsensitivePattern:()=>ho,getTerminalParts:()=>ph,isMultilineComment:()=>fo,isWhitespace:()=>Bi,partialMatches:()=>po,partialRegExp:()=>Ec});function _(r){return r.charCodeAt(0)}a(_,"cc");function Ui(r,e){Array.isArray(r)?r.forEach(function(t){e.push(t)}):e.push(r)}a(Ui,"insertToSet");function Nr(r,e){if(r[e]===!0)throw"duplicate flag "+e;let t=r[e];r[e]=!0}a(Nr,"addFlag");function er(r){if(r===void 0)throw Error("Internal Error - Should never get here!");return!0}a(er,"ASSERT_EXISTS");function gn(){throw Error("Internal Error - Should never get here!")}a(gn,"ASSERT_NEVER_REACH_HERE");function oo(r){return r.type==="Character"}a(oo,"isCharacter");var yn=[];for(let r=_("0");r<=_("9");r++)yn.push(r);var Tn=[_("_")].concat(yn);for(let r=_("a");r<=_("z");r++)Tn.push(r);for(let r=_("A");r<=_("Z");r++)Tn.push(r);var lo=[_(" "),_("\f"),_(`
`),_("\r"),_(" "),_("\v"),_(" "),_("\xA0"),_("\u1680"),_("\u2000"),_("\u2001"),_("\u2002"),_("\u2003"),_("\u2004"),_("\u2005"),_("\u2006"),_("\u2007"),_("\u2008"),_("\u2009"),_("\u200A"),_("\u2028"),_("\u2029"),_("\u202F"),_("\u205F"),_("\u3000"),_("\uFEFF")];var dh=/[0-9a-fA-F]/,Gi=/[0-9]/,hh=/[1-9]/,tr=class{static{a(this,"RegExpParser")}constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let t=this.disjunction();this.consumeChar("/");let n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Nr(n,"global");break;case"i":Nr(n,"ignoreCase");break;case"m":Nr(n,"multiLine");break;case"u":Nr(n,"unicode");break;case"y":Nr(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break}er(t);let n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return gn()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let 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;er(t);break}if(!(e===!0&&t===void 0)&&er(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),er(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):gn()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[_(`
`),_("\r"),_("\u2028"),_("\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=yn;break;case"D":e=yn,t=!0;break;case"s":e=lo;break;case"S":e=lo,t=!0;break;case"w":e=Tn;break;case"W":e=Tn,t=!0;break}return er(e)?{type:"Set",value:e,complement:t}:gn()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=_("\f");break;case"n":e=_(`
`);break;case"r":e=_("\r");break;case"t":e=_(" ");break;case"v":e=_("\v");break}return er(e)?{type:"Character",value:e}:gn()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:_("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:_(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:_(e)}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let n=this.classAtom(),i=n.type==="Character";if(oo(n)&&this.isRangeDash()){this.consumeChar("-");let s=this.classAtom(),o=s.type==="Character";if(oo(s)){if(s.value=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}};var lt=class{static{a(this,"BaseRegExpVisitor")}visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"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){}};var uo=/\r?\n/gm,Rc=new tr,co=class extends lt{static{a(this,"TerminalRegExpVisitor")}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){let t=String.fromCharCode(e.value);if(!this.multiline&&t===`
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let n=nr(t);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitSet(e){if(!this.multiline){let t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=!!`
`.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let 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)}},rr=new co;function ph(r){try{typeof r!="string"&&(r=r.source),r=`/${r}/`;let e=Rc.pattern(r),t=[];for(let n of e.value.value)rr.reset(r),rr.visit(n),t.push({start:rr.startRegexp,end:rr.endRegex});return t}catch{return[]}}a(ph,"getTerminalParts");function fo(r){try{return typeof r=="string"&&(r=new RegExp(r)),r=r.toString(),rr.reset(r),rr.visit(Rc.pattern(r)),rr.multiline}catch{return!1}}a(fo,"isMultilineComment");function Bi(r){return(typeof r=="string"?new RegExp(r):r).test(" ")}a(Bi,"isWhitespace");function nr(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}a(nr,"escapeRegExp");function ho(r){return Array.prototype.map.call(r,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:nr(e)).join("")}a(ho,"getCaseInsensitivePattern");function po(r,e){let t=Ec(r),n=e.match(t);return!!n&&n[0].length>0}a(po,"partialMatches");function Ec(r){typeof r=="string"&&(r=new RegExp(r));let e=r,t=r.source,n=0;function i(){let s="",o;function l(u){s+=t.substr(n,u),n+=u}a(l,"appendRaw");function c(u){s+="(?:"+t.substr(n,u)+"|$)",n+=u}for(a(c,"appendOptional");n",n)-n+1);break;default:c(2);break}break;case"[":o=/\[(?:\\.|.)*?\]/g,o.lastIndex=n,o=o.exec(t)||[],c(o[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":l(1);break;case"{":o=/\{\d+,?\d*\}/g,o.lastIndex=n,o=o.exec(t),o?l(o[0].length):c(1);break;case"(":if(t[n+1]==="?")switch(t[n+2]){case":":s+="(?:",n+=3,s+=i()+"|$)";break;case"=":s+="(?=",n+=3,s+=i()+")";break;case"!":o=n,n+=3,i(),s+=t.substr(o,n-o);break;case"<":switch(t[n+3]){case"=":case"!":o=n,n+=4,i(),s+=t.substr(o,n-o);break;default:l(t.indexOf(">",n)-n+1),s+=i()+"|$)";break}break}else l(1),s+=i()+"|$)";break;case")":return++n,s;default:c(1);break}return s}return a(i,"process"),new RegExp(i(),r.flags)}a(Ec,"partialRegExp");function Ac(r){return r.rules.find(e=>_e(e)&&e.entry)}a(Ac,"getEntryRule");function vc(r){return r.rules.filter(e=>Ye(e)&&e.hidden)}a(vc,"getHiddenRules");function xn(r,e){let t=new Set,n=Ac(r);if(!n)return new Set(r.rules);let i=[n].concat(vc(r));for(let o of i)kc(o,t,e);let s=new Set;for(let o of r.rules)(t.has(o.name)||Ye(o)&&o.hidden)&&s.add(o);return s}a(xn,"getAllReachableRules");function kc(r,e,t){e.add(r.name),ot(r).forEach(n=>{if(rt(n)||t&&bi(n)){let i=n.rule.ref;i&&!e.has(i.name)&&kc(i,e,t)}})}a(kc,"ruleDfs");function yo(r){if(r.terminal)return r.terminal;if(r.type.ref){let e=ji(r.type.ref);return e?.terminal}}a(yo,"getCrossReferenceTerminal");function To(r){return r.hidden&&!Sr(r).test(" ")}a(To,"isCommentTerminal");function xo(r,e){return!r||!e?[]:Ro(r,e,r.astNode,!0)}a(xo,"findNodesForProperty");function Rn(r,e,t){if(!r||!e)return;let n=Ro(r,e,r.astNode,!0);if(n.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,n.length-1)):t=0,n[t]}a(Rn,"findNodeForProperty");function Ro(r,e,t,n){if(!n){let i=Zt(r.grammarSource,tt);if(i&&i.feature===e)return[r]}return Ke(r)&&r.astNode===t?r.content.flatMap(i=>Ro(i,e,t,!1)):[]}a(Ro,"findNodesForPropertyInternal");function mh(r,e){return r?Ao(r,e,r?.astNode):[]}a(mh,"findNodesForKeyword");function Eo(r,e,t){if(!r)return;let n=Ao(r,e,r?.astNode);if(n.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,n.length-1)):t=0,n[t]}a(Eo,"findNodeForKeyword");function Ao(r,e,t){if(r.astNode!==t)return[];if(Je(r.grammarSource)&&r.grammarSource.value===e)return[r];let n=Xt(r).iterator(),i,s=[];do if(i=n.next(),!i.done){let o=i.value;o.astNode===t?Je(o.grammarSource)&&o.grammarSource.value===e&&s.push(o):n.prune()}while(!i.done);return s}a(Ao,"findNodesForKeywordInternal");function vo(r){var e;let t=r.astNode;for(;t===((e=r.container)===null||e===void 0?void 0:e.astNode);){let n=Zt(r.grammarSource,tt);if(n)return n;r=r.container}}a(vo,"findAssignment");function ji(r){let e=r;return Li(e)&&(Et(e.$container)?e=e.$container.$container:_e(e.$container)?e=e.$container:bt(e.$container)),Ic(r,e,new Map)}a(ji,"findNameAssignment");function Ic(r,e,t){var n;function i(s,o){let l;return Zt(s,tt)||(l=Ic(o,o,t)),t.set(r,l),l}if(a(i,"go"),t.has(r))return t.get(r);t.set(r,void 0);for(let s of ot(e)){if(tt(s)&&s.feature.toLowerCase()==="name")return t.set(r,s),s;if(rt(s)&&_e(s.rule.ref))return i(s,s.rule.ref);if($i(s)&&(!((n=s.typeRef)===null||n===void 0)&&n.ref))return i(s,s.typeRef.ref)}}a(Ic,"findNameAssignmentInternal");function Nc(r){let e=r.$container;if(Mt(e)){let t=e.elements,n=t.indexOf(r);for(let i=n-1;i>=0;i--){let s=t[i];if(Et(s))return s;{let o=ot(t[i]).find(Et);if(o)return o}}}if(dn(e))return Nc(e)}a(Nc,"getActionAtElement");function gh(r,e){return r==="?"||r==="*"||Mt(e)&&!!e.guardCondition}a(gh,"isOptionalCardinality");function yh(r){return r==="*"||r==="+"}a(yh,"isArrayCardinality");function Th(r){return r==="+="}a(Th,"isArrayOperator");function En(r){return Sc(r,new Set)}a(En,"isDataTypeRule");function Sc(r,e){if(e.has(r))return!0;e.add(r);for(let t of ot(r))if(rt(t)){if(!t.rule.ref||_e(t.rule.ref)&&!Sc(t.rule.ref,e))return!1}else{if(tt(t))return!1;if(Et(t))return!1}return!!r.definition}a(Sc,"isDataTypeRuleInternal");function xh(r){return go(r.type,new Set)}a(xh,"isDataType");function go(r,e){if(e.has(r))return!0;if(e.add(r),la(r))return!1;if(Na(r))return!1;if(Oa(r))return r.types.every(t=>go(t,e));if($i(r)){if(r.primitiveType!==void 0)return!0;if(r.stringType!==void 0)return!0;if(r.typeRef!==void 0){let t=r.typeRef.ref;return hn(t)?go(t.type,e):!1}else return!1}else return!1}a(go,"isDataTypeInternal");function ko(r){if(r.inferredType)return r.inferredType.name;if(r.dataType)return r.dataType;if(r.returnType){let e=r.returnType.ref;if(e){if(_e(e))return e.name;if(Oi(e)||hn(e))return e.name}}}a(ko,"getExplicitRuleType");function ir(r){var e;if(_e(r))return En(r)?r.name:(e=ko(r))!==null&&e!==void 0?e:r.name;if(Oi(r)||hn(r)||Sa(r))return r.name;if(Et(r)){let t=Cc(r);if(t)return t}else if(Li(r))return r.name;throw new Error("Cannot get name of Unknown Type")}a(ir,"getTypeName");function Cc(r){var e;if(r.inferredType)return r.inferredType.name;if(!((e=r.type)===null||e===void 0)&&e.ref)return ir(r.type.ref)}a(Cc,"getActionType");function Io(r){var e,t,n;return Ye(r)?(t=(e=r.type)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"string":En(r)?r.name:(n=ko(r))!==null&&n!==void 0?n:r.name}a(Io,"getRuleType");function Sr(r){let e={s:!1,i:!1,u:!1},t=Cr(r.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(t,n)}a(Sr,"terminalRegex");var No=/[\s\S]/.source;function Cr(r,e){if(Xa(r))return Rh(r);if(Ja(r))return Eh(r);if(Da(r))return kh(r);if(bi(r)){let t=r.rule.ref;if(!t)throw new Error("Missing rule reference.");return At(Cr(t.definition),{cardinality:r.cardinality,lookahead:r.lookahead})}else{if(Va(r))return vh(r);if(to(r))return Ah(r);if(Ha(r)){let t=r.regex.lastIndexOf("/"),n=r.regex.substring(1,t),i=r.regex.substring(t+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),At(n,{cardinality:r.cardinality,lookahead:r.lookahead,wrap:!1})}else{if(no(r))return At(No,{cardinality:r.cardinality,lookahead:r.lookahead});throw new Error(`Invalid terminal element: ${r?.$type}`)}}}a(Cr,"abstractElementToRegex");function Rh(r){return At(r.elements.map(e=>Cr(e)).join("|"),{cardinality:r.cardinality,lookahead:r.lookahead})}a(Rh,"terminalAlternativesToRegex");function Eh(r){return At(r.elements.map(e=>Cr(e)).join(""),{cardinality:r.cardinality,lookahead:r.lookahead})}a(Eh,"terminalGroupToRegex");function Ah(r){return At(`${No}*?${Cr(r.terminal)}`,{cardinality:r.cardinality,lookahead:r.lookahead})}a(Ah,"untilTokenToRegex");function vh(r){return At(`(?!${Cr(r.terminal)})${No}*?`,{cardinality:r.cardinality,lookahead:r.lookahead})}a(vh,"negateTokenToRegex");function kh(r){return r.right?At(`[${mo(r.left)}-${mo(r.right)}]`,{cardinality:r.cardinality,lookahead:r.lookahead,wrap:!1}):At(mo(r.left),{cardinality:r.cardinality,lookahead:r.lookahead,wrap:!1})}a(kh,"characterRangeToRegex");function mo(r){return nr(r.value)}a(mo,"keywordToRegex");function At(r,e){var t;return(e.wrap!==!1||e.lookahead)&&(r=`(${(t=e.lookahead)!==null&&t!==void 0?t:""}${r})`),e.cardinality?`${r}${e.cardinality}`:r}a(At,"withCardinality");function So(r){let e=[],t=r.Grammar;for(let n of t.rules)Ye(n)&&To(n)&&fo(Sr(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:Ni}}a(So,"createGrammarConfig");function _r(r){console&&console.error&&console.error(`Error: ${r}`)}a(_r,"PRINT_ERROR");function An(r){console&&console.warn&&console.warn(`Warning: ${r}`)}a(An,"PRINT_WARNING");function vn(r){let e=new Date().getTime(),t=r();return{time:new Date().getTime()-e,value:t}}a(vn,"timer");function kn(r){function e(){}a(e,"FakeConstructor"),e.prototype=r;let t=new e;function n(){return typeof t.bar}return a(n,"fakeAccess"),n(),n(),r;(0,eval)(r)}a(kn,"toFastProperties");function Ih(r){return Nh(r)?r.LABEL:r.name}a(Ih,"tokenLabel");function Nh(r){return Ce(r.LABEL)&&r.LABEL!==""}a(Nh,"hasTokenLabel");var ze=class{static{a(this,"AbstractProduction")}get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),I(this.definition,t=>{t.accept(e)})}},H=class extends ze{static{a(this,"NonTerminal")}constructor(e){super([]),this.idx=1,Ie(this,Ve(e,t=>t!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},Me=class extends ze{static{a(this,"Rule")}constructor(e){super(e.definition),this.orgText="",Ie(this,Ve(e,t=>t!==void 0))}},J=class extends ze{static{a(this,"Alternative")}constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Ie(this,Ve(e,t=>t!==void 0))}},z=class extends ze{static{a(this,"Option")}constructor(e){super(e.definition),this.idx=1,Ie(this,Ve(e,t=>t!==void 0))}},Q=class extends ze{static{a(this,"RepetitionMandatory")}constructor(e){super(e.definition),this.idx=1,Ie(this,Ve(e,t=>t!==void 0))}},Z=class extends ze{static{a(this,"RepetitionMandatoryWithSeparator")}constructor(e){super(e.definition),this.idx=1,Ie(this,Ve(e,t=>t!==void 0))}},F=class extends ze{static{a(this,"Repetition")}constructor(e){super(e.definition),this.idx=1,Ie(this,Ve(e,t=>t!==void 0))}},q=class extends ze{static{a(this,"RepetitionWithSeparator")}constructor(e){super(e.definition),this.idx=1,Ie(this,Ve(e,t=>t!==void 0))}},X=class extends ze{static{a(this,"Alternation")}get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Ie(this,Ve(e,t=>t!==void 0))}},D=class{static{a(this,"Terminal")}constructor(e){this.idx=1,Ie(this,Ve(e,t=>t!==void 0))}accept(e){e.visit(this)}};function Ki(r){return E(r,wr)}a(Ki,"serializeGrammar");function wr(r){function e(t){return E(t,wr)}if(a(e,"convertDefinition"),r instanceof H){let t={type:"NonTerminal",name:r.nonTerminalName,idx:r.idx};return Ce(r.label)&&(t.label=r.label),t}else{if(r instanceof J)return{type:"Alternative",definition:e(r.definition)};if(r instanceof z)return{type:"Option",idx:r.idx,definition:e(r.definition)};if(r instanceof Q)return{type:"RepetitionMandatory",idx:r.idx,definition:e(r.definition)};if(r instanceof Z)return{type:"RepetitionMandatoryWithSeparator",idx:r.idx,separator:wr(new D({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof q)return{type:"RepetitionWithSeparator",idx:r.idx,separator:wr(new D({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof F)return{type:"Repetition",idx:r.idx,definition:e(r.definition)};if(r instanceof X)return{type:"Alternation",idx:r.idx,definition:e(r.definition)};if(r instanceof D){let t={type:"Terminal",name:r.terminalType.name,label:Ih(r.terminalType),idx:r.idx};Ce(r.label)&&(t.terminalLabel=r.label);let n=r.terminalType.PATTERN;return r.terminalType.PATTERN&&(t.pattern=et(n)?n.source:n),t}else{if(r instanceof Me)return{type:"Rule",name:r.name,orgText:r.orgText,definition:e(r.definition)};throw Error("non exhaustive match")}}}a(wr,"serializeProduction");var De=class{static{a(this,"GAstVisitor")}visit(e){let t=e;switch(t.constructor){case H:return this.visitNonTerminal(t);case J:return this.visitAlternative(t);case z:return this.visitOption(t);case Q:return this.visitRepetitionMandatory(t);case Z:return this.visitRepetitionMandatoryWithSeparator(t);case q:return this.visitRepetitionWithSeparator(t);case F:return this.visitRepetition(t);case X:return this.visitAlternation(t);case D:return this.visitTerminal(t);case Me:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function Co(r){return r instanceof J||r instanceof z||r instanceof F||r instanceof Q||r instanceof Z||r instanceof q||r instanceof D||r instanceof Me}a(Co,"isSequenceProd");function sr(r,e=[]){return r instanceof z||r instanceof F||r instanceof q?!0:r instanceof X?ki(r.definition,n=>sr(n,e)):r instanceof H&&se(e,r)?!1:r instanceof ze?(r instanceof H&&e.push(r),$e(r.definition,n=>sr(n,e))):!1}a(sr,"isOptionalProd");function _o(r){return r instanceof X}a(_o,"isBranchingProd");function Be(r){if(r instanceof H)return"SUBRULE";if(r instanceof z)return"OPTION";if(r instanceof X)return"OR";if(r instanceof Q)return"AT_LEAST_ONE";if(r instanceof Z)return"AT_LEAST_ONE_SEP";if(r instanceof q)return"MANY_SEP";if(r instanceof F)return"MANY";if(r instanceof D)return"CONSUME";throw Error("non exhaustive match")}a(Be,"getProductionDslName");var vt=class{static{a(this,"RestWalker")}walk(e,t=[]){I(e.definition,(n,i)=>{let s=de(e.definition,i+1);if(n instanceof H)this.walkProdRef(n,s,t);else if(n instanceof D)this.walkTerminal(n,s,t);else if(n instanceof J)this.walkFlat(n,s,t);else if(n instanceof z)this.walkOption(n,s,t);else if(n instanceof Q)this.walkAtLeastOne(n,s,t);else if(n instanceof Z)this.walkAtLeastOneSep(n,s,t);else if(n instanceof q)this.walkManySep(n,s,t);else if(n instanceof F)this.walkMany(n,s,t);else if(n instanceof X)this.walkOr(n,s,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){let i=t.concat(n);this.walk(e,i)}walkOption(e,t,n){let i=t.concat(n);this.walk(e,i)}walkAtLeastOne(e,t,n){let i=[new z({definition:e.definition})].concat(t,n);this.walk(e,i)}walkAtLeastOneSep(e,t,n){let i=_c(e,t,n);this.walk(e,i)}walkMany(e,t,n){let i=[new z({definition:e.definition})].concat(t,n);this.walk(e,i)}walkManySep(e,t,n){let i=_c(e,t,n);this.walk(e,i)}walkOr(e,t,n){let i=t.concat(n);I(e.definition,s=>{let o=new J({definition:[s]});this.walk(o,i)})}};function _c(r,e,t){return[new z({definition:[new D({terminalType:r.separator})].concat(r.definition)})].concat(e,t)}a(_c,"restForRepetitionWithSeparator");function ar(r){if(r instanceof H)return ar(r.referencedRule);if(r instanceof D)return _h(r);if(Co(r))return Sh(r);if(_o(r))return Ch(r);throw Error("non exhaustive match")}a(ar,"first");function Sh(r){let e=[],t=r.definition,n=0,i=t.length>n,s,o=!0;for(;i&&o;)s=t[n],o=sr(s),e=e.concat(ar(s)),n=n+1,i=t.length>n;return on(e)}a(Sh,"firstForSequence");function Ch(r){let e=E(r.definition,t=>ar(t));return on(fe(e))}a(Ch,"firstForBranching");function _h(r){return[r.terminalType]}a(_h,"firstForTerminal");var Hi="_~IN~_";var wo=class extends vt{static{a(this,"ResyncFollowsWalker")}constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){let i=wh(e.referencedRule,e.idx)+this.topProd.name,s=t.concat(n),o=new J({definition:s}),l=ar(o);this.follows[i]=l}};function wc(r){let e={};return I(r,t=>{let n=new wo(t).startWalking();Ie(e,n)}),e}a(wc,"computeAllProdsFollows");function wh(r,e){return r.name+e+Hi}a(wh,"buildBetweenProdsFollowPrefix");var zi={},Lh=new tr;function Lr(r){let e=r.toString();if(zi.hasOwnProperty(e))return zi[e];{let t=Lh.pattern(e);return zi[e]=t,t}}a(Lr,"getRegExpAst");function Lc(){zi={}}a(Lc,"clearRegExpParserCache");var $c="Complement Sets are not supported for first char optimization",In=`Unable to use "first char" lexer optimizations:
`;function Pc(r,e=!1){try{let t=Lr(r);return Lo(t.value,{},t.flags.ignoreCase)}catch(t){if(t.message===$c)e&&An(`${In} Unable to optimize: < ${r.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 n="";e&&(n=`
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),_r(`${In}
Failed parsing: < ${r.toString()} >
Using the @chevrotain/regexp-to-ast library
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}a(Pc,"getOptimizedStartCodesIndices");function Lo(r,e,t){switch(r.type){case"Disjunction":for(let i=0;i{if(typeof c=="number")qi(c,e,t);else{let u=c;if(t===!0)for(let f=u.from;f<=u.to;f++)qi(f,e,t);else{for(let f=u.from;f<=u.to&&f=Or){let f=u.from>=Or?u.from:Or,d=u.to,p=ct(f),h=ct(d);for(let g=p;g<=h;g++)e[g]=g}}}});break;case"Group":Lo(o.value,e,t);break;default:throw Error("Non Exhaustive Match")}let l=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&Oo(o)===!1||o.type!=="Group"&&l===!1)break}break;default:throw Error("non exhaustive match!")}return re(e)}a(Lo,"firstCharOptimizedIndices");function qi(r,e,t){let n=ct(r);e[n]=n,t===!0&&Oh(r,e)}a(qi,"addOptimizedIdxToResult");function Oh(r,e){let t=String.fromCharCode(r),n=t.toUpperCase();if(n!==t){let i=ct(n.charCodeAt(0));e[i]=i}else{let i=t.toLowerCase();if(i!==t){let s=ct(i.charCodeAt(0));e[s]=s}}}a(Oh,"handleIgnoreCase");function Oc(r,e){return xt(r.value,t=>{if(typeof t=="number")return se(e,t);{let n=t;return xt(e,i=>n.from<=i&&i<=n.to)!==void 0}})}a(Oc,"findCode");function Oo(r){let e=r.quantifier;return e&&e.atLeast===0?!0:r.value?me(r.value)?$e(r.value,Oo):Oo(r.value):!1}a(Oo,"isWholeOptional");var $o=class extends lt{static{a(this,"CharCodeFinder")}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){se(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Oc(e,this.targetCharCodes)===void 0&&(this.found=!0):Oc(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Xi(r,e){if(e instanceof RegExp){let t=Lr(e),n=new $o(r);return n.visit(t),n.found}else return xt(e,t=>se(r,t.charCodeAt(0)))!==void 0}a(Xi,"canMatchCharCode");var or="PATTERN",$r="defaultMode",Yi="modes",bo=typeof new RegExp("(?:)").sticky=="boolean";function Dc(r,e){e=an(e,{useSticky:bo,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:a((A,x)=>x(),"tracer")});let t=e.tracer;t("initCharCodeToOptimizedIndexMap",()=>{Yh()});let n;t("Reject Lexer.NA",()=>{n=Ht(r,A=>A[or]===le.NA)});let i=!1,s;t("Transform Patterns",()=>{i=!1,s=E(n,A=>{let x=A[or];if(et(x)){let P=x.source;return P.length===1&&P!=="^"&&P!=="$"&&P!=="."&&!x.ignoreCase?P:P.length===2&&P[0]==="\\"&&!se(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],P[1])?P[1]:e.useSticky?Mc(x):bc(x)}else{if(st(x))return i=!0,{exec:x};if(typeof x=="object")return i=!0,x;if(typeof x=="string"){if(x.length===1)return x;{let P=x.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),b=new RegExp(P);return e.useSticky?Mc(b):bc(b)}}else throw Error("non exhaustive match")}})});let o,l,c,u,f;t("misc mapping",()=>{o=E(n,A=>A.tokenTypeIdx),l=E(n,A=>{let x=A.GROUP;if(x!==le.SKIPPED){if(Ce(x))return x;if(Pe(x))return!1;throw Error("non exhaustive match")}}),c=E(n,A=>{let x=A.LONGER_ALT;if(x)return me(x)?E(x,b=>Js(n,b)):[Js(n,x)]}),u=E(n,A=>A.PUSH_MODE),f=E(n,A=>N(A,"POP_MODE"))});let d;t("Line Terminator Handling",()=>{let A=Kc(e.lineTerminatorCharacters);d=E(n,x=>!1),e.positionTracking!=="onlyOffset"&&(d=E(n,x=>N(x,"LINE_BREAKS")?!!x.LINE_BREAKS:Vc(x,A)===!1&&Xi(A,x.PATTERN)))});let p,h,g,T;t("Misc Mapping #2",()=>{p=E(n,Wc),h=E(s,qh),g=oe(n,(A,x)=>{let P=x.GROUP;return Ce(P)&&P!==le.SKIPPED&&(A[P]=[]),A},{}),T=E(s,(A,x)=>({pattern:s[x],longerAlt:c[x],canLineTerminator:d[x],isCustom:p[x],short:h[x],group:l[x],push:u[x],pop:f[x],tokenTypeIdx:o[x],tokenType:n[x]}))});let k=!0,R=[];return e.safeMode||t("First Char Optimization",()=>{R=oe(n,(A,x,P)=>{if(typeof x.PATTERN=="string"){let b=x.PATTERN.charCodeAt(0),xe=ct(b);Po(A,xe,T[P])}else if(me(x.START_CHARS_HINT)){let b;I(x.START_CHARS_HINT,xe=>{let Rr=typeof xe=="string"?xe.charCodeAt(0):xe,ve=ct(Rr);b!==ve&&(b=ve,Po(A,ve,T[P]))})}else if(et(x.PATTERN))if(x.PATTERN.unicode)k=!1,e.ensureOptimizations&&_r(`${In} Unable to analyze < ${x.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{let b=Pc(x.PATTERN,e.ensureOptimizations);M(b)&&(k=!1),I(b,xe=>{Po(A,xe,T[P])})}else e.ensureOptimizations&&_r(`${In} TokenType: <${x.name}> is using a custom token pattern without providing parameter.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),k=!1;return A},[])}),{emptyGroups:g,patternIdxToConfig:T,charCodeToPatternIdxToConfig:R,hasCustom:i,canBeOptimized:k}}a(Dc,"analyzeTokenTypes");function Fc(r,e){let t=[],n=Ph(r);t=t.concat(n.errors);let i=bh(n.valid),s=i.valid;return t=t.concat(i.errors),t=t.concat($h(s)),t=t.concat(jh(s)),t=t.concat(Vh(s,e)),t=t.concat(Kh(s)),t}a(Fc,"validatePatterns");function $h(r){let e=[],t=Ee(r,n=>et(n[or]));return e=e.concat(Dh(t)),e=e.concat(Gh(t)),e=e.concat(Bh(t)),e=e.concat(Wh(t)),e=e.concat(Fh(t)),e}a($h,"validateRegExpPattern");function Ph(r){let e=Ee(r,i=>!N(i,or)),t=E(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:ne.MISSING_PATTERN,tokenTypes:[i]})),n=Kt(r,e);return{errors:t,valid:n}}a(Ph,"findMissingPatterns");function bh(r){let e=Ee(r,i=>{let s=i[or];return!et(s)&&!st(s)&&!N(s,"exec")&&!Ce(s)}),t=E(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:ne.INVALID_PATTERN,tokenTypes:[i]})),n=Kt(r,e);return{errors:t,valid:n}}a(bh,"findInvalidPatterns");var Mh=/[^\\][$]/;function Dh(r){class e extends lt{static{a(this,"EndAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}let t=Ee(r,i=>{let s=i.PATTERN;try{let o=Lr(s),l=new e;return l.visit(o),l.found}catch{return Mh.test(s.source)}});return E(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:ne.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}a(Dh,"findEndOfInputAnchor");function Fh(r){let e=Ee(r,n=>n.PATTERN.test(""));return E(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:ne.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}a(Fh,"findEmptyMatchRegExps");var Uh=/[^\\[][\^]|^\^/;function Gh(r){class e extends lt{static{a(this,"StartAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}let t=Ee(r,i=>{let s=i.PATTERN;try{let o=Lr(s),l=new e;return l.visit(o),l.found}catch{return Uh.test(s.source)}});return E(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:ne.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}a(Gh,"findStartOfInputAnchor");function Bh(r){let e=Ee(r,n=>{let i=n[or];return i instanceof RegExp&&(i.multiline||i.global)});return E(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:ne.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}a(Bh,"findUnsupportedFlags");function Wh(r){let e=[],t=E(r,s=>oe(r,(o,l)=>(s.PATTERN.source===l.PATTERN.source&&!se(e,l)&&l.PATTERN!==le.NA&&(e.push(l),o.push(l)),o),[]));t=yt(t);let n=Ee(t,s=>s.length>1);return E(n,s=>{let o=E(s,c=>c.name);return{message:`The same RegExp pattern ->${Ne(s).PATTERN}<-has been used in all of the following Token Types: ${o.join(", ")} <-`,type:ne.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}a(Wh,"findDuplicatePatterns");function jh(r){let e=Ee(r,n=>{if(!N(n,"GROUP"))return!1;let i=n.GROUP;return i!==le.SKIPPED&&i!==le.NA&&!Ce(i)});return E(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:ne.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}a(jh,"findInvalidGroupType");function Vh(r,e){let t=Ee(r,i=>i.PUSH_MODE!==void 0&&!se(e,i.PUSH_MODE));return E(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:ne.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}a(Vh,"findModesThatDoNotExist");function Kh(r){let e=[],t=oe(r,(n,i,s)=>{let o=i.PATTERN;return o===le.NA||(Ce(o)?n.push({str:o,idx:s,tokenType:i}):et(o)&&zh(o)&&n.push({str:o.source,idx:s,tokenType:i})),n},[]);return I(r,(n,i)=>{I(t,({str:s,idx:o,tokenType:l})=>{if(i${l.name}<- can never be matched.
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:ne.UNREACHABLE_PATTERN,tokenTypes:[n,l]})}})}),e}a(Kh,"findUnreachablePatterns");function Hh(r,e){if(et(e)){let t=e.exec(r);return t!==null&&t.index===0}else{if(st(e))return e(r,0,[],{});if(N(e,"exec"))return e.exec(r,0,[],{});if(typeof e=="string")return e===r;throw Error("non exhaustive match")}}a(Hh,"testTokenType");function zh(r){return xt([".","\\","[","]","|","^","$","(",")","?","*","+","{"],t=>r.source.indexOf(t)!==-1)===void 0}a(zh,"noMetaChar");function bc(r){let e=r.ignoreCase?"i":"";return new RegExp(`^(?:${r.source})`,e)}a(bc,"addStartOfInput");function Mc(r){let e=r.ignoreCase?"iy":"y";return new RegExp(`${r.source}`,e)}a(Mc,"addStickyFlag");function Uc(r,e,t){let n=[];return N(r,$r)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+$r+`> property in its definition
`,type:ne.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),N(r,Yi)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Yi+`> property in its definition
`,type:ne.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),N(r,Yi)&&N(r,$r)&&!N(r.modes,r.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${$r}: <${r.defaultMode}>which does not exist
`,type:ne.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),N(r,Yi)&&I(r.modes,(i,s)=>{I(i,(o,l)=>{if(Pe(o))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${l}>
`,type:ne.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(N(o,"LONGER_ALT")){let c=me(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT];I(c,u=>{!Pe(u)&&!se(i,u)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${o.name}> outside of mode <${s}>
`,type:ne.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}a(Uc,"performRuntimeChecks");function Gc(r,e,t){let n=[],i=!1,s=yt(fe(re(r.modes))),o=Ht(s,c=>c[or]===le.NA),l=Kc(t);return e&&I(o,c=>{let u=Vc(c,l);if(u!==!1){let d={message:Xh(c,u),type:u.issue,tokenType:c};n.push(d)}else N(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):Xi(l,c.PATTERN)&&(i=!0)}),e&&!i&&n.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:ne.NO_LINE_BREAKS_FLAGS}),n}a(Gc,"performWarningRuntimeChecks");function Bc(r){let e={},t=gt(r);return I(t,n=>{let i=r[n];if(me(i))e[n]=[];else throw Error("non exhaustive match")}),e}a(Bc,"cloneEmptyGroups");function Wc(r){let e=r.PATTERN;if(et(e))return!1;if(st(e))return!0;if(N(e,"exec"))return!0;if(Ce(e))return!1;throw Error("non exhaustive match")}a(Wc,"isCustomPattern");function qh(r){return Ce(r)&&r.length===1?r.charCodeAt(0):!1}a(qh,"isShortPattern");var jc={test:a(function(r){let e=r.length;for(let t=this.lastIndex;t Token Type
Root cause: ${e.errMsg}.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===ne.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the option.
The problem is in the <${r.name}> Token Type
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}a(Xh,"buildLineBreakIssueMessage");function Kc(r){return E(r,t=>Ce(t)?t.charCodeAt(0):t)}a(Kc,"getCharCodes");function Po(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}a(Po,"addToMapOfArrays");var Or=256,Ji=[];function ct(r){return r255?255+~~(r/255):r}}a(Yh,"initCharCodeToOptimizedIndexMap");function kt(r,e){let t=r.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}a(kt,"tokenStructuredMatcher");function Pr(r,e){return r.tokenTypeIdx===e.tokenTypeIdx}a(Pr,"tokenStructuredMatcherNoCategories");var Hc=1,qc={};function It(r){let e=Jh(r);Qh(e),ep(e),Zh(e),I(e,t=>{t.isParent=t.categoryMatches.length>0})}a(It,"augmentTokenTypes");function Jh(r){let e=te(r),t=r,n=!0;for(;n;){t=yt(fe(E(t,s=>s.CATEGORIES)));let i=Kt(t,e);e=e.concat(i),M(i)?n=!1:t=i}return e}a(Jh,"expandCategories");function Qh(r){I(r,e=>{Mo(e)||(qc[Hc]=e,e.tokenTypeIdx=Hc++),zc(e)&&!me(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),zc(e)||(e.CATEGORIES=[]),tp(e)||(e.categoryMatches=[]),rp(e)||(e.categoryMatchesMap={})})}a(Qh,"assignTokenDefaultProps");function Zh(r){I(r,e=>{e.categoryMatches=[],I(e.categoryMatchesMap,(t,n)=>{e.categoryMatches.push(qc[n].tokenTypeIdx)})})}a(Zh,"assignCategoriesTokensProp");function ep(r){I(r,e=>{Xc([],e)})}a(ep,"assignCategoriesMapProp");function Xc(r,e){I(r,t=>{e.categoryMatchesMap[t.tokenTypeIdx]=!0}),I(e.CATEGORIES,t=>{let n=r.concat(e);se(n,t)||Xc(n,t)})}a(Xc,"singleAssignCategoriesToksMap");function Mo(r){return N(r,"tokenTypeIdx")}a(Mo,"hasShortKeyProperty");function zc(r){return N(r,"CATEGORIES")}a(zc,"hasCategoriesProperty");function tp(r){return N(r,"categoryMatches")}a(tp,"hasExtendingTokensTypesProperty");function rp(r){return N(r,"categoryMatchesMap")}a(rp,"hasExtendingTokensTypesMapProperty");function Yc(r){return N(r,"tokenTypeIdx")}a(Yc,"isTokenType");var Do={buildUnableToPopLexerModeMessage(r){return`Unable to pop Lexer Mode after encountering Token ->${r.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(r,e,t,n,i){return`unexpected character: ->${r.charAt(e)}<- at offset: ${e}, skipped ${t} characters.`}};var ne;(function(r){r[r.MISSING_PATTERN=0]="MISSING_PATTERN",r[r.INVALID_PATTERN=1]="INVALID_PATTERN",r[r.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",r[r.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",r[r.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",r[r.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",r[r.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",r[r.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",r[r.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",r[r.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",r[r.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",r[r.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",r[r.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",r[r.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",r[r.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",r[r.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",r[r.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",r[r.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(ne||(ne={}));var Nn={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Do,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Nn);var le=class{static{a(this,"Lexer")}constructor(e,t=Nn){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++;let o=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${i}>`);let{time:l,value:c}=vn(s),u=l>10?console.warn:console.log;return this.traceInitIndent time: ${l}ms`),this.traceInitIndent--,c}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=Ie({},Nn,t);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Nn.lineTerminatorsPattern)this.config.lineTerminatorsPattern=jc;else if(this.config.lineTerminatorCharacters===Nn.lineTerminatorCharacters)throw Error(`Error: Missing 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),me(e)?i={modes:{defaultMode:te(e)},defaultMode:$r}:(s=!1,i=te(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Uc(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Gc(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},I(i.modes,(l,c)=>{i.modes[c]=Ht(l,u=>Pe(u))});let o=gt(i.modes);if(I(i.modes,(l,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(Fc(l,o))}),M(this.lexerDefinitionErrors)){It(l);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=Dc(l,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=u.charCodeToPatternIdxToConfig,this.emptyGroups=Ie({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!M(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let c=E(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+c)}I(this.lexerDefinitionWarning,l=>{An(l.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(bo?(this.chopInput=Ys,this.match=this.matchWithTest):(this.updateLastIndex=ue,this.match=this.matchWithExec),s&&(this.handleModes=ue),this.trackStartLines===!1&&(this.computeNewColumn=Ys),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=ue),/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 config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let l=oe(this.canModeBeOptimized,(c,u,f)=>(u===!1&&c.push(f),c),[]);if(t.ensureOptimizations&&!M(l))throw Error(`Lexer Modes: < ${l.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",()=>{Lc()}),this.TRACE_INIT("toFastProperties",()=>{kn(this)})})}tokenize(e,t=this.defaultMode){if(!M(this.lexerDefinitionErrors)){let i=E(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 n,i,s,o,l,c,u,f,d,p,h,g,T,k,R,A,x=e,P=x.length,b=0,xe=0,Rr=this.hasCustom?0:Math.floor(e.length/10),ve=new Array(Rr),Lt=[],ht=this.trackStartLines?1:void 0,v=this.trackStartLines?1:void 0,y=Bc(this.emptyGroups),C=this.trackStartLines,S=this.config.lineTerminatorsPattern,V=0,$=[],O=[],Le=[],Oe=[];Object.freeze(Oe);let ee;function Wt(){return $}a(Wt,"getPossiblePatternsSlow");function Zl(ke){let Xe=ct(ke),Er=O[Xe];return Er===void 0?Oe:Er}a(Zl,"getPossiblePatternsOptimized");let Bd=a(ke=>{if(Le.length===1&&ke.tokenType.PUSH_MODE===void 0){let Xe=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ke);Lt.push({offset:ke.startOffset,line:ke.startLine,column:ke.startColumn,length:ke.image.length,message:Xe})}else{Le.pop();let Xe=Tt(Le);$=this.patternIdxToConfig[Xe],O=this.charCodeToPatternIdxToConfig[Xe],V=$.length;let Er=this.canModeBeOptimized[Xe]&&this.config.safeMode===!1;O&&Er?ee=Zl:ee=Wt}},"pop_mode");function ec(ke){Le.push(ke),O=this.charCodeToPatternIdxToConfig[ke],$=this.patternIdxToConfig[ke],V=$.length,V=$.length;let Xe=this.canModeBeOptimized[ke]&&this.config.safeMode===!1;O&&Xe?ee=Zl:ee=Wt}a(ec,"push_mode"),ec.call(this,t);let Ze,tc=this.config.recoveryEnabled;for(;bc.length){c=o,u=f,Ze=mt;break}}}break}}if(c!==null){if(d=c.length,p=Ze.group,p!==void 0&&(h=Ze.tokenTypeIdx,g=this.createTokenInstance(c,b,h,Ze.tokenType,ht,v,d),this.handlePayload(g,u),p===!1?xe=this.addToken(ve,xe,g):y[p].push(g)),e=this.chopInput(e,d),b=b+d,v=this.computeNewColumn(v,d),C===!0&&Ze.canLineTerminator===!0){let je=0,pt,Ot;S.lastIndex=0;do pt=S.test(c),pt===!0&&(Ot=S.lastIndex-1,je++);while(pt===!0);je!==0&&(ht=ht+je,v=d-Ot,this.updateTokenEndLineColumnLocation(g,p,Ot,je,ht,v,d))}this.handleModes(Ze,Bd,ec,g)}else{let je=b,pt=ht,Ot=v,mt=tc===!1;for(;mt===!1&&b
${Nt(r)} <--`:`token of type --> ${r.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:r,ruleName:e}){return"Redundant input, expecting EOF but found: "+r.image},buildNoViableAltMessage({expectedPathsPerAlt:r,actual:e,previous:t,customUserDescription:n,ruleName:i}){let s="Expecting: ",l=`
but found: '`+Ne(e).image+"'";if(n)return s+n+l;{let c=oe(r,(p,h)=>p.concat(h),[]),u=E(c,p=>`[${E(p,h=>Nt(h)).join(", ")}]`),d=`one of these possible Token sequences:
${E(u,(p,h)=>` ${h+1}. ${p}`).join(`
`)}`;return s+d+l}},buildEarlyExitMessage({expectedIterationPaths:r,actual:e,customUserDescription:t,ruleName:n}){let i="Expecting: ",o=`
but found: '`+Ne(e).image+"'";if(t)return i+t+o;{let c=`expecting at least one iteration which starts with one of these possible Token sequences::
<${E(r,u=>`[${E(u,f=>Nt(f)).join(",")}]`).join(" ,")}>`;return i+c+o}}};Object.freeze(St);var su={buildRuleNotFoundError(r,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+r.name+"<-"}},nt={buildDuplicateFoundError(r,e){function t(f){return f instanceof D?f.terminalType.name:f instanceof H?f.nonTerminalName:""}a(t,"getExtraProductionArgument");let n=r.name,i=Ne(e),s=i.idx,o=Be(i),l=t(i),c=s>0,u=`->${o}${c?s:""}<- ${l?`with argument: ->${l}<-`:""}
appears more than once (${e.length} times) in the top level rule: ->${n}<-.
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(r){return`Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${r.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(r){let e=E(r.prefixPath,i=>Nt(i)).join(", "),t=r.alternation.idx===0?"":r.alternation.idx;return`Ambiguous alternatives: <${r.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in inside <${r.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(r){let e=E(r.prefixPath,i=>Nt(i)).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,n=`Ambiguous Alternatives Detected: <${r.ambiguityIndices.join(" ,")}> in inside <${r.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
`;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,n},buildEmptyRepetitionError(r){let e=Be(r.repetition);return r.repetition.idx!==0&&(e+=r.repetition.idx),`The repetition <${e}> within Rule <${r.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`},buildTokenNameError(r){return"deprecated"},buildEmptyAlternationError(r){return`Ambiguous empty alternative: <${r.emptyChoiceIdx+1}> in inside <${r.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(r){return`An Alternation cannot have more than 256 alternatives:
inside <${r.topLevelRule.name}> Rule.
has ${r.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(r){let e=r.topLevelRule.name,t=E(r.leftRecursionPath,s=>s.name),n=`${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:
${n}
To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(r){return"deprecated"},buildDuplicateRuleNameError(r){let e;return r.topLevelRule instanceof Me?e=r.topLevelRule.name:e=r.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${r.grammarName}<-`}};function au(r,e){let t=new Uo(r,e);return t.resolveRefs(),t.errors}a(au,"resolveGrammar");var Uo=class extends De{static{a(this,"GastRefResolverVisitor")}constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){I(re(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:ye.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var Go=class extends vt{static{a(this,"AbstractNextPossibleTokensWalker")}constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=te(this.path.ruleStack).reverse(),this.occurrenceStack=te(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){M(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},Zi=class extends Go{static{a(this,"NextAfterTokenWalker")}constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=t.concat(n),s=new J({definition:i});this.possibleTokTypes=ar(s),this.found=!0}}},br=class extends vt{static{a(this,"AbstractNextTerminalAfterProductionWalker")}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}},es=class extends br{static{a(this,"NextTerminalAfterManyWalker")}walkMany(e,t,n){if(e.idx===this.occurrence){let i=Ne(t.concat(n));this.result.isEndOfRule=i===void 0,i instanceof D&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,t,n)}},Cn=class extends br{static{a(this,"NextTerminalAfterManySepWalker")}walkManySep(e,t,n){if(e.idx===this.occurrence){let i=Ne(t.concat(n));this.result.isEndOfRule=i===void 0,i instanceof D&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,t,n)}},ts=class extends br{static{a(this,"NextTerminalAfterAtLeastOneWalker")}walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){let i=Ne(t.concat(n));this.result.isEndOfRule=i===void 0,i instanceof D&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,t,n)}},_n=class extends br{static{a(this,"NextTerminalAfterAtLeastOneSepWalker")}walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){let i=Ne(t.concat(n));this.result.isEndOfRule=i===void 0,i instanceof D&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,t,n)}};function rs(r,e,t=[]){t=te(t);let n=[],i=0;function s(l){return l.concat(de(r,i+1))}a(s,"remainingPathWith");function o(l){let c=rs(s(l),e,t);return n.concat(c)}for(a(o,"getAlternativesForProd");t.length{M(c.definition)===!1&&(n=o(c.definition))}),n;if(l instanceof D)t.push(l.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:t,suffixDef:de(r,i)}),n}a(rs,"possiblePathsFrom");function ns(r,e,t,n){let i="EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE",l=!1,c=e.length,u=c-n-1,f=[],d=[];for(d.push({idx:-1,def:r,ruleStack:[],occurrenceStack:[]});!M(d);){let p=d.pop();if(p===o){l&&Tt(d).idx<=u&&d.pop();continue}let h=p.def,g=p.idx,T=p.ruleStack,k=p.occurrenceStack;if(M(h))continue;let R=h[0];if(R===i){let A={idx:g,def:de(h),ruleStack:$t(T),occurrenceStack:$t(k)};d.push(A)}else if(R instanceof D)if(g=0;A--){let x=R.definition[A],P={idx:g,def:x.definition.concat(de(h)),ruleStack:T,occurrenceStack:k};d.push(P),d.push(o)}else if(R instanceof J)d.push({idx:g,def:R.definition.concat(de(h)),ruleStack:T,occurrenceStack:k});else if(R instanceof Me)d.push(sp(R,g,T,k));else throw Error("non exhaustive match")}return f}a(ns,"nextPossibleTokensAfter");function sp(r,e,t,n){let i=te(t);i.push(r.name);let s=te(n);return s.push(1),{idx:e,def:r.definition,ruleStack:i,occurrenceStack:s}}a(sp,"expandTopLevelRule");var ie;(function(r){r[r.OPTION=0]="OPTION",r[r.REPETITION=1]="REPETITION",r[r.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",r[r.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",r[r.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",r[r.ALTERNATION=5]="ALTERNATION"})(ie||(ie={}));function wn(r){if(r instanceof z||r==="Option")return ie.OPTION;if(r instanceof F||r==="Repetition")return ie.REPETITION;if(r instanceof Q||r==="RepetitionMandatory")return ie.REPETITION_MANDATORY;if(r instanceof Z||r==="RepetitionMandatoryWithSeparator")return ie.REPETITION_MANDATORY_WITH_SEPARATOR;if(r instanceof q||r==="RepetitionWithSeparator")return ie.REPETITION_WITH_SEPARATOR;if(r instanceof X||r==="Alternation")return ie.ALTERNATION;throw Error("non exhaustive match")}a(wn,"getProdType");function ss(r){let{occurrence:e,rule:t,prodType:n,maxLookahead:i}=r,s=wn(n);return s===ie.ALTERNATION?Mr(e,t,i):Dr(e,t,s,i)}a(ss,"getLookaheadPaths");function lu(r,e,t,n,i,s){let o=Mr(r,e,t),l=pu(o)?Pr:kt;return s(o,n,l,i)}a(lu,"buildLookaheadFuncForOr");function cu(r,e,t,n,i,s){let o=Dr(r,e,i,t),l=pu(o)?Pr:kt;return s(o[0],l,n)}a(cu,"buildLookaheadFuncForOptionalProd");function uu(r,e,t,n){let i=r.length,s=$e(r,o=>$e(o,l=>l.length===1));if(e)return function(o){let l=E(o,c=>c.GATE);for(let c=0;cfe(c)),l=oe(o,(c,u,f)=>(I(u,d=>{N(c,d.tokenTypeIdx)||(c[d.tokenTypeIdx]=f),I(d.categoryMatches,p=>{N(c,p)||(c[p]=f)})}),c),{});return function(){let c=this.LA(1);return l[c.tokenTypeIdx]}}else return function(){for(let o=0;os.length===1),i=r.length;if(n&&!t){let s=fe(r);if(s.length===1&&M(s[0].categoryMatches)){let l=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===l}}else{let o=oe(s,(l,c,u)=>(l[c.tokenTypeIdx]=!0,I(c.categoryMatches,f=>{l[f]=!0}),l),[]);return function(){let l=this.LA(1);return o[l.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;srs([o],1)),n=ou(t.length),i=E(t,o=>{let l={};return I(o,c=>{let u=Bo(c.partialPath);I(u,f=>{l[f]=!0})}),l}),s=t;for(let o=1;o<=e;o++){let l=s;s=ou(l.length);for(let c=0;c{let R=Bo(k.partialPath);I(R,A=>{i[c][A]=!0})})}}}}return n}a(du,"lookAheadSequenceFromAlternatives");function Mr(r,e,t,n){let i=new is(r,ie.ALTERNATION,n);return e.accept(i),du(i.result,t)}a(Mr,"getLookaheadPathsForOr");function Dr(r,e,t,n){let i=new is(r,t);e.accept(i);let s=i.result,l=new Wo(e,r,t).startWalking(),c=new J({definition:s}),u=new J({definition:l});return du([c,u],n)}a(Dr,"getLookaheadPathsForOptionalProd");function as(r,e){e:for(let t=0;t{let i=e[n];return t===i||i.categoryMatchesMap[t.tokenTypeIdx]})}a(hu,"isStrictPrefixOfPath");function pu(r){return $e(r,e=>$e(e,t=>$e(t,n=>M(n.categoryMatches))))}a(pu,"areTokenCategoriesNotUsed");function mu(r){let e=r.lookaheadStrategy.validate({rules:r.rules,tokenTypes:r.tokenTypes,grammarName:r.grammarName});return E(e,t=>Object.assign({type:ye.CUSTOM_LOOKAHEAD_VALIDATION},t))}a(mu,"validateLookahead");function gu(r,e,t,n){let i=Se(r,c=>op(c,t)),s=hp(r,e,t),o=Se(r,c=>up(c,t)),l=Se(r,c=>cp(c,r,n,t));return i.concat(s,o,l)}a(gu,"validateGrammar");function op(r,e){let t=new jo;r.accept(t);let n=t.allProductions,i=sc(n,lp),s=Ve(i,l=>l.length>1);return E(re(s),l=>{let c=Ne(l),u=e.buildDuplicateFoundError(r,l),f=Be(c),d={message:u,type:ye.DUPLICATE_PRODUCTIONS,ruleName:r.name,dslName:f,occurrence:c.idx},p=yu(c);return p&&(d.parameter=p),d})}a(op,"validateDuplicateProductions");function lp(r){return`${Be(r)}_#_${r.idx}_#_${yu(r)}`}a(lp,"identifyProductionForDuplicates");function yu(r){return r instanceof D?r.terminalType.name:r instanceof H?r.nonTerminalName:""}a(yu,"getExtraProductionArgument");var jo=class extends De{static{a(this,"OccurrenceValidationCollector")}constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function cp(r,e,t,n){let i=[];if(oe(e,(o,l)=>l.name===r.name?o+1:o,0)>1){let o=n.buildDuplicateRuleNameError({topLevelRule:r,grammarName:t});i.push({message:o,type:ye.DUPLICATE_RULE_NAME,ruleName:r.name})}return i}a(cp,"validateRuleDoesNotAlreadyExist");function Tu(r,e,t){let n=[],i;return se(e,r)||(i=`Invalid rule override, rule: ->${r}<- cannot be overridden in the grammar: ->${t}<-as it is not defined in any of the super grammars `,n.push({message:i,type:ye.INVALID_RULE_OVERRIDE,ruleName:r})),n}a(Tu,"validateRuleIsOverridden");function Ko(r,e,t,n=[]){let i=[],s=os(e.definition);if(M(s))return[];{let o=r.name;se(s,r)&&i.push({message:t.buildLeftRecursionError({topLevelRule:r,leftRecursionPath:n}),type:ye.LEFT_RECURSION,ruleName:o});let c=Kt(s,n.concat([r])),u=Se(c,f=>{let d=te(n);return d.push(f),Ko(r,f,t,d)});return i.concat(u)}}a(Ko,"validateNoLeftRecursion");function os(r){let e=[];if(M(r))return e;let t=Ne(r);if(t instanceof H)e.push(t.referencedRule);else if(t instanceof J||t instanceof z||t instanceof Q||t instanceof Z||t instanceof q||t instanceof F)e=e.concat(os(t.definition));else if(t instanceof X)e=fe(E(t.definition,s=>os(s.definition)));else if(!(t instanceof D))throw Error("non exhaustive match");let n=sr(t),i=r.length>1;if(n&&i){let s=de(r);return e.concat(os(s))}else return e}a(os,"getFirstNoneTerminal");var Ln=class extends De{static{a(this,"OrCollector")}constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function xu(r,e){let t=new Ln;r.accept(t);let n=t.alternations;return Se(n,s=>{let o=$t(s.definition);return Se(o,(l,c)=>{let u=ns([l],[],kt,1);return M(u)?[{message:e.buildEmptyAlternationError({topLevelRule:r,alternation:s,emptyChoiceIdx:c}),type:ye.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:s.idx,alternative:c+1}]:[]})})}a(xu,"validateEmptyOrAlternative");function Ru(r,e,t){let n=new Ln;r.accept(n);let i=n.alternations;return i=Ht(i,o=>o.ignoreAmbiguities===!0),Se(i,o=>{let l=o.idx,c=o.maxLookahead||e,u=Mr(l,r,c,o),f=fp(u,o,r,t),d=dp(u,o,r,t);return f.concat(d)})}a(Ru,"validateAmbiguousAlternationAlternatives");var Vo=class extends De{static{a(this,"RepetitionCollector")}constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function up(r,e){let t=new Ln;r.accept(t);let n=t.alternations;return Se(n,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:r,alternation:s}),type:ye.TOO_MANY_ALTS,ruleName:r.name,occurrence:s.idx}]:[])}a(up,"validateTooManyAlts");function Eu(r,e,t){let n=[];return I(r,i=>{let s=new Vo;i.accept(s);let o=s.allProductions;I(o,l=>{let c=wn(l),u=l.maxLookahead||e,f=l.idx,p=Dr(f,i,c,u)[0];if(M(fe(p))){let h=t.buildEmptyRepetitionError({topLevelRule:i,repetition:l});n.push({message:h,type:ye.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}a(Eu,"validateSomeNonEmptyLookaheadPath");function fp(r,e,t,n){let i=[],s=oe(r,(l,c,u)=>(e.definition[u].ignoreAmbiguities===!0||I(c,f=>{let d=[u];I(r,(p,h)=>{u!==h&&as(p,f)&&e.definition[h].ignoreAmbiguities!==!0&&d.push(h)}),d.length>1&&!as(i,f)&&(i.push(f),l.push({alts:d,path:f}))}),l),[]);return E(s,l=>{let c=E(l.alts,f=>f+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:c,prefixPath:l.path}),type:ye.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:l.alts}})}a(fp,"checkAlternativesAmbiguities");function dp(r,e,t,n){let i=oe(r,(o,l,c)=>{let u=E(l,f=>({idx:c,path:f}));return o.concat(u)},[]);return yt(Se(i,o=>{if(e.definition[o.idx].ignoreAmbiguities===!0)return[];let c=o.idx,u=o.path,f=Ee(i,p=>e.definition[p.idx].ignoreAmbiguities!==!0&&p.idx{let h=[p.idx+1,c+1],g=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:h,prefixPath:p.path}),type:ye.AMBIGUOUS_PREFIX_ALTS,ruleName:t.name,occurrence:g,alternatives:h}})}))}a(dp,"checkPrefixAlternativesAmbiguities");function hp(r,e,t){let n=[],i=E(e,s=>s.name);return I(r,s=>{let o=s.name;if(se(i,o)){let l=t.buildNamespaceConflictError(s);n.push({message:l,type:ye.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),n}a(hp,"checkTerminalAndNoneTerminalsNameSpace");function Au(r){let e=an(r,{errMsgProvider:su}),t={};return I(r.rules,n=>{t[n.name]=n}),au(t,e.errMsgProvider)}a(Au,"resolveGrammar");function vu(r){return r=an(r,{errMsgProvider:nt}),gu(r.rules,r.tokenTypes,r.errMsgProvider,r.grammarName)}a(vu,"validateGrammar");var ku="MismatchedTokenException",Iu="NoViableAltException",Nu="EarlyExitException",Su="NotAllInputParsedException",Cu=[ku,Iu,Nu,Su];Object.freeze(Cu);function Dt(r){return se(Cu,r.name)}a(Dt,"isRecognitionException");var Fr=class extends Error{static{a(this,"RecognitionException")}constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},cr=class extends Fr{static{a(this,"MismatchedTokenException")}constructor(e,t,n){super(e,t),this.previousToken=n,this.name=ku}},On=class extends Fr{static{a(this,"NoViableAltException")}constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Iu}},$n=class extends Fr{static{a(this,"NotAllInputParsedException")}constructor(e,t){super(e,t),this.name=Su}},Pn=class extends Fr{static{a(this,"EarlyExitException")}constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Nu}};var Ho={},qo="InRuleRecoveryException",zo=class extends Error{static{a(this,"InRuleRecoveryException")}constructor(e){super(e),this.name=qo}},ls=class{static{a(this,"Recoverable")}initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=N(e,"recoveryEnabled")?e.recoveryEnabled:Fe.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=pp)}getTokenToInsert(e){let t=lr(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,i){let s=this.findReSyncTokenType(),o=this.exportLexerState(),l=[],c=!1,u=this.LA(1),f=this.LA(1),d=a(()=>{let p=this.LA(0),h=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:p,ruleName:this.getCurrRuleFullName()}),g=new cr(h,u,this.LA(0));g.resyncedTokens=$t(l),this.SAVE_ERROR(g)},"generateErrorMessage");for(;!c;)if(this.tokenMatcher(f,i)){d();return}else if(n.call(this)){d(),e.apply(this,t);return}else this.tokenMatcher(f,s)?c=!0:(f=this.SKIP_TOKEN(),this.addToResyncTokens(f,l));this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,t,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){let n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new zo("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||M(t))return!1;let n=this.LA(1);return xt(t,s=>this.tokenMatcher(n,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(t);return se(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA(1),n=2;for(;;){let i=xt(e,s=>Sn(t,s));if(i!==void 0)return i;t=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Ho;let e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return E(e,(n,i)=>i===0?Ho:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:t[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=E(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t));return fe(e)}getFollowSetFromFollowKey(e){if(e===Ho)return[qe];let t=e.ruleName+e.idxInCallingRule+Hi+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,qe)||t.push(e),t}reSyncTo(e){let t=[],n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return $t(t)}attemptInRepetitionRecovery(e,t,n,i,s,o,l){}getCurrentGrammarPath(e,t){let n=this.getHumanReadableRuleStack(),i=te(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return E(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function pp(r,e,t,n,i,s,o){let l=this.getKeyForAutomaticLookahead(n,i),c=this.firstAfterRepMap[l];if(c===void 0){let p=this.getCurrRuleFullName(),h=this.getGAstProductions()[p];c=new s(h,i).startWalking(),this.firstAfterRepMap[l]=c}let u=c.token,f=c.occurrence,d=c.isEndOfRule;this.RULE_STACK.length===1&&d&&u===void 0&&(u=qe,f=1),!(u===void 0||f===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,f,o)&&this.tryInRepetitionRecovery(r,e,t,u)}a(pp,"attemptInRepetitionRecovery");function cs(r,e,t){return t|e|r}a(cs,"getKeyForAutomaticLookahead");var Ct=class{static{a(this,"LLkLookaheadStrategy")}constructor(e){var t;this.maxLookahead=(t=e?.maxLookahead)!==null&&t!==void 0?t:Fe.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(M(t)){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...i,...s]}return t}validateNoLeftRecursion(e){return Se(e,t=>Ko(t,t,nt))}validateEmptyOrAlternatives(e){return Se(e,t=>xu(t,nt))}validateAmbiguousAlternationAlternatives(e,t){return Se(e,n=>Ru(n,t,nt))}validateSomeNonEmptyLookaheadPath(e,t){return Eu(e,t,nt)}buildLookaheadForAlternation(e){return lu(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,uu)}buildLookaheadForOptional(e){return cu(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,wn(e.prodType),fu)}};var fs=class{static{a(this,"LooksAhead")}initLooksAhead(e){this.dynamicTokensEnabled=N(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Fe.dynamicTokensEnabled,this.maxLookahead=N(e,"maxLookahead")?e.maxLookahead:Fe.maxLookahead,this.lookaheadStrategy=N(e,"lookaheadStrategy")?e.lookaheadStrategy:new Ct({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){I(e,t=>{this.TRACE_INIT(`${t.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:s,repetitionMandatory:o,repetitionMandatoryWithSeparator:l,repetitionWithSeparator:c}=mp(t);I(n,u=>{let f=u.idx===0?"":u.idx;this.TRACE_INIT(`${Be(u)}${f}`,()=>{let d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:t,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),p=cs(this.fullRuleNameToShort[t.name],256,u.idx);this.setLaFuncCache(p,d)})}),I(i,u=>{this.computeLookaheadFunc(t,u.idx,768,"Repetition",u.maxLookahead,Be(u))}),I(s,u=>{this.computeLookaheadFunc(t,u.idx,512,"Option",u.maxLookahead,Be(u))}),I(o,u=>{this.computeLookaheadFunc(t,u.idx,1024,"RepetitionMandatory",u.maxLookahead,Be(u))}),I(l,u=>{this.computeLookaheadFunc(t,u.idx,1536,"RepetitionMandatoryWithSeparator",u.maxLookahead,Be(u))}),I(c,u=>{this.computeLookaheadFunc(t,u.idx,1280,"RepetitionWithSeparator",u.maxLookahead,Be(u))})})})}computeLookaheadFunc(e,t,n,i,s,o){this.TRACE_INIT(`${o}${t===0?"":t}`,()=>{let l=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),c=cs(this.fullRuleNameToShort[e.name],n,t);this.setLaFuncCache(c,l)})}getKeyForAutomaticLookahead(e,t){let n=this.getLastExplicitRuleShortName();return cs(n,e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}},Xo=class extends De{static{a(this,"DslMethodsCollectorVisitor")}constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},us=new Xo;function mp(r){us.reset(),r.accept(us);let e=us.dslMethods;return us.reset(),e}a(mp,"collectMethods");function Qo(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.endOffset=e.endOffset):r.endOffseto.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
${s.join(`
`).replace(/\n/g,`
`)}`)}},"validateVisitor")};return t.prototype=n,t.prototype.constructor=t,t._RULE_NAMES=e,t}a(Lu,"createBaseSemanticVisitorConstructor");function Ou(r,e,t){let n=a(function(){},"derivedConstructor");el(n,r+"BaseSemanticsWithDefaults");let i=Object.create(t.prototype);return I(e,s=>{i[s]=yp}),n.prototype=i,n.prototype.constructor=n,n}a(Ou,"createBaseVisitorConstructorWithDefaults");var tl;(function(r){r[r.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",r[r.MISSING_METHOD=1]="MISSING_METHOD"})(tl||(tl={}));function Tp(r,e){return xp(r,e)}a(Tp,"validateVisitor");function xp(r,e){let t=Ee(e,i=>st(r[i])===!1),n=E(t,i=>({msg:`Missing visitor method: <${i}> on ${r.constructor.name} CST Visitor.`,type:tl.MISSING_METHOD,methodName:i}));return yt(n)}a(xp,"validateMissingCstMethods");var ms=class{static{a(this,"TreeBuilder")}initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=N(e,"nodeLocationTracking")?e.nodeLocationTracking:Fe.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=ue,this.cstFinallyStateUpdate=ue,this.cstPostTerminal=ue,this.cstPostNonTerminal=ue,this.cstPostRule=ue;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Zo,this.setNodeLocationFromNode=Zo,this.cstPostRule=ue,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=ue,this.setNodeLocationFromNode=ue,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Qo,this.setNodeLocationFromNode=Qo,this.cstPostRule=ue,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=ue,this.setNodeLocationFromNode=ue,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=ue,this.setNodeLocationFromNode=ue,this.cstPostRule=ue,this.setInitialNodeLocation=ue;else throw Error(`Invalid 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){let t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){let t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=NaN}cstPostTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];_u(n,t,e),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];wu(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(Pe(this.baseCstVisitorConstructor)){let e=Lu(this.className,gt(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Pe(this.baseCstVisitorWithDefaultsConstructor)){let e=Ou(this.className,gt(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}};var gs=class{static{a(this,"LexerAdapter")}initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing 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)):Ur}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Ur: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()}};var ys=class{static{a(this,"RecognizerApi")}ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,n=Gr){if(se(this.definedRulesNames,e)){let o={message:nt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:ye.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(o)}this.definedRulesNames.push(e);let i=this.defineRule(e,t,n);return this[e]=i,i}OVERRIDE_RULE(e,t,n=Gr){let i=Tu(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let s=this.defineRule(e,t,n);return this[e]=s,s}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);let n=this.saveRecogState();try{return e.apply(this,t),!0}catch(i){if(Dt(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Ki(re(this.gastProductionsCache))}};var Ts=class{static{a(this,"RecognizerEngine")}initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Pr,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},N(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property.
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details.`);if(me(e)){if(M(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(me(e))this.tokensMap=oe(e,(s,o)=>(s[o.name]=o,s),{});else if(N(e,"modes")&&$e(fe(re(e.modes)),Yc)){let s=fe(re(e.modes)),o=on(s);this.tokensMap=oe(o,(l,c)=>(l[c.name]=c,l),{})}else if(ic(e))this.tokensMap=te(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=qe;let n=N(e,"modes")?fe(re(e.modes)):re(e),i=$e(n,s=>M(s.categoryMatches));this.tokenMatcher=i?Pr:kt,It(re(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=N(n,"resyncEnabled")?n.resyncEnabled:Gr.resyncEnabled,s=N(n,"recoveryValueFunc")?n.recoveryValueFunc:Gr.recoveryValueFunc,o=this.ruleShortNameIdx<<12;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let l;return this.outputCst===!0?l=a(function(...f){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),t.apply(this,f);let 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()}},"invokeRuleWithTry"):l=a(function(...f){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),t.apply(this,f)}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}},"invokeRuleWithTryCst"),Object.assign(l,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,n){let i=this.RULE_STACK.length===1,s=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Dt(e)){let o=e;if(s){let l=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(l))if(o.resyncedTokens=this.reSyncTo(l),this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return n(e);else{if(this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,o.partialCstResult=c}throw o}}else{if(i)return this.moveToTerminatedState(),n(e);throw o}}else throw e}optionInternal(e,t){let n=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let i=this.getLaFuncFromCache(n),s;if(typeof e!="function"){s=e.DEF;let o=e.GATE;if(o!==void 0){let l=i;i=a(()=>o.call(this)&&l.call(this),"lookAheadFunc")}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,t){let n=this.getKeyForAutomaticLookahead(1024,e);return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let i=this.getLaFuncFromCache(n),s;if(typeof t!="function"){s=t.DEF;let o=t.GATE;if(o!==void 0){let l=i;i=a(()=>o.call(this)&&l.call(this),"lookAheadFunc")}}else s=t;if(i.call(this)===!0){let o=this.doSingleRepetition(s);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,ie.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,1024,e,ts)}atLeastOneSepFirstInternal(e,t){let n=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let i=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let l=a(()=>this.tokenMatcher(this.LA(1),s),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,l,i,_n],l,1536,e,_n)}else throw this.raiseEarlyExitException(e,ie.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let i=this.getLaFuncFromCache(n),s;if(typeof t!="function"){s=t.DEF;let l=t.GATE;if(l!==void 0){let c=i;i=a(()=>l.call(this)&&c.call(this),"lookaheadFunction")}}else s=t;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,es,o)}manySepFirstInternal(e,t){let n=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let i=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let l=a(()=>this.tokenMatcher(this.LA(1),s),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,l,i,Cn],l,1280,e,Cn)}}repetitionSepSecondInternal(e,t,n,i,s){for(;n();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,i,s],n,1536,e,s)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=this.getKeyForAutomaticLookahead(256,t),i=me(e)?e:e.DEF,o=this.getLaFuncFromCache(n).call(this,i);if(o!==void 0)return i[o].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){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new $n(t,e))}}subruleInternal(e,t,n){let i;try{let s=n!==void 0?n.ARGS:void 0;return this.subruleIdx=t,i=e.apply(this,s),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,n,e.ruleName)}}subruleInternalError(e,t,n){throw Dt(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let i;try{let s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,n)}catch(s){i=this.consumeInternalRecovery(e,t,s)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i}consumeInternalError(e,t,n){let i,s=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new cr(i,t,s))}consumeInternalRecovery(e,t,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===qo?n:s}}else throw n}saveRecogState(){let e=this.errors,t=te(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),qe)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}};var xs=class{static{a(this,"ErrorHandler")}initErrorHandler(e){this._errors=[],this.errorMessageProvider=N(e,"errorMessageProvider")?e.errorMessageProvider:Fe.errorMessageProvider}SAVE_ERROR(e){if(Dt(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:te(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return te(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],l=Dr(e,s,t,this.maxLookahead)[0],c=[];for(let f=1;f<=this.maxLookahead;f++)c.push(this.LA(f));let u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:l,actual:c,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new Pn(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],s=Mr(e,i,this.maxLookahead),o=[];for(let u=1;u<=this.maxLookahead;u++)o.push(this.LA(u));let l=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:l,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new On(c,this.LA(1),l))}};var Rs=class{static{a(this,"ContentAssist")}initContentAssist(){}computeContentAssist(e,t){let n=this.gastProductionsCache[e];if(Pe(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return ns([n],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let t=Ne(e.ruleStack),i=this.getGAstProductions()[t];return new Zi(i,e).startWalking()}};var vs={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(vs);var $u=!0,Pu=Math.pow(2,8)-1,Mu=Qi({name:"RECORDING_PHASE_TOKEN",pattern:le.NA});It([Mu]);var Du=lr(Mu,`This IToken indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Du);var Ep={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Es=class{static{a(this,"GastRecorder")}initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";this[`CONSUME${t}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${t}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},this[`OPTION${t}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${t}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${t}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${t}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${t}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${t}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:"";delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return Ur}topLevelRuleRecord(e,t){try{let n=new Me({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.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 n}throw n}}optionInternalRecord(e,t){return Mn.call(this,z,e,t)}atLeastOneInternalRecord(e,t){Mn.call(this,Q,t,e)}atLeastOneSepFirstInternalRecord(e,t){Mn.call(this,Z,t,e,$u)}manyInternalRecord(e,t){Mn.call(this,F,t,e)}manySepFirstInternalRecord(e,t){Mn.call(this,q,t,e,$u)}orInternalRecord(e,t){return Ap.call(this,e,t)}subruleInternalRecord(e,t,n){if(As(t),!e||N(e,"ruleName")===!1){let l=new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw l.KNOWN_RECORDER_ERROR=!0,l}let i=Tt(this.recordingProdStack),s=e.ruleName,o=new H({idx:t,nonTerminalName:s,label:n?.LABEL,referencedRule:void 0});return i.definition.push(o),this.outputCst?Ep:vs}consumeInternalRecord(e,t,n){if(As(t),!Mo(e)){let o=new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}let i=Tt(this.recordingProdStack),s=new D({idx:t,terminalType:e,label:n?.LABEL});return i.definition.push(s),Du}};function Mn(r,e,t,n=!1){As(t);let i=Tt(this.recordingProdStack),s=st(e)?e:e.DEF,o=new r({definition:[],idx:t});return n&&(o.separator=e.SEP),N(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.pop(),vs}a(Mn,"recordProd");function Ap(r,e){As(e);let t=Tt(this.recordingProdStack),n=me(r)===!1,i=n===!1?r:r.DEF,s=new X({definition:[],idx:e,ignoreAmbiguities:n&&r.IGNORE_AMBIGUITIES===!0});N(r,"MAX_LOOKAHEAD")&&(s.maxLookahead=r.MAX_LOOKAHEAD);let o=ki(i,l=>st(l.GATE));return s.hasPredicates=o,t.definition.push(s),I(i,l=>{let c=new J({definition:[]});s.definition.push(c),N(l,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=l.IGNORE_AMBIGUITIES:N(l,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),l.ALT.call(this),this.recordingProdStack.pop()}),vs}a(Ap,"recordOrProd");function bu(r){return r===0?"":`${r}`}a(bu,"getIdxSuffix");function As(r){if(r<0||r>Pu){let e=new Error(`Invalid DSL Method idx value: <${r}>
Idx value must be a none negative value smaller than ${Pu+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}a(As,"assertMethodIdxIsValid");var ks=class{static{a(this,"PerformanceTracer")}initPerformanceTracer(e){if(N(e,"traceInitPerf")){let t=e.traceInitPerf,n=typeof t=="number";this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Fe.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${e}>`);let{time:i,value:s}=vn(t),o=i>10?console.warn:console.log;return this.traceInitIndent time: ${i}ms`),this.traceInitIndent--,s}else return t()}};function Fu(r,e){e.forEach(t=>{let n=t.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let s=Object.getOwnPropertyDescriptor(n,i);s&&(s.get||s.set)?Object.defineProperty(r.prototype,i,s):r.prototype[i]=t.prototype[i]})})}a(Fu,"applyMixins");var Ur=lr(qe,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Ur);var Fe=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:St,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Gr=Object.freeze({recoveryValueFunc:a(()=>{},"recoveryValueFunc"),resyncEnabled:!0}),ye;(function(r){r[r.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",r[r.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",r[r.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",r[r.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",r[r.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",r[r.LEFT_RECURSION=5]="LEFT_RECURSION",r[r.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",r[r.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",r[r.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",r[r.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",r[r.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",r[r.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",r[r.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",r[r.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(ye||(ye={}));function Is(r=void 0){return function(){return r}}a(Is,"EMPTY_ALT");var Dn=class r{static{a(this,"Parser")}static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let t=this.className;this.TRACE_INIT("toFastProps",()=>{kn(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),I(this.definedRulesNames,i=>{let o=this[i].originalGrammarAction,l;this.TRACE_INIT(`${i} Rule`,()=>{l=this.topLevelRuleRecord(i,o)}),this.gastProductionsCache[i]=l})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=Au({rules:re(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(M(n)&&this.skipValidations===!1){let i=vu({rules:re(this.gastProductionsCache),tokenTypes:re(this.tokensMap),errMsgProvider:nt,grammarName:t}),s=mu({lookaheadStrategy:this.lookaheadStrategy,rules:re(this.gastProductionsCache),tokenTypes:re(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(i,s)}}),M(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=wc(re(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:re(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(re(this.gastProductionsCache))})),!r.DEFER_DEFINITION_ERRORS_HANDLING&&!M(this.definitionErrors))throw e=E(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
${e.join(`
-------------------------------
`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initContentAssist(),n.initGastRecorder(t),n.initPerformanceTracer(t),N(t,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated.
Please use the 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:Fe.skipValidations}};Dn.DEFER_DEFINITION_ERRORS_HANDLING=!1;Fu(Dn,[ls,fs,ms,gs,Ts,ys,xs,Rs,Es,ks]);var Fn=class extends Dn{static{a(this,"EmbeddedActionsParser")}constructor(e,t=Fe){let n=te(t);n.outputCst=!1,super(e,n)}};function ur(r,e,t){return`${r.name}_${e}_${t}`}a(ur,"buildATNKey");var Ft=1,kp=2,Uu=4,Gu=5;var jr=7,Ip=8,Np=9,Sp=10,Cp=11,Bu=12,Un=class{static{a(this,"AbstractTransition")}constructor(e){this.target=e}isEpsilon(){return!1}},Br=class extends Un{static{a(this,"AtomTransition")}constructor(e,t){super(e),this.tokenType=t}},Gn=class extends Un{static{a(this,"EpsilonTransition")}constructor(e){super(e)}isEpsilon(){return!0}},Wr=class extends Un{static{a(this,"RuleTransition")}constructor(e,t,n){super(e),this.rule=t,this.followState=n}isEpsilon(){return!0}};function Wu(r){let e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};_p(e,r);let t=r.length;for(let n=0;nju(r,e,o));return Vr(r,e,n,t,...i)}a(Pp,"alternation");function bp(r,e,t){let n=Re(r,e,t,{type:Ft});Ut(r,n);let i=Vr(r,e,n,t,fr(r,e,t));return Mp(r,e,t,i)}a(bp,"option");function fr(r,e,t){let n=Ee(E(t.definition,i=>ju(r,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:Fp(r,n)}a(fr,"block");function Vu(r,e,t,n,i){let s=n.left,o=n.right,l=Re(r,e,t,{type:Cp});Ut(r,l);let c=Re(r,e,t,{type:Bu});return s.loopback=l,c.loopback=l,r.decisionMap[ur(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",t.idx)]=l,he(o,l),i===void 0?(he(l,s),he(l,c)):(he(l,c),he(l,i.left),he(i.right,s)),{left:s,right:c}}a(Vu,"plus");function Ku(r,e,t,n,i){let s=n.left,o=n.right,l=Re(r,e,t,{type:Sp});Ut(r,l);let c=Re(r,e,t,{type:Bu}),u=Re(r,e,t,{type:Np});return l.loopback=u,c.loopback=u,he(l,s),he(l,c),he(o,u),i!==void 0?(he(u,c),he(u,i.left),he(i.right,s)):he(u,l),r.decisionMap[ur(e,i?"RepetitionWithSeparator":"Repetition",t.idx)]=l,{left:l,right:c}}a(Ku,"star");function Mp(r,e,t,n){let i=n.left,s=n.right;return he(i,s),r.decisionMap[ur(e,"Option",t.idx)]=i,n}a(Mp,"optional");function Ut(r,e){return r.decisionStates.push(e),e.decision=r.decisionStates.length-1,e.decision}a(Ut,"defineDecisionState");function Vr(r,e,t,n,...i){let s=Re(r,e,n,{type:Ip,start:t});t.end=s;for(let l of i)l!==void 0?(he(t,l.left),he(l.right,s)):he(t,s);let o={left:t,right:s};return r.decisionMap[ur(e,Dp(n),n.idx)]=t,o}a(Vr,"makeAlts");function Dp(r){if(r instanceof X)return"Alternation";if(r instanceof z)return"Option";if(r instanceof F)return"Repetition";if(r instanceof q)return"RepetitionWithSeparator";if(r instanceof Q)return"RepetitionMandatory";if(r instanceof Z)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}a(Dp,"getProdType");function Fp(r,e){let t=e.length;for(let s=0;se.alt)}get key(){let e="";for(let t in this.map)e+=t+":";return e}};function sl(r,e=!0){return`${e?`a${r.alt}`:""}s${r.state.stateNumber}:${r.stack.map(t=>t.stateNumber.toString()).join("_")}`}a(sl,"getATNConfigKey");function Wp(r,e){let t={};return n=>{let i=n.toString(),s=t[i];return s!==void 0||(s={atnStartState:r,decision:e,states:{}},t[i]=s),s}}a(Wp,"createDFACache");var Ns=class{static{a(this,"PredicateSet")}constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,t){this.predicates[e]=t}toString(){let e="",t=this.predicates.length;for(let n=0;nconsole.log(n)}initialize(e){this.atn=Wu(e.rules),this.dfas=jp(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){let{prodOccurrence:t,rule:n,hasPredicates:i,dynamicTokensEnabled:s}=e,o=this.dfas,l=this.logging,c=ur(n,"Alternation",t),f=this.atn.decisionMap[c].decision,d=E(ss({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:n}),p=>E(p,h=>h[0]));if(zu(d,!1)&&!s){let p=oe(d,(h,g,T)=>(I(g,k=>{k&&(h[k.tokenTypeIdx]=T,I(k.categoryMatches,R=>{h[R]=T}))}),h),{});return i?function(h){var g;let T=this.LA(1),k=p[T.tokenTypeIdx];if(h!==void 0&&k!==void 0){let R=(g=h[k])===null||g===void 0?void 0:g.GATE;if(R!==void 0&&R.call(this)===!1)return}return k}:function(){let h=this.LA(1);return p[h.tokenTypeIdx]}}else return i?function(p){let h=new Ns,g=p===void 0?0:p.length;for(let k=0;kE(p,h=>h[0]));if(zu(d)&&d[0][0]&&!s){let p=d[0],h=fe(p);if(h.length===1&&M(h[0].categoryMatches)){let T=h[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===T}}else{let g=oe(h,(T,k)=>(k!==void 0&&(T[k.tokenTypeIdx]=!0,I(k.categoryMatches,R=>{T[R]=!0})),T),{});return function(){let T=this.LA(1);return g[T.tokenTypeIdx]===!0}}}return function(){let p=al.call(this,o,f,Hu,l);return typeof p=="object"?!1:p===0}}};function zu(r,e=!0){let t=new Set;for(let n of r){let i=new Set;for(let s of n){if(s===void 0){if(e)break;return!1}let o=[s.tokenTypeIdx].concat(s.categoryMatches);for(let l of o)if(t.has(l)){if(!i.has(l))return!1}else t.add(l),i.add(l)}}return!0}a(zu,"isLL1Sequence");function jp(r){let e=r.decisionStates.length,t=Array(e);for(let n=0;nNt(i)).join(", "),t=r.production.idx===0?"":r.production.idx,n=`Ambiguous Alternatives Detected: <${r.ambiguityIndices.join(", ")}> in <${qp(r.production)}${t}> inside <${r.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
`;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,n}a(zp,"buildAmbiguityError");function qp(r){if(r instanceof H)return"SUBRULE";if(r instanceof z)return"OPTION";if(r instanceof X)return"OR";if(r instanceof Q)return"AT_LEAST_ONE";if(r instanceof Z)return"AT_LEAST_ONE_SEP";if(r instanceof q)return"MANY_SEP";if(r instanceof F)return"MANY";if(r instanceof D)return"CONSUME";throw Error("non exhaustive match")}a(qp,"getProductionDslName");function Xp(r,e,t){let n=Se(e.configs.elements,s=>s.state.transitions),i=oc(n.filter(s=>s instanceof Br).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:t,possibleTokenTypes:i,tokenPath:r}}a(Xp,"buildAdaptivePredictError");function Yp(r,e){return r.edges[e.tokenTypeIdx]}a(Yp,"getExistingTargetState");function Jp(r,e,t){let n=new Kr,i=[];for(let o of r.elements){if(t.is(o.alt)===!1)continue;if(o.state.type===jr){i.push(o);continue}let l=o.state.transitions.length;for(let c=0;c0&&!rm(s))for(let o of i)s.add(o);return s}a(Jp,"computeReachSet");function Qp(r,e){if(r instanceof Br&&Sn(e,r.tokenType))return r.target}a(Qp,"getReachableTarget");function Zp(r,e){let t;for(let n of r.elements)if(e.is(n.alt)===!0){if(t===void 0)t=n.alt;else if(t!==n.alt)return}return t}a(Zp,"getUniqueAlt");function Xu(r){return{configs:r,edges:{},isAcceptState:!1,prediction:-1}}a(Xu,"newDFAState");function qu(r,e,t,n){return n=Yu(r,n),e.edges[t.tokenTypeIdx]=n,n}a(qu,"addDFAEdge");function Yu(r,e){if(e===Bn)return e;let t=e.configs.key,n=r.states[t];return n!==void 0?n:(e.configs.finalize(),r.states[t]=e,e)}a(Yu,"addDFAState");function em(r){let e=new Kr,t=r.transitions.length;for(let n=0;n0){let i=[...r.stack],o={state:i.pop(),alt:r.alt,stack:i};Ss(o,e)}else e.add(r);return}t.epsilonOnlyTransitions||e.add(r);let n=t.transitions.length;for(let i=0;i1)return!0;return!1}a(am,"hasConflictingAltSet");function om(r){for(let e of Array.from(r.values()))if(Object.keys(e).length===1)return!0;return!1}a(om,"hasStateAssociatedWithOneAlt");var Ju;(function(r){function e(t){return typeof t=="string"}a(e,"is"),r.is=e})(Ju||(Ju={}));var ol;(function(r){function e(t){return typeof t=="string"}a(e,"is"),r.is=e})(ol||(ol={}));var Qu;(function(r){r.MIN_VALUE=-2147483648,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}a(e,"is"),r.is=e})(Qu||(Qu={}));var Cs;(function(r){r.MIN_VALUE=0,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}a(e,"is"),r.is=e})(Cs||(Cs={}));var B;(function(r){function e(n,i){return n===Number.MAX_VALUE&&(n=Cs.MAX_VALUE),i===Number.MAX_VALUE&&(i=Cs.MAX_VALUE),{line:n,character:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.uinteger(i.line)&&m.uinteger(i.character)}a(t,"is"),r.is=t})(B||(B={}));var U;(function(r){function e(n,i,s,o){if(m.uinteger(n)&&m.uinteger(i)&&m.uinteger(s)&&m.uinteger(o))return{start:B.create(n,i),end:B.create(s,o)};if(B.is(n)&&B.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${s}, ${o}]`)}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&B.is(i.start)&&B.is(i.end)}a(t,"is"),r.is=t})(U||(U={}));var _s;(function(r){function e(n,i){return{uri:n,range:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&U.is(i.range)&&(m.string(i.uri)||m.undefined(i.uri))}a(t,"is"),r.is=t})(_s||(_s={}));var Zu;(function(r){function e(n,i,s,o){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&U.is(i.targetRange)&&m.string(i.targetUri)&&U.is(i.targetSelectionRange)&&(U.is(i.originSelectionRange)||m.undefined(i.originSelectionRange))}a(t,"is"),r.is=t})(Zu||(Zu={}));var ll;(function(r){function e(n,i,s,o){return{red:n,green:i,blue:s,alpha:o}}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.numberRange(i.red,0,1)&&m.numberRange(i.green,0,1)&&m.numberRange(i.blue,0,1)&&m.numberRange(i.alpha,0,1)}a(t,"is"),r.is=t})(ll||(ll={}));var ef;(function(r){function e(n,i){return{range:n,color:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&U.is(i.range)&&ll.is(i.color)}a(t,"is"),r.is=t})(ef||(ef={}));var tf;(function(r){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.string(i.label)&&(m.undefined(i.textEdit)||zr.is(i))&&(m.undefined(i.additionalTextEdits)||m.typedArray(i.additionalTextEdits,zr.is))}a(t,"is"),r.is=t})(tf||(tf={}));var rf;(function(r){r.Comment="comment",r.Imports="imports",r.Region="region"})(rf||(rf={}));var nf;(function(r){function e(n,i,s,o,l,c){let u={startLine:n,endLine:i};return m.defined(s)&&(u.startCharacter=s),m.defined(o)&&(u.endCharacter=o),m.defined(l)&&(u.kind=l),m.defined(c)&&(u.collapsedText=c),u}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.uinteger(i.startLine)&&m.uinteger(i.startLine)&&(m.undefined(i.startCharacter)||m.uinteger(i.startCharacter))&&(m.undefined(i.endCharacter)||m.uinteger(i.endCharacter))&&(m.undefined(i.kind)||m.string(i.kind))}a(t,"is"),r.is=t})(nf||(nf={}));var cl;(function(r){function e(n,i){return{location:n,message:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&_s.is(i.location)&&m.string(i.message)}a(t,"is"),r.is=t})(cl||(cl={}));var sf;(function(r){r.Error=1,r.Warning=2,r.Information=3,r.Hint=4})(sf||(sf={}));var af;(function(r){r.Unnecessary=1,r.Deprecated=2})(af||(af={}));var of;(function(r){function e(t){let n=t;return m.objectLiteral(n)&&m.string(n.href)}a(e,"is"),r.is=e})(of||(of={}));var ws;(function(r){function e(n,i,s,o,l,c){let u={range:n,message:i};return m.defined(s)&&(u.severity=s),m.defined(o)&&(u.code=o),m.defined(l)&&(u.source=l),m.defined(c)&&(u.relatedInformation=c),u}a(e,"create"),r.create=e;function t(n){var i;let s=n;return m.defined(s)&&U.is(s.range)&&m.string(s.message)&&(m.number(s.severity)||m.undefined(s.severity))&&(m.integer(s.code)||m.string(s.code)||m.undefined(s.code))&&(m.undefined(s.codeDescription)||m.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(m.string(s.source)||m.undefined(s.source))&&(m.undefined(s.relatedInformation)||m.typedArray(s.relatedInformation,cl.is))}a(t,"is"),r.is=t})(ws||(ws={}));var Hr;(function(r){function e(n,i,...s){let o={title:n,command:i};return m.defined(s)&&s.length>0&&(o.arguments=s),o}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.title)&&m.string(i.command)}a(t,"is"),r.is=t})(Hr||(Hr={}));var zr;(function(r){function e(s,o){return{range:s,newText:o}}a(e,"replace"),r.replace=e;function t(s,o){return{range:{start:s,end:s},newText:o}}a(t,"insert"),r.insert=t;function n(s){return{range:s,newText:""}}a(n,"del"),r.del=n;function i(s){let o=s;return m.objectLiteral(o)&&m.string(o.newText)&&U.is(o.range)}a(i,"is"),r.is=i})(zr||(zr={}));var ul;(function(r){function e(n,i,s){let o={label:n};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.string(i.label)&&(m.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(m.string(i.description)||i.description===void 0)}a(t,"is"),r.is=t})(ul||(ul={}));var qr;(function(r){function e(t){let n=t;return m.string(n)}a(e,"is"),r.is=e})(qr||(qr={}));var lf;(function(r){function e(s,o,l){return{range:s,newText:o,annotationId:l}}a(e,"replace"),r.replace=e;function t(s,o,l){return{range:{start:s,end:s},newText:o,annotationId:l}}a(t,"insert"),r.insert=t;function n(s,o){return{range:s,newText:"",annotationId:o}}a(n,"del"),r.del=n;function i(s){let o=s;return zr.is(o)&&(ul.is(o.annotationId)||qr.is(o.annotationId))}a(i,"is"),r.is=i})(lf||(lf={}));var fl;(function(r){function e(n,i){return{textDocument:n,edits:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&gl.is(i.textDocument)&&Array.isArray(i.edits)}a(t,"is"),r.is=t})(fl||(fl={}));var dl;(function(r){function e(n,i,s){let o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}a(e,"create"),r.create=e;function t(n){let i=n;return i&&i.kind==="create"&&m.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||m.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||m.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qr.is(i.annotationId))}a(t,"is"),r.is=t})(dl||(dl={}));var hl;(function(r){function e(n,i,s,o){let l={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(l.options=s),o!==void 0&&(l.annotationId=o),l}a(e,"create"),r.create=e;function t(n){let i=n;return i&&i.kind==="rename"&&m.string(i.oldUri)&&m.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||m.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||m.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qr.is(i.annotationId))}a(t,"is"),r.is=t})(hl||(hl={}));var pl;(function(r){function e(n,i,s){let o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}a(e,"create"),r.create=e;function t(n){let i=n;return i&&i.kind==="delete"&&m.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||m.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||m.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||qr.is(i.annotationId))}a(t,"is"),r.is=t})(pl||(pl={}));var ml;(function(r){function e(t){let n=t;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>m.string(i.kind)?dl.is(i)||hl.is(i)||pl.is(i):fl.is(i)))}a(e,"is"),r.is=e})(ml||(ml={}));var cf;(function(r){function e(n){return{uri:n}}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.uri)}a(t,"is"),r.is=t})(cf||(cf={}));var uf;(function(r){function e(n,i){return{uri:n,version:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.uri)&&m.integer(i.version)}a(t,"is"),r.is=t})(uf||(uf={}));var gl;(function(r){function e(n,i){return{uri:n,version:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.uri)&&(i.version===null||m.integer(i.version))}a(t,"is"),r.is=t})(gl||(gl={}));var ff;(function(r){function e(n,i,s,o){return{uri:n,languageId:i,version:s,text:o}}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.uri)&&m.string(i.languageId)&&m.integer(i.version)&&m.string(i.text)}a(t,"is"),r.is=t})(ff||(ff={}));var yl;(function(r){r.PlainText="plaintext",r.Markdown="markdown";function e(t){let n=t;return n===r.PlainText||n===r.Markdown}a(e,"is"),r.is=e})(yl||(yl={}));var jn;(function(r){function e(t){let n=t;return m.objectLiteral(t)&&yl.is(n.kind)&&m.string(n.value)}a(e,"is"),r.is=e})(jn||(jn={}));var df;(function(r){r.Text=1,r.Method=2,r.Function=3,r.Constructor=4,r.Field=5,r.Variable=6,r.Class=7,r.Interface=8,r.Module=9,r.Property=10,r.Unit=11,r.Value=12,r.Enum=13,r.Keyword=14,r.Snippet=15,r.Color=16,r.File=17,r.Reference=18,r.Folder=19,r.EnumMember=20,r.Constant=21,r.Struct=22,r.Event=23,r.Operator=24,r.TypeParameter=25})(df||(df={}));var hf;(function(r){r.PlainText=1,r.Snippet=2})(hf||(hf={}));var pf;(function(r){r.Deprecated=1})(pf||(pf={}));var mf;(function(r){function e(n,i,s){return{newText:n,insert:i,replace:s}}a(e,"create"),r.create=e;function t(n){let i=n;return i&&m.string(i.newText)&&U.is(i.insert)&&U.is(i.replace)}a(t,"is"),r.is=t})(mf||(mf={}));var gf;(function(r){r.asIs=1,r.adjustIndentation=2})(gf||(gf={}));var yf;(function(r){function e(t){let n=t;return n&&(m.string(n.detail)||n.detail===void 0)&&(m.string(n.description)||n.description===void 0)}a(e,"is"),r.is=e})(yf||(yf={}));var Tf;(function(r){function e(t){return{label:t}}a(e,"create"),r.create=e})(Tf||(Tf={}));var xf;(function(r){function e(t,n){return{items:t||[],isIncomplete:!!n}}a(e,"create"),r.create=e})(xf||(xf={}));var Ls;(function(r){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}a(e,"fromPlainText"),r.fromPlainText=e;function t(n){let i=n;return m.string(i)||m.objectLiteral(i)&&m.string(i.language)&&m.string(i.value)}a(t,"is"),r.is=t})(Ls||(Ls={}));var Rf;(function(r){function e(t){let n=t;return!!n&&m.objectLiteral(n)&&(jn.is(n.contents)||Ls.is(n.contents)||m.typedArray(n.contents,Ls.is))&&(t.range===void 0||U.is(t.range))}a(e,"is"),r.is=e})(Rf||(Rf={}));var Ef;(function(r){function e(t,n){return n?{label:t,documentation:n}:{label:t}}a(e,"create"),r.create=e})(Ef||(Ef={}));var Af;(function(r){function e(t,n,...i){let s={label:t};return m.defined(n)&&(s.documentation=n),m.defined(i)?s.parameters=i:s.parameters=[],s}a(e,"create"),r.create=e})(Af||(Af={}));var vf;(function(r){r.Text=1,r.Read=2,r.Write=3})(vf||(vf={}));var kf;(function(r){function e(t,n){let i={range:t};return m.number(n)&&(i.kind=n),i}a(e,"create"),r.create=e})(kf||(kf={}));var If;(function(r){r.File=1,r.Module=2,r.Namespace=3,r.Package=4,r.Class=5,r.Method=6,r.Property=7,r.Field=8,r.Constructor=9,r.Enum=10,r.Interface=11,r.Function=12,r.Variable=13,r.Constant=14,r.String=15,r.Number=16,r.Boolean=17,r.Array=18,r.Object=19,r.Key=20,r.Null=21,r.EnumMember=22,r.Struct=23,r.Event=24,r.Operator=25,r.TypeParameter=26})(If||(If={}));var Nf;(function(r){r.Deprecated=1})(Nf||(Nf={}));var Sf;(function(r){function e(t,n,i,s,o){let l={name:t,kind:n,location:{uri:s,range:i}};return o&&(l.containerName=o),l}a(e,"create"),r.create=e})(Sf||(Sf={}));var Cf;(function(r){function e(t,n,i,s){return s!==void 0?{name:t,kind:n,location:{uri:i,range:s}}:{name:t,kind:n,location:{uri:i}}}a(e,"create"),r.create=e})(Cf||(Cf={}));var _f;(function(r){function e(n,i,s,o,l,c){let u={name:n,detail:i,kind:s,range:o,selectionRange:l};return c!==void 0&&(u.children=c),u}a(e,"create"),r.create=e;function t(n){let i=n;return i&&m.string(i.name)&&m.number(i.kind)&&U.is(i.range)&&U.is(i.selectionRange)&&(i.detail===void 0||m.string(i.detail))&&(i.deprecated===void 0||m.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}a(t,"is"),r.is=t})(_f||(_f={}));var wf;(function(r){r.Empty="",r.QuickFix="quickfix",r.Refactor="refactor",r.RefactorExtract="refactor.extract",r.RefactorInline="refactor.inline",r.RefactorRewrite="refactor.rewrite",r.Source="source",r.SourceOrganizeImports="source.organizeImports",r.SourceFixAll="source.fixAll"})(wf||(wf={}));var Os;(function(r){r.Invoked=1,r.Automatic=2})(Os||(Os={}));var Lf;(function(r){function e(n,i,s){let o={diagnostics:n};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&m.typedArray(i.diagnostics,ws.is)&&(i.only===void 0||m.typedArray(i.only,m.string))&&(i.triggerKind===void 0||i.triggerKind===Os.Invoked||i.triggerKind===Os.Automatic)}a(t,"is"),r.is=t})(Lf||(Lf={}));var Of;(function(r){function e(n,i,s){let o={title:n},l=!0;return typeof i=="string"?(l=!1,o.kind=i):Hr.is(i)?o.command=i:o.edit=i,l&&s!==void 0&&(o.kind=s),o}a(e,"create"),r.create=e;function t(n){let i=n;return i&&m.string(i.title)&&(i.diagnostics===void 0||m.typedArray(i.diagnostics,ws.is))&&(i.kind===void 0||m.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Hr.is(i.command))&&(i.isPreferred===void 0||m.boolean(i.isPreferred))&&(i.edit===void 0||ml.is(i.edit))}a(t,"is"),r.is=t})(Of||(Of={}));var $f;(function(r){function e(n,i){let s={range:n};return m.defined(i)&&(s.data=i),s}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&U.is(i.range)&&(m.undefined(i.command)||Hr.is(i.command))}a(t,"is"),r.is=t})($f||($f={}));var Pf;(function(r){function e(n,i){return{tabSize:n,insertSpaces:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&m.uinteger(i.tabSize)&&m.boolean(i.insertSpaces)}a(t,"is"),r.is=t})(Pf||(Pf={}));var bf;(function(r){function e(n,i,s){return{range:n,target:i,data:s}}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&U.is(i.range)&&(m.undefined(i.target)||m.string(i.target))}a(t,"is"),r.is=t})(bf||(bf={}));var Mf;(function(r){function e(n,i){return{range:n,parent:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&U.is(i.range)&&(i.parent===void 0||r.is(i.parent))}a(t,"is"),r.is=t})(Mf||(Mf={}));var Df;(function(r){r.namespace="namespace",r.type="type",r.class="class",r.enum="enum",r.interface="interface",r.struct="struct",r.typeParameter="typeParameter",r.parameter="parameter",r.variable="variable",r.property="property",r.enumMember="enumMember",r.event="event",r.function="function",r.method="method",r.macro="macro",r.keyword="keyword",r.modifier="modifier",r.comment="comment",r.string="string",r.number="number",r.regexp="regexp",r.operator="operator",r.decorator="decorator"})(Df||(Df={}));var Ff;(function(r){r.declaration="declaration",r.definition="definition",r.readonly="readonly",r.static="static",r.deprecated="deprecated",r.abstract="abstract",r.async="async",r.modification="modification",r.documentation="documentation",r.defaultLibrary="defaultLibrary"})(Ff||(Ff={}));var Uf;(function(r){function e(t){let n=t;return m.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}a(e,"is"),r.is=e})(Uf||(Uf={}));var Gf;(function(r){function e(n,i){return{range:n,text:i}}a(e,"create"),r.create=e;function t(n){let i=n;return i!=null&&U.is(i.range)&&m.string(i.text)}a(t,"is"),r.is=t})(Gf||(Gf={}));var Bf;(function(r){function e(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}a(e,"create"),r.create=e;function t(n){let i=n;return i!=null&&U.is(i.range)&&m.boolean(i.caseSensitiveLookup)&&(m.string(i.variableName)||i.variableName===void 0)}a(t,"is"),r.is=t})(Bf||(Bf={}));var Wf;(function(r){function e(n,i){return{range:n,expression:i}}a(e,"create"),r.create=e;function t(n){let i=n;return i!=null&&U.is(i.range)&&(m.string(i.expression)||i.expression===void 0)}a(t,"is"),r.is=t})(Wf||(Wf={}));var jf;(function(r){function e(n,i){return{frameId:n,stoppedLocation:i}}a(e,"create"),r.create=e;function t(n){let i=n;return m.defined(i)&&U.is(n.stoppedLocation)}a(t,"is"),r.is=t})(jf||(jf={}));var Tl;(function(r){r.Type=1,r.Parameter=2;function e(t){return t===1||t===2}a(e,"is"),r.is=e})(Tl||(Tl={}));var xl;(function(r){function e(n){return{value:n}}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&(i.tooltip===void 0||m.string(i.tooltip)||jn.is(i.tooltip))&&(i.location===void 0||_s.is(i.location))&&(i.command===void 0||Hr.is(i.command))}a(t,"is"),r.is=t})(xl||(xl={}));var Vf;(function(r){function e(n,i,s){let o={position:n,label:i};return s!==void 0&&(o.kind=s),o}a(e,"create"),r.create=e;function t(n){let i=n;return m.objectLiteral(i)&&B.is(i.position)&&(m.string(i.label)||m.typedArray(i.label,xl.is))&&(i.kind===void 0||Tl.is(i.kind))&&i.textEdits===void 0||m.typedArray(i.textEdits,zr.is)&&(i.tooltip===void 0||m.string(i.tooltip)||jn.is(i.tooltip))&&(i.paddingLeft===void 0||m.boolean(i.paddingLeft))&&(i.paddingRight===void 0||m.boolean(i.paddingRight))}a(t,"is"),r.is=t})(Vf||(Vf={}));var Kf;(function(r){function e(t){return{kind:"snippet",value:t}}a(e,"createSnippet"),r.createSnippet=e})(Kf||(Kf={}));var Hf;(function(r){function e(t,n,i,s){return{insertText:t,filterText:n,range:i,command:s}}a(e,"create"),r.create=e})(Hf||(Hf={}));var zf;(function(r){function e(t){return{items:t}}a(e,"create"),r.create=e})(zf||(zf={}));var qf;(function(r){r.Invoked=0,r.Automatic=1})(qf||(qf={}));var Xf;(function(r){function e(t,n){return{range:t,text:n}}a(e,"create"),r.create=e})(Xf||(Xf={}));var Yf;(function(r){function e(t,n){return{triggerKind:t,selectedCompletionInfo:n}}a(e,"create"),r.create=e})(Yf||(Yf={}));var Jf;(function(r){function e(t){let n=t;return m.objectLiteral(n)&&ol.is(n.uri)&&m.string(n.name)}a(e,"is"),r.is=e})(Jf||(Jf={}));var Qf;(function(r){function e(s,o,l,c){return new Rl(s,o,l,c)}a(e,"create"),r.create=e;function t(s){let o=s;return!!(m.defined(o)&&m.string(o.uri)&&(m.undefined(o.languageId)||m.string(o.languageId))&&m.uinteger(o.lineCount)&&m.func(o.getText)&&m.func(o.positionAt)&&m.func(o.offsetAt))}a(t,"is"),r.is=t;function n(s,o){let l=s.getText(),c=i(o,(f,d)=>{let p=f.range.start.line-d.range.start.line;return p===0?f.range.start.character-d.range.start.character:p}),u=l.length;for(let f=c.length-1;f>=0;f--){let d=c[f],p=s.offsetAt(d.range.start),h=s.offsetAt(d.range.end);if(h<=u)l=l.substring(0,p)+d.newText+l.substring(h,l.length);else throw new Error("Overlapping edit");u=p}return l}a(n,"applyEdits"),r.applyEdits=n;function i(s,o){if(s.length<=1)return s;let l=s.length/2|0,c=s.slice(0,l),u=s.slice(l);i(c,o),i(u,o);let f=0,d=0,p=0;for(;f0&&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(),n=0,i=t.length;if(i===0)return B.create(0,e);for(;ne?i=o:n=o+1}let s=n-1;return B.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 n=t[e.line],i=e.line+1"u"}a(n,"undefined"),r.undefined=n;function i(h){return h===!0||h===!1}a(i,"boolean"),r.boolean=i;function s(h){return e.call(h)==="[object String]"}a(s,"string"),r.string=s;function o(h){return e.call(h)==="[object Number]"}a(o,"number"),r.number=o;function l(h,g,T){return e.call(h)==="[object Number]"&&g<=h&&h<=T}a(l,"numberRange"),r.numberRange=l;function c(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}a(c,"integer"),r.integer=c;function u(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}a(u,"uinteger"),r.uinteger=u;function f(h){return e.call(h)==="[object Function]"}a(f,"func"),r.func=f;function d(h){return h!==null&&typeof h=="object"}a(d,"objectLiteral"),r.objectLiteral=d;function p(h,g){return Array.isArray(h)&&h.every(g)}a(p,"typedArray"),r.typedArray=p})(m||(m={}));var Vn=class{static{a(this,"CstNodeBuilder")}constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new Xr(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new hr;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let n=new dr(e.startOffset,e.image.length,vr(e),e.tokenType,!1);return n.grammarSource=t,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){let t=e.container;if(t){let n=t.content.indexOf(e);n>=0&&t.content.splice(n,1)}}construct(e){let t=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=t;let n=this.nodeStack.pop();n?.content.length===0&&this.removeNode(n)}addHiddenTokens(e){for(let t of e){let n=new dr(t.startOffset,t.image.length,vr(t),t.tokenType,!0);n.root=this.rootNode,this.addHiddenToken(this.rootNode,n)}}addHiddenToken(e,t){let{offset:n,end:i}=t;for(let s=0;sl&&i=0;e--){let t=this.content[e];if(!t.hidden)return t}return this.content[this.content.length-1]}},El=class r extends Array{static{a(this,"CstNodeContainer")}constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,r.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...n){return this.addParents(n),super.splice(e,t,...n)}addParents(e){for(let t of e)t.container=this.parent}},Xr=class extends hr{static{a(this,"RootCstNodeImpl")}get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}};var $s=Symbol("Datatype");function Al(r){return r.$type===$s}a(Al,"isDataTypeNode");var Zf="\u200B",ed=a(r=>r.endsWith(Zf)?r:r+Zf,"withRuleSuffix"),Hn=class{static{a(this,"AbstractLangiumParser")}constructor(e){this._unorderedGroups=new Map,this.lexer=e.parser.Lexer;let t=this.lexer.definition;this.wrapper=new vl(t,Object.assign(Object.assign({},e.parser.ParserConfig),{errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},zn=class extends Hn{static{a(this,"LangiumParser")}get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Vn,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){let n=e.fragment?void 0:En(e)?$s:ir(e),i=this.wrapper.DEFINE_RULE(ed(e.name),this.startImplementation(n,t).bind(this));return e.entry&&(this.mainRule=i),i}parse(e){this.nodeBuilder.buildRootNode(e);let t=this.lexer.tokenize(e);this.wrapper.input=t.tokens;let n=this.mainRule.call(this.wrapper,{});return this.nodeBuilder.addHiddenTokens(t.hidden),this.unorderedGroups.clear(),{value:n,lexerErrors:t.errors,parserErrors:this.wrapper.errors}}startImplementation(e,t){return n=>{if(!this.isRecording()){let s={$type:e};this.stack.push(s),e===$s&&(s.value="")}let i;try{i=t(n)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,t,n){let i=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(i)){let s=this.nodeBuilder.buildLeafNode(i,n),{assignment:o,isCrossRef:l}=this.getAssignment(n),c=this.current;if(o){let u=Je(n)?i.image:this.converter.convert(i.image,s);this.assign(o.operator,o.feature,u,s,l)}else if(Al(c)){let u=i.image;Je(n)||(u=this.converter.convert(u,s).toString()),c.value+=u}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,t,n,i){let s;this.isRecording()||(s=this.nodeBuilder.buildCompositeNode(n));let o=this.wrapper.wrapSubrule(e,t,i);!this.isRecording()&&s&&s.length>0&&this.performSubruleAssignment(o,n,s)}performSubruleAssignment(e,t,n){let{assignment:i,isCrossRef:s}=this.getAssignment(t);if(i)this.assign(i.operator,i.feature,e,n,s);else if(!i){let o=this.current;if(Al(o))o.value+=e.toString();else if(typeof e=="object"&&e){let l=e.$type,c=this.assignWithoutOverride(e,o);l&&(c.$type=l);let u=c;this.stack.pop(),this.stack.push(u)}}}action(e,t){if(!this.isRecording()){let n=this.current;if(!n.$cstNode&&t.feature&&t.operator){n=this.construct(!1);let s=n.$cstNode.feature;this.nodeBuilder.buildCompositeNode(s)}let i={$type:e};this.stack.pop(),this.stack.push(i),t.feature&&t.operator&&this.assign(t.operator,t.feature,n,n.$cstNode,!1)}}construct(e=!0){if(this.isRecording())return;let t=this.current;return Di(t),this.nodeBuilder.construct(t),e&&this.stack.pop(),Al(t)?this.converter.convert(t.value,t.$cstNode):(ao(this.astReflection,t),t)}getAssignment(e){if(!this.assignmentMap.has(e)){let t=Zt(e,tt);this.assignmentMap.set(e,{assignment:t,isCrossRef:t?Qt(t.terminal):!1})}return this.assignmentMap.get(e)}assign(e,t,n,i,s){let o=this.current,l;switch(s&&typeof n=="string"?l=this.linker.buildReference(o,t,i,n):l=n,e){case"=":{o[t]=l;break}case"?=":{o[t]=!0;break}case"+=":Array.isArray(o[t])||(o[t]=[]),o[t].push(l)}}assignWithoutOverride(e,t){for(let[n,i]of Object.entries(t)){let s=e[n];s===void 0?e[n]=i:Array.isArray(s)&&Array.isArray(i)&&(i.push(...s),e[n]=i)}return e}get definitionErrors(){return this.wrapper.definitionErrors}},Ps=class{static{a(this,"AbstractParserErrorMessageProvider")}buildMismatchTokenMessage(e){return St.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return St.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return St.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return St.buildEarlyExitMessage(e)}},Yr=class extends Ps{static{a(this,"LangiumParserErrorMessageProvider")}buildMismatchTokenMessage({expected:e,actual:t}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},qn=class extends Hn{static{a(this,"LangiumCompletionParser")}constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let t=this.lexer.tokenize(e);return this.tokens=t.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,t){let n=this.wrapper.DEFINE_RULE(ed(e.name),this.startImplementation(t).bind(this));return e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{let n=this.keepStackSize();try{e(t)}finally{this.resetStackSize(n)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,t,n){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,n,i){this.before(n),this.wrapper.wrapSubrule(e,t,i),this.after(n)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}},lm={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Yr},vl=class extends Fn{static{a(this,"ChevrotainWrapper")}constructor(e,t){let n=t&&"maxLookahead"in t;super(e,Object.assign(Object.assign(Object.assign({},lm),{lookaheadStrategy:n?new Ct({maxLookahead:t.maxLookahead}):new Wn}),t))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t){return this.RULE(e,t)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t)}wrapSubrule(e,t,n){return this.subrule(e,t,{ARGS:[n]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}};function Ms(r,e,t){return cm({parser:e,tokens:t,rules:new Map,ruleNames:new Map},r),e}a(Ms,"createParser");function cm(r,e){let t=xn(e,!1),n=K(e.rules).filter(_e).filter(i=>t.has(i));for(let i of n){let s=Object.assign(Object.assign({},r),{consume:1,optional:1,subrule:1,many:1,or:1});s.rules.set(i.name,r.parser.rule(i,pr(s,i.definition)))}}a(cm,"buildRules");function pr(r,e,t=!1){let n;if(Je(e))n=gm(r,e);else if(Et(e))n=um(r,e);else if(tt(e))n=pr(r,e.terminal);else if(Qt(e))n=td(r,e);else if(rt(e))n=fm(r,e);else if(Pi(e))n=hm(r,e);else if(Mi(e))n=pm(r,e);else if(Mt(e))n=mm(r,e);else if(Ga(e)){let i=r.consume++;n=a(()=>r.parser.consume(i,qe,e),"method")}else throw new Jt(e.$cstNode,`Unexpected element type: ${e.$type}`);return rd(r,t?void 0:bs(e),n,e.cardinality)}a(pr,"buildElement");function um(r,e){let t=ir(e);return()=>r.parser.action(t,e)}a(um,"buildAction");function fm(r,e){let t=e.rule.ref;if(_e(t)){let n=r.subrule++,i=e.arguments.length>0?dm(t,e.arguments):()=>({});return s=>r.parser.subrule(n,nd(r,t),e,i(s))}else if(Ye(t)){let n=r.consume++,i=kl(r,t.name);return()=>r.parser.consume(n,i,e)}else if(t)bt(t);else throw new Jt(e.$cstNode,`Undefined rule type: ${e.$type}`)}a(fm,"buildRuleCall");function dm(r,e){let t=e.map(n=>_t(n.value));return n=>{let i={};for(let s=0;se(n)||t(n)}else if(da(r)){let e=_t(r.left),t=_t(r.right);return n=>e(n)&&t(n)}else if(xa(r)){let e=_t(r.value);return t=>!e(t)}else if(va(r)){let e=r.parameter.ref.name;return t=>t!==void 0&&t[e]===!0}else if(ua(r)){let e=!!r.true;return()=>e}bt(r)}a(_t,"buildPredicate");function hm(r,e){if(e.elements.length===1)return pr(r,e.elements[0]);{let t=[];for(let i of e.elements){let s={ALT:pr(r,i,!0)},o=bs(i);o&&(s.GATE=_t(o)),t.push(s)}let n=r.or++;return i=>r.parser.alternatives(n,t.map(s=>{let o={ALT:a(()=>s.ALT(i),"ALT")},l=s.GATE;return l&&(o.GATE=()=>l(i)),o}))}}a(hm,"buildAlternatives");function pm(r,e){if(e.elements.length===1)return pr(r,e.elements[0]);let t=[];for(let l of e.elements){let c={ALT:pr(r,l,!0)},u=bs(l);u&&(c.GATE=_t(u)),t.push(c)}let n=r.or++,i=a((l,c)=>{let u=c.getRuleStack().join("-");return`uGroup_${l}_${u}`},"idFunc"),s=a(l=>r.parser.alternatives(n,t.map((c,u)=>{let f={ALT:a(()=>!0,"ALT")},d=r.parser;f.ALT=()=>{if(c.ALT(l),!d.isRecording()){let h=i(n,d);d.unorderedGroups.get(h)||d.unorderedGroups.set(h,[]);let g=d.unorderedGroups.get(h);typeof g?.[u]>"u"&&(g[u]=!0)}};let p=c.GATE;return p?f.GATE=()=>p(l):f.GATE=()=>{let h=d.unorderedGroups.get(i(n,d));return!h?.[u]},f})),"alternatives"),o=rd(r,bs(e),s,"*");return l=>{o(l),r.parser.isRecording()||r.parser.unorderedGroups.delete(i(n,r.parser))}}a(pm,"buildUnorderedGroup");function mm(r,e){let t=e.elements.map(n=>pr(r,n));return n=>t.forEach(i=>i(n))}a(mm,"buildGroup");function bs(r){if(Mt(r))return r.guardCondition}a(bs,"getGuardCondition");function td(r,e,t=e.terminal){if(t)if(rt(t)&&_e(t.rule.ref)){let n=r.subrule++;return i=>r.parser.subrule(n,nd(r,t.rule.ref),e,i)}else if(rt(t)&&Ye(t.rule.ref)){let n=r.consume++,i=kl(r,t.rule.ref.name);return()=>r.parser.consume(n,i,e)}else if(Je(t)){let n=r.consume++,i=kl(r,t.value);return()=>r.parser.consume(n,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);let n=ji(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+ir(e.type.ref));return td(r,e,i)}}a(td,"buildCrossReference");function gm(r,e){let t=r.consume++,n=r.tokens[e.value];if(!n)throw new Error("Could not find token for keyword: "+e.value);return()=>r.parser.consume(t,n,e)}a(gm,"buildKeyword");function rd(r,e,t,n){let i=e&&_t(e);if(!n)if(i){let s=r.or++;return o=>r.parser.alternatives(s,[{ALT:a(()=>t(o),"ALT"),GATE:a(()=>i(o),"GATE")},{ALT:Is(),GATE:a(()=>!i(o),"GATE")}])}else return t;if(n==="*"){let s=r.many++;return o=>r.parser.many(s,{DEF:a(()=>t(o),"DEF"),GATE:i?()=>i(o):void 0})}else if(n==="+"){let s=r.many++;if(i){let o=r.or++;return l=>r.parser.alternatives(o,[{ALT:a(()=>r.parser.atLeastOne(s,{DEF:a(()=>t(l),"DEF")}),"ALT"),GATE:a(()=>i(l),"GATE")},{ALT:Is(),GATE:a(()=>!i(l),"GATE")}])}else return o=>r.parser.atLeastOne(s,{DEF:a(()=>t(o),"DEF")})}else if(n==="?"){let s=r.optional++;return o=>r.parser.optional(s,{DEF:a(()=>t(o),"DEF"),GATE:i?()=>i(o):void 0})}else bt(n)}a(rd,"wrap");function nd(r,e){let t=ym(r,e),n=r.rules.get(t);if(!n)throw new Error(`Rule "${t}" not found."`);return n}a(nd,"getRule");function ym(r,e){if(_e(e))return e.name;if(r.ruleNames.has(e))return r.ruleNames.get(e);{let t=e,n=t.$container,i=e.$type;for(;!_e(n);)(Mt(n)||Pi(n)||Mi(n))&&(i=n.elements.indexOf(t).toString()+":"+i),t=n,n=n.$container;return i=n.name+":"+i,r.ruleNames.set(e,i),i}}a(ym,"getRuleName");function kl(r,e){let t=r.tokens[e];if(!t)throw new Error(`Token "${e}" not found."`);return t}a(kl,"getToken");function Il(r){let e=r.Grammar,t=r.parser.Lexer,n=new qn(r);return Ms(e,n,t.definition),n.finalize(),n}a(Il,"createCompletionParser");function Nl(r){let e=id(r);return e.finalize(),e}a(Nl,"createLangiumParser");function id(r){let e=r.Grammar,t=r.parser.Lexer,n=new zn(r);return Ms(e,n,t.definition)}a(id,"prepareLangiumParser");var mr=class{static{a(this,"DefaultTokenBuilder")}buildTokens(e,t){let n=K(xn(e,!1)),i=this.buildTerminalTokens(n),s=this.buildKeywordTokens(n,i,t);return i.forEach(o=>{let l=o.PATTERN;typeof l=="object"&&l&&"test"in l&&Bi(l)?s.unshift(o):s.push(o)}),s}buildTerminalTokens(e){return e.filter(Ye).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(e){let t=Sr(e),n=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,i={name:e.name,PATTERN:n,LINE_BREAKS:!0};return e.hidden&&(i.GROUP=Bi(t)?le.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")?!0:!!(e.source.includes("?<=")||e.source.includes("?(t.lastIndex=i,t.exec(n))}buildKeywordTokens(e,t,n){return e.filter(_e).flatMap(i=>ot(i).filter(Je)).distinct(i=>i.value).toArray().sort((i,s)=>s.value.length-i.value.length).map(i=>this.buildKeywordToken(i,t,!!n?.caseInsensitive))}buildKeywordToken(e,t,n){return{name:e.value,PATTERN:this.buildKeywordPattern(e,n),LONGER_ALT:this.findLongerAlt(e,t)}}buildKeywordPattern(e,t){return t?new RegExp(ho(e.value)):e.value}findLongerAlt(e,t){return t.reduce((n,i)=>{let s=i?.PATTERN;return s?.source&&po("^"+s.source+"$",e.value)&&n.push(i),n},[])}};var gr=class{static{a(this,"DefaultValueConverter")}convert(e,t){let n=t.grammarSource;if(Qt(n)&&(n=yo(n)),rt(n)){let i=n.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,t)}return e}runConverter(e,t,n){var i;switch(e.name.toUpperCase()){case"INT":return ut.convertInt(t);case"STRING":return ut.convertString(t);case"ID":return ut.convertID(t)}switch((i=Io(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return ut.convertNumber(t);case"boolean":return ut.convertBoolean(t);case"bigint":return ut.convertBigint(t);case"date":return ut.convertDate(t);default:return t}}},ut;(function(r){function e(u){let f="";for(let d=1;d{typeof setImmediate>"u"?setTimeout(r,0):setImmediate(r)})}a(Ml,"delayNextTick");var bl=0,ud=10;function fd(){return bl=Date.now(),new w.CancellationTokenSource}a(fd,"startCancelableOperation");function dd(r){ud=r}a(dd,"setInterruptionPeriod");var ft=Symbol("OperationCancelled");function Gt(r){return r===ft}a(Gt,"isOperationCancelled");async function Te(r){if(r===w.CancellationToken.None)return;let e=Date.now();if(e-bl>=ud&&(bl=e,await Ml()),r.isCancellationRequested)throw ft}a(Te,"interruptAndCheck");var Ue=class{static{a(this,"Deferred")}constructor(){this.promise=new Promise((e,t)=>{this.resolve=n=>(e(n),this),this.reject=n=>(t(n),this)})}};var Gs=class r{static{a(this,"FullTextDocument")}constructor(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){for(let n of e)if(r.isIncremental(n)){let i=md(n.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(o,this._content.length);let l=Math.max(i.start.line,0),c=Math.max(i.end.line,0),u=this._lineOffsets,f=hd(n.text,!1,s);if(c-l===f.length)for(let p=0,h=f.length;pe?i=o:n=o+1}let s=n-1;return e=this.ensureBeforeEOL(e,t[s]),{line:s,character: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 n=t[e.line];if(e.character<=0)return n;let i=e.line+1t&&pd(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let t=e;return t!=null&&typeof t.text=="string"&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength=="number")}static isFull(e){let t=e;return t!=null&&typeof t.text=="string"&&t.range===void 0&&t.rangeLength===void 0}},Zr;(function(r){function e(i,s,o,l){return new Gs(i,s,o,l)}a(e,"create"),r.create=e;function t(i,s,o){if(i instanceof Gs)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}a(t,"update"),r.update=t;function n(i,s){let o=i.getText(),l=Dl(s.map(Sm),(f,d)=>{let p=f.range.start.line-d.range.start.line;return p===0?f.range.start.character-d.range.start.character:p}),c=0,u=[];for(let f of l){let d=i.offsetAt(f.range.start);if(dc&&u.push(o.substring(c,d)),f.newText.length&&u.push(f.newText),c=i.offsetAt(f.range.end)}return u.push(o.substr(c)),u.join("")}a(n,"applyEdits"),r.applyEdits=n})(Zr||(Zr={}));function Dl(r,e){if(r.length<=1)return r;let t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);Dl(n,e),Dl(i,e);let s=0,o=0,l=0;for(;st.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:r}a(md,"getWellformedRange");function Sm(r){let e=md(r.range);return e!==r.range?{newText:r.newText,range:e}:r}a(Sm,"getWellformedEdit");var gd;(()=>{"use strict";var r={470:i=>{function s(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}a(s,"e");function o(c,u){for(var f,d="",p=0,h=-1,g=0,T=0;T<=c.length;++T){if(T2){var k=d.lastIndexOf("/");if(k!==d.length-1){k===-1?(d="",p=0):p=(d=d.slice(0,k)).length-1-d.lastIndexOf("/"),h=T,g=0;continue}}else if(d.length===2||d.length===1){d="",p=0,h=T,g=0;continue}}u&&(d.length>0?d+="/..":d="..",p=2)}else d.length>0?d+="/"+c.slice(h+1,T):d=c.slice(h+1,T),p=T-h-1;h=T,g=0}else f===46&&g!==-1?++g:g=-1}return d}a(o,"r");var l={resolve:a(function(){for(var c,u="",f=!1,d=arguments.length-1;d>=-1&&!f;d--){var p;d>=0?p=arguments[d]:(c===void 0&&(c=process.cwd()),p=c),s(p),p.length!==0&&(u=p+"/"+u,f=p.charCodeAt(0)===47)}return u=o(u,!f),f?u.length>0?"/"+u:"/":u.length>0?u:"."},"resolve"),normalize:a(function(c){if(s(c),c.length===0)return".";var u=c.charCodeAt(0)===47,f=c.charCodeAt(c.length-1)===47;return(c=o(c,!u)).length!==0||u||(c="."),c.length>0&&f&&(c+="/"),u?"/"+c:c},"normalize"),isAbsolute:a(function(c){return s(c),c.length>0&&c.charCodeAt(0)===47},"isAbsolute"),join:a(function(){if(arguments.length===0)return".";for(var c,u=0;u0&&(c===void 0?c=f:c+="/"+f)}return c===void 0?".":l.normalize(c)},"join"),relative:a(function(c,u){if(s(c),s(u),c===u||(c=l.resolve(c))===(u=l.resolve(u)))return"";for(var f=1;fT){if(u.charCodeAt(h+R)===47)return u.slice(h+R+1);if(R===0)return u.slice(h+R)}else p>T&&(c.charCodeAt(f+R)===47?k=R:R===0&&(k=0));break}var A=c.charCodeAt(f+R);if(A!==u.charCodeAt(h+R))break;A===47&&(k=R)}var x="";for(R=f+k+1;R<=d;++R)R!==d&&c.charCodeAt(R)!==47||(x.length===0?x+="..":x+="/..");return x.length>0?x+u.slice(h+k):(h+=k,u.charCodeAt(h)===47&&++h,u.slice(h))},"relative"),_makeLong:a(function(c){return c},"_makeLong"),dirname:a(function(c){if(s(c),c.length===0)return".";for(var u=c.charCodeAt(0),f=u===47,d=-1,p=!0,h=c.length-1;h>=1;--h)if((u=c.charCodeAt(h))===47){if(!p){d=h;break}}else p=!1;return d===-1?f?"/":".":f&&d===1?"//":c.slice(0,d)},"dirname"),basename:a(function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');s(c);var f,d=0,p=-1,h=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var g=u.length-1,T=-1;for(f=c.length-1;f>=0;--f){var k=c.charCodeAt(f);if(k===47){if(!h){d=f+1;break}}else T===-1&&(h=!1,T=f+1),g>=0&&(k===u.charCodeAt(g)?--g==-1&&(p=f):(g=-1,p=T))}return d===p?p=T:p===-1&&(p=c.length),c.slice(d,p)}for(f=c.length-1;f>=0;--f)if(c.charCodeAt(f)===47){if(!h){d=f+1;break}}else p===-1&&(h=!1,p=f+1);return p===-1?"":c.slice(d,p)},"basename"),extname:a(function(c){s(c);for(var u=-1,f=0,d=-1,p=!0,h=0,g=c.length-1;g>=0;--g){var T=c.charCodeAt(g);if(T!==47)d===-1&&(p=!1,d=g+1),T===46?u===-1?u=g:h!==1&&(h=1):u!==-1&&(h=-1);else if(!p){f=g+1;break}}return u===-1||d===-1||h===0||h===1&&u===d-1&&u===f+1?"":c.slice(u,d)},"extname"),format:a(function(c){if(c===null||typeof c!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof c);return function(u,f){var d=f.dir||f.root,p=f.base||(f.name||"")+(f.ext||"");return d?d===f.root?d+p:d+"/"+p:p}(0,c)},"format"),parse:a(function(c){s(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var f,d=c.charCodeAt(0),p=d===47;p?(u.root="/",f=1):f=0;for(var h=-1,g=0,T=-1,k=!0,R=c.length-1,A=0;R>=f;--R)if((d=c.charCodeAt(R))!==47)T===-1&&(k=!1,T=R+1),d===46?h===-1?h=R:A!==1&&(A=1):h!==-1&&(A=-1);else if(!k){g=R+1;break}return h===-1||T===-1||A===0||A===1&&h===T-1&&h===g+1?T!==-1&&(u.base=u.name=g===0&&p?c.slice(1,T):c.slice(g,T)):(g===0&&p?(u.name=c.slice(1,h),u.base=c.slice(1,T)):(u.name=c.slice(g,h),u.base=c.slice(g,T)),u.ext=c.slice(h,T)),g>0?u.dir=c.slice(0,g-1):p&&(u.dir="/"),u},"parse"),sep:"/",delimiter:":",win32:null,posix:null};l.posix=l,i.exports=l}},e={};function t(i){var s=e[i];if(s!==void 0)return s.exports;var o=e[i]={exports:{}};return r[i](o,o.exports,t),o.exports}a(t,"r"),t.d=(i,s)=>{for(var o in s)t.o(s,o)&&!t.o(i,o)&&Object.defineProperty(i,o,{enumerable:!0,get:s[o]})},t.o=(i,s)=>Object.prototype.hasOwnProperty.call(i,s),t.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var n={};(()=>{let i;t.r(n),t.d(n,{URI:a(()=>p,"URI"),Utils:a(()=>ht,"Utils")}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let s=/^\w[\w\d+.-]*$/,o=/^\//,l=/^\/\//;function c(v,y){if(!v.scheme&&y)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${v.authority}", path: "${v.path}", query: "${v.query}", fragment: "${v.fragment}"}`);if(v.scheme&&!s.test(v.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(v.path){if(v.authority){if(!o.test(v.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(l.test(v.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}a(c,"s");let u="",f="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class p{static{a(this,"f")}static isUri(y){return y instanceof p||!!y&&typeof y.authority=="string"&&typeof y.fragment=="string"&&typeof y.path=="string"&&typeof y.query=="string"&&typeof y.scheme=="string"&&typeof y.fsPath=="string"&&typeof y.with=="function"&&typeof y.toString=="function"}scheme;authority;path;query;fragment;constructor(y,C,S,V,$,O=!1){typeof y=="object"?(this.scheme=y.scheme||u,this.authority=y.authority||u,this.path=y.path||u,this.query=y.query||u,this.fragment=y.fragment||u):(this.scheme=function(Le,Oe){return Le||Oe?Le:"file"}(y,O),this.authority=C||u,this.path=function(Le,Oe){switch(Le){case"https":case"http":case"file":Oe?Oe[0]!==f&&(Oe=f+Oe):Oe=f}return Oe}(this.scheme,S||u),this.query=V||u,this.fragment=$||u,c(this,O))}get fsPath(){return A(this,!1)}with(y){if(!y)return this;let{scheme:C,authority:S,path:V,query:$,fragment:O}=y;return C===void 0?C=this.scheme:C===null&&(C=u),S===void 0?S=this.authority:S===null&&(S=u),V===void 0?V=this.path:V===null&&(V=u),$===void 0?$=this.query:$===null&&($=u),O===void 0?O=this.fragment:O===null&&(O=u),C===this.scheme&&S===this.authority&&V===this.path&&$===this.query&&O===this.fragment?this:new g(C,S,V,$,O)}static parse(y,C=!1){let S=d.exec(y);return S?new g(S[2]||u,xe(S[4]||u),xe(S[5]||u),xe(S[7]||u),xe(S[9]||u),C):new g(u,u,u,u,u)}static file(y){let C=u;if(i&&(y=y.replace(/\\/g,f)),y[0]===f&&y[1]===f){let S=y.indexOf(f,2);S===-1?(C=y.substring(2),y=f):(C=y.substring(2,S),y=y.substring(S)||f)}return new g("file",C,y,u,u)}static from(y){let C=new g(y.scheme,y.authority,y.path,y.query,y.fragment);return c(C,!0),C}toString(y=!1){return x(this,y)}toJSON(){return this}static revive(y){if(y){if(y instanceof p)return y;{let C=new g(y);return C._formatted=y.external,C._fsPath=y._sep===h?y.fsPath:null,C}}return y}}let h=i?1:void 0;class g extends p{static{a(this,"l")}_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=A(this,!1)),this._fsPath}toString(y=!1){return y?x(this,!0):(this._formatted||(this._formatted=x(this,!1)),this._formatted)}toJSON(){let y={$mid:1};return this._fsPath&&(y.fsPath=this._fsPath,y._sep=h),this._formatted&&(y.external=this._formatted),this.path&&(y.path=this.path),this.scheme&&(y.scheme=this.scheme),this.authority&&(y.authority=this.authority),this.query&&(y.query=this.query),this.fragment&&(y.fragment=this.fragment),y}}let T={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function k(v,y,C){let S,V=-1;for(let $=0;$=97&&O<=122||O>=65&&O<=90||O>=48&&O<=57||O===45||O===46||O===95||O===126||y&&O===47||C&&O===91||C&&O===93||C&&O===58)V!==-1&&(S+=encodeURIComponent(v.substring(V,$)),V=-1),S!==void 0&&(S+=v.charAt($));else{S===void 0&&(S=v.substr(0,$));let Le=T[O];Le!==void 0?(V!==-1&&(S+=encodeURIComponent(v.substring(V,$)),V=-1),S+=Le):V===-1&&(V=$)}}return V!==-1&&(S+=encodeURIComponent(v.substring(V))),S!==void 0?S:v}a(k,"d");function R(v){let y;for(let C=0;C1&&v.scheme==="file"?`//${v.authority}${v.path}`:v.path.charCodeAt(0)===47&&(v.path.charCodeAt(1)>=65&&v.path.charCodeAt(1)<=90||v.path.charCodeAt(1)>=97&&v.path.charCodeAt(1)<=122)&&v.path.charCodeAt(2)===58?y?v.path.substr(1):v.path[1].toLowerCase()+v.path.substr(2):v.path,i&&(C=C.replace(/\//g,"\\")),C}a(A,"m");function x(v,y){let C=y?R:k,S="",{scheme:V,authority:$,path:O,query:Le,fragment:Oe}=v;if(V&&(S+=V,S+=":"),($||V==="file")&&(S+=f,S+=f),$){let ee=$.indexOf("@");if(ee!==-1){let Wt=$.substr(0,ee);$=$.substr(ee+1),ee=Wt.lastIndexOf(":"),ee===-1?S+=C(Wt,!1,!1):(S+=C(Wt.substr(0,ee),!1,!1),S+=":",S+=C(Wt.substr(ee+1),!1,!0)),S+="@"}$=$.toLowerCase(),ee=$.lastIndexOf(":"),ee===-1?S+=C($,!1,!0):(S+=C($.substr(0,ee),!1,!0),S+=$.substr(ee))}if(O){if(O.length>=3&&O.charCodeAt(0)===47&&O.charCodeAt(2)===58){let ee=O.charCodeAt(1);ee>=65&&ee<=90&&(O=`/${String.fromCharCode(ee+32)}:${O.substr(3)}`)}else if(O.length>=2&&O.charCodeAt(1)===58){let ee=O.charCodeAt(0);ee>=65&&ee<=90&&(O=`${String.fromCharCode(ee+32)}:${O.substr(2)}`)}S+=C(O,!0,!1)}return Le&&(S+="?",S+=C(Le,!1,!1)),Oe&&(S+="#",S+=y?Oe:k(Oe,!1,!1)),S}a(x,"y");function P(v){try{return decodeURIComponent(v)}catch{return v.length>3?v.substr(0,3)+P(v.substr(3)):v}}a(P,"v");let b=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function xe(v){return v.match(b)?v.replace(b,y=>P(y)):v}a(xe,"C");var Rr=t(470);let ve=Rr.posix||Rr,Lt="/";var ht;(function(v){v.joinPath=function(y,...C){return y.with({path:ve.join(y.path,...C)})},v.resolvePath=function(y,...C){let S=y.path,V=!1;S[0]!==Lt&&(S=Lt+S,V=!0);let $=ve.resolve(S,...C);return V&&$[0]===Lt&&!y.authority&&($=$.substring(1)),y.with({path:$})},v.dirname=function(y){if(y.path.length===0||y.path===Lt)return y;let C=ve.dirname(y.path);return C.length===1&&C.charCodeAt(0)===46&&(C=""),y.with({path:C})},v.basename=function(y){return ve.basename(y.path)},v.extname=function(y){return ve.extname(y.path)}})(ht||(ht={}))})(),gd=n})();var{URI:We,Utils:en}=gd;var Ge;(function(r){r.basename=en.basename,r.dirname=en.dirname,r.extname=en.extname,r.joinPath=en.joinPath,r.resolvePath=en.resolvePath;function e(n,i){return n?.toString()===i?.toString()}a(e,"equals"),r.equals=e;function t(n,i){let s=typeof n=="string"?n:n.path,o=typeof i=="string"?i:i.path,l=s.split("/").filter(p=>p.length>0),c=o.split("/").filter(p=>p.length>0),u=0;for(;ui??(i=Zr.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,t??""))}},Yn=class{static{a(this,"DefaultLangiumDocuments")}constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return K(this.documentMap.values())}addDocument(e){let t=e.uri.toString();if(this.documentMap.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentMap.set(t,e)}getDocument(e){let t=e.toString();return this.documentMap.get(t)}async getOrCreateDocument(e,t){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(n),n)}createDocument(e,t,n){if(n)return this.langiumDocumentFactory.fromString(t,e,n).then(i=>(this.addDocument(i),i));{let i=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let t=e.toString(),n=this.documentMap.get(t);return n&&(n.state=Y.Changed,n.precomputedScopes=void 0,n.references=[],n.diagnostics=void 0),n}deleteDocument(e){let t=e.toString(),n=this.documentMap.get(t);return n&&(n.state=Y.Changed,this.documentMap.delete(t)),n}};var Jn=class{static{a(this,"DefaultLinker")}constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,t=w.CancellationToken.None){for(let n of Qe(e.parseResult.value))await Te(t),Ir(n).forEach(i=>this.doLink(i,e))}doLink(e,t){let n=e.reference;if(n._ref===void 0)try{let i=this.getCandidate(e);if(qt(i))n._ref=i;else if(n._nodeDescription=i,this.langiumDocuments().hasDocument(i.documentUri)){let s=this.loadAstNode(i);n._ref=s??this.createLinkingError(e,i)}}catch(i){n._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${n.$refText}': ${i}`})}t.references.push(n)}unlink(e){for(let t of e.references)delete t._ref,delete t._nodeDescription;e.references=[]}getCandidate(e){let n=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return n??this.createLinkingError(e)}buildReference(e,t,n,i){let s=this,o={$refNode:n,$refText:i,get ref(){var l;if(ae(this._ref))return this._ref;if(Qs(this._nodeDescription)){let c=s.loadAstNode(this._nodeDescription);this._ref=c??s.createLinkingError({reference:o,container:e,property:t},this._nodeDescription)}else if(this._ref===void 0){let c=s.getLinkedNode({reference:o,container:e,property:t});if(c.error&&ge(e).state=e.end)return s.ref}}if(n){let i=this.nameProvider.getNameNode(n);if(i&&(i===e||ea(e,i)))return n}}}findDeclarationNode(e){let t=this.findDeclaration(e);if(t?.$cstNode){let n=this.nameProvider.getNameNode(t);return n??t.$cstNode}}findReferences(e,t){let n=[];if(t.includeDeclaration){let s=this.getReferenceToSelf(e);s&&n.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(i=i.filter(s=>Ge.equals(s.sourceUri,t.documentUri))),n.push(...i),K(n)}getReferenceToSelf(e){let t=this.nameProvider.getNameNode(e);if(t){let n=ge(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:Yt(t),local:!0}}}};var dt=class{static{a(this,"MultiMap")}constructor(e){if(this.map=new Map,e)for(let[t,n]of e)this.add(t,n)}get size(){return Ar.sum(K(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(t===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let i=n.indexOf(t);if(i>=0)return n.length===1?this.map.delete(e):n.splice(i,1),!0}return!1}}get(e){var t;return(t=this.map.get(e))!==null&&t!==void 0?t:[]}has(e,t){if(t===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(t)>=0:!1}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach((t,n)=>t.forEach(i=>e(i,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return K(this.map.entries()).flatMap(([e,t])=>t.map(n=>[e,n]))}keys(){return K(this.map.keys())}values(){return K(this.map.values()).flat()}entriesGroupedByKey(){return K(this.map.entries())}},yr=class{static{a(this,"BiMap")}get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[t,n]of e)this.set(t,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,t){return this.map.set(e,t),this.inverse.set(t,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let t=this.map.get(e);return t!==void 0?(this.map.delete(e),this.inverse.delete(t),!0):!1}};var ei=class{static{a(this,"DefaultScopeComputation")}constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=w.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=mn,i=w.CancellationToken.None){let s=[];this.exportNode(e,s,t);for(let o of n(e))await Te(i),this.exportNode(o,s,t);return s}exportNode(e,t,n){let i=this.nameProvider.getName(e);i&&t.push(this.descriptions.createDescription(e,i,n))}async computeLocalScopes(e,t=w.CancellationToken.None){let n=e.parseResult.value,i=new dt;for(let s of ot(n))await Te(t),this.processNode(s,e,i);return i}processNode(e,t,n){let i=e.$container;if(i){let s=this.nameProvider.getName(e);s&&n.add(i,this.descriptions.createDescription(e,s,t))}}};var tn=class{static{a(this,"StreamScope")}constructor(e,t,n){var i;this.elements=e,this.outerScope=t,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let t=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===e.toLowerCase()):this.elements.find(n=>n.name===e);if(t)return t;if(this.outerScope)return this.outerScope.getElement(e)}},ti=class{static{a(this,"MapScope")}constructor(e,t,n){var i;this.elements=new Map,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1;for(let s of e){let o=this.caseInsensitive?s.name.toLowerCase():s.name;this.elements.set(o,s)}this.outerScope=t}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(t);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=K(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},Cm={getElement(){},getAllElements(){return cn}};var rn=class{static{a(this,"DisposableCache")}constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}},ri=class extends rn{static{a(this,"SimpleCache")}constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,t){this.throwIfDisposed(),this.cache.set(e,t)}get(e,t){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(t){let n=t();return this.cache.set(e,n),n}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},Tr=class extends rn{static{a(this,"ContextCache")}constructor(e){super(),this.cache=new Map,this.converter=e??(t=>t)}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,n){this.throwIfDisposed(),this.cacheForContext(e).set(t,n)}get(e,t,n){this.throwIfDisposed();let i=this.cacheForContext(e);if(i.has(t))return i.get(t);if(n){let s=n();return i.set(t,s),s}else return}delete(e,t){return this.throwIfDisposed(),this.cacheForContext(e).delete(t)}clear(e){if(this.throwIfDisposed(),e){let t=this.converter(e);this.cache.delete(t)}else this.cache.clear()}cacheForContext(e){let t=this.converter(e),n=this.cache.get(t);return n||(n=new Map,this.cache.set(t,n)),n}},Bs=class extends Tr{static{a(this,"DocumentCache")}constructor(e){super(t=>t.toString()),this.onDispose(e.workspace.DocumentBuilder.onUpdate((t,n)=>{let i=t.concat(n);for(let s of i)this.clear(s)}))}},nn=class extends ri{static{a(this,"WorkspaceCache")}constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}};var ni=class{static{a(this,"DefaultScopeProvider")}constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new nn(e.shared)}getScope(e){let t=[],n=this.reflection.getReferenceType(e),i=ge(e.container).precomputedScopes;if(i){let o=e.container;do{let l=i.get(o);l.length>0&&t.push(K(l).filter(c=>this.reflection.isSubtype(c.type,n))),o=o.$container}while(o)}let s=this.getGlobalScope(n,e);for(let o=t.length-1;o>=0;o--)s=this.createScope(t[o],s);return s}createScope(e,t,n){return new tn(K(e),t,n)}createScopeForNodes(e,t,n){let i=K(e).map(s=>{let o=this.nameProvider.getName(s);if(o)return this.descriptions.createDescription(s,o)}).nonNullable();return new tn(i,t,n)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new ti(this.indexManager.allElements(e)))}};function Fl(r){return typeof r.$comment=="string"}a(Fl,"isAstNodeWithComment");function Td(r){return typeof r=="object"&&!!r&&("$ref"in r||"$error"in r)}a(Td,"isIntermediateReference");var ii=class{static{a(this,"DefaultJsonSerializer")}constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,t={}){let n=t?.replacer,i=a((o,l)=>this.replacer(o,l,t),"defaultReplacer"),s=n?(o,l)=>n(o,l,i):i;try{return this.currentDocument=ge(e),JSON.stringify(e,s,t?.space)}finally{this.currentDocument=void 0}}deserialize(e,t={}){let n=JSON.parse(e);return this.linkNode(n,n,t),n}replacer(e,t,{refText:n,sourceText:i,textRegions:s,comments:o,uriConverter:l}){var c,u,f,d;if(!this.ignoreProperties.has(e))if(Ae(t)){let p=t.ref,h=n?t.$refText:void 0;if(p){let g=ge(p),T="";this.currentDocument&&this.currentDocument!==g&&(l?T=l(g.uri,t):T=g.uri.toString());let k=this.astNodeLocator.getAstNodePath(p);return{$ref:`${T}#${k}`,$refText:h}}else return{$error:(u=(c=t.error)===null||c===void 0?void 0:c.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:h}}else if(ae(t)){let p;if(s&&(p=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},t)),(!e||t.$document)&&p?.$textRegion&&(p.$textRegion.documentURI=(f=this.currentDocument)===null||f===void 0?void 0:f.uri.toString())),i&&!e&&(p??(p=Object.assign({},t)),p.$sourceText=(d=t.$cstNode)===null||d===void 0?void 0:d.text),o){p??(p=Object.assign({},t));let h=this.commentProvider.getComment(t);h&&(p.$comment=h.replace(/\r/g,""))}return p??t}else return t}addAstNodeRegionWithAssignmentsTo(e){let t=a(n=>({offset:n.offset,end:n.end,length:n.length,range:n.range}),"createDocumentSegment");if(e.$cstNode){let n=e.$textRegion=t(e.$cstNode),i=n.assignments={};return Object.keys(e).filter(s=>!s.startsWith("$")).forEach(s=>{let o=xo(e.$cstNode,s).map(t);o.length!==0&&(i[s]=o)}),e}}linkNode(e,t,n,i,s,o){for(let[c,u]of Object.entries(e))if(Array.isArray(u))for(let f=0;f{try{await e.call(t,n,i,s)}catch(o){if(Gt(o))throw o;console.error("An error occurred during validation:",o);let l=o instanceof Error?o.message:String(o);o instanceof Error&&o.stack&&console.error(o.stack),i("error","An error occurred during validation: "+l,{node:n})}}}addEntry(e,t){if(e==="AstNode"){this.entries.add("AstNode",t);return}for(let n of this.reflection.getAllSubTypes(e))this.entries.add(n,t)}getChecks(e,t){let n=K(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(n=n.filter(i=>t.includes(i.category))),n.map(i=>i.check)}};var oi=class{static{a(this,"DefaultDocumentValidator")}constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t={},n=w.CancellationToken.None){let i=e.parseResult,s=[];if(await Te(n),(!t.categories||t.categories.includes("built-in"))&&(this.processLexingErrors(i,s,t),t.stopAfterLexingErrors&&s.some(o=>{var l;return((l=o.data)===null||l===void 0?void 0:l.code)===wt.LexingError})||(this.processParsingErrors(i,s,t),t.stopAfterParsingErrors&&s.some(o=>{var l;return((l=o.data)===null||l===void 0?void 0:l.code)===wt.ParsingError}))||(this.processLinkingErrors(e,s,t),t.stopAfterLinkingErrors&&s.some(o=>{var l;return((l=o.data)===null||l===void 0?void 0:l.code)===wt.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,t,n))}catch(o){if(Gt(o))throw o;console.error("An error occurred during validation:",o)}return await Te(n),s}processLexingErrors(e,t,n){for(let i of e.lexerErrors){let s={severity:js("error"),range:{start:{line:i.line-1,character:i.column-1},end:{line:i.line-1,character:i.column+i.length-1}},message:i.message,data:Ws(wt.LexingError),source:this.getSource()};t.push(s)}}processParsingErrors(e,t,n){for(let i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){let o=i.previousToken;if(isNaN(o.startOffset)){let l={line:0,character:0};s={start:l,end:l}}else{let l={line:o.endLine-1,character:o.endColumn};s={start:l,end:l}}}}else s=vr(i.token);if(s){let o={severity:js("error"),range:s,message:i.message,data:Ws(wt.ParsingError),source:this.getSource()};t.push(o)}}}processLinkingErrors(e,t,n){for(let i of e.references){let s=i.error;if(s){let o={node:s.container,property:s.property,index:s.index,data:{code:wt.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};t.push(this.toDiagnostic("error",s.message,o))}}}async validateAst(e,t,n=w.CancellationToken.None){let i=[],s=a((o,l,c)=>{i.push(this.toDiagnostic(o,l,c))},"acceptor");return await Promise.all(Qe(e).map(async o=>{await Te(n);let l=this.validationRegistry.getChecks(o.$type,t.categories);for(let c of l)await c(o,s,n)})),i}toDiagnostic(e,t,n){return{message:t,range:xd(n),severity:js(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};function xd(r){if(r.range)return r.range;let e;return typeof r.property=="string"?e=Rn(r.node.$cstNode,r.property,r.index):typeof r.keyword=="string"&&(e=Eo(r.node.$cstNode,r.keyword,r.index)),e??(e=r.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}a(xd,"getDiagnosticRange");function js(r){switch(r){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+r)}}a(js,"toDiagnosticSeverity");var wt;(function(r){r.LexingError="lexing-error",r.ParsingError="parsing-error",r.LinkingError="linking-error"})(wt||(wt={}));var li=class{static{a(this,"DefaultAstNodeDescriptionProvider")}constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,n=ge(e)){t??(t=this.nameProvider.getName(e));let i=this.astNodeLocator.getAstNodePath(e);if(!t)throw new Error(`Node at path ${i} has no name.`);let s,o=a(()=>{var l;return s??(s=Yt((l=this.nameProvider.getNameNode(e))!==null&&l!==void 0?l:e.$cstNode))},"nameSegmentGetter");return{node:e,name:t,get nameSegment(){return o()},selectionSegment:Yt(e.$cstNode),type:e.$type,documentUri:n.uri,path:i}}},ci=class{static{a(this,"DefaultReferenceDescriptionProvider")}constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=w.CancellationToken.None){let n=[],i=e.parseResult.value;for(let s of Qe(i))await Te(t),Ir(s).filter(o=>!qt(o)).forEach(o=>{let l=this.createDescription(o);l&&n.push(l)});return n}createDescription(e){let t=e.reference.$nodeDescription,n=e.reference.$refNode;if(!t||!n)return;let i=ge(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:Yt(n),local:Ge.equals(t.documentUri,i)}}};var ui=class{static{a(this,"DefaultAstNodeLocator")}constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let t=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return t+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return t!==void 0?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce((i,s)=>{if(!i||s.length===0)return i;let o=s.indexOf(this.indexSeparator);if(o>0){let l=s.substring(0,o),c=parseInt(s.substring(o+1)),u=i[l];return u?.[c]}return i[s]},e)}};var fi=class{static{a(this,"DefaultConfigurationProvider")}constructor(e){this._ready=new Ue,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var t,n;this.workspaceConfig=(n=(t=e.capabilities.workspace)===null||t===void 0?void 0:t.configuration)!==null&&n!==void 0?n:!1}async initialized(e){if(this.workspaceConfig){if(e.register){let t=this.serviceRegistry.all;e.register({section:t.map(n=>this.toSectionName(n.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let t=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await e.fetchConfiguration(t);t.forEach((i,s)=>{this.updateSectionConfiguration(i.section,n[s])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(t=>{this.updateSectionConfiguration(t,e.settings[t])})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][t]}toSectionName(e){return`${e}`}};var xr;(function(r){function e(t){return{dispose:a(async()=>await t(),"dispose")}}a(e,"create"),r.create=e})(xr||(xr={}));var di=class{static{a(this,"DefaultDocumentBuilder")}constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new dt,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=Y.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},n=w.CancellationToken.None){var i,s;for(let o of e){let l=o.uri.toString();if(o.state===Y.Validated){if(typeof t.validation=="boolean"&&t.validation)o.state=Y.IndexedReferences,o.diagnostics=void 0,this.buildState.delete(l);else if(typeof t.validation=="object"){let c=this.buildState.get(l),u=(i=c?.result)===null||i===void 0?void 0:i.validationChecks;if(u){let d=((s=t.validation.categories)!==null&&s!==void 0?s:sn.all).filter(p=>!u.includes(p));d.length>0&&(this.buildState.set(l,{completed:!1,options:{validation:Object.assign(Object.assign({},t.validation),{categories:d})},result:c.result}),o.state=Y.IndexedReferences)}}}else this.buildState.delete(l)}this.currentState=Y.Changed,await this.emitUpdate(e.map(o=>o.uri),[]),await this.buildDocuments(e,t,n)}async update(e,t,n=w.CancellationToken.None){this.currentState=Y.Changed;for(let o of t)this.langiumDocuments.deleteDocument(o),this.buildState.delete(o.toString()),this.indexManager.remove(o);for(let o of e){if(!this.langiumDocuments.invalidateDocument(o)){let c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},o);c.state=Y.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(o.toString())}let i=K(e).concat(t).map(o=>o.toString()).toSet();this.langiumDocuments.all.filter(o=>!i.has(o.uri.toString())&&this.shouldRelink(o,i)).forEach(o=>{this.serviceRegistry.getServices(o.uri).references.Linker.unlink(o),o.state=Math.min(o.state,Y.ComputedScopes),o.diagnostics=void 0}),await this.emitUpdate(e,t),await Te(n);let s=this.langiumDocuments.all.filter(o=>{var l;return o.staten(e,t)))}shouldRelink(e,t){return e.references.some(n=>n.error!==void 0)?!0:this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),xr.create(()=>{let t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}async buildDocuments(e,t,n){this.prepareBuild(e,t),await this.runCancelable(e,Y.Parsed,n,s=>this.langiumDocumentFactory.update(s,n)),await this.runCancelable(e,Y.IndexedContent,n,s=>this.indexManager.updateContent(s,n)),await this.runCancelable(e,Y.ComputedScopes,n,async s=>{let o=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await o.computeLocalScopes(s,n)}),await this.runCancelable(e,Y.Linked,n,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,n)),await this.runCancelable(e,Y.IndexedReferences,n,s=>this.indexManager.updateReferences(s,n));let i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,Y.Validated,n,s=>this.validate(s,n));for(let s of e){let o=this.buildState.get(s.uri.toString());o&&(o.completed=!0)}}prepareBuild(e,t){for(let n of e){let i=n.uri.toString(),s=this.buildState.get(i);(!s||s.completed)&&this.buildState.set(i,{completed:!1,options:t,result:s?.result})}}async runCancelable(e,t,n,i){let s=e.filter(o=>o.state{this.buildPhaseListeners.delete(e,t)})}waitUntil(e,t,n){let i;if(t&&"path"in t?i=t:n=t,n??(n=w.CancellationToken.None),i){let s=this.langiumDocuments.getDocument(i);if(s&&s.state>e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(ft):new Promise((s,o)=>{let l=this.onBuildPhase(e,()=>{if(l.dispose(),c.dispose(),i){let u=this.langiumDocuments.getDocument(i);s(u?.uri)}else s(void 0)}),c=n.onCancellationRequested(()=>{l.dispose(),c.dispose(),o(ft)})})}async notifyBuildPhase(e,t,n){if(e.length===0)return;let i=this.buildPhaseListeners.get(t);for(let s of i)await Te(n),await s(e,n)}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,t){var n,i;let s=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,o=this.getBuildOptions(e).validation,l=typeof o=="object"?o:void 0,c=await s.validateDocument(e,l,t);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;let u=this.buildState.get(e.uri.toString());if(u){(n=u.result)!==null&&n!==void 0||(u.result={});let f=(i=l?.categories)!==null&&i!==void 0?i:sn.all;u.result.validationChecks?u.result.validationChecks.push(...f):u.result.validationChecks=[...f]}}getBuildOptions(e){var t,n;return(n=(t=this.buildState.get(e.uri.toString()))===null||t===void 0?void 0:t.options)!==null&&n!==void 0?n:{}}};var hi=class{static{a(this,"DefaultIndexManager")}constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Tr,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){let n=ge(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(o=>{Ge.equals(o.targetUri,n)&&o.targetPath===t&&i.push(o)})}),K(i)}allElements(e,t){let n=K(this.symbolIndex.keys());return t&&(n=n.filter(i=>!t||t.has(i))),n.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,t){var n;return t?this.symbolByTypeIndex.get(e,t,()=>{var s;return((s=this.symbolIndex.get(e))!==null&&s!==void 0?s:[]).filter(l=>this.astReflection.isSubtype(l.type,t))}):(n=this.symbolIndex.get(e))!==null&&n!==void 0?n:[]}remove(e){let t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t),this.referenceIndex.delete(t)}async updateContent(e,t=w.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,t),s=e.uri.toString();this.symbolIndex.set(s,i),this.symbolByTypeIndex.clear(s)}async updateReferences(e,t=w.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,t){let n=this.referenceIndex.get(e.uri.toString());return n?n.some(i=>!i.local&&t.has(i.targetUri.toString())):!1}};var pi=class{static{a(this,"DefaultWorkspaceManager")}constructor(e){this.initialBuildOptions={},this._ready=new Ue,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}initialize(e){var t;this.folders=(t=e.workspaceFolders)!==null&&t!==void 0?t:void 0}initialized(e){return this.mutex.write(t=>{var n;return this.initializeWorkspace((n=this.folders)!==null&&n!==void 0?n:[],t)})}async initializeWorkspace(e,t=w.CancellationToken.None){let n=await this.performStartup(e);await Te(t),await this.documentBuilder.build(n,this.initialBuildOptions,t)}async performStartup(e){let t=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),n=[],i=a(s=>{n.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)},"collector");return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,t,i))),this._ready.resolve(),n}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return We.parse(e.uri)}async traverseFolder(e,t,n,i){let s=await this.fileSystemProvider.readDirectory(t);await Promise.all(s.map(async o=>{if(this.includeEntry(e,o,n)){if(o.isDirectory)await this.traverseFolder(e,o.uri,n,i);else if(o.isFile){let l=await this.langiumDocuments.getOrCreateDocument(o.uri);i(l)}}}))}includeEntry(e,t,n){let i=Ge.basename(t.uri);if(i.startsWith("."))return!1;if(t.isDirectory)return i!=="node_modules"&&i!=="out";if(t.isFile){let s=Ge.extname(t.uri);return n.includes(s)}return!1}};var mi=class{static{a(this,"DefaultLexer")}constructor(e){let t=e.parser.TokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(t);let n=Ul(t)?Object.values(t):t;this.chevrotainLexer=new le(n,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e){var t;let n=this.chevrotainLexer.tokenize(e);return{tokens:n.tokens,errors:n.errors,hidden:(t=n.groups.hidden)!==null&&t!==void 0?t:[]}}toTokenTypeDictionary(e){if(Ul(e))return e;let t=Gl(e)?Object.values(e.modes).flat():e,n={};return t.forEach(i=>n[i.name]=i),n}};function Rd(r){return Array.isArray(r)&&(r.length===0||"name"in r[0])}a(Rd,"isTokenTypeArray");function Gl(r){return r&&"modes"in r&&"defaultMode"in r}a(Gl,"isIMultiModeLexerDefinition");function Ul(r){return!Rd(r)&&!Gl(r)}a(Ul,"isTokenTypeDictionary");function jl(r,e,t){let n,i;typeof r=="string"?(i=e,n=t):(i=r.range.start,n=e),i||(i=B.create(0,0));let s=vd(r),o=Kl(n),l=wm({lines:s,position:i,options:o});return bm({index:0,tokens:l,position:i})}a(jl,"parseJSDoc");function Vl(r,e){let t=Kl(e),n=vd(r);if(n.length===0)return!1;let i=n[0],s=n[n.length-1],o=t.start,l=t.end;return!!o?.exec(i)&&!!l?.exec(s)}a(Vl,"isJSDoc");function vd(r){let e="";return typeof r=="string"?e=r:e=r.text,e.split(uo)}a(vd,"getLines");var Ed=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,_m=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function wm(r){var e,t,n;let i=[],s=r.position.line,o=r.position.character;for(let l=0;l=f.length){if(i.length>0){let h=B.create(s,o);i.push({type:"break",content:"",range:U.create(h,h)})}}else{Ed.lastIndex=d;let h=Ed.exec(f);if(h){let g=h[0],T=h[1],k=B.create(s,o+d),R=B.create(s,o+d+g.length);i.push({type:"tag",content:T,range:U.create(k,R)}),d+=g.length,d=Wl(f,d)}if(d0&&i[i.length-1].type==="break"?i.slice(0,-1):i}a(wm,"tokenize");function Lm(r,e,t,n){let i=[];if(r.length===0){let s=B.create(t,n),o=B.create(t,n+e.length);i.push({type:"text",content:e,range:U.create(s,o)})}else{let s=0;for(let l of r){let c=l.index,u=e.substring(s,c);u.length>0&&i.push({type:"text",content:e.substring(s,c),range:U.create(B.create(t,s+n),B.create(t,c+n))});let f=u.length+1,d=l[1];if(i.push({type:"inline-tag",content:d,range:U.create(B.create(t,s+f+n),B.create(t,s+f+d.length+n))}),f+=d.length,l.length===4){f+=l[2].length;let p=l[3];i.push({type:"text",content:p,range:U.create(B.create(t,s+f+n),B.create(t,s+f+p.length+n))})}else i.push({type:"text",content:"",range:U.create(B.create(t,s+f+n),B.create(t,s+f+n))});s=c+l[0].length}let o=e.substring(s);o.length>0&&i.push({type:"text",content:o,range:U.create(B.create(t,s+n),B.create(t,s+n+o.length))})}return i}a(Lm,"buildInlineTokens");var Om=/\S/,$m=/\s*$/;function Wl(r,e){let t=r.substring(e).match(Om);return t?e+t.index:r.length}a(Wl,"skipWhitespace");function Pm(r){let e=r.match($m);if(e&&typeof e.index=="number")return e.index}a(Pm,"lastCharacter");function bm(r){var e,t,n,i;let s=B.create(r.position.line,r.position.character);if(r.tokens.length===0)return new Vs([],U.create(s,s));let o=[];for(;r.indext.name===e)}getTags(e){return this.getAllTags().filter(t=>t.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(let t of this.elements)if(e.length===0)e=t.toString();else{let n=t.toString();e+=Ad(e)+n}return e.trim()}toMarkdown(e){let t="";for(let n of this.elements)if(t.length===0)t=n.toMarkdown(e);else{let i=n.toMarkdown(e);t+=Ad(t)+i}return t.trim()}},gi=class{static{a(this,"JSDocTagImpl")}constructor(e,t,n,i){this.name=e,this.content=t,this.inline=n,this.range=i}toString(){let e=`@${this.name}`,t=this.content.toString();return this.content.inlines.length===1?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e}
${t}`),this.inline?`{${e}}`:e}toMarkdown(e){var t,n;return(n=(t=e?.renderTag)===null||t===void 0?void 0:t.call(e,this))!==null&&n!==void 0?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){let t=this.content.toMarkdown(e);if(this.inline){let s=Um(this.name,t,e??{});if(typeof s=="string")return s}let n="";e?.tag==="italic"||e?.tag===void 0?n="*":e?.tag==="bold"?n="**":e?.tag==="bold-italic"&&(n="***");let i=`${n}@${this.name}${n}`;return this.content.inlines.length===1?i=`${i} \u2014 ${t}`:this.content.inlines.length>1&&(i=`${i}
${t}`),this.inline?`{${i}}`:i}};function Um(r,e,t){var n,i;if(r==="linkplain"||r==="linkcode"||r==="link"){let s=e.indexOf(" "),o=e;if(s>0){let c=Wl(e,s);o=e.substring(c),e=e.substring(0,s)}return(r==="linkcode"||r==="link"&&t.link==="code")&&(o=`\`${o}\``),(i=(n=t.renderLink)===null||n===void 0?void 0:n.call(t,e,o))!==null&&i!==void 0?i:Gm(e,o)}}a(Um,"renderInlineTag");function Gm(r,e){try{return We.parse(r,!0),`[${e}](${r})`}catch{return r}}a(Gm,"renderLinkDefault");var yi=class{static{a(this,"JSDocTextImpl")}constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;tn.range.start.line&&(e+=`
`)}return e}toMarkdown(e){let t="";for(let n=0;ni.range.start.line&&(t+=`
`)}return t}},Ks=class{static{a(this,"JSDocLineImpl")}constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}};function Ad(r){return r.endsWith(`
`)?`
`:`
`}a(Ad,"fillNewlines");var Ti=class{static{a(this,"JSDocDocumentationProvider")}constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let t=this.commentProvider.getComment(e);if(t&&Vl(t))return jl(t).toMarkdown({renderLink:a((i,s)=>this.documentationLinkRenderer(e,i,s),"renderLink"),renderTag:a(i=>this.documentationTagRenderer(e,i),"renderTag")})}documentationLinkRenderer(e,t,n){var i;let s=(i=this.findNameInPrecomputedScopes(e,t))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,t);if(s&&s.nameSegment){let o=s.nameSegment.range.start.line+1,l=s.nameSegment.range.start.character+1,c=s.documentUri.with({fragment:`L${o},${l}`});return`[${n}](${c.toString()})`}else return}documentationTagRenderer(e,t){}findNameInPrecomputedScopes(e,t){let i=ge(e).precomputedScopes;if(!i)return;let s=e;do{let l=i.get(s).find(c=>c.name===t);if(l)return l;s=s.$container}while(s)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(i=>i.name===t)}};var xi=class{static{a(this,"DefaultCommentProvider")}constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var t;return Fl(e)?e.$comment:(t=ra(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||t===void 0?void 0:t.text}};var ce={};G(ce,nc(Ol(),1));var Ri=class{static{a(this,"DefaultAsyncParser")}constructor(e){this.syncParser=e.parser.LangiumParser}parse(e){return Promise.resolve(this.syncParser.parse(e))}},Hl=class{static{a(this,"AbstractThreadedAsyncParser")}constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length{if(this.queue.length>0){let t=this.queue.shift();t&&(e.lock(),t.resolve(e))}}),this.workerPool.push(e)}}async parse(e,t){let n=await this.acquireParserWorker(t),i=new Ue,s,o=t.onCancellationRequested(()=>{s=setTimeout(()=>{this.terminateWorker(n)},this.terminationDelay)});return n.parse(e).then(l=>{let c=this.hydrator.hydrate(l);i.resolve(c)}).catch(l=>{i.reject(l)}).finally(()=>{o.dispose(),clearTimeout(s)}),i.promise}terminateWorker(e){e.terminate();let t=this.workerPool.indexOf(e);t>=0&&this.workerPool.splice(t,1)}async acquireParserWorker(e){this.initializeWorkers();for(let n of this.workerPool)if(n.ready)return n.lock(),n;let t=new Ue;return e.onCancellationRequested(()=>{let n=this.queue.indexOf(t);n>=0&&this.queue.splice(n,1),t.reject(ft)}),this.queue.push(t),t.promise}},zl=class{static{a(this,"ParserWorker")}get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,t,n,i){this.onReadyEmitter=new ce.Emitter,this.deferred=new Ue,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=i,t(s=>{let o=s;this.deferred.resolve(o),this.unlock()}),n(s=>{this.deferred.reject(s),this.unlock()})}terminate(){this.deferred.reject(ft),this._terminate()}lock(){this._ready=!1}unlock(){this._parsing=!1,this._ready=!0,this.onReadyEmitter.fire()}parse(e){if(this._parsing)throw new Error("Parser worker is busy");return this._parsing=!0,this.deferred=new Ue,this.sendMessage(e),this.deferred.promise}};var Ei=class{static{a(this,"DefaultWorkspaceLock")}constructor(){this.previousTokenSource=new w.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let t=new w.CancellationTokenSource;return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,n){let i=new Ue,s={action:t,deferred:i,cancellationToken:n??w.CancellationToken.None};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;let 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:n,cancellationToken:i})=>{try{let s=await Promise.resolve().then(()=>t(i));n.resolve(s)}catch(s){Gt(s)?n.resolve(void 0):n.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}};var Ai=class{static{a(this,"DefaultHydrator")}constructor(e){this.grammarElementIdMap=new yr,this.tokenTypeIdMap=new yr,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors.map(t=>Object.assign({},t)),parserErrors:e.parserErrors.map(t=>Object.assign({},t)),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}createDehyrationContext(e){let t=new Map,n=new Map;for(let i of Qe(e))t.set(i,{});if(e.$cstNode)for(let i of Xt(e.$cstNode))n.set(i,{});return{astNodes:t,cstNodes:n}}dehydrateAstNode(e,t){let n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(let[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){let o=[];n[i]=o;for(let l of s)ae(l)?o.push(this.dehydrateAstNode(l,t)):Ae(l)?o.push(this.dehydrateReference(l,t)):o.push(l)}else ae(s)?n[i]=this.dehydrateAstNode(s,t):Ae(s)?n[i]=this.dehydrateReference(s,t):s!==void 0&&(n[i]=s);return n}dehydrateReference(e,t){let n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=t.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,t){let n=t.cstNodes.get(e);return ln(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=t.astNodes.get(e.astNode),Ke(e)?n.content=e.content.map(i=>this.dehydrateCstNode(i,t)):Pt(e)&&(n.tokenType=e.tokenType.name,n.offset=e.offset,n.length=e.length,n.startLine=e.range.start.line,n.startColumn=e.range.start.character,n.endLine=e.range.end.line,n.endColumn=e.range.end.character),n}hydrate(e){let t=e.value,n=this.createHydrationContext(t);return"$cstNode"in t&&this.hydrateCstNode(t.$cstNode,n),{lexerErrors:e.lexerErrors,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,n)}}createHydrationContext(e){let t=new Map,n=new Map;for(let s of Qe(e))t.set(s,{});let i;if(e.$cstNode)for(let s of Xt(e.$cstNode)){let o;"fullText"in s?(o=new Xr(s.fullText),i=o):"content"in s?o=new hr:"tokenType"in s&&(o=this.hydrateCstLeafNode(s)),o&&(n.set(s,o),o.root=i)}return{astNodes:t,cstNodes:n}}hydrateAstNode(e,t){let n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode&&(n.$cstNode=t.cstNodes.get(e.$cstNode));for(let[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){let o=[];n[i]=o;for(let l of s)ae(l)?o.push(this.setParent(this.hydrateAstNode(l,t),n)):Ae(l)?o.push(this.hydrateReference(l,n,i,t)):o.push(l)}else ae(s)?n[i]=this.setParent(this.hydrateAstNode(s,t),n):Ae(s)?n[i]=this.hydrateReference(s,n,i,t):s!==void 0&&(n[i]=s);return n}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,n,i){return this.linker.buildReference(t,n,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,n=0){let i=t.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=t.astNodes.get(e.astNode),Ke(i))for(let s of e.content){let o=this.hydrateCstNode(s,t,n++);i.content.push(o)}return i}hydrateCstLeafNode(e){let t=this.getTokenType(e.tokenType),n=e.offset,i=e.length,s=e.startLine,o=e.startColumn,l=e.endLine,c=e.endColumn,u=e.hidden;return new dr(n,i,{start:{line:s,character:o},end:{line:l,character:c}},t,u)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap();let t=this.grammarElementIdMap.getKey(e);if(t)return t;throw new Error("Invalid grammar element id: "+e)}createGrammarElementIdMap(){let e=0;for(let t of Qe(this.grammar))dn(t)&&this.grammarElementIdMap.set(t,e++)}};function ql(r){return{documentation:{CommentProvider:a(e=>new xi(e),"CommentProvider"),DocumentationProvider:a(e=>new Ti(e),"DocumentationProvider")},parser:{AsyncParser:a(e=>new Ri(e),"AsyncParser"),GrammarConfig:a(e=>So(e),"GrammarConfig"),LangiumParser:a(e=>Nl(e),"LangiumParser"),CompletionParser:a(e=>Il(e),"CompletionParser"),ValueConverter:a(()=>new gr,"ValueConverter"),TokenBuilder:a(()=>new mr,"TokenBuilder"),Lexer:a(e=>new mi(e),"Lexer"),ParserErrorMessageProvider:a(()=>new Yr,"ParserErrorMessageProvider")},workspace:{AstNodeLocator:a(()=>new ui,"AstNodeLocator"),AstNodeDescriptionProvider:a(e=>new li(e),"AstNodeDescriptionProvider"),ReferenceDescriptionProvider:a(e=>new ci(e),"ReferenceDescriptionProvider")},references:{Linker:a(e=>new Jn(e),"Linker"),NameProvider:a(()=>new Qn,"NameProvider"),ScopeProvider:a(e=>new ni(e),"ScopeProvider"),ScopeComputation:a(e=>new ei(e),"ScopeComputation"),References:a(e=>new Zn(e),"References")},serializer:{Hydrator:a(e=>new Ai(e),"Hydrator"),JsonSerializer:a(e=>new ii(e),"JsonSerializer")},validation:{DocumentValidator:a(e=>new oi(e),"DocumentValidator"),ValidationRegistry:a(e=>new ai(e),"ValidationRegistry")},shared:a(()=>r.shared,"shared")}}a(ql,"createDefaultCoreModule");function Xl(r){return{ServiceRegistry:a(()=>new si,"ServiceRegistry"),workspace:{LangiumDocuments:a(e=>new Yn(e),"LangiumDocuments"),LangiumDocumentFactory:a(e=>new Xn(e),"LangiumDocumentFactory"),DocumentBuilder:a(e=>new di(e),"DocumentBuilder"),IndexManager:a(e=>new hi(e),"IndexManager"),WorkspaceManager:a(e=>new pi(e),"WorkspaceManager"),FileSystemProvider:a(e=>r.fileSystemProvider(e),"FileSystemProvider"),WorkspaceLock:a(()=>new Ei,"WorkspaceLock"),ConfigurationProvider:a(e=>new fi(e),"ConfigurationProvider")}}}a(Xl,"createDefaultSharedCoreModule");var Yl;(function(r){r.merge=(e,t)=>Hs(Hs({},e),t)})(Yl||(Yl={}));function zs(r,e,t,n,i,s,o,l,c){let u=[r,e,t,n,i,s,o,l,c].reduce(Hs,{});return wd(u)}a(zs,"inject");var Jl=Symbol("isProxy");function _d(r){if(r&&r[Jl])for(let e of Object.values(r))_d(e);return r}a(_d,"eagerLoad");function wd(r,e){let t=new Proxy({},{deleteProperty:a(()=>!1,"deleteProperty"),get:a((n,i)=>Cd(n,i,r,e||t),"get"),getOwnPropertyDescriptor:a((n,i)=>(Cd(n,i,r,e||t),Object.getOwnPropertyDescriptor(n,i)),"getOwnPropertyDescriptor"),has:a((n,i)=>i in r,"has"),ownKeys:a(()=>[...Reflect.ownKeys(r),Jl],"ownKeys")});return t[Jl]=!0,t}a(wd,"_inject");var Sd=Symbol();function Cd(r,e,t,n){if(e in r){if(r[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:r[e]});if(r[e]===Sd)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. See https://langium.org/docs/configuration-services/#resolving-cyclic-dependencies');return r[e]}else if(e in t){let i=t[e];r[e]=Sd;try{r[e]=typeof i=="function"?i(n):wd(i,n)}catch(s){throw r[e]=s instanceof Error?s:void 0,s}return r[e]}else return}a(Cd,"_resolve");function Hs(r,e){if(e){for(let[t,n]of Object.entries(e))if(n!==void 0){let i=r[t];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?r[t]=Hs(i,n):r[t]=n}}return r}a(Hs,"_merge");var W={};Vt(W,{AstUtils:()=>Fi,BiMap:()=>yr,Cancellation:()=>w,ContextCache:()=>Tr,CstUtils:()=>Si,DONE_RESULT:()=>be,Deferred:()=>Ue,Disposable:()=>xr,DisposableCache:()=>rn,DocumentCache:()=>Bs,EMPTY_STREAM:()=>cn,ErrorWithLocation:()=>Jt,GrammarUtils:()=>Vi,MultiMap:()=>dt,OperationCancelled:()=>ft,Reduction:()=>Ar,RegExpUtils:()=>Wi,SimpleCache:()=>ri,StreamImpl:()=>He,TreeStreamImpl:()=>at,URI:()=>We,UriUtils:()=>Ge,WorkspaceCache:()=>nn,assertUnreachable:()=>bt,delayNextTick:()=>Ml,interruptAndCheck:()=>Te,isOperationCancelled:()=>Gt,loadGrammarFromJson:()=>Bt,setInterruptionPeriod:()=>dd,startCancelableOperation:()=>fd,stream:()=>K});G(W,ce);var qs=class{static{a(this,"EmptyFileSystemProvider")}readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}},Ql={fileSystemProvider:a(()=>new qs,"fileSystemProvider")};var Bm={Grammar:a(()=>{},"Grammar"),LanguageMetaData:a(()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"}),"LanguageMetaData")},Wm={AstReflection:a(()=>new kr,"AstReflection")};function jm(){let r=zs(Xl(Ql),Wm),e=zs(ql({shared:r}),Bm);return r.ServiceRegistry.register(e),e}a(jm,"createMinimalGrammarServices");function Bt(r){var e;let t=jm(),n=t.serializer.JsonSerializer.deserialize(r);return t.shared.workspace.LangiumDocumentFactory.fromModel(n,We.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}a(Bt,"loadGrammarFromJson");G(pe,W);var Vm=Object.defineProperty,j=a((r,e)=>Vm(r,"name",{value:e,configurable:!0}),"__name"),Km="Statement",Hm="Architecture";function zm(r){return it.isInstance(r,Hm)}a(zm,"isArchitecture");j(zm,"isArchitecture");var Md="Branch";function qm(r){return it.isInstance(r,Md)}a(qm,"isBranch");j(qm,"isBranch");var Xm="Checkout",Ym="CherryPicking",Dd="Commit";function Jm(r){return it.isInstance(r,Dd)}a(Jm,"isCommit");j(Jm,"isCommit");var Qm="Common";function Zm(r){return it.isInstance(r,Qm)}a(Zm,"isCommon");j(Zm,"isCommon");var Fd="GitGraph";function eg(r){return it.isInstance(r,Fd)}a(eg,"isGitGraph");j(eg,"isGitGraph");var tg="Info";function rg(r){return it.isInstance(r,tg)}a(rg,"isInfo");j(rg,"isInfo");var Ud="Merge";function ng(r){return it.isInstance(r,Ud)}a(ng,"isMerge");j(ng,"isMerge");var ig="Packet";function sg(r){return it.isInstance(r,ig)}a(sg,"isPacket");j(sg,"isPacket");var ag="PacketBlock";function og(r){return it.isInstance(r,ag)}a(og,"isPacketBlock");j(og,"isPacketBlock");var lg="Pie";function cg(r){return it.isInstance(r,lg)}a(cg,"isPie");j(cg,"isPie");var ug="PieSection";function fg(r){return it.isInstance(r,ug)}a(fg,"isPieSection");j(fg,"isPieSection");var dg="Direction",Gd=class extends zt{static{a(this,"MermaidAstReflection")}static{j(this,"MermaidAstReflection")}getAllTypes(){return["Architecture","Branch","Checkout","CherryPicking","Commit","Common","Direction","Edge","GitGraph","Group","Info","Junction","Merge","Packet","PacketBlock","Pie","PieSection","Service","Statement"]}computeIsSubtype(r,e){switch(r){case Md:case Xm:case Ym:case Dd:case Ud:return this.isSubtype(Km,e);case dg:return this.isSubtype(Fd,e);default:return!1}}getReferenceType(r){let e=`${r.container.$type}:${r.property}`;switch(e){default:throw new Error(`${e} is not a valid reference id.`)}}getTypeMetaData(r){switch(r){case"Architecture":return{name:"Architecture",properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case"Branch":return{name:"Branch",properties:[{name:"name"},{name:"order"}]};case"Checkout":return{name:"Checkout",properties:[{name:"branch"}]};case"CherryPicking":return{name:"CherryPicking",properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case"Commit":return{name:"Commit",properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Common":return{name:"Common",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Edge":return{name:"Edge",properties:[{name:"lhsDir"},{name:"lhsGroup",defaultValue:!1},{name:"lhsId"},{name:"lhsInto",defaultValue:!1},{name:"rhsDir"},{name:"rhsGroup",defaultValue:!1},{name:"rhsId"},{name:"rhsInto",defaultValue:!1},{name:"title"}]};case"GitGraph":return{name:"GitGraph",properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case"Group":return{name:"Group",properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case"Info":return{name:"Info",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Junction":return{name:"Junction",properties:[{name:"id"},{name:"in"}]};case"Merge":return{name:"Merge",properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Packet":return{name:"Packet",properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case"PacketBlock":return{name:"PacketBlock",properties:[{name:"end"},{name:"label"},{name:"start"}]};case"Pie":return{name:"Pie",properties:[{name:"accDescr"},{name:"accTitle"},{name:"sections",defaultValue:[]},{name:"showData",defaultValue:!1},{name:"title"}]};case"PieSection":return{name:"PieSection",properties:[{name:"label"},{name:"value"}]};case"Service":return{name:"Service",properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case"Direction":return{name:"Direction",properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};default:return{name:r,properties:[]}}}},it=new Gd,Ld,hg=j(()=>Ld??(Ld=Bt('{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","name":"Info","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"InfoGrammar"),Od,pg=j(()=>Od??(Od=Bt(`{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","name":"Packet","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"packet-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}`)),"PacketGrammar"),$d,mg=j(()=>$d??($d=Bt('{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","name":"Pie","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"PIE_SECTION_LABEL","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]+\\"/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PIE_SECTION_VALUE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"PieGrammar"),Pd,gg=j(()=>Pd??(Pd=Bt('{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","name":"Architecture","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LeftPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RightPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Arrow","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ID","definition":{"$type":"RegexToken","regex":"/[\\\\w]+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TEXT_ICON","definition":{"$type":"RegexToken","regex":"/\\\\(\\"[^\\"]+\\"\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"ArchitectureGrammar"),bd,yg=j(()=>bd??(bd=Bt(`{"$type":"Grammar","isDeclared":true,"name":"GitGraph","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"ParserRule","name":"GitGraph","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+(?=\\\\s)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}`)),"GitGraphGrammar"),Tg={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},xg={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},Rg={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},Eg={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},Ag={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},tC={AstReflection:j(()=>new Gd,"AstReflection")},rC={Grammar:j(()=>hg(),"Grammar"),LanguageMetaData:j(()=>Tg,"LanguageMetaData"),parser:{}},nC={Grammar:j(()=>pg(),"Grammar"),LanguageMetaData:j(()=>xg,"LanguageMetaData"),parser:{}},iC={Grammar:j(()=>mg(),"Grammar"),LanguageMetaData:j(()=>Rg,"LanguageMetaData"),parser:{}},sC={Grammar:j(()=>gg(),"Grammar"),LanguageMetaData:j(()=>Eg,"LanguageMetaData"),parser:{}},aC={Grammar:j(()=>yg(),"Grammar"),LanguageMetaData:j(()=>Ag,"LanguageMetaData"),parser:{}},vg=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,kg=/accTitle[\t ]*:([^\n\r]*)/,Ig=/title([\t ][^\n\r]*|)/,Ng={ACC_DESCR:vg,ACC_TITLE:kg,TITLE:Ig},Sg=class extends gr{static{a(this,"AbstractMermaidValueConverter")}static{j(this,"AbstractMermaidValueConverter")}runConverter(r,e,t){let n=this.runCommonConverter(r,e,t);return n===void 0&&(n=this.runCustomConverter(r,e,t)),n===void 0?super.runConverter(r,e,t):n}runCommonConverter(r,e,t){let n=Ng[r.name];if(n===void 0)return;let i=n.exec(e);if(i!==null){if(i[1]!==void 0)return i[1].trim().replace(/[\t ]{2,}/gm," ");if(i[2]!==void 0)return i[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,`
`)}}},lC=class extends Sg{static{a(this,"CommonValueConverter")}static{j(this,"CommonValueConverter")}runCustomConverter(r,e,t){}},Cg=class extends mr{static{a(this,"AbstractMermaidTokenBuilder")}static{j(this,"AbstractMermaidTokenBuilder")}constructor(r){super(),this.keywords=new Set(r)}buildKeywordTokens(r,e,t){let n=super.buildKeywordTokens(r,e,t);return n.forEach(i=>{this.keywords.has(i.name)&&i.PATTERN!==void 0&&(i.PATTERN=new RegExp(i.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),n}},uC=class extends Cg{static{a(this,"CommonTokenBuilder")}static{j(this,"CommonTokenBuilder")}};export{ql as a,Xl as b,zs as c,Ql as d,pe as e,j as f,tC as g,rC as h,nC as i,iC as j,sC as k,aC as l,Sg as m,lC as n,Cg as o};