Files
static-php-cli/assets/chunks/wardley-L42UT6IY.C8rjnVeB.js

174 lines
599 KiB
JavaScript
Raw Normal View History

import{W as er}from"./framework.C2AwuPrQ.js";var LN=Object.create,pc=Object.defineProperty,DN=Object.getOwnPropertyDescriptor,xh=Object.getOwnPropertyNames,MN=Object.getPrototypeOf,xN=Object.prototype.hasOwnProperty,s=(t,e)=>pc(t,"name",{value:e,configurable:!0}),FN=(t,e)=>function(){return t&&(e=(0,t[xh(t)[0]])(t=0)),e},Y=(t,e)=>function(){return e||(0,t[xh(t)[0]])((e={exports:{}}).exports,e),e.exports},Zr=(t,e)=>{for(var r in e)pc(t,r,{get:e[r],enumerable:!0})},Fh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of xh(e))!xN.call(t,a)&&a!==r&&pc(t,a,{get:()=>e[a],enumerable:!(n=DN(e,a))||n.enumerable});return t},uf=(t,e,r)=>(Fh(t,e,"default"),r),Gh=(t,e,r)=>(r=t!=null?LN(MN(t)):{},Fh(pc(r,"default",{value:t,enumerable:!0}),t)),jh=t=>Fh(pc({},"__esModule",{value:!0}),t),ff={};Zr(ff,{AnnotatedTextEdit:()=>Tr,ChangeAnnotation:()=>un,ChangeAnnotationIdentifier:()=>Xe,CodeAction:()=>Ap,CodeActionContext:()=>$p,CodeActionKind:()=>Rp,CodeActionTriggerKind:()=>Il,CodeDescription:()=>Zd,CodeLens:()=>Ep,Color:()=>tu,ColorInformation:()=>qd,ColorPresentation:()=>Vd,Command:()=>cn,CompletionItem:()=>lp,CompletionItemKind:()=>rp,CompletionItemLabelDetails:()=>op,CompletionItemTag:()=>ap,CompletionList:()=>cp,CreateFile:()=>Ta,DeleteFile:()=>$a,Diagnostic:()=>Cl,DiagnosticRelatedInformation:()=>ru,DiagnosticSeverity:()=>Xd,DiagnosticTag:()=>Jd,DocumentHighlight:()=>hp,DocumentHighlightKind:()=>pp,DocumentLink:()=>Cp,DocumentSymbol:()=>Tp,DocumentUri:()=>Bd,EOL:()=>hT,FoldingRange:()=>Yd,FoldingRangeKind:()=>Hd,FormattingOptions:()=>_p,Hover:()=>up,InlayHint:()=>Lp,InlayHintKind:()=>iu,InlayHintLabelPart:()=>su,InlineCompletionContext:()=>jp,InlineCompletionItem:()=>Mp,InlineCompletionList:()=>xp,InlineCompletionTriggerKind:()=>Fp,InlineValueContext:()=>Op,InlineValueEvaluatableExpression:()=>Pp,InlineValueText:()=>Np,InlineValueVariableLookup:()=>kp,InsertReplaceEdit:()=>ip,InsertTextFormat:()=>np,InsertTextMode:()=>sp,Location:()=>_l,LocationLink:()=>Wd,MarkedString:()=>wl,MarkupContent:()=>Aa,MarkupKind:()=>au,OptionalVersionedTextDocumentIdentifier:()=>bl,ParameterInformation:()=>fp,Position:()=>ie,Range:()=>ee,RenameFile:()=>Ra,SelectedCompletionInfo:()=>Gp,SelectionRange:()=>Sp,SemanticTokenModifiers:()=>wp,SemanticTokenTypes:()=>bp,SemanticTokens:()=>Ip,SignatureInformation:()=>dp,StringValue:()=>Dp,SymbolInformation:()=>yp,SymbolKind:()=>mp,SymbolTag:()=>gp,TextDocument:()=>zp,TextDocumentEdit:()=>Sl,TextDocumentIdentifier:()=>Qd,TextDocumentItem:()=>tp,TextEdit:()=>rr,URI:()=>eu,VersionedTextDocumentIdentifier:()=>ep,WorkspaceChange:()=>pT,WorkspaceEdit:()=>nu,WorkspaceFolder:()=>Up,WorkspaceSymbol:()=>vp,integer:()=>Kd,uinteger:()=>El});var Bd,eu,Kd,El,ie,ee,_l,Wd,tu,qd,Vd,Hd,Yd,ru,Xd,Jd,Zd,Cl,cn,rr,un,Xe,Tr,Sl,Ta,Ra,$a,nu,pl,Rd,pT,Qd,ep,bl,tp,au,Aa,rp,np,ap,ip,sp,op,lp,cp,wl,up,fp,dp,pp,hp,mp,gp,yp,vp,Tp,Rp,Il,$p,Ap,Ep,_p,Cp,Sp,bp,wp,Ip,Np,kp,Pp,Op,iu,su,Lp,Dp,Mp,xp,Fp,Gp,jp,Up,hT,zp,Ey,E,hc=FN({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Bd||(Bd={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(eu||(eu={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kd||(Kd={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(El||(El={})),(function(a){function i(c,l){return c===Number.MAX_VALUE&&(c=El.MAX_VALUE),l===Number.MAX_VALUE&&(l=El.MAX_VALUE),{line:c,character:l}}s(i,"create"),a.create=i;function o(c){let l=c;return E.objectLiteral(l)&&E.uinteger(l.line)&&E.uinteger(l.character)}s(o,"is"),a.is=o})(ie||(ie={})),(function(a){function i(c,l,u,f){if(E.uinteger(c)&&E.uinteger(l)&&E.uinteger(u)&&E.uinteger(f))return{start:ie.create(c,l),end:ie.create(u,f)};if(ie.is(c)&&ie.is(l))return{start:c,end:l};throw new Error(`Range#create calle
`,`\r
`,"\r"],(function(a){function i(u,f,d,p){return new Ey(u,f,d,p)}s(i,"create"),a.create=i;function o(u){let f=u;return!!(E.defined(f)&&E.string(f.uri)&&(E.undefined(f.languageId)||E.string(f.languageId))&&E.uinteger(f.lineCount)&&E.func(f.getText)&&E.func(f.positionAt)&&E.func(f.offsetAt))}s(o,"is"),a.is=o;function c(u,f){let d=u.getText(),p=l(f,(m,T)=>{let _=m.range.start.line-T.range.start.line;return _===0?m.range.start.character-T.range.start.character:_}),g=d.length;for(let m=p.length-1;m>=0;m--){let T=p[m],_=u.offsetAt(T.range.start),v=u.offsetAt(T.range.end);if(v<=g)d=d.substring(0,_)+T.newText+d.substring(v,d.length);else throw new Error("Overlapping edit");g=_}return d}s(c,"applyEdits"),a.applyEdits=c;function l(u,f){if(u.length<=1)return u;const d=u.length/2|0,p=u.slice(0,d),g=u.slice(d);l(p,f),l(g,f);let m=0,T=0,_=0;for(;m<p.length&&T<g.length;)f(p[m],g[T])<=0?u[_++]=p[m++]:u[_++]=g[T++];for(;m<p.length;)u[_++]=p[m++];for(;T<g.length;)u[_++]=g[T++];return u}s(l,"mergeSort")})(zp||(zp={})),Ey=(n=class{constructor(i,o,c,l){this._uri=i,this._languageId=o,this._version=c,this._content=l,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(i){if(i){let o=this.offsetAt(i.start),c=this.offsetAt(i.end);return this._content.substring(o,c)}return this._content}update(i,o){this._content=i.text,this._version=o,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let i=[],o=this._content,c=!0;for(let l=0;l<o.length;l++){c&&(i.push(l),c=!1);let u=o.charAt(l);c=u==="\r"||u===`
`,u==="\r"&&l+1<o.length&&o.charAt(l+1)===`
`&&l++}c&&o.length>0&&i.push(o.length),this._lineOffsets=i}return this._lineOffsets}positionAt(i){i=Math.max(Math.min(i,this._content.length),0);let o=this.getLineOffsets(),c=0,l=o.length;if(l===0)return ie.create(0,i);for(;c<l;){let f=Math.floor((c+l)/2);o[f]>i?l=f:c=f+1}let u=c-1;return ie.create(u,i-o[u])}offsetAt(i){let o=this.getLineOffsets();if(i.line>=o.length)return this._content.length;if(i.line<0)return 0;let c=o[i.line],l=i.line+1<o.length?o[i.line+1]:this._content.length;return Math.max(Math.min(c+i.character,l),c)}get lineCount(){return this.getLineOffsets().length}},s(n,"FullTextDocument"),n),(function(a){const i=Object.prototype.toString;function o(v){return typeof v<"u"}s(o,"defined"),a.defined=o;function c(v){return typeof v>"u"}s(c,"undefined"),a.undefined=c;function l(v){return v===!0||v===!1}s(l,"boolean"),a.boolean=l;function u(v){return i.call(v)==="[object String]"}s(u,"string"),a.string=u;function f(v){return i.call(v)==="[object Number]"}s(f,"number"),a.number=f;function d(v,w,C){return i.call(v)==="[object Number]"&&w<=v&&v<=C}s(d,"numberRange"),a.numberRange=d;function p(v){return i.call(v)==="[object Number]"&&-2147483648<=v&&v<=2147483647}s(p,"integer"),a.integer=p;function g(v){return i.call(v)==="[object Number]"&&0<=v&&v<=2147483647}s(g,"uinteger"),a.uinteger=g;function m(v){return i.call(v)==="[object Function]"}s(m,"func"),a.func=m;function T(v){return v!==null&&typeof v=="object"}s(T,"objectLiteral"),a.objectLiteral=T;function _(v,w){return Array.isArray(v)&&v.every(w)}s(_,"typedArray"),a.typedArray=_})(E||(E={}))}}),Un=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e;function r(){if(e===void 0)throw new Error("No runtime abstraction layer installed");return e}s(r,"RAL"),(function(n){function a(i){if(i===void 0)throw new Error("No runtime abstraction layer provided");e=i}s(a,"install"),n.install=a})(r||(r={})),t.default=r}}),mc=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.stringArray=t.array=t.func=t.error=t.number=t.string=t.boolean=void 0;function e(l){return l===!0||l===!1}s(e,"boolean"),t.boolean=e;function r(l){return typeof l=="string"||l instanceof String}s(r,"string"),t.string=r;function n(l){return typeof l=="number"||l instanceof Number}s(n,"number"),t.number=n;function a(l){return l instanceof Error}s(a,"error"),t.error=a;function i(l){return typeof l=="function"}s(i,"func"),t.func=i;function o(l){return Array.isArray(l)}s(o,"array"),t.array=o;function c(l){return o(l)&&l.every(u=>r(u))}s(c,"stringArray"),t.stringArray=c}}),Go=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js"(t){var i,o;Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=t.Event=void 0;var e=Un(),r;(function(c){const l={dispose(){}};c.None=function(){return l}})(r||(t.Event=r={}));var n=(i=class{add(l,u=null,f){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(l),this._contexts.push(u),Array.isArray(f)&&f.push({dispose:s(()=>this.remove(l,u),"dispose")})}remove(l,u=null){if(!this._callbacks)return;let f=!1;for(let d=0,p=this._callbacks.length;d<p;d++)if(this._callbacks[d]===l)if(this._contexts[d]===u){this._callbacks.splice(d,1),this._contexts.splice(d,1);return}else f=!0;if(f)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...l){if(!this._callbacks)return[];const u=[],f=this._callbacks.slice(0),d=this._contexts.slice(0);for(let p=0,g=f.length;p<g;p++)try{u.push(f[p].apply(d[p],l))}catch(m){(0,e.default)().console.error(m)}return u}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},s(i,"CallbackList"),i),a=(o=class{constructor(l){this._options=l}get event(){return this._event||(this._event=(l,u,f)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._
${JSON.stringify(Object.fromEntries(m))}`));return}const _=parseInt(T);if(isNaN(_)){this.fireError(new Error(`Content-Length value must be a number. Got ${T}`));return}this.nextMessageLength=_}const g=this.buffer.tryReadBody(this.nextMessageLength);if(g===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const m=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(g):g,T=await this.options.contentTypeDecoder.decode(m,this.options);this.callback(T)}).catch(m=>{this.fireError(m)})}}catch(g){this.fireError(g)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,e.default)().timer.setTimeout((p,g)=>{this.partialMessageTimer=void 0,p===this.messageToken&&(this.firePartialMessage({messageToken:p,waitingTime:g}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}},s(f,"ReadableStreamMessageReader"),f);t.ReadableStreamMessageReader=l}}),zN=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(t){var d,p;Object.defineProperty(t,"__esModule",{value:!0}),t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=void 0;var e=Un(),r=mc(),n=yT(),a=Go(),i="Content-Length: ",o=`\r
`,c;(function(g){function m(T){let _=T;return _&&r.func(_.dispose)&&r.func(_.onClose)&&r.func(_.onError)&&r.func(_.write)}s(m,"is"),g.is=m})(c||(t.MessageWriter=c={}));var l=(d=class{constructor(){this.errorEmitter=new a.Emitter,this.closeEmitter=new a.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(m,T,_){this.errorEmitter.fire([this.asError(m),T,_])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(m){return m instanceof Error?m:new Error(`Writer received error. Reason: ${r.string(m.message)?m.message:"unknown"}`)}},s(d,"AbstractMessageWriter"),d);t.AbstractMessageWriter=l;var u;(function(g){function m(T){return T===void 0||typeof T=="string"?{charset:T??"utf-8",contentTypeEncoder:(0,e.default)().applicationJson.encoder}:{charset:T.charset??"utf-8",contentEncoder:T.contentEncoder,contentTypeEncoder:T.contentTypeEncoder??(0,e.default)().applicationJson.encoder}}s(m,"fromOptions"),g.fromOptions=m})(u||(u={}));var f=(p=class extends l{constructor(m,T){super(),this.writable=m,this.options=u.fromOptions(T),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(_=>this.fireError(_)),this.writable.onClose(()=>this.fireClose())}async write(m){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(m,this.options).then(_=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(_):_).then(_=>{const v=[];return v.push(i,_.byteLength.toString(),o),v.push(o),this.doWrite(m,v,_)},_=>{throw this.fireError(_),_}))}async doWrite(m,T,_){try{return await this.writable.write(T.join(""),"ascii"),this.writable.write(_)}catch(v){return this.handleError(v,m),Promise.reject(v)}}handleError(m,T){this.errorCount++,this.fireError(m,T,this.errorCount)}end(){this.writable.end()}},s(p,"WriteableStreamMessageWriter"),p);t.WriteableStreamMessageWriter=f}}),BN=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractMessageBuffer=void 0;var e=13,r=10,n=`\r
`,a=(i=class{constructor(c="utf-8"){this._encoding=c,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(c){const l=typeof c=="string"?this.fromString(c,this._encoding):c;this._chunks.push(l),this._totalLength+=l.byteLength}tryReadHeaders(c=!1){if(this._chunks.length===0)return;let l=0,u=0,f=0,d=0;e:for(;u<this._chunks.length;){const T=this._chunks[u];for(f=0;f<T.length;){switch(T[f]){case e:switch(l){case 0:l=1;break;case 2:l=3;break;default:l=0}break;case r:switch(l){case 1:l=2;break;case 3:l=4,f++;break e;default:l=0}break;default:l=0}f++}d+=T.byteLength,u++}if(l!==4)return;const p=this._read(d+f),g=new Map,m=this.toString(p,"ascii").split(n);if(m.length<2)return g;for(let T=0;T<m.length-2;T++){const _=m[T],v=_.indexOf(":");if(v===-1)throw new Error(`Message header must separate key and value using ':'
${_}`);const w=_.substr(0,v),C=_.substr(v+1).trim();g.set(c?w.toLowerCase():w,C)}return g}tryReadBody(c){if(!(this._totalLength<c))return this._read(c)}get numberOfBytes(){return this._totalLength}_read(c){if(c===0)return this.emptyBuffer();if(c>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===c){const d=this._chunks[0];return this._chunks.shift(),this._totalLength-=c,this.asNative(d)}if(this._chunks[0].byteLength>c){const d=this._chunks[0],p=this.asNative(d,c);return this._chunks[0]=d.slice(c),this._totalLength-=c,p}const l=this.allocNative(c);let u=0,f=0;for(;c>0;){const d=this._chunks[f];if(d.byteLength>c){const p=d.slice(0,c);l.set(p,u),u+=c,this._chunks[f]=d.slice(c),this._totalLength-=c,c-=c}else l.set(d,u),u+=d.byteLength,this._chunks.shift(),this._totalLength-=d.byteLength,c-=d.byteLength}return l}},s(i,"AbstractMessageBuffer"),i);t.AbstractMessageBuffer=a}}),KN=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/connection.js"(t){var P,S;Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.RequestCancellationReceiverStrategy=t.IdCancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=t.NullLogger=t.ProgressType=t.ProgressToken=void 0;var e=Un(),r=mc(),n=mT(),a=gT(),i=Go(),o=df(),c;(function(R){R.type=new n.NotificationType("$/cancelRequest")})(c||(c={}));var l;(function(R){function I($){return typeof $=="string"||typeof $=="number"}s(I,"is"),R.is=I})(l||(t.ProgressToken=l={}));var u;(function(R){R.type=new n.NotificationType("$/progress")})(u||(u={}));var f=(P=class{constructor(){}},s(P,"ProgressType"),P);t.ProgressType=f;var d;(function(R){function I($){return r.func($)}s(I,"is"),R.is=I})(d||(d={})),t.NullLogger=Object.freeze({error:s(()=>{},"error"),warn:s(()=>{},"warn"),info:s(()=>{},"info"),log:s(()=>{},"log")});var p;(function(R){R[R.Off=0]="Off",R[R.Messages=1]="Messages",R[R.Compact=2]="Compact",R[R.Verbose=3]="Verbose"})(p||(t.Trace=p={}));var g;(function(R){R.Off="off",R.Messages="messages",R.Compact="compact",R.Verbose="verbose"})(g||(t.TraceValues=g={})),(function(R){function I(A){if(!r.string(A))return R.Off;switch(A=A.toLowerCase(),A){case"off":return R.Off;case"messages":return R.Messages;case"compact":return R.Compact;case"verbose":return R.Verbose;default:return R.Off}}s(I,"fromString"),R.fromString=I;function $(A){switch(A){case R.Off:return"off";case R.Messages:return"messages";case R.Compact:return"compact";case R.Verbose:return"verbose";default:return"off"}}s($,"toString"),R.toString=$})(p||(t.Trace=p={}));var m;(function(R){R.Text="text",R.JSON="json"})(m||(t.TraceFormat=m={})),(function(R){function I($){return r.string($)?($=$.toLowerCase(),$==="json"?R.JSON:R.Text):R.Text}s(I,"fromString"),R.fromString=I})(m||(t.TraceFormat=m={}));var T;(function(R){R.type=new n.NotificationType("$/setTrace")})(T||(t.SetTraceNotification=T={}));var _;(function(R){R.type=new n.NotificationType("$/logTrace")})(_||(t.LogTraceNotification=_={}));var v;(function(R){R[R.Closed=1]="Closed",R[R.Disposed=2]="Disposed",R[R.AlreadyListening=3]="AlreadyListening"})(v||(t.ConnectionErrors=v={}));var w=(S=class extends Error{constructor(I,$){super($),this.code=I,Object.setPrototypeOf(this,S.prototype)}},s(S,"ConnectionError"),S);t.ConnectionError=w;var C;(function(R){function I($){const A=$;return A&&r.func(A.cancelUndispatched)}s(I,"is"),R.is=I})(C||(t.ConnectionStrategy=C={}));var k;(function(R){function I($){const A=$;return A&&(A.kind===void 0||A.kind==="id")&&r.func(A.createCancellationTokenSource)&&(A.dispose===void 0||r.func(A.dispose))}s(I,"is"),R.is=I})(k||(t.IdCancellationReceiverStrategy=k={}));var B;(function(R){function I($){const A=$;return A&&A.kind==="request"&&r.func(A.createCancellationTokenSource)&&(A.dispose===void 0||r.func(A.dispose))}s(I,"is"),R.is=I})(B||(t.Re
${JSON.stringify(y.error,void 0,4)}`):b.error("Received response message without id. No further error information provided.");else{const N=y.id,D=ye.get(N);if(ul(y,D),D!==void 0){ye.delete(N);try{if(y.error){const G=y.error;D.reject(new n.ResponseError(G.code,G.message,G.data))}else if(y.result!==void 0)D.resolve(y.result);else throw new Error("Should never happen.")}catch(G){G.message?b.error(`Response handler '${D.method}' failed with message: ${G.message}`):b.error(`Response handler '${D.method}' failed unexpectedly.`)}}}}s(al,"handleResponse");function il(y){if(Jt())return;let N,D;if(y.method===c.type.method){const G=y.params.id;Ie.delete(G),nn(y);return}else{const G=Q.get(y.method);G&&(D=G.handler,N=G.type)}if(D||U)try{if(nn(y),D)if(y.params===void 0)N!==void 0&&N.numberOfParams!==0&&N.parameterStructures!==n.ParameterStructures.byName&&b.error(`Notification ${y.method} defines ${N.numberOfParams} params but received none.`),D();else if(Array.isArray(y.params)){const G=y.params;y.method===u.type.method&&G.length===2&&l.is(G[0])?D({token:G[0],value:G[1]}):(N!==void 0&&(N.parameterStructures===n.ParameterStructures.byName&&b.error(`Notification ${y.method} defines parameters by name but received parameters by position`),N.numberOfParams!==y.params.length&&b.error(`Notification ${y.method} defines ${N.numberOfParams} params but received ${G.length} arguments`)),D(...G))}else N!==void 0&&N.parameterStructures===n.ParameterStructures.byPosition&&b.error(`Notification ${y.method} defines parameters by position but received parameters by name`),D(y.params);else U&&U(y.method,y.params)}catch(G){G.message?b.error(`Notification handler '${y.method}' failed with message: ${G.message}`):b.error(`Notification handler '${y.method}' failed unexpectedly.`)}else ze.fire(y)}s(il,"handleNotification");function sl(y){if(!y){b.error("Received empty message.");return}b.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(y,null,4)}`);const N=y;if(r.string(N.id)||r.number(N.id)){const D=N.id,G=ye.get(D);G&&G.reject(new Error("The received response has neither a result nor an error property."))}}s(sl,"handleInvalidMessage");function kt(y){if(y!=null)switch(J){case p.Verbose:return JSON.stringify(y,null,4);case p.Compact:return JSON.stringify(y);default:return}}s(kt,"stringifyTrace");function ol(y){if(!(J===p.Off||!le))if(Ue===m.Text){let N;(J===p.Verbose||J===p.Compact)&&y.params&&(N=`Params: ${kt(y.params)}
`),le.log(`Sending request '${y.method} - (${y.id})'.`,N)}else Zt("send-request",y)}s(ol,"traceSendingRequest");function ll(y){if(!(J===p.Off||!le))if(Ue===m.Text){let N;(J===p.Verbose||J===p.Compact)&&(y.params?N=`Params: ${kt(y.params)}
`:N=`No parameters provided.
`),le.log(`Sending notification '${y.method}'.`,N)}else Zt("send-notification",y)}s(ll,"traceSendingNotification");function Gr(y,N,D){if(!(J===p.Off||!le))if(Ue===m.Text){let G;(J===p.Verbose||J===p.Compact)&&(y.error&&y.error.data?G=`Error data: ${kt(y.error.data)}
`:y.result?G=`Result: ${kt(y.result)}
`:y.error===void 0&&(G=`No result returned.
`)),le.log(`Sending response '${N} - (${y.id})'. Processing request took ${Date.now()-D}ms`,G)}else Zt("send-response",y)}s(Gr,"traceSendingResponse");function cl(y){if(!(J===p.Off||!le))if(Ue===m.Text){let N;(J===p.Verbose||J===p.Compact)&&y.params&&(N=`Params: ${kt(y.params)}
`),le.log(`Received request '${y.method} - (${y.id})'.`,N)}else Zt("receive-request",y)}s(cl,"traceReceivedRequest");function nn(y){if(!(J===p.Off||!le||y.method===_.type.method))if(Ue===m.Text){let N;(J===p.Verbose||J===p.Compact)&&(y.params?N=`Params: ${kt(y.params)}
`:N=`No parameters provided.
`),le.log(`Received notification '${y.method}'.`,N)}else Zt("receive-notification",y)}s(nn,"traceReceivedNotification");function ul(y,N){if(!(J===p.Off||!le))if(Ue===m.Text){let D;if((J===p.Verbose||J===p.Compact)&&(y.error&&y.error.data?D=`Error data: ${kt(y.error.data)}
`:y.result?D=`Result: ${kt(y.result)}
`:y.error===void 0&&(D=`No result returned.
`)),N){const G=y.error?` Request failed: ${y.error.message} (${y.error.code}).`:"";le.log(`Received response '${N.method} - (${y.id})' in ${Date.now()-N.timerStart}ms.${G}`,D)}else le.log(`Received response ${y.id} without active response promise.`,D)}else Zt("receive-response",y)}s(ul,"traceReceivedResponse");function Zt(y,N){if(!le||J===p.Off)return;const D={isLSPMessage:!0,type:y,message:N,timestamp:Date.now()};le.log(D)}s(Zt,"logLSPMessage");function yr(){if(ua())throw new w(v.Closed,"Connection is closed.");if(Jt())throw new w(v.Disposed,"Connection is disposed.")}s(yr,"throwIfClosedOrDisposed");function fl(){if(ca())throw new w(v.AlreadyListening,"Connection is already listening")}s(fl,"throwIfListening");function dl(){if(!ca())throw new Error("Call listen() first.")}s(dl,"throwIfNotListening");function h(y){return y===void 0?null:y}s(h,"undefinedToNull");function se(y){if(y!==null)return y}s(se,"nullToUndefined");function Ne(y){return y!=null&&!Array.isArray(y)&&typeof y=="object"}s(Ne,"isNamedParam");function H(y,N){switch(y){case n.ParameterStructures.auto:return Ne(N)?se(N):[h(N)];case n.ParameterStructures.byName:if(!Ne(N))throw new Error("Received parameters by name but param is not an object literal.");return se(N);case n.ParameterStructures.byPosition:return[h(N)];default:throw new Error(`Unknown parameter structure ${y.toString()}`)}}s(H,"computeSingleParam");function Pe(y,N){let D;const G=y.numberOfParams;switch(G){case 0:D=void 0;break;case 1:D=H(y.parameterStructures,N[0]);break;default:D=[];for(let _e=0;_e<N.length&&_e<G;_e++)D.push(h(N[_e]));if(N.length<G)for(let _e=N.length;_e<G;_e++)D.push(null);break}return D}s(Pe,"computeMessageParams");const ha={sendNotification:s((y,...N)=>{yr();let D,G;if(r.string(y)){D=y;const me=N[0];let Me=0,Ge=n.ParameterStructures.auto;n.ParameterStructures.is(me)&&(Me=1,Ge=me);let ne=N.length;const Oe=ne-Me;switch(Oe){case 0:G=void 0;break;case 1:G=H(Ge,N[Me]);break;default:if(Ge===n.ParameterStructures.byName)throw new Error(`Received ${Oe} parameters for 'by Name' notification parameter structure.`);G=N.slice(Me,ne).map(ce=>h(ce));break}}else{const me=N;D=y.method,G=Pe(y,me)}const _e={jsonrpc:j,method:D,params:G};return ll(_e),I.write(_e).catch(me=>{throw b.error("Sending notification failed."),me})},"sendNotification"),onNotification:s((y,N)=>{yr();let D;return r.func(y)?U=y:N&&(r.string(y)?(D=y,Q.set(y,{type:void 0,handler:N})):(D=y.method,Q.set(y.method,{type:y,handler:N}))),{dispose:s(()=>{D!==void 0?Q.delete(D):U=void 0},"dispose")}},"onNotification"),onProgress:s((y,N,D)=>{if(fe.has(N))throw new Error(`Progress handler for token ${N} already registered`);return fe.set(N,D),{dispose:s(()=>{fe.delete(N)},"dispose")}},"onProgress"),sendProgress:s((y,N,D)=>ha.sendNotification(u.type,{token:N,value:D}),"sendProgress"),onUnhandledProgress:Xt.event,sendRequest:s((y,...N)=>{yr(),dl();let D,G,_e;if(r.string(y)){D=y;const ne=N[0],Oe=N[N.length-1];let ce=0,Ke=n.ParameterStructures.auto;n.ParameterStructures.is(ne)&&(ce=1,Ke=ne);let rt=N.length;o.CancellationToken.is(Oe)&&(rt=rt-1,_e=Oe);const Qt=rt-ce;switch(Qt){case 0:G=void 0;break;case 1:G=H(Ke,N[ce]);break;default:if(Ke===n.ParameterStructures.byName)throw new Error(`Received ${Qt} parameters for 'by Name' request parameter structure.`);G=N.slice(ce,rt).map(ON=>h(ON));break}}else{const ne=N;D=y.method,G=Pe(y,ne);const Oe=y.numberOfParams;_e=o.CancellationToken.is(ne[Oe])?ne[Oe]:void 0}const me=O++;let Me;_e&&(Me=_e.onCancellationRequested(()=>{const ne=Te.sender.sendCancellation(ha,me);return ne===void 0?(b.log(`Received no promise from cancellation strategy when cancelling id ${me}`),Promise.resolve()):ne.catch(()=>{b.log(`Sending cancellation messages for id ${me} failed`)})}));const Ge={jsonrpc:j,id:me,method:D,params:G};return ol(Ge),typeof Te.sender.enableCancellation=="function"&&Te.sender.enableCancellation(Ge),new Promise(async(ne,Oe)=>{const ce=s(Qt=>{ne(Qt),Te.sender.cleanup(me),Me?.dispose()},"resolveWithCleanup"),Ke=s(Qt=>{Oe(Qt),Te.sender.cleanup(me),Me?.dispose()},"rejectWithCleanup"),rt={method:D,timerSta
`),q("\r"),q(" "),q("\v"),q(" "),q(" "),q(""),q(" "),q(""),q(""),q(""),q(""),q(""),q(""),q(""),q(""),q(""),q(""),q("\u2028"),q("\u2029"),q(""),q(""),q(" "),q("\uFEFF")],vk=/[0-9a-fA-F]/,Mc=/[0-9]/,Tk=/[1-9]/,qa,qT=(qa=class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const r=this.disjunction();this.consumeChar("/");const 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":Ea(n,"global");break;case"i":Ea(n,"ignoreCase");break;case"m":Ea(n,"multiLine");break;case"u":Ea(n,"unicode");break;case"y":Ea(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:r,loc:this.loc(0)}}disjunction(){const e=[],r=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(r)}}alternative(){const e=[],r=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(r)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":r="Lookbehind";break;case"!":r="NegativeLookbehind"}break}}fn(r);const n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return WT()}quantifier(e=!1){let r;const n=this.idx;switch(this.popChar()){case"*":r={atLeast:0,atMost:1/0};break;case"+":r={atLeast:1,atMost:1/0};break;case"?":r={atLeast:0,atMost:1};break;case"{":const a=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:a,atMost:a};break;case",":let i;this.isDigit()?(i=this.integerIncludingZero(),r={atLeast:a,atMost:i}):r={atLeast:a,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;fn(r);break}if(!(e===!0&&r===void 0)&&fn(r))return this.peekChar(0)==="?"?(this.consumeChar("?"),r.greedy=!1):r.greedy=!0,r.type="Quantifier",r.loc=this.loc(n),r}atom(){let e;const r=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),fn(e))return e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[q(`
`),q("\r"),q("\u2028"),q("\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,r=!1;switch(this.popChar()){case"d":e=Gu;break;case"D":e=Gu,r=!0;break;case"s":e=Cy;break;case"S":e=Cy,r=!0;break;case"w":e=ju;break;case"W":e=ju,r=!0;break}if(fn(e))return{type:"Set",value:e,complement:r}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=q("\f");break;case"n":e=q(`
`);break;case"r":e=q("\r");break;case"t":e=q(" ");break;case"v":e=q("\v");break}if(fn(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:q("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:q(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:q(e)}}}characterClass(){const e=[];let r=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),r=!0);this.isClassAtom();){const n=this.classAtom();if(n.type,Wp(n)&&this.isRangeDash()){this.consumeChar("-");const a=this.classAtom();if(a.type,Wp(a)){if(a.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:a.value})}else ou(n.value,e),e.push(q("-")),ou(a.value,e)}else ou(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:r,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:q("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const r=this.disjunction();this.consumeChar(")");const n={type:"Group",capturing:e,value:r};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(Tk.test(e)===!1)throw Error("Expecting a positive integer");for(;Mc.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Mc.test(e)===!1)throw Error("Expecting an integer");for(;Mc.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:q(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return Mc.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!"||this.peekChar(2)==="<"&&(this.peekChar(3)==="="||this.peekChar(3)==="!"));default:return!1}}isQuantifier(){const e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let r="";for(let a=0;a<e;a++){const i=this.popChar();if(vk.test(i)===!1)throw Error("Expecting a HexDecimal digits");r+=i}return{type:"Character",value:parseInt(r,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}},s(qa,"RegExpParser"),qa),Va,Af=(Va=class{visitChildren(e){for(const r in e){const n=e[r];e.hasOwnProperty(r)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(a=>{this.visit(a)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},s(Va,"BaseRegExpVisitor"),Va),VT=/\r?\n/gm,HT=new qT,Ha,Rk=(Ha=class extends Af{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const r=String.fromCharCode(e.value);if(!this.multiline&&r===`
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=Uo(r);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitSet(e){if(!this.multiline){const r=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(r);this.multiline=!!`
`.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},s(Ha,"TerminalRegExpVisitor"),Ha),In=new Rk;function YT(t){try{typeof t!="string"&&(t=t.source),t=`/${t}/`;const e=HT.pattern(t),r=[];for(const n of e.value.value)In.reset(t),In.visit(n),r.push({start:In.startRegexp,end:In.endRegex});return r}catch{return[]}}s(YT,"getTerminalParts");function _m(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),In.reset(t),In.visit(HT.pattern(t)),In.multiline}catch{return!1}}s(_m,"isMultilineComment");var XT=`\f
\r \v   \u2028\u2029 \uFEFF`.split("");function Ef(t){const e=typeof t=="string"?new RegExp(t):t;return XT.some(r=>e.test(r))}s(Ef,"isWhitespace");function Uo(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(Uo,"escapeRegExp");function Cm(t,e){const r=Sm(t),n=e.match(r);return!!n&&n[0].length>0}s(Cm,"partialMatches");function Sm(t){typeof t=="string"&&(t=new RegExp(t));const e=t,r=t.source;let n=0;function a(){let i="",o;function c(u){i+=r.substr(n,u),n+=u}s(c,"appendRaw");function l(u){i+="(?:"+r.substr(n,u)+"|$)",n+=u}for(s(l,"appendOptional");n<r.length;)switch(r[n]){case"\\":switch(r[n+1]){case"c":l(3);break;case"x":l(4);break;case"u":e.unicode?r[n+2]==="{"?l(r.indexOf("}",n)-n+1):l(6):l(2);break;case"p":case"P":e.unicode?l(r.indexOf("}",n)-n+1):l(2);break;case"k":l(r.indexOf(">",n)-n+1);break;default:l(2);break}break;case"[":o=/\[(?:\\.|.)*?\]/g,o.lastIndex=n,o=o.exec(r)||[],l(o[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":c(1);break;case"{":o=/\{\d+,?\d*\}/g,o.lastIndex=n,o=o.exec(r),o?c(o[0].length):l(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":i+="(?:",n+=3,i+=a()+"|$)";break;case"=":i+="(?=",n+=3,i+=a()+")";break;case"!":o=n,n+=3,a(),i+=r.substr(o,n-o);break;case"<":switch(r[n+3]){case"=":case"!":o=n,n+=4,a(),i+=r.substr(o,n-o);break;default:c(r.indexOf(">",n)-n+1),i+=a()+"|$)";break}break}else c(1),i+=a()+"|$)";break;case")":return++n,i;default:l(1);break}return i}return s(a,"process"),new RegExp(a(),t.flags)}s(Sm,"partialRegExp");function bm(t){return t.rules.find(e=>ot(e)&&e.entry)}s(bm,"getEntryRule");function wm(t){return t.rules.filter(e=>xt(e)&&e.hidden)}s(wm,"getHiddenRules");function _f(t,e){const r=new Set,n=bm(t);if(!n)return new Set(t.rules);const a=[n].concat(wm(t));for(const o of a)Im(o,r,e);const i=new Set;for(const o of t.rules)(r.has(o.name)||xt(o)&&o.hidden)&&i.add(o);return i}s(_f,"getAllReachableRules");function Im(t,e,r){e.add(t.name),Dr(t).forEach(n=>{if(wr(n)||r&&yf(n)){const a=n.rule.ref;a&&!e.has(a.name)&&Im(a,e,r)}})}s(Im,"ruleDfs");function JT(t){const e=new Set;return Dr(t).forEach(r=>{Wn(r)&&(ot(r.type.ref)&&e.add(r.type.ref),yc(r.type.ref)&&ot(r.type.ref.$container)&&e.add(r.type.ref.$container))}),e}s(JT,"getAllRulesUsedForCrossReferences");function Nm(t){if(t.terminal)return t.terminal;if(t.type.ref)return wf(t.type.ref)?.terminal}s(Nm,"getCrossReferenceTerminal");function km(t){return t.hidden&&!Ef(Rc(t))}s(km,"isCommentTerminal");function Pm(t,e){return!t||!e?[]:Sf(t,e,t.astNode,!0)}s(Pm,"findNodesForProperty");function Cf(t,e,r){if(!t||!e)return;const n=Sf(t,e,t.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}s(Cf,"findNodeForProperty");function Sf(t,e,r,n){if(!n){const a=Bn(t.grammarSource,Sr);if(a&&a.feature===e)return[t]}return Cr(t)&&t.astNode===r?t.content.flatMap(a=>Sf(a,e,r,!1)):[]}s(Sf,"findNodesForPropertyInternal");function ZT(t,e){return t?bf(t,e,t?.astNode):[]}s(ZT,"findNodesForKeyword");function Om(t,e,r){if(!t)return;const n=bf(t,e,t?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}s(Om,"findNodeForKeyword");function bf(t,e,r){if(t.astNode!==r)return[];if(br(t.grammarSource)&&t.grammarSource.value===e)return[t];const n=Po(t).iterator();let a;const i=[];do if(a=n.next(),!a.done){const o=a.value;o.astNode===r?br(o.grammarSource)&&o.grammarSource.value===e&&i.push(o):n.prune()}while(!a.done);return i}s(bf,"findNodesForKeywordInternal");function Lm(t){const e=t.astNode;for(;e===t.container?.astNode;){const r=Bn(t.grammarSource,Sr);if(r)return r;t=t.container}}s(Lm,"findAssignment");function wf(t){let e=t;return yc(e)&&(Vr(e.$container)?e=e.$container.$container:Kn(e.$container)?e=e.$container:Qr(e.$container)),Dm(t,e,new Map)}s(wf,"findNameAssignment");function Dm(t,e,r){function n(a,i){let o;return Bn(a,Sr)||(o=Dm(i,i,r)),r.set(t,o),o}if(s(n,"go"),r.has(t))return r.get(t);r.set(t,void 0);for(const a of Dr(e)){if(Sr(a)&&a.feature.toLowerCase()==="name")return r.set(t,a),a;if(wr(a)&&ot(a.rule.ref))return n(
`;function y_(t,e=!1){try{const r=Ic(t);return qu(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===g_)e&&lg(`${Wu} Unable to optimize: < ${t.toString()} >
Complement Sets cannot be automatically optimized.
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{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.`),Ku(`${Wu}
Failed parsing: < ${t.toString()} >
Using the @chevrotain/regexp-to-ast library
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}s(y_,"getOptimizedStartCodesIndices");function qu(t,e,r){switch(t.type){case"Disjunction":for(let a=0;a<t.value.length;a++)qu(t.value[a],e,r);break;case"Alternative":const n=t.value;for(let a=0;a<n.length;a++){const i=n[a];switch(i.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const o=i;switch(o.type){case"Character":Nl(o.value,e,r);break;case"Set":if(o.complement===!0)throw Error(g_);V(o.value,l=>{if(typeof l=="number")Nl(l,e,r);else{const u=l;if(r===!0)for(let f=u.from;f<=u.to;f++)Nl(f,e,r);else{for(let f=u.from;f<=u.to&&f<Pl;f++)Nl(f,e,r);if(u.to>=Pl){const f=u.from>=Pl?u.from:Pl,d=u.to,p=kr(f),g=kr(d);for(let m=p;m<=g;m++)e[m]=m}}}});break;case"Group":qu(o.value,e,r);break;default:throw Error("Non Exhaustive Match")}const c=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&Vu(o)===!1||o.type!=="Group"&&c===!1)break}break;default:throw Error("non exhaustive match!")}return qe(e)}s(qu,"firstCharOptimizedIndices");function Nl(t,e,r){const n=kr(t);e[n]=n,r===!0&&v_(t,e)}s(Nl,"addOptimizedIdxToResult");function v_(t,e){const r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){const a=kr(n.charCodeAt(0));e[a]=a}else{const a=r.toLowerCase();if(a!==r){const i=kr(a.charCodeAt(0));e[i]=i}}}s(v_,"handleIgnoreCase");function Jp(t,e){return Mo(t.value,r=>{if(typeof r=="number")return ft(e,r);{const n=r;return Mo(e,a=>n.from<=a&&a<=n.to)!==void 0}})}s(Jp,"findCode");function Vu(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?ae(t.value)?qt(t.value,Vu):Vu(t.value):!1}s(Vu,"isWholeOptional");var ci,UM=(ci=class extends Af{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){ft(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Jp(e,this.targetCharCodes)===void 0&&(this.found=!0):Jp(e,this.targetCharCodes)!==void 0&&(this.found=!0)}},s(ci,"CharCodeFinder"),ci);function Kf(t,e){if(e instanceof RegExp){const r=Ic(e),n=new UM(t);return n.visit(r),n.found}else return Mo(e,r=>ft(t,r.charCodeAt(0)))!==void 0}s(Kf,"canMatchCharCode");var Gn="PATTERN",kl="defaultMode",Fc="modes",T_=typeof new RegExp("(?:)").sticky=="boolean";function R_(t,e){e=sg(e,{useSticky:T_,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:s((w,C)=>C(),"tracer")});const r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{U_()});let n;r("Reject Lexer.NA",()=>{n=zf(t,w=>w[Gn]===st.NA)});let a=!1,i;r("Transform Patterns",()=>{a=!1,i=z(n,w=>{const C=w[Gn];if(Ir(C)){const k=C.source;return k.length===1&&k!=="^"&&k!=="$"&&k!=="."&&!C.ignoreCase?k:k.length===2&&k[0]==="\\"&&!ft(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],k[1])?k[1]:e.useSticky?Qp(C):Zp(C)}else{if(Mr(C))return a=!0,{exec:C};if(typeof C=="object")return a=!0,C;if(typeof C=="string"){if(C.length===1)return C;{const k=C.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),B=new RegExp(k);return e.useSticky?Qp(B):Zp(B)}}else throw Error("non exhaustive match")}})});let o,c,l,u,f;r("misc mapping",()=>{o=z(n,w=>w.tokenTypeIdx),c=z(n,w=>{const C=w.GROUP;if(C!==st.SKIPPED){if(mt(C))return C;if(Nr(C))return!1;throw Error("non exhaustive match")}}),l=z(n,w=>{const C=w.LONGER_ALT;if(C)return ae(C)?z(C,B=>av(n,B)):[av(n,C)]}),u=z(n,w=>w.PUSH_MODE),f=z(n,w=>W(w,"POP_MODE"))});let d;r("Line Terminator Handling",()=>{const w=pg(e.lineTerminatorCharacters);d=z(n,C=>!1),e.positionTracking!=="onlyOffset"&&(d=z(n,C=>W(C,"LINE_BREAKS")?!!C.LINE_BREAKS:dg(C,w)===!1&&Kf(w,C.PATTERN)))});let p,g,m,T;r("Misc Mapping #2",()=>{p=z(n,fg),g=z(i,G_),m=Et(n,(w,C)=>{const k=C.GROUP;return mt(k)&&k!==st.SKIPPED&&(w[k]=[]),w},{}),T=z(i,(w,C)=>({pattern:i[C],longerAlt:l[C],canLineTerminator:d[C],isCustom:p[C],short:g[C],group:c[C],push:u[C],pop:f[C],tokenTypeIdx:o[C],tokenType:n[C]}))});let _=!0,v=[];return e.safeMode||r("First Char Optimization",()=>{v=Et(n,(w,C,k)=>{if(typeof C.PATTERN=="string"){const B=C.PATTERN.charCodeAt(0),re=kr(B);uu(w,re,T[k])}else if(ae(C.START_CHARS_HINT)){let B;V(C.START_CHARS_HINT,re=>{const X=typeof re=="string"?re.charCodeAt(0):re,ge=kr(X);B!==ge&&(B=ge,uu(w,ge,T[k]))})}else if(Ir(C.PATTERN))if(C.PATTERN.unicode)_=!1,e.ensureOptimizations&&Ku(`${Wu} Unable to analyze < ${C.PATTERN.toString()} > pattern.
The regexp unicode flag is not currently supported by the regexp-to-ast library.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const B=y_(C.PATTERN,e.ensureOptimizations);Ae(B)&&(_=!1),V(B,re=>{uu(w,re,T[k])})}else e.ensureOptimizations&&Ku(`${Wu} TokenType: <${C.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),_=!1;return w},[])}),{emptyGroups:m,patternIdxToConfig:T,charCodeToPatternIdxToConfig:v,hasCustom:a,canBeOptimized:_}}s(R_,"analyzeTokenTypes");function $_(t,e){let r=[];const n=E_(t);r=r.concat(n.errors);const a=__(n.valid),i=a.valid;return r=r.concat(a.errors),r=r.concat(A_(i)),r=r.concat(N_(i)),r=r.concat(k_(i,e)),r=r.concat(P_(i)),r}s($_,"validatePatterns");function A_(t){let e=[];const r=Ft(t,n=>Ir(n[Gn]));return e=e.concat(C_(r)),e=e.concat(b_(r)),e=e.concat(w_(r)),e=e.concat(I_(r)),e=e.concat(S_(r)),e}s(A_,"validateRegExpPattern");function E_(t){const e=Ft(t,a=>!W(a,Gn)),r=z(e,a=>({message:"Token Type: ->"+a.name+"<- missing static 'PATTERN' property",type:Fe.MISSING_PATTERN,tokenTypes:[a]})),n=Uf(t,e);return{errors:r,valid:n}}s(E_,"findMissingPatterns");function __(t){const e=Ft(t,a=>{const i=a[Gn];return!Ir(i)&&!Mr(i)&&!W(i,"exec")&&!mt(i)}),r=z(e,a=>({message:"Token Type: ->"+a.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Fe.INVALID_PATTERN,tokenTypes:[a]})),n=Uf(t,e);return{errors:r,valid:n}}s(__,"findInvalidPatterns");var zM=/[^\\][$]/;function C_(t){const a=class a extends Af{constructor(){super(...arguments),this.found=!1}visitEndAnchor(o){this.found=!0}};s(a,"EndAnchorFinder");let e=a;const r=Ft(t,i=>{const o=i.PATTERN;try{const c=Ic(o),l=new e;return l.visit(c),l.found}catch{return zM.test(o.source)}});return z(r,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:Fe.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}s(C_,"findEndOfInputAnchor");function S_(t){const e=Ft(t,n=>n.PATTERN.test(""));return z(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Fe.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}s(S_,"findEmptyMatchRegExps");var BM=/[^\\[][\^]|^\^/;function b_(t){const a=class a extends Af{constructor(){super(...arguments),this.found=!1}visitStartAnchor(o){this.found=!0}};s(a,"StartAnchorFinder");let e=a;const r=Ft(t,i=>{const o=i.PATTERN;try{const c=Ic(o),l=new e;return l.visit(c),l.found}catch{return BM.test(o.source)}});return z(r,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:Fe.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}s(b_,"findStartOfInputAnchor");function w_(t){const e=Ft(t,n=>{const a=n[Gn];return a instanceof RegExp&&(a.multiline||a.global)});return z(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Fe.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}s(w_,"findUnsupportedFlags");function I_(t){const e=[];let r=z(t,i=>Et(t,(o,c)=>(i.PATTERN.source===c.PATTERN.source&&!ft(e,c)&&c.PATTERN!==st.NA&&(e.push(c),o.push(c)),o),[]));r=wc(r);const n=Ft(r,i=>i.length>1);return z(n,i=>{const o=z(i,l=>l.name);return{message:`The same RegExp pattern ->${Ht(i).PATTERN}<-has been used in all of the following Token Types: ${o.join(", ")} <-`,type:Fe.DUPLICATE_PATTERNS_FOUND,tokenTypes:i}})}s(I_,"findDuplicatePatterns");function N_(t){const e=Ft(t,n=>{if(!W(n,"GROUP"))return!1;const a=n.GROUP;return a!==st.SKIPPED&&a!==st.NA&&!mt(a)});return z(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Fe.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}s(N_,"findInvalidGroupType");function k_(t,e){const r=Ft(t,a=>a.PUSH_MODE!==void 0&&!ft(e,a.PUSH_MODE));return z(r,a=>({message:`Token Type: ->${a.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${a.PUSH_MODE}<-which does not exist`,type:Fe.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[a]}))}s(k_,"findModesThatDoNotExist");function P_(t){const e=[],r=Et(t,(n,a,i)=>{const o=a.PATTERN;return o===st.NA||(mt(o)?n.push({str:o,idx:i,tokenType:a}):Ir(o)&&L_(o)&&n.push({str:o.source,idx:i,tokenType:a})),n},[]);return V(t,(n,a)=>{V(r,({str:i,idx:o,tokenType:c})=>{if(a<o&&O_(i,n.PATTERN)){const l=`Token: ->${c.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:l,type:Fe.UNREACHABLE_PATTERN,tokenTypes:[n,c]})}})}),e}s(P_,"findUnreachablePatterns");function O_(t,e){if(Ir(e)){if(D_(e))return!1;const r=e.exec(t);return r!==null&&r.index===0}else{if(Mr(e))return e(t,0,[],{});if(W(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}s(O_,"tryToMatchStrToPattern");function L_(t){return Mo([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>t.source.indexOf(r)!==-1)===void 0}s(L_,"noMetaChar");function D_(t){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source)}s(D_,"usesLookAheadOrBehind");function Zp(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}s(Zp,"addStartOfInput");function Qp(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}s(Qp,"addStickyFlag");function M_(t,e,r){const n=[];return W(t,kl)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+kl+`> property in its definition
`,type:Fe.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),W(t,Fc)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Fc+`> property in its definition
`,type:Fe.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),W(t,Fc)&&W(t,kl)&&!W(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${kl}: <${t.defaultMode}>which does not exist
`,type:Fe.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),W(t,Fc)&&V(t.modes,(a,i)=>{V(a,(o,c)=>{if(Nr(o))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${c}>
`,type:Fe.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(W(o,"LONGER_ALT")){const l=ae(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT];V(l,u=>{!Nr(u)&&!ft(a,u)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${o.name}> outside of mode <${i}>
`,type:Fe.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}s(M_,"performRuntimeChecks");function x_(t,e,r){const n=[];let a=!1;const i=wc(Wt(qe(t.modes))),o=zf(i,l=>l[Gn]===st.NA),c=pg(r);return e&&V(o,l=>{const u=dg(l,c);if(u!==!1){const d={message:j_(l,u),type:u.issue,tokenType:l};n.push(d)}else W(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(a=!0):Kf(c,l.PATTERN)&&(a=!0)}),e&&!a&&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:Fe.NO_LINE_BREAKS_FLAGS}),n}s(x_,"performWarningRuntimeChecks");function F_(t){const e={},r=$t(t);return V(r,n=>{const a=t[n];if(ae(a))e[n]=[];else throw Error("non exhaustive match")}),e}s(F_,"cloneEmptyGroups");function fg(t){const e=t.PATTERN;if(Ir(e))return!1;if(Mr(e))return!0;if(W(e,"exec"))return!0;if(mt(e))return!1;throw Error("non exhaustive match")}s(fg,"isCustomPattern");function G_(t){return mt(t)&&t.length===1?t.charCodeAt(0):!1}s(G_,"isShortPattern");var KM={test:s(function(t){const e=t.length;for(let r=this.lastIndex;r<e;r++){const n=t.charCodeAt(r);if(n===10)return this.lastIndex=r+1,!0;if(n===13)return t.charCodeAt(r+1)===10?this.lastIndex=r+2:this.lastIndex=r+1,!0}return!1},"test"),lastIndex:0};function dg(t,e){if(W(t,"LINE_BREAKS"))return!1;if(Ir(t.PATTERN)){try{Kf(e,t.PATTERN)}catch(r){return{issue:Fe.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(mt(t.PATTERN))return!1;if(fg(t))return{issue:Fe.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}s(dg,"checkLineBreaksIssues");function j_(t,e){if(e.issue===Fe.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
The problem is in the <${t.name}> Token Type
Root cause: ${e.errMsg}.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===Fe.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
The problem is in the <${t.name}> Token Type
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}s(j_,"buildLineBreakIssueMessage");function pg(t){return z(t,r=>mt(r)?r.charCodeAt(0):r)}s(pg,"getCharCodes");function uu(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}s(uu,"addToMapOfArrays");var Pl=256,fu=[];function kr(t){return t<Pl?t:fu[t]}s(kr,"charCodeToOptimizedIndex");function U_(){if(Ae(fu)){fu=new Array(65536);for(let t=0;t<65536;t++)fu[t]=t>255?255+~~(t/255):t}}s(U_,"initCharCodeToOptimizedIndexMap");function Wo(t,e){const r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}s(Wo,"tokenStructuredMatcher");function ic(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}s(ic,"tokenStructuredMatcherNoCategories");var sv=1,z_={};function qo(t){const e=B_(t);K_(e),q_(e),W_(e),V(e,r=>{r.isParent=r.categoryMatches.length>0})}s(qo,"augmentTokenTypes");function B_(t){let e=et(t),r=t,n=!0;for(;n;){r=wc(Wt(z(r,i=>i.CATEGORIES)));const a=Uf(r,e);e=e.concat(a),Ae(a)?n=!1:r=a}return e}s(B_,"expandCategories");function K_(t){V(t,e=>{mg(e)||(z_[sv]=e,e.tokenTypeIdx=sv++),eh(e)&&!ae(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),eh(e)||(e.CATEGORIES=[]),V_(e)||(e.categoryMatches=[]),H_(e)||(e.categoryMatchesMap={})})}s(K_,"assignTokenDefaultProps");function W_(t){V(t,e=>{e.categoryMatches=[],V(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(z_[n].tokenTypeIdx)})})}s(W_,"assignCategoriesTokensProp");function q_(t){V(t,e=>{hg([],e)})}s(q_,"assignCategoriesMapProp");function hg(t,e){V(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),V(e.CATEGORIES,r=>{const n=t.concat(e);ft(n,r)||hg(n,r)})}s(hg,"singleAssignCategoriesToksMap");function mg(t){return W(t,"tokenTypeIdx")}s(mg,"hasShortKeyProperty");function eh(t){return W(t,"CATEGORIES")}s(eh,"hasCategoriesProperty");function V_(t){return W(t,"categoryMatches")}s(V_,"hasExtendingTokensTypesProperty");function H_(t){return W(t,"categoryMatchesMap")}s(H_,"hasExtendingTokensTypesMapProperty");function Y_(t){return W(t,"tokenTypeIdx")}s(Y_,"isTokenType");var th={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,a,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}},Fe;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(Fe||(Fe={}));var Ol={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:th,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Ol);var ui,st=(ui=class{constructor(e,r=Ol){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=(a,i)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const o=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${o}--> <${a}>`);const{time:c,value:l}=cg(i),u=c>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${o}<-- <${a}> time: ${c}ms`),this.traceInitIndent--,l}else return i()},typeof r=="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=At({},Ol,r);const 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 a,i=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Ol.lineTerminatorsPattern)this.config.lineTerminatorsPattern=KM;else if(this.config.lineTerminatorCharacters===Ol.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(r.safeMode&&r.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),ae(e)?a={modes:{defaultMode:et(e)},defaultMode:kl}:(i=!1,a=et(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(M_(a,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(x_(a,this.trackStartLines,this.config.lineTerminatorCharacters))})),a.modes=a.modes?a.modes:{},V(a.modes,(c,l)=>{a.modes[l]=zf(c,u=>Nr(u))});const o=$t(a.modes);if(V(a.modes,(c,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat($_(c,o))}),Ae(this.lexerDefinitionErrors)){qo(c);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=R_(c,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=u.charCodeToPatternIdxToConfig,this.emptyGroups=At({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=u.canBeOptimized}})}),this.defaultMode=a.defaultMode,!Ae(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const l=z(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+l)}V(this.lexerDefinitionWarning,c=>{lg(c.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(T_?(this.chopInput=Lo,this.match=this.matchWithTest):(this.updateLastIndex=We,this.match=this.matchWithExec),i&&(this.handleModes=We),this.trackStartLines===!1&&(this.computeNewColumn=Lo),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=We),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const c=Et(this.canModeBeOptimized,(l,u,f)=>(u===!1&&l.push(f),l),[]);if(r.ensureOptimizations&&!Ae(c))throw Error(`Lexer Modes: < ${c.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",()=>{m_()}),this.TRACE_INIT("toFastProperties",()=>{ug(this)})})}tokenize(e,r=this.defaultMode){if(!Ae(this.lexerDefinitionErrors)){const a=z(this.lexerDefinitionErrors,i=>i.message).join(`-----------------------
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
`+a)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,a,i,o,c,l,u,f,d,p,g,m,T,_,v;const w=e,C=w.length;let k=0,B=0;const re=this.hasCustom?0:Math.floor(e.length/10),X=new Array(re),ge=[];let Ee=this.trackStartLines?1:void 0,we=this.trackStartLines?1:void 0;const oe=F_(this.emptyGroups),tt=this.trackStartLines,P=this.config.lineTerminatorsPattern;let S=0,R=[],I=[];const $=[],A=[];Object.freeze(A);let b;function O(){return R}s(O,"getPossiblePatternsSlow");function M(U){const Q=kr(U),fe=I[Q];return fe===void 0?A:fe}s(M,"getPossiblePatternsOptimized");const L=s(U=>{if($.length===1&&U.tokenType.PUSH_MODE===void 0){const Q=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(U);ge.push({offset:U.startOffset,line:U.startLine,column:U.startColumn,length:U.image.length,message:Q})}else{$.pop();const Q=Fn($);R=this.patternIdxToConfig[Q],I=this.charCodeToPatternIdxToConfig[Q],S=R.length;const fe=this.canModeBeOptimized[Q]&&this.config.safeMode===!1;I&&fe?b=M:b=O}},"pop_mode");function j(U){$.push(U),I=this.charCodeToPatternIdxToConfig[U],R=this.patternIdxToConfig[U],S=R.length,S=R.length;const Q=this.canModeBeOptimized[U]&&this.config.safeMode===!1;I&&Q?b=M:b=O}s(j,"push_mode"),j.call(this,r);let F;const te=this.config.recoveryEnabled;for(;k<C;){l=null;const U=w.charCodeAt(k),Q=b(U),fe=Q.length;for(n=0;n<fe;n++){F=Q[n];const de=F.pattern;u=null;const pe=F.short;if(pe!==!1?U===pe&&(l=de):F.isCustom===!0?(v=de.exec(w,k,X,oe),v!==null?(l=v[0],v.payload!==void 0&&(u=v.payload)):l=null):(this.updateLastIndex(de,k),l=this.match(de,e,k)),l!==null){if(c=F.longerAlt,c!==void 0){const ye=c.length;for(i=0;i<ye;i++){const Ie=R[c[i]],he=Ie.pattern;if(f=null,Ie.isCustom===!0?(v=he.exec(w,k,X,oe),v!==null?(o=v[0],v.payload!==void 0&&(f=v.payload)):o=null):(this.updateLastIndex(he,k),o=this.match(he,e,k)),o&&o.length>l.length){l=o,u=f,F=Ie;break}}}break}}if(l!==null){if(d=l.length,p=F.group,p!==void 0&&(g=F.tokenTypeIdx,m=this.createTokenInstance(l,k,g,F.tokenType,Ee,we,d),this.handlePayload(m,u),p===!1?B=this.addToken(X,B,m):oe[p].push(m)),e=this.chopInput(e,d),k=k+d,we=this.computeNewColumn(we,d),tt===!0&&F.canLineTerminator===!0){let de=0,pe,ye;P.lastIndex=0;do pe=P.test(l),pe===!0&&(ye=P.lastIndex-1,de++);while(pe===!0);de!==0&&(Ee=Ee+de,we=d-ye,this.updateTokenEndLineColumnLocation(m,p,ye,de,Ee,we,d))}this.handleModes(F,L,j,m)}else{const de=k,pe=Ee,ye=we;let Ie=te===!1;for(;Ie===!1&&k<C;)for(e=this.chopInput(e,1),k++,a=0;a<S;a++){const he=R[a],J=he.pattern,Ue=he.short;if(Ue!==!1?w.charCodeAt(k)===Ue&&(Ie=!0):he.isCustom===!0?Ie=J.exec(w,k,X,oe)!==null:(this.updateLastIndex(J,k),Ie=J.exec(e)!==null),Ie===!0)break}if(T=k-de,we=this.computeNewColumn(we,T),_=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(w,de,T,pe,ye,Fn($)),ge.push({offset:de,line:pe,column:ye,length:T,message:_}),te===!1)break}}return this.hasCustom||(X.length=B),{tokens:X,groups:oe,errors:ge}}handleModes(e,r,n,a){if(e.pop===!0){const i=e.push;r(a),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}chopInput(e,r){return e.substring(r)}updateLastIndex(e,r){e.lastIndex=r}updateTokenEndLineColumnLocation(e,r,n,a,i,o,c){let l,u;r!==void 0&&(l=n===c-1,u=l?-1:0,a===1&&l===!0||(e.endLine=i+u,e.endColumn=o-1+-u))}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,n,a){return{image:e,startOffset:r,tokenTypeIdx:n,tokenType:a}}createStartOnlyToken(e,r,n,a,i,o){return{image:e,startOffset:r,startLine:i,startColumn:o,tokenTypeIdx:n,tokenType:a}}createFullToken(e,r,n,a,i,o,c){return{image:e,startOffset:r,endOffset:r+c-1,startLine:i,endLine:i,startColumn:o,endColumn:o+c-1,tokenTypeIdx:n,tokenType:a}}addTokenUsingPush(e,r,n){return e.push(n),r}addTokenUsingMemberAccess(e,r,n){return e[r]=n,r++,r}handlePayloadNoCustom(e,r){}handlePayloadWithCustom(e,r){r!==null&&(e.payload=r)}matchWithTest(e,r,n){return e.test(r)===!0?r.substring(n,e.lastIndex):null}matchWithExec(e,r){const n=e.exec(r);return n!==null?n[0]:null}},s(ui,"Lexer"),ui);st.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be c
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return W(t,ov)&&(r.CATEGORIES=t[ov]),qo([r]),W(t,lv)&&(r.LABEL=t[lv]),W(t,cv)&&(r.GROUP=t[cv]),W(t,fv)&&(r.POP_MODE=t[fv]),W(t,uv)&&(r.PUSH_MODE=t[uv]),W(t,dv)&&(r.LONGER_ALT=t[dv]),W(t,pv)&&(r.LINE_BREAKS=t[pv]),W(t,hv)&&(r.START_CHARS_HINT=t[hv]),r}s(X_,"createTokenInternal");var Yr=ja({name:"EOF",pattern:st.NA});qo([Yr]);function Nc(t,e,r,n,a,i,o,c){return{image:e,startOffset:r,endOffset:n,startLine:a,endLine:i,startColumn:o,endColumn:c,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}s(Nc,"createTokenInstance");function yg(t,e){return Wo(t,e)}s(yg,"tokenMatcher");var xa={buildMismatchTokenMessage({expected:t,actual:e,previous:r,ruleName:n}){return`Expecting ${gg(t)?`--> ${On(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:r,customUserDescription:n,ruleName:a}){const i="Expecting: ",c=`
but found: '`+Ht(e).image+"'";if(n)return i+n+c;{const l=Et(t,(p,g)=>p.concat(g),[]),u=z(l,p=>`[${z(p,g=>On(g)).join(", ")}]`),d=`one of these possible Token sequences:
${z(u,(p,g)=>` ${g+1}. ${p}`).join(`
`)}`;return i+d+c}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:r,ruleName:n}){const a="Expecting: ",o=`
but found: '`+Ht(e).image+"'";if(r)return a+r+o;{const l=`expecting at least one iteration which starts with one of these possible Token sequences::
<${z(t,u=>`[${z(u,f=>On(f)).join(",")}]`).join(" ,")}>`;return a+l+o}}};Object.freeze(xa);var qM={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+t.name+"<-"}},Nn={buildDuplicateFoundError(t,e){function r(f){return f instanceof be?f.terminalType.name:f instanceof lt?f.nonTerminalName:""}s(r,"getExtraProductionArgument");const n=t.name,a=Ht(e),i=a.idx,o=Ut(a),c=r(a),l=i>0;let u=`->${o}${l?i:""}<- ${c?`with argument: ->${c}<-`:""}
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(t){return`Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
To resolve this make sure each Terminal and Non-Terminal names are unique
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=z(t.prefixPath,a=>On(a)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in <OR${r}> inside <${t.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(t){const e=z(t.prefixPath,a=>On(a)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx;let n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${r}> inside <${t.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(t){let e=Ut(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,r=z(t.leftRecursionPath,i=>i.name),n=`${e} --> ${r.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(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof zo?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function J_(t,e){const r=new VM(t,e);return r.resolveRefs(),r.errors}s(J_,"resolveGrammar");var fi,VM=(fi=class extends Bo{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){V(qe(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{const n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:ct.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},s(fi,"GastRefResolverVisitor"),fi),di,HM=(di=class extends Bf{constructor(e,r){super(),this.topProd=e,this.path=r,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=et(this.path.ruleStack).reverse(),this.occurrenceStack=et(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){this.found||super.walk(e,r)}walkProdRef(e,r,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const a=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,a)}}updateExpectedNext(){Ae(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},s(di,"AbstractNextPossibleTokensWalker"),di),pi,YM=(pi=class extends HM{constructor(e,r){super(e,r),this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const a=r.concat(n),i=new gt({definition:a});this.possibleTokTypes=Ko(i),this.found=!0}}},s(pi,"NextAfterTokenWalker"),pi),hi,Wf=(hi=class extends Bf{constructor(e,r){super(),this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},s(hi,"AbstractNextTerminalAfterProductionWalker"),hi),mi,XM=(mi=class extends Wf{walkMany(e,r,n){if(e.idx===this.occurrence){const a=Ht(r.concat(n));this.result.isEndOfRule=a===void 0,a instanceof be&&(this.result.token=a.terminalType,this.result.occurrence=a.idx)}else super.walkMany(e,r,n)}},s(mi,"NextTerminalAfterManyWalker"),mi),gi,mv=(gi=class extends Wf{walkManySep(e,r,n){if(e.idx===this.occurrence){const a=Ht(r.concat(n));this.result.isEndOfRule=a===void 0,a instanceof be&&(this.result.token=a.terminalType,this.result.occurrence=a.idx)}else super.walkManySep(e,r,n)}},s(gi,"NextTerminalAfterManySepWalker"),gi),yi,JM=(yi=class extends Wf{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){const a=Ht(r.concat(n));this.result.isEndOfRule=a===void 0,a instanceof be&&(this.result.token=a.terminalType,this.result.occurrence=a.idx)}else super.walkAtLeastOne(e,r,n)}},s(yi,"NextTerminalAfterAtLeastOneWalker"),yi),vi,gv=(vi=class extends Wf{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){const a=Ht(r.concat(n));this.result.isEndOfRule=a===void 0,a instanceof be&&(this.result.token=a.terminalType,this.result.occurrence=a.idx)}else super.walkAtLeastOneSep(e,r,n)}},s(vi,"NextTerminalAfterAtLeastOneSepWalker"),vi);function Hu(t,e,r=[]){r=et(r);let n=[],a=0;function i(c){return c.concat(Ze(t,a+1))}s(i,"remainingPathWith");function o(c){const l=Hu(i(c),e,r);return n.
${i.join(`
`).replace(/\n/g,`
`)}`)}},"validateVisitor")};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}s(DC,"createBaseSemanticVisitorConstructor");function MC(t,e,r){const n=s(function(){},"derivedConstructor");Cg(n,t+"BaseSemanticsWithDefaults");const a=Object.create(r.prototype);return V(e,i=>{a[i]=LC}),n.prototype=a,n.prototype.constructor=n,n}s(MC,"createBaseVisitorConstructorWithDefaults");var ch;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(ch||(ch={}));function xC(t,e){return FC(t,e)}s(xC,"validateVisitor");function FC(t,e){const r=Ft(e,a=>Mr(t[a])===!1),n=z(r,a=>({msg:`Missing visitor method: <${a}> on ${t.constructor.name} CST Visitor.`,type:ch.MISSING_METHOD,methodName:a}));return wc(n)}s(FC,"validateMissingCstMethods");var Li,ux=(Li=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=W(e,"nodeLocationTracking")?e.nodeLocationTracking:Pr.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=We,this.cstFinallyStateUpdate=We,this.cstPostTerminal=We,this.cstPostNonTerminal=We,this.cstPostRule=We;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=lh,this.setNodeLocationFromNode=lh,this.cstPostRule=We,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=We,this.setNodeLocationFromNode=We,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=oh,this.setNodeLocationFromNode=oh,this.cstPostRule=We,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=We,this.setNodeLocationFromNode=We,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=We,this.setNodeLocationFromNode=We,this.cstPostRule=We,this.setInitialNodeLocation=We;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?(n.endOffset=r.endOffset,n.endLine=r.endLine,n.endColumn=r.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){const r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){const n=this.CST_STACK[this.CST_STACK.length-1];PC(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){const n=this.CST_STACK[this.CST_STACK.length-1];OC(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(Nr(this.baseCstVisitorConstructor)){const e=DC(this.className,$t(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Nr(this.baseCstVisitorWithDefaultsConstructor)){const e=MC(this.className,$t(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details.`);if(ae(e)){if(Ae(e))throw Error(`A Token Vocabulary cannot be empty.
Note that the first argument for the parser constructor
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
For Further details.`)}if(ae(e))this.tokensMap=Et(e,(i,o)=>(i[o.name]=o,i),{});else if(W(e,"modes")&&qt(Wt(qe(e.modes)),Y_)){const i=Wt(qe(e.modes)),o=og(i);this.tokensMap=Et(o,(c,l)=>(c[l.name]=l,c),{})}else if(Mt(e))this.tokensMap=et(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Yr;const n=W(e,"modes")?Wt(qe(e.modes)):qe(e),a=qt(n,i=>Ae(i.categoryMatches));this.tokenMatcher=a?ic:Wo,qo(qe(this.tokensMap))}defineRule(e,r,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.`);const a=W(n,"resyncEnabled")?n.resyncEnabled:Ju.resyncEnabled,i=W(n,"recoveryValueFunc")?n.recoveryValueFunc:Ju.recoveryValueFunc,o=this.ruleShortNameIdx<<sx+tn;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let c;return this.outputCst===!0?c=s(function(...f){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),r.apply(this,f);const d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,a,i)}finally{this.ruleFinallyStateUpdate()}},"invokeRuleWithTry"):c=s(function(...f){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),r.apply(this,f)}catch(d){return this.invokeRuleCatch(d,a,i)}finally{this.ruleFinallyStateUpdate()}},"invokeRuleWithTryCst"),Object.assign(c,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,n){const a=this.RULE_STACK.length===1,i=r&&!this.isBackTracking()&&this.recoveryEnabled;if(sc(e)){const o=e;if(i){const c=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(c))if(o.resyncedTokens=this.reSyncTo(c),this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return n(e);else{if(this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,o.partialCstResult=l}throw o}}else{if(a)return this.moveToTerminatedState(),n(e);throw o}}else throw e}optionInternal(e,r){const n=this.getKeyForAutomaticLookahead(NC,r);return this.optionInternalLogic(e,r,n)}optionInternalLogic(e,r,n){let a=this.getLaFuncFromCache(n),i;if(typeof e!="function"){i=e.DEF;const o=e.GATE;if(o!==void 0){const c=a;a=s(()=>o.call(this)&&c.call(this),"lookAheadFunc")}}else i=e;if(a.call(this)===!0)return i.call(this)}atLeastOneInternal(e,r){const n=this.getKeyForAutomaticLookahead(ih,e);return this.atLeastOneInternalLogic(e,r,n)}atLeastOneInternalLogic(e,r,n){let a=this.getLaFuncFromCache(n),i;if(typeof r!="function"){i=r.DEF;const o=r.GATE;if(o!==void 0){const c=a;a=s(()=>o.call(this)&&c.call(this),"lookAheadFunc")}}else i=r;if(a.call(this)===!0){let o=this.doSingleRepetition(i);for(;a.call(this)===!0&&o===!0;)o=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,Le.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],a,ih,e,JM)}atLeastOneSepFirstInternal(e,r){const n=this.getKeyForAutomaticLookahead(pu,e);this.atLeastOneSepFirstInternalLogic(e,r,n)}atLeastOneSepFirstInternalLogic(e,r,n){const a=r.DEF,i=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){a.call(this);const c=s(()=>this.tokenMatcher(this.LA(1),i),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),a.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,a,gv],c,pu,e,gv)}else throw this.raiseEarlyExitException(e,Le.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){const n=this.getKeyForAutomaticLookahead(ah,e);return this.manyInternalLogic(e,r,n)}manyInternalLogic(e,r,n){let a=this.getLaFuncFromCache(n),i;if(typeof r!="function"){i=r.DEF;const c=r.GATE;if(c!==void 0){const l=a;a=s(()=>c.call(this)&&l.call(this),"lookaheadFunction")}}else i=r;let o=!0;for(;a.call(this)===!0&&o===!0;)o=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],a,ah,e,XM,o)}manySepFirstInternal(e,r){const n=this.getKeyForAutomaticLookahead(sh,e);this.manySepFirstInternalLogic(e,r,n)}manySepFirstInternalLogic(e,r,n){const a=r.DEF,i=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){a.call(this);const c=s(()=>this.tokenMatcher(this.LA(1),i),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),a.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,c,a,mv],c,sh,e,mv)}}repetitionSepSecondInternal(e,r,n,a,i){for(;n();)this.CONSUME(r),a.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,n,a,i],n,pu,e,i)}doSingleRepetition(e){const r=this.getLexerPosition();return e.call(this),this.g
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(jC);var gx={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},ji,yx=(ji=class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const r=e>0?e:"";this[`CONSUME${r}`]=function(n,a){return this.consumeInternalRecord(n,e,a)},this[`SUBRULE${r}`]=function(n,a){return this.subruleInternalRecord(n,e,a)},this[`OPTION${r}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${r}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${r}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${r}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${r}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${r}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,r,n){return this.consumeInternalRecord(r,e,n)},this.subrule=function(e,r,n){return this.subruleInternalRecord(r,e,n)},this.option=function(e,r){return this.optionInternalRecord(r,e)},this.or=function(e,r){return this.orInternalRecord(r,e)},this.many=function(e,r){this.manyInternalRecord(e,r)},this.atLeastOne=function(e,r){this.atLeastOneInternalRecord(e,r)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let r=0;r<10;r++){const n=r>0?r:"";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,r){return()=>!0}LA_RECORD(e){return Xu}topLevelRuleRecord(e,r){try{const n=new zo({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),r.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,r){return _a.call(this,Qe,e,r)}atLeastOneInternalRecord(e,r){_a.call(this,_t,r,e)}atLeastOneSepFirstInternalRecord(e,r){_a.call(this,Ct,r,e,yv)}manyInternalRecord(e,r){_a.call(this,xe,r,e)}manySepFirstInternalRecord(e,r){_a.call(this,yt,r,e,yv)}orInternalRecord(e,r){return UC.call(this,e,r)}subruleInternalRecord(e,r,n){if(oc(r),!e||W(e,"ruleName")===!1){const c=new Error(`<SUBRULE${uh(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw c.KNOWN_RECORDER_ERROR=!0,c}const a=Fn(this.recordingProdStack),i=e.ruleName,o=new lt({idx:r,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return a.definition.push(o),this.outputCst?gx:Hf}consumeInternalRecord(e,r,n){if(oc(r),!mg(e)){const o=new Error(`<CONSUME${uh(r)}> 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}const a=Fn(this.recordingProdStack),i=new be({idx:r,terminalType:e,label:n?.LABEL});return a.definition.push(i),jC}},s(ji,"GastRecorder"),ji);function _a(t,e,r,n=!1){oc(r);const a=Fn(this.recordingProdStack),i=Mr(e)?e:e.DEF,o=new t({definition:[],idx:r});return n&&(o.separator=e.SEP),W(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),i.call(this),a.definition.push(o),this.recordingProdStack.pop(),Hf}s(_a,"recordProd");function UC(t,e){oc(e);const r=Fn(this.recordingProdStack),n=ae(t)===!1,a=n===!1?t:t.DEF,i=new vt({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});W(t,"MAX_LOOKAHEAD")&&(i.maxLookahead=t.MAX_LOOKAHEAD);const o=t_(a,c=>Mr(c.GATE));return i.hasPredicates=o,r.definition.push(i),V(a,c=>{const l=new gt({definition:[]});i.definition.push(l),W(c,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=c.IGNORE_AMBIGUITIES:W(c,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),c.ALT.call(this),this.recordingProdStack.pop()}),Hf}s(UC,"recordOrProd");function uh(t){return t===0?"":`${t}`}s(uh,"getIdxSuffix");function oc(t){if(t<0||t>vv){const e=new Error(`Invalid DSL Method idx value: <${t}>
Idx value must be a none negative value smaller than ${vv+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}s(oc,"assertMethodIdxIsValid");var Ui,vx=(Ui=class{initPerformanceTracer(e){if(W(e,"traceInitPerf")){const r=e.traceInitPerf,n=typeof r=="number";this.traceInitMaxIdent=n?r:1/0,this.traceInitPerf=n?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=Pr.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);const{time:a,value:i}=cg(r),o=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${n}<-- <${e}> time: ${a}ms`),this.traceInitIndent--,i}else return r()}},s(Ui,"PerformanceTracer"),Ui);function zC(t,e){e.forEach(r=>{const n=r.prototype;Object.getOwnPropertyNames(n).forEach(a=>{if(a==="constructor")return;const i=Object.getOwnPropertyDescriptor(n,a);i&&(i.get||i.set)?Object.defineProperty(t.prototype,a,i):t.prototype[a]=r.prototype[a]})})}s(zC,"applyMixins");var Xu=Nc(Yr,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Xu);var Pr=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:xa,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ju=Object.freeze({recoveryValueFunc:s(()=>{},"recoveryValueFunc"),resyncEnabled:!0}),ct;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(ct||(ct={}));function fh(t=void 0){return function(){return t}}s(fh,"EMPTY_ALT");var Dn,Sg=(Dn=class{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const r=this.className;this.TRACE_INIT("toFastProps",()=>{ug(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),V(this.definedRulesNames,a=>{const o=this[a].originalGrammarAction;let c;this.TRACE_INIT(`${a} Rule`,()=>{c=this.topLevelRuleRecord(a,o)}),this.gastProductionsCache[a]=c})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=TC({rules:qe(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(Ae(n)&&this.skipValidations===!1){const a=RC({rules:qe(this.gastProductionsCache),tokenTypes:qe(this.tokensMap),errMsgProvider:Nn,grammarName:r}),i=sC({lookaheadStrategy:this.lookaheadStrategy,rules:qe(this.gastProductionsCache),tokenTypes:qe(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(a,i)}}),Ae(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const a=p_(qe(this.gastProductionsCache));this.resyncFollows=a}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var a,i;(i=(a=this.lookaheadStrategy).initialize)===null||i===void 0||i.call(a,{rules:qe(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(qe(this.gastProductionsCache))})),!Dn.DEFER_DEFINITION_ERRORS_HANDLING&&!Ae(this.definitionErrors))throw e=z(this.definitionErrors,a=>a.message),new Error(`Parser Definition Errors detected:
${e.join(`
-------------------------------
`)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;const n=this;if(n.initErrorHandler(r),n.initLexerAdapter(),n.initLooksAhead(r),n.initRecognizerEngine(e,r),n.initRecoverable(r),n.initTreeBuilder(r),n.initContentAssist(),n.initGastRecorder(r),n.initPerformanceTracer(r),W(r,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
For further details.`);this.skipValidations=W(r,"skipValidations")?r.skipValidations:Pr.skipValidations}},s(Dn,"Parser"),Dn);Sg.DEFER_DEFINITION_ERRORS_HANDLING=!1;zC(Sg,[ix,ox,ux,fx,px,dx,hx,mx,yx,vx]);var zi,Tx=(zi=class extends Sg{constructor(e,r=Pr){const n=et(r);n.outputCst=!1,super(e,n)}},s(zi,"EmbeddedActionsParser"),zi);function BC(t,e){for(var r=-1,n=t==null?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a}s(BC,"arrayMap");var KC=BC;function WC(){this.__data__=[],this.size=0}s(WC,"listCacheClear");var Rx=WC;function qC(t,e){return t===e||t!==t&&e!==e}s(qC,"eq");var VC=qC;function HC(t,e){for(var r=t.length;r--;)if(VC(t[r][0],e))return r;return-1}s(HC,"assocIndexOf");var Yf=HC,$x=Array.prototype,Ax=$x.splice;function YC(t){var e=this.__data__,r=Yf(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Ax.call(e,r,1),--this.size,!0}s(YC,"listCacheDelete");var Ex=YC;function XC(t){var e=this.__data__,r=Yf(e,t);return r<0?void 0:e[r][1]}s(XC,"listCacheGet");var _x=XC;function JC(t){return Yf(this.__data__,t)>-1}s(JC,"listCacheHas");var Cx=JC;function ZC(t,e){var r=this.__data__,n=Yf(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}s(ZC,"listCacheSet");var Sx=ZC;function ta(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}s(ta,"ListCache");ta.prototype.clear=Rx;ta.prototype.delete=Ex;ta.prototype.get=_x;ta.prototype.has=Cx;ta.prototype.set=Sx;var Xf=ta;function QC(){this.__data__=new Xf,this.size=0}s(QC,"stackClear");var bx=QC;function eS(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}s(eS,"stackDelete");var wx=eS;function tS(t){return this.__data__.get(t)}s(tS,"stackGet");var Ix=tS;function rS(t){return this.__data__.has(t)}s(rS,"stackHas");var Nx=rS,kx=typeof global=="object"&&global&&global.Object===Object&&global,nS=kx,Px=typeof self=="object"&&self&&self.Object===Object&&self,Ox=nS||Px||Function("return this")(),xr=Ox,Lx=xr.Symbol,ur=Lx,aS=Object.prototype,Dx=aS.hasOwnProperty,Mx=aS.toString,ml=ur?ur.toStringTag:void 0;function iS(t){var e=Dx.call(t,ml),r=t[ml];try{t[ml]=void 0;var n=!0}catch{}var a=Mx.call(t);return n&&(e?t[ml]=r:delete t[ml]),a}s(iS,"getRawTag");var xx=iS,Fx=Object.prototype,Gx=Fx.toString;function sS(t){return Gx.call(t)}s(sS,"objectToString");var jx=sS,Ux="[object Null]",zx="[object Undefined]",Tv=ur?ur.toStringTag:void 0;function oS(t){return t==null?t===void 0?zx:Ux:Tv&&Tv in Object(t)?xx(t):jx(t)}s(oS,"baseGetTag");var Vo=oS;function lS(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}s(lS,"isObject");var bg=lS,Bx="[object AsyncFunction]",Kx="[object Function]",Wx="[object GeneratorFunction]",qx="[object Proxy]";function cS(t){if(!bg(t))return!1;var e=Vo(t);return e==Kx||e==Wx||e==Bx||e==qx}s(cS,"isFunction");var uS=cS,Vx=xr["__core-js_shared__"],Cd=Vx,Rv=(function(){var t=/[^.]+$/.exec(Cd&&Cd.keys&&Cd.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function fS(t){return!!Rv&&Rv in t}s(fS,"isMasked");var Hx=fS,Yx=Function.prototype,Xx=Yx.toString;function dS(t){if(t!=null){try{return Xx.call(t)}catch{}try{return t+""}catch{}}return""}s(dS,"toSource");var ra=dS,Jx=/[\\^$.*+?()[\]{}|]/g,Zx=/^\[object .+?Constructor\]$/,Qx=Function.prototype,e1=Object.prototype,t1=Qx.toString,r1=e1.hasOwnProperty,n1=RegExp("^"+t1.call(r1).replace(Jx,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function pS(t){if(!bg(t)||Hx(t))return!1;var e=uS(t)?n1:Zx;return e.test(ra(t))}s(pS,"baseIsNative");var a1=pS;function hS(t,e){return t?.[e]}s(hS,"getValue");var i1=hS;function mS(t,e){var r=i1(t,e);return a1(r)?r:void 0}s(mS,"getNative");var Ho=mS,s1=Ho(xr,"Map"),lc=s1,o1=Ho(Object,"create"),cc=o1;function gS(){this.__data__=cc?cc(null):{},this.size=0}s(gS,"hashClear");var l1=gS;function yS(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}s(yS,"hashDelete");var c1=yS,u1="__lodash_hash_undefined__",f1=Object.prototype,d1=f1.hasOwnProperty;function vS(t){var e=this.__data__;if(cc){var r=e[t];return r===u1?void 0:r}return d1.call(e,t)?e[t]:void 0}s(vS,"hashGet
<${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}s(zw,"buildAmbiguityError");function Bw(t){if(t instanceof lt)return"SUBRULE";if(t instanceof Qe)return"OPTION";if(t instanceof vt)return"OR";if(t instanceof _t)return"AT_LEAST_ONE";if(t instanceof Ct)return"AT_LEAST_ONE_SEP";if(t instanceof yt)return"MANY_SEP";if(t instanceof xe)return"MANY";if(t instanceof be)return"CONSUME";throw Error("non exhaustive match")}s(Bw,"getProductionDslName");function Kw(t,e,r){const n=oj(e.configs.elements,i=>i.state.transitions),a=Rj(n.filter(i=>i instanceof xg).map(i=>i.tokenType),i=>i.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:a,tokenPath:t}}s(Kw,"buildAdaptivePredictError");function Ww(t,e){return t.edges[e.tokenTypeIdx]}s(Ww,"getExistingTargetState");function qw(t,e,r){const n=new gh,a=[];for(const o of t.elements){if(r.is(o.alt)===!1)continue;if(o.state.type===Oc){a.push(o);continue}const c=o.state.transitions.length;for(let l=0;l<c;l++){const u=o.state.transitions[l],f=Vw(u,e);f!==void 0&&n.add({state:f,alt:o.alt,stack:o.stack})}}let i;if(a.length===0&&n.size===1&&(i=n),i===void 0){i=new gh;for(const o of n.elements)fc(o,i)}if(a.length>0&&!Jw(i))for(const o of a)i.add(o);return i}s(qw,"computeReachSet");function Vw(t,e){if(t instanceof xg&&yg(e,t.tokenType))return t.target}s(Vw,"getReachableTarget");function Hw(t,e){let r;for(const n of t.elements)if(e.is(n.alt)===!0){if(r===void 0)r=n.alt;else if(r!==n.alt)return}return r}s(Hw,"getUniqueAlt");function Kg(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}s(Kg,"newDFAState");function vh(t,e,r,n){return n=Wg(t,n),e.edges[r.tokenTypeIdx]=n,n}s(vh,"addDFAEdge");function Wg(t,e){if(e===Qu)return e;const r=e.configs.key,n=t.states[r];return n!==void 0?n:(e.configs.finalize(),t.states[r]=e,e)}s(Wg,"addDFAState");function Yw(t){const e=new gh,r=t.transitions.length;for(let n=0;n<r;n++){const i={state:t.transitions[n].target,alt:n,stack:[]};fc(i,e)}return e}s(Yw,"computeStartState");function fc(t,e){const r=t.state;if(r.type===Oc){if(t.stack.length>0){const a=[...t.stack],o={state:a.pop(),alt:t.alt,stack:a};fc(o,e)}else e.add(t);return}r.epsilonOnlyTransitions||e.add(t);const n=r.transitions.length;for(let a=0;a<n;a++){const i=r.transitions[a],o=Xw(t,i);o!==void 0&&fc(o,e)}}s(fc,"closure");function Xw(t,e){if(e instanceof Zb)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof Fg){const r=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:r}}}s(Xw,"getEpsilonTarget");function Jw(t){for(const e of t.elements)if(e.state.type===Oc)return!0;return!1}s(Jw,"hasConfigInRuleStopState");function Zw(t){for(const e of t.elements)if(e.state.type!==Oc)return!1;return!0}s(Zw,"allConfigsInRuleStopStates");function Qw(t){if(Zw(t))return!0;const e=eI(t.elements);return tI(e)&&!rI(e)}s(Qw,"hasConflictTerminatingPrediction");function eI(t){const e=new Map;for(const r of t){const n=zg(r,!1);let a=e.get(n);a===void 0&&(a={},e.set(n,a)),a[r.alt]=!0}return e}s(eI,"getConflictingAltSets");function tI(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}s(tI,"hasConflictingAltSet");function rI(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}s(rI,"hasStateAssociatedWithOneAlt");hc();var Xi,nI=(Xi=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new Vg(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const r=new ld;return r.grammarSource=e,r.root=this.rootNode,this.current.content.push(r),this.nodeStack.push(r),r}buildLeafNode(e,r){const n=new ef(e.startOffset,e.image.length,Zl(e),e.tokenType,!r);return n.grammarSource=r,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){const r=e.container;if(r){const n=r.content.indexOf(e);n>=0&&r.content.splice(n,1)}}addHiddenNodes(e){const r=[];for(const i of e){const o=new ef(i.startOffset,i.image.length,Zl(i),i.tokenType,!0);o.root=this.rootNode,r.push(o)}let n=this.current,a=!1;if(n.content.length>0){n.content.push(.
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return u}}s(r,"convertEscapeCharacter");function n(u){return u.charAt(0)==="^"?u.substring(1):u}s(n,"convertID"),t.convertID=n;function a(u){return parseInt(u)}s(a,"convertInt"),t.convertInt=a;function i(u){return BigInt(u)}s(i,"convertBigint"),t.convertBigint=i;function o(u){return new Date(u)}s(o,"convertDate"),t.convertDate=o;function c(u){return Number(u)}s(c,"convertNumber"),t.convertNumber=c;function l(u){return u.toLowerCase()==="true"}s(l,"convertBoolean"),t.convertBoolean=l})(ar||(ar={}));var $e={};uf($e,Gh(df()));function dd(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}s(dd,"delayNextTick");var vu=0,TI=10;function pd(){return vu=performance.now(),new $e.CancellationTokenSource}s(pd,"startCancelableOperation");function ry(t){TI=t}s(ry,"setInterruptionPeriod");var or=Symbol("OperationCancelled");function oa(t){return t===or}s(oa,"isOperationCancelled");async function Ye(t){if(t===$e.CancellationToken.None)return;const e=performance.now();if(e-vu>=TI&&(vu=e,await dd(),vu=performance.now()),t.isCancellationRequested)throw or}s(Ye,"interruptAndCheck");var us,Or=(us=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=n=>(e(n),this),this.reject=n=>(r(n),this)})}},s(us,"Deferred"),us),qr,Wv=(qr=class{constructor(e,r,n,a){this._uri=e,this._languageId=r,this._version=n,this._content=a,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){const r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){for(const n of e)if(qr.isIncremental(n)){const a=ay(n.range),i=this.offsetAt(a.start),o=this.offsetAt(a.end);this._content=this._content.substring(0,i)+n.text+this._content.substring(o,this._content.length);const c=Math.max(a.start.line,0),l=Math.max(a.end.line,0);let u=this._lineOffsets;const f=Th(n.text,!1,i);if(l-c===f.length)for(let p=0,g=f.length;p<g;p++)u[p+c+1]=f[p];else f.length<1e4?u.splice(c+1,l-c,...f):this._lineOffsets=u=u.slice(0,c+1).concat(f,u.slice(l+1));const d=n.text.length-(o-i);if(d!==0)for(let p=c+1+f.length,g=u.length;p<g;p++)u[p]=u[p]+d}else if(qr.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=r}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Th(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const r=this.getLineOffsets();let n=0,a=r.length;if(a===0)return{line:0,character:e};for(;n<a;){const o=Math.floor((n+a)/2);r[o]>e?a=o:n=o+1}const i=n-1;return e=this.ensureBeforeEOL(e,r[i]),{line:i,character:e-r[i]}}offsetAt(e){const r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;const n=r[e.line];if(e.character<=0)return n;const a=e.line+1<r.length?r[e.line+1]:this._content.length,i=Math.min(n+e.character,a);return this.ensureBeforeEOL(i,n)}ensureBeforeEOL(e,r){for(;e>r&&ny(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){const r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){const r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},s(qr,"FullTextDocument"),qr),nf;(function(t){function e(a,i,o,c){return new Wv(a,i,o,c)}s(e,"create"),t.create=e;function r(a,i,o){if(a instanceof Wv)return a.update(i,o),a;throw new Error("TextDocument.update: document must be created by TextDocument.create")}s(r,"update"),t.update=r;function n(a,i){const o=a.getText(),c=af(i.map(RI),(f,d)=>{const p=f.range.start.line-d.range.start.line;return p===0?f.range.start.character-d.range.start.character:p});let l=0;const u=[];for(const f of c){const d=a.offsetAt(f.range.start);if(d<l)throw new Error("Overlapping edit");d>l&&u.push(o.substring(l,d)),f.newText.length&&u.push
${r}`),this.inline?`{${e}}`:e}toMarkdown(e){return e?.renderTag?.(this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){const r=this.content.toMarkdown(e);if(this.inline){const i=JI(this.name,r,e??{});if(typeof i=="string")return i}let n="";e?.tag==="italic"||e?.tag===void 0?n="*":e?.tag==="bold"?n="**":e?.tag==="bold-italic"&&(n="***");let a=`${n}@${this.name}${n}`;return this.content.inlines.length===1?a=`${a} ${r}`:this.content.inlines.length>1&&(a=`${a}
${r}`),this.inline?`{${a}}`:a}},s(Bs,"JSDocTagImpl"),Bs);function JI(t,e,r){if(t==="linkplain"||t==="linkcode"||t==="link"){const n=e.indexOf(" ");let a=e;if(n>0){const o=cf(e,n);a=e.substring(o),e=e.substring(0,n)}return(t==="linkcode"||t==="link"&&r.link==="code")&&(a=`\`${a}\``),r.renderLink?.(e,a)??ZI(e,a)}}s(JI,"renderInlineTag");function ZI(t,e){try{return Rt.parse(t,!0),`[${e}](${t})`}catch{return t}}s(ZI,"renderLinkDefault");var Ks,Ah=(Ks=class{constructor(e,r){this.inlines=e,this.range=r}toString(){let e="";for(let r=0;r<this.inlines.length;r++){const n=this.inlines[r],a=this.inlines[r+1];e+=n.toString(),a&&a.range.start.line>n.range.start.line&&(e+=`
`)}return e}toMarkdown(e){let r="";for(let n=0;n<this.inlines.length;n++){const a=this.inlines[n],i=this.inlines[n+1];r+=a.toMarkdown(e),i&&i.range.start.line>a.range.start.line&&(r+=`
`)}return r}},s(Ks,"JSDocTextImpl"),Ks),Ws,QI=(Ws=class{constructor(e,r){this.text=e,this.range=r}toString(){return this.text}toMarkdown(){return this.text}},s(Ws,"JSDocLineImpl"),Ws);function Eh(t){return t.endsWith(`
`)?`
`:`
`}s(Eh,"fillNewlines");var qs,eN=(qs=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const r=this.commentProvider.getComment(e);if(r&&my(r))return hy(r).toMarkdown({renderLink:s((a,i)=>this.documentationLinkRenderer(e,a,i),"renderLink"),renderTag:s(a=>this.documentationTagRenderer(e,a),"renderTag")})}documentationLinkRenderer(e,r,n){const a=this.findNameInLocalSymbols(e,r)??this.findNameInGlobalScope(e,r);if(a&&a.nameSegment){const i=a.nameSegment.range.start.line+1,o=a.nameSegment.range.start.character+1,c=a.documentUri.with({fragment:`L${i},${o}`});return`[${n}](${c.toString()})`}else return}documentationTagRenderer(e,r){}findNameInLocalSymbols(e,r){const a=Bt(e).localSymbols;if(!a)return;let i=e;do{const c=a.getStream(i).find(l=>l.name===r);if(c)return c;i=i.$container}while(i)}findNameInGlobalScope(e,r){return this.indexManager.allElements().find(a=>a.name===r)}},s(qs,"JSDocDocumentationProvider"),qs),Vs,tN=(Vs=class{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return cy(e)?e.$comment:ym(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}},s(Vs,"DefaultCommentProvider"),Vs),Hs,rN=(Hs=class{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,r){return Promise.resolve(this.syncParser.parse(e))}},s(Hs,"DefaultAsyncParser"),Hs),Ys,jj=(Ys=class{constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length<this.threadCount;){const e=this.createWorker();e.onReady(()=>{if(this.queue.length>0){const r=this.queue.shift();r&&(e.lock(),r.resolve(e))}}),this.workerPool.push(e)}}async parse(e,r){const n=await this.acquireParserWorker(r),a=new Or;let i;const o=r.onCancellationRequested(()=>{i=setTimeout(()=>{this.terminateWorker(n)},this.terminationDelay)});return n.parse(e).then(c=>{const l=this.hydrator.hydrate(c);a.resolve(l)}).catch(c=>{a.reject(c)}).finally(()=>{o.dispose(),clearTimeout(i)}),a.promise}terminateWorker(e){e.terminate();const r=this.workerPool.indexOf(e);r>=0&&this.workerPool.splice(r,1)}async acquireParserWorker(e){this.initializeWorkers();for(const n of this.workerPool)if(n.ready)return n.lock(),n;const r=new Or;return e.onCancellationRequested(()=>{const n=this.queue.indexOf(r);n>=0&&this.queue.splice(n,1),r.reject(or)}),this.queue.push(r),r.promise}},s(Ys,"AbstractThreadedAsyncParser"),Ys),Xs,Uj=(Xs=class{get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,r,n,a){this.onReadyEmitter=new gd.Emitter,this.deferred=new Or,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=a,r(i=>{const o=i;this.deferred.resolve(o),this.unlock()}),n(i=>{this.deferred.reject(i),this.unlock()})}terminate(){this.deferred.reject(or),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 Or,this.sendMessage(e),this.deferred.promise}},s(Xs,"ParserWorker"),Xs),Js,nN=(Js=class{constructor(){this.previousTokenSource=new $e.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const r=pd();return this.previousTokenSource=r,this.enqueue(this.writeQueue,e,r.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,r,n=$e.CancellationToken.None){const a=new Or,i={action:r,deferred:a,cancellationToken:n};return e.push(i),this.performNextOperation(),a.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:r,deferred:n,cancellationToken:a})=>{try{const i=await Promise.resolve().then(()=>r(a));n.resolve(i)}catch(i){oa(i)?n.resolve(void 0):n.reject(i)}})),this.done=!0,this.performNextOperation()}cancelW
`.includes(e[r-1])}matchWhitespace(e,r,n,a){this.whitespaceRegExp.lastIndex=r;const i=this.whitespaceRegExp.exec(e);return{currIndentLevel:i?.[0].length??0,prevIndentLevel:this.indentationStack.at(-1),match:i}}createIndentationTokenInstance(e,r,n,a){const i=this.getLineNumber(r,a);return Nc(e,n,a,a+n.length,i,i,1,n.length)}getLineNumber(e,r){return e.substring(0,r).split(/\r\n|\r|\n/).length}indentMatcher(e,r,n,a){if(!this.isStartOfLine(e,r))return null;const{currIndentLevel:i,prevIndentLevel:o,match:c}=this.matchWhitespace(e,r,n,a);return i<=o?null:(this.indentationStack.push(i),c)}dedentMatcher(e,r,n,a){if(!this.isStartOfLine(e,r))return null;const{currIndentLevel:i,prevIndentLevel:o,match:c}=this.matchWhitespace(e,r,n,a);if(i>=o)return null;const l=this.indentationStack.lastIndexOf(i);if(l===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${i} at offset: ${r}. Current indentation stack: ${this.indentationStack}`,offset:r,length:c?.[0]?.length??0,line:this.getLineNumber(e,r),column:1}),null;const u=this.indentationStack.length-l-1,f=e.substring(0,r).match(/[\r\n]+$/)?.[0].length??1;for(let d=0;d<u;d++){const p=this.createIndentationTokenInstance(this.dedentTokenType,e,"",r-(f-1));n.push(p),this.indentationStack.pop()}return null}buildTerminalToken(e){const r=super.buildTerminalToken(e),{indentTokenName:n,dedentTokenName:a,whitespaceTokenName:i}=this.options;return r.name===n?this.indentTokenType:r.name===a?this.dedentTokenType:r.name===i?ja({name:i,pattern:this.whitespaceRegExp,group:st.SKIPPED}):r}flushRemainingDedents(e){const r=[];for(;this.indentationStack.length>1;)r.push(this.createIndentationTokenInstance(this.dedentTokenType,e,"",e.length)),this.indentationStack.pop();return this.indentationStack=[0],r}},s(Qs,"IndentationAwareTokenBuilder"),Qs),eo,zj=(eo=class extends py{constructor(e){if(super(e),e.parser.TokenBuilder instanceof sN)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(e,r=dy){const n=super.tokenize(e),a=n.report;r?.mode==="full"&&n.tokens.push(...a.remainingDedents),a.remainingDedents=[];const{indentTokenType:i,dedentTokenType:o}=this.indentationTokenBuilder,c=i.tokenTypeIdx,l=o.tokenTypeIdx,u=[],f=n.tokens.length-1;for(let d=0;d<f;d++){const p=n.tokens[d],g=n.tokens[d+1];if(p.tokenTypeIdx===c&&g.tokenTypeIdx===l){d++;continue}u.push(p)}return f>=0&&u.push(n.tokens[f]),n.tokens=u,n}},s(eo,"IndentationAwareLexer"),eo),Ay={};Zr(Ay,{AstUtils:()=>Wh,BiMap:()=>sf,Cancellation:()=>$e,ContextCache:()=>md,CstUtils:()=>zh,DONE_RESULT:()=>nt,Deferred:()=>Or,Disposable:()=>Ln,DisposableCache:()=>hd,DocumentCache:()=>II,EMPTY_STREAM:()=>bo,ErrorWithLocation:()=>$f,GrammarUtils:()=>$m,MultiMap:()=>Lr,OperationCancelled:()=>or,Reduction:()=>Jl,RegExpUtils:()=>Em,SimpleCache:()=>oy,StreamImpl:()=>sr,TreeStreamImpl:()=>wo,URI:()=>Rt,UriTrie:()=>iy,UriUtils:()=>it,WorkspaceCache:()=>ly,assertCondition:()=>Am,assertUnreachable:()=>Qr,delayNextTick:()=>dd,interruptAndCheck:()=>Ye,isOperationCancelled:()=>oa,loadGrammarFromJson:()=>wt,setInterruptionPeriod:()=>ry,startCancelableOperation:()=>pd,stream:()=>ue});uf(Ay,gd);var to,oN=(to=class{stat(e){throw new Error("No file system is available.")}statSync(e){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}},s(to,"EmptyFileSystemProvider"),to),Gt={fileSystemProvider:s(()=>new oN,"fileSystemProvider")},Bj={Grammar:s(()=>{},"Grammar"),LanguageMetaData:s(()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"}),"LanguageMetaData")},Kj={AstReflection:s(()=>new dm,"AstReflection")};function lN(){const t=ke(bt(Gt),Kj),e=ke(St({shared:t}),Bj);return t.ServiceRegistry.regi
`)}}},s(io,"AbstractMermaidValueConverter"),io),so,Lc=(so=class extends Yo{runCustomConverter(e,r,n){}},s(so,"CommonValueConverter"),so),oo,gr=(oo=class extends fd{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,r,n){const a=super.buildKeywordTokens(e,r,n);return a.forEach(i=>{this.keywords.has(i.name)&&i.PATTERN!==void 0&&(i.PATTERN=new RegExp(i.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),a}},s(oo,"AbstractMermaidTokenBuilder"),oo),lo;lo=class extends gr{},s(lo,"CommonTokenBuilder");/*! Bundled license information:
lodash-es/lodash.js:
(**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
*/var co,jU=(co=class extends gr{constructor(){super(["radar-beta"])}},s(co,"RadarTokenBuilder"),co),fN={parser:{TokenBuilder:s(()=>new jU,"TokenBuilder"),ValueConverter:s(()=>new Lc,"ValueConverter")}};function dN(t=Gt){const e=ke(bt(t),mr),r=ke(St({shared:e}),PU,fN);return e.ServiceRegistry.register(r),{shared:e,Radar:r}}s(dN,"createRadarServices");var uo,UU=(uo=class extends gr{constructor(){super(["treemap"])}},s(uo,"TreemapTokenBuilder"),uo),zU=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,fo,BU=(fo=class extends Yo{runCustomConverter(e,r,n){if(e.name==="NUMBER2")return parseFloat(r.replace(/,/g,""));if(e.name==="SEPARATOR")return r.substring(1,r.length-1);if(e.name==="STRING2")return r.substring(1,r.length-1);if(e.name==="INDENTATION")return r.length;if(e.name==="ClassDef"){if(typeof r!="string")return r;const a=zU.exec(r);if(a)return{$type:"ClassDefStatement",className:a[1],styleText:a[2]||void 0}}}},s(fo,"TreemapValueConverter"),fo);function pN(t){const e=t.validation.TreemapValidator,r=t.validation.ValidationRegistry;if(r){const n={Treemap:e.checkSingleRoot.bind(e)};r.register(n,e)}}s(pN,"registerValidationChecks");var po,KU=(po=class{checkSingleRoot(e,r){let n;for(const a of e.TreemapRows)a.item&&(n===void 0&&a.indent===void 0?n=0:a.indent===void 0?r("error","Multiple root nodes are not allowed in a treemap.",{node:a,property:"item"}):n!==void 0&&n>=parseInt(a.indent,10)&&r("error","Multiple root nodes are not allowed in a treemap.",{node:a,property:"item"}))}},s(po,"TreemapValidator"),po),hN={parser:{TokenBuilder:s(()=>new UU,"TokenBuilder"),ValueConverter:s(()=>new BU,"ValueConverter")},validation:{TreemapValidator:s(()=>new KU,"TreemapValidator")}};function mN(t=Gt){const e=ke(bt(t),mr),r=ke(St({shared:e}),OU,hN);return e.ServiceRegistry.register(r),pN(r),{shared:e,Treemap:r}}s(mN,"createTreemapServices");var ho,WU=(ho=class extends Yo{runCustomConverter(e,r,n){switch(e.name.toUpperCase()){case"LINK_LABEL":return r.substring(1).trim();default:return}}},s(ho,"WardleyValueConverter"),ho),gN={parser:{ValueConverter:s(()=>new WU,"ValueConverter")}};function yN(t=Gt){const e=ke(bt(t),mr),r=ke(St({shared:e}),DU,gN);return e.ServiceRegistry.register(r),{shared:e,Wardley:r}}s(yN,"createWardleyServices");var mo,qU=(mo=class extends gr{constructor(){super(["gitGraph"])}},s(mo,"GitGraphTokenBuilder"),mo),vN={parser:{TokenBuilder:s(()=>new qU,"TokenBuilder"),ValueConverter:s(()=>new Lc,"ValueConverter")}};function TN(t=Gt){const e=ke(bt(t),mr),r=ke(St({shared:e}),wU,vN);return e.ServiceRegistry.register(r),{shared:e,GitGraph:r}}s(TN,"createGitGraphServices");var go,VU=(go=class extends gr{constructor(){super(["info","showInfo"])}},s(go,"InfoTokenBuilder"),go),RN={parser:{TokenBuilder:s(()=>new VU,"TokenBuilder"),ValueConverter:s(()=>new Lc,"ValueConverter")}};function $N(t=Gt){const e=ke(bt(t),mr),r=ke(St({shared:e}),IU,RN);return e.ServiceRegistry.register(r),{shared:e,Info:r}}s($N,"createInfoServices");var yo,HU=(yo=class extends gr{constructor(){super(["packet"])}},s(yo,"PacketTokenBuilder"),yo),AN={parser:{TokenBuilder:s(()=>new HU,"TokenBuilder"),ValueConverter:s(()=>new Lc,"ValueConverter")}};function EN(t=Gt){const e=ke(bt(t),mr),r=ke(St({shared:e}),NU,AN);return e.ServiceRegistry.register(r),{shared:e,Packet:r}}s(EN,"createPacketServices");var vo,YU=(vo=class extends gr{constructor(){super(["pie","showData"])}},s(vo,"PieTokenBuilder"),vo),To,XU=(To=class extends Yo{runCustomConverter(e,r,n){if(e.name==="PIE_SECTION_LABEL")return r.replace(/"/g,"").trim()}},s(To,"PieValueConverter"),To),_N={parser:{TokenBuilder:s(()=>new YU,"TokenBuilder"),ValueConverter:s(()=>new XU,"ValueConverter")}};function CN(t=Gt){const e=ke(bt(t),mr),r=ke(St({shared:e}),kU,_N);return e.ServiceRegistry.register(r),{shared:e,Pie:r}}s(CN,"createPieServices");var Ro,JU=(Ro=class extends Yo{runCustomConverter(e,r,n){if(e.name==="INDENTATION")return r?.length||0;if(e.name==="STRING2")return r.substring(1,r.length-1)}},s(Ro,"TreeViewValueConverter"),Ro),$o,ZU=($o=class extends gr{constructor(){super(["treeView-beta"])}},s($o,"TreeViewTokenBu
`),n=e.parserErrors.map(a=>{const i=a.token.startLine!==void 0&&!isNaN(a.token.startLine)?a.token.startLine:"?",o=a.token.startColumn!==void 0&&!isNaN(a.token.startColumn)?a.token.startColumn:"?";return`Parse error on line ${i}, column ${o}: ${a.message}`}).join(`
`);super(`Parsing failed: ${r} ${n}`),this.result=e}},s(So,"MermaidParseError"),So);const sz=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:RN,createInfoServices:$N},Symbol.toStringTag,{value:"Module"})),oz=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:AN,createPacketServices:EN},Symbol.toStringTag,{value:"Module"})),lz=Object.freeze(Object.defineProperty({__proto__:null,PieModule:_N,createPieServices:CN},Symbol.toStringTag,{value:"Module"})),cz=Object.freeze(Object.defineProperty({__proto__:null,TreeViewModule:SN,createTreeViewServices:bN},Symbol.toStringTag,{value:"Module"})),uz=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:wN,createArchitectureServices:IN},Symbol.toStringTag,{value:"Module"})),fz=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:vN,createGitGraphServices:TN},Symbol.toStringTag,{value:"Module"})),dz=Object.freeze(Object.defineProperty({__proto__:null,EventModelingModule:kN,createEventModelingServices:PN},Symbol.toStringTag,{value:"Module"})),pz=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:fN,createRadarServices:dN},Symbol.toStringTag,{value:"Module"})),hz=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:hN,createTreemapServices:mN},Symbol.toStringTag,{value:"Module"})),mz=Object.freeze(Object.defineProperty({__proto__:null,WardleyModule:gN,createWardleyServices:yN},Symbol.toStringTag,{value:"Module"}));export{Xj as i,az as p};