acspec-parser 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/main.mjs CHANGED
@@ -1,99 +1,99 @@
1
- var aA=Object.create;var Pu=Object.defineProperty;var cA=Object.getOwnPropertyDescriptor;var uA=Object.getOwnPropertyNames;var lA=Object.getPrototypeOf,dA=Object.prototype.hasOwnProperty;var fA=(t,e)=>()=>(t&&(e=t(t=0)),e);var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),En=(t,e)=>{for(var r in e)Pu(t,r,{get:e[r],enumerable:!0})},Nu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of uA(e))!dA.call(t,i)&&i!==r&&Pu(t,i,{get:()=>e[i],enumerable:!(n=cA(e,i))||n.enumerable});return t},se=(t,e,r)=>(Nu(t,e,"default"),r&&Nu(r,e,"default")),hr=(t,e,r)=>(r=t!=null?aA(lA(t)):{},Nu(e||!t||!t.__esModule?Pu(r,"default",{value:t,enumerable:!0}):r,t)),gh=t=>Nu(Pu({},"__esModule",{value:!0}),t);var fd={};En(fd,{AnnotatedTextEdit:()=>Rn,ChangeAnnotation:()=>Pi,ChangeAnnotationIdentifier:()=>Ct,CodeAction:()=>km,CodeActionContext:()=>Cm,CodeActionKind:()=>bm,CodeActionTriggerKind:()=>yc,CodeDescription:()=>em,CodeLens:()=>Sm,Color:()=>od,ColorInformation:()=>Vp,ColorPresentation:()=>Xp,Command:()=>Di,CompletionItem:()=>dm,CompletionItemKind:()=>om,CompletionItemLabelDetails:()=>lm,CompletionItemTag:()=>am,CompletionList:()=>fm,CreateFile:()=>Os,DeleteFile:()=>Ms,Diagnostic:()=>hc,DiagnosticRelatedInformation:()=>sd,DiagnosticSeverity:()=>Qp,DiagnosticTag:()=>Zp,DocumentHighlight:()=>ym,DocumentHighlightKind:()=>gm,DocumentLink:()=>Am,DocumentSymbol:()=>_m,DocumentUri:()=>Gp,EOL:()=>gF,FoldingRange:()=>Jp,FoldingRangeKind:()=>Yp,FormattingOptions:()=>Em,Hover:()=>hm,InlayHint:()=>Fm,InlayHintKind:()=>ld,InlayHintLabelPart:()=>dd,InlineCompletionContext:()=>Bm,InlineCompletionItem:()=>qm,InlineCompletionList:()=>Um,InlineCompletionTriggerKind:()=>jm,InlineValueContext:()=>Mm,InlineValueEvaluatableExpression:()=>Lm,InlineValueText:()=>Im,InlineValueVariableLookup:()=>Om,InsertReplaceEdit:()=>cm,InsertTextFormat:()=>sm,InsertTextMode:()=>um,Location:()=>fc,LocationLink:()=>Kp,MarkedString:()=>gc,MarkupContent:()=>Fs,MarkupKind:()=>ud,OptionalVersionedTextDocumentIdentifier:()=>mc,ParameterInformation:()=>pm,Position:()=>ce,Range:()=>te,RenameFile:()=>Ls,SelectedCompletionInfo:()=>Wm,SelectionRange:()=>wm,SemanticTokenModifiers:()=>Pm,SemanticTokenTypes:()=>Nm,SemanticTokens:()=>Dm,SignatureInformation:()=>mm,StringValue:()=>$m,SymbolInformation:()=>Tm,SymbolKind:()=>vm,SymbolTag:()=>xm,TextDocument:()=>Gm,TextDocumentEdit:()=>pc,TextDocumentIdentifier:()=>rm,TextDocumentItem:()=>im,TextEdit:()=>vr,URI:()=>id,VersionedTextDocumentIdentifier:()=>nm,WorkspaceChange:()=>tm,WorkspaceEdit:()=>ad,WorkspaceFolder:()=>Hm,WorkspaceSymbol:()=>Rm,integer:()=>zp,uinteger:()=>dc});var Gp,id,zp,dc,ce,te,fc,Kp,od,Vp,Xp,Yp,Jp,sd,Qp,Zp,em,hc,Di,vr,Pi,Ct,Rn,pc,Os,Ls,Ms,ad,Is,cd,tm,rm,nm,mc,im,ud,Fs,om,sm,am,cm,um,lm,dm,fm,gc,hm,pm,mm,gm,ym,vm,xm,Tm,Rm,_m,bm,yc,Cm,km,Sm,Em,Am,wm,Nm,Pm,Dm,Im,Om,Lm,Mm,ld,dd,Fm,$m,qm,Um,jm,Wm,Bm,Hm,gF,Gm,zm,x,Ii=fA(()=>{"use strict";(function(t){function e(r){return typeof r=="string"}t.is=e})(Gp||(Gp={}));(function(t){function e(r){return typeof r=="string"}t.is=e})(id||(id={}));(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(zp||(zp={}));(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(dc||(dc={}));(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=dc.MAX_VALUE),i===Number.MAX_VALUE&&(i=dc.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.uinteger(i.line)&&x.uinteger(i.character)}t.is=r})(ce||(ce={}));(function(t){function e(n,i,o,s){if(x.uinteger(n)&&x.uinteger(i)&&x.uinteger(o)&&x.uinteger(s))return{start:ce.create(n,i),end:ce.create(o,s)};if(ce.is(n)&&ce.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${o}, ${s}]`)}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&ce.is(i.start)&&ce.is(i.end)}t.is=r})(te||(te={}));(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&te.is(i.range)&&(x.string(i.uri)||x.undefined(i.uri))}t.is=r})(fc||(fc={}));(function(t){function e(n,i,o,s){return{targetUri:n,targetRange:i,targetSelectionRange:o,originSelectionRange:s}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&te.is(i.targetRange)&&x.string(i.targetUri)&&te.is(i.targetSelectionRange)&&(te.is(i.originSelectionRange)||x.undefined(i.originSelectionRange))}t.is=r})(Kp||(Kp={}));(function(t){function e(n,i,o,s){return{red:n,green:i,blue:o,alpha:s}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.numberRange(i.red,0,1)&&x.numberRange(i.green,0,1)&&x.numberRange(i.blue,0,1)&&x.numberRange(i.alpha,0,1)}t.is=r})(od||(od={}));(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&te.is(i.range)&&od.is(i.color)}t.is=r})(Vp||(Vp={}));(function(t){function e(n,i,o){return{label:n,textEdit:i,additionalTextEdits:o}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.string(i.label)&&(x.undefined(i.textEdit)||vr.is(i))&&(x.undefined(i.additionalTextEdits)||x.typedArray(i.additionalTextEdits,vr.is))}t.is=r})(Xp||(Xp={}));(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(Yp||(Yp={}));(function(t){function e(n,i,o,s,a,c){let u={startLine:n,endLine:i};return x.defined(o)&&(u.startCharacter=o),x.defined(s)&&(u.endCharacter=s),x.defined(a)&&(u.kind=a),x.defined(c)&&(u.collapsedText=c),u}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.uinteger(i.startLine)&&x.uinteger(i.startLine)&&(x.undefined(i.startCharacter)||x.uinteger(i.startCharacter))&&(x.undefined(i.endCharacter)||x.uinteger(i.endCharacter))&&(x.undefined(i.kind)||x.string(i.kind))}t.is=r})(Jp||(Jp={}));(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&fc.is(i.location)&&x.string(i.message)}t.is=r})(sd||(sd={}));(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Qp||(Qp={}));(function(t){t.Unnecessary=1,t.Deprecated=2})(Zp||(Zp={}));(function(t){function e(r){let n=r;return x.objectLiteral(n)&&x.string(n.href)}t.is=e})(em||(em={}));(function(t){function e(n,i,o,s,a,c){let u={range:n,message:i};return x.defined(o)&&(u.severity=o),x.defined(s)&&(u.code=s),x.defined(a)&&(u.source=a),x.defined(c)&&(u.relatedInformation=c),u}t.create=e;function r(n){var i;let o=n;return x.defined(o)&&te.is(o.range)&&x.string(o.message)&&(x.number(o.severity)||x.undefined(o.severity))&&(x.integer(o.code)||x.string(o.code)||x.undefined(o.code))&&(x.undefined(o.codeDescription)||x.string((i=o.codeDescription)===null||i===void 0?void 0:i.href))&&(x.string(o.source)||x.undefined(o.source))&&(x.undefined(o.relatedInformation)||x.typedArray(o.relatedInformation,sd.is))}t.is=r})(hc||(hc={}));(function(t){function e(n,i,...o){let s={title:n,command:i};return x.defined(o)&&o.length>0&&(s.arguments=o),s}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.title)&&x.string(i.command)}t.is=r})(Di||(Di={}));(function(t){function e(o,s){return{range:o,newText:s}}t.replace=e;function r(o,s){return{range:{start:o,end:o},newText:s}}t.insert=r;function n(o){return{range:o,newText:""}}t.del=n;function i(o){let s=o;return x.objectLiteral(s)&&x.string(s.newText)&&te.is(s.range)}t.is=i})(vr||(vr={}));(function(t){function e(n,i,o){let s={label:n};return i!==void 0&&(s.needsConfirmation=i),o!==void 0&&(s.description=o),s}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.string(i.label)&&(x.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(x.string(i.description)||i.description===void 0)}t.is=r})(Pi||(Pi={}));(function(t){function e(r){let n=r;return x.string(n)}t.is=e})(Ct||(Ct={}));(function(t){function e(o,s,a){return{range:o,newText:s,annotationId:a}}t.replace=e;function r(o,s,a){return{range:{start:o,end:o},newText:s,annotationId:a}}t.insert=r;function n(o,s){return{range:o,newText:"",annotationId:s}}t.del=n;function i(o){let s=o;return vr.is(s)&&(Pi.is(s.annotationId)||Ct.is(s.annotationId))}t.is=i})(Rn||(Rn={}));(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&mc.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(pc||(pc={}));(function(t){function e(n,i,o){let s={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}t.create=e;function r(n){let i=n;return i&&i.kind==="create"&&x.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||x.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||x.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Ct.is(i.annotationId))}t.is=r})(Os||(Os={}));(function(t){function e(n,i,o,s){let a={kind:"rename",oldUri:n,newUri:i};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}t.create=e;function r(n){let i=n;return i&&i.kind==="rename"&&x.string(i.oldUri)&&x.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||x.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||x.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Ct.is(i.annotationId))}t.is=r})(Ls||(Ls={}));(function(t){function e(n,i,o){let s={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}t.create=e;function r(n){let i=n;return i&&i.kind==="delete"&&x.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||x.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||x.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Ct.is(i.annotationId))}t.is=r})(Ms||(Ms={}));(function(t){function e(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>x.string(i.kind)?Os.is(i)||Ls.is(i)||Ms.is(i):pc.is(i)))}t.is=e})(ad||(ad={}));Is=class{constructor(e,r){this.edits=e,this.changeAnnotations=r}insert(e,r,n){let i,o;if(n===void 0?i=vr.insert(e,r):Ct.is(n)?(o=n,i=Rn.insert(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),i=Rn.insert(e,r,o)),this.edits.push(i),o!==void 0)return o}replace(e,r,n){let i,o;if(n===void 0?i=vr.replace(e,r):Ct.is(n)?(o=n,i=Rn.replace(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),i=Rn.replace(e,r,o)),this.edits.push(i),o!==void 0)return o}delete(e,r){let n,i;if(r===void 0?n=vr.del(e):Ct.is(r)?(i=r,n=Rn.del(e,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=Rn.del(e,i)),this.edits.push(n),i!==void 0)return i}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},cd=class{constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,r){let n;if(Ct.is(e)?n=e:(n=this.nextId(),r=e),this._annotations[n]!==void 0)throw new Error(`Id ${n} is already in use.`);if(r===void 0)throw new Error(`No annotation provided for id ${n}`);return this._annotations[n]=r,this._size++,n}nextId(){return this._counter++,this._counter.toString()}},tm=class{constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new cd(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(r=>{if(pc.is(r)){let n=new Is(r.edits,this._changeAnnotations);this._textEditChanges[r.textDocument.uri]=n}})):e.changes&&Object.keys(e.changes).forEach(r=>{let n=new Is(e.changes[r]);this._textEditChanges[r]=n})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(mc.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let r={uri:e.uri,version:e.version},n=this._textEditChanges[r.uri];if(!n){let i=[],o={textDocument:r,edits:i};this._workspaceEdit.documentChanges.push(o),n=new Is(i,this._changeAnnotations),this._textEditChanges[r.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let r=this._textEditChanges[e];if(!r){let n=[];this._workspaceEdit.changes[e]=n,r=new Is(n),this._textEditChanges[e]=r}return r}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new cd,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Pi.is(r)||Ct.is(r)?i=r:n=r;let o,s;if(i===void 0?o=Os.create(e,n):(s=Ct.is(i)?i:this._changeAnnotations.manage(i),o=Os.create(e,n,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}renameFile(e,r,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;Pi.is(n)||Ct.is(n)?o=n:i=n;let s,a;if(o===void 0?s=Ls.create(e,r,i):(a=Ct.is(o)?o:this._changeAnnotations.manage(o),s=Ls.create(e,r,i,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}deleteFile(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Pi.is(r)||Ct.is(r)?i=r:n=r;let o,s;if(i===void 0?o=Ms.create(e,n):(s=Ct.is(i)?i:this._changeAnnotations.manage(i),o=Ms.create(e,n,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}};(function(t){function e(n){return{uri:n}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.uri)}t.is=r})(rm||(rm={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.uri)&&x.integer(i.version)}t.is=r})(nm||(nm={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.uri)&&(i.version===null||x.integer(i.version))}t.is=r})(mc||(mc={}));(function(t){function e(n,i,o,s){return{uri:n,languageId:i,version:o,text:s}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.uri)&&x.string(i.languageId)&&x.integer(i.version)&&x.string(i.text)}t.is=r})(im||(im={}));(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){let n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(ud||(ud={}));(function(t){function e(r){let n=r;return x.objectLiteral(r)&&ud.is(n.kind)&&x.string(n.value)}t.is=e})(Fs||(Fs={}));(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(om||(om={}));(function(t){t.PlainText=1,t.Snippet=2})(sm||(sm={}));(function(t){t.Deprecated=1})(am||(am={}));(function(t){function e(n,i,o){return{newText:n,insert:i,replace:o}}t.create=e;function r(n){let i=n;return i&&x.string(i.newText)&&te.is(i.insert)&&te.is(i.replace)}t.is=r})(cm||(cm={}));(function(t){t.asIs=1,t.adjustIndentation=2})(um||(um={}));(function(t){function e(r){let n=r;return n&&(x.string(n.detail)||n.detail===void 0)&&(x.string(n.description)||n.description===void 0)}t.is=e})(lm||(lm={}));(function(t){function e(r){return{label:r}}t.create=e})(dm||(dm={}));(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(fm||(fm={}));(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){let i=n;return x.string(i)||x.objectLiteral(i)&&x.string(i.language)&&x.string(i.value)}t.is=r})(gc||(gc={}));(function(t){function e(r){let n=r;return!!n&&x.objectLiteral(n)&&(Fs.is(n.contents)||gc.is(n.contents)||x.typedArray(n.contents,gc.is))&&(r.range===void 0||te.is(r.range))}t.is=e})(hm||(hm={}));(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(pm||(pm={}));(function(t){function e(r,n,...i){let o={label:r};return x.defined(n)&&(o.documentation=n),x.defined(i)?o.parameters=i:o.parameters=[],o}t.create=e})(mm||(mm={}));(function(t){t.Text=1,t.Read=2,t.Write=3})(gm||(gm={}));(function(t){function e(r,n){let i={range:r};return x.number(n)&&(i.kind=n),i}t.create=e})(ym||(ym={}));(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(vm||(vm={}));(function(t){t.Deprecated=1})(xm||(xm={}));(function(t){function e(r,n,i,o,s){let a={name:r,kind:n,location:{uri:o,range:i}};return s&&(a.containerName=s),a}t.create=e})(Tm||(Tm={}));(function(t){function e(r,n,i,o){return o!==void 0?{name:r,kind:n,location:{uri:i,range:o}}:{name:r,kind:n,location:{uri:i}}}t.create=e})(Rm||(Rm={}));(function(t){function e(n,i,o,s,a,c){let u={name:n,detail:i,kind:o,range:s,selectionRange:a};return c!==void 0&&(u.children=c),u}t.create=e;function r(n){let i=n;return i&&x.string(i.name)&&x.number(i.kind)&&te.is(i.range)&&te.is(i.selectionRange)&&(i.detail===void 0||x.string(i.detail))&&(i.deprecated===void 0||x.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(_m||(_m={}));(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(bm||(bm={}));(function(t){t.Invoked=1,t.Automatic=2})(yc||(yc={}));(function(t){function e(n,i,o){let s={diagnostics:n};return i!=null&&(s.only=i),o!=null&&(s.triggerKind=o),s}t.create=e;function r(n){let i=n;return x.defined(i)&&x.typedArray(i.diagnostics,hc.is)&&(i.only===void 0||x.typedArray(i.only,x.string))&&(i.triggerKind===void 0||i.triggerKind===yc.Invoked||i.triggerKind===yc.Automatic)}t.is=r})(Cm||(Cm={}));(function(t){function e(n,i,o){let s={title:n},a=!0;return typeof i=="string"?(a=!1,s.kind=i):Di.is(i)?s.command=i:s.edit=i,a&&o!==void 0&&(s.kind=o),s}t.create=e;function r(n){let i=n;return i&&x.string(i.title)&&(i.diagnostics===void 0||x.typedArray(i.diagnostics,hc.is))&&(i.kind===void 0||x.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Di.is(i.command))&&(i.isPreferred===void 0||x.boolean(i.isPreferred))&&(i.edit===void 0||ad.is(i.edit))}t.is=r})(km||(km={}));(function(t){function e(n,i){let o={range:n};return x.defined(i)&&(o.data=i),o}t.create=e;function r(n){let i=n;return x.defined(i)&&te.is(i.range)&&(x.undefined(i.command)||Di.is(i.command))}t.is=r})(Sm||(Sm={}));(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.uinteger(i.tabSize)&&x.boolean(i.insertSpaces)}t.is=r})(Em||(Em={}));(function(t){function e(n,i,o){return{range:n,target:i,data:o}}t.create=e;function r(n){let i=n;return x.defined(i)&&te.is(i.range)&&(x.undefined(i.target)||x.string(i.target))}t.is=r})(Am||(Am={}));(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&te.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(wm||(wm={}));(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(Nm||(Nm={}));(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(Pm||(Pm={}));(function(t){function e(r){let n=r;return x.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}t.is=e})(Dm||(Dm={}));(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){let i=n;return i!=null&&te.is(i.range)&&x.string(i.text)}t.is=r})(Im||(Im={}));(function(t){function e(n,i,o){return{range:n,variableName:i,caseSensitiveLookup:o}}t.create=e;function r(n){let i=n;return i!=null&&te.is(i.range)&&x.boolean(i.caseSensitiveLookup)&&(x.string(i.variableName)||i.variableName===void 0)}t.is=r})(Om||(Om={}));(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){let i=n;return i!=null&&te.is(i.range)&&(x.string(i.expression)||i.expression===void 0)}t.is=r})(Lm||(Lm={}));(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&te.is(n.stoppedLocation)}t.is=r})(Mm||(Mm={}));(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(ld||(ld={}));(function(t){function e(n){return{value:n}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&(i.tooltip===void 0||x.string(i.tooltip)||Fs.is(i.tooltip))&&(i.location===void 0||fc.is(i.location))&&(i.command===void 0||Di.is(i.command))}t.is=r})(dd||(dd={}));(function(t){function e(n,i,o){let s={position:n,label:i};return o!==void 0&&(s.kind=o),s}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&ce.is(i.position)&&(x.string(i.label)||x.typedArray(i.label,dd.is))&&(i.kind===void 0||ld.is(i.kind))&&i.textEdits===void 0||x.typedArray(i.textEdits,vr.is)&&(i.tooltip===void 0||x.string(i.tooltip)||Fs.is(i.tooltip))&&(i.paddingLeft===void 0||x.boolean(i.paddingLeft))&&(i.paddingRight===void 0||x.boolean(i.paddingRight))}t.is=r})(Fm||(Fm={}));(function(t){function e(r){return{kind:"snippet",value:r}}t.createSnippet=e})($m||($m={}));(function(t){function e(r,n,i,o){return{insertText:r,filterText:n,range:i,command:o}}t.create=e})(qm||(qm={}));(function(t){function e(r){return{items:r}}t.create=e})(Um||(Um={}));(function(t){t.Invoked=0,t.Automatic=1})(jm||(jm={}));(function(t){function e(r,n){return{range:r,text:n}}t.create=e})(Wm||(Wm={}));(function(t){function e(r,n){return{triggerKind:r,selectedCompletionInfo:n}}t.create=e})(Bm||(Bm={}));(function(t){function e(r){let n=r;return x.objectLiteral(n)&&id.is(n.uri)&&x.string(n.name)}t.is=e})(Hm||(Hm={}));gF=[`
1
+ var uA=Object.create;var Pu=Object.defineProperty;var lA=Object.getOwnPropertyDescriptor;var dA=Object.getOwnPropertyNames;var fA=Object.getPrototypeOf,hA=Object.prototype.hasOwnProperty;var pA=(t,e)=>()=>(t&&(e=t(t=0)),e);var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),En=(t,e)=>{for(var r in e)Pu(t,r,{get:e[r],enumerable:!0})},Nu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of dA(e))!hA.call(t,i)&&i!==r&&Pu(t,i,{get:()=>e[i],enumerable:!(n=lA(e,i))||n.enumerable});return t},se=(t,e,r)=>(Nu(t,e,"default"),r&&Nu(r,e,"default")),hr=(t,e,r)=>(r=t!=null?uA(fA(t)):{},Nu(e||!t||!t.__esModule?Pu(r,"default",{value:t,enumerable:!0}):r,t)),vh=t=>Nu(Pu({},"__esModule",{value:!0}),t);var fd={};En(fd,{AnnotatedTextEdit:()=>Rn,ChangeAnnotation:()=>Pi,ChangeAnnotationIdentifier:()=>Ct,CodeAction:()=>Em,CodeActionContext:()=>km,CodeActionKind:()=>Sm,CodeActionTriggerKind:()=>vc,CodeDescription:()=>rm,CodeLens:()=>Am,Color:()=>od,ColorInformation:()=>Yp,ColorPresentation:()=>Jp,Command:()=>Di,CompletionItem:()=>hm,CompletionItemKind:()=>am,CompletionItemLabelDetails:()=>fm,CompletionItemTag:()=>um,CompletionList:()=>pm,CreateFile:()=>Ls,DeleteFile:()=>Fs,Diagnostic:()=>pc,DiagnosticRelatedInformation:()=>sd,DiagnosticSeverity:()=>em,DiagnosticTag:()=>tm,DocumentHighlight:()=>xm,DocumentHighlightKind:()=>vm,DocumentLink:()=>Nm,DocumentSymbol:()=>Cm,DocumentUri:()=>Kp,EOL:()=>vF,FoldingRange:()=>Zp,FoldingRangeKind:()=>Qp,FormattingOptions:()=>wm,Hover:()=>mm,InlayHint:()=>qm,InlayHintKind:()=>ld,InlayHintLabelPart:()=>dd,InlineCompletionContext:()=>Gm,InlineCompletionItem:()=>jm,InlineCompletionList:()=>Wm,InlineCompletionTriggerKind:()=>Bm,InlineValueContext:()=>$m,InlineValueEvaluatableExpression:()=>Fm,InlineValueText:()=>Lm,InlineValueVariableLookup:()=>Mm,InsertReplaceEdit:()=>lm,InsertTextFormat:()=>cm,InsertTextMode:()=>dm,Location:()=>hc,LocationLink:()=>Xp,MarkedString:()=>yc,MarkupContent:()=>$s,MarkupKind:()=>ud,OptionalVersionedTextDocumentIdentifier:()=>gc,ParameterInformation:()=>gm,Position:()=>ce,Range:()=>te,RenameFile:()=>Ms,SelectedCompletionInfo:()=>Hm,SelectionRange:()=>Pm,SemanticTokenModifiers:()=>Im,SemanticTokenTypes:()=>Dm,SemanticTokens:()=>Om,SignatureInformation:()=>ym,StringValue:()=>Um,SymbolInformation:()=>_m,SymbolKind:()=>Tm,SymbolTag:()=>Rm,TextDocument:()=>Km,TextDocumentEdit:()=>mc,TextDocumentIdentifier:()=>im,TextDocumentItem:()=>sm,TextEdit:()=>vr,URI:()=>id,VersionedTextDocumentIdentifier:()=>om,WorkspaceChange:()=>nm,WorkspaceEdit:()=>ad,WorkspaceFolder:()=>zm,WorkspaceSymbol:()=>bm,integer:()=>Vp,uinteger:()=>fc});var Kp,id,Vp,fc,ce,te,hc,Xp,od,Yp,Jp,Qp,Zp,sd,em,tm,rm,pc,Di,vr,Pi,Ct,Rn,mc,Ls,Ms,Fs,ad,Os,cd,nm,im,om,gc,sm,ud,$s,am,cm,um,lm,dm,fm,hm,pm,yc,mm,gm,ym,vm,xm,Tm,Rm,_m,bm,Cm,Sm,vc,km,Em,Am,wm,Nm,Pm,Dm,Im,Om,Lm,Mm,Fm,$m,ld,dd,qm,Um,jm,Wm,Bm,Hm,Gm,zm,vF,Km,Vm,x,Ii=pA(()=>{"use strict";(function(t){function e(r){return typeof r=="string"}t.is=e})(Kp||(Kp={}));(function(t){function e(r){return typeof r=="string"}t.is=e})(id||(id={}));(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Vp||(Vp={}));(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(fc||(fc={}));(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=fc.MAX_VALUE),i===Number.MAX_VALUE&&(i=fc.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.uinteger(i.line)&&x.uinteger(i.character)}t.is=r})(ce||(ce={}));(function(t){function e(n,i,o,s){if(x.uinteger(n)&&x.uinteger(i)&&x.uinteger(o)&&x.uinteger(s))return{start:ce.create(n,i),end:ce.create(o,s)};if(ce.is(n)&&ce.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${o}, ${s}]`)}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&ce.is(i.start)&&ce.is(i.end)}t.is=r})(te||(te={}));(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&te.is(i.range)&&(x.string(i.uri)||x.undefined(i.uri))}t.is=r})(hc||(hc={}));(function(t){function e(n,i,o,s){return{targetUri:n,targetRange:i,targetSelectionRange:o,originSelectionRange:s}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&te.is(i.targetRange)&&x.string(i.targetUri)&&te.is(i.targetSelectionRange)&&(te.is(i.originSelectionRange)||x.undefined(i.originSelectionRange))}t.is=r})(Xp||(Xp={}));(function(t){function e(n,i,o,s){return{red:n,green:i,blue:o,alpha:s}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.numberRange(i.red,0,1)&&x.numberRange(i.green,0,1)&&x.numberRange(i.blue,0,1)&&x.numberRange(i.alpha,0,1)}t.is=r})(od||(od={}));(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&te.is(i.range)&&od.is(i.color)}t.is=r})(Yp||(Yp={}));(function(t){function e(n,i,o){return{label:n,textEdit:i,additionalTextEdits:o}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.string(i.label)&&(x.undefined(i.textEdit)||vr.is(i))&&(x.undefined(i.additionalTextEdits)||x.typedArray(i.additionalTextEdits,vr.is))}t.is=r})(Jp||(Jp={}));(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(Qp||(Qp={}));(function(t){function e(n,i,o,s,a,c){let u={startLine:n,endLine:i};return x.defined(o)&&(u.startCharacter=o),x.defined(s)&&(u.endCharacter=s),x.defined(a)&&(u.kind=a),x.defined(c)&&(u.collapsedText=c),u}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.uinteger(i.startLine)&&x.uinteger(i.startLine)&&(x.undefined(i.startCharacter)||x.uinteger(i.startCharacter))&&(x.undefined(i.endCharacter)||x.uinteger(i.endCharacter))&&(x.undefined(i.kind)||x.string(i.kind))}t.is=r})(Zp||(Zp={}));(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&hc.is(i.location)&&x.string(i.message)}t.is=r})(sd||(sd={}));(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(em||(em={}));(function(t){t.Unnecessary=1,t.Deprecated=2})(tm||(tm={}));(function(t){function e(r){let n=r;return x.objectLiteral(n)&&x.string(n.href)}t.is=e})(rm||(rm={}));(function(t){function e(n,i,o,s,a,c){let u={range:n,message:i};return x.defined(o)&&(u.severity=o),x.defined(s)&&(u.code=s),x.defined(a)&&(u.source=a),x.defined(c)&&(u.relatedInformation=c),u}t.create=e;function r(n){var i;let o=n;return x.defined(o)&&te.is(o.range)&&x.string(o.message)&&(x.number(o.severity)||x.undefined(o.severity))&&(x.integer(o.code)||x.string(o.code)||x.undefined(o.code))&&(x.undefined(o.codeDescription)||x.string((i=o.codeDescription)===null||i===void 0?void 0:i.href))&&(x.string(o.source)||x.undefined(o.source))&&(x.undefined(o.relatedInformation)||x.typedArray(o.relatedInformation,sd.is))}t.is=r})(pc||(pc={}));(function(t){function e(n,i,...o){let s={title:n,command:i};return x.defined(o)&&o.length>0&&(s.arguments=o),s}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.title)&&x.string(i.command)}t.is=r})(Di||(Di={}));(function(t){function e(o,s){return{range:o,newText:s}}t.replace=e;function r(o,s){return{range:{start:o,end:o},newText:s}}t.insert=r;function n(o){return{range:o,newText:""}}t.del=n;function i(o){let s=o;return x.objectLiteral(s)&&x.string(s.newText)&&te.is(s.range)}t.is=i})(vr||(vr={}));(function(t){function e(n,i,o){let s={label:n};return i!==void 0&&(s.needsConfirmation=i),o!==void 0&&(s.description=o),s}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&x.string(i.label)&&(x.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(x.string(i.description)||i.description===void 0)}t.is=r})(Pi||(Pi={}));(function(t){function e(r){let n=r;return x.string(n)}t.is=e})(Ct||(Ct={}));(function(t){function e(o,s,a){return{range:o,newText:s,annotationId:a}}t.replace=e;function r(o,s,a){return{range:{start:o,end:o},newText:s,annotationId:a}}t.insert=r;function n(o,s){return{range:o,newText:"",annotationId:s}}t.del=n;function i(o){let s=o;return vr.is(s)&&(Pi.is(s.annotationId)||Ct.is(s.annotationId))}t.is=i})(Rn||(Rn={}));(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&gc.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(mc||(mc={}));(function(t){function e(n,i,o){let s={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}t.create=e;function r(n){let i=n;return i&&i.kind==="create"&&x.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||x.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||x.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Ct.is(i.annotationId))}t.is=r})(Ls||(Ls={}));(function(t){function e(n,i,o,s){let a={kind:"rename",oldUri:n,newUri:i};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}t.create=e;function r(n){let i=n;return i&&i.kind==="rename"&&x.string(i.oldUri)&&x.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||x.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||x.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Ct.is(i.annotationId))}t.is=r})(Ms||(Ms={}));(function(t){function e(n,i,o){let s={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}t.create=e;function r(n){let i=n;return i&&i.kind==="delete"&&x.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||x.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||x.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Ct.is(i.annotationId))}t.is=r})(Fs||(Fs={}));(function(t){function e(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>x.string(i.kind)?Ls.is(i)||Ms.is(i)||Fs.is(i):mc.is(i)))}t.is=e})(ad||(ad={}));Os=class{constructor(e,r){this.edits=e,this.changeAnnotations=r}insert(e,r,n){let i,o;if(n===void 0?i=vr.insert(e,r):Ct.is(n)?(o=n,i=Rn.insert(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),i=Rn.insert(e,r,o)),this.edits.push(i),o!==void 0)return o}replace(e,r,n){let i,o;if(n===void 0?i=vr.replace(e,r):Ct.is(n)?(o=n,i=Rn.replace(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),i=Rn.replace(e,r,o)),this.edits.push(i),o!==void 0)return o}delete(e,r){let n,i;if(r===void 0?n=vr.del(e):Ct.is(r)?(i=r,n=Rn.del(e,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=Rn.del(e,i)),this.edits.push(n),i!==void 0)return i}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},cd=class{constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,r){let n;if(Ct.is(e)?n=e:(n=this.nextId(),r=e),this._annotations[n]!==void 0)throw new Error(`Id ${n} is already in use.`);if(r===void 0)throw new Error(`No annotation provided for id ${n}`);return this._annotations[n]=r,this._size++,n}nextId(){return this._counter++,this._counter.toString()}},nm=class{constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new cd(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(r=>{if(mc.is(r)){let n=new Os(r.edits,this._changeAnnotations);this._textEditChanges[r.textDocument.uri]=n}})):e.changes&&Object.keys(e.changes).forEach(r=>{let n=new Os(e.changes[r]);this._textEditChanges[r]=n})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(gc.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let r={uri:e.uri,version:e.version},n=this._textEditChanges[r.uri];if(!n){let i=[],o={textDocument:r,edits:i};this._workspaceEdit.documentChanges.push(o),n=new Os(i,this._changeAnnotations),this._textEditChanges[r.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let r=this._textEditChanges[e];if(!r){let n=[];this._workspaceEdit.changes[e]=n,r=new Os(n),this._textEditChanges[e]=r}return r}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new cd,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Pi.is(r)||Ct.is(r)?i=r:n=r;let o,s;if(i===void 0?o=Ls.create(e,n):(s=Ct.is(i)?i:this._changeAnnotations.manage(i),o=Ls.create(e,n,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}renameFile(e,r,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;Pi.is(n)||Ct.is(n)?o=n:i=n;let s,a;if(o===void 0?s=Ms.create(e,r,i):(a=Ct.is(o)?o:this._changeAnnotations.manage(o),s=Ms.create(e,r,i,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}deleteFile(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Pi.is(r)||Ct.is(r)?i=r:n=r;let o,s;if(i===void 0?o=Fs.create(e,n):(s=Ct.is(i)?i:this._changeAnnotations.manage(i),o=Fs.create(e,n,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}};(function(t){function e(n){return{uri:n}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.uri)}t.is=r})(im||(im={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.uri)&&x.integer(i.version)}t.is=r})(om||(om={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.uri)&&(i.version===null||x.integer(i.version))}t.is=r})(gc||(gc={}));(function(t){function e(n,i,o,s){return{uri:n,languageId:i,version:o,text:s}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.string(i.uri)&&x.string(i.languageId)&&x.integer(i.version)&&x.string(i.text)}t.is=r})(sm||(sm={}));(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){let n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(ud||(ud={}));(function(t){function e(r){let n=r;return x.objectLiteral(r)&&ud.is(n.kind)&&x.string(n.value)}t.is=e})($s||($s={}));(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(am||(am={}));(function(t){t.PlainText=1,t.Snippet=2})(cm||(cm={}));(function(t){t.Deprecated=1})(um||(um={}));(function(t){function e(n,i,o){return{newText:n,insert:i,replace:o}}t.create=e;function r(n){let i=n;return i&&x.string(i.newText)&&te.is(i.insert)&&te.is(i.replace)}t.is=r})(lm||(lm={}));(function(t){t.asIs=1,t.adjustIndentation=2})(dm||(dm={}));(function(t){function e(r){let n=r;return n&&(x.string(n.detail)||n.detail===void 0)&&(x.string(n.description)||n.description===void 0)}t.is=e})(fm||(fm={}));(function(t){function e(r){return{label:r}}t.create=e})(hm||(hm={}));(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(pm||(pm={}));(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){let i=n;return x.string(i)||x.objectLiteral(i)&&x.string(i.language)&&x.string(i.value)}t.is=r})(yc||(yc={}));(function(t){function e(r){let n=r;return!!n&&x.objectLiteral(n)&&($s.is(n.contents)||yc.is(n.contents)||x.typedArray(n.contents,yc.is))&&(r.range===void 0||te.is(r.range))}t.is=e})(mm||(mm={}));(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(gm||(gm={}));(function(t){function e(r,n,...i){let o={label:r};return x.defined(n)&&(o.documentation=n),x.defined(i)?o.parameters=i:o.parameters=[],o}t.create=e})(ym||(ym={}));(function(t){t.Text=1,t.Read=2,t.Write=3})(vm||(vm={}));(function(t){function e(r,n){let i={range:r};return x.number(n)&&(i.kind=n),i}t.create=e})(xm||(xm={}));(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(Tm||(Tm={}));(function(t){t.Deprecated=1})(Rm||(Rm={}));(function(t){function e(r,n,i,o,s){let a={name:r,kind:n,location:{uri:o,range:i}};return s&&(a.containerName=s),a}t.create=e})(_m||(_m={}));(function(t){function e(r,n,i,o){return o!==void 0?{name:r,kind:n,location:{uri:i,range:o}}:{name:r,kind:n,location:{uri:i}}}t.create=e})(bm||(bm={}));(function(t){function e(n,i,o,s,a,c){let u={name:n,detail:i,kind:o,range:s,selectionRange:a};return c!==void 0&&(u.children=c),u}t.create=e;function r(n){let i=n;return i&&x.string(i.name)&&x.number(i.kind)&&te.is(i.range)&&te.is(i.selectionRange)&&(i.detail===void 0||x.string(i.detail))&&(i.deprecated===void 0||x.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(Cm||(Cm={}));(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(Sm||(Sm={}));(function(t){t.Invoked=1,t.Automatic=2})(vc||(vc={}));(function(t){function e(n,i,o){let s={diagnostics:n};return i!=null&&(s.only=i),o!=null&&(s.triggerKind=o),s}t.create=e;function r(n){let i=n;return x.defined(i)&&x.typedArray(i.diagnostics,pc.is)&&(i.only===void 0||x.typedArray(i.only,x.string))&&(i.triggerKind===void 0||i.triggerKind===vc.Invoked||i.triggerKind===vc.Automatic)}t.is=r})(km||(km={}));(function(t){function e(n,i,o){let s={title:n},a=!0;return typeof i=="string"?(a=!1,s.kind=i):Di.is(i)?s.command=i:s.edit=i,a&&o!==void 0&&(s.kind=o),s}t.create=e;function r(n){let i=n;return i&&x.string(i.title)&&(i.diagnostics===void 0||x.typedArray(i.diagnostics,pc.is))&&(i.kind===void 0||x.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Di.is(i.command))&&(i.isPreferred===void 0||x.boolean(i.isPreferred))&&(i.edit===void 0||ad.is(i.edit))}t.is=r})(Em||(Em={}));(function(t){function e(n,i){let o={range:n};return x.defined(i)&&(o.data=i),o}t.create=e;function r(n){let i=n;return x.defined(i)&&te.is(i.range)&&(x.undefined(i.command)||Di.is(i.command))}t.is=r})(Am||(Am={}));(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&x.uinteger(i.tabSize)&&x.boolean(i.insertSpaces)}t.is=r})(wm||(wm={}));(function(t){function e(n,i,o){return{range:n,target:i,data:o}}t.create=e;function r(n){let i=n;return x.defined(i)&&te.is(i.range)&&(x.undefined(i.target)||x.string(i.target))}t.is=r})(Nm||(Nm={}));(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&te.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(Pm||(Pm={}));(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(Dm||(Dm={}));(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(Im||(Im={}));(function(t){function e(r){let n=r;return x.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}t.is=e})(Om||(Om={}));(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){let i=n;return i!=null&&te.is(i.range)&&x.string(i.text)}t.is=r})(Lm||(Lm={}));(function(t){function e(n,i,o){return{range:n,variableName:i,caseSensitiveLookup:o}}t.create=e;function r(n){let i=n;return i!=null&&te.is(i.range)&&x.boolean(i.caseSensitiveLookup)&&(x.string(i.variableName)||i.variableName===void 0)}t.is=r})(Mm||(Mm={}));(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){let i=n;return i!=null&&te.is(i.range)&&(x.string(i.expression)||i.expression===void 0)}t.is=r})(Fm||(Fm={}));(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){let i=n;return x.defined(i)&&te.is(n.stoppedLocation)}t.is=r})($m||($m={}));(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(ld||(ld={}));(function(t){function e(n){return{value:n}}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&(i.tooltip===void 0||x.string(i.tooltip)||$s.is(i.tooltip))&&(i.location===void 0||hc.is(i.location))&&(i.command===void 0||Di.is(i.command))}t.is=r})(dd||(dd={}));(function(t){function e(n,i,o){let s={position:n,label:i};return o!==void 0&&(s.kind=o),s}t.create=e;function r(n){let i=n;return x.objectLiteral(i)&&ce.is(i.position)&&(x.string(i.label)||x.typedArray(i.label,dd.is))&&(i.kind===void 0||ld.is(i.kind))&&i.textEdits===void 0||x.typedArray(i.textEdits,vr.is)&&(i.tooltip===void 0||x.string(i.tooltip)||$s.is(i.tooltip))&&(i.paddingLeft===void 0||x.boolean(i.paddingLeft))&&(i.paddingRight===void 0||x.boolean(i.paddingRight))}t.is=r})(qm||(qm={}));(function(t){function e(r){return{kind:"snippet",value:r}}t.createSnippet=e})(Um||(Um={}));(function(t){function e(r,n,i,o){return{insertText:r,filterText:n,range:i,command:o}}t.create=e})(jm||(jm={}));(function(t){function e(r){return{items:r}}t.create=e})(Wm||(Wm={}));(function(t){t.Invoked=0,t.Automatic=1})(Bm||(Bm={}));(function(t){function e(r,n){return{range:r,text:n}}t.create=e})(Hm||(Hm={}));(function(t){function e(r,n){return{triggerKind:r,selectedCompletionInfo:n}}t.create=e})(Gm||(Gm={}));(function(t){function e(r){let n=r;return x.objectLiteral(n)&&id.is(n.uri)&&x.string(n.name)}t.is=e})(zm||(zm={}));vF=[`
2
2
  `,`\r
3
- `,"\r"];(function(t){function e(o,s,a,c){return new zm(o,s,a,c)}t.create=e;function r(o){let s=o;return!!(x.defined(s)&&x.string(s.uri)&&(x.undefined(s.languageId)||x.string(s.languageId))&&x.uinteger(s.lineCount)&&x.func(s.getText)&&x.func(s.positionAt)&&x.func(s.offsetAt))}t.is=r;function n(o,s){let a=o.getText(),c=i(s,(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),u=a.length;for(let l=c.length-1;l>=0;l--){let d=c[l],f=o.offsetAt(d.range.start),p=o.offsetAt(d.range.end);if(p<=u)a=a.substring(0,f)+d.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");u=f}return a}t.applyEdits=n;function i(o,s){if(o.length<=1)return o;let a=o.length/2|0,c=o.slice(0,a),u=o.slice(a);i(c,s),i(u,s);let l=0,d=0,f=0;for(;l<c.length&&d<u.length;)s(c[l],u[d])<=0?o[f++]=c[l++]:o[f++]=u[d++];for(;l<c.length;)o[f++]=c[l++];for(;d<u.length;)o[f++]=u[d++];return o}})(Gm||(Gm={}));zm=class{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){this._content=e.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],r=this._content,n=!0;for(let i=0;i<r.length;i++){n&&(e.push(i),n=!1);let o=r.charAt(i);n=o==="\r"||o===`
3
+ `,"\r"];(function(t){function e(o,s,a,c){return new Vm(o,s,a,c)}t.create=e;function r(o){let s=o;return!!(x.defined(s)&&x.string(s.uri)&&(x.undefined(s.languageId)||x.string(s.languageId))&&x.uinteger(s.lineCount)&&x.func(s.getText)&&x.func(s.positionAt)&&x.func(s.offsetAt))}t.is=r;function n(o,s){let a=o.getText(),c=i(s,(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),u=a.length;for(let l=c.length-1;l>=0;l--){let d=c[l],f=o.offsetAt(d.range.start),p=o.offsetAt(d.range.end);if(p<=u)a=a.substring(0,f)+d.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");u=f}return a}t.applyEdits=n;function i(o,s){if(o.length<=1)return o;let a=o.length/2|0,c=o.slice(0,a),u=o.slice(a);i(c,s),i(u,s);let l=0,d=0,f=0;for(;l<c.length&&d<u.length;)s(c[l],u[d])<=0?o[f++]=c[l++]:o[f++]=u[d++];for(;l<c.length;)o[f++]=c[l++];for(;d<u.length;)o[f++]=u[d++];return o}})(Km||(Km={}));Vm=class{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){this._content=e.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],r=this._content,n=!0;for(let i=0;i<r.length;i++){n&&(e.push(i),n=!1);let o=r.charAt(i);n=o==="\r"||o===`
4
4
  `,o==="\r"&&i+1<r.length&&r.charAt(i+1)===`
5
- `&&i++}n&&r.length>0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return ce.create(0,e);for(;n<i;){let s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}let o=n-1;return ce.create(o,e-r[o])}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}};(function(t){let e=Object.prototype.toString;function r(p){return typeof p<"u"}t.defined=r;function n(p){return typeof p>"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function o(p){return e.call(p)==="[object String]"}t.string=o;function s(p){return e.call(p)==="[object Number]"}t.number=s;function a(p,v,T){return e.call(p)==="[object Number]"&&v<=p&&p<=T}t.numberRange=a;function c(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=c;function u(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=u;function l(p){return e.call(p)==="[object Function]"}t.func=l;function d(p){return p!==null&&typeof p=="object"}t.objectLiteral=d;function f(p,v){return Array.isArray(p)&&p.every(v)}t.typedArray=f})(x||(x={}))});var Xn=L(tg=>{"use strict";Object.defineProperty(tg,"__esModule",{value:!0});var Zm;function eg(){if(Zm===void 0)throw new Error("No runtime abstraction layer installed");return Zm}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");Zm=r}t.install=e})(eg||(eg={}));tg.default=eg});var Us=L(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.stringArray=Nt.array=Nt.func=Nt.error=Nt.number=Nt.string=Nt.boolean=void 0;function EF(t){return t===!0||t===!1}Nt.boolean=EF;function Z_(t){return typeof t=="string"||t instanceof String}Nt.string=Z_;function AF(t){return typeof t=="number"||t instanceof Number}Nt.number=AF;function wF(t){return t instanceof Error}Nt.error=wF;function NF(t){return typeof t=="function"}Nt.func=NF;function eb(t){return Array.isArray(t)}Nt.array=eb;function PF(t){return eb(t)&&t.every(e=>Z_(e))}Nt.stringArray=PF});var $i=L(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.Emitter=js.Event=void 0;var DF=Xn(),tb;(function(t){let e={dispose(){}};t.None=function(){return e}})(tb||(js.Event=tb={}));var rg=class{add(e,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,r)})}remove(e,r=null){if(!this._callbacks)return;let n=!1;for(let i=0,o=this._callbacks.length;i<o;i++)if(this._callbacks[i]===e)if(this._contexts[i]===r){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else n=!0;if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];let r=[],n=this._callbacks.slice(0),i=this._contexts.slice(0);for(let o=0,s=n.length;o<s;o++)try{r.push(n[o].apply(i[o],e))}catch(a){(0,DF.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},gd=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,r,n)=>{this._callbacks||(this._callbacks=new rg),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,r);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,r),i.dispose=t._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};js.Emitter=gd;gd._noop=function(){}});var kc=L(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.CancellationTokenSource=Ws.CancellationToken=void 0;var IF=Xn(),OF=Us(),ng=$i(),yd;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ng.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ng.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||OF.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(yd||(Ws.CancellationToken=yd={}));var LF=Object.freeze(function(t,e){let r=(0,IF.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),vd=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?LF:(this._emitter||(this._emitter=new ng.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},ig=class{get token(){return this._token||(this._token=new vd),this._token}cancel(){this._token?this._token.cancel():this._token=yd.Cancelled}dispose(){this._token?this._token instanceof vd&&this._token.dispose():this._token=yd.None}};Ws.CancellationTokenSource=ig});var jg=L(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.Message=W.NotificationType9=W.NotificationType8=W.NotificationType7=W.NotificationType6=W.NotificationType5=W.NotificationType4=W.NotificationType3=W.NotificationType2=W.NotificationType1=W.NotificationType0=W.NotificationType=W.RequestType9=W.RequestType8=W.RequestType7=W.RequestType6=W.RequestType5=W.RequestType4=W.RequestType3=W.RequestType2=W.RequestType1=W.RequestType=W.RequestType0=W.AbstractMessageSignature=W.ParameterStructures=W.ResponseError=W.ErrorCodes=void 0;var zi=Us(),yg;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(yg||(W.ErrorCodes=yg={}));var vg=class t extends Error{constructor(e,r,n){super(r),this.code=zi.number(e)?e:yg.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,t.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};W.ResponseError=vg;var er=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};W.ParameterStructures=er;er.auto=new er("auto");er.byPosition=new er("byPosition");er.byName=new er("byName");var De=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return er.auto}};W.AbstractMessageSignature=De;var xg=class extends De{constructor(e){super(e,0)}};W.RequestType0=xg;var Tg=class extends De{constructor(e,r=er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};W.RequestType=Tg;var Rg=class extends De{constructor(e,r=er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};W.RequestType1=Rg;var _g=class extends De{constructor(e){super(e,2)}};W.RequestType2=_g;var bg=class extends De{constructor(e){super(e,3)}};W.RequestType3=bg;var Cg=class extends De{constructor(e){super(e,4)}};W.RequestType4=Cg;var kg=class extends De{constructor(e){super(e,5)}};W.RequestType5=kg;var Sg=class extends De{constructor(e){super(e,6)}};W.RequestType6=Sg;var Eg=class extends De{constructor(e){super(e,7)}};W.RequestType7=Eg;var Ag=class extends De{constructor(e){super(e,8)}};W.RequestType8=Ag;var wg=class extends De{constructor(e){super(e,9)}};W.RequestType9=wg;var Ng=class extends De{constructor(e,r=er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};W.NotificationType=Ng;var Pg=class extends De{constructor(e){super(e,0)}};W.NotificationType0=Pg;var Dg=class extends De{constructor(e,r=er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};W.NotificationType1=Dg;var Ig=class extends De{constructor(e){super(e,2)}};W.NotificationType2=Ig;var Og=class extends De{constructor(e){super(e,3)}};W.NotificationType3=Og;var Lg=class extends De{constructor(e){super(e,4)}};W.NotificationType4=Lg;var Mg=class extends De{constructor(e){super(e,5)}};W.NotificationType5=Mg;var Fg=class extends De{constructor(e){super(e,6)}};W.NotificationType6=Fg;var $g=class extends De{constructor(e){super(e,7)}};W.NotificationType7=$g;var qg=class extends De{constructor(e){super(e,8)}};W.NotificationType8=qg;var Ug=class extends De{constructor(e){super(e,9)}};W.NotificationType9=Ug;var Rb;(function(t){function e(i){let o=i;return o&&zi.string(o.method)&&(zi.string(o.id)||zi.number(o.id))}t.isRequest=e;function r(i){let o=i;return o&&zi.string(o.method)&&i.id===void 0}t.isNotification=r;function n(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(zi.string(o.id)||zi.number(o.id)||o.id===null)}t.isResponse=n})(Rb||(W.Message=Rb={}))});var Bg=L(Qn=>{"use strict";var _b;Object.defineProperty(Qn,"__esModule",{value:!0});Qn.LRUCache=Qn.LinkedMap=Qn.Touch=void 0;var Pt;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(Pt||(Qn.Touch=Pt={}));var Id=class{constructor(){this[_b]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,r=Pt.None){let n=this._map.get(e);if(n)return r!==Pt.None&&this.touch(n,r),n.value}set(e,r,n=Pt.None){let i=this._map.get(e);if(i)i.value=r,n!==Pt.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case Pt.None:this.addItemLast(i);break;case Pt.First:this.addItemFirst(i);break;case Pt.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let r=this._map.get(e);if(r)return this._map.delete(e),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,r){let n=this._state,i=this._head;for(;i;){if(r?e.bind(r)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:r.key,done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:r.value,done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:[r.key,r.value],done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}[(_b=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>e;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let r=e.next,n=e.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}e.next=void 0,e.previous=void 0,this._state++}touch(e,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==Pt.First&&r!==Pt.Last)){if(r===Pt.First){if(e===this._head)return;let n=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(r===Pt.Last){if(e===this._tail)return;let n=e.next,i=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((r,n)=>{e.push([n,r])}),e}fromJSON(e){this.clear();for(let[r,n]of e)this.set(r,n)}};Qn.LinkedMap=Id;var Wg=class extends Id{constructor(e,r=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,r),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,r=Pt.AsNew){return super.get(e,r)}peek(e){return super.get(e,Pt.None)}set(e,r){return super.set(e,r,Pt.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Qn.LRUCache=Wg});var Cb=L(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.Disposable=void 0;var bb;(function(t){function e(r){return{dispose:r}}t.create=e})(bb||(Od.Disposable=bb={}))});var kb=L(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.SharedArrayReceiverStrategy=Xs.SharedArraySenderStrategy=void 0;var ZF=kc(),su;(function(t){t.Continue=0,t.Cancelled=1})(su||(su={}));var Hg=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let r=new SharedArrayBuffer(4),n=new Int32Array(r,0,1);n[0]=su.Continue,this.buffers.set(e.id,r),e.$cancellationData=r}async sendCancellation(e,r){let n=this.buffers.get(r);if(n===void 0)return;let i=new Int32Array(n,0,1);Atomics.store(i,0,su.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};Xs.SharedArraySenderStrategy=Hg;var Gg=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===su.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},zg=class{constructor(e){this.token=new Gg(e)}cancel(){}dispose(){}},Kg=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new ZF.CancellationTokenSource:new zg(r)}};Xs.SharedArrayReceiverStrategy=Kg});var Xg=L(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.Semaphore=void 0;var e1=Xn(),Vg=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((r,n)=>{this._waiting.push({thunk:e,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,e1.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let r=e.thunk();r instanceof Promise?r.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(r),this.runNext())}catch(r){this._active--,e.reject(r),this.runNext()}}};Ld.Semaphore=Vg});var Eb=L(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.ReadableStreamMessageReader=Zn.AbstractMessageReader=Zn.MessageReader=void 0;var Jg=Xn(),Ys=Us(),Yg=$i(),t1=Xg(),Sb;(function(t){function e(r){let n=r;return n&&Ys.func(n.listen)&&Ys.func(n.dispose)&&Ys.func(n.onError)&&Ys.func(n.onClose)&&Ys.func(n.onPartialMessage)}t.is=e})(Sb||(Zn.MessageReader=Sb={}));var Md=class{constructor(){this.errorEmitter=new Yg.Emitter,this.closeEmitter=new Yg.Emitter,this.partialMessageEmitter=new Yg.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${Ys.string(e.message)?e.message:"unknown"}`)}};Zn.AbstractMessageReader=Md;var Qg;(function(t){function e(r){let n,i,o,s=new Map,a,c=new Map;if(r===void 0||typeof r=="string")n=r??"utf-8";else{if(n=r.charset??"utf-8",r.contentDecoder!==void 0&&(o=r.contentDecoder,s.set(o.name,o)),r.contentDecoders!==void 0)for(let u of r.contentDecoders)s.set(u.name,u);if(r.contentTypeDecoder!==void 0&&(a=r.contentTypeDecoder,c.set(a.name,a)),r.contentTypeDecoders!==void 0)for(let u of r.contentTypeDecoders)c.set(u.name,u)}return a===void 0&&(a=(0,Jg.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:o,contentDecoders:s,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(Qg||(Qg={}));var Zg=class extends Md{constructor(e,r){super(),this.readable=e,this.options=Qg.fromOptions(r),this.buffer=(0,Jg.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new t1.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let i=n.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property.
6
- ${JSON.stringify(Object.fromEntries(n))}`));return}let o=parseInt(i);if(isNaN(o)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=o}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(r):r,i=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(i)}).catch(n=>{this.fireError(n)})}}catch(r){this.fireError(r)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,Jg.default)().timer.setTimeout((e,r)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};Zn.ReadableStreamMessageReader=Zg});var Db=L(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.WriteableStreamMessageWriter=ei.AbstractMessageWriter=ei.MessageWriter=void 0;var Ab=Xn(),au=Us(),r1=Xg(),wb=$i(),n1="Content-Length: ",Nb=`\r
7
- `,Pb;(function(t){function e(r){let n=r;return n&&au.func(n.dispose)&&au.func(n.onClose)&&au.func(n.onError)&&au.func(n.write)}t.is=e})(Pb||(ei.MessageWriter=Pb={}));var Fd=class{constructor(){this.errorEmitter=new wb.Emitter,this.closeEmitter=new wb.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,r,n){this.errorEmitter.fire([this.asError(e),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${au.string(e.message)?e.message:"unknown"}`)}};ei.AbstractMessageWriter=Fd;var ey;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,Ab.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,Ab.default)().applicationJson.encoder}}t.fromOptions=e})(ey||(ey={}));var ty=class extends Fd{constructor(e,r){super(),this.writable=e,this.options=ey.fromOptions(r),this.errorCount=0,this.writeSemaphore=new r1.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let i=[];return i.push(n1,n.byteLength.toString(),Nb),i.push(Nb),this.doWrite(e,i,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){this.writable.end()}};ei.WriteableStreamMessageWriter=ty});var Ib=L($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.AbstractMessageBuffer=void 0;var i1=13,o1=10,s1=`\r
8
- `,ry=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let r=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let r=0,n=0,i=0,o=0;e:for(;n<this._chunks.length;){let u=this._chunks[n];for(i=0;i<u.length;){switch(u[i]){case i1:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case o1:switch(r){case 1:r=2;break;case 3:r=4,i++;break e;default:r=0}break;default:r=0}i++}o+=u.byteLength,n++}if(r!==4)return;let s=this._read(o+i),a=new Map,c=this.toString(s,"ascii").split(s1);if(c.length<2)return a;for(let u=0;u<c.length-2;u++){let l=c[u],d=l.indexOf(":");if(d===-1)throw new Error(`Message header must separate key and value using ':'
9
- ${l}`);let f=l.substr(0,d),p=l.substr(d+1).trim();a.set(e?f.toLowerCase():f,p)}return a}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let o=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(o)}if(this._chunks[0].byteLength>e){let o=this._chunks[0],s=this.asNative(o,e);return this._chunks[0]=o.slice(e),this._totalLength-=e,s}let r=this.allocNative(e),n=0,i=0;for(;e>0;){let o=this._chunks[i];if(o.byteLength>e){let s=o.slice(0,e);r.set(s,n),n+=e,this._chunks[i]=o.slice(e),this._totalLength-=e,e-=e}else r.set(o,n),n+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,e-=o.byteLength}return r}};$d.AbstractMessageBuffer=ry});var $b=L(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.createMessageConnection=Y.ConnectionOptions=Y.MessageStrategy=Y.CancellationStrategy=Y.CancellationSenderStrategy=Y.CancellationReceiverStrategy=Y.RequestCancellationReceiverStrategy=Y.IdCancellationReceiverStrategy=Y.ConnectionStrategy=Y.ConnectionError=Y.ConnectionErrors=Y.LogTraceNotification=Y.SetTraceNotification=Y.TraceFormat=Y.TraceValues=Y.Trace=Y.NullLogger=Y.ProgressType=Y.ProgressToken=void 0;var Ob=Xn(),He=Us(),z=jg(),Lb=Bg(),cu=$i(),ny=kc(),du;(function(t){t.type=new z.NotificationType("$/cancelRequest")})(du||(du={}));var iy;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(iy||(Y.ProgressToken=iy={}));var uu;(function(t){t.type=new z.NotificationType("$/progress")})(uu||(uu={}));var oy=class{constructor(){}};Y.ProgressType=oy;var sy;(function(t){function e(r){return He.func(r)}t.is=e})(sy||(sy={}));Y.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var de;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(de||(Y.Trace=de={}));var Mb;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(Mb||(Y.TraceValues=Mb={}));(function(t){function e(n){if(!He.string(n))return t.Off;switch(n=n.toLowerCase(),n){case"off":return t.Off;case"messages":return t.Messages;case"compact":return t.Compact;case"verbose":return t.Verbose;default:return t.Off}}t.fromString=e;function r(n){switch(n){case t.Off:return"off";case t.Messages:return"messages";case t.Compact:return"compact";case t.Verbose:return"verbose";default:return"off"}}t.toString=r})(de||(Y.Trace=de={}));var dr;(function(t){t.Text="text",t.JSON="json"})(dr||(Y.TraceFormat=dr={}));(function(t){function e(r){return He.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(dr||(Y.TraceFormat=dr={}));var ay;(function(t){t.type=new z.NotificationType("$/setTrace")})(ay||(Y.SetTraceNotification=ay={}));var qd;(function(t){t.type=new z.NotificationType("$/logTrace")})(qd||(Y.LogTraceNotification=qd={}));var lu;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(lu||(Y.ConnectionErrors=lu={}));var Js=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};Y.ConnectionError=Js;var cy;(function(t){function e(r){let n=r;return n&&He.func(n.cancelUndispatched)}t.is=e})(cy||(Y.ConnectionStrategy=cy={}));var Ud;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&He.func(n.createCancellationTokenSource)&&(n.dispose===void 0||He.func(n.dispose))}t.is=e})(Ud||(Y.IdCancellationReceiverStrategy=Ud={}));var uy;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&He.func(n.createCancellationTokenSource)&&(n.dispose===void 0||He.func(n.dispose))}t.is=e})(uy||(Y.RequestCancellationReceiverStrategy=uy={}));var jd;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new ny.CancellationTokenSource}});function e(r){return Ud.is(r)||uy.is(r)}t.is=e})(jd||(Y.CancellationReceiverStrategy=jd={}));var Wd;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(du.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&He.func(n.sendCancellation)&&He.func(n.cleanup)}t.is=e})(Wd||(Y.CancellationSenderStrategy=Wd={}));var Bd;(function(t){t.Message=Object.freeze({receiver:jd.Message,sender:Wd.Message});function e(r){let n=r;return n&&jd.is(n.receiver)&&Wd.is(n.sender)}t.is=e})(Bd||(Y.CancellationStrategy=Bd={}));var Hd;(function(t){function e(r){let n=r;return n&&He.func(n.handleMessage)}t.is=e})(Hd||(Y.MessageStrategy=Hd={}));var Fb;(function(t){function e(r){let n=r;return n&&(Bd.is(n.cancellationStrategy)||cy.is(n.connectionStrategy)||Hd.is(n.messageStrategy))}t.is=e})(Fb||(Y.ConnectionOptions=Fb={}));var Dr;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(Dr||(Dr={}));function a1(t,e,r,n){let i=r!==void 0?r:Y.NullLogger,o=0,s=0,a=0,c="2.0",u,l=new Map,d,f=new Map,p=new Map,v,T=new Lb.LinkedMap,k=new Map,R=new Set,g=new Map,h=de.Off,_=dr.Text,w,J=Dr.New,Bt=new cu.Emitter,Ye=new cu.Emitter,ir=new cu.Emitter,Ht=new cu.Emitter,I=new cu.Emitter,S=n&&n.cancellationStrategy?n.cancellationStrategy:Bd.Message;function U(y){if(y===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+y.toString()}function M(y){return y===null?"res-unknown-"+(++a).toString():"res-"+y.toString()}function ne(){return"not-"+(++s).toString()}function K(y,E){z.Message.isRequest(E)?y.set(U(E.id),E):z.Message.isResponse(E)?y.set(M(E.id),E):y.set(ne(),E)}function H(y){}function ct(){return J===Dr.Listening}function F(){return J===Dr.Closed}function b(){return J===Dr.Disposed}function Te(){(J===Dr.New||J===Dr.Listening)&&(J=Dr.Closed,Ye.fire(void 0))}function Eu(y){Bt.fire([y,void 0,void 0])}function hh(y){Bt.fire(y)}t.onClose(Te),t.onError(Eu),e.onClose(Te),e.onError(hh);function pa(){v||T.size===0||(v=(0,Ob.default)().timer.setImmediate(()=>{v=void 0,Au()}))}function Gt(y){z.Message.isRequest(y)?zt(y):z.Message.isNotification(y)?Ot(y):z.Message.isResponse(y)?kn(y):kr(y)}function Au(){if(T.size===0)return;let y=T.shift();try{let E=n?.messageStrategy;Hd.is(E)?E.handleMessage(y,Gt):Gt(y)}finally{pa()}}let ht=y=>{try{if(z.Message.isNotification(y)&&y.method===du.type.method){let E=y.params.id,P=U(E),j=T.get(P);if(z.Message.isRequest(j)){let ge=n?.connectionStrategy,Ge=ge&&ge.cancelUndispatched?ge.cancelUndispatched(j,H):void 0;if(Ge&&(Ge.error!==void 0||Ge.result!==void 0)){T.delete(P),g.delete(E),Ge.id=j.id,Sn(Ge,y.method,Date.now()),e.write(Ge).catch(()=>i.error("Sending response for canceled message failed."));return}}let Ae=g.get(E);if(Ae!==void 0){Ae.cancel(),ph(y);return}else R.add(E)}K(T,y)}finally{pa()}};function zt(y){if(b())return;function E(ae,qe,pe){let ut={jsonrpc:c,id:y.id};ae instanceof z.ResponseError?ut.error=ae.toJson():ut.result=ae===void 0?null:ae,Sn(ut,qe,pe),e.write(ut).catch(()=>i.error("Sending response failed."))}function P(ae,qe,pe){let ut={jsonrpc:c,id:y.id,error:ae.toJson()};Sn(ut,qe,pe),e.write(ut).catch(()=>i.error("Sending response failed."))}function j(ae,qe,pe){ae===void 0&&(ae=null);let ut={jsonrpc:c,id:y.id,result:ae};Sn(ut,qe,pe),e.write(ut).catch(()=>i.error("Sending response failed."))}wu(y);let Ae=l.get(y.method),ge,Ge;Ae&&(ge=Ae.type,Ge=Ae.handler);let Je=Date.now();if(Ge||u){let ae=y.id??String(Date.now()),qe=Ud.is(S.receiver)?S.receiver.createCancellationTokenSource(ae):S.receiver.createCancellationTokenSource(y);y.id!==null&&R.has(y.id)&&qe.cancel(),y.id!==null&&g.set(ae,qe);try{let pe;if(Ge)if(y.params===void 0){if(ge!==void 0&&ge.numberOfParams!==0){P(new z.ResponseError(z.ErrorCodes.InvalidParams,`Request ${y.method} defines ${ge.numberOfParams} params but received none.`),y.method,Je);return}pe=Ge(qe.token)}else if(Array.isArray(y.params)){if(ge!==void 0&&ge.parameterStructures===z.ParameterStructures.byName){P(new z.ResponseError(z.ErrorCodes.InvalidParams,`Request ${y.method} defines parameters by name but received parameters by position`),y.method,Je);return}pe=Ge(...y.params,qe.token)}else{if(ge!==void 0&&ge.parameterStructures===z.ParameterStructures.byPosition){P(new z.ResponseError(z.ErrorCodes.InvalidParams,`Request ${y.method} defines parameters by position but received parameters by name`),y.method,Je);return}pe=Ge(y.params,qe.token)}else u&&(pe=u(y.method,y.params,qe.token));let ut=pe;pe?ut.then?ut.then(Lt=>{g.delete(ae),E(Lt,y.method,Je)},Lt=>{g.delete(ae),Lt instanceof z.ResponseError?P(Lt,y.method,Je):Lt&&He.string(Lt.message)?P(new z.ResponseError(z.ErrorCodes.InternalError,`Request ${y.method} failed with message: ${Lt.message}`),y.method,Je):P(new z.ResponseError(z.ErrorCodes.InternalError,`Request ${y.method} failed unexpectedly without providing any details.`),y.method,Je)}):(g.delete(ae),E(pe,y.method,Je)):(g.delete(ae),j(pe,y.method,Je))}catch(pe){g.delete(ae),pe instanceof z.ResponseError?E(pe,y.method,Je):pe&&He.string(pe.message)?P(new z.ResponseError(z.ErrorCodes.InternalError,`Request ${y.method} failed with message: ${pe.message}`),y.method,Je):P(new z.ResponseError(z.ErrorCodes.InternalError,`Request ${y.method} failed unexpectedly without providing any details.`),y.method,Je)}}else P(new z.ResponseError(z.ErrorCodes.MethodNotFound,`Unhandled method ${y.method}`),y.method,Je)}function kn(y){if(!b())if(y.id===null)y.error?i.error(`Received response message without id: Error is:
10
- ${JSON.stringify(y.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let E=y.id,P=k.get(E);if(nA(y,P),P!==void 0){k.delete(E);try{if(y.error){let j=y.error;P.reject(new z.ResponseError(j.code,j.message,j.data))}else if(y.result!==void 0)P.resolve(y.result);else throw new Error("Should never happen.")}catch(j){j.message?i.error(`Response handler '${P.method}' failed with message: ${j.message}`):i.error(`Response handler '${P.method}' failed unexpectedly.`)}}}}function Ot(y){if(b())return;let E,P;if(y.method===du.type.method){let j=y.params.id;R.delete(j),ph(y);return}else{let j=f.get(y.method);j&&(P=j.handler,E=j.type)}if(P||d)try{if(ph(y),P)if(y.params===void 0)E!==void 0&&E.numberOfParams!==0&&E.parameterStructures!==z.ParameterStructures.byName&&i.error(`Notification ${y.method} defines ${E.numberOfParams} params but received none.`),P();else if(Array.isArray(y.params)){let j=y.params;y.method===uu.type.method&&j.length===2&&iy.is(j[0])?P({token:j[0],value:j[1]}):(E!==void 0&&(E.parameterStructures===z.ParameterStructures.byName&&i.error(`Notification ${y.method} defines parameters by name but received parameters by position`),E.numberOfParams!==y.params.length&&i.error(`Notification ${y.method} defines ${E.numberOfParams} params but received ${j.length} arguments`)),P(...j))}else E!==void 0&&E.parameterStructures===z.ParameterStructures.byPosition&&i.error(`Notification ${y.method} defines parameters by position but received parameters by name`),P(y.params);else d&&d(y.method,y.params)}catch(j){j.message?i.error(`Notification handler '${y.method}' failed with message: ${j.message}`):i.error(`Notification handler '${y.method}' failed unexpectedly.`)}else ir.fire(y)}function kr(y){if(!y){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
11
- ${JSON.stringify(y,null,4)}`);let E=y;if(He.string(E.id)||He.number(E.id)){let P=E.id,j=k.get(P);j&&j.reject(new Error("The received response has neither a result nor an error property."))}}function Tt(y){if(y!=null)switch(h){case de.Verbose:return JSON.stringify(y,null,4);case de.Compact:return JSON.stringify(y);default:return}}function Sr(y){if(!(h===de.Off||!w))if(_===dr.Text){let E;(h===de.Verbose||h===de.Compact)&&y.params&&(E=`Params: ${Tt(y.params)}
5
+ `&&i++}n&&r.length>0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return ce.create(0,e);for(;n<i;){let s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}let o=n-1;return ce.create(o,e-r[o])}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}};(function(t){let e=Object.prototype.toString;function r(p){return typeof p<"u"}t.defined=r;function n(p){return typeof p>"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function o(p){return e.call(p)==="[object String]"}t.string=o;function s(p){return e.call(p)==="[object Number]"}t.number=s;function a(p,v,T){return e.call(p)==="[object Number]"&&v<=p&&p<=T}t.numberRange=a;function c(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=c;function u(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=u;function l(p){return e.call(p)==="[object Function]"}t.func=l;function d(p){return p!==null&&typeof p=="object"}t.objectLiteral=d;function f(p,v){return Array.isArray(p)&&p.every(v)}t.typedArray=f})(x||(x={}))});var Xn=L(ng=>{"use strict";Object.defineProperty(ng,"__esModule",{value:!0});var tg;function rg(){if(tg===void 0)throw new Error("No runtime abstraction layer installed");return tg}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");tg=r}t.install=e})(rg||(rg={}));ng.default=rg});var js=L(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.stringArray=Nt.array=Nt.func=Nt.error=Nt.number=Nt.string=Nt.boolean=void 0;function wF(t){return t===!0||t===!1}Nt.boolean=wF;function tb(t){return typeof t=="string"||t instanceof String}Nt.string=tb;function NF(t){return typeof t=="number"||t instanceof Number}Nt.number=NF;function PF(t){return t instanceof Error}Nt.error=PF;function DF(t){return typeof t=="function"}Nt.func=DF;function rb(t){return Array.isArray(t)}Nt.array=rb;function IF(t){return rb(t)&&t.every(e=>tb(e))}Nt.stringArray=IF});var qi=L(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.Emitter=Ws.Event=void 0;var OF=Xn(),nb;(function(t){let e={dispose(){}};t.None=function(){return e}})(nb||(Ws.Event=nb={}));var ig=class{add(e,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,r)})}remove(e,r=null){if(!this._callbacks)return;let n=!1;for(let i=0,o=this._callbacks.length;i<o;i++)if(this._callbacks[i]===e)if(this._contexts[i]===r){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else n=!0;if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];let r=[],n=this._callbacks.slice(0),i=this._contexts.slice(0);for(let o=0,s=n.length;o<s;o++)try{r.push(n[o].apply(i[o],e))}catch(a){(0,OF.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},gd=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,r,n)=>{this._callbacks||(this._callbacks=new ig),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,r);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,r),i.dispose=t._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Ws.Emitter=gd;gd._noop=function(){}});var Sc=L(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.CancellationTokenSource=Bs.CancellationToken=void 0;var LF=Xn(),MF=js(),og=qi(),yd;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:og.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:og.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||MF.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(yd||(Bs.CancellationToken=yd={}));var FF=Object.freeze(function(t,e){let r=(0,LF.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),vd=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?FF:(this._emitter||(this._emitter=new og.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},sg=class{get token(){return this._token||(this._token=new vd),this._token}cancel(){this._token?this._token.cancel():this._token=yd.Cancelled}dispose(){this._token?this._token instanceof vd&&this._token.dispose():this._token=yd.None}};Bs.CancellationTokenSource=sg});var Bg=L(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.Message=W.NotificationType9=W.NotificationType8=W.NotificationType7=W.NotificationType6=W.NotificationType5=W.NotificationType4=W.NotificationType3=W.NotificationType2=W.NotificationType1=W.NotificationType0=W.NotificationType=W.RequestType9=W.RequestType8=W.RequestType7=W.RequestType6=W.RequestType5=W.RequestType4=W.RequestType3=W.RequestType2=W.RequestType1=W.RequestType=W.RequestType0=W.AbstractMessageSignature=W.ParameterStructures=W.ResponseError=W.ErrorCodes=void 0;var Ki=js(),xg;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(xg||(W.ErrorCodes=xg={}));var Tg=class t extends Error{constructor(e,r,n){super(r),this.code=Ki.number(e)?e:xg.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,t.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};W.ResponseError=Tg;var er=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};W.ParameterStructures=er;er.auto=new er("auto");er.byPosition=new er("byPosition");er.byName=new er("byName");var De=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return er.auto}};W.AbstractMessageSignature=De;var Rg=class extends De{constructor(e){super(e,0)}};W.RequestType0=Rg;var _g=class extends De{constructor(e,r=er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};W.RequestType=_g;var bg=class extends De{constructor(e,r=er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};W.RequestType1=bg;var Cg=class extends De{constructor(e){super(e,2)}};W.RequestType2=Cg;var Sg=class extends De{constructor(e){super(e,3)}};W.RequestType3=Sg;var kg=class extends De{constructor(e){super(e,4)}};W.RequestType4=kg;var Eg=class extends De{constructor(e){super(e,5)}};W.RequestType5=Eg;var Ag=class extends De{constructor(e){super(e,6)}};W.RequestType6=Ag;var wg=class extends De{constructor(e){super(e,7)}};W.RequestType7=wg;var Ng=class extends De{constructor(e){super(e,8)}};W.RequestType8=Ng;var Pg=class extends De{constructor(e){super(e,9)}};W.RequestType9=Pg;var Dg=class extends De{constructor(e,r=er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};W.NotificationType=Dg;var Ig=class extends De{constructor(e){super(e,0)}};W.NotificationType0=Ig;var Og=class extends De{constructor(e,r=er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};W.NotificationType1=Og;var Lg=class extends De{constructor(e){super(e,2)}};W.NotificationType2=Lg;var Mg=class extends De{constructor(e){super(e,3)}};W.NotificationType3=Mg;var Fg=class extends De{constructor(e){super(e,4)}};W.NotificationType4=Fg;var $g=class extends De{constructor(e){super(e,5)}};W.NotificationType5=$g;var qg=class extends De{constructor(e){super(e,6)}};W.NotificationType6=qg;var Ug=class extends De{constructor(e){super(e,7)}};W.NotificationType7=Ug;var jg=class extends De{constructor(e){super(e,8)}};W.NotificationType8=jg;var Wg=class extends De{constructor(e){super(e,9)}};W.NotificationType9=Wg;var bb;(function(t){function e(i){let o=i;return o&&Ki.string(o.method)&&(Ki.string(o.id)||Ki.number(o.id))}t.isRequest=e;function r(i){let o=i;return o&&Ki.string(o.method)&&i.id===void 0}t.isNotification=r;function n(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(Ki.string(o.id)||Ki.number(o.id)||o.id===null)}t.isResponse=n})(bb||(W.Message=bb={}))});var Gg=L(Qn=>{"use strict";var Cb;Object.defineProperty(Qn,"__esModule",{value:!0});Qn.LRUCache=Qn.LinkedMap=Qn.Touch=void 0;var Pt;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(Pt||(Qn.Touch=Pt={}));var Id=class{constructor(){this[Cb]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,r=Pt.None){let n=this._map.get(e);if(n)return r!==Pt.None&&this.touch(n,r),n.value}set(e,r,n=Pt.None){let i=this._map.get(e);if(i)i.value=r,n!==Pt.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case Pt.None:this.addItemLast(i);break;case Pt.First:this.addItemFirst(i);break;case Pt.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let r=this._map.get(e);if(r)return this._map.delete(e),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,r){let n=this._state,i=this._head;for(;i;){if(r?e.bind(r)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:r.key,done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:r.value,done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:[r.key,r.value],done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}[(Cb=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>e;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let r=e.next,n=e.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}e.next=void 0,e.previous=void 0,this._state++}touch(e,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==Pt.First&&r!==Pt.Last)){if(r===Pt.First){if(e===this._head)return;let n=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(r===Pt.Last){if(e===this._tail)return;let n=e.next,i=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((r,n)=>{e.push([n,r])}),e}fromJSON(e){this.clear();for(let[r,n]of e)this.set(r,n)}};Qn.LinkedMap=Id;var Hg=class extends Id{constructor(e,r=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,r),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,r=Pt.AsNew){return super.get(e,r)}peek(e){return super.get(e,Pt.None)}set(e,r){return super.set(e,r,Pt.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Qn.LRUCache=Hg});var kb=L(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.Disposable=void 0;var Sb;(function(t){function e(r){return{dispose:r}}t.create=e})(Sb||(Od.Disposable=Sb={}))});var Eb=L(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.SharedArrayReceiverStrategy=Ys.SharedArraySenderStrategy=void 0;var t1=Sc(),su;(function(t){t.Continue=0,t.Cancelled=1})(su||(su={}));var zg=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let r=new SharedArrayBuffer(4),n=new Int32Array(r,0,1);n[0]=su.Continue,this.buffers.set(e.id,r),e.$cancellationData=r}async sendCancellation(e,r){let n=this.buffers.get(r);if(n===void 0)return;let i=new Int32Array(n,0,1);Atomics.store(i,0,su.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};Ys.SharedArraySenderStrategy=zg;var Kg=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===su.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Vg=class{constructor(e){this.token=new Kg(e)}cancel(){}dispose(){}},Xg=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new t1.CancellationTokenSource:new Vg(r)}};Ys.SharedArrayReceiverStrategy=Xg});var Jg=L(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.Semaphore=void 0;var r1=Xn(),Yg=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((r,n)=>{this._waiting.push({thunk:e,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,r1.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let r=e.thunk();r instanceof Promise?r.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(r),this.runNext())}catch(r){this._active--,e.reject(r),this.runNext()}}};Ld.Semaphore=Yg});var wb=L(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.ReadableStreamMessageReader=Zn.AbstractMessageReader=Zn.MessageReader=void 0;var Zg=Xn(),Js=js(),Qg=qi(),n1=Jg(),Ab;(function(t){function e(r){let n=r;return n&&Js.func(n.listen)&&Js.func(n.dispose)&&Js.func(n.onError)&&Js.func(n.onClose)&&Js.func(n.onPartialMessage)}t.is=e})(Ab||(Zn.MessageReader=Ab={}));var Md=class{constructor(){this.errorEmitter=new Qg.Emitter,this.closeEmitter=new Qg.Emitter,this.partialMessageEmitter=new Qg.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${Js.string(e.message)?e.message:"unknown"}`)}};Zn.AbstractMessageReader=Md;var ey;(function(t){function e(r){let n,i,o,s=new Map,a,c=new Map;if(r===void 0||typeof r=="string")n=r??"utf-8";else{if(n=r.charset??"utf-8",r.contentDecoder!==void 0&&(o=r.contentDecoder,s.set(o.name,o)),r.contentDecoders!==void 0)for(let u of r.contentDecoders)s.set(u.name,u);if(r.contentTypeDecoder!==void 0&&(a=r.contentTypeDecoder,c.set(a.name,a)),r.contentTypeDecoders!==void 0)for(let u of r.contentTypeDecoders)c.set(u.name,u)}return a===void 0&&(a=(0,Zg.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:o,contentDecoders:s,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(ey||(ey={}));var ty=class extends Md{constructor(e,r){super(),this.readable=e,this.options=ey.fromOptions(r),this.buffer=(0,Zg.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new n1.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let i=n.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property.
6
+ ${JSON.stringify(Object.fromEntries(n))}`));return}let o=parseInt(i);if(isNaN(o)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=o}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(r):r,i=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(i)}).catch(n=>{this.fireError(n)})}}catch(r){this.fireError(r)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,Zg.default)().timer.setTimeout((e,r)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};Zn.ReadableStreamMessageReader=ty});var Ob=L(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.WriteableStreamMessageWriter=ei.AbstractMessageWriter=ei.MessageWriter=void 0;var Nb=Xn(),au=js(),i1=Jg(),Pb=qi(),o1="Content-Length: ",Db=`\r
7
+ `,Ib;(function(t){function e(r){let n=r;return n&&au.func(n.dispose)&&au.func(n.onClose)&&au.func(n.onError)&&au.func(n.write)}t.is=e})(Ib||(ei.MessageWriter=Ib={}));var Fd=class{constructor(){this.errorEmitter=new Pb.Emitter,this.closeEmitter=new Pb.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,r,n){this.errorEmitter.fire([this.asError(e),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${au.string(e.message)?e.message:"unknown"}`)}};ei.AbstractMessageWriter=Fd;var ry;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,Nb.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,Nb.default)().applicationJson.encoder}}t.fromOptions=e})(ry||(ry={}));var ny=class extends Fd{constructor(e,r){super(),this.writable=e,this.options=ry.fromOptions(r),this.errorCount=0,this.writeSemaphore=new i1.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let i=[];return i.push(o1,n.byteLength.toString(),Db),i.push(Db),this.doWrite(e,i,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){this.writable.end()}};ei.WriteableStreamMessageWriter=ny});var Lb=L($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.AbstractMessageBuffer=void 0;var s1=13,a1=10,c1=`\r
8
+ `,iy=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let r=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let r=0,n=0,i=0,o=0;e:for(;n<this._chunks.length;){let u=this._chunks[n];for(i=0;i<u.length;){switch(u[i]){case s1:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case a1:switch(r){case 1:r=2;break;case 3:r=4,i++;break e;default:r=0}break;default:r=0}i++}o+=u.byteLength,n++}if(r!==4)return;let s=this._read(o+i),a=new Map,c=this.toString(s,"ascii").split(c1);if(c.length<2)return a;for(let u=0;u<c.length-2;u++){let l=c[u],d=l.indexOf(":");if(d===-1)throw new Error(`Message header must separate key and value using ':'
9
+ ${l}`);let f=l.substr(0,d),p=l.substr(d+1).trim();a.set(e?f.toLowerCase():f,p)}return a}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let o=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(o)}if(this._chunks[0].byteLength>e){let o=this._chunks[0],s=this.asNative(o,e);return this._chunks[0]=o.slice(e),this._totalLength-=e,s}let r=this.allocNative(e),n=0,i=0;for(;e>0;){let o=this._chunks[i];if(o.byteLength>e){let s=o.slice(0,e);r.set(s,n),n+=e,this._chunks[i]=o.slice(e),this._totalLength-=e,e-=e}else r.set(o,n),n+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,e-=o.byteLength}return r}};$d.AbstractMessageBuffer=iy});var Ub=L(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.createMessageConnection=Y.ConnectionOptions=Y.MessageStrategy=Y.CancellationStrategy=Y.CancellationSenderStrategy=Y.CancellationReceiverStrategy=Y.RequestCancellationReceiverStrategy=Y.IdCancellationReceiverStrategy=Y.ConnectionStrategy=Y.ConnectionError=Y.ConnectionErrors=Y.LogTraceNotification=Y.SetTraceNotification=Y.TraceFormat=Y.TraceValues=Y.Trace=Y.NullLogger=Y.ProgressType=Y.ProgressToken=void 0;var Mb=Xn(),Ge=js(),z=Bg(),Fb=Gg(),cu=qi(),oy=Sc(),du;(function(t){t.type=new z.NotificationType("$/cancelRequest")})(du||(du={}));var sy;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(sy||(Y.ProgressToken=sy={}));var uu;(function(t){t.type=new z.NotificationType("$/progress")})(uu||(uu={}));var ay=class{constructor(){}};Y.ProgressType=ay;var cy;(function(t){function e(r){return Ge.func(r)}t.is=e})(cy||(cy={}));Y.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var de;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(de||(Y.Trace=de={}));var $b;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})($b||(Y.TraceValues=$b={}));(function(t){function e(n){if(!Ge.string(n))return t.Off;switch(n=n.toLowerCase(),n){case"off":return t.Off;case"messages":return t.Messages;case"compact":return t.Compact;case"verbose":return t.Verbose;default:return t.Off}}t.fromString=e;function r(n){switch(n){case t.Off:return"off";case t.Messages:return"messages";case t.Compact:return"compact";case t.Verbose:return"verbose";default:return"off"}}t.toString=r})(de||(Y.Trace=de={}));var dr;(function(t){t.Text="text",t.JSON="json"})(dr||(Y.TraceFormat=dr={}));(function(t){function e(r){return Ge.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(dr||(Y.TraceFormat=dr={}));var uy;(function(t){t.type=new z.NotificationType("$/setTrace")})(uy||(Y.SetTraceNotification=uy={}));var qd;(function(t){t.type=new z.NotificationType("$/logTrace")})(qd||(Y.LogTraceNotification=qd={}));var lu;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(lu||(Y.ConnectionErrors=lu={}));var Qs=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};Y.ConnectionError=Qs;var ly;(function(t){function e(r){let n=r;return n&&Ge.func(n.cancelUndispatched)}t.is=e})(ly||(Y.ConnectionStrategy=ly={}));var Ud;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&Ge.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Ge.func(n.dispose))}t.is=e})(Ud||(Y.IdCancellationReceiverStrategy=Ud={}));var dy;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&Ge.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Ge.func(n.dispose))}t.is=e})(dy||(Y.RequestCancellationReceiverStrategy=dy={}));var jd;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new oy.CancellationTokenSource}});function e(r){return Ud.is(r)||dy.is(r)}t.is=e})(jd||(Y.CancellationReceiverStrategy=jd={}));var Wd;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(du.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&Ge.func(n.sendCancellation)&&Ge.func(n.cleanup)}t.is=e})(Wd||(Y.CancellationSenderStrategy=Wd={}));var Bd;(function(t){t.Message=Object.freeze({receiver:jd.Message,sender:Wd.Message});function e(r){let n=r;return n&&jd.is(n.receiver)&&Wd.is(n.sender)}t.is=e})(Bd||(Y.CancellationStrategy=Bd={}));var Hd;(function(t){function e(r){let n=r;return n&&Ge.func(n.handleMessage)}t.is=e})(Hd||(Y.MessageStrategy=Hd={}));var qb;(function(t){function e(r){let n=r;return n&&(Bd.is(n.cancellationStrategy)||ly.is(n.connectionStrategy)||Hd.is(n.messageStrategy))}t.is=e})(qb||(Y.ConnectionOptions=qb={}));var Dr;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(Dr||(Dr={}));function u1(t,e,r,n){let i=r!==void 0?r:Y.NullLogger,o=0,s=0,a=0,c="2.0",u,l=new Map,d,f=new Map,p=new Map,v,T=new Fb.LinkedMap,S=new Map,R=new Set,g=new Map,h=de.Off,_=dr.Text,w,J=Dr.New,Bt=new cu.Emitter,Ye=new cu.Emitter,ir=new cu.Emitter,Ht=new cu.Emitter,I=new cu.Emitter,k=n&&n.cancellationStrategy?n.cancellationStrategy:Bd.Message;function U(y){if(y===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+y.toString()}function M(y){return y===null?"res-unknown-"+(++a).toString():"res-"+y.toString()}function ne(){return"not-"+(++s).toString()}function K(y,E){z.Message.isRequest(E)?y.set(U(E.id),E):z.Message.isResponse(E)?y.set(M(E.id),E):y.set(ne(),E)}function H(y){}function ct(){return J===Dr.Listening}function F(){return J===Dr.Closed}function b(){return J===Dr.Disposed}function Te(){(J===Dr.New||J===Dr.Listening)&&(J=Dr.Closed,Ye.fire(void 0))}function Eu(y){Bt.fire([y,void 0,void 0])}function mh(y){Bt.fire(y)}t.onClose(Te),t.onError(Eu),e.onClose(Te),e.onError(mh);function ma(){v||T.size===0||(v=(0,Mb.default)().timer.setImmediate(()=>{v=void 0,Au()}))}function Gt(y){z.Message.isRequest(y)?zt(y):z.Message.isNotification(y)?Ot(y):z.Message.isResponse(y)?Sn(y):Sr(y)}function Au(){if(T.size===0)return;let y=T.shift();try{let E=n?.messageStrategy;Hd.is(E)?E.handleMessage(y,Gt):Gt(y)}finally{ma()}}let ht=y=>{try{if(z.Message.isNotification(y)&&y.method===du.type.method){let E=y.params.id,P=U(E),j=T.get(P);if(z.Message.isRequest(j)){let ge=n?.connectionStrategy,ze=ge&&ge.cancelUndispatched?ge.cancelUndispatched(j,H):void 0;if(ze&&(ze.error!==void 0||ze.result!==void 0)){T.delete(P),g.delete(E),ze.id=j.id,kn(ze,y.method,Date.now()),e.write(ze).catch(()=>i.error("Sending response for canceled message failed."));return}}let Ae=g.get(E);if(Ae!==void 0){Ae.cancel(),gh(y);return}else R.add(E)}K(T,y)}finally{ma()}};function zt(y){if(b())return;function E(ae,qe,pe){let ut={jsonrpc:c,id:y.id};ae instanceof z.ResponseError?ut.error=ae.toJson():ut.result=ae===void 0?null:ae,kn(ut,qe,pe),e.write(ut).catch(()=>i.error("Sending response failed."))}function P(ae,qe,pe){let ut={jsonrpc:c,id:y.id,error:ae.toJson()};kn(ut,qe,pe),e.write(ut).catch(()=>i.error("Sending response failed."))}function j(ae,qe,pe){ae===void 0&&(ae=null);let ut={jsonrpc:c,id:y.id,result:ae};kn(ut,qe,pe),e.write(ut).catch(()=>i.error("Sending response failed."))}wu(y);let Ae=l.get(y.method),ge,ze;Ae&&(ge=Ae.type,ze=Ae.handler);let Je=Date.now();if(ze||u){let ae=y.id??String(Date.now()),qe=Ud.is(k.receiver)?k.receiver.createCancellationTokenSource(ae):k.receiver.createCancellationTokenSource(y);y.id!==null&&R.has(y.id)&&qe.cancel(),y.id!==null&&g.set(ae,qe);try{let pe;if(ze)if(y.params===void 0){if(ge!==void 0&&ge.numberOfParams!==0){P(new z.ResponseError(z.ErrorCodes.InvalidParams,`Request ${y.method} defines ${ge.numberOfParams} params but received none.`),y.method,Je);return}pe=ze(qe.token)}else if(Array.isArray(y.params)){if(ge!==void 0&&ge.parameterStructures===z.ParameterStructures.byName){P(new z.ResponseError(z.ErrorCodes.InvalidParams,`Request ${y.method} defines parameters by name but received parameters by position`),y.method,Je);return}pe=ze(...y.params,qe.token)}else{if(ge!==void 0&&ge.parameterStructures===z.ParameterStructures.byPosition){P(new z.ResponseError(z.ErrorCodes.InvalidParams,`Request ${y.method} defines parameters by position but received parameters by name`),y.method,Je);return}pe=ze(y.params,qe.token)}else u&&(pe=u(y.method,y.params,qe.token));let ut=pe;pe?ut.then?ut.then(Lt=>{g.delete(ae),E(Lt,y.method,Je)},Lt=>{g.delete(ae),Lt instanceof z.ResponseError?P(Lt,y.method,Je):Lt&&Ge.string(Lt.message)?P(new z.ResponseError(z.ErrorCodes.InternalError,`Request ${y.method} failed with message: ${Lt.message}`),y.method,Je):P(new z.ResponseError(z.ErrorCodes.InternalError,`Request ${y.method} failed unexpectedly without providing any details.`),y.method,Je)}):(g.delete(ae),E(pe,y.method,Je)):(g.delete(ae),j(pe,y.method,Je))}catch(pe){g.delete(ae),pe instanceof z.ResponseError?E(pe,y.method,Je):pe&&Ge.string(pe.message)?P(new z.ResponseError(z.ErrorCodes.InternalError,`Request ${y.method} failed with message: ${pe.message}`),y.method,Je):P(new z.ResponseError(z.ErrorCodes.InternalError,`Request ${y.method} failed unexpectedly without providing any details.`),y.method,Je)}}else P(new z.ResponseError(z.ErrorCodes.MethodNotFound,`Unhandled method ${y.method}`),y.method,Je)}function Sn(y){if(!b())if(y.id===null)y.error?i.error(`Received response message without id: Error is:
10
+ ${JSON.stringify(y.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let E=y.id,P=S.get(E);if(oA(y,P),P!==void 0){S.delete(E);try{if(y.error){let j=y.error;P.reject(new z.ResponseError(j.code,j.message,j.data))}else if(y.result!==void 0)P.resolve(y.result);else throw new Error("Should never happen.")}catch(j){j.message?i.error(`Response handler '${P.method}' failed with message: ${j.message}`):i.error(`Response handler '${P.method}' failed unexpectedly.`)}}}}function Ot(y){if(b())return;let E,P;if(y.method===du.type.method){let j=y.params.id;R.delete(j),gh(y);return}else{let j=f.get(y.method);j&&(P=j.handler,E=j.type)}if(P||d)try{if(gh(y),P)if(y.params===void 0)E!==void 0&&E.numberOfParams!==0&&E.parameterStructures!==z.ParameterStructures.byName&&i.error(`Notification ${y.method} defines ${E.numberOfParams} params but received none.`),P();else if(Array.isArray(y.params)){let j=y.params;y.method===uu.type.method&&j.length===2&&sy.is(j[0])?P({token:j[0],value:j[1]}):(E!==void 0&&(E.parameterStructures===z.ParameterStructures.byName&&i.error(`Notification ${y.method} defines parameters by name but received parameters by position`),E.numberOfParams!==y.params.length&&i.error(`Notification ${y.method} defines ${E.numberOfParams} params but received ${j.length} arguments`)),P(...j))}else E!==void 0&&E.parameterStructures===z.ParameterStructures.byPosition&&i.error(`Notification ${y.method} defines parameters by position but received parameters by name`),P(y.params);else d&&d(y.method,y.params)}catch(j){j.message?i.error(`Notification handler '${y.method}' failed with message: ${j.message}`):i.error(`Notification handler '${y.method}' failed unexpectedly.`)}else ir.fire(y)}function Sr(y){if(!y){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
11
+ ${JSON.stringify(y,null,4)}`);let E=y;if(Ge.string(E.id)||Ge.number(E.id)){let P=E.id,j=S.get(P);j&&j.reject(new Error("The received response has neither a result nor an error property."))}}function Tt(y){if(y!=null)switch(h){case de.Verbose:return JSON.stringify(y,null,4);case de.Compact:return JSON.stringify(y);default:return}}function kr(y){if(!(h===de.Off||!w))if(_===dr.Text){let E;(h===de.Verbose||h===de.Compact)&&y.params&&(E=`Params: ${Tt(y.params)}
12
12
 
13
- `),w.log(`Sending request '${y.method} - (${y.id})'.`,E)}else Ji("send-request",y)}function cn(y){if(!(h===de.Off||!w))if(_===dr.Text){let E;(h===de.Verbose||h===de.Compact)&&(y.params?E=`Params: ${Tt(y.params)}
13
+ `),w.log(`Sending request '${y.method} - (${y.id})'.`,E)}else Qi("send-request",y)}function cn(y){if(!(h===de.Off||!w))if(_===dr.Text){let E;(h===de.Verbose||h===de.Compact)&&(y.params?E=`Params: ${Tt(y.params)}
14
14
 
15
15
  `:E=`No parameters provided.
16
16
 
17
- `),w.log(`Sending notification '${y.method}'.`,E)}else Ji("send-notification",y)}function Sn(y,E,P){if(!(h===de.Off||!w))if(_===dr.Text){let j;(h===de.Verbose||h===de.Compact)&&(y.error&&y.error.data?j=`Error data: ${Tt(y.error.data)}
17
+ `),w.log(`Sending notification '${y.method}'.`,E)}else Qi("send-notification",y)}function kn(y,E,P){if(!(h===de.Off||!w))if(_===dr.Text){let j;(h===de.Verbose||h===de.Compact)&&(y.error&&y.error.data?j=`Error data: ${Tt(y.error.data)}
18
18
 
19
19
  `:y.result?j=`Result: ${Tt(y.result)}
20
20
 
21
21
  `:y.error===void 0&&(j=`No result returned.
22
22
 
23
- `)),w.log(`Sending response '${E} - (${y.id})'. Processing request took ${Date.now()-P}ms`,j)}else Ji("send-response",y)}function wu(y){if(!(h===de.Off||!w))if(_===dr.Text){let E;(h===de.Verbose||h===de.Compact)&&y.params&&(E=`Params: ${Tt(y.params)}
23
+ `)),w.log(`Sending response '${E} - (${y.id})'. Processing request took ${Date.now()-P}ms`,j)}else Qi("send-response",y)}function wu(y){if(!(h===de.Off||!w))if(_===dr.Text){let E;(h===de.Verbose||h===de.Compact)&&y.params&&(E=`Params: ${Tt(y.params)}
24
24
 
25
- `),w.log(`Received request '${y.method} - (${y.id})'.`,E)}else Ji("receive-request",y)}function ph(y){if(!(h===de.Off||!w||y.method===qd.type.method))if(_===dr.Text){let E;(h===de.Verbose||h===de.Compact)&&(y.params?E=`Params: ${Tt(y.params)}
25
+ `),w.log(`Received request '${y.method} - (${y.id})'.`,E)}else Qi("receive-request",y)}function gh(y){if(!(h===de.Off||!w||y.method===qd.type.method))if(_===dr.Text){let E;(h===de.Verbose||h===de.Compact)&&(y.params?E=`Params: ${Tt(y.params)}
26
26
 
27
27
  `:E=`No parameters provided.
28
28
 
29
- `),w.log(`Received notification '${y.method}'.`,E)}else Ji("receive-notification",y)}function nA(y,E){if(!(h===de.Off||!w))if(_===dr.Text){let P;if((h===de.Verbose||h===de.Compact)&&(y.error&&y.error.data?P=`Error data: ${Tt(y.error.data)}
29
+ `),w.log(`Received notification '${y.method}'.`,E)}else Qi("receive-notification",y)}function oA(y,E){if(!(h===de.Off||!w))if(_===dr.Text){let P;if((h===de.Verbose||h===de.Compact)&&(y.error&&y.error.data?P=`Error data: ${Tt(y.error.data)}
30
30
 
31
31
  `:y.result?P=`Result: ${Tt(y.result)}
32
32
 
33
33
  `:y.error===void 0&&(P=`No result returned.
34
34
 
35
- `)),E){let j=y.error?` Request failed: ${y.error.message} (${y.error.code}).`:"";w.log(`Received response '${E.method} - (${y.id})' in ${Date.now()-E.timerStart}ms.${j}`,P)}else w.log(`Received response ${y.id} without active response promise.`,P)}else Ji("receive-response",y)}function Ji(y,E){if(!w||h===de.Off)return;let P={isLSPMessage:!0,type:y,message:E,timestamp:Date.now()};w.log(P)}function ma(){if(F())throw new Js(lu.Closed,"Connection is closed.");if(b())throw new Js(lu.Disposed,"Connection is disposed.")}function iA(){if(ct())throw new Js(lu.AlreadyListening,"Connection is already listening")}function oA(){if(!ct())throw new Error("Call listen() first.")}function ga(y){return y===void 0?null:y}function hv(y){if(y!==null)return y}function pv(y){return y!=null&&!Array.isArray(y)&&typeof y=="object"}function mh(y,E){switch(y){case z.ParameterStructures.auto:return pv(E)?hv(E):[ga(E)];case z.ParameterStructures.byName:if(!pv(E))throw new Error("Received parameters by name but param is not an object literal.");return hv(E);case z.ParameterStructures.byPosition:return[ga(E)];default:throw new Error(`Unknown parameter structure ${y.toString()}`)}}function mv(y,E){let P,j=y.numberOfParams;switch(j){case 0:P=void 0;break;case 1:P=mh(y.parameterStructures,E[0]);break;default:P=[];for(let Ae=0;Ae<E.length&&Ae<j;Ae++)P.push(ga(E[Ae]));if(E.length<j)for(let Ae=E.length;Ae<j;Ae++)P.push(null);break}return P}let Qi={sendNotification:(y,...E)=>{ma();let P,j;if(He.string(y)){P=y;let ge=E[0],Ge=0,Je=z.ParameterStructures.auto;z.ParameterStructures.is(ge)&&(Ge=1,Je=ge);let ae=E.length,qe=ae-Ge;switch(qe){case 0:j=void 0;break;case 1:j=mh(Je,E[Ge]);break;default:if(Je===z.ParameterStructures.byName)throw new Error(`Received ${qe} parameters for 'by Name' notification parameter structure.`);j=E.slice(Ge,ae).map(pe=>ga(pe));break}}else{let ge=E;P=y.method,j=mv(y,ge)}let Ae={jsonrpc:c,method:P,params:j};return cn(Ae),e.write(Ae).catch(ge=>{throw i.error("Sending notification failed."),ge})},onNotification:(y,E)=>{ma();let P;return He.func(y)?d=y:E&&(He.string(y)?(P=y,f.set(y,{type:void 0,handler:E})):(P=y.method,f.set(y.method,{type:y,handler:E}))),{dispose:()=>{P!==void 0?f.delete(P):d=void 0}}},onProgress:(y,E,P)=>{if(p.has(E))throw new Error(`Progress handler for token ${E} already registered`);return p.set(E,P),{dispose:()=>{p.delete(E)}}},sendProgress:(y,E,P)=>Qi.sendNotification(uu.type,{token:E,value:P}),onUnhandledProgress:Ht.event,sendRequest:(y,...E)=>{ma(),oA();let P,j,Ae;if(He.string(y)){P=y;let ae=E[0],qe=E[E.length-1],pe=0,ut=z.ParameterStructures.auto;z.ParameterStructures.is(ae)&&(pe=1,ut=ae);let Lt=E.length;ny.CancellationToken.is(qe)&&(Lt=Lt-1,Ae=qe);let Or=Lt-pe;switch(Or){case 0:j=void 0;break;case 1:j=mh(ut,E[pe]);break;default:if(ut===z.ParameterStructures.byName)throw new Error(`Received ${Or} parameters for 'by Name' request parameter structure.`);j=E.slice(pe,Lt).map(sA=>ga(sA));break}}else{let ae=E;P=y.method,j=mv(y,ae);let qe=y.numberOfParams;Ae=ny.CancellationToken.is(ae[qe])?ae[qe]:void 0}let ge=o++,Ge;Ae&&(Ge=Ae.onCancellationRequested(()=>{let ae=S.sender.sendCancellation(Qi,ge);return ae===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${ge}`),Promise.resolve()):ae.catch(()=>{i.log(`Sending cancellation messages for id ${ge} failed`)})}));let Je={jsonrpc:c,id:ge,method:P,params:j};return Sr(Je),typeof S.sender.enableCancellation=="function"&&S.sender.enableCancellation(Je),new Promise(async(ae,qe)=>{let pe=Or=>{ae(Or),S.sender.cleanup(ge),Ge?.dispose()},ut=Or=>{qe(Or),S.sender.cleanup(ge),Ge?.dispose()},Lt={method:P,timerStart:Date.now(),resolve:pe,reject:ut};try{await e.write(Je),k.set(ge,Lt)}catch(Or){throw i.error("Sending request failed."),Lt.reject(new z.ResponseError(z.ErrorCodes.MessageWriteError,Or.message?Or.message:"Unknown reason")),Or}})},onRequest:(y,E)=>{ma();let P=null;return sy.is(y)?(P=void 0,u=y):He.string(y)?(P=null,E!==void 0&&(P=y,l.set(y,{handler:E,type:void 0}))):E!==void 0&&(P=y.method,l.set(y.method,{type:y,handler:E})),{dispose:()=>{P!==null&&(P!==void 0?l.delete(P):u=void 0)}}},hasPendingResponse:()=>k.size>0,trace:async(y,E,P)=>{let j=!1,Ae=dr.Text;P!==void 0&&(He.boolean(P)?j=P:(j=P.sendNotification||!1,Ae=P.traceFormat||dr.Text)),h=y,_=Ae,h===de.Off?w=void 0:w=E,j&&!F()&&!b()&&await Qi.sendNotification(ay.type,{value:de.toString(y)})},onError:Bt.event,onClose:Ye.event,onUnhandledNotification:ir.event,onDispose:I.event,end:()=>{e.end()},dispose:()=>{if(b())return;J=Dr.Disposed,I.fire(void 0);let y=new z.ResponseError(z.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let E of k.values())E.reject(y);k=new Map,g=new Map,R=new Set,T=new Lb.LinkedMap,He.func(e.dispose)&&e.dispose(),He.func(t.dispose)&&t.dispose()},listen:()=>{ma(),iA(),J=Dr.Listening,t.listen(ht)},inspect:()=>{(0,Ob.default)().console.log("inspect")}};return Qi.onNotification(qd.type,y=>{if(h===de.Off||!w)return;let E=h===de.Verbose||h===de.Compact;w.log(y.message,E?y.verbose:void 0)}),Qi.onNotification(uu.type,y=>{let E=p.get(y.token);E?E(y.value):Ht.fire(y)}),Qi}Y.createMessageConnection=a1});var Gd=L(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.ProgressType=C.ProgressToken=C.createMessageConnection=C.NullLogger=C.ConnectionOptions=C.ConnectionStrategy=C.AbstractMessageBuffer=C.WriteableStreamMessageWriter=C.AbstractMessageWriter=C.MessageWriter=C.ReadableStreamMessageReader=C.AbstractMessageReader=C.MessageReader=C.SharedArrayReceiverStrategy=C.SharedArraySenderStrategy=C.CancellationToken=C.CancellationTokenSource=C.Emitter=C.Event=C.Disposable=C.LRUCache=C.Touch=C.LinkedMap=C.ParameterStructures=C.NotificationType9=C.NotificationType8=C.NotificationType7=C.NotificationType6=C.NotificationType5=C.NotificationType4=C.NotificationType3=C.NotificationType2=C.NotificationType1=C.NotificationType0=C.NotificationType=C.ErrorCodes=C.ResponseError=C.RequestType9=C.RequestType8=C.RequestType7=C.RequestType6=C.RequestType5=C.RequestType4=C.RequestType3=C.RequestType2=C.RequestType1=C.RequestType0=C.RequestType=C.Message=C.RAL=void 0;C.MessageStrategy=C.CancellationStrategy=C.CancellationSenderStrategy=C.CancellationReceiverStrategy=C.ConnectionError=C.ConnectionErrors=C.LogTraceNotification=C.SetTraceNotification=C.TraceFormat=C.TraceValues=C.Trace=void 0;var Ee=jg();Object.defineProperty(C,"Message",{enumerable:!0,get:function(){return Ee.Message}});Object.defineProperty(C,"RequestType",{enumerable:!0,get:function(){return Ee.RequestType}});Object.defineProperty(C,"RequestType0",{enumerable:!0,get:function(){return Ee.RequestType0}});Object.defineProperty(C,"RequestType1",{enumerable:!0,get:function(){return Ee.RequestType1}});Object.defineProperty(C,"RequestType2",{enumerable:!0,get:function(){return Ee.RequestType2}});Object.defineProperty(C,"RequestType3",{enumerable:!0,get:function(){return Ee.RequestType3}});Object.defineProperty(C,"RequestType4",{enumerable:!0,get:function(){return Ee.RequestType4}});Object.defineProperty(C,"RequestType5",{enumerable:!0,get:function(){return Ee.RequestType5}});Object.defineProperty(C,"RequestType6",{enumerable:!0,get:function(){return Ee.RequestType6}});Object.defineProperty(C,"RequestType7",{enumerable:!0,get:function(){return Ee.RequestType7}});Object.defineProperty(C,"RequestType8",{enumerable:!0,get:function(){return Ee.RequestType8}});Object.defineProperty(C,"RequestType9",{enumerable:!0,get:function(){return Ee.RequestType9}});Object.defineProperty(C,"ResponseError",{enumerable:!0,get:function(){return Ee.ResponseError}});Object.defineProperty(C,"ErrorCodes",{enumerable:!0,get:function(){return Ee.ErrorCodes}});Object.defineProperty(C,"NotificationType",{enumerable:!0,get:function(){return Ee.NotificationType}});Object.defineProperty(C,"NotificationType0",{enumerable:!0,get:function(){return Ee.NotificationType0}});Object.defineProperty(C,"NotificationType1",{enumerable:!0,get:function(){return Ee.NotificationType1}});Object.defineProperty(C,"NotificationType2",{enumerable:!0,get:function(){return Ee.NotificationType2}});Object.defineProperty(C,"NotificationType3",{enumerable:!0,get:function(){return Ee.NotificationType3}});Object.defineProperty(C,"NotificationType4",{enumerable:!0,get:function(){return Ee.NotificationType4}});Object.defineProperty(C,"NotificationType5",{enumerable:!0,get:function(){return Ee.NotificationType5}});Object.defineProperty(C,"NotificationType6",{enumerable:!0,get:function(){return Ee.NotificationType6}});Object.defineProperty(C,"NotificationType7",{enumerable:!0,get:function(){return Ee.NotificationType7}});Object.defineProperty(C,"NotificationType8",{enumerable:!0,get:function(){return Ee.NotificationType8}});Object.defineProperty(C,"NotificationType9",{enumerable:!0,get:function(){return Ee.NotificationType9}});Object.defineProperty(C,"ParameterStructures",{enumerable:!0,get:function(){return Ee.ParameterStructures}});var ly=Bg();Object.defineProperty(C,"LinkedMap",{enumerable:!0,get:function(){return ly.LinkedMap}});Object.defineProperty(C,"LRUCache",{enumerable:!0,get:function(){return ly.LRUCache}});Object.defineProperty(C,"Touch",{enumerable:!0,get:function(){return ly.Touch}});var c1=Cb();Object.defineProperty(C,"Disposable",{enumerable:!0,get:function(){return c1.Disposable}});var qb=$i();Object.defineProperty(C,"Event",{enumerable:!0,get:function(){return qb.Event}});Object.defineProperty(C,"Emitter",{enumerable:!0,get:function(){return qb.Emitter}});var Ub=kc();Object.defineProperty(C,"CancellationTokenSource",{enumerable:!0,get:function(){return Ub.CancellationTokenSource}});Object.defineProperty(C,"CancellationToken",{enumerable:!0,get:function(){return Ub.CancellationToken}});var jb=kb();Object.defineProperty(C,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return jb.SharedArraySenderStrategy}});Object.defineProperty(C,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return jb.SharedArrayReceiverStrategy}});var dy=Eb();Object.defineProperty(C,"MessageReader",{enumerable:!0,get:function(){return dy.MessageReader}});Object.defineProperty(C,"AbstractMessageReader",{enumerable:!0,get:function(){return dy.AbstractMessageReader}});Object.defineProperty(C,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return dy.ReadableStreamMessageReader}});var fy=Db();Object.defineProperty(C,"MessageWriter",{enumerable:!0,get:function(){return fy.MessageWriter}});Object.defineProperty(C,"AbstractMessageWriter",{enumerable:!0,get:function(){return fy.AbstractMessageWriter}});Object.defineProperty(C,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return fy.WriteableStreamMessageWriter}});var u1=Ib();Object.defineProperty(C,"AbstractMessageBuffer",{enumerable:!0,get:function(){return u1.AbstractMessageBuffer}});var kt=$b();Object.defineProperty(C,"ConnectionStrategy",{enumerable:!0,get:function(){return kt.ConnectionStrategy}});Object.defineProperty(C,"ConnectionOptions",{enumerable:!0,get:function(){return kt.ConnectionOptions}});Object.defineProperty(C,"NullLogger",{enumerable:!0,get:function(){return kt.NullLogger}});Object.defineProperty(C,"createMessageConnection",{enumerable:!0,get:function(){return kt.createMessageConnection}});Object.defineProperty(C,"ProgressToken",{enumerable:!0,get:function(){return kt.ProgressToken}});Object.defineProperty(C,"ProgressType",{enumerable:!0,get:function(){return kt.ProgressType}});Object.defineProperty(C,"Trace",{enumerable:!0,get:function(){return kt.Trace}});Object.defineProperty(C,"TraceValues",{enumerable:!0,get:function(){return kt.TraceValues}});Object.defineProperty(C,"TraceFormat",{enumerable:!0,get:function(){return kt.TraceFormat}});Object.defineProperty(C,"SetTraceNotification",{enumerable:!0,get:function(){return kt.SetTraceNotification}});Object.defineProperty(C,"LogTraceNotification",{enumerable:!0,get:function(){return kt.LogTraceNotification}});Object.defineProperty(C,"ConnectionErrors",{enumerable:!0,get:function(){return kt.ConnectionErrors}});Object.defineProperty(C,"ConnectionError",{enumerable:!0,get:function(){return kt.ConnectionError}});Object.defineProperty(C,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return kt.CancellationReceiverStrategy}});Object.defineProperty(C,"CancellationSenderStrategy",{enumerable:!0,get:function(){return kt.CancellationSenderStrategy}});Object.defineProperty(C,"CancellationStrategy",{enumerable:!0,get:function(){return kt.CancellationStrategy}});Object.defineProperty(C,"MessageStrategy",{enumerable:!0,get:function(){return kt.MessageStrategy}});var l1=Xn();C.RAL=l1.default});var Bb=L(gy=>{"use strict";Object.defineProperty(gy,"__esModule",{value:!0});var tn=Gd(),zd=class t extends tn.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return new TextEncoder().encode(e)}toString(e,r){return r==="ascii"?this.asciiDecoder.decode(e):new TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e:e.slice(0,r)}allocNative(e){return new Uint8Array(e)}};zd.emptyBuffer=new Uint8Array(0);var hy=class{constructor(e){this.socket=e,this._onData=new tn.Emitter,this._messageListener=r=>{r.data.arrayBuffer().then(i=>{this._onData.fire(new Uint8Array(i))},()=>{(0,tn.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),tn.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),tn.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),tn.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}},py=class{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),tn.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),tn.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),tn.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,r){if(typeof e=="string"){if(r!==void 0&&r!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${r}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}},d1=new TextEncoder,Wb=Object.freeze({messageBuffer:Object.freeze({create:t=>new zd(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{if(e.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${e.charset}`);return Promise.resolve(d1.encode(JSON.stringify(t,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{if(!(t instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(e.charset).decode(t)))}})}),stream:Object.freeze({asReadableStream:t=>new hy(t),asWritableStream:t=>new py(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setTimeout(t,0,...e);return{dispose:()=>clearTimeout(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function my(){return Wb}(function(t){function e(){tn.RAL.install(Wb)}t.install=e})(my||(my={}));gy.default=my});var Ki=L(fr=>{"use strict";var f1=fr&&fr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),h1=fr&&fr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&f1(e,t,r)};Object.defineProperty(fr,"__esModule",{value:!0});fr.createMessageConnection=fr.BrowserMessageWriter=fr.BrowserMessageReader=void 0;var p1=Bb();p1.default.install();var Qs=Gd();h1(Gd(),fr);var yy=class extends Qs.AbstractMessageReader{constructor(e){super(),this._onData=new Qs.Emitter,this._messageListener=r=>{this._onData.fire(r.data)},e.addEventListener("error",r=>this.fireError(r)),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}};fr.BrowserMessageReader=yy;var vy=class extends Qs.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("error",r=>this.fireError(r))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};fr.BrowserMessageWriter=vy;function m1(t,e,r,n){return r===void 0&&(r=Qs.NullLogger),Qs.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Qs.createMessageConnection)(t,e,r,n)}fr.createMessageConnection=m1});var xy=L((uZ,Hb)=>{"use strict";Hb.exports=Ki()});var $e=L(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.ProtocolNotificationType=tr.ProtocolNotificationType0=tr.ProtocolRequestType=tr.ProtocolRequestType0=tr.RegistrationType=tr.MessageDirection=void 0;var Zs=Ki(),Gb;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(Gb||(tr.MessageDirection=Gb={}));var Ty=class{constructor(e){this.method=e}};tr.RegistrationType=Ty;var Ry=class extends Zs.RequestType0{constructor(e){super(e)}};tr.ProtocolRequestType0=Ry;var _y=class extends Zs.RequestType{constructor(e){super(e,Zs.ParameterStructures.byName)}};tr.ProtocolRequestType=_y;var by=class extends Zs.NotificationType0{constructor(e){super(e)}};tr.ProtocolNotificationType0=by;var Cy=class extends Zs.NotificationType{constructor(e){super(e,Zs.ParameterStructures.byName)}};tr.ProtocolNotificationType=Cy});var Kd=L(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.objectLiteral=st.typedArray=st.stringArray=st.array=st.func=st.error=st.number=st.string=st.boolean=void 0;function g1(t){return t===!0||t===!1}st.boolean=g1;function zb(t){return typeof t=="string"||t instanceof String}st.string=zb;function y1(t){return typeof t=="number"||t instanceof Number}st.number=y1;function v1(t){return t instanceof Error}st.error=v1;function x1(t){return typeof t=="function"}st.func=x1;function Kb(t){return Array.isArray(t)}st.array=Kb;function T1(t){return Kb(t)&&t.every(e=>zb(e))}st.stringArray=T1;function R1(t,e){return Array.isArray(t)&&t.every(e)}st.typedArray=R1;function _1(t){return t!==null&&typeof t=="object"}st.objectLiteral=_1});var Yb=L(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.ImplementationRequest=void 0;var Vb=$e(),Xb;(function(t){t.method="textDocument/implementation",t.messageDirection=Vb.MessageDirection.clientToServer,t.type=new Vb.ProtocolRequestType(t.method)})(Xb||(Vd.ImplementationRequest=Xb={}))});var Zb=L(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.TypeDefinitionRequest=void 0;var Jb=$e(),Qb;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=Jb.MessageDirection.clientToServer,t.type=new Jb.ProtocolRequestType(t.method)})(Qb||(Xd.TypeDefinitionRequest=Qb={}))});var rC=L(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.DidChangeWorkspaceFoldersNotification=ea.WorkspaceFoldersRequest=void 0;var Yd=$e(),eC;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Yd.MessageDirection.serverToClient,t.type=new Yd.ProtocolRequestType0(t.method)})(eC||(ea.WorkspaceFoldersRequest=eC={}));var tC;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Yd.MessageDirection.clientToServer,t.type=new Yd.ProtocolNotificationType(t.method)})(tC||(ea.DidChangeWorkspaceFoldersNotification=tC={}))});var oC=L(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.ConfigurationRequest=void 0;var nC=$e(),iC;(function(t){t.method="workspace/configuration",t.messageDirection=nC.MessageDirection.serverToClient,t.type=new nC.ProtocolRequestType(t.method)})(iC||(Jd.ConfigurationRequest=iC={}))});var cC=L(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.ColorPresentationRequest=ta.DocumentColorRequest=void 0;var Qd=$e(),sC;(function(t){t.method="textDocument/documentColor",t.messageDirection=Qd.MessageDirection.clientToServer,t.type=new Qd.ProtocolRequestType(t.method)})(sC||(ta.DocumentColorRequest=sC={}));var aC;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=Qd.MessageDirection.clientToServer,t.type=new Qd.ProtocolRequestType(t.method)})(aC||(ta.ColorPresentationRequest=aC={}))});var dC=L(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.FoldingRangeRefreshRequest=ra.FoldingRangeRequest=void 0;var Zd=$e(),uC;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Zd.MessageDirection.clientToServer,t.type=new Zd.ProtocolRequestType(t.method)})(uC||(ra.FoldingRangeRequest=uC={}));var lC;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Zd.MessageDirection.serverToClient,t.type=new Zd.ProtocolRequestType0(t.method)})(lC||(ra.FoldingRangeRefreshRequest=lC={}))});var pC=L(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.DeclarationRequest=void 0;var fC=$e(),hC;(function(t){t.method="textDocument/declaration",t.messageDirection=fC.MessageDirection.clientToServer,t.type=new fC.ProtocolRequestType(t.method)})(hC||(ef.DeclarationRequest=hC={}))});var yC=L(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.SelectionRangeRequest=void 0;var mC=$e(),gC;(function(t){t.method="textDocument/selectionRange",t.messageDirection=mC.MessageDirection.clientToServer,t.type=new mC.ProtocolRequestType(t.method)})(gC||(tf.SelectionRangeRequest=gC={}))});var RC=L(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.WorkDoneProgressCancelNotification=ti.WorkDoneProgressCreateRequest=ti.WorkDoneProgress=void 0;var b1=Ki(),rf=$e(),vC;(function(t){t.type=new b1.ProgressType;function e(r){return r===t.type}t.is=e})(vC||(ti.WorkDoneProgress=vC={}));var xC;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=rf.MessageDirection.serverToClient,t.type=new rf.ProtocolRequestType(t.method)})(xC||(ti.WorkDoneProgressCreateRequest=xC={}));var TC;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=rf.MessageDirection.clientToServer,t.type=new rf.ProtocolNotificationType(t.method)})(TC||(ti.WorkDoneProgressCancelNotification=TC={}))});var kC=L(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.CallHierarchyOutgoingCallsRequest=ri.CallHierarchyIncomingCallsRequest=ri.CallHierarchyPrepareRequest=void 0;var na=$e(),_C;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=na.MessageDirection.clientToServer,t.type=new na.ProtocolRequestType(t.method)})(_C||(ri.CallHierarchyPrepareRequest=_C={}));var bC;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=na.MessageDirection.clientToServer,t.type=new na.ProtocolRequestType(t.method)})(bC||(ri.CallHierarchyIncomingCallsRequest=bC={}));var CC;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=na.MessageDirection.clientToServer,t.type=new na.ProtocolRequestType(t.method)})(CC||(ri.CallHierarchyOutgoingCallsRequest=CC={}))});var PC=L(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.SemanticTokensRefreshRequest=rr.SemanticTokensRangeRequest=rr.SemanticTokensDeltaRequest=rr.SemanticTokensRequest=rr.SemanticTokensRegistrationType=rr.TokenFormat=void 0;var bn=$e(),SC;(function(t){t.Relative="relative"})(SC||(rr.TokenFormat=SC={}));var fu;(function(t){t.method="textDocument/semanticTokens",t.type=new bn.RegistrationType(t.method)})(fu||(rr.SemanticTokensRegistrationType=fu={}));var EC;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=bn.MessageDirection.clientToServer,t.type=new bn.ProtocolRequestType(t.method),t.registrationMethod=fu.method})(EC||(rr.SemanticTokensRequest=EC={}));var AC;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=bn.MessageDirection.clientToServer,t.type=new bn.ProtocolRequestType(t.method),t.registrationMethod=fu.method})(AC||(rr.SemanticTokensDeltaRequest=AC={}));var wC;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=bn.MessageDirection.clientToServer,t.type=new bn.ProtocolRequestType(t.method),t.registrationMethod=fu.method})(wC||(rr.SemanticTokensRangeRequest=wC={}));var NC;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=bn.MessageDirection.serverToClient,t.type=new bn.ProtocolRequestType0(t.method)})(NC||(rr.SemanticTokensRefreshRequest=NC={}))});var OC=L(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});nf.ShowDocumentRequest=void 0;var DC=$e(),IC;(function(t){t.method="window/showDocument",t.messageDirection=DC.MessageDirection.serverToClient,t.type=new DC.ProtocolRequestType(t.method)})(IC||(nf.ShowDocumentRequest=IC={}))});var FC=L(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.LinkedEditingRangeRequest=void 0;var LC=$e(),MC;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=LC.MessageDirection.clientToServer,t.type=new LC.ProtocolRequestType(t.method)})(MC||(of.LinkedEditingRangeRequest=MC={}))});var GC=L(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.WillDeleteFilesRequest=Dt.DidDeleteFilesNotification=Dt.DidRenameFilesNotification=Dt.WillRenameFilesRequest=Dt.DidCreateFilesNotification=Dt.WillCreateFilesRequest=Dt.FileOperationPatternKind=void 0;var Tr=$e(),$C;(function(t){t.file="file",t.folder="folder"})($C||(Dt.FileOperationPatternKind=$C={}));var qC;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolRequestType(t.method)})(qC||(Dt.WillCreateFilesRequest=qC={}));var UC;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolNotificationType(t.method)})(UC||(Dt.DidCreateFilesNotification=UC={}));var jC;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolRequestType(t.method)})(jC||(Dt.WillRenameFilesRequest=jC={}));var WC;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolNotificationType(t.method)})(WC||(Dt.DidRenameFilesNotification=WC={}));var BC;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolNotificationType(t.method)})(BC||(Dt.DidDeleteFilesNotification=BC={}));var HC;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolRequestType(t.method)})(HC||(Dt.WillDeleteFilesRequest=HC={}))});var YC=L(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.MonikerRequest=ni.MonikerKind=ni.UniquenessLevel=void 0;var zC=$e(),KC;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(KC||(ni.UniquenessLevel=KC={}));var VC;(function(t){t.$import="import",t.$export="export",t.local="local"})(VC||(ni.MonikerKind=VC={}));var XC;(function(t){t.method="textDocument/moniker",t.messageDirection=zC.MessageDirection.clientToServer,t.type=new zC.ProtocolRequestType(t.method)})(XC||(ni.MonikerRequest=XC={}))});var ek=L(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.TypeHierarchySubtypesRequest=ii.TypeHierarchySupertypesRequest=ii.TypeHierarchyPrepareRequest=void 0;var ia=$e(),JC;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method)})(JC||(ii.TypeHierarchyPrepareRequest=JC={}));var QC;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method)})(QC||(ii.TypeHierarchySupertypesRequest=QC={}));var ZC;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method)})(ZC||(ii.TypeHierarchySubtypesRequest=ZC={}))});var nk=L(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.InlineValueRefreshRequest=oa.InlineValueRequest=void 0;var sf=$e(),tk;(function(t){t.method="textDocument/inlineValue",t.messageDirection=sf.MessageDirection.clientToServer,t.type=new sf.ProtocolRequestType(t.method)})(tk||(oa.InlineValueRequest=tk={}));var rk;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=sf.MessageDirection.serverToClient,t.type=new sf.ProtocolRequestType0(t.method)})(rk||(oa.InlineValueRefreshRequest=rk={}))});var ak=L(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.InlayHintRefreshRequest=oi.InlayHintResolveRequest=oi.InlayHintRequest=void 0;var sa=$e(),ik;(function(t){t.method="textDocument/inlayHint",t.messageDirection=sa.MessageDirection.clientToServer,t.type=new sa.ProtocolRequestType(t.method)})(ik||(oi.InlayHintRequest=ik={}));var ok;(function(t){t.method="inlayHint/resolve",t.messageDirection=sa.MessageDirection.clientToServer,t.type=new sa.ProtocolRequestType(t.method)})(ok||(oi.InlayHintResolveRequest=ok={}));var sk;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=sa.MessageDirection.serverToClient,t.type=new sa.ProtocolRequestType0(t.method)})(sk||(oi.InlayHintRefreshRequest=sk={}))});var pk=L(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.DiagnosticRefreshRequest=Rr.WorkspaceDiagnosticRequest=Rr.DocumentDiagnosticRequest=Rr.DocumentDiagnosticReportKind=Rr.DiagnosticServerCancellationData=void 0;var hk=Ki(),C1=Kd(),aa=$e(),ck;(function(t){function e(r){let n=r;return n&&C1.boolean(n.retriggerRequest)}t.is=e})(ck||(Rr.DiagnosticServerCancellationData=ck={}));var uk;(function(t){t.Full="full",t.Unchanged="unchanged"})(uk||(Rr.DocumentDiagnosticReportKind=uk={}));var lk;(function(t){t.method="textDocument/diagnostic",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method),t.partialResult=new hk.ProgressType})(lk||(Rr.DocumentDiagnosticRequest=lk={}));var dk;(function(t){t.method="workspace/diagnostic",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method),t.partialResult=new hk.ProgressType})(dk||(Rr.WorkspaceDiagnosticRequest=dk={}));var fk;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=aa.MessageDirection.serverToClient,t.type=new aa.ProtocolRequestType0(t.method)})(fk||(Rr.DiagnosticRefreshRequest=fk={}))});var Rk=L(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.DidCloseNotebookDocumentNotification=Ve.DidSaveNotebookDocumentNotification=Ve.DidChangeNotebookDocumentNotification=Ve.NotebookCellArrayChange=Ve.DidOpenNotebookDocumentNotification=Ve.NotebookDocumentSyncRegistrationType=Ve.NotebookDocument=Ve.NotebookCell=Ve.ExecutionSummary=Ve.NotebookCellKind=void 0;var hu=(Ii(),gh(fd)),Ir=Kd(),rn=$e(),ky;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(ky||(Ve.NotebookCellKind=ky={}));var Sy;(function(t){function e(i,o){let s={executionOrder:i};return(o===!0||o===!1)&&(s.success=o),s}t.create=e;function r(i){let o=i;return Ir.objectLiteral(o)&&hu.uinteger.is(o.executionOrder)&&(o.success===void 0||Ir.boolean(o.success))}t.is=r;function n(i,o){return i===o?!0:i==null||o===null||o===void 0?!1:i.executionOrder===o.executionOrder&&i.success===o.success}t.equals=n})(Sy||(Ve.ExecutionSummary=Sy={}));var af;(function(t){function e(o,s){return{kind:o,document:s}}t.create=e;function r(o){let s=o;return Ir.objectLiteral(s)&&ky.is(s.kind)&&hu.DocumentUri.is(s.document)&&(s.metadata===void 0||Ir.objectLiteral(s.metadata))}t.is=r;function n(o,s){let a=new Set;return o.document!==s.document&&a.add("document"),o.kind!==s.kind&&a.add("kind"),o.executionSummary!==s.executionSummary&&a.add("executionSummary"),(o.metadata!==void 0||s.metadata!==void 0)&&!i(o.metadata,s.metadata)&&a.add("metadata"),(o.executionSummary!==void 0||s.executionSummary!==void 0)&&!Sy.equals(o.executionSummary,s.executionSummary)&&a.add("executionSummary"),a}t.diff=n;function i(o,s){if(o===s)return!0;if(o==null||s===null||s===void 0||typeof o!=typeof s||typeof o!="object")return!1;let a=Array.isArray(o),c=Array.isArray(s);if(a!==c)return!1;if(a&&c){if(o.length!==s.length)return!1;for(let u=0;u<o.length;u++)if(!i(o[u],s[u]))return!1}if(Ir.objectLiteral(o)&&Ir.objectLiteral(s)){let u=Object.keys(o),l=Object.keys(s);if(u.length!==l.length||(u.sort(),l.sort(),!i(u,l)))return!1;for(let d=0;d<u.length;d++){let f=u[d];if(!i(o[f],s[f]))return!1}}return!0}})(af||(Ve.NotebookCell=af={}));var mk;(function(t){function e(n,i,o,s){return{uri:n,notebookType:i,version:o,cells:s}}t.create=e;function r(n){let i=n;return Ir.objectLiteral(i)&&Ir.string(i.uri)&&hu.integer.is(i.version)&&Ir.typedArray(i.cells,af.is)}t.is=r})(mk||(Ve.NotebookDocument=mk={}));var ca;(function(t){t.method="notebookDocument/sync",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.RegistrationType(t.method)})(ca||(Ve.NotebookDocumentSyncRegistrationType=ca={}));var gk;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method),t.registrationMethod=ca.method})(gk||(Ve.DidOpenNotebookDocumentNotification=gk={}));var yk;(function(t){function e(n){let i=n;return Ir.objectLiteral(i)&&hu.uinteger.is(i.start)&&hu.uinteger.is(i.deleteCount)&&(i.cells===void 0||Ir.typedArray(i.cells,af.is))}t.is=e;function r(n,i,o){let s={start:n,deleteCount:i};return o!==void 0&&(s.cells=o),s}t.create=r})(yk||(Ve.NotebookCellArrayChange=yk={}));var vk;(function(t){t.method="notebookDocument/didChange",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method),t.registrationMethod=ca.method})(vk||(Ve.DidChangeNotebookDocumentNotification=vk={}));var xk;(function(t){t.method="notebookDocument/didSave",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method),t.registrationMethod=ca.method})(xk||(Ve.DidSaveNotebookDocumentNotification=xk={}));var Tk;(function(t){t.method="notebookDocument/didClose",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method),t.registrationMethod=ca.method})(Tk||(Ve.DidCloseNotebookDocumentNotification=Tk={}))});var Ck=L(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.InlineCompletionRequest=void 0;var _k=$e(),bk;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=_k.MessageDirection.clientToServer,t.type=new _k.ProtocolRequestType(t.method)})(bk||(cf.InlineCompletionRequest=bk={}))});var FS=L(m=>{"use strict";Object.defineProperty(m,"__esModule",{value:!0});m.WorkspaceSymbolRequest=m.CodeActionResolveRequest=m.CodeActionRequest=m.DocumentSymbolRequest=m.DocumentHighlightRequest=m.ReferencesRequest=m.DefinitionRequest=m.SignatureHelpRequest=m.SignatureHelpTriggerKind=m.HoverRequest=m.CompletionResolveRequest=m.CompletionRequest=m.CompletionTriggerKind=m.PublishDiagnosticsNotification=m.WatchKind=m.RelativePattern=m.FileChangeType=m.DidChangeWatchedFilesNotification=m.WillSaveTextDocumentWaitUntilRequest=m.WillSaveTextDocumentNotification=m.TextDocumentSaveReason=m.DidSaveTextDocumentNotification=m.DidCloseTextDocumentNotification=m.DidChangeTextDocumentNotification=m.TextDocumentContentChangeEvent=m.DidOpenTextDocumentNotification=m.TextDocumentSyncKind=m.TelemetryEventNotification=m.LogMessageNotification=m.ShowMessageRequest=m.ShowMessageNotification=m.MessageType=m.DidChangeConfigurationNotification=m.ExitNotification=m.ShutdownRequest=m.InitializedNotification=m.InitializeErrorCodes=m.InitializeRequest=m.WorkDoneProgressOptions=m.TextDocumentRegistrationOptions=m.StaticRegistrationOptions=m.PositionEncodingKind=m.FailureHandlingKind=m.ResourceOperationKind=m.UnregistrationRequest=m.RegistrationRequest=m.DocumentSelector=m.NotebookCellTextDocumentFilter=m.NotebookDocumentFilter=m.TextDocumentFilter=void 0;m.MonikerRequest=m.MonikerKind=m.UniquenessLevel=m.WillDeleteFilesRequest=m.DidDeleteFilesNotification=m.WillRenameFilesRequest=m.DidRenameFilesNotification=m.WillCreateFilesRequest=m.DidCreateFilesNotification=m.FileOperationPatternKind=m.LinkedEditingRangeRequest=m.ShowDocumentRequest=m.SemanticTokensRegistrationType=m.SemanticTokensRefreshRequest=m.SemanticTokensRangeRequest=m.SemanticTokensDeltaRequest=m.SemanticTokensRequest=m.TokenFormat=m.CallHierarchyPrepareRequest=m.CallHierarchyOutgoingCallsRequest=m.CallHierarchyIncomingCallsRequest=m.WorkDoneProgressCancelNotification=m.WorkDoneProgressCreateRequest=m.WorkDoneProgress=m.SelectionRangeRequest=m.DeclarationRequest=m.FoldingRangeRefreshRequest=m.FoldingRangeRequest=m.ColorPresentationRequest=m.DocumentColorRequest=m.ConfigurationRequest=m.DidChangeWorkspaceFoldersNotification=m.WorkspaceFoldersRequest=m.TypeDefinitionRequest=m.ImplementationRequest=m.ApplyWorkspaceEditRequest=m.ExecuteCommandRequest=m.PrepareRenameRequest=m.RenameRequest=m.PrepareSupportDefaultBehavior=m.DocumentOnTypeFormattingRequest=m.DocumentRangesFormattingRequest=m.DocumentRangeFormattingRequest=m.DocumentFormattingRequest=m.DocumentLinkResolveRequest=m.DocumentLinkRequest=m.CodeLensRefreshRequest=m.CodeLensResolveRequest=m.CodeLensRequest=m.WorkspaceSymbolResolveRequest=void 0;m.InlineCompletionRequest=m.DidCloseNotebookDocumentNotification=m.DidSaveNotebookDocumentNotification=m.DidChangeNotebookDocumentNotification=m.NotebookCellArrayChange=m.DidOpenNotebookDocumentNotification=m.NotebookDocumentSyncRegistrationType=m.NotebookDocument=m.NotebookCell=m.ExecutionSummary=m.NotebookCellKind=m.DiagnosticRefreshRequest=m.WorkspaceDiagnosticRequest=m.DocumentDiagnosticRequest=m.DocumentDiagnosticReportKind=m.DiagnosticServerCancellationData=m.InlayHintRefreshRequest=m.InlayHintResolveRequest=m.InlayHintRequest=m.InlineValueRefreshRequest=m.InlineValueRequest=m.TypeHierarchySupertypesRequest=m.TypeHierarchySubtypesRequest=m.TypeHierarchyPrepareRequest=void 0;var A=$e(),kk=(Ii(),gh(fd)),vt=Kd(),k1=Yb();Object.defineProperty(m,"ImplementationRequest",{enumerable:!0,get:function(){return k1.ImplementationRequest}});var S1=Zb();Object.defineProperty(m,"TypeDefinitionRequest",{enumerable:!0,get:function(){return S1.TypeDefinitionRequest}});var IS=rC();Object.defineProperty(m,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return IS.WorkspaceFoldersRequest}});Object.defineProperty(m,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return IS.DidChangeWorkspaceFoldersNotification}});var E1=oC();Object.defineProperty(m,"ConfigurationRequest",{enumerable:!0,get:function(){return E1.ConfigurationRequest}});var OS=cC();Object.defineProperty(m,"DocumentColorRequest",{enumerable:!0,get:function(){return OS.DocumentColorRequest}});Object.defineProperty(m,"ColorPresentationRequest",{enumerable:!0,get:function(){return OS.ColorPresentationRequest}});var LS=dC();Object.defineProperty(m,"FoldingRangeRequest",{enumerable:!0,get:function(){return LS.FoldingRangeRequest}});Object.defineProperty(m,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return LS.FoldingRangeRefreshRequest}});var A1=pC();Object.defineProperty(m,"DeclarationRequest",{enumerable:!0,get:function(){return A1.DeclarationRequest}});var w1=yC();Object.defineProperty(m,"SelectionRangeRequest",{enumerable:!0,get:function(){return w1.SelectionRangeRequest}});var Py=RC();Object.defineProperty(m,"WorkDoneProgress",{enumerable:!0,get:function(){return Py.WorkDoneProgress}});Object.defineProperty(m,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return Py.WorkDoneProgressCreateRequest}});Object.defineProperty(m,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return Py.WorkDoneProgressCancelNotification}});var Dy=kC();Object.defineProperty(m,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return Dy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(m,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return Dy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(m,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return Dy.CallHierarchyPrepareRequest}});var ua=PC();Object.defineProperty(m,"TokenFormat",{enumerable:!0,get:function(){return ua.TokenFormat}});Object.defineProperty(m,"SemanticTokensRequest",{enumerable:!0,get:function(){return ua.SemanticTokensRequest}});Object.defineProperty(m,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return ua.SemanticTokensDeltaRequest}});Object.defineProperty(m,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return ua.SemanticTokensRangeRequest}});Object.defineProperty(m,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return ua.SemanticTokensRefreshRequest}});Object.defineProperty(m,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return ua.SemanticTokensRegistrationType}});var N1=OC();Object.defineProperty(m,"ShowDocumentRequest",{enumerable:!0,get:function(){return N1.ShowDocumentRequest}});var P1=FC();Object.defineProperty(m,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return P1.LinkedEditingRangeRequest}});var Vi=GC();Object.defineProperty(m,"FileOperationPatternKind",{enumerable:!0,get:function(){return Vi.FileOperationPatternKind}});Object.defineProperty(m,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Vi.DidCreateFilesNotification}});Object.defineProperty(m,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Vi.WillCreateFilesRequest}});Object.defineProperty(m,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Vi.DidRenameFilesNotification}});Object.defineProperty(m,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Vi.WillRenameFilesRequest}});Object.defineProperty(m,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Vi.DidDeleteFilesNotification}});Object.defineProperty(m,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Vi.WillDeleteFilesRequest}});var Iy=YC();Object.defineProperty(m,"UniquenessLevel",{enumerable:!0,get:function(){return Iy.UniquenessLevel}});Object.defineProperty(m,"MonikerKind",{enumerable:!0,get:function(){return Iy.MonikerKind}});Object.defineProperty(m,"MonikerRequest",{enumerable:!0,get:function(){return Iy.MonikerRequest}});var Oy=ek();Object.defineProperty(m,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return Oy.TypeHierarchyPrepareRequest}});Object.defineProperty(m,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return Oy.TypeHierarchySubtypesRequest}});Object.defineProperty(m,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return Oy.TypeHierarchySupertypesRequest}});var MS=nk();Object.defineProperty(m,"InlineValueRequest",{enumerable:!0,get:function(){return MS.InlineValueRequest}});Object.defineProperty(m,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return MS.InlineValueRefreshRequest}});var Ly=ak();Object.defineProperty(m,"InlayHintRequest",{enumerable:!0,get:function(){return Ly.InlayHintRequest}});Object.defineProperty(m,"InlayHintResolveRequest",{enumerable:!0,get:function(){return Ly.InlayHintResolveRequest}});Object.defineProperty(m,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return Ly.InlayHintRefreshRequest}});var pu=pk();Object.defineProperty(m,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return pu.DiagnosticServerCancellationData}});Object.defineProperty(m,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return pu.DocumentDiagnosticReportKind}});Object.defineProperty(m,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return pu.DocumentDiagnosticRequest}});Object.defineProperty(m,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return pu.WorkspaceDiagnosticRequest}});Object.defineProperty(m,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return pu.DiagnosticRefreshRequest}});var nn=Rk();Object.defineProperty(m,"NotebookCellKind",{enumerable:!0,get:function(){return nn.NotebookCellKind}});Object.defineProperty(m,"ExecutionSummary",{enumerable:!0,get:function(){return nn.ExecutionSummary}});Object.defineProperty(m,"NotebookCell",{enumerable:!0,get:function(){return nn.NotebookCell}});Object.defineProperty(m,"NotebookDocument",{enumerable:!0,get:function(){return nn.NotebookDocument}});Object.defineProperty(m,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return nn.NotebookDocumentSyncRegistrationType}});Object.defineProperty(m,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return nn.DidOpenNotebookDocumentNotification}});Object.defineProperty(m,"NotebookCellArrayChange",{enumerable:!0,get:function(){return nn.NotebookCellArrayChange}});Object.defineProperty(m,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return nn.DidChangeNotebookDocumentNotification}});Object.defineProperty(m,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return nn.DidSaveNotebookDocumentNotification}});Object.defineProperty(m,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return nn.DidCloseNotebookDocumentNotification}});var D1=Ck();Object.defineProperty(m,"InlineCompletionRequest",{enumerable:!0,get:function(){return D1.InlineCompletionRequest}});var Ey;(function(t){function e(r){let n=r;return vt.string(n)||vt.string(n.language)||vt.string(n.scheme)||vt.string(n.pattern)}t.is=e})(Ey||(m.TextDocumentFilter=Ey={}));var Ay;(function(t){function e(r){let n=r;return vt.objectLiteral(n)&&(vt.string(n.notebookType)||vt.string(n.scheme)||vt.string(n.pattern))}t.is=e})(Ay||(m.NotebookDocumentFilter=Ay={}));var wy;(function(t){function e(r){let n=r;return vt.objectLiteral(n)&&(vt.string(n.notebook)||Ay.is(n.notebook))&&(n.language===void 0||vt.string(n.language))}t.is=e})(wy||(m.NotebookCellTextDocumentFilter=wy={}));var Ny;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!vt.string(n)&&!Ey.is(n)&&!wy.is(n))return!1;return!0}t.is=e})(Ny||(m.DocumentSelector=Ny={}));var Sk;(function(t){t.method="client/registerCapability",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType(t.method)})(Sk||(m.RegistrationRequest=Sk={}));var Ek;(function(t){t.method="client/unregisterCapability",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType(t.method)})(Ek||(m.UnregistrationRequest=Ek={}));var Ak;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(Ak||(m.ResourceOperationKind=Ak={}));var wk;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(wk||(m.FailureHandlingKind=wk={}));var Nk;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(Nk||(m.PositionEncodingKind=Nk={}));var Pk;(function(t){function e(r){let n=r;return n&&vt.string(n.id)&&n.id.length>0}t.hasId=e})(Pk||(m.StaticRegistrationOptions=Pk={}));var Dk;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||Ny.is(n.documentSelector))}t.is=e})(Dk||(m.TextDocumentRegistrationOptions=Dk={}));var Ik;(function(t){function e(n){let i=n;return vt.objectLiteral(i)&&(i.workDoneProgress===void 0||vt.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&vt.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(Ik||(m.WorkDoneProgressOptions=Ik={}));var Ok;(function(t){t.method="initialize",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Ok||(m.InitializeRequest=Ok={}));var Lk;(function(t){t.unknownProtocolVersion=1})(Lk||(m.InitializeErrorCodes=Lk={}));var Mk;(function(t){t.method="initialized",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(Mk||(m.InitializedNotification=Mk={}));var Fk;(function(t){t.method="shutdown",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType0(t.method)})(Fk||(m.ShutdownRequest=Fk={}));var $k;(function(t){t.method="exit",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType0(t.method)})($k||(m.ExitNotification=$k={}));var qk;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(qk||(m.DidChangeConfigurationNotification=qk={}));var Uk;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(Uk||(m.MessageType=Uk={}));var jk;(function(t){t.method="window/showMessage",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolNotificationType(t.method)})(jk||(m.ShowMessageNotification=jk={}));var Wk;(function(t){t.method="window/showMessageRequest",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType(t.method)})(Wk||(m.ShowMessageRequest=Wk={}));var Bk;(function(t){t.method="window/logMessage",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolNotificationType(t.method)})(Bk||(m.LogMessageNotification=Bk={}));var Hk;(function(t){t.method="telemetry/event",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolNotificationType(t.method)})(Hk||(m.TelemetryEventNotification=Hk={}));var Gk;(function(t){t.None=0,t.Full=1,t.Incremental=2})(Gk||(m.TextDocumentSyncKind=Gk={}));var zk;(function(t){t.method="textDocument/didOpen",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(zk||(m.DidOpenTextDocumentNotification=zk={}));var Kk;(function(t){function e(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}t.isIncremental=e;function r(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}t.isFull=r})(Kk||(m.TextDocumentContentChangeEvent=Kk={}));var Vk;(function(t){t.method="textDocument/didChange",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(Vk||(m.DidChangeTextDocumentNotification=Vk={}));var Xk;(function(t){t.method="textDocument/didClose",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(Xk||(m.DidCloseTextDocumentNotification=Xk={}));var Yk;(function(t){t.method="textDocument/didSave",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(Yk||(m.DidSaveTextDocumentNotification=Yk={}));var Jk;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(Jk||(m.TextDocumentSaveReason=Jk={}));var Qk;(function(t){t.method="textDocument/willSave",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(Qk||(m.WillSaveTextDocumentNotification=Qk={}));var Zk;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Zk||(m.WillSaveTextDocumentWaitUntilRequest=Zk={}));var eS;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(eS||(m.DidChangeWatchedFilesNotification=eS={}));var tS;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(tS||(m.FileChangeType=tS={}));var rS;(function(t){function e(r){let n=r;return vt.objectLiteral(n)&&(kk.URI.is(n.baseUri)||kk.WorkspaceFolder.is(n.baseUri))&&vt.string(n.pattern)}t.is=e})(rS||(m.RelativePattern=rS={}));var nS;(function(t){t.Create=1,t.Change=2,t.Delete=4})(nS||(m.WatchKind=nS={}));var iS;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolNotificationType(t.method)})(iS||(m.PublishDiagnosticsNotification=iS={}));var oS;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(oS||(m.CompletionTriggerKind=oS={}));var sS;(function(t){t.method="textDocument/completion",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(sS||(m.CompletionRequest=sS={}));var aS;(function(t){t.method="completionItem/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(aS||(m.CompletionResolveRequest=aS={}));var cS;(function(t){t.method="textDocument/hover",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(cS||(m.HoverRequest=cS={}));var uS;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(uS||(m.SignatureHelpTriggerKind=uS={}));var lS;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(lS||(m.SignatureHelpRequest=lS={}));var dS;(function(t){t.method="textDocument/definition",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(dS||(m.DefinitionRequest=dS={}));var fS;(function(t){t.method="textDocument/references",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(fS||(m.ReferencesRequest=fS={}));var hS;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(hS||(m.DocumentHighlightRequest=hS={}));var pS;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(pS||(m.DocumentSymbolRequest=pS={}));var mS;(function(t){t.method="textDocument/codeAction",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(mS||(m.CodeActionRequest=mS={}));var gS;(function(t){t.method="codeAction/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(gS||(m.CodeActionResolveRequest=gS={}));var yS;(function(t){t.method="workspace/symbol",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(yS||(m.WorkspaceSymbolRequest=yS={}));var vS;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(vS||(m.WorkspaceSymbolResolveRequest=vS={}));var xS;(function(t){t.method="textDocument/codeLens",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(xS||(m.CodeLensRequest=xS={}));var TS;(function(t){t.method="codeLens/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(TS||(m.CodeLensResolveRequest=TS={}));var RS;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType0(t.method)})(RS||(m.CodeLensRefreshRequest=RS={}));var _S;(function(t){t.method="textDocument/documentLink",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(_S||(m.DocumentLinkRequest=_S={}));var bS;(function(t){t.method="documentLink/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(bS||(m.DocumentLinkResolveRequest=bS={}));var CS;(function(t){t.method="textDocument/formatting",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(CS||(m.DocumentFormattingRequest=CS={}));var kS;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(kS||(m.DocumentRangeFormattingRequest=kS={}));var SS;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(SS||(m.DocumentRangesFormattingRequest=SS={}));var ES;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(ES||(m.DocumentOnTypeFormattingRequest=ES={}));var AS;(function(t){t.Identifier=1})(AS||(m.PrepareSupportDefaultBehavior=AS={}));var wS;(function(t){t.method="textDocument/rename",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(wS||(m.RenameRequest=wS={}));var NS;(function(t){t.method="textDocument/prepareRename",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(NS||(m.PrepareRenameRequest=NS={}));var PS;(function(t){t.method="workspace/executeCommand",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(PS||(m.ExecuteCommandRequest=PS={}));var DS;(function(t){t.method="workspace/applyEdit",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType("workspace/applyEdit")})(DS||(m.ApplyWorkspaceEditRequest=DS={}))});var qS=L(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.createProtocolConnection=void 0;var $S=Ki();function I1(t,e,r,n){return $S.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,$S.createMessageConnection)(t,e,r,n)}uf.createProtocolConnection=I1});var jS=L(nr=>{"use strict";var O1=nr&&nr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),lf=nr&&nr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&O1(e,t,r)};Object.defineProperty(nr,"__esModule",{value:!0});nr.LSPErrorCodes=nr.createProtocolConnection=void 0;lf(Ki(),nr);lf((Ii(),gh(fd)),nr);lf($e(),nr);lf(FS(),nr);var L1=qS();Object.defineProperty(nr,"createProtocolConnection",{enumerable:!0,get:function(){return L1.createProtocolConnection}});var US;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(US||(nr.LSPErrorCodes=US={}))});var Xe=L(on=>{"use strict";var M1=on&&on.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),WS=on&&on.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&M1(e,t,r)};Object.defineProperty(on,"__esModule",{value:!0});on.createProtocolConnection=void 0;var F1=xy();WS(xy(),on);WS(jS(),on);function $1(t,e,r,n){return(0,F1.createMessageConnection)(t,e,r,n)}on.createProtocolConnection=$1});var Fy=L(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.SemanticTokensBuilder=si.SemanticTokensDiff=si.SemanticTokensFeature=void 0;var df=Xe(),q1=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(df.SemanticTokensRefreshRequest.type),on:e=>{let r=df.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=df.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=df.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};si.SemanticTokensFeature=q1;var ff=class{constructor(e,r){this.originalSequence=e,this.modifiedSequence=r}computeDiff(){let e=this.originalSequence.length,r=this.modifiedSequence.length,n=0;for(;n<r&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<r&&n<e){let i=e-1,o=r-1;for(;i>=n&&o>=n&&this.originalSequence[i]===this.modifiedSequence[o];)i--,o--;(i<n||o<n)&&(i++,o++);let s=i-n+1,a=this.modifiedSequence.slice(n,o+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:n,deleteCount:s-1}]:[{start:n,deleteCount:s,data:a}]}else return n<r?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};si.SemanticTokensDiff=ff;var My=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,r,n,i,o){let s=e,a=r;this._dataLen>0&&(s-=this._prevLine,s===0&&(a-=this._prevChar)),this._data[this._dataLen++]=s,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=o,this._prevLine=e,this._prevChar=r}get id(){return this._id.toString()}previousResult(e){this.id===e&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new ff(this._prevData,this._data).computeDiff()}:this.build()}};si.SemanticTokensBuilder=My});var BS=L(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.InlineCompletionFeature=void 0;var U1=Xe(),j1=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(U1.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};hf.InlineCompletionFeature=j1});var qy=L(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.TextDocuments=void 0;var Xi=Xe(),$y=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Xi.Emitter,this._onDidOpen=new Xi.Emitter,this._onDidClose=new Xi.Emitter,this._onDidSave=new Xi.Emitter,this._onWillSave=new Xi.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=Xi.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,o);let s=Object.freeze({document:o});this._onDidOpen.fire(s),this._onDidChangeContent.fire(s)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:s}=i;if(s==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=this._syncedDocuments.get(i.uri);a!==void 0&&(a=this._configuration.update(a,o,s),this._syncedDocuments.set(i.uri,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),r.push(e.onDidCloseTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(n.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(n.textDocument.uri);return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),Xi.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};pf.TextDocuments=$y});var jy=L(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.NotebookDocuments=la.NotebookSyncFeature=void 0;var _r=Xe(),HS=qy(),W1=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(_r.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(_r.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(_r.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(_r.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};la.NotebookSyncFeature=W1;var mf=class t{onDidOpenTextDocument(e){return this.openHandler=e,_r.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,_r.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,_r.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};mf.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var Uy=class{constructor(e){e instanceof HS.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new HS.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new _r.Emitter,this._onDidChange=new _r.Emitter,this._onDidSave=new _r.Emitter,this._onDidClose=new _r.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let r=this.notebookCellMap.get(e);return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"?e:e.document,n=this.notebookCellMap.get(r);return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let r=new mf,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let o of i.cellTextDocuments)r.openTextDocument({textDocument:o});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o===void 0)return;o.version=i.notebookDocument.version;let s=o.metadata,a=!1,c=i.change;c.metadata!==void 0&&(a=!0,o.metadata=c.metadata);let u=[],l=[],d=[],f=[];if(c.cells!==void 0){let R=c.cells;if(R.structure!==void 0){let g=R.structure.array;if(o.cells.splice(g.start,g.deleteCount,...g.cells!==void 0?g.cells:[]),R.structure.didOpen!==void 0)for(let h of R.structure.didOpen)r.openTextDocument({textDocument:h}),u.push(h.uri);if(R.structure.didClose)for(let h of R.structure.didClose)r.closeTextDocument({textDocument:h}),l.push(h.uri)}if(R.data!==void 0){let g=new Map(R.data.map(h=>[h.document,h]));for(let h=0;h<=o.cells.length;h++){let _=g.get(o.cells[h].document);if(_!==void 0){let w=o.cells.splice(h,1,_);if(d.push({old:w[0],new:_}),g.delete(_.document),g.size===0)break}}}if(R.textContent!==void 0)for(let g of R.textContent)r.changeTextDocument({textDocument:g.document,contentChanges:g.changes}),f.push(g.document.uri)}this.updateCellMap(o);let p={notebookDocument:o};a&&(p.metadata={old:s,new:o.metadata});let v=[];for(let R of u)v.push(this.getNotebookCell(R));let T=[];for(let R of l)T.push(this.getNotebookCell(R));let k=[];for(let R of f)k.push(this.getNotebookCell(R));(v.length>0||T.length>0||d.length>0||k.length>0)&&(p.cells={added:v,removed:T,changed:{data:d,textContent:k}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o!==void 0){this._onDidClose.fire(o);for(let s of i.cellTextDocuments)r.closeTextDocument({textDocument:s});this.notebookDocuments.delete(i.notebookDocument.uri);for(let s of o.cells)this.notebookCellMap.delete(s.document)}})),_r.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};la.NotebookDocuments=Uy});var Wy=L(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.thenable=at.typedArray=at.stringArray=at.array=at.func=at.error=at.number=at.string=at.boolean=void 0;function B1(t){return t===!0||t===!1}at.boolean=B1;function GS(t){return typeof t=="string"||t instanceof String}at.string=GS;function H1(t){return typeof t=="number"||t instanceof Number}at.number=H1;function G1(t){return t instanceof Error}at.error=G1;function zS(t){return typeof t=="function"}at.func=zS;function KS(t){return Array.isArray(t)}at.array=KS;function z1(t){return KS(t)&&t.every(e=>GS(e))}at.stringArray=z1;function K1(t,e){return Array.isArray(t)&&t.every(e)}at.typedArray=K1;function V1(t){return t&&zS(t.then)}at.thenable=V1});var By=L(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.generateUuid=br.parse=br.isUUID=br.v4=br.empty=void 0;var mu=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},gu=class t extends mu{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return t._oneOf(t._chars)}constructor(){super([t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-","4",t._randomHex(),t._randomHex(),t._randomHex(),"-",t._oneOf(t._timeHighBits),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex()].join(""))}};gu._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];gu._timeHighBits=["8","9","a","b"];br.empty=new mu("00000000-0000-0000-0000-000000000000");function VS(){return new gu}br.v4=VS;var X1=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function XS(t){return X1.test(t)}br.isUUID=XS;function Y1(t){if(!XS(t))throw new Error("invalid uuid");return new mu(t)}br.parse=Y1;function J1(){return VS().asHex()}br.generateUuid=J1});var YS=L(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.attachPartialResult=ci.ProgressFeature=ci.attachWorkDone=void 0;var ai=Xe(),Q1=By(),Yi=class t{constructor(e,r){this._connection=e,this._token=r,t.Instances.set(this._token,this)}begin(e,r,n,i){let o={kind:"begin",title:e,percentage:r,message:n,cancellable:i};this._connection.sendProgress(ai.WorkDoneProgress.type,this._token,o)}report(e,r){let n={kind:"report"};typeof e=="number"?(n.percentage=e,r!==void 0&&(n.message=r)):n.message=e,this._connection.sendProgress(ai.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(ai.WorkDoneProgress.type,this._token,{kind:"end"})}};Yi.Instances=new Map;var gf=class extends Yi{constructor(e,r){super(e,r),this._source=new ai.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},yu=class{constructor(){}begin(){}report(){}done(){}},yf=class extends yu{constructor(){super(),this._source=new ai.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function Z1(t,e){if(e===void 0||e.workDoneToken===void 0)return new yu;let r=e.workDoneToken;return delete e.workDoneToken,new Yi(t,r)}ci.attachWorkDone=Z1;var e$=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(ai.WorkDoneProgressCancelNotification.type,r=>{let n=Yi.Instances.get(r.token);(n instanceof gf||n instanceof yf)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new yu:new Yi(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,Q1.generateUuid)();return this.connection.sendRequest(ai.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new gf(this.connection,e))}else return Promise.resolve(new yf)}};ci.ProgressFeature=e$;var Hy;(function(t){t.type=new ai.ProgressType})(Hy||(Hy={}));var Gy=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(Hy.type,this._token,e)}};function t$(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new Gy(t,r)}ci.attachPartialResult=t$});var JS=L(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.ConfigurationFeature=void 0;var r$=Xe(),n$=Wy(),i$=t=>class extends t{getConfiguration(e){return e?n$.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let r={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(r$.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};vf.ConfigurationFeature=i$});var QS=L(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.WorkspaceFoldersFeature=void 0;var xf=Xe(),o$=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new xf.Emitter,this.connection.onNotification(xf.DidChangeWorkspaceFoldersNotification.type,n=>{this._onDidChangeWorkspaceFolders.fire(n.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let r=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=r===!0||typeof r=="string"}getWorkspaceFolders(){return this.connection.sendRequest(xf.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(xf.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Tf.WorkspaceFoldersFeature=o$});var ZS=L(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.CallHierarchyFeature=void 0;var zy=Xe(),s$=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(zy.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=zy.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=zy.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Rf.CallHierarchyFeature=s$});var eE=L(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.ShowDocumentFeature=void 0;var a$=Xe(),c$=t=>class extends t{showDocument(e){return this.connection.sendRequest(a$.ShowDocumentRequest.type,e)}};_f.ShowDocumentFeature=c$});var tE=L(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.FileOperationsFeature=void 0;var da=Xe(),u$=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(da.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(da.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(da.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(da.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(da.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(da.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};bf.FileOperationsFeature=u$});var rE=L(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.LinkedEditingRangeFeature=void 0;var l$=Xe(),d$=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(l$.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};Cf.LinkedEditingRangeFeature=d$});var nE=L(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.TypeHierarchyFeature=void 0;var Ky=Xe(),f$=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(Ky.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=Ky.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=Ky.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};kf.TypeHierarchyFeature=f$});var oE=L(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.InlineValueFeature=void 0;var iE=Xe(),h$=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(iE.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(iE.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Sf.InlineValueFeature=h$});var aE=L(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.FoldingRangeFeature=void 0;var sE=Xe(),p$=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(sE.FoldingRangeRefreshRequest.type),on:e=>{let r=sE.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Ef.FoldingRangeFeature=p$});var cE=L(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.InlayHintFeature=void 0;var Vy=Xe(),m$=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Vy.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Vy.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(Vy.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Af.InlayHintFeature=m$});var uE=L(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.DiagnosticFeature=void 0;var vu=Xe(),g$=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(vu.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(vu.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(vu.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(vu.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(vu.WorkspaceDiagnosticRequest.partialResult,r)))}}};wf.DiagnosticFeature=g$});var lE=L(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.MonikerFeature=void 0;var y$=Xe(),v$=t=>class extends t{get moniker(){return{on:e=>{let r=y$.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Nf.MonikerFeature=v$});var kE=L(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.createConnection=le.combineFeatures=le.combineNotebooksFeatures=le.combineLanguagesFeatures=le.combineWorkspaceFeatures=le.combineWindowFeatures=le.combineClientFeatures=le.combineTracerFeatures=le.combineTelemetryFeatures=le.combineConsoleFeatures=le._NotebooksImpl=le._LanguagesImpl=le.BulkUnregistration=le.BulkRegistration=le.ErrorMessageTracker=void 0;var D=Xe(),Cr=Wy(),Yy=By(),X=YS(),x$=JS(),T$=QS(),R$=ZS(),_$=Fy(),b$=eE(),C$=tE(),k$=rE(),S$=nE(),E$=oE(),A$=aE(),w$=cE(),N$=uE(),P$=jy(),D$=lE();function Xy(t){if(t!==null)return t}var Jy=class{constructor(){this._messages=Object.create(null)}add(e){let r=this._messages[e];r||(r=0),r++,this._messages[e]=r}sendErrors(e){Object.keys(this._messages).forEach(r=>{e.window.showErrorMessage(r)})}};le.ErrorMessageTracker=Jy;var Pf=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(D.MessageType.Error,e)}warn(e){this.send(D.MessageType.Warning,e)}info(e){this.send(D.MessageType.Info,e)}log(e){this.send(D.MessageType.Log,e)}debug(e){this.send(D.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(D.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,D.RAL)().console.error("Sending log message failed")})}},Qy=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...r){let n={type:D.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(D.ShowMessageRequest.type,n).then(Xy)}showWarningMessage(e,...r){let n={type:D.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(D.ShowMessageRequest.type,n).then(Xy)}showInformationMessage(e,...r){let n={type:D.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(D.ShowMessageRequest.type,n).then(Xy)}},dE=(0,b$.ShowDocumentFeature)((0,X.ProgressFeature)(Qy)),fE;(function(t){function e(){return new Df}t.create=e})(fE||(le.BulkRegistration=fE={}));var Df=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=Cr.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=Yy.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},hE;(function(t){function e(){return new xu(void 0,[])}t.create=e})(hE||(le.BulkUnregistration=hE={}));var xu=class{constructor(e,r){this._connection=e,this._unregistrations=new Map,r.forEach(n=>{this._unregistrations.set(n.method,n)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let n of this._unregistrations.values())e.push(n);let r={unregisterations:e};this._connection.sendRequest(D.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=Cr.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(D.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},o=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},If=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,r,n){return e instanceof Df?this.registerMany(e):e instanceof xu?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=Cr.string(r)?r:r.method,o=Yy.generateUuid(),s={registrations:[{id:o,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(D.RegistrationRequest.type,s).then(a=>(e.add({id:o,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,r){let n=Cr.string(e)?e:e.method,i=Yy.generateUuid(),o={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(D.RegistrationRequest.type,o).then(s=>D.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),s=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(s)))}unregisterSingle(e,r){let n={unregisterations:[{id:e,method:r}]};return this.connection.sendRequest(D.UnregistrationRequest.type,n).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let r=e.asRegistrationParams();return this.connection.sendRequest(D.RegistrationRequest.type,r).then(()=>new xu(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Zy=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function r(i){return i&&!!i.edit}let n=r(e)?e:{edit:e};return this.connection.sendRequest(D.ApplyWorkspaceEditRequest.type,n)}},pE=(0,C$.FileOperationsFeature)((0,T$.WorkspaceFoldersFeature)((0,x$.ConfigurationFeature)(Zy))),Of=class{constructor(){this._trace=D.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,r){this._trace!==D.Trace.Off&&this.connection.sendNotification(D.LogTraceNotification.type,{message:e,verbose:this._trace===D.Trace.Verbose?r:void 0}).catch(()=>{})}},Lf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(D.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},Mf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,X.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,X.attachPartialResult)(this.connection,r)}};le._LanguagesImpl=Mf;var mE=(0,A$.FoldingRangeFeature)((0,D$.MonikerFeature)((0,N$.DiagnosticFeature)((0,w$.InlayHintFeature)((0,E$.InlineValueFeature)((0,S$.TypeHierarchyFeature)((0,k$.LinkedEditingRangeFeature)((0,_$.SemanticTokensFeature)((0,R$.CallHierarchyFeature)(Mf))))))))),Ff=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,X.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,X.attachPartialResult)(this.connection,r)}};le._NotebooksImpl=Ff;var gE=(0,P$.NotebookSyncFeature)(Ff);function yE(t,e){return function(r){return e(t(r))}}le.combineConsoleFeatures=yE;function vE(t,e){return function(r){return e(t(r))}}le.combineTelemetryFeatures=vE;function xE(t,e){return function(r){return e(t(r))}}le.combineTracerFeatures=xE;function TE(t,e){return function(r){return e(t(r))}}le.combineClientFeatures=TE;function RE(t,e){return function(r){return e(t(r))}}le.combineWindowFeatures=RE;function _E(t,e){return function(r){return e(t(r))}}le.combineWorkspaceFeatures=_E;function bE(t,e){return function(r){return e(t(r))}}le.combineLanguagesFeatures=bE;function CE(t,e){return function(r){return e(t(r))}}le.combineNotebooksFeatures=CE;function I$(t,e){function r(i,o,s){return i&&o?s(i,o):i||o}return{__brand:"features",console:r(t.console,e.console,yE),tracer:r(t.tracer,e.tracer,xE),telemetry:r(t.telemetry,e.telemetry,vE),client:r(t.client,e.client,TE),window:r(t.window,e.window,RE),workspace:r(t.workspace,e.workspace,_E),languages:r(t.languages,e.languages,bE),notebooks:r(t.notebooks,e.notebooks,CE)}}le.combineFeatures=I$;function O$(t,e,r){let n=r&&r.console?new(r.console(Pf)):new Pf,i=t(n);n.rawAttach(i);let o=r&&r.tracer?new(r.tracer(Of)):new Of,s=r&&r.telemetry?new(r.telemetry(Lf)):new Lf,a=r&&r.client?new(r.client(If)):new If,c=r&&r.window?new(r.window(dE)):new dE,u=r&&r.workspace?new(r.workspace(pE)):new pE,l=r&&r.languages?new(r.languages(mE)):new mE,d=r&&r.notebooks?new(r.notebooks(gE)):new gE,f=[n,o,s,a,c,u,l,d];function p(g){return g instanceof Promise?g:Cr.thenable(g)?new Promise((h,_)=>{g.then(w=>h(w),w=>_(w))}):Promise.resolve(g)}let v,T,k,R={listen:()=>i.listen(),sendRequest:(g,...h)=>i.sendRequest(Cr.string(g)?g:g.method,...h),onRequest:(g,h)=>i.onRequest(g,h),sendNotification:(g,h)=>{let _=Cr.string(g)?g:g.method;return i.sendNotification(_,h)},onNotification:(g,h)=>i.onNotification(g,h),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:g=>(T=g,{dispose:()=>{T=void 0}}),onInitialized:g=>i.onNotification(D.InitializedNotification.type,g),onShutdown:g=>(v=g,{dispose:()=>{v=void 0}}),onExit:g=>(k=g,{dispose:()=>{k=void 0}}),get console(){return n},get telemetry(){return s},get tracer(){return o},get client(){return a},get window(){return c},get workspace(){return u},get languages(){return l},get notebooks(){return d},onDidChangeConfiguration:g=>i.onNotification(D.DidChangeConfigurationNotification.type,g),onDidChangeWatchedFiles:g=>i.onNotification(D.DidChangeWatchedFilesNotification.type,g),__textDocumentSync:void 0,onDidOpenTextDocument:g=>i.onNotification(D.DidOpenTextDocumentNotification.type,g),onDidChangeTextDocument:g=>i.onNotification(D.DidChangeTextDocumentNotification.type,g),onDidCloseTextDocument:g=>i.onNotification(D.DidCloseTextDocumentNotification.type,g),onWillSaveTextDocument:g=>i.onNotification(D.WillSaveTextDocumentNotification.type,g),onWillSaveTextDocumentWaitUntil:g=>i.onRequest(D.WillSaveTextDocumentWaitUntilRequest.type,g),onDidSaveTextDocument:g=>i.onNotification(D.DidSaveTextDocumentNotification.type,g),sendDiagnostics:g=>i.sendNotification(D.PublishDiagnosticsNotification.type,g),onHover:g=>i.onRequest(D.HoverRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onCompletion:g=>i.onRequest(D.CompletionRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onCompletionResolve:g=>i.onRequest(D.CompletionResolveRequest.type,g),onSignatureHelp:g=>i.onRequest(D.SignatureHelpRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onDeclaration:g=>i.onRequest(D.DeclarationRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onDefinition:g=>i.onRequest(D.DefinitionRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onTypeDefinition:g=>i.onRequest(D.TypeDefinitionRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onImplementation:g=>i.onRequest(D.ImplementationRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onReferences:g=>i.onRequest(D.ReferencesRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onDocumentHighlight:g=>i.onRequest(D.DocumentHighlightRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onDocumentSymbol:g=>i.onRequest(D.DocumentSymbolRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onWorkspaceSymbol:g=>i.onRequest(D.WorkspaceSymbolRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onWorkspaceSymbolResolve:g=>i.onRequest(D.WorkspaceSymbolResolveRequest.type,g),onCodeAction:g=>i.onRequest(D.CodeActionRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onCodeActionResolve:g=>i.onRequest(D.CodeActionResolveRequest.type,(h,_)=>g(h,_)),onCodeLens:g=>i.onRequest(D.CodeLensRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onCodeLensResolve:g=>i.onRequest(D.CodeLensResolveRequest.type,(h,_)=>g(h,_)),onDocumentFormatting:g=>i.onRequest(D.DocumentFormattingRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onDocumentRangeFormatting:g=>i.onRequest(D.DocumentRangeFormattingRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onDocumentOnTypeFormatting:g=>i.onRequest(D.DocumentOnTypeFormattingRequest.type,(h,_)=>g(h,_)),onRenameRequest:g=>i.onRequest(D.RenameRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onPrepareRename:g=>i.onRequest(D.PrepareRenameRequest.type,(h,_)=>g(h,_)),onDocumentLinks:g=>i.onRequest(D.DocumentLinkRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onDocumentLinkResolve:g=>i.onRequest(D.DocumentLinkResolveRequest.type,(h,_)=>g(h,_)),onDocumentColor:g=>i.onRequest(D.DocumentColorRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onColorPresentation:g=>i.onRequest(D.ColorPresentationRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onFoldingRanges:g=>i.onRequest(D.FoldingRangeRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onSelectionRanges:g=>i.onRequest(D.SelectionRangeRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onExecuteCommand:g=>i.onRequest(D.ExecuteCommandRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),dispose:()=>i.dispose()};for(let g of f)g.attach(R);return i.onRequest(D.InitializeRequest.type,g=>{e.initialize(g),Cr.string(g.trace)&&(o.trace=D.Trace.fromString(g.trace));for(let h of f)h.initialize(g.capabilities);if(T){let h=T(g,new D.CancellationTokenSource().token,(0,X.attachWorkDone)(i,g),void 0);return p(h).then(_=>{if(_ instanceof D.ResponseError)return _;let w=_;w||(w={capabilities:{}});let J=w.capabilities;J||(J={},w.capabilities=J),J.textDocumentSync===void 0||J.textDocumentSync===null?J.textDocumentSync=Cr.number(R.__textDocumentSync)?R.__textDocumentSync:D.TextDocumentSyncKind.None:!Cr.number(J.textDocumentSync)&&!Cr.number(J.textDocumentSync.change)&&(J.textDocumentSync.change=Cr.number(R.__textDocumentSync)?R.__textDocumentSync:D.TextDocumentSyncKind.None);for(let Bt of f)Bt.fillServerCapabilities(J);return w})}else{let h={capabilities:{textDocumentSync:D.TextDocumentSyncKind.None}};for(let _ of f)_.fillServerCapabilities(h.capabilities);return h}}),i.onRequest(D.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,v)return v(new D.CancellationTokenSource().token)}),i.onNotification(D.ExitNotification.type,()=>{try{k&&k()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(D.SetTraceNotification.type,g=>{o.trace=D.Trace.fromString(g.value)}),R}le.createConnection=O$});var ev=L(It=>{"use strict";var L$=It&&It.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),EE=It&&It.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&L$(e,t,r)};Object.defineProperty(It,"__esModule",{value:!0});It.ProposedFeatures=It.NotebookDocuments=It.TextDocuments=It.SemanticTokensBuilder=void 0;var M$=Fy();Object.defineProperty(It,"SemanticTokensBuilder",{enumerable:!0,get:function(){return M$.SemanticTokensBuilder}});var F$=BS();EE(Xe(),It);var $$=qy();Object.defineProperty(It,"TextDocuments",{enumerable:!0,get:function(){return $$.TextDocuments}});var q$=jy();Object.defineProperty(It,"NotebookDocuments",{enumerable:!0,get:function(){return q$.NotebookDocuments}});EE(kE(),It);var SE;(function(t){t.all={__brand:"features",languages:F$.InlineCompletionFeature}})(SE||(It.ProposedFeatures=SE={}))});var wE=L((Tee,AE)=>{"use strict";AE.exports=Xe()});var an=L(sn=>{"use strict";var U$=sn&&sn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),PE=sn&&sn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&U$(e,t,r)};Object.defineProperty(sn,"__esModule",{value:!0});sn.createConnection=void 0;var $f=ev();PE(wE(),sn);PE(ev(),sn);var NE=!1,j$={initialize:t=>{},get shutdownReceived(){return NE},set shutdownReceived(t){NE=t},exit:t=>{}};function W$(t,e,r,n){let i,o,s,a;t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),$f.ConnectionStrategy.is(t)||$f.ConnectionOptions.is(t)?a=t:(o=t,s=e,a=r);let c=u=>(0,$f.createProtocolConnection)(o,s,u,a);return(0,$f.createConnection)(c,j$,i)}sn.createConnection=W$});var Ke={};En(Ke,{AbstractAstReflection:()=>ui,AbstractCstNode:()=>xc,AbstractLangiumParser:()=>Tc,AbstractParserErrorMessageProvider:()=>pd,AbstractThreadedAsyncParser:()=>hg,AstUtils:()=>Uu,BiMap:()=>qi,Cancellation:()=>B,CompositeCstNodeImpl:()=>Li,ContextCache:()=>Ui,CstNodeBuilder:()=>vc,CstUtils:()=>Ou,DEFAULT_TOKENIZE_OPTIONS:()=>kd,DONE_RESULT:()=>St,DatatypeSymbol:()=>hd,DefaultAstNodeDescriptionProvider:()=>qc,DefaultAstNodeLocator:()=>jc,DefaultAsyncParser:()=>Zc,DefaultCommentProvider:()=>Qc,DefaultConfigurationProvider:()=>Wc,DefaultDocumentBuilder:()=>Bc,DefaultDocumentValidator:()=>Wi,DefaultHydrator:()=>tu,DefaultIndexManager:()=>Hc,DefaultJsonSerializer:()=>Lc,DefaultLangiumDocumentFactory:()=>Sc,DefaultLangiumDocuments:()=>Ec,DefaultLexer:()=>Bi,DefaultLexerErrorMessageProvider:()=>zc,DefaultLinker:()=>Ac,DefaultNameProvider:()=>wc,DefaultReferenceDescriptionProvider:()=>Uc,DefaultReferences:()=>Nc,DefaultScopeComputation:()=>Pc,DefaultScopeProvider:()=>Oc,DefaultServiceRegistry:()=>Fc,DefaultTokenBuilder:()=>Fi,DefaultValueConverter:()=>Cc,DefaultWorkspaceLock:()=>eu,DefaultWorkspaceManager:()=>Gc,Deferred:()=>Wt,Disposable:()=>Jn,DisposableCache:()=>Gs,DocumentCache:()=>bd,DocumentState:()=>xe,DocumentValidator:()=>xr,EMPTY_SCOPE:()=>FF,EMPTY_STREAM:()=>va,EmptyFileSystem:()=>ou,EmptyFileSystemProvider:()=>Pd,ErrorWithLocation:()=>hi,GrammarAST:()=>gi,GrammarUtils:()=>Gu,IndentationAwareLexer:()=>gg,IndentationAwareTokenBuilder:()=>Nd,JSDocDocumentationProvider:()=>Jc,LangiumCompletionParser:()=>_c,LangiumParser:()=>Rc,LangiumParserErrorMessageProvider:()=>qs,LeafCstNodeImpl:()=>Oi,LexingMode:()=>Gi,MapScope:()=>Dc,Module:()=>Vs,MultiMap:()=>Pr,OperationCancelled:()=>Zr,ParserWorker:()=>pg,Reduction:()=>Zi,RegExpUtils:()=>Bu,RootCstNodeImpl:()=>$s,SimpleCache:()=>Ic,StreamImpl:()=>or,StreamScope:()=>Hs,TextDocument:()=>Yn,TreeStreamImpl:()=>Lr,URI:()=>tt,UriUtils:()=>oe,ValidationCategory:()=>Ks,ValidationRegistry:()=>$c,ValueConverter:()=>Qr,WorkspaceCache:()=>zs,assertUnreachable:()=>Fr,createCompletionParser:()=>Jm,createDefaultCoreModule:()=>ru,createDefaultSharedCoreModule:()=>nu,createGrammarConfig:()=>op,createLangiumParser:()=>Qm,createParser:()=>bc,delayNextTick:()=>og,diagnosticData:()=>ji,eagerLoad:()=>iu,getDiagnosticRange:()=>ub,indentationBuilderDefaultOptions:()=>mg,inject:()=>Hi,interruptAndCheck:()=>Be,isAstNode:()=>we,isAstNodeDescription:()=>yh,isAstNodeWithComment:()=>Mc,isCompositeCstNode:()=>Er,isIMultiModeLexerDefinition:()=>ug,isJSDoc:()=>Yc,isLeafCstNode:()=>An,isLinkingError:()=>li,isNamed:()=>_d,isOperationCancelled:()=>en,isReference:()=>Rt,isRootCstNode:()=>ya,isTokenTypeArray:()=>Sd,isTokenTypeDictionary:()=>cg,loadGrammarFromJson:()=>Dd,parseJSDoc:()=>Xc,prepareLangiumParser:()=>Q_,setInterruptionPeriod:()=>nb,startCancelableOperation:()=>Td,stream:()=>Z,toDiagnosticData:()=>lb,toDiagnosticSeverity:()=>Cd});var Ou={};En(Ou,{DefaultNameRegexp:()=>Iu,RangeComparison:()=>Mr,compareRange:()=>yv,findCommentNode:()=>xa,findDeclarationNodeAtOffset:()=>Kt,findLeafNodeAtOffset:()=>_h,findLeafNodeBeforeOffset:()=>Ta,flattenCst:()=>xh,getInteriorNodes:()=>yA,getNextNode:()=>mA,getPreviousNode:()=>xv,getStartlineNode:()=>gA,inRange:()=>Rh,isChildNode:()=>Th,isCommentNode:()=>vh,streamCst:()=>di,toDocumentSegment:()=>fi,tokenToRange:()=>eo});function we(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Rt(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function yh(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function li(t){return typeof t=="object"&&t!==null&&we(t.container)&&Rt(t.reference)&&typeof t.message=="string"}var ui=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,r){return we(e)&&this.isSubtype(e.$type,r)}isSubtype(e,r){if(e===r)return!0;let n=this.subtypes[e];n||(n=this.subtypes[e]={});let i=n[r];if(i!==void 0)return i;{let o=this.computeIsSubtype(e,r);return n[r]=o,o}}getAllSubTypes(e){let r=this.allSubtypes[e];if(r)return r;{let n=this.getAllTypes(),i=[];for(let o of n)this.isSubtype(o,e)&&i.push(o);return this.allSubtypes[e]=i,i}}};function Er(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function An(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function ya(t){return Er(t)&&typeof t.fullText=="string"}var or=class t{constructor(e,r){this.startFn=e,this.nextFn=r}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let e=this.iterator(),r=0,n=e.next();for(;!n.done;)r++,n=e.next();return r}toArray(){let e=[],r=this.iterator(),n;do n=r.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,r){let n=this.map(i=>[e?e(i):i,r?r(i):i]);return new Map(n)}toString(){return this.join()}concat(e){return new t(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),r=>{let n;if(!r.firstDone){do if(n=this.nextFn(r.first),!n.done)return n;while(!n.done);r.firstDone=!0}do if(n=r.iterator.next(),!n.done)return n;while(!n.done);return St})}join(e=","){let r=this.iterator(),n="",i,o=!1;do i=r.next(),i.done||(o&&(n+=e),n+=pA(i.value)),o=!0;while(!i.done);return n}indexOf(e,r=0){let n=this.iterator(),i=0,o=n.next();for(;!o.done;){if(i>=r&&o.value===e)return i;o=n.next(),i++}return-1}every(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(!e(n.value))return!1;n=r.next()}return!0}some(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return!0;n=r.next()}return!1}forEach(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;)e(i.value,n),i=r.next(),n++}map(e){return new t(this.startFn,r=>{let{done:n,value:i}=this.nextFn(r);return n?St:{done:!1,value:e(i)}})}filter(e){return new t(this.startFn,r=>{let n;do if(n=this.nextFn(r),!n.done&&e(n.value))return n;while(!n.done);return St})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,r){let n=this.iterator(),i=r,o=n.next();for(;!o.done;)i===void 0?i=o.value:i=e(i,o.value),o=n.next();return i}reduceRight(e,r){return this.recursiveReduce(this.iterator(),e,r)}recursiveReduce(e,r,n){let i=e.next();if(i.done)return n;let o=this.recursiveReduce(e,r,n);return o===void 0?i.value:r(o,i.value)}find(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return n.value;n=r.next()}}findIndex(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;){if(e(i.value))return n;i=r.next(),n++}return-1}includes(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(n.value===e)return!0;n=r.next()}return!1}flatMap(e){return new t(()=>({this:this.startFn()}),r=>{do{if(r.iterator){let o=r.iterator.next();if(o.done)r.iterator=void 0;else return o}let{done:n,value:i}=this.nextFn(r.this);if(!n){let o=e(i);if(Du(o))r.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}}while(r.iterator);return St})}flat(e){if(e===void 0&&(e=1),e<=0)return this;let r=e>1?this.flat(e-1):this;return new t(()=>({this:r.startFn()}),n=>{do{if(n.iterator){let s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}let{done:i,value:o}=r.nextFn(n.this);if(!i)if(Du(o))n.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}while(n.iterator);return St})}head(){let r=this.iterator().next();if(!r.done)return r.value}tail(e=1){return new t(()=>{let r=this.startFn();for(let n=0;n<e;n++)if(this.nextFn(r).done)return r;return r},this.nextFn)}limit(e){return new t(()=>({size:0,state:this.startFn()}),r=>(r.size++,r.size>e?St:this.nextFn(r.state)))}distinct(e){return new t(()=>({set:new Set,internalState:this.startFn()}),r=>{let n;do if(n=this.nextFn(r.internalState),!n.done){let i=e?e(n.value):n.value;if(!r.set.has(i))return r.set.add(i),n}while(!n.done);return St})}exclude(e,r){let n=new Set;for(let i of e){let o=r?r(i):i;n.add(o)}return this.filter(i=>{let o=r?r(i):i;return!n.has(o)})}};function pA(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function Du(t){return!!t&&typeof t[Symbol.iterator]=="function"}var va=new or(()=>{},()=>St),St=Object.freeze({done:!0,value:void 0});function Z(...t){if(t.length===1){let e=t[0];if(e instanceof or)return e;if(Du(e))return new or(()=>e[Symbol.iterator](),r=>r.next());if(typeof e.length=="number")return new or(()=>({index:0}),r=>r.index<e.length?{done:!1,value:e[r.index++]}:St)}return t.length>1?new or(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){let r=e.iterator.next();if(!r.done)return r;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){let r=t[e.collIndex++];Du(r)?e.iterator=r[Symbol.iterator]():r&&typeof r.length=="number"&&(e.array=r)}}while(e.iterator||e.array||e.collIndex<t.length);return St}):va}var Lr=class extends or{constructor(e,r,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[r(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let s=i.iterators[i.iterators.length-1].next();if(s.done)i.iterators.pop();else return i.iterators.push(r(s.value)[Symbol.iterator]()),s}return St})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}},Zi;(function(t){function e(o){return o.reduce((s,a)=>s+a,0)}t.sum=e;function r(o){return o.reduce((s,a)=>s*a,0)}t.product=r;function n(o){return o.reduce((s,a)=>Math.min(s,a))}t.min=n;function i(o){return o.reduce((s,a)=>Math.max(s,a))}t.max=i})(Zi||(Zi={}));function di(t){return new Lr(t,e=>Er(e)?e.content:[],{includeRoot:!0})}function xh(t){return di(t).filter(An)}function Th(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function eo(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function fi(t){if(!t)return;let{offset:e,end:r,range:n}=t;return{range:n,offset:e,end:r,length:r-e}}var Mr;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside",t[t.Outside=5]="Outside"})(Mr||(Mr={}));function yv(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return Mr.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return Mr.After;let r=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,n=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return r&&n?Mr.Inside:r?Mr.OverlapBack:n?Mr.OverlapFront:Mr.Outside}function Rh(t,e){return yv(t,e)>Mr.After}var Iu=/^[\w\p{L}]$/u;function Kt(t,e,r=Iu){if(t){if(e>0){let n=e-t.offset,i=t.text.charAt(n);r.test(i)||e--}return _h(t,e)}}function xa(t,e){if(t){let r=xv(t,!0);if(r&&vh(r,e))return r;if(ya(t)){let n=t.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let o=t.content[i];if(vh(o,e))return o}}}}function vh(t,e){return An(t)&&e.includes(t.tokenType.name)}function _h(t,e){if(An(t))return t;if(Er(t)){let r=vv(t,e,!1);if(r)return _h(r,e)}}function Ta(t,e){if(An(t))return t;if(Er(t)){let r=vv(t,e,!0);if(r)return Ta(r,e)}}function vv(t,e,r){let n=0,i=t.content.length-1,o;for(;n<=i;){let s=Math.floor((n+i)/2),a=t.content[s];if(a.offset<=e&&a.end>e)return a;a.end<=e?(o=r?a:void 0,n=s+1):i=s-1}return o}function xv(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t);for(;n>0;){n--;let i=r.content[n];if(e||!i.hidden)return i}t=r}}function mA(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t),i=r.content.length-1;for(;n<i;){n++;let o=r.content[n];if(e||!o.hidden)return o}t=r}}function gA(t){if(t.range.start.character===0)return t;let e=t.range.start.line,r=t,n;for(;t.container;){let i=t.container,o=n??i.content.indexOf(t);if(o===0?(t=i,n=void 0):(n=o-1,t=i.content[n]),t.range.start.line!==e)break;r=t}return r}function yA(t,e){let r=vA(t,e);return r?r.parent.content.slice(r.a+1,r.b):[]}function vA(t,e){let r=gv(t),n=gv(e),i;for(let o=0;o<r.length&&o<n.length;o++){let s=r[o],a=n[o];if(s.parent===a.parent)i={parent:s.parent,a:s.index,b:a.index};else break}return i}function gv(t){let e=[];for(;t.container;){let r=t.container,n=r.content.indexOf(t);e.push({parent:r,index:n}),t=r}return e.reverse()}var Gu={};En(Gu,{findAssignment:()=>tp,findNameAssignment:()=>Hu,findNodeForKeyword:()=>Zh,findNodeForProperty:()=>$a,findNodesForKeyword:()=>UA,findNodesForKeywordInternal:()=>ep,findNodesForProperty:()=>Jh,getActionAtElement:()=>Av,getActionType:()=>Nv,getAllReachableRules:()=>Ma,getAllRulesUsedForCrossReferences:()=>qA,getCrossReferenceTerminal:()=>Fa,getEntryRule:()=>La,getExplicitRuleType:()=>qr,getHiddenRules:()=>kv,getRuleType:()=>np,getRuleTypeName:()=>BA,getTypeName:()=>_i,isArrayCardinality:()=>rp,isArrayOperator:()=>jA,isCommentTerminal:()=>Yh,isDataType:()=>WA,isDataTypeRule:()=>qa,isOptionalCardinality:()=>Ri,terminalRegex:()=>Nn});var hi=class extends Error{constructor(e,r){super(e?`${r} at ${e.range.start.line}:${e.range.start.character}`:r)}};function Fr(t){throw new Error("Error! The input value was not handled.")}var gi={};En(gi,{AbstractElement:()=>no,AbstractRule:()=>to,AbstractType:()=>ro,Action:()=>bo,Alternatives:()=>Co,ArrayLiteral:()=>io,ArrayType:()=>oo,Assignment:()=>ko,BooleanLiteral:()=>so,CharacterRange:()=>So,Condition:()=>Ra,Conjunction:()=>ao,CrossReference:()=>Eo,Disjunction:()=>co,EndOfFile:()=>Ao,Grammar:()=>uo,GrammarImport:()=>ba,Group:()=>wo,InferredType:()=>lo,Interface:()=>fo,Keyword:()=>No,LangiumGrammarAstReflection:()=>Uo,LangiumGrammarTerminals:()=>xA,NamedArgument:()=>Ca,NegatedToken:()=>Po,Negation:()=>ho,NumberLiteral:()=>po,Parameter:()=>mo,ParameterReference:()=>go,ParserRule:()=>yo,ReferenceType:()=>vo,RegexToken:()=>Do,ReturnType:()=>ka,RuleCall:()=>Io,SimpleType:()=>xo,StringLiteral:()=>To,TerminalAlternatives:()=>Oo,TerminalGroup:()=>Lo,TerminalRule:()=>pi,TerminalRuleCall:()=>Mo,Type:()=>Ro,TypeAttribute:()=>Sa,TypeDefinition:()=>Lu,UnionType:()=>_o,UnorderedGroup:()=>Fo,UntilToken:()=>$o,ValueLiteral:()=>_a,Wildcard:()=>qo,isAbstractElement:()=>mi,isAbstractRule:()=>TA,isAbstractType:()=>RA,isAction:()=>Ar,isAlternatives:()=>jo,isArrayLiteral:()=>SA,isArrayType:()=>bh,isAssignment:()=>Et,isBooleanLiteral:()=>Ch,isCharacterRange:()=>Dh,isCondition:()=>_A,isConjunction:()=>kh,isCrossReference:()=>sr,isDisjunction:()=>Sh,isEndOfFile:()=>Ih,isFeatureName:()=>bA,isGrammar:()=>EA,isGrammarImport:()=>AA,isGroup:()=>pr,isInferredType:()=>Ea,isInterface:()=>Mu,isKeyword:()=>lt,isNamedArgument:()=>wA,isNegatedToken:()=>Oh,isNegation:()=>Eh,isNumberLiteral:()=>NA,isParameter:()=>PA,isParameterReference:()=>Ah,isParserRule:()=>Ie,isPrimitiveType:()=>Tv,isReferenceType:()=>wh,isRegexToken:()=>Lh,isReturnType:()=>Nh,isRuleCall:()=>Vt,isSimpleType:()=>Fu,isStringLiteral:()=>DA,isTerminalAlternatives:()=>Mh,isTerminalGroup:()=>Fh,isTerminalRule:()=>Mt,isTerminalRuleCall:()=>$u,isType:()=>Aa,isTypeAttribute:()=>IA,isTypeDefinition:()=>CA,isUnionType:()=>Ph,isUnorderedGroup:()=>Wo,isUntilToken:()=>$h,isValueLiteral:()=>kA,isWildcard:()=>qh,reflection:()=>V});var xA={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},to="AbstractRule";function TA(t){return V.isInstance(t,to)}var ro="AbstractType";function RA(t){return V.isInstance(t,ro)}var Ra="Condition";function _A(t){return V.isInstance(t,Ra)}function bA(t){return Tv(t)||t==="current"||t==="entry"||t==="extends"||t==="false"||t==="fragment"||t==="grammar"||t==="hidden"||t==="import"||t==="interface"||t==="returns"||t==="terminal"||t==="true"||t==="type"||t==="infer"||t==="infers"||t==="with"||typeof t=="string"&&/\^?[_a-zA-Z][\w_]*/.test(t)}function Tv(t){return t==="string"||t==="number"||t==="boolean"||t==="Date"||t==="bigint"}var Lu="TypeDefinition";function CA(t){return V.isInstance(t,Lu)}var _a="ValueLiteral";function kA(t){return V.isInstance(t,_a)}var no="AbstractElement";function mi(t){return V.isInstance(t,no)}var io="ArrayLiteral";function SA(t){return V.isInstance(t,io)}var oo="ArrayType";function bh(t){return V.isInstance(t,oo)}var so="BooleanLiteral";function Ch(t){return V.isInstance(t,so)}var ao="Conjunction";function kh(t){return V.isInstance(t,ao)}var co="Disjunction";function Sh(t){return V.isInstance(t,co)}var uo="Grammar";function EA(t){return V.isInstance(t,uo)}var ba="GrammarImport";function AA(t){return V.isInstance(t,ba)}var lo="InferredType";function Ea(t){return V.isInstance(t,lo)}var fo="Interface";function Mu(t){return V.isInstance(t,fo)}var Ca="NamedArgument";function wA(t){return V.isInstance(t,Ca)}var ho="Negation";function Eh(t){return V.isInstance(t,ho)}var po="NumberLiteral";function NA(t){return V.isInstance(t,po)}var mo="Parameter";function PA(t){return V.isInstance(t,mo)}var go="ParameterReference";function Ah(t){return V.isInstance(t,go)}var yo="ParserRule";function Ie(t){return V.isInstance(t,yo)}var vo="ReferenceType";function wh(t){return V.isInstance(t,vo)}var ka="ReturnType";function Nh(t){return V.isInstance(t,ka)}var xo="SimpleType";function Fu(t){return V.isInstance(t,xo)}var To="StringLiteral";function DA(t){return V.isInstance(t,To)}var pi="TerminalRule";function Mt(t){return V.isInstance(t,pi)}var Ro="Type";function Aa(t){return V.isInstance(t,Ro)}var Sa="TypeAttribute";function IA(t){return V.isInstance(t,Sa)}var _o="UnionType";function Ph(t){return V.isInstance(t,_o)}var bo="Action";function Ar(t){return V.isInstance(t,bo)}var Co="Alternatives";function jo(t){return V.isInstance(t,Co)}var ko="Assignment";function Et(t){return V.isInstance(t,ko)}var So="CharacterRange";function Dh(t){return V.isInstance(t,So)}var Eo="CrossReference";function sr(t){return V.isInstance(t,Eo)}var Ao="EndOfFile";function Ih(t){return V.isInstance(t,Ao)}var wo="Group";function pr(t){return V.isInstance(t,wo)}var No="Keyword";function lt(t){return V.isInstance(t,No)}var Po="NegatedToken";function Oh(t){return V.isInstance(t,Po)}var Do="RegexToken";function Lh(t){return V.isInstance(t,Do)}var Io="RuleCall";function Vt(t){return V.isInstance(t,Io)}var Oo="TerminalAlternatives";function Mh(t){return V.isInstance(t,Oo)}var Lo="TerminalGroup";function Fh(t){return V.isInstance(t,Lo)}var Mo="TerminalRuleCall";function $u(t){return V.isInstance(t,Mo)}var Fo="UnorderedGroup";function Wo(t){return V.isInstance(t,Fo)}var $o="UntilToken";function $h(t){return V.isInstance(t,$o)}var qo="Wildcard";function qh(t){return V.isInstance(t,qo)}var Uo=class extends ui{getAllTypes(){return[no,to,ro,bo,Co,io,oo,ko,so,So,Ra,ao,Eo,co,Ao,uo,ba,wo,lo,fo,No,Ca,Po,ho,po,mo,go,yo,vo,Do,ka,Io,xo,To,Oo,Lo,pi,Mo,Ro,Sa,Lu,_o,Fo,$o,_a,qo]}computeIsSubtype(e,r){switch(e){case bo:case Co:case ko:case So:case Eo:case Ao:case wo:case No:case Po:case Do:case Io:case Oo:case Lo:case Mo:case Fo:case $o:case qo:return this.isSubtype(no,r);case io:case po:case To:return this.isSubtype(_a,r);case oo:case vo:case xo:case _o:return this.isSubtype(Lu,r);case so:return this.isSubtype(Ra,r)||this.isSubtype(_a,r);case ao:case co:case ho:case go:return this.isSubtype(Ra,r);case lo:case fo:case Ro:return this.isSubtype(ro,r);case yo:return this.isSubtype(to,r)||this.isSubtype(ro,r);case pi:return this.isSubtype(to,r);default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;switch(r){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return ro;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return to;case"Grammar:usedGrammars":return uo;case"NamedArgument:parameter":case"ParameterReference:parameter":return mo;case"TerminalRuleCall:rule":return pi;default:throw new Error(`${r} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case no:return{name:no,properties:[{name:"cardinality"},{name:"lookahead"}]};case io:return{name:io,properties:[{name:"elements",defaultValue:[]}]};case oo:return{name:oo,properties:[{name:"elementType"}]};case so:return{name:so,properties:[{name:"true",defaultValue:!1}]};case ao:return{name:ao,properties:[{name:"left"},{name:"right"}]};case co:return{name:co,properties:[{name:"left"},{name:"right"}]};case uo:return{name:uo,properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case ba:return{name:ba,properties:[{name:"path"}]};case lo:return{name:lo,properties:[{name:"name"}]};case fo:return{name:fo,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case Ca:return{name:Ca,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case ho:return{name:ho,properties:[{name:"value"}]};case po:return{name:po,properties:[{name:"value"}]};case mo:return{name:mo,properties:[{name:"name"}]};case go:return{name:go,properties:[{name:"parameter"}]};case yo:return{name:yo,properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case vo:return{name:vo,properties:[{name:"referenceType"}]};case ka:return{name:ka,properties:[{name:"name"}]};case xo:return{name:xo,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case To:return{name:To,properties:[{name:"value"}]};case pi:return{name:pi,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case Ro:return{name:Ro,properties:[{name:"name"},{name:"type"}]};case Sa:return{name:Sa,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case _o:return{name:_o,properties:[{name:"types",defaultValue:[]}]};case bo:return{name:bo,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case Co:return{name:Co,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case ko:return{name:ko,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case So:return{name:So,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case Eo:return{name:Eo,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case Ao:return{name:Ao,properties:[{name:"cardinality"},{name:"lookahead"}]};case wo:return{name:wo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case No:return{name:No,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case Po:return{name:Po,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Do:return{name:Do,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case Io:return{name:Io,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Oo:return{name:Oo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Lo:return{name:Lo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Mo:return{name:Mo,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Fo:return{name:Fo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case $o:return{name:$o,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case qo:return{name:qo,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}},V=new Uo;var Uu={};En(Uu,{assignMandatoryProperties:()=>Na,copyAstNode:()=>jh,findLocalReferences:()=>LA,findRootNode:()=>wa,getContainerOfType:()=>ar,getDocument:()=>rt,hasContainerOfType:()=>OA,linkContentToContainer:()=>qu,streamAllContents:()=>cr,streamAst:()=>mr,streamContents:()=>yi,streamReferences:()=>Bo});function qu(t){for(let[e,r]of Object.entries(t))e.startsWith("$")||(Array.isArray(r)?r.forEach((n,i)=>{we(n)&&(n.$container=t,n.$containerProperty=e,n.$containerIndex=i)}):we(r)&&(r.$container=t,r.$containerProperty=e))}function ar(t,e){let r=t;for(;r;){if(e(r))return r;r=r.$container}}function OA(t,e){let r=t;for(;r;){if(e(r))return!0;r=r.$container}return!1}function rt(t){let r=wa(t).$document;if(!r)throw new Error("AST node has no document.");return r}function wa(t){for(;t.$container;)t=t.$container;return t}function yi(t,e){if(!t)throw new Error("Node must be an AstNode.");let r=e?.range;return new or(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndex<n.keys.length;){let i=n.keys[n.keyIndex];if(!i.startsWith("$")){let o=t[i];if(we(o)){if(n.keyIndex++,Uh(o,r))return{done:!1,value:o}}else if(Array.isArray(o)){for(;n.arrayIndex<o.length;){let s=n.arrayIndex++,a=o[s];if(we(a)&&Uh(a,r))return{done:!1,value:a}}n.arrayIndex=0}}n.keyIndex++}return St})}function cr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new Lr(t,r=>yi(r,e))}function mr(t,e){if(t){if(e?.range&&!Uh(t,e.range))return new Lr(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new Lr(t,r=>yi(r,e),{includeRoot:!0})}function Uh(t,e){var r;if(!e)return!0;let n=(r=t.$cstNode)===null||r===void 0?void 0:r.range;return n?Rh(n,e):!1}function Bo(t){return new or(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){let r=e.keys[e.keyIndex];if(!r.startsWith("$")){let n=t[r];if(Rt(n))return e.keyIndex++,{done:!1,value:{reference:n,container:t,property:r}};if(Array.isArray(n)){for(;e.arrayIndex<n.length;){let i=e.arrayIndex++,o=n[i];if(Rt(o))return{done:!1,value:{reference:o,container:t,property:r,index:i}}}e.arrayIndex=0}}e.keyIndex++}return St})}function LA(t,e=rt(t).parseResult.value){let r=[];return mr(e).forEach(n=>{Bo(n).forEach(i=>{i.reference.ref===t&&r.push(i.reference)})}),Z(r)}function Na(t,e){let r=t.getTypeMetaData(e.$type),n=e;for(let i of r.properties)i.defaultValue!==void 0&&n[i.name]===void 0&&(n[i.name]=Rv(i.defaultValue))}function Rv(t){return Array.isArray(t)?[...t.map(Rv)]:t}function jh(t,e){let r={$type:t.$type};for(let[n,i]of Object.entries(t))if(!n.startsWith("$"))if(we(i))r[n]=jh(i,e);else if(Rt(i))r[n]=e(r,n,i.$refNode,i.$refText);else if(Array.isArray(i)){let o=[];for(let s of i)we(s)?o.push(jh(s,e)):Rt(s)?o.push(e(r,n,s.$refNode,s.$refText)):o.push(s);r[n]=o}else r[n]=i;return qu(r),r}var Bu={};En(Bu,{NEWLINE_REGEXP:()=>Gh,escapeRegExp:()=>wn,getTerminalParts:()=>$A,isMultilineComment:()=>zh,isWhitespace:()=>Oa,partialMatches:()=>Kh,partialRegExp:()=>Cv,whitespaceCharacters:()=>bv});function G(t){return t.charCodeAt(0)}function ju(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function Ho(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function vi(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Pa(){throw Error("Internal Error - Should never get here!")}function Wh(t){return t.type==="Character"}var Da=[];for(let t=G("0");t<=G("9");t++)Da.push(t);var Ia=[G("_")].concat(Da);for(let t=G("a");t<=G("z");t++)Ia.push(t);for(let t=G("A");t<=G("Z");t++)Ia.push(t);var Bh=[G(" "),G("\f"),G(`
36
- `),G("\r"),G(" "),G("\v"),G(" "),G("\xA0"),G("\u1680"),G("\u2000"),G("\u2001"),G("\u2002"),G("\u2003"),G("\u2004"),G("\u2005"),G("\u2006"),G("\u2007"),G("\u2008"),G("\u2009"),G("\u200A"),G("\u2028"),G("\u2029"),G("\u202F"),G("\u205F"),G("\u3000"),G("\uFEFF")];var MA=/[0-9a-fA-F]/,Wu=/[0-9]/,FA=/[1-9]/,xi=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("/");let r=this.disjunction();this.consumeChar("/");let n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Ho(n,"global");break;case"i":Ho(n,"ignoreCase");break;case"m":Ho(n,"multiLine");break;case"u":Ho(n,"unicode");break;case"y":Ho(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(){let 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(){let 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(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break}vi(r);let n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return Pa()}quantifier(e=!1){let r,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"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:i,atMost:i};break;case",":let o;this.isDigit()?(o=this.integerIncludingZero(),r={atLeast:i,atMost:o}):r={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;vi(r);break}if(!(e===!0&&r===void 0)&&vi(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,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}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),vi(e)?(e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):Pa()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[G(`
37
- `),G("\r"),G("\u2028"),G("\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=Da;break;case"D":e=Da,r=!0;break;case"s":e=Bh;break;case"S":e=Bh,r=!0;break;case"w":e=Ia;break;case"W":e=Ia,r=!0;break}return vi(e)?{type:"Set",value:e,complement:r}:Pa()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=G("\f");break;case"n":e=G(`
38
- `);break;case"r":e=G("\r");break;case"t":e=G(" ");break;case"v":e=G("\v");break}return vi(e)?{type:"Character",value:e}:Pa()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:G("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:G(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
39
- `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:G(e)}}}characterClass(){let e=[],r=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),r=!0);this.isClassAtom();){let n=this.classAtom(),i=n.type==="Character";if(Wh(n)&&this.isRangeDash()){this.consumeChar("-");let o=this.classAtom(),s=o.type==="Character";if(Wh(o)){if(o.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:o.value})}else ju(n.value,e),e.push(G("-")),ju(o.value,e)}else ju(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:r,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
40
- `: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:G("\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}let r=this.disjunction();this.consumeChar(")");let n={type:"Group",capturing:e,value:r};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(FA.test(e)===!1)throw Error("Expecting a positive integer");for(;Wu.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Wu.test(e)===!1)throw Error("Expecting an integer");for(;Wu.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
35
+ `)),E){let j=y.error?` Request failed: ${y.error.message} (${y.error.code}).`:"";w.log(`Received response '${E.method} - (${y.id})' in ${Date.now()-E.timerStart}ms.${j}`,P)}else w.log(`Received response ${y.id} without active response promise.`,P)}else Qi("receive-response",y)}function Qi(y,E){if(!w||h===de.Off)return;let P={isLSPMessage:!0,type:y,message:E,timestamp:Date.now()};w.log(P)}function ga(){if(F())throw new Qs(lu.Closed,"Connection is closed.");if(b())throw new Qs(lu.Disposed,"Connection is disposed.")}function sA(){if(ct())throw new Qs(lu.AlreadyListening,"Connection is already listening")}function aA(){if(!ct())throw new Error("Call listen() first.")}function ya(y){return y===void 0?null:y}function mv(y){if(y!==null)return y}function gv(y){return y!=null&&!Array.isArray(y)&&typeof y=="object"}function yh(y,E){switch(y){case z.ParameterStructures.auto:return gv(E)?mv(E):[ya(E)];case z.ParameterStructures.byName:if(!gv(E))throw new Error("Received parameters by name but param is not an object literal.");return mv(E);case z.ParameterStructures.byPosition:return[ya(E)];default:throw new Error(`Unknown parameter structure ${y.toString()}`)}}function yv(y,E){let P,j=y.numberOfParams;switch(j){case 0:P=void 0;break;case 1:P=yh(y.parameterStructures,E[0]);break;default:P=[];for(let Ae=0;Ae<E.length&&Ae<j;Ae++)P.push(ya(E[Ae]));if(E.length<j)for(let Ae=E.length;Ae<j;Ae++)P.push(null);break}return P}let Zi={sendNotification:(y,...E)=>{ga();let P,j;if(Ge.string(y)){P=y;let ge=E[0],ze=0,Je=z.ParameterStructures.auto;z.ParameterStructures.is(ge)&&(ze=1,Je=ge);let ae=E.length,qe=ae-ze;switch(qe){case 0:j=void 0;break;case 1:j=yh(Je,E[ze]);break;default:if(Je===z.ParameterStructures.byName)throw new Error(`Received ${qe} parameters for 'by Name' notification parameter structure.`);j=E.slice(ze,ae).map(pe=>ya(pe));break}}else{let ge=E;P=y.method,j=yv(y,ge)}let Ae={jsonrpc:c,method:P,params:j};return cn(Ae),e.write(Ae).catch(ge=>{throw i.error("Sending notification failed."),ge})},onNotification:(y,E)=>{ga();let P;return Ge.func(y)?d=y:E&&(Ge.string(y)?(P=y,f.set(y,{type:void 0,handler:E})):(P=y.method,f.set(y.method,{type:y,handler:E}))),{dispose:()=>{P!==void 0?f.delete(P):d=void 0}}},onProgress:(y,E,P)=>{if(p.has(E))throw new Error(`Progress handler for token ${E} already registered`);return p.set(E,P),{dispose:()=>{p.delete(E)}}},sendProgress:(y,E,P)=>Zi.sendNotification(uu.type,{token:E,value:P}),onUnhandledProgress:Ht.event,sendRequest:(y,...E)=>{ga(),aA();let P,j,Ae;if(Ge.string(y)){P=y;let ae=E[0],qe=E[E.length-1],pe=0,ut=z.ParameterStructures.auto;z.ParameterStructures.is(ae)&&(pe=1,ut=ae);let Lt=E.length;oy.CancellationToken.is(qe)&&(Lt=Lt-1,Ae=qe);let Or=Lt-pe;switch(Or){case 0:j=void 0;break;case 1:j=yh(ut,E[pe]);break;default:if(ut===z.ParameterStructures.byName)throw new Error(`Received ${Or} parameters for 'by Name' request parameter structure.`);j=E.slice(pe,Lt).map(cA=>ya(cA));break}}else{let ae=E;P=y.method,j=yv(y,ae);let qe=y.numberOfParams;Ae=oy.CancellationToken.is(ae[qe])?ae[qe]:void 0}let ge=o++,ze;Ae&&(ze=Ae.onCancellationRequested(()=>{let ae=k.sender.sendCancellation(Zi,ge);return ae===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${ge}`),Promise.resolve()):ae.catch(()=>{i.log(`Sending cancellation messages for id ${ge} failed`)})}));let Je={jsonrpc:c,id:ge,method:P,params:j};return kr(Je),typeof k.sender.enableCancellation=="function"&&k.sender.enableCancellation(Je),new Promise(async(ae,qe)=>{let pe=Or=>{ae(Or),k.sender.cleanup(ge),ze?.dispose()},ut=Or=>{qe(Or),k.sender.cleanup(ge),ze?.dispose()},Lt={method:P,timerStart:Date.now(),resolve:pe,reject:ut};try{await e.write(Je),S.set(ge,Lt)}catch(Or){throw i.error("Sending request failed."),Lt.reject(new z.ResponseError(z.ErrorCodes.MessageWriteError,Or.message?Or.message:"Unknown reason")),Or}})},onRequest:(y,E)=>{ga();let P=null;return cy.is(y)?(P=void 0,u=y):Ge.string(y)?(P=null,E!==void 0&&(P=y,l.set(y,{handler:E,type:void 0}))):E!==void 0&&(P=y.method,l.set(y.method,{type:y,handler:E})),{dispose:()=>{P!==null&&(P!==void 0?l.delete(P):u=void 0)}}},hasPendingResponse:()=>S.size>0,trace:async(y,E,P)=>{let j=!1,Ae=dr.Text;P!==void 0&&(Ge.boolean(P)?j=P:(j=P.sendNotification||!1,Ae=P.traceFormat||dr.Text)),h=y,_=Ae,h===de.Off?w=void 0:w=E,j&&!F()&&!b()&&await Zi.sendNotification(uy.type,{value:de.toString(y)})},onError:Bt.event,onClose:Ye.event,onUnhandledNotification:ir.event,onDispose:I.event,end:()=>{e.end()},dispose:()=>{if(b())return;J=Dr.Disposed,I.fire(void 0);let y=new z.ResponseError(z.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let E of S.values())E.reject(y);S=new Map,g=new Map,R=new Set,T=new Fb.LinkedMap,Ge.func(e.dispose)&&e.dispose(),Ge.func(t.dispose)&&t.dispose()},listen:()=>{ga(),sA(),J=Dr.Listening,t.listen(ht)},inspect:()=>{(0,Mb.default)().console.log("inspect")}};return Zi.onNotification(qd.type,y=>{if(h===de.Off||!w)return;let E=h===de.Verbose||h===de.Compact;w.log(y.message,E?y.verbose:void 0)}),Zi.onNotification(uu.type,y=>{let E=p.get(y.token);E?E(y.value):Ht.fire(y)}),Zi}Y.createMessageConnection=u1});var Gd=L(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.ProgressType=C.ProgressToken=C.createMessageConnection=C.NullLogger=C.ConnectionOptions=C.ConnectionStrategy=C.AbstractMessageBuffer=C.WriteableStreamMessageWriter=C.AbstractMessageWriter=C.MessageWriter=C.ReadableStreamMessageReader=C.AbstractMessageReader=C.MessageReader=C.SharedArrayReceiverStrategy=C.SharedArraySenderStrategy=C.CancellationToken=C.CancellationTokenSource=C.Emitter=C.Event=C.Disposable=C.LRUCache=C.Touch=C.LinkedMap=C.ParameterStructures=C.NotificationType9=C.NotificationType8=C.NotificationType7=C.NotificationType6=C.NotificationType5=C.NotificationType4=C.NotificationType3=C.NotificationType2=C.NotificationType1=C.NotificationType0=C.NotificationType=C.ErrorCodes=C.ResponseError=C.RequestType9=C.RequestType8=C.RequestType7=C.RequestType6=C.RequestType5=C.RequestType4=C.RequestType3=C.RequestType2=C.RequestType1=C.RequestType0=C.RequestType=C.Message=C.RAL=void 0;C.MessageStrategy=C.CancellationStrategy=C.CancellationSenderStrategy=C.CancellationReceiverStrategy=C.ConnectionError=C.ConnectionErrors=C.LogTraceNotification=C.SetTraceNotification=C.TraceFormat=C.TraceValues=C.Trace=void 0;var Ee=Bg();Object.defineProperty(C,"Message",{enumerable:!0,get:function(){return Ee.Message}});Object.defineProperty(C,"RequestType",{enumerable:!0,get:function(){return Ee.RequestType}});Object.defineProperty(C,"RequestType0",{enumerable:!0,get:function(){return Ee.RequestType0}});Object.defineProperty(C,"RequestType1",{enumerable:!0,get:function(){return Ee.RequestType1}});Object.defineProperty(C,"RequestType2",{enumerable:!0,get:function(){return Ee.RequestType2}});Object.defineProperty(C,"RequestType3",{enumerable:!0,get:function(){return Ee.RequestType3}});Object.defineProperty(C,"RequestType4",{enumerable:!0,get:function(){return Ee.RequestType4}});Object.defineProperty(C,"RequestType5",{enumerable:!0,get:function(){return Ee.RequestType5}});Object.defineProperty(C,"RequestType6",{enumerable:!0,get:function(){return Ee.RequestType6}});Object.defineProperty(C,"RequestType7",{enumerable:!0,get:function(){return Ee.RequestType7}});Object.defineProperty(C,"RequestType8",{enumerable:!0,get:function(){return Ee.RequestType8}});Object.defineProperty(C,"RequestType9",{enumerable:!0,get:function(){return Ee.RequestType9}});Object.defineProperty(C,"ResponseError",{enumerable:!0,get:function(){return Ee.ResponseError}});Object.defineProperty(C,"ErrorCodes",{enumerable:!0,get:function(){return Ee.ErrorCodes}});Object.defineProperty(C,"NotificationType",{enumerable:!0,get:function(){return Ee.NotificationType}});Object.defineProperty(C,"NotificationType0",{enumerable:!0,get:function(){return Ee.NotificationType0}});Object.defineProperty(C,"NotificationType1",{enumerable:!0,get:function(){return Ee.NotificationType1}});Object.defineProperty(C,"NotificationType2",{enumerable:!0,get:function(){return Ee.NotificationType2}});Object.defineProperty(C,"NotificationType3",{enumerable:!0,get:function(){return Ee.NotificationType3}});Object.defineProperty(C,"NotificationType4",{enumerable:!0,get:function(){return Ee.NotificationType4}});Object.defineProperty(C,"NotificationType5",{enumerable:!0,get:function(){return Ee.NotificationType5}});Object.defineProperty(C,"NotificationType6",{enumerable:!0,get:function(){return Ee.NotificationType6}});Object.defineProperty(C,"NotificationType7",{enumerable:!0,get:function(){return Ee.NotificationType7}});Object.defineProperty(C,"NotificationType8",{enumerable:!0,get:function(){return Ee.NotificationType8}});Object.defineProperty(C,"NotificationType9",{enumerable:!0,get:function(){return Ee.NotificationType9}});Object.defineProperty(C,"ParameterStructures",{enumerable:!0,get:function(){return Ee.ParameterStructures}});var fy=Gg();Object.defineProperty(C,"LinkedMap",{enumerable:!0,get:function(){return fy.LinkedMap}});Object.defineProperty(C,"LRUCache",{enumerable:!0,get:function(){return fy.LRUCache}});Object.defineProperty(C,"Touch",{enumerable:!0,get:function(){return fy.Touch}});var l1=kb();Object.defineProperty(C,"Disposable",{enumerable:!0,get:function(){return l1.Disposable}});var jb=qi();Object.defineProperty(C,"Event",{enumerable:!0,get:function(){return jb.Event}});Object.defineProperty(C,"Emitter",{enumerable:!0,get:function(){return jb.Emitter}});var Wb=Sc();Object.defineProperty(C,"CancellationTokenSource",{enumerable:!0,get:function(){return Wb.CancellationTokenSource}});Object.defineProperty(C,"CancellationToken",{enumerable:!0,get:function(){return Wb.CancellationToken}});var Bb=Eb();Object.defineProperty(C,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return Bb.SharedArraySenderStrategy}});Object.defineProperty(C,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return Bb.SharedArrayReceiverStrategy}});var hy=wb();Object.defineProperty(C,"MessageReader",{enumerable:!0,get:function(){return hy.MessageReader}});Object.defineProperty(C,"AbstractMessageReader",{enumerable:!0,get:function(){return hy.AbstractMessageReader}});Object.defineProperty(C,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return hy.ReadableStreamMessageReader}});var py=Ob();Object.defineProperty(C,"MessageWriter",{enumerable:!0,get:function(){return py.MessageWriter}});Object.defineProperty(C,"AbstractMessageWriter",{enumerable:!0,get:function(){return py.AbstractMessageWriter}});Object.defineProperty(C,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return py.WriteableStreamMessageWriter}});var d1=Lb();Object.defineProperty(C,"AbstractMessageBuffer",{enumerable:!0,get:function(){return d1.AbstractMessageBuffer}});var St=Ub();Object.defineProperty(C,"ConnectionStrategy",{enumerable:!0,get:function(){return St.ConnectionStrategy}});Object.defineProperty(C,"ConnectionOptions",{enumerable:!0,get:function(){return St.ConnectionOptions}});Object.defineProperty(C,"NullLogger",{enumerable:!0,get:function(){return St.NullLogger}});Object.defineProperty(C,"createMessageConnection",{enumerable:!0,get:function(){return St.createMessageConnection}});Object.defineProperty(C,"ProgressToken",{enumerable:!0,get:function(){return St.ProgressToken}});Object.defineProperty(C,"ProgressType",{enumerable:!0,get:function(){return St.ProgressType}});Object.defineProperty(C,"Trace",{enumerable:!0,get:function(){return St.Trace}});Object.defineProperty(C,"TraceValues",{enumerable:!0,get:function(){return St.TraceValues}});Object.defineProperty(C,"TraceFormat",{enumerable:!0,get:function(){return St.TraceFormat}});Object.defineProperty(C,"SetTraceNotification",{enumerable:!0,get:function(){return St.SetTraceNotification}});Object.defineProperty(C,"LogTraceNotification",{enumerable:!0,get:function(){return St.LogTraceNotification}});Object.defineProperty(C,"ConnectionErrors",{enumerable:!0,get:function(){return St.ConnectionErrors}});Object.defineProperty(C,"ConnectionError",{enumerable:!0,get:function(){return St.ConnectionError}});Object.defineProperty(C,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return St.CancellationReceiverStrategy}});Object.defineProperty(C,"CancellationSenderStrategy",{enumerable:!0,get:function(){return St.CancellationSenderStrategy}});Object.defineProperty(C,"CancellationStrategy",{enumerable:!0,get:function(){return St.CancellationStrategy}});Object.defineProperty(C,"MessageStrategy",{enumerable:!0,get:function(){return St.MessageStrategy}});var f1=Xn();C.RAL=f1.default});var Gb=L(vy=>{"use strict";Object.defineProperty(vy,"__esModule",{value:!0});var tn=Gd(),zd=class t extends tn.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return new TextEncoder().encode(e)}toString(e,r){return r==="ascii"?this.asciiDecoder.decode(e):new TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e:e.slice(0,r)}allocNative(e){return new Uint8Array(e)}};zd.emptyBuffer=new Uint8Array(0);var my=class{constructor(e){this.socket=e,this._onData=new tn.Emitter,this._messageListener=r=>{r.data.arrayBuffer().then(i=>{this._onData.fire(new Uint8Array(i))},()=>{(0,tn.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),tn.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),tn.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),tn.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}},gy=class{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),tn.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),tn.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),tn.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,r){if(typeof e=="string"){if(r!==void 0&&r!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${r}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}},h1=new TextEncoder,Hb=Object.freeze({messageBuffer:Object.freeze({create:t=>new zd(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{if(e.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${e.charset}`);return Promise.resolve(h1.encode(JSON.stringify(t,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{if(!(t instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(e.charset).decode(t)))}})}),stream:Object.freeze({asReadableStream:t=>new my(t),asWritableStream:t=>new gy(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setTimeout(t,0,...e);return{dispose:()=>clearTimeout(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function yy(){return Hb}(function(t){function e(){tn.RAL.install(Hb)}t.install=e})(yy||(yy={}));vy.default=yy});var Vi=L(fr=>{"use strict";var p1=fr&&fr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),m1=fr&&fr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&p1(e,t,r)};Object.defineProperty(fr,"__esModule",{value:!0});fr.createMessageConnection=fr.BrowserMessageWriter=fr.BrowserMessageReader=void 0;var g1=Gb();g1.default.install();var Zs=Gd();m1(Gd(),fr);var xy=class extends Zs.AbstractMessageReader{constructor(e){super(),this._onData=new Zs.Emitter,this._messageListener=r=>{this._onData.fire(r.data)},e.addEventListener("error",r=>this.fireError(r)),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}};fr.BrowserMessageReader=xy;var Ty=class extends Zs.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("error",r=>this.fireError(r))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};fr.BrowserMessageWriter=Ty;function y1(t,e,r,n){return r===void 0&&(r=Zs.NullLogger),Zs.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Zs.createMessageConnection)(t,e,r,n)}fr.createMessageConnection=y1});var Ry=L((dZ,zb)=>{"use strict";zb.exports=Vi()});var $e=L(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.ProtocolNotificationType=tr.ProtocolNotificationType0=tr.ProtocolRequestType=tr.ProtocolRequestType0=tr.RegistrationType=tr.MessageDirection=void 0;var ea=Vi(),Kb;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(Kb||(tr.MessageDirection=Kb={}));var _y=class{constructor(e){this.method=e}};tr.RegistrationType=_y;var by=class extends ea.RequestType0{constructor(e){super(e)}};tr.ProtocolRequestType0=by;var Cy=class extends ea.RequestType{constructor(e){super(e,ea.ParameterStructures.byName)}};tr.ProtocolRequestType=Cy;var Sy=class extends ea.NotificationType0{constructor(e){super(e)}};tr.ProtocolNotificationType0=Sy;var ky=class extends ea.NotificationType{constructor(e){super(e,ea.ParameterStructures.byName)}};tr.ProtocolNotificationType=ky});var Kd=L(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.objectLiteral=st.typedArray=st.stringArray=st.array=st.func=st.error=st.number=st.string=st.boolean=void 0;function v1(t){return t===!0||t===!1}st.boolean=v1;function Vb(t){return typeof t=="string"||t instanceof String}st.string=Vb;function x1(t){return typeof t=="number"||t instanceof Number}st.number=x1;function T1(t){return t instanceof Error}st.error=T1;function R1(t){return typeof t=="function"}st.func=R1;function Xb(t){return Array.isArray(t)}st.array=Xb;function _1(t){return Xb(t)&&t.every(e=>Vb(e))}st.stringArray=_1;function b1(t,e){return Array.isArray(t)&&t.every(e)}st.typedArray=b1;function C1(t){return t!==null&&typeof t=="object"}st.objectLiteral=C1});var Qb=L(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.ImplementationRequest=void 0;var Yb=$e(),Jb;(function(t){t.method="textDocument/implementation",t.messageDirection=Yb.MessageDirection.clientToServer,t.type=new Yb.ProtocolRequestType(t.method)})(Jb||(Vd.ImplementationRequest=Jb={}))});var tC=L(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.TypeDefinitionRequest=void 0;var Zb=$e(),eC;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=Zb.MessageDirection.clientToServer,t.type=new Zb.ProtocolRequestType(t.method)})(eC||(Xd.TypeDefinitionRequest=eC={}))});var iC=L(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.DidChangeWorkspaceFoldersNotification=ta.WorkspaceFoldersRequest=void 0;var Yd=$e(),rC;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Yd.MessageDirection.serverToClient,t.type=new Yd.ProtocolRequestType0(t.method)})(rC||(ta.WorkspaceFoldersRequest=rC={}));var nC;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Yd.MessageDirection.clientToServer,t.type=new Yd.ProtocolNotificationType(t.method)})(nC||(ta.DidChangeWorkspaceFoldersNotification=nC={}))});var aC=L(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.ConfigurationRequest=void 0;var oC=$e(),sC;(function(t){t.method="workspace/configuration",t.messageDirection=oC.MessageDirection.serverToClient,t.type=new oC.ProtocolRequestType(t.method)})(sC||(Jd.ConfigurationRequest=sC={}))});var lC=L(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.ColorPresentationRequest=ra.DocumentColorRequest=void 0;var Qd=$e(),cC;(function(t){t.method="textDocument/documentColor",t.messageDirection=Qd.MessageDirection.clientToServer,t.type=new Qd.ProtocolRequestType(t.method)})(cC||(ra.DocumentColorRequest=cC={}));var uC;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=Qd.MessageDirection.clientToServer,t.type=new Qd.ProtocolRequestType(t.method)})(uC||(ra.ColorPresentationRequest=uC={}))});var hC=L(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.FoldingRangeRefreshRequest=na.FoldingRangeRequest=void 0;var Zd=$e(),dC;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Zd.MessageDirection.clientToServer,t.type=new Zd.ProtocolRequestType(t.method)})(dC||(na.FoldingRangeRequest=dC={}));var fC;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Zd.MessageDirection.serverToClient,t.type=new Zd.ProtocolRequestType0(t.method)})(fC||(na.FoldingRangeRefreshRequest=fC={}))});var gC=L(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.DeclarationRequest=void 0;var pC=$e(),mC;(function(t){t.method="textDocument/declaration",t.messageDirection=pC.MessageDirection.clientToServer,t.type=new pC.ProtocolRequestType(t.method)})(mC||(ef.DeclarationRequest=mC={}))});var xC=L(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.SelectionRangeRequest=void 0;var yC=$e(),vC;(function(t){t.method="textDocument/selectionRange",t.messageDirection=yC.MessageDirection.clientToServer,t.type=new yC.ProtocolRequestType(t.method)})(vC||(tf.SelectionRangeRequest=vC={}))});var bC=L(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.WorkDoneProgressCancelNotification=ti.WorkDoneProgressCreateRequest=ti.WorkDoneProgress=void 0;var S1=Vi(),rf=$e(),TC;(function(t){t.type=new S1.ProgressType;function e(r){return r===t.type}t.is=e})(TC||(ti.WorkDoneProgress=TC={}));var RC;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=rf.MessageDirection.serverToClient,t.type=new rf.ProtocolRequestType(t.method)})(RC||(ti.WorkDoneProgressCreateRequest=RC={}));var _C;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=rf.MessageDirection.clientToServer,t.type=new rf.ProtocolNotificationType(t.method)})(_C||(ti.WorkDoneProgressCancelNotification=_C={}))});var EC=L(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.CallHierarchyOutgoingCallsRequest=ri.CallHierarchyIncomingCallsRequest=ri.CallHierarchyPrepareRequest=void 0;var ia=$e(),CC;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method)})(CC||(ri.CallHierarchyPrepareRequest=CC={}));var SC;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method)})(SC||(ri.CallHierarchyIncomingCallsRequest=SC={}));var kC;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method)})(kC||(ri.CallHierarchyOutgoingCallsRequest=kC={}))});var IC=L(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.SemanticTokensRefreshRequest=rr.SemanticTokensRangeRequest=rr.SemanticTokensDeltaRequest=rr.SemanticTokensRequest=rr.SemanticTokensRegistrationType=rr.TokenFormat=void 0;var bn=$e(),AC;(function(t){t.Relative="relative"})(AC||(rr.TokenFormat=AC={}));var fu;(function(t){t.method="textDocument/semanticTokens",t.type=new bn.RegistrationType(t.method)})(fu||(rr.SemanticTokensRegistrationType=fu={}));var wC;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=bn.MessageDirection.clientToServer,t.type=new bn.ProtocolRequestType(t.method),t.registrationMethod=fu.method})(wC||(rr.SemanticTokensRequest=wC={}));var NC;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=bn.MessageDirection.clientToServer,t.type=new bn.ProtocolRequestType(t.method),t.registrationMethod=fu.method})(NC||(rr.SemanticTokensDeltaRequest=NC={}));var PC;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=bn.MessageDirection.clientToServer,t.type=new bn.ProtocolRequestType(t.method),t.registrationMethod=fu.method})(PC||(rr.SemanticTokensRangeRequest=PC={}));var DC;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=bn.MessageDirection.serverToClient,t.type=new bn.ProtocolRequestType0(t.method)})(DC||(rr.SemanticTokensRefreshRequest=DC={}))});var MC=L(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});nf.ShowDocumentRequest=void 0;var OC=$e(),LC;(function(t){t.method="window/showDocument",t.messageDirection=OC.MessageDirection.serverToClient,t.type=new OC.ProtocolRequestType(t.method)})(LC||(nf.ShowDocumentRequest=LC={}))});var qC=L(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.LinkedEditingRangeRequest=void 0;var FC=$e(),$C;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=FC.MessageDirection.clientToServer,t.type=new FC.ProtocolRequestType(t.method)})($C||(of.LinkedEditingRangeRequest=$C={}))});var KC=L(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.WillDeleteFilesRequest=Dt.DidDeleteFilesNotification=Dt.DidRenameFilesNotification=Dt.WillRenameFilesRequest=Dt.DidCreateFilesNotification=Dt.WillCreateFilesRequest=Dt.FileOperationPatternKind=void 0;var Tr=$e(),UC;(function(t){t.file="file",t.folder="folder"})(UC||(Dt.FileOperationPatternKind=UC={}));var jC;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolRequestType(t.method)})(jC||(Dt.WillCreateFilesRequest=jC={}));var WC;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolNotificationType(t.method)})(WC||(Dt.DidCreateFilesNotification=WC={}));var BC;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolRequestType(t.method)})(BC||(Dt.WillRenameFilesRequest=BC={}));var HC;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolNotificationType(t.method)})(HC||(Dt.DidRenameFilesNotification=HC={}));var GC;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolNotificationType(t.method)})(GC||(Dt.DidDeleteFilesNotification=GC={}));var zC;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Tr.MessageDirection.clientToServer,t.type=new Tr.ProtocolRequestType(t.method)})(zC||(Dt.WillDeleteFilesRequest=zC={}))});var QC=L(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.MonikerRequest=ni.MonikerKind=ni.UniquenessLevel=void 0;var VC=$e(),XC;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(XC||(ni.UniquenessLevel=XC={}));var YC;(function(t){t.$import="import",t.$export="export",t.local="local"})(YC||(ni.MonikerKind=YC={}));var JC;(function(t){t.method="textDocument/moniker",t.messageDirection=VC.MessageDirection.clientToServer,t.type=new VC.ProtocolRequestType(t.method)})(JC||(ni.MonikerRequest=JC={}))});var rS=L(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.TypeHierarchySubtypesRequest=ii.TypeHierarchySupertypesRequest=ii.TypeHierarchyPrepareRequest=void 0;var oa=$e(),ZC;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=oa.MessageDirection.clientToServer,t.type=new oa.ProtocolRequestType(t.method)})(ZC||(ii.TypeHierarchyPrepareRequest=ZC={}));var eS;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=oa.MessageDirection.clientToServer,t.type=new oa.ProtocolRequestType(t.method)})(eS||(ii.TypeHierarchySupertypesRequest=eS={}));var tS;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=oa.MessageDirection.clientToServer,t.type=new oa.ProtocolRequestType(t.method)})(tS||(ii.TypeHierarchySubtypesRequest=tS={}))});var oS=L(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.InlineValueRefreshRequest=sa.InlineValueRequest=void 0;var sf=$e(),nS;(function(t){t.method="textDocument/inlineValue",t.messageDirection=sf.MessageDirection.clientToServer,t.type=new sf.ProtocolRequestType(t.method)})(nS||(sa.InlineValueRequest=nS={}));var iS;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=sf.MessageDirection.serverToClient,t.type=new sf.ProtocolRequestType0(t.method)})(iS||(sa.InlineValueRefreshRequest=iS={}))});var uS=L(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.InlayHintRefreshRequest=oi.InlayHintResolveRequest=oi.InlayHintRequest=void 0;var aa=$e(),sS;(function(t){t.method="textDocument/inlayHint",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(sS||(oi.InlayHintRequest=sS={}));var aS;(function(t){t.method="inlayHint/resolve",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(aS||(oi.InlayHintResolveRequest=aS={}));var cS;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=aa.MessageDirection.serverToClient,t.type=new aa.ProtocolRequestType0(t.method)})(cS||(oi.InlayHintRefreshRequest=cS={}))});var gS=L(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.DiagnosticRefreshRequest=Rr.WorkspaceDiagnosticRequest=Rr.DocumentDiagnosticRequest=Rr.DocumentDiagnosticReportKind=Rr.DiagnosticServerCancellationData=void 0;var mS=Vi(),k1=Kd(),ca=$e(),lS;(function(t){function e(r){let n=r;return n&&k1.boolean(n.retriggerRequest)}t.is=e})(lS||(Rr.DiagnosticServerCancellationData=lS={}));var dS;(function(t){t.Full="full",t.Unchanged="unchanged"})(dS||(Rr.DocumentDiagnosticReportKind=dS={}));var fS;(function(t){t.method="textDocument/diagnostic",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method),t.partialResult=new mS.ProgressType})(fS||(Rr.DocumentDiagnosticRequest=fS={}));var hS;(function(t){t.method="workspace/diagnostic",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method),t.partialResult=new mS.ProgressType})(hS||(Rr.WorkspaceDiagnosticRequest=hS={}));var pS;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=ca.MessageDirection.serverToClient,t.type=new ca.ProtocolRequestType0(t.method)})(pS||(Rr.DiagnosticRefreshRequest=pS={}))});var bS=L(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.DidCloseNotebookDocumentNotification=Ve.DidSaveNotebookDocumentNotification=Ve.DidChangeNotebookDocumentNotification=Ve.NotebookCellArrayChange=Ve.DidOpenNotebookDocumentNotification=Ve.NotebookDocumentSyncRegistrationType=Ve.NotebookDocument=Ve.NotebookCell=Ve.ExecutionSummary=Ve.NotebookCellKind=void 0;var hu=(Ii(),vh(fd)),Ir=Kd(),rn=$e(),Ey;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(Ey||(Ve.NotebookCellKind=Ey={}));var Ay;(function(t){function e(i,o){let s={executionOrder:i};return(o===!0||o===!1)&&(s.success=o),s}t.create=e;function r(i){let o=i;return Ir.objectLiteral(o)&&hu.uinteger.is(o.executionOrder)&&(o.success===void 0||Ir.boolean(o.success))}t.is=r;function n(i,o){return i===o?!0:i==null||o===null||o===void 0?!1:i.executionOrder===o.executionOrder&&i.success===o.success}t.equals=n})(Ay||(Ve.ExecutionSummary=Ay={}));var af;(function(t){function e(o,s){return{kind:o,document:s}}t.create=e;function r(o){let s=o;return Ir.objectLiteral(s)&&Ey.is(s.kind)&&hu.DocumentUri.is(s.document)&&(s.metadata===void 0||Ir.objectLiteral(s.metadata))}t.is=r;function n(o,s){let a=new Set;return o.document!==s.document&&a.add("document"),o.kind!==s.kind&&a.add("kind"),o.executionSummary!==s.executionSummary&&a.add("executionSummary"),(o.metadata!==void 0||s.metadata!==void 0)&&!i(o.metadata,s.metadata)&&a.add("metadata"),(o.executionSummary!==void 0||s.executionSummary!==void 0)&&!Ay.equals(o.executionSummary,s.executionSummary)&&a.add("executionSummary"),a}t.diff=n;function i(o,s){if(o===s)return!0;if(o==null||s===null||s===void 0||typeof o!=typeof s||typeof o!="object")return!1;let a=Array.isArray(o),c=Array.isArray(s);if(a!==c)return!1;if(a&&c){if(o.length!==s.length)return!1;for(let u=0;u<o.length;u++)if(!i(o[u],s[u]))return!1}if(Ir.objectLiteral(o)&&Ir.objectLiteral(s)){let u=Object.keys(o),l=Object.keys(s);if(u.length!==l.length||(u.sort(),l.sort(),!i(u,l)))return!1;for(let d=0;d<u.length;d++){let f=u[d];if(!i(o[f],s[f]))return!1}}return!0}})(af||(Ve.NotebookCell=af={}));var yS;(function(t){function e(n,i,o,s){return{uri:n,notebookType:i,version:o,cells:s}}t.create=e;function r(n){let i=n;return Ir.objectLiteral(i)&&Ir.string(i.uri)&&hu.integer.is(i.version)&&Ir.typedArray(i.cells,af.is)}t.is=r})(yS||(Ve.NotebookDocument=yS={}));var ua;(function(t){t.method="notebookDocument/sync",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.RegistrationType(t.method)})(ua||(Ve.NotebookDocumentSyncRegistrationType=ua={}));var vS;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method),t.registrationMethod=ua.method})(vS||(Ve.DidOpenNotebookDocumentNotification=vS={}));var xS;(function(t){function e(n){let i=n;return Ir.objectLiteral(i)&&hu.uinteger.is(i.start)&&hu.uinteger.is(i.deleteCount)&&(i.cells===void 0||Ir.typedArray(i.cells,af.is))}t.is=e;function r(n,i,o){let s={start:n,deleteCount:i};return o!==void 0&&(s.cells=o),s}t.create=r})(xS||(Ve.NotebookCellArrayChange=xS={}));var TS;(function(t){t.method="notebookDocument/didChange",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method),t.registrationMethod=ua.method})(TS||(Ve.DidChangeNotebookDocumentNotification=TS={}));var RS;(function(t){t.method="notebookDocument/didSave",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method),t.registrationMethod=ua.method})(RS||(Ve.DidSaveNotebookDocumentNotification=RS={}));var _S;(function(t){t.method="notebookDocument/didClose",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method),t.registrationMethod=ua.method})(_S||(Ve.DidCloseNotebookDocumentNotification=_S={}))});var kS=L(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.InlineCompletionRequest=void 0;var CS=$e(),SS;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=CS.MessageDirection.clientToServer,t.type=new CS.ProtocolRequestType(t.method)})(SS||(cf.InlineCompletionRequest=SS={}))});var qk=L(m=>{"use strict";Object.defineProperty(m,"__esModule",{value:!0});m.WorkspaceSymbolRequest=m.CodeActionResolveRequest=m.CodeActionRequest=m.DocumentSymbolRequest=m.DocumentHighlightRequest=m.ReferencesRequest=m.DefinitionRequest=m.SignatureHelpRequest=m.SignatureHelpTriggerKind=m.HoverRequest=m.CompletionResolveRequest=m.CompletionRequest=m.CompletionTriggerKind=m.PublishDiagnosticsNotification=m.WatchKind=m.RelativePattern=m.FileChangeType=m.DidChangeWatchedFilesNotification=m.WillSaveTextDocumentWaitUntilRequest=m.WillSaveTextDocumentNotification=m.TextDocumentSaveReason=m.DidSaveTextDocumentNotification=m.DidCloseTextDocumentNotification=m.DidChangeTextDocumentNotification=m.TextDocumentContentChangeEvent=m.DidOpenTextDocumentNotification=m.TextDocumentSyncKind=m.TelemetryEventNotification=m.LogMessageNotification=m.ShowMessageRequest=m.ShowMessageNotification=m.MessageType=m.DidChangeConfigurationNotification=m.ExitNotification=m.ShutdownRequest=m.InitializedNotification=m.InitializeErrorCodes=m.InitializeRequest=m.WorkDoneProgressOptions=m.TextDocumentRegistrationOptions=m.StaticRegistrationOptions=m.PositionEncodingKind=m.FailureHandlingKind=m.ResourceOperationKind=m.UnregistrationRequest=m.RegistrationRequest=m.DocumentSelector=m.NotebookCellTextDocumentFilter=m.NotebookDocumentFilter=m.TextDocumentFilter=void 0;m.MonikerRequest=m.MonikerKind=m.UniquenessLevel=m.WillDeleteFilesRequest=m.DidDeleteFilesNotification=m.WillRenameFilesRequest=m.DidRenameFilesNotification=m.WillCreateFilesRequest=m.DidCreateFilesNotification=m.FileOperationPatternKind=m.LinkedEditingRangeRequest=m.ShowDocumentRequest=m.SemanticTokensRegistrationType=m.SemanticTokensRefreshRequest=m.SemanticTokensRangeRequest=m.SemanticTokensDeltaRequest=m.SemanticTokensRequest=m.TokenFormat=m.CallHierarchyPrepareRequest=m.CallHierarchyOutgoingCallsRequest=m.CallHierarchyIncomingCallsRequest=m.WorkDoneProgressCancelNotification=m.WorkDoneProgressCreateRequest=m.WorkDoneProgress=m.SelectionRangeRequest=m.DeclarationRequest=m.FoldingRangeRefreshRequest=m.FoldingRangeRequest=m.ColorPresentationRequest=m.DocumentColorRequest=m.ConfigurationRequest=m.DidChangeWorkspaceFoldersNotification=m.WorkspaceFoldersRequest=m.TypeDefinitionRequest=m.ImplementationRequest=m.ApplyWorkspaceEditRequest=m.ExecuteCommandRequest=m.PrepareRenameRequest=m.RenameRequest=m.PrepareSupportDefaultBehavior=m.DocumentOnTypeFormattingRequest=m.DocumentRangesFormattingRequest=m.DocumentRangeFormattingRequest=m.DocumentFormattingRequest=m.DocumentLinkResolveRequest=m.DocumentLinkRequest=m.CodeLensRefreshRequest=m.CodeLensResolveRequest=m.CodeLensRequest=m.WorkspaceSymbolResolveRequest=void 0;m.InlineCompletionRequest=m.DidCloseNotebookDocumentNotification=m.DidSaveNotebookDocumentNotification=m.DidChangeNotebookDocumentNotification=m.NotebookCellArrayChange=m.DidOpenNotebookDocumentNotification=m.NotebookDocumentSyncRegistrationType=m.NotebookDocument=m.NotebookCell=m.ExecutionSummary=m.NotebookCellKind=m.DiagnosticRefreshRequest=m.WorkspaceDiagnosticRequest=m.DocumentDiagnosticRequest=m.DocumentDiagnosticReportKind=m.DiagnosticServerCancellationData=m.InlayHintRefreshRequest=m.InlayHintResolveRequest=m.InlayHintRequest=m.InlineValueRefreshRequest=m.InlineValueRequest=m.TypeHierarchySupertypesRequest=m.TypeHierarchySubtypesRequest=m.TypeHierarchyPrepareRequest=void 0;var A=$e(),ES=(Ii(),vh(fd)),vt=Kd(),E1=Qb();Object.defineProperty(m,"ImplementationRequest",{enumerable:!0,get:function(){return E1.ImplementationRequest}});var A1=tC();Object.defineProperty(m,"TypeDefinitionRequest",{enumerable:!0,get:function(){return A1.TypeDefinitionRequest}});var Lk=iC();Object.defineProperty(m,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return Lk.WorkspaceFoldersRequest}});Object.defineProperty(m,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return Lk.DidChangeWorkspaceFoldersNotification}});var w1=aC();Object.defineProperty(m,"ConfigurationRequest",{enumerable:!0,get:function(){return w1.ConfigurationRequest}});var Mk=lC();Object.defineProperty(m,"DocumentColorRequest",{enumerable:!0,get:function(){return Mk.DocumentColorRequest}});Object.defineProperty(m,"ColorPresentationRequest",{enumerable:!0,get:function(){return Mk.ColorPresentationRequest}});var Fk=hC();Object.defineProperty(m,"FoldingRangeRequest",{enumerable:!0,get:function(){return Fk.FoldingRangeRequest}});Object.defineProperty(m,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return Fk.FoldingRangeRefreshRequest}});var N1=gC();Object.defineProperty(m,"DeclarationRequest",{enumerable:!0,get:function(){return N1.DeclarationRequest}});var P1=xC();Object.defineProperty(m,"SelectionRangeRequest",{enumerable:!0,get:function(){return P1.SelectionRangeRequest}});var Iy=bC();Object.defineProperty(m,"WorkDoneProgress",{enumerable:!0,get:function(){return Iy.WorkDoneProgress}});Object.defineProperty(m,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return Iy.WorkDoneProgressCreateRequest}});Object.defineProperty(m,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return Iy.WorkDoneProgressCancelNotification}});var Oy=EC();Object.defineProperty(m,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return Oy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(m,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return Oy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(m,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return Oy.CallHierarchyPrepareRequest}});var la=IC();Object.defineProperty(m,"TokenFormat",{enumerable:!0,get:function(){return la.TokenFormat}});Object.defineProperty(m,"SemanticTokensRequest",{enumerable:!0,get:function(){return la.SemanticTokensRequest}});Object.defineProperty(m,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return la.SemanticTokensDeltaRequest}});Object.defineProperty(m,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return la.SemanticTokensRangeRequest}});Object.defineProperty(m,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return la.SemanticTokensRefreshRequest}});Object.defineProperty(m,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return la.SemanticTokensRegistrationType}});var D1=MC();Object.defineProperty(m,"ShowDocumentRequest",{enumerable:!0,get:function(){return D1.ShowDocumentRequest}});var I1=qC();Object.defineProperty(m,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return I1.LinkedEditingRangeRequest}});var Xi=KC();Object.defineProperty(m,"FileOperationPatternKind",{enumerable:!0,get:function(){return Xi.FileOperationPatternKind}});Object.defineProperty(m,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Xi.DidCreateFilesNotification}});Object.defineProperty(m,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Xi.WillCreateFilesRequest}});Object.defineProperty(m,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Xi.DidRenameFilesNotification}});Object.defineProperty(m,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Xi.WillRenameFilesRequest}});Object.defineProperty(m,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Xi.DidDeleteFilesNotification}});Object.defineProperty(m,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Xi.WillDeleteFilesRequest}});var Ly=QC();Object.defineProperty(m,"UniquenessLevel",{enumerable:!0,get:function(){return Ly.UniquenessLevel}});Object.defineProperty(m,"MonikerKind",{enumerable:!0,get:function(){return Ly.MonikerKind}});Object.defineProperty(m,"MonikerRequest",{enumerable:!0,get:function(){return Ly.MonikerRequest}});var My=rS();Object.defineProperty(m,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return My.TypeHierarchyPrepareRequest}});Object.defineProperty(m,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return My.TypeHierarchySubtypesRequest}});Object.defineProperty(m,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return My.TypeHierarchySupertypesRequest}});var $k=oS();Object.defineProperty(m,"InlineValueRequest",{enumerable:!0,get:function(){return $k.InlineValueRequest}});Object.defineProperty(m,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return $k.InlineValueRefreshRequest}});var Fy=uS();Object.defineProperty(m,"InlayHintRequest",{enumerable:!0,get:function(){return Fy.InlayHintRequest}});Object.defineProperty(m,"InlayHintResolveRequest",{enumerable:!0,get:function(){return Fy.InlayHintResolveRequest}});Object.defineProperty(m,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return Fy.InlayHintRefreshRequest}});var pu=gS();Object.defineProperty(m,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return pu.DiagnosticServerCancellationData}});Object.defineProperty(m,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return pu.DocumentDiagnosticReportKind}});Object.defineProperty(m,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return pu.DocumentDiagnosticRequest}});Object.defineProperty(m,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return pu.WorkspaceDiagnosticRequest}});Object.defineProperty(m,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return pu.DiagnosticRefreshRequest}});var nn=bS();Object.defineProperty(m,"NotebookCellKind",{enumerable:!0,get:function(){return nn.NotebookCellKind}});Object.defineProperty(m,"ExecutionSummary",{enumerable:!0,get:function(){return nn.ExecutionSummary}});Object.defineProperty(m,"NotebookCell",{enumerable:!0,get:function(){return nn.NotebookCell}});Object.defineProperty(m,"NotebookDocument",{enumerable:!0,get:function(){return nn.NotebookDocument}});Object.defineProperty(m,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return nn.NotebookDocumentSyncRegistrationType}});Object.defineProperty(m,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return nn.DidOpenNotebookDocumentNotification}});Object.defineProperty(m,"NotebookCellArrayChange",{enumerable:!0,get:function(){return nn.NotebookCellArrayChange}});Object.defineProperty(m,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return nn.DidChangeNotebookDocumentNotification}});Object.defineProperty(m,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return nn.DidSaveNotebookDocumentNotification}});Object.defineProperty(m,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return nn.DidCloseNotebookDocumentNotification}});var O1=kS();Object.defineProperty(m,"InlineCompletionRequest",{enumerable:!0,get:function(){return O1.InlineCompletionRequest}});var wy;(function(t){function e(r){let n=r;return vt.string(n)||vt.string(n.language)||vt.string(n.scheme)||vt.string(n.pattern)}t.is=e})(wy||(m.TextDocumentFilter=wy={}));var Ny;(function(t){function e(r){let n=r;return vt.objectLiteral(n)&&(vt.string(n.notebookType)||vt.string(n.scheme)||vt.string(n.pattern))}t.is=e})(Ny||(m.NotebookDocumentFilter=Ny={}));var Py;(function(t){function e(r){let n=r;return vt.objectLiteral(n)&&(vt.string(n.notebook)||Ny.is(n.notebook))&&(n.language===void 0||vt.string(n.language))}t.is=e})(Py||(m.NotebookCellTextDocumentFilter=Py={}));var Dy;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!vt.string(n)&&!wy.is(n)&&!Py.is(n))return!1;return!0}t.is=e})(Dy||(m.DocumentSelector=Dy={}));var AS;(function(t){t.method="client/registerCapability",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType(t.method)})(AS||(m.RegistrationRequest=AS={}));var wS;(function(t){t.method="client/unregisterCapability",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType(t.method)})(wS||(m.UnregistrationRequest=wS={}));var NS;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(NS||(m.ResourceOperationKind=NS={}));var PS;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(PS||(m.FailureHandlingKind=PS={}));var DS;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(DS||(m.PositionEncodingKind=DS={}));var IS;(function(t){function e(r){let n=r;return n&&vt.string(n.id)&&n.id.length>0}t.hasId=e})(IS||(m.StaticRegistrationOptions=IS={}));var OS;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||Dy.is(n.documentSelector))}t.is=e})(OS||(m.TextDocumentRegistrationOptions=OS={}));var LS;(function(t){function e(n){let i=n;return vt.objectLiteral(i)&&(i.workDoneProgress===void 0||vt.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&vt.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(LS||(m.WorkDoneProgressOptions=LS={}));var MS;(function(t){t.method="initialize",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(MS||(m.InitializeRequest=MS={}));var FS;(function(t){t.unknownProtocolVersion=1})(FS||(m.InitializeErrorCodes=FS={}));var $S;(function(t){t.method="initialized",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})($S||(m.InitializedNotification=$S={}));var qS;(function(t){t.method="shutdown",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType0(t.method)})(qS||(m.ShutdownRequest=qS={}));var US;(function(t){t.method="exit",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType0(t.method)})(US||(m.ExitNotification=US={}));var jS;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(jS||(m.DidChangeConfigurationNotification=jS={}));var WS;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(WS||(m.MessageType=WS={}));var BS;(function(t){t.method="window/showMessage",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolNotificationType(t.method)})(BS||(m.ShowMessageNotification=BS={}));var HS;(function(t){t.method="window/showMessageRequest",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType(t.method)})(HS||(m.ShowMessageRequest=HS={}));var GS;(function(t){t.method="window/logMessage",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolNotificationType(t.method)})(GS||(m.LogMessageNotification=GS={}));var zS;(function(t){t.method="telemetry/event",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolNotificationType(t.method)})(zS||(m.TelemetryEventNotification=zS={}));var KS;(function(t){t.None=0,t.Full=1,t.Incremental=2})(KS||(m.TextDocumentSyncKind=KS={}));var VS;(function(t){t.method="textDocument/didOpen",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(VS||(m.DidOpenTextDocumentNotification=VS={}));var XS;(function(t){function e(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}t.isIncremental=e;function r(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}t.isFull=r})(XS||(m.TextDocumentContentChangeEvent=XS={}));var YS;(function(t){t.method="textDocument/didChange",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(YS||(m.DidChangeTextDocumentNotification=YS={}));var JS;(function(t){t.method="textDocument/didClose",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(JS||(m.DidCloseTextDocumentNotification=JS={}));var QS;(function(t){t.method="textDocument/didSave",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(QS||(m.DidSaveTextDocumentNotification=QS={}));var ZS;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(ZS||(m.TextDocumentSaveReason=ZS={}));var ek;(function(t){t.method="textDocument/willSave",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(ek||(m.WillSaveTextDocumentNotification=ek={}));var tk;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(tk||(m.WillSaveTextDocumentWaitUntilRequest=tk={}));var rk;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolNotificationType(t.method)})(rk||(m.DidChangeWatchedFilesNotification=rk={}));var nk;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(nk||(m.FileChangeType=nk={}));var ik;(function(t){function e(r){let n=r;return vt.objectLiteral(n)&&(ES.URI.is(n.baseUri)||ES.WorkspaceFolder.is(n.baseUri))&&vt.string(n.pattern)}t.is=e})(ik||(m.RelativePattern=ik={}));var ok;(function(t){t.Create=1,t.Change=2,t.Delete=4})(ok||(m.WatchKind=ok={}));var sk;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolNotificationType(t.method)})(sk||(m.PublishDiagnosticsNotification=sk={}));var ak;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(ak||(m.CompletionTriggerKind=ak={}));var ck;(function(t){t.method="textDocument/completion",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(ck||(m.CompletionRequest=ck={}));var uk;(function(t){t.method="completionItem/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(uk||(m.CompletionResolveRequest=uk={}));var lk;(function(t){t.method="textDocument/hover",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(lk||(m.HoverRequest=lk={}));var dk;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(dk||(m.SignatureHelpTriggerKind=dk={}));var fk;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(fk||(m.SignatureHelpRequest=fk={}));var hk;(function(t){t.method="textDocument/definition",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(hk||(m.DefinitionRequest=hk={}));var pk;(function(t){t.method="textDocument/references",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(pk||(m.ReferencesRequest=pk={}));var mk;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(mk||(m.DocumentHighlightRequest=mk={}));var gk;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(gk||(m.DocumentSymbolRequest=gk={}));var yk;(function(t){t.method="textDocument/codeAction",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(yk||(m.CodeActionRequest=yk={}));var vk;(function(t){t.method="codeAction/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(vk||(m.CodeActionResolveRequest=vk={}));var xk;(function(t){t.method="workspace/symbol",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(xk||(m.WorkspaceSymbolRequest=xk={}));var Tk;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Tk||(m.WorkspaceSymbolResolveRequest=Tk={}));var Rk;(function(t){t.method="textDocument/codeLens",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Rk||(m.CodeLensRequest=Rk={}));var _k;(function(t){t.method="codeLens/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(_k||(m.CodeLensResolveRequest=_k={}));var bk;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType0(t.method)})(bk||(m.CodeLensRefreshRequest=bk={}));var Ck;(function(t){t.method="textDocument/documentLink",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Ck||(m.DocumentLinkRequest=Ck={}));var Sk;(function(t){t.method="documentLink/resolve",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Sk||(m.DocumentLinkResolveRequest=Sk={}));var kk;(function(t){t.method="textDocument/formatting",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(kk||(m.DocumentFormattingRequest=kk={}));var Ek;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Ek||(m.DocumentRangeFormattingRequest=Ek={}));var Ak;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Ak||(m.DocumentRangesFormattingRequest=Ak={}));var wk;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(wk||(m.DocumentOnTypeFormattingRequest=wk={}));var Nk;(function(t){t.Identifier=1})(Nk||(m.PrepareSupportDefaultBehavior=Nk={}));var Pk;(function(t){t.method="textDocument/rename",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Pk||(m.RenameRequest=Pk={}));var Dk;(function(t){t.method="textDocument/prepareRename",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Dk||(m.PrepareRenameRequest=Dk={}));var Ik;(function(t){t.method="workspace/executeCommand",t.messageDirection=A.MessageDirection.clientToServer,t.type=new A.ProtocolRequestType(t.method)})(Ik||(m.ExecuteCommandRequest=Ik={}));var Ok;(function(t){t.method="workspace/applyEdit",t.messageDirection=A.MessageDirection.serverToClient,t.type=new A.ProtocolRequestType("workspace/applyEdit")})(Ok||(m.ApplyWorkspaceEditRequest=Ok={}))});var jk=L(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.createProtocolConnection=void 0;var Uk=Vi();function L1(t,e,r,n){return Uk.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Uk.createMessageConnection)(t,e,r,n)}uf.createProtocolConnection=L1});var Bk=L(nr=>{"use strict";var M1=nr&&nr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),lf=nr&&nr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&M1(e,t,r)};Object.defineProperty(nr,"__esModule",{value:!0});nr.LSPErrorCodes=nr.createProtocolConnection=void 0;lf(Vi(),nr);lf((Ii(),vh(fd)),nr);lf($e(),nr);lf(qk(),nr);var F1=jk();Object.defineProperty(nr,"createProtocolConnection",{enumerable:!0,get:function(){return F1.createProtocolConnection}});var Wk;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(Wk||(nr.LSPErrorCodes=Wk={}))});var Xe=L(on=>{"use strict";var $1=on&&on.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Hk=on&&on.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$1(e,t,r)};Object.defineProperty(on,"__esModule",{value:!0});on.createProtocolConnection=void 0;var q1=Ry();Hk(Ry(),on);Hk(Bk(),on);function U1(t,e,r,n){return(0,q1.createMessageConnection)(t,e,r,n)}on.createProtocolConnection=U1});var qy=L(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.SemanticTokensBuilder=si.SemanticTokensDiff=si.SemanticTokensFeature=void 0;var df=Xe(),j1=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(df.SemanticTokensRefreshRequest.type),on:e=>{let r=df.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=df.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=df.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};si.SemanticTokensFeature=j1;var ff=class{constructor(e,r){this.originalSequence=e,this.modifiedSequence=r}computeDiff(){let e=this.originalSequence.length,r=this.modifiedSequence.length,n=0;for(;n<r&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<r&&n<e){let i=e-1,o=r-1;for(;i>=n&&o>=n&&this.originalSequence[i]===this.modifiedSequence[o];)i--,o--;(i<n||o<n)&&(i++,o++);let s=i-n+1,a=this.modifiedSequence.slice(n,o+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:n,deleteCount:s-1}]:[{start:n,deleteCount:s,data:a}]}else return n<r?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};si.SemanticTokensDiff=ff;var $y=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,r,n,i,o){let s=e,a=r;this._dataLen>0&&(s-=this._prevLine,s===0&&(a-=this._prevChar)),this._data[this._dataLen++]=s,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=o,this._prevLine=e,this._prevChar=r}get id(){return this._id.toString()}previousResult(e){this.id===e&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new ff(this._prevData,this._data).computeDiff()}:this.build()}};si.SemanticTokensBuilder=$y});var Gk=L(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.InlineCompletionFeature=void 0;var W1=Xe(),B1=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(W1.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};hf.InlineCompletionFeature=B1});var jy=L(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.TextDocuments=void 0;var Yi=Xe(),Uy=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Yi.Emitter,this._onDidOpen=new Yi.Emitter,this._onDidClose=new Yi.Emitter,this._onDidSave=new Yi.Emitter,this._onWillSave=new Yi.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=Yi.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,o);let s=Object.freeze({document:o});this._onDidOpen.fire(s),this._onDidChangeContent.fire(s)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:s}=i;if(s==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=this._syncedDocuments.get(i.uri);a!==void 0&&(a=this._configuration.update(a,o,s),this._syncedDocuments.set(i.uri,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),r.push(e.onDidCloseTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(n.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(n.textDocument.uri);return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),Yi.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};pf.TextDocuments=Uy});var By=L(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.NotebookDocuments=da.NotebookSyncFeature=void 0;var _r=Xe(),zk=jy(),H1=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(_r.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(_r.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(_r.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(_r.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};da.NotebookSyncFeature=H1;var mf=class t{onDidOpenTextDocument(e){return this.openHandler=e,_r.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,_r.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,_r.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};mf.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var Wy=class{constructor(e){e instanceof zk.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new zk.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new _r.Emitter,this._onDidChange=new _r.Emitter,this._onDidSave=new _r.Emitter,this._onDidClose=new _r.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let r=this.notebookCellMap.get(e);return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"?e:e.document,n=this.notebookCellMap.get(r);return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let r=new mf,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let o of i.cellTextDocuments)r.openTextDocument({textDocument:o});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o===void 0)return;o.version=i.notebookDocument.version;let s=o.metadata,a=!1,c=i.change;c.metadata!==void 0&&(a=!0,o.metadata=c.metadata);let u=[],l=[],d=[],f=[];if(c.cells!==void 0){let R=c.cells;if(R.structure!==void 0){let g=R.structure.array;if(o.cells.splice(g.start,g.deleteCount,...g.cells!==void 0?g.cells:[]),R.structure.didOpen!==void 0)for(let h of R.structure.didOpen)r.openTextDocument({textDocument:h}),u.push(h.uri);if(R.structure.didClose)for(let h of R.structure.didClose)r.closeTextDocument({textDocument:h}),l.push(h.uri)}if(R.data!==void 0){let g=new Map(R.data.map(h=>[h.document,h]));for(let h=0;h<=o.cells.length;h++){let _=g.get(o.cells[h].document);if(_!==void 0){let w=o.cells.splice(h,1,_);if(d.push({old:w[0],new:_}),g.delete(_.document),g.size===0)break}}}if(R.textContent!==void 0)for(let g of R.textContent)r.changeTextDocument({textDocument:g.document,contentChanges:g.changes}),f.push(g.document.uri)}this.updateCellMap(o);let p={notebookDocument:o};a&&(p.metadata={old:s,new:o.metadata});let v=[];for(let R of u)v.push(this.getNotebookCell(R));let T=[];for(let R of l)T.push(this.getNotebookCell(R));let S=[];for(let R of f)S.push(this.getNotebookCell(R));(v.length>0||T.length>0||d.length>0||S.length>0)&&(p.cells={added:v,removed:T,changed:{data:d,textContent:S}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o!==void 0){this._onDidClose.fire(o);for(let s of i.cellTextDocuments)r.closeTextDocument({textDocument:s});this.notebookDocuments.delete(i.notebookDocument.uri);for(let s of o.cells)this.notebookCellMap.delete(s.document)}})),_r.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};da.NotebookDocuments=Wy});var Hy=L(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.thenable=at.typedArray=at.stringArray=at.array=at.func=at.error=at.number=at.string=at.boolean=void 0;function G1(t){return t===!0||t===!1}at.boolean=G1;function Kk(t){return typeof t=="string"||t instanceof String}at.string=Kk;function z1(t){return typeof t=="number"||t instanceof Number}at.number=z1;function K1(t){return t instanceof Error}at.error=K1;function Vk(t){return typeof t=="function"}at.func=Vk;function Xk(t){return Array.isArray(t)}at.array=Xk;function V1(t){return Xk(t)&&t.every(e=>Kk(e))}at.stringArray=V1;function X1(t,e){return Array.isArray(t)&&t.every(e)}at.typedArray=X1;function Y1(t){return t&&Vk(t.then)}at.thenable=Y1});var Gy=L(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.generateUuid=br.parse=br.isUUID=br.v4=br.empty=void 0;var mu=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},gu=class t extends mu{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return t._oneOf(t._chars)}constructor(){super([t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-","4",t._randomHex(),t._randomHex(),t._randomHex(),"-",t._oneOf(t._timeHighBits),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex()].join(""))}};gu._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];gu._timeHighBits=["8","9","a","b"];br.empty=new mu("00000000-0000-0000-0000-000000000000");function Yk(){return new gu}br.v4=Yk;var J1=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Jk(t){return J1.test(t)}br.isUUID=Jk;function Q1(t){if(!Jk(t))throw new Error("invalid uuid");return new mu(t)}br.parse=Q1;function Z1(){return Yk().asHex()}br.generateUuid=Z1});var Qk=L(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.attachPartialResult=ci.ProgressFeature=ci.attachWorkDone=void 0;var ai=Xe(),e$=Gy(),Ji=class t{constructor(e,r){this._connection=e,this._token=r,t.Instances.set(this._token,this)}begin(e,r,n,i){let o={kind:"begin",title:e,percentage:r,message:n,cancellable:i};this._connection.sendProgress(ai.WorkDoneProgress.type,this._token,o)}report(e,r){let n={kind:"report"};typeof e=="number"?(n.percentage=e,r!==void 0&&(n.message=r)):n.message=e,this._connection.sendProgress(ai.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(ai.WorkDoneProgress.type,this._token,{kind:"end"})}};Ji.Instances=new Map;var gf=class extends Ji{constructor(e,r){super(e,r),this._source=new ai.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},yu=class{constructor(){}begin(){}report(){}done(){}},yf=class extends yu{constructor(){super(),this._source=new ai.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function t$(t,e){if(e===void 0||e.workDoneToken===void 0)return new yu;let r=e.workDoneToken;return delete e.workDoneToken,new Ji(t,r)}ci.attachWorkDone=t$;var r$=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(ai.WorkDoneProgressCancelNotification.type,r=>{let n=Ji.Instances.get(r.token);(n instanceof gf||n instanceof yf)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new yu:new Ji(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,e$.generateUuid)();return this.connection.sendRequest(ai.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new gf(this.connection,e))}else return Promise.resolve(new yf)}};ci.ProgressFeature=r$;var zy;(function(t){t.type=new ai.ProgressType})(zy||(zy={}));var Ky=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(zy.type,this._token,e)}};function n$(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new Ky(t,r)}ci.attachPartialResult=n$});var Zk=L(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.ConfigurationFeature=void 0;var i$=Xe(),o$=Hy(),s$=t=>class extends t{getConfiguration(e){return e?o$.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let r={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(i$.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};vf.ConfigurationFeature=s$});var eE=L(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.WorkspaceFoldersFeature=void 0;var xf=Xe(),a$=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new xf.Emitter,this.connection.onNotification(xf.DidChangeWorkspaceFoldersNotification.type,n=>{this._onDidChangeWorkspaceFolders.fire(n.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let r=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=r===!0||typeof r=="string"}getWorkspaceFolders(){return this.connection.sendRequest(xf.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(xf.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Tf.WorkspaceFoldersFeature=a$});var tE=L(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.CallHierarchyFeature=void 0;var Vy=Xe(),c$=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(Vy.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=Vy.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=Vy.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Rf.CallHierarchyFeature=c$});var rE=L(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.ShowDocumentFeature=void 0;var u$=Xe(),l$=t=>class extends t{showDocument(e){return this.connection.sendRequest(u$.ShowDocumentRequest.type,e)}};_f.ShowDocumentFeature=l$});var nE=L(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.FileOperationsFeature=void 0;var fa=Xe(),d$=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(fa.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(fa.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(fa.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(fa.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(fa.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(fa.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};bf.FileOperationsFeature=d$});var iE=L(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.LinkedEditingRangeFeature=void 0;var f$=Xe(),h$=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(f$.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};Cf.LinkedEditingRangeFeature=h$});var oE=L(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.TypeHierarchyFeature=void 0;var Xy=Xe(),p$=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(Xy.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=Xy.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=Xy.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Sf.TypeHierarchyFeature=p$});var aE=L(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.InlineValueFeature=void 0;var sE=Xe(),m$=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(sE.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(sE.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};kf.InlineValueFeature=m$});var uE=L(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.FoldingRangeFeature=void 0;var cE=Xe(),g$=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(cE.FoldingRangeRefreshRequest.type),on:e=>{let r=cE.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Ef.FoldingRangeFeature=g$});var lE=L(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.InlayHintFeature=void 0;var Yy=Xe(),y$=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Yy.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Yy.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(Yy.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Af.InlayHintFeature=y$});var dE=L(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.DiagnosticFeature=void 0;var vu=Xe(),v$=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(vu.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(vu.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(vu.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(vu.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(vu.WorkspaceDiagnosticRequest.partialResult,r)))}}};wf.DiagnosticFeature=v$});var fE=L(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.MonikerFeature=void 0;var x$=Xe(),T$=t=>class extends t{get moniker(){return{on:e=>{let r=x$.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Nf.MonikerFeature=T$});var EE=L(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.createConnection=le.combineFeatures=le.combineNotebooksFeatures=le.combineLanguagesFeatures=le.combineWorkspaceFeatures=le.combineWindowFeatures=le.combineClientFeatures=le.combineTracerFeatures=le.combineTelemetryFeatures=le.combineConsoleFeatures=le._NotebooksImpl=le._LanguagesImpl=le.BulkUnregistration=le.BulkRegistration=le.ErrorMessageTracker=void 0;var D=Xe(),Cr=Hy(),Qy=Gy(),X=Qk(),R$=Zk(),_$=eE(),b$=tE(),C$=qy(),S$=rE(),k$=nE(),E$=iE(),A$=oE(),w$=aE(),N$=uE(),P$=lE(),D$=dE(),I$=By(),O$=fE();function Jy(t){if(t!==null)return t}var Zy=class{constructor(){this._messages=Object.create(null)}add(e){let r=this._messages[e];r||(r=0),r++,this._messages[e]=r}sendErrors(e){Object.keys(this._messages).forEach(r=>{e.window.showErrorMessage(r)})}};le.ErrorMessageTracker=Zy;var Pf=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(D.MessageType.Error,e)}warn(e){this.send(D.MessageType.Warning,e)}info(e){this.send(D.MessageType.Info,e)}log(e){this.send(D.MessageType.Log,e)}debug(e){this.send(D.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(D.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,D.RAL)().console.error("Sending log message failed")})}},ev=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...r){let n={type:D.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(D.ShowMessageRequest.type,n).then(Jy)}showWarningMessage(e,...r){let n={type:D.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(D.ShowMessageRequest.type,n).then(Jy)}showInformationMessage(e,...r){let n={type:D.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(D.ShowMessageRequest.type,n).then(Jy)}},hE=(0,S$.ShowDocumentFeature)((0,X.ProgressFeature)(ev)),pE;(function(t){function e(){return new Df}t.create=e})(pE||(le.BulkRegistration=pE={}));var Df=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=Cr.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=Qy.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},mE;(function(t){function e(){return new xu(void 0,[])}t.create=e})(mE||(le.BulkUnregistration=mE={}));var xu=class{constructor(e,r){this._connection=e,this._unregistrations=new Map,r.forEach(n=>{this._unregistrations.set(n.method,n)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let n of this._unregistrations.values())e.push(n);let r={unregisterations:e};this._connection.sendRequest(D.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=Cr.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(D.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},o=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},If=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,r,n){return e instanceof Df?this.registerMany(e):e instanceof xu?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=Cr.string(r)?r:r.method,o=Qy.generateUuid(),s={registrations:[{id:o,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(D.RegistrationRequest.type,s).then(a=>(e.add({id:o,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,r){let n=Cr.string(e)?e:e.method,i=Qy.generateUuid(),o={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(D.RegistrationRequest.type,o).then(s=>D.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),s=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(s)))}unregisterSingle(e,r){let n={unregisterations:[{id:e,method:r}]};return this.connection.sendRequest(D.UnregistrationRequest.type,n).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let r=e.asRegistrationParams();return this.connection.sendRequest(D.RegistrationRequest.type,r).then(()=>new xu(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},tv=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function r(i){return i&&!!i.edit}let n=r(e)?e:{edit:e};return this.connection.sendRequest(D.ApplyWorkspaceEditRequest.type,n)}},gE=(0,k$.FileOperationsFeature)((0,_$.WorkspaceFoldersFeature)((0,R$.ConfigurationFeature)(tv))),Of=class{constructor(){this._trace=D.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,r){this._trace!==D.Trace.Off&&this.connection.sendNotification(D.LogTraceNotification.type,{message:e,verbose:this._trace===D.Trace.Verbose?r:void 0}).catch(()=>{})}},Lf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(D.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},Mf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,X.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,X.attachPartialResult)(this.connection,r)}};le._LanguagesImpl=Mf;var yE=(0,N$.FoldingRangeFeature)((0,O$.MonikerFeature)((0,D$.DiagnosticFeature)((0,P$.InlayHintFeature)((0,w$.InlineValueFeature)((0,A$.TypeHierarchyFeature)((0,E$.LinkedEditingRangeFeature)((0,C$.SemanticTokensFeature)((0,b$.CallHierarchyFeature)(Mf))))))))),Ff=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,X.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,X.attachPartialResult)(this.connection,r)}};le._NotebooksImpl=Ff;var vE=(0,I$.NotebookSyncFeature)(Ff);function xE(t,e){return function(r){return e(t(r))}}le.combineConsoleFeatures=xE;function TE(t,e){return function(r){return e(t(r))}}le.combineTelemetryFeatures=TE;function RE(t,e){return function(r){return e(t(r))}}le.combineTracerFeatures=RE;function _E(t,e){return function(r){return e(t(r))}}le.combineClientFeatures=_E;function bE(t,e){return function(r){return e(t(r))}}le.combineWindowFeatures=bE;function CE(t,e){return function(r){return e(t(r))}}le.combineWorkspaceFeatures=CE;function SE(t,e){return function(r){return e(t(r))}}le.combineLanguagesFeatures=SE;function kE(t,e){return function(r){return e(t(r))}}le.combineNotebooksFeatures=kE;function L$(t,e){function r(i,o,s){return i&&o?s(i,o):i||o}return{__brand:"features",console:r(t.console,e.console,xE),tracer:r(t.tracer,e.tracer,RE),telemetry:r(t.telemetry,e.telemetry,TE),client:r(t.client,e.client,_E),window:r(t.window,e.window,bE),workspace:r(t.workspace,e.workspace,CE),languages:r(t.languages,e.languages,SE),notebooks:r(t.notebooks,e.notebooks,kE)}}le.combineFeatures=L$;function M$(t,e,r){let n=r&&r.console?new(r.console(Pf)):new Pf,i=t(n);n.rawAttach(i);let o=r&&r.tracer?new(r.tracer(Of)):new Of,s=r&&r.telemetry?new(r.telemetry(Lf)):new Lf,a=r&&r.client?new(r.client(If)):new If,c=r&&r.window?new(r.window(hE)):new hE,u=r&&r.workspace?new(r.workspace(gE)):new gE,l=r&&r.languages?new(r.languages(yE)):new yE,d=r&&r.notebooks?new(r.notebooks(vE)):new vE,f=[n,o,s,a,c,u,l,d];function p(g){return g instanceof Promise?g:Cr.thenable(g)?new Promise((h,_)=>{g.then(w=>h(w),w=>_(w))}):Promise.resolve(g)}let v,T,S,R={listen:()=>i.listen(),sendRequest:(g,...h)=>i.sendRequest(Cr.string(g)?g:g.method,...h),onRequest:(g,h)=>i.onRequest(g,h),sendNotification:(g,h)=>{let _=Cr.string(g)?g:g.method;return i.sendNotification(_,h)},onNotification:(g,h)=>i.onNotification(g,h),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:g=>(T=g,{dispose:()=>{T=void 0}}),onInitialized:g=>i.onNotification(D.InitializedNotification.type,g),onShutdown:g=>(v=g,{dispose:()=>{v=void 0}}),onExit:g=>(S=g,{dispose:()=>{S=void 0}}),get console(){return n},get telemetry(){return s},get tracer(){return o},get client(){return a},get window(){return c},get workspace(){return u},get languages(){return l},get notebooks(){return d},onDidChangeConfiguration:g=>i.onNotification(D.DidChangeConfigurationNotification.type,g),onDidChangeWatchedFiles:g=>i.onNotification(D.DidChangeWatchedFilesNotification.type,g),__textDocumentSync:void 0,onDidOpenTextDocument:g=>i.onNotification(D.DidOpenTextDocumentNotification.type,g),onDidChangeTextDocument:g=>i.onNotification(D.DidChangeTextDocumentNotification.type,g),onDidCloseTextDocument:g=>i.onNotification(D.DidCloseTextDocumentNotification.type,g),onWillSaveTextDocument:g=>i.onNotification(D.WillSaveTextDocumentNotification.type,g),onWillSaveTextDocumentWaitUntil:g=>i.onRequest(D.WillSaveTextDocumentWaitUntilRequest.type,g),onDidSaveTextDocument:g=>i.onNotification(D.DidSaveTextDocumentNotification.type,g),sendDiagnostics:g=>i.sendNotification(D.PublishDiagnosticsNotification.type,g),onHover:g=>i.onRequest(D.HoverRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onCompletion:g=>i.onRequest(D.CompletionRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onCompletionResolve:g=>i.onRequest(D.CompletionResolveRequest.type,g),onSignatureHelp:g=>i.onRequest(D.SignatureHelpRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onDeclaration:g=>i.onRequest(D.DeclarationRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onDefinition:g=>i.onRequest(D.DefinitionRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onTypeDefinition:g=>i.onRequest(D.TypeDefinitionRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onImplementation:g=>i.onRequest(D.ImplementationRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onReferences:g=>i.onRequest(D.ReferencesRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onDocumentHighlight:g=>i.onRequest(D.DocumentHighlightRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onDocumentSymbol:g=>i.onRequest(D.DocumentSymbolRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onWorkspaceSymbol:g=>i.onRequest(D.WorkspaceSymbolRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onWorkspaceSymbolResolve:g=>i.onRequest(D.WorkspaceSymbolResolveRequest.type,g),onCodeAction:g=>i.onRequest(D.CodeActionRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onCodeActionResolve:g=>i.onRequest(D.CodeActionResolveRequest.type,(h,_)=>g(h,_)),onCodeLens:g=>i.onRequest(D.CodeLensRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onCodeLensResolve:g=>i.onRequest(D.CodeLensResolveRequest.type,(h,_)=>g(h,_)),onDocumentFormatting:g=>i.onRequest(D.DocumentFormattingRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onDocumentRangeFormatting:g=>i.onRequest(D.DocumentRangeFormattingRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onDocumentOnTypeFormatting:g=>i.onRequest(D.DocumentOnTypeFormattingRequest.type,(h,_)=>g(h,_)),onRenameRequest:g=>i.onRequest(D.RenameRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),onPrepareRename:g=>i.onRequest(D.PrepareRenameRequest.type,(h,_)=>g(h,_)),onDocumentLinks:g=>i.onRequest(D.DocumentLinkRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onDocumentLinkResolve:g=>i.onRequest(D.DocumentLinkResolveRequest.type,(h,_)=>g(h,_)),onDocumentColor:g=>i.onRequest(D.DocumentColorRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onColorPresentation:g=>i.onRequest(D.ColorPresentationRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onFoldingRanges:g=>i.onRequest(D.FoldingRangeRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onSelectionRanges:g=>i.onRequest(D.SelectionRangeRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),(0,X.attachPartialResult)(i,h))),onExecuteCommand:g=>i.onRequest(D.ExecuteCommandRequest.type,(h,_)=>g(h,_,(0,X.attachWorkDone)(i,h),void 0)),dispose:()=>i.dispose()};for(let g of f)g.attach(R);return i.onRequest(D.InitializeRequest.type,g=>{e.initialize(g),Cr.string(g.trace)&&(o.trace=D.Trace.fromString(g.trace));for(let h of f)h.initialize(g.capabilities);if(T){let h=T(g,new D.CancellationTokenSource().token,(0,X.attachWorkDone)(i,g),void 0);return p(h).then(_=>{if(_ instanceof D.ResponseError)return _;let w=_;w||(w={capabilities:{}});let J=w.capabilities;J||(J={},w.capabilities=J),J.textDocumentSync===void 0||J.textDocumentSync===null?J.textDocumentSync=Cr.number(R.__textDocumentSync)?R.__textDocumentSync:D.TextDocumentSyncKind.None:!Cr.number(J.textDocumentSync)&&!Cr.number(J.textDocumentSync.change)&&(J.textDocumentSync.change=Cr.number(R.__textDocumentSync)?R.__textDocumentSync:D.TextDocumentSyncKind.None);for(let Bt of f)Bt.fillServerCapabilities(J);return w})}else{let h={capabilities:{textDocumentSync:D.TextDocumentSyncKind.None}};for(let _ of f)_.fillServerCapabilities(h.capabilities);return h}}),i.onRequest(D.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,v)return v(new D.CancellationTokenSource().token)}),i.onNotification(D.ExitNotification.type,()=>{try{S&&S()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(D.SetTraceNotification.type,g=>{o.trace=D.Trace.fromString(g.value)}),R}le.createConnection=M$});var rv=L(It=>{"use strict";var F$=It&&It.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),wE=It&&It.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&F$(e,t,r)};Object.defineProperty(It,"__esModule",{value:!0});It.ProposedFeatures=It.NotebookDocuments=It.TextDocuments=It.SemanticTokensBuilder=void 0;var $$=qy();Object.defineProperty(It,"SemanticTokensBuilder",{enumerable:!0,get:function(){return $$.SemanticTokensBuilder}});var q$=Gk();wE(Xe(),It);var U$=jy();Object.defineProperty(It,"TextDocuments",{enumerable:!0,get:function(){return U$.TextDocuments}});var j$=By();Object.defineProperty(It,"NotebookDocuments",{enumerable:!0,get:function(){return j$.NotebookDocuments}});wE(EE(),It);var AE;(function(t){t.all={__brand:"features",languages:q$.InlineCompletionFeature}})(AE||(It.ProposedFeatures=AE={}))});var PE=L((_ee,NE)=>{"use strict";NE.exports=Xe()});var an=L(sn=>{"use strict";var W$=sn&&sn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),IE=sn&&sn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&W$(e,t,r)};Object.defineProperty(sn,"__esModule",{value:!0});sn.createConnection=void 0;var $f=rv();IE(PE(),sn);IE(rv(),sn);var DE=!1,B$={initialize:t=>{},get shutdownReceived(){return DE},set shutdownReceived(t){DE=t},exit:t=>{}};function H$(t,e,r,n){let i,o,s,a;t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),$f.ConnectionStrategy.is(t)||$f.ConnectionOptions.is(t)?a=t:(o=t,s=e,a=r);let c=u=>(0,$f.createProtocolConnection)(o,s,u,a);return(0,$f.createConnection)(c,B$,i)}sn.createConnection=H$});var He={};En(He,{AbstractAstReflection:()=>ui,AbstractCstNode:()=>Tc,AbstractLangiumParser:()=>Rc,AbstractParserErrorMessageProvider:()=>pd,AbstractThreadedAsyncParser:()=>mg,AstUtils:()=>Uu,BiMap:()=>Ui,Cancellation:()=>B,CompositeCstNodeImpl:()=>Li,ContextCache:()=>ji,CstNodeBuilder:()=>xc,CstUtils:()=>Ou,DEFAULT_TOKENIZE_OPTIONS:()=>Sd,DONE_RESULT:()=>kt,DatatypeSymbol:()=>hd,DefaultAstNodeDescriptionProvider:()=>qc,DefaultAstNodeLocator:()=>jc,DefaultAsyncParser:()=>Zc,DefaultCommentProvider:()=>Qc,DefaultConfigurationProvider:()=>Wc,DefaultDocumentBuilder:()=>Bc,DefaultDocumentValidator:()=>Bi,DefaultHydrator:()=>tu,DefaultIndexManager:()=>Hc,DefaultJsonSerializer:()=>Lc,DefaultLangiumDocumentFactory:()=>kc,DefaultLangiumDocuments:()=>Ec,DefaultLexer:()=>Hi,DefaultLexerErrorMessageProvider:()=>zc,DefaultLinker:()=>Ac,DefaultNameProvider:()=>wc,DefaultReferenceDescriptionProvider:()=>Uc,DefaultReferences:()=>Nc,DefaultScopeComputation:()=>Pc,DefaultScopeProvider:()=>Oc,DefaultServiceRegistry:()=>Fc,DefaultTokenBuilder:()=>Fi,DefaultValueConverter:()=>$i,DefaultWorkspaceLock:()=>eu,DefaultWorkspaceManager:()=>Gc,Deferred:()=>Wt,Disposable:()=>Jn,DisposableCache:()=>zs,DocumentCache:()=>bd,DocumentState:()=>xe,DocumentValidator:()=>xr,EMPTY_SCOPE:()=>qF,EMPTY_STREAM:()=>xa,EmptyFileSystem:()=>ou,EmptyFileSystemProvider:()=>Pd,ErrorWithLocation:()=>hi,GrammarAST:()=>gi,GrammarUtils:()=>Gu,IndentationAwareLexer:()=>vg,IndentationAwareTokenBuilder:()=>Nd,JSDocDocumentationProvider:()=>Jc,LangiumCompletionParser:()=>bc,LangiumParser:()=>_c,LangiumParserErrorMessageProvider:()=>Us,LeafCstNodeImpl:()=>Oi,LexingMode:()=>zi,MapScope:()=>Dc,Module:()=>Xs,MultiMap:()=>Pr,OperationCancelled:()=>Zr,ParserWorker:()=>gg,Reduction:()=>eo,RegExpUtils:()=>Bu,RootCstNodeImpl:()=>qs,SimpleCache:()=>Ic,StreamImpl:()=>or,StreamScope:()=>Gs,TextDocument:()=>Yn,TreeStreamImpl:()=>Lr,URI:()=>tt,UriUtils:()=>oe,ValidationCategory:()=>Vs,ValidationRegistry:()=>$c,ValueConverter:()=>Qr,WorkspaceCache:()=>Ks,assertUnreachable:()=>Fr,createCompletionParser:()=>Zm,createDefaultCoreModule:()=>ru,createDefaultSharedCoreModule:()=>nu,createGrammarConfig:()=>ap,createLangiumParser:()=>eg,createParser:()=>Cc,delayNextTick:()=>ag,diagnosticData:()=>Wi,eagerLoad:()=>iu,getDiagnosticRange:()=>db,indentationBuilderDefaultOptions:()=>yg,inject:()=>Gi,interruptAndCheck:()=>Be,isAstNode:()=>we,isAstNodeDescription:()=>xh,isAstNodeWithComment:()=>Mc,isCompositeCstNode:()=>Er,isIMultiModeLexerDefinition:()=>dg,isJSDoc:()=>Yc,isLeafCstNode:()=>An,isLinkingError:()=>li,isNamed:()=>_d,isOperationCancelled:()=>en,isReference:()=>Rt,isRootCstNode:()=>va,isTokenTypeArray:()=>kd,isTokenTypeDictionary:()=>lg,loadGrammarFromJson:()=>Dd,parseJSDoc:()=>Xc,prepareLangiumParser:()=>eb,setInterruptionPeriod:()=>ob,startCancelableOperation:()=>Td,stream:()=>Z,toDiagnosticData:()=>fb,toDiagnosticSeverity:()=>Cd});var Ou={};En(Ou,{DefaultNameRegexp:()=>Iu,RangeComparison:()=>Mr,compareRange:()=>xv,findCommentNode:()=>Ta,findDeclarationNodeAtOffset:()=>Kt,findLeafNodeAtOffset:()=>Ch,findLeafNodeBeforeOffset:()=>Ra,flattenCst:()=>Rh,getInteriorNodes:()=>xA,getNextNode:()=>yA,getPreviousNode:()=>Rv,getStartlineNode:()=>vA,inRange:()=>bh,isChildNode:()=>_h,isCommentNode:()=>Th,streamCst:()=>di,toDocumentSegment:()=>fi,tokenToRange:()=>to});function we(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Rt(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function xh(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function li(t){return typeof t=="object"&&t!==null&&we(t.container)&&Rt(t.reference)&&typeof t.message=="string"}var ui=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,r){return we(e)&&this.isSubtype(e.$type,r)}isSubtype(e,r){if(e===r)return!0;let n=this.subtypes[e];n||(n=this.subtypes[e]={});let i=n[r];if(i!==void 0)return i;{let o=this.computeIsSubtype(e,r);return n[r]=o,o}}getAllSubTypes(e){let r=this.allSubtypes[e];if(r)return r;{let n=this.getAllTypes(),i=[];for(let o of n)this.isSubtype(o,e)&&i.push(o);return this.allSubtypes[e]=i,i}}};function Er(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function An(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function va(t){return Er(t)&&typeof t.fullText=="string"}var or=class t{constructor(e,r){this.startFn=e,this.nextFn=r}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let e=this.iterator(),r=0,n=e.next();for(;!n.done;)r++,n=e.next();return r}toArray(){let e=[],r=this.iterator(),n;do n=r.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,r){let n=this.map(i=>[e?e(i):i,r?r(i):i]);return new Map(n)}toString(){return this.join()}concat(e){return new t(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),r=>{let n;if(!r.firstDone){do if(n=this.nextFn(r.first),!n.done)return n;while(!n.done);r.firstDone=!0}do if(n=r.iterator.next(),!n.done)return n;while(!n.done);return kt})}join(e=","){let r=this.iterator(),n="",i,o=!1;do i=r.next(),i.done||(o&&(n+=e),n+=gA(i.value)),o=!0;while(!i.done);return n}indexOf(e,r=0){let n=this.iterator(),i=0,o=n.next();for(;!o.done;){if(i>=r&&o.value===e)return i;o=n.next(),i++}return-1}every(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(!e(n.value))return!1;n=r.next()}return!0}some(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return!0;n=r.next()}return!1}forEach(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;)e(i.value,n),i=r.next(),n++}map(e){return new t(this.startFn,r=>{let{done:n,value:i}=this.nextFn(r);return n?kt:{done:!1,value:e(i)}})}filter(e){return new t(this.startFn,r=>{let n;do if(n=this.nextFn(r),!n.done&&e(n.value))return n;while(!n.done);return kt})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,r){let n=this.iterator(),i=r,o=n.next();for(;!o.done;)i===void 0?i=o.value:i=e(i,o.value),o=n.next();return i}reduceRight(e,r){return this.recursiveReduce(this.iterator(),e,r)}recursiveReduce(e,r,n){let i=e.next();if(i.done)return n;let o=this.recursiveReduce(e,r,n);return o===void 0?i.value:r(o,i.value)}find(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return n.value;n=r.next()}}findIndex(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;){if(e(i.value))return n;i=r.next(),n++}return-1}includes(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(n.value===e)return!0;n=r.next()}return!1}flatMap(e){return new t(()=>({this:this.startFn()}),r=>{do{if(r.iterator){let o=r.iterator.next();if(o.done)r.iterator=void 0;else return o}let{done:n,value:i}=this.nextFn(r.this);if(!n){let o=e(i);if(Du(o))r.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}}while(r.iterator);return kt})}flat(e){if(e===void 0&&(e=1),e<=0)return this;let r=e>1?this.flat(e-1):this;return new t(()=>({this:r.startFn()}),n=>{do{if(n.iterator){let s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}let{done:i,value:o}=r.nextFn(n.this);if(!i)if(Du(o))n.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}while(n.iterator);return kt})}head(){let r=this.iterator().next();if(!r.done)return r.value}tail(e=1){return new t(()=>{let r=this.startFn();for(let n=0;n<e;n++)if(this.nextFn(r).done)return r;return r},this.nextFn)}limit(e){return new t(()=>({size:0,state:this.startFn()}),r=>(r.size++,r.size>e?kt:this.nextFn(r.state)))}distinct(e){return new t(()=>({set:new Set,internalState:this.startFn()}),r=>{let n;do if(n=this.nextFn(r.internalState),!n.done){let i=e?e(n.value):n.value;if(!r.set.has(i))return r.set.add(i),n}while(!n.done);return kt})}exclude(e,r){let n=new Set;for(let i of e){let o=r?r(i):i;n.add(o)}return this.filter(i=>{let o=r?r(i):i;return!n.has(o)})}};function gA(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function Du(t){return!!t&&typeof t[Symbol.iterator]=="function"}var xa=new or(()=>{},()=>kt),kt=Object.freeze({done:!0,value:void 0});function Z(...t){if(t.length===1){let e=t[0];if(e instanceof or)return e;if(Du(e))return new or(()=>e[Symbol.iterator](),r=>r.next());if(typeof e.length=="number")return new or(()=>({index:0}),r=>r.index<e.length?{done:!1,value:e[r.index++]}:kt)}return t.length>1?new or(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){let r=e.iterator.next();if(!r.done)return r;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){let r=t[e.collIndex++];Du(r)?e.iterator=r[Symbol.iterator]():r&&typeof r.length=="number"&&(e.array=r)}}while(e.iterator||e.array||e.collIndex<t.length);return kt}):xa}var Lr=class extends or{constructor(e,r,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[r(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let s=i.iterators[i.iterators.length-1].next();if(s.done)i.iterators.pop();else return i.iterators.push(r(s.value)[Symbol.iterator]()),s}return kt})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}},eo;(function(t){function e(o){return o.reduce((s,a)=>s+a,0)}t.sum=e;function r(o){return o.reduce((s,a)=>s*a,0)}t.product=r;function n(o){return o.reduce((s,a)=>Math.min(s,a))}t.min=n;function i(o){return o.reduce((s,a)=>Math.max(s,a))}t.max=i})(eo||(eo={}));function di(t){return new Lr(t,e=>Er(e)?e.content:[],{includeRoot:!0})}function Rh(t){return di(t).filter(An)}function _h(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function to(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function fi(t){if(!t)return;let{offset:e,end:r,range:n}=t;return{range:n,offset:e,end:r,length:r-e}}var Mr;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside",t[t.Outside=5]="Outside"})(Mr||(Mr={}));function xv(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return Mr.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return Mr.After;let r=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,n=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return r&&n?Mr.Inside:r?Mr.OverlapBack:n?Mr.OverlapFront:Mr.Outside}function bh(t,e){return xv(t,e)>Mr.After}var Iu=/^[\w\p{L}]$/u;function Kt(t,e,r=Iu){if(t){if(e>0){let n=e-t.offset,i=t.text.charAt(n);r.test(i)||e--}return Ch(t,e)}}function Ta(t,e){if(t){let r=Rv(t,!0);if(r&&Th(r,e))return r;if(va(t)){let n=t.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let o=t.content[i];if(Th(o,e))return o}}}}function Th(t,e){return An(t)&&e.includes(t.tokenType.name)}function Ch(t,e){if(An(t))return t;if(Er(t)){let r=Tv(t,e,!1);if(r)return Ch(r,e)}}function Ra(t,e){if(An(t))return t;if(Er(t)){let r=Tv(t,e,!0);if(r)return Ra(r,e)}}function Tv(t,e,r){let n=0,i=t.content.length-1,o;for(;n<=i;){let s=Math.floor((n+i)/2),a=t.content[s];if(a.offset<=e&&a.end>e)return a;a.end<=e?(o=r?a:void 0,n=s+1):i=s-1}return o}function Rv(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t);for(;n>0;){n--;let i=r.content[n];if(e||!i.hidden)return i}t=r}}function yA(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t),i=r.content.length-1;for(;n<i;){n++;let o=r.content[n];if(e||!o.hidden)return o}t=r}}function vA(t){if(t.range.start.character===0)return t;let e=t.range.start.line,r=t,n;for(;t.container;){let i=t.container,o=n??i.content.indexOf(t);if(o===0?(t=i,n=void 0):(n=o-1,t=i.content[n]),t.range.start.line!==e)break;r=t}return r}function xA(t,e){let r=TA(t,e);return r?r.parent.content.slice(r.a+1,r.b):[]}function TA(t,e){let r=vv(t),n=vv(e),i;for(let o=0;o<r.length&&o<n.length;o++){let s=r[o],a=n[o];if(s.parent===a.parent)i={parent:s.parent,a:s.index,b:a.index};else break}return i}function vv(t){let e=[];for(;t.container;){let r=t.container,n=r.content.indexOf(t);e.push({parent:r,index:n}),t=r}return e.reverse()}var Gu={};En(Gu,{findAssignment:()=>np,findNameAssignment:()=>Hu,findNodeForKeyword:()=>tp,findNodeForProperty:()=>qa,findNodesForKeyword:()=>WA,findNodesForKeywordInternal:()=>rp,findNodesForProperty:()=>Zh,getActionAtElement:()=>Nv,getActionType:()=>Dv,getAllReachableRules:()=>Fa,getAllRulesUsedForCrossReferences:()=>jA,getCrossReferenceTerminal:()=>$a,getEntryRule:()=>Ma,getExplicitRuleType:()=>qr,getHiddenRules:()=>Ev,getRuleType:()=>op,getRuleTypeName:()=>GA,getTypeName:()=>_i,isArrayCardinality:()=>ip,isArrayOperator:()=>BA,isCommentTerminal:()=>Qh,isDataType:()=>HA,isDataTypeRule:()=>Ua,isOptionalCardinality:()=>Ri,terminalRegex:()=>Nn});var hi=class extends Error{constructor(e,r){super(e?`${r} at ${e.range.start.line}:${e.range.start.character}`:r)}};function Fr(t){throw new Error("Error! The input value was not handled.")}var gi={};En(gi,{AbstractElement:()=>io,AbstractRule:()=>ro,AbstractType:()=>no,Action:()=>Co,Alternatives:()=>So,ArrayLiteral:()=>oo,ArrayType:()=>so,Assignment:()=>ko,BooleanLiteral:()=>ao,CharacterRange:()=>Eo,Condition:()=>_a,Conjunction:()=>co,CrossReference:()=>Ao,Disjunction:()=>uo,EndOfFile:()=>wo,Grammar:()=>lo,GrammarImport:()=>Ca,Group:()=>No,InferredType:()=>fo,Interface:()=>ho,Keyword:()=>Po,LangiumGrammarAstReflection:()=>jo,LangiumGrammarTerminals:()=>RA,NamedArgument:()=>Sa,NegatedToken:()=>Do,Negation:()=>po,NumberLiteral:()=>mo,Parameter:()=>go,ParameterReference:()=>yo,ParserRule:()=>vo,ReferenceType:()=>xo,RegexToken:()=>Io,ReturnType:()=>ka,RuleCall:()=>Oo,SimpleType:()=>To,StringLiteral:()=>Ro,TerminalAlternatives:()=>Lo,TerminalGroup:()=>Mo,TerminalRule:()=>pi,TerminalRuleCall:()=>Fo,Type:()=>_o,TypeAttribute:()=>Ea,TypeDefinition:()=>Lu,UnionType:()=>bo,UnorderedGroup:()=>$o,UntilToken:()=>qo,ValueLiteral:()=>ba,Wildcard:()=>Uo,isAbstractElement:()=>mi,isAbstractRule:()=>_A,isAbstractType:()=>bA,isAction:()=>Ar,isAlternatives:()=>Wo,isArrayLiteral:()=>AA,isArrayType:()=>Sh,isAssignment:()=>Et,isBooleanLiteral:()=>kh,isCharacterRange:()=>Oh,isCondition:()=>CA,isConjunction:()=>Eh,isCrossReference:()=>sr,isDisjunction:()=>Ah,isEndOfFile:()=>Lh,isFeatureName:()=>SA,isGrammar:()=>wA,isGrammarImport:()=>NA,isGroup:()=>pr,isInferredType:()=>Aa,isInterface:()=>Mu,isKeyword:()=>lt,isNamedArgument:()=>PA,isNegatedToken:()=>Mh,isNegation:()=>wh,isNumberLiteral:()=>DA,isParameter:()=>IA,isParameterReference:()=>Nh,isParserRule:()=>Ie,isPrimitiveType:()=>_v,isReferenceType:()=>Ph,isRegexToken:()=>Fh,isReturnType:()=>Dh,isRuleCall:()=>Vt,isSimpleType:()=>Fu,isStringLiteral:()=>OA,isTerminalAlternatives:()=>$h,isTerminalGroup:()=>qh,isTerminalRule:()=>Mt,isTerminalRuleCall:()=>$u,isType:()=>wa,isTypeAttribute:()=>LA,isTypeDefinition:()=>kA,isUnionType:()=>Ih,isUnorderedGroup:()=>Bo,isUntilToken:()=>Uh,isValueLiteral:()=>EA,isWildcard:()=>jh,reflection:()=>V});var RA={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},ro="AbstractRule";function _A(t){return V.isInstance(t,ro)}var no="AbstractType";function bA(t){return V.isInstance(t,no)}var _a="Condition";function CA(t){return V.isInstance(t,_a)}function SA(t){return _v(t)||t==="current"||t==="entry"||t==="extends"||t==="false"||t==="fragment"||t==="grammar"||t==="hidden"||t==="import"||t==="interface"||t==="returns"||t==="terminal"||t==="true"||t==="type"||t==="infer"||t==="infers"||t==="with"||typeof t=="string"&&/\^?[_a-zA-Z][\w_]*/.test(t)}function _v(t){return t==="string"||t==="number"||t==="boolean"||t==="Date"||t==="bigint"}var Lu="TypeDefinition";function kA(t){return V.isInstance(t,Lu)}var ba="ValueLiteral";function EA(t){return V.isInstance(t,ba)}var io="AbstractElement";function mi(t){return V.isInstance(t,io)}var oo="ArrayLiteral";function AA(t){return V.isInstance(t,oo)}var so="ArrayType";function Sh(t){return V.isInstance(t,so)}var ao="BooleanLiteral";function kh(t){return V.isInstance(t,ao)}var co="Conjunction";function Eh(t){return V.isInstance(t,co)}var uo="Disjunction";function Ah(t){return V.isInstance(t,uo)}var lo="Grammar";function wA(t){return V.isInstance(t,lo)}var Ca="GrammarImport";function NA(t){return V.isInstance(t,Ca)}var fo="InferredType";function Aa(t){return V.isInstance(t,fo)}var ho="Interface";function Mu(t){return V.isInstance(t,ho)}var Sa="NamedArgument";function PA(t){return V.isInstance(t,Sa)}var po="Negation";function wh(t){return V.isInstance(t,po)}var mo="NumberLiteral";function DA(t){return V.isInstance(t,mo)}var go="Parameter";function IA(t){return V.isInstance(t,go)}var yo="ParameterReference";function Nh(t){return V.isInstance(t,yo)}var vo="ParserRule";function Ie(t){return V.isInstance(t,vo)}var xo="ReferenceType";function Ph(t){return V.isInstance(t,xo)}var ka="ReturnType";function Dh(t){return V.isInstance(t,ka)}var To="SimpleType";function Fu(t){return V.isInstance(t,To)}var Ro="StringLiteral";function OA(t){return V.isInstance(t,Ro)}var pi="TerminalRule";function Mt(t){return V.isInstance(t,pi)}var _o="Type";function wa(t){return V.isInstance(t,_o)}var Ea="TypeAttribute";function LA(t){return V.isInstance(t,Ea)}var bo="UnionType";function Ih(t){return V.isInstance(t,bo)}var Co="Action";function Ar(t){return V.isInstance(t,Co)}var So="Alternatives";function Wo(t){return V.isInstance(t,So)}var ko="Assignment";function Et(t){return V.isInstance(t,ko)}var Eo="CharacterRange";function Oh(t){return V.isInstance(t,Eo)}var Ao="CrossReference";function sr(t){return V.isInstance(t,Ao)}var wo="EndOfFile";function Lh(t){return V.isInstance(t,wo)}var No="Group";function pr(t){return V.isInstance(t,No)}var Po="Keyword";function lt(t){return V.isInstance(t,Po)}var Do="NegatedToken";function Mh(t){return V.isInstance(t,Do)}var Io="RegexToken";function Fh(t){return V.isInstance(t,Io)}var Oo="RuleCall";function Vt(t){return V.isInstance(t,Oo)}var Lo="TerminalAlternatives";function $h(t){return V.isInstance(t,Lo)}var Mo="TerminalGroup";function qh(t){return V.isInstance(t,Mo)}var Fo="TerminalRuleCall";function $u(t){return V.isInstance(t,Fo)}var $o="UnorderedGroup";function Bo(t){return V.isInstance(t,$o)}var qo="UntilToken";function Uh(t){return V.isInstance(t,qo)}var Uo="Wildcard";function jh(t){return V.isInstance(t,Uo)}var jo=class extends ui{getAllTypes(){return[io,ro,no,Co,So,oo,so,ko,ao,Eo,_a,co,Ao,uo,wo,lo,Ca,No,fo,ho,Po,Sa,Do,po,mo,go,yo,vo,xo,Io,ka,Oo,To,Ro,Lo,Mo,pi,Fo,_o,Ea,Lu,bo,$o,qo,ba,Uo]}computeIsSubtype(e,r){switch(e){case Co:case So:case ko:case Eo:case Ao:case wo:case No:case Po:case Do:case Io:case Oo:case Lo:case Mo:case Fo:case $o:case qo:case Uo:return this.isSubtype(io,r);case oo:case mo:case Ro:return this.isSubtype(ba,r);case so:case xo:case To:case bo:return this.isSubtype(Lu,r);case ao:return this.isSubtype(_a,r)||this.isSubtype(ba,r);case co:case uo:case po:case yo:return this.isSubtype(_a,r);case fo:case ho:case _o:return this.isSubtype(no,r);case vo:return this.isSubtype(ro,r)||this.isSubtype(no,r);case pi:return this.isSubtype(ro,r);default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;switch(r){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return no;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return ro;case"Grammar:usedGrammars":return lo;case"NamedArgument:parameter":case"ParameterReference:parameter":return go;case"TerminalRuleCall:rule":return pi;default:throw new Error(`${r} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case io:return{name:io,properties:[{name:"cardinality"},{name:"lookahead"}]};case oo:return{name:oo,properties:[{name:"elements",defaultValue:[]}]};case so:return{name:so,properties:[{name:"elementType"}]};case ao:return{name:ao,properties:[{name:"true",defaultValue:!1}]};case co:return{name:co,properties:[{name:"left"},{name:"right"}]};case uo:return{name:uo,properties:[{name:"left"},{name:"right"}]};case lo:return{name:lo,properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case Ca:return{name:Ca,properties:[{name:"path"}]};case fo:return{name:fo,properties:[{name:"name"}]};case ho:return{name:ho,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case Sa:return{name:Sa,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case po:return{name:po,properties:[{name:"value"}]};case mo:return{name:mo,properties:[{name:"value"}]};case go:return{name:go,properties:[{name:"name"}]};case yo:return{name:yo,properties:[{name:"parameter"}]};case vo:return{name:vo,properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case xo:return{name:xo,properties:[{name:"referenceType"}]};case ka:return{name:ka,properties:[{name:"name"}]};case To:return{name:To,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case Ro:return{name:Ro,properties:[{name:"value"}]};case pi:return{name:pi,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case _o:return{name:_o,properties:[{name:"name"},{name:"type"}]};case Ea:return{name:Ea,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case bo:return{name:bo,properties:[{name:"types",defaultValue:[]}]};case Co:return{name:Co,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case So:return{name:So,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case ko:return{name:ko,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case Eo:return{name:Eo,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case Ao:return{name:Ao,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case wo:return{name:wo,properties:[{name:"cardinality"},{name:"lookahead"}]};case No:return{name:No,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case Po:return{name:Po,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case Do:return{name:Do,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Io:return{name:Io,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case Oo:return{name:Oo,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Lo:return{name:Lo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Mo:return{name:Mo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Fo:return{name:Fo,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case $o:return{name:$o,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case qo:return{name:qo,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Uo:return{name:Uo,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}},V=new jo;var Uu={};En(Uu,{assignMandatoryProperties:()=>Pa,copyAstNode:()=>Bh,findLocalReferences:()=>FA,findRootNode:()=>Na,getContainerOfType:()=>ar,getDocument:()=>rt,hasContainerOfType:()=>MA,linkContentToContainer:()=>qu,streamAllContents:()=>cr,streamAst:()=>mr,streamContents:()=>yi,streamReferences:()=>Ho});function qu(t){for(let[e,r]of Object.entries(t))e.startsWith("$")||(Array.isArray(r)?r.forEach((n,i)=>{we(n)&&(n.$container=t,n.$containerProperty=e,n.$containerIndex=i)}):we(r)&&(r.$container=t,r.$containerProperty=e))}function ar(t,e){let r=t;for(;r;){if(e(r))return r;r=r.$container}}function MA(t,e){let r=t;for(;r;){if(e(r))return!0;r=r.$container}return!1}function rt(t){let r=Na(t).$document;if(!r)throw new Error("AST node has no document.");return r}function Na(t){for(;t.$container;)t=t.$container;return t}function yi(t,e){if(!t)throw new Error("Node must be an AstNode.");let r=e?.range;return new or(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndex<n.keys.length;){let i=n.keys[n.keyIndex];if(!i.startsWith("$")){let o=t[i];if(we(o)){if(n.keyIndex++,Wh(o,r))return{done:!1,value:o}}else if(Array.isArray(o)){for(;n.arrayIndex<o.length;){let s=n.arrayIndex++,a=o[s];if(we(a)&&Wh(a,r))return{done:!1,value:a}}n.arrayIndex=0}}n.keyIndex++}return kt})}function cr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new Lr(t,r=>yi(r,e))}function mr(t,e){if(t){if(e?.range&&!Wh(t,e.range))return new Lr(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new Lr(t,r=>yi(r,e),{includeRoot:!0})}function Wh(t,e){var r;if(!e)return!0;let n=(r=t.$cstNode)===null||r===void 0?void 0:r.range;return n?bh(n,e):!1}function Ho(t){return new or(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){let r=e.keys[e.keyIndex];if(!r.startsWith("$")){let n=t[r];if(Rt(n))return e.keyIndex++,{done:!1,value:{reference:n,container:t,property:r}};if(Array.isArray(n)){for(;e.arrayIndex<n.length;){let i=e.arrayIndex++,o=n[i];if(Rt(o))return{done:!1,value:{reference:o,container:t,property:r,index:i}}}e.arrayIndex=0}}e.keyIndex++}return kt})}function FA(t,e=rt(t).parseResult.value){let r=[];return mr(e).forEach(n=>{Ho(n).forEach(i=>{i.reference.ref===t&&r.push(i.reference)})}),Z(r)}function Pa(t,e){let r=t.getTypeMetaData(e.$type),n=e;for(let i of r.properties)i.defaultValue!==void 0&&n[i.name]===void 0&&(n[i.name]=bv(i.defaultValue))}function bv(t){return Array.isArray(t)?[...t.map(bv)]:t}function Bh(t,e){let r={$type:t.$type};for(let[n,i]of Object.entries(t))if(!n.startsWith("$"))if(we(i))r[n]=Bh(i,e);else if(Rt(i))r[n]=e(r,n,i.$refNode,i.$refText);else if(Array.isArray(i)){let o=[];for(let s of i)we(s)?o.push(Bh(s,e)):Rt(s)?o.push(e(r,n,s.$refNode,s.$refText)):o.push(s);r[n]=o}else r[n]=i;return qu(r),r}var Bu={};En(Bu,{NEWLINE_REGEXP:()=>Kh,escapeRegExp:()=>wn,getTerminalParts:()=>UA,isMultilineComment:()=>Vh,isWhitespace:()=>La,partialMatches:()=>Xh,partialRegExp:()=>kv,whitespaceCharacters:()=>Sv});function G(t){return t.charCodeAt(0)}function ju(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function Go(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function vi(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Da(){throw Error("Internal Error - Should never get here!")}function Hh(t){return t.type==="Character"}var Ia=[];for(let t=G("0");t<=G("9");t++)Ia.push(t);var Oa=[G("_")].concat(Ia);for(let t=G("a");t<=G("z");t++)Oa.push(t);for(let t=G("A");t<=G("Z");t++)Oa.push(t);var Gh=[G(" "),G("\f"),G(`
36
+ `),G("\r"),G(" "),G("\v"),G(" "),G("\xA0"),G("\u1680"),G("\u2000"),G("\u2001"),G("\u2002"),G("\u2003"),G("\u2004"),G("\u2005"),G("\u2006"),G("\u2007"),G("\u2008"),G("\u2009"),G("\u200A"),G("\u2028"),G("\u2029"),G("\u202F"),G("\u205F"),G("\u3000"),G("\uFEFF")];var $A=/[0-9a-fA-F]/,Wu=/[0-9]/,qA=/[1-9]/,xi=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("/");let r=this.disjunction();this.consumeChar("/");let n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Go(n,"global");break;case"i":Go(n,"ignoreCase");break;case"m":Go(n,"multiLine");break;case"u":Go(n,"unicode");break;case"y":Go(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(){let 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(){let 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(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break}vi(r);let n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return Da()}quantifier(e=!1){let r,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"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:i,atMost:i};break;case",":let o;this.isDigit()?(o=this.integerIncludingZero(),r={atLeast:i,atMost:o}):r={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;vi(r);break}if(!(e===!0&&r===void 0)&&vi(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,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}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),vi(e)?(e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):Da()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[G(`
37
+ `),G("\r"),G("\u2028"),G("\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=Ia;break;case"D":e=Ia,r=!0;break;case"s":e=Gh;break;case"S":e=Gh,r=!0;break;case"w":e=Oa;break;case"W":e=Oa,r=!0;break}return vi(e)?{type:"Set",value:e,complement:r}:Da()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=G("\f");break;case"n":e=G(`
38
+ `);break;case"r":e=G("\r");break;case"t":e=G(" ");break;case"v":e=G("\v");break}return vi(e)?{type:"Character",value:e}:Da()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:G("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:G(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
39
+ `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:G(e)}}}characterClass(){let e=[],r=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),r=!0);this.isClassAtom();){let n=this.classAtom(),i=n.type==="Character";if(Hh(n)&&this.isRangeDash()){this.consumeChar("-");let o=this.classAtom(),s=o.type==="Character";if(Hh(o)){if(o.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:o.value})}else ju(n.value,e),e.push(G("-")),ju(o.value,e)}else ju(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:r,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
40
+ `: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:G("\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}let r=this.disjunction();this.consumeChar(")");let n={type:"Group",capturing:e,value:r};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(qA.test(e)===!1)throw Error("Expecting a positive integer");for(;Wu.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Wu.test(e)===!1)throw Error("Expecting an integer");for(;Wu.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
41
41
  `: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:G(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 Wu.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
42
42
  `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){let 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`
43
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let r="";for(let i=0;i<e;i++){let o=this.popChar();if(MA.test(o)===!1)throw Error("Expecting a HexDecimal digits");r+=o}return{type:"Character",value:parseInt(r,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let 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}}};var $r=class{visitChildren(e){for(let r in e){let n=e[r];e.hasOwnProperty(r)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}};var Gh=/\r?\n/gm,_v=new xi,Hh=class extends $r{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let r=String.fromCharCode(e.value);if(!this.multiline&&r===`
43
+ `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let r="";for(let i=0;i<e;i++){let o=this.popChar();if($A.test(o)===!1)throw Error("Expecting a HexDecimal digits");r+=o}return{type:"Character",value:parseInt(r,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let 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}}};var $r=class{visitChildren(e){for(let r in e){let n=e[r];e.hasOwnProperty(r)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}};var Kh=/\r?\n/gm,Cv=new xi,zh=class extends $r{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let r=String.fromCharCode(e.value);if(!this.multiline&&r===`
44
44
  `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let n=wn(r);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitSet(e){if(!this.multiline){let r=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(r);this.multiline=!!`
45
- `.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let 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)}},Ti=new Hh;function $A(t){try{typeof t!="string"&&(t=t.source),t=`/${t}/`;let e=_v.pattern(t),r=[];for(let n of e.value.value)Ti.reset(t),Ti.visit(n),r.push({start:Ti.startRegexp,end:Ti.endRegex});return r}catch{return[]}}function zh(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Ti.reset(t),Ti.visit(_v.pattern(t)),Ti.multiline}catch{return!1}}var bv=`\f
46
- \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function Oa(t){let e=typeof t=="string"?new RegExp(t):t;return bv.some(r=>e.test(r))}function wn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Kh(t,e){let r=Cv(t),n=e.match(r);return!!n&&n[0].length>0}function Cv(t){typeof t=="string"&&(t=new RegExp(t));let e=t,r=t.source,n=0;function i(){let o="",s;function a(u){o+=r.substr(n,u),n+=u}function c(u){o+="(?:"+r.substr(n,u)+"|$)",n+=u}for(;n<r.length;)switch(r[n]){case"\\":switch(r[n+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?r[n+2]==="{"?c(r.indexOf("}",n)-n+1):c(6):c(2);break;case"p":case"P":e.unicode?c(r.indexOf("}",n)-n+1):c(2);break;case"k":c(r.indexOf(">",n)-n+1);break;default:c(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=n,s=s.exec(r)||[],c(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=n,s=s.exec(r),s?a(s[0].length):c(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":o+="(?:",n+=3,o+=i()+"|$)";break;case"=":o+="(?=",n+=3,o+=i()+")";break;case"!":s=n,n+=3,i(),o+=r.substr(s,n-s);break;case"<":switch(r[n+3]){case"=":case"!":s=n,n+=4,i(),o+=r.substr(s,n-s);break;default:a(r.indexOf(">",n)-n+1),o+=i()+"|$)";break}break}else a(1),o+=i()+"|$)";break;case")":return++n,o;default:c(1);break}return o}return new RegExp(i(),t.flags)}function La(t){return t.rules.find(e=>Ie(e)&&e.entry)}function kv(t){return t.rules.filter(e=>Mt(e)&&e.hidden)}function Ma(t,e){let r=new Set,n=La(t);if(!n)return new Set(t.rules);let i=[n].concat(kv(t));for(let s of i)Sv(s,r,e);let o=new Set;for(let s of t.rules)(r.has(s.name)||Mt(s)&&s.hidden)&&o.add(s);return o}function Sv(t,e,r){e.add(t.name),cr(t).forEach(n=>{if(Vt(n)||r&&$u(n)){let i=n.rule.ref;i&&!e.has(i.name)&&Sv(i,e,r)}})}function qA(t){let e=new Set;return cr(t).forEach(r=>{sr(r)&&(Ie(r.type.ref)&&e.add(r.type.ref),Ea(r.type.ref)&&Ie(r.type.ref.$container)&&e.add(r.type.ref.$container))}),e}function Fa(t){if(t.terminal)return t.terminal;if(t.type.ref){let e=Hu(t.type.ref);return e?.terminal}}function Yh(t){return t.hidden&&!Oa(Nn(t))}function Jh(t,e){return!t||!e?[]:Qh(t,e,t.astNode,!0)}function $a(t,e,r){if(!t||!e)return;let n=Qh(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]}function Qh(t,e,r,n){if(!n){let i=ar(t.grammarSource,Et);if(i&&i.feature===e)return[t]}return Er(t)&&t.astNode===r?t.content.flatMap(i=>Qh(i,e,r,!1)):[]}function UA(t,e){return t?ep(t,e,t?.astNode):[]}function Zh(t,e,r){if(!t)return;let n=ep(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]}function ep(t,e,r){if(t.astNode!==r)return[];if(lt(t.grammarSource)&&t.grammarSource.value===e)return[t];let n=di(t).iterator(),i,o=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?lt(s.grammarSource)&&s.grammarSource.value===e&&o.push(s):n.prune()}while(!i.done);return o}function tp(t){var e;let r=t.astNode;for(;r===((e=t.container)===null||e===void 0?void 0:e.astNode);){let n=ar(t.grammarSource,Et);if(n)return n;t=t.container}}function Hu(t){let e=t;return Ea(e)&&(Ar(e.$container)?e=e.$container.$container:Ie(e.$container)?e=e.$container:Fr(e.$container)),Ev(t,e,new Map)}function Ev(t,e,r){var n;function i(o,s){let a;return ar(o,Et)||(a=Ev(s,s,r)),r.set(t,a),a}if(r.has(t))return r.get(t);r.set(t,void 0);for(let o of cr(e)){if(Et(o)&&o.feature.toLowerCase()==="name")return r.set(t,o),o;if(Vt(o)&&Ie(o.rule.ref))return i(o,o.rule.ref);if(Fu(o)&&(!((n=o.typeRef)===null||n===void 0)&&n.ref))return i(o,o.typeRef.ref)}}function Av(t){let e=t.$container;if(pr(e)){let r=e.elements,n=r.indexOf(t);for(let i=n-1;i>=0;i--){let o=r[i];if(Ar(o))return o;{let s=cr(r[i]).find(Ar);if(s)return s}}}if(mi(e))return Av(e)}function Ri(t,e){return t==="?"||t==="*"||pr(e)&&!!e.guardCondition}function rp(t){return t==="*"||t==="+"}function jA(t){return t==="+="}function qa(t){return wv(t,new Set)}function wv(t,e){if(e.has(t))return!0;e.add(t);for(let r of cr(t))if(Vt(r)){if(!r.rule.ref||Ie(r.rule.ref)&&!wv(r.rule.ref,e))return!1}else{if(Et(r))return!1;if(Ar(r))return!1}return!!t.definition}function WA(t){return Xh(t.type,new Set)}function Xh(t,e){if(e.has(t))return!0;if(e.add(t),bh(t))return!1;if(wh(t))return!1;if(Ph(t))return t.types.every(r=>Xh(r,e));if(Fu(t)){if(t.primitiveType!==void 0)return!0;if(t.stringType!==void 0)return!0;if(t.typeRef!==void 0){let r=t.typeRef.ref;return Aa(r)?Xh(r.type,e):!1}else return!1}else return!1}function qr(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){let e=t.returnType.ref;if(e){if(Ie(e))return e.name;if(Mu(e)||Aa(e))return e.name}}}function _i(t){var e;if(Ie(t))return qa(t)?t.name:(e=qr(t))!==null&&e!==void 0?e:t.name;if(Mu(t)||Aa(t)||Nh(t))return t.name;if(Ar(t)){let r=Nv(t);if(r)return r}else if(Ea(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function Nv(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return _i(t.type.ref)}function BA(t){var e,r,n;return Mt(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":qa(t)?t.name:(n=qr(t))!==null&&n!==void 0?n:t.name}function np(t){var e,r,n;return Mt(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":(n=qr(t))!==null&&n!==void 0?n:t.name}function Nn(t){let e={s:!1,i:!1,u:!1},r=Go(t.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(r,n)}var ip=/[\s\S]/.source;function Go(t,e){if(Mh(t))return HA(t);if(Fh(t))return GA(t);if(Dh(t))return VA(t);if($u(t)){let r=t.rule.ref;if(!r)throw new Error("Missing rule reference.");return un(Go(r.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(Oh(t))return KA(t);if($h(t))return zA(t);if(Lh(t)){let r=t.regex.lastIndexOf("/"),n=t.regex.substring(1,r),i=t.regex.substring(r+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),un(n,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(qh(t))return un(ip,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function HA(t){return un(t.elements.map(e=>Go(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function GA(t){return un(t.elements.map(e=>Go(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function zA(t){return un(`${ip}*?${Go(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function KA(t){return un(`(?!${Go(t.terminal)})${ip}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function VA(t){return t.right?un(`[${Vh(t.left)}-${Vh(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):un(Vh(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function Vh(t){return wn(t.value)}function un(t,e){var r;return(e.wrap!==!1||e.lookahead)&&(t=`(${(r=e.lookahead)!==null&&r!==void 0?r:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}function op(t){let e=[],r=t.Grammar;for(let n of r.rules)Mt(n)&&Yh(n)&&zh(Nn(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:Iu}}var XA=typeof window=="object"&&window&&window.Object===Object&&window,zu=XA;var YA=typeof self=="object"&&self&&self.Object===Object&&self,JA=zu||YA||Function("return this")(),nt=JA;var QA=nt.Symbol,pt=QA;var Pv=Object.prototype,ZA=Pv.hasOwnProperty,ew=Pv.toString,Ua=pt?pt.toStringTag:void 0;function tw(t){var e=ZA.call(t,Ua),r=t[Ua];try{t[Ua]=void 0;var n=!0}catch{}var i=ew.call(t);return n&&(e?t[Ua]=r:delete t[Ua]),i}var Dv=tw;var rw=Object.prototype,nw=rw.toString;function iw(t){return nw.call(t)}var Iv=iw;var ow="[object Null]",sw="[object Undefined]",Ov=pt?pt.toStringTag:void 0;function aw(t){return t==null?t===void 0?sw:ow:Ov&&Ov in Object(t)?Dv(t):Iv(t)}var Ft=aw;function cw(t){return t!=null&&typeof t=="object"}var Qe=cw;var uw="[object Symbol]";function lw(t){return typeof t=="symbol"||Qe(t)&&Ft(t)==uw}var Ur=lw;function dw(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var jr=dw;var fw=Array.isArray,q=fw;var hw=1/0,Lv=pt?pt.prototype:void 0,Mv=Lv?Lv.toString:void 0;function Fv(t){if(typeof t=="string")return t;if(q(t))return jr(t,Fv)+"";if(Ur(t))return Mv?Mv.call(t):"";var e=t+"";return e=="0"&&1/t==-hw?"-0":e}var $v=Fv;var pw=/\s/;function mw(t){for(var e=t.length;e--&&pw.test(t.charAt(e)););return e}var qv=mw;var gw=/^\s+/;function yw(t){return t&&t.slice(0,qv(t)+1).replace(gw,"")}var Uv=yw;function vw(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ue=vw;var jv=NaN,xw=/^[-+]0x[0-9a-f]+$/i,Tw=/^0b[01]+$/i,Rw=/^0o[0-7]+$/i,_w=parseInt;function bw(t){if(typeof t=="number")return t;if(Ur(t))return jv;if(Ue(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ue(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Uv(t);var r=Tw.test(t);return r||Rw.test(t)?_w(t.slice(2),r?2:8):xw.test(t)?jv:+t}var Wv=bw;var Bv=1/0,Cw=17976931348623157e292;function kw(t){if(!t)return t===0?t:0;if(t=Wv(t),t===Bv||t===-Bv){var e=t<0?-1:1;return e*Cw}return t===t?t:0}var Hv=kw;function Sw(t){var e=Hv(t),r=e%1;return e===e?r?e-r:e:0}var Wr=Sw;function Ew(t){return t}var Xt=Ew;var Aw="[object AsyncFunction]",ww="[object Function]",Nw="[object GeneratorFunction]",Pw="[object Proxy]";function Dw(t){if(!Ue(t))return!1;var e=Ft(t);return e==ww||e==Nw||e==Aw||e==Pw}var $t=Dw;var Iw=nt["__core-js_shared__"],Ku=Iw;var Gv=(function(){var t=/[^.]+$/.exec(Ku&&Ku.keys&&Ku.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Ow(t){return!!Gv&&Gv in t}var zv=Ow;var Lw=Function.prototype,Mw=Lw.toString;function Fw(t){if(t!=null){try{return Mw.call(t)}catch{}try{return t+""}catch{}}return""}var ln=Fw;var $w=/[\\^$.*+?()[\]{}|]/g,qw=/^\[object .+?Constructor\]$/,Uw=Function.prototype,jw=Object.prototype,Ww=Uw.toString,Bw=jw.hasOwnProperty,Hw=RegExp("^"+Ww.call(Bw).replace($w,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Gw(t){if(!Ue(t)||zv(t))return!1;var e=$t(t)?Hw:qw;return e.test(ln(t))}var Kv=Gw;function zw(t,e){return t?.[e]}var Vv=zw;function Kw(t,e){var r=Vv(t,e);return Kv(r)?r:void 0}var Yt=Kw;var Vw=Yt(nt,"WeakMap"),Vu=Vw;var Xv=Object.create,Xw=(function(){function t(){}return function(e){if(!Ue(e))return{};if(Xv)return Xv(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),Yv=Xw;function Yw(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Jv=Yw;function Jw(){}var je=Jw;function Qw(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var Qv=Qw;var Zw=800,eN=16,tN=Date.now;function rN(t){var e=0,r=0;return function(){var n=tN(),i=eN-(n-r);if(r=n,i>0){if(++e>=Zw)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Zv=rN;function nN(t){return function(){return t}}var ex=nN;var iN=(function(){try{var t=Yt(Object,"defineProperty");return t({},"",{}),t}catch{}})(),zo=iN;var oN=zo?function(t,e){return zo(t,"toString",{configurable:!0,enumerable:!1,value:ex(e),writable:!0})}:Xt,tx=oN;var sN=Zv(tx),rx=sN;function aN(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Xu=aN;function cN(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}var Yu=cN;function uN(t){return t!==t}var nx=uN;function lN(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var ix=lN;function dN(t,e,r){return e===e?ix(t,e,r):Yu(t,nx,r)}var Ko=dN;function fN(t,e){var r=t==null?0:t.length;return!!r&&Ko(t,e,0)>-1}var Ju=fN;var hN=9007199254740991,pN=/^(?:0|[1-9]\d*)$/;function mN(t,e){var r=typeof t;return e=e??hN,!!e&&(r=="number"||r!="symbol"&&pN.test(t))&&t>-1&&t%1==0&&t<e}var Pn=mN;function gN(t,e,r){e=="__proto__"&&zo?zo(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Vo=gN;function yN(t,e){return t===e||t!==t&&e!==e}var Br=yN;var vN=Object.prototype,xN=vN.hasOwnProperty;function TN(t,e,r){var n=t[e];(!(xN.call(t,e)&&Br(n,r))||r===void 0&&!(e in t))&&Vo(t,e,r)}var Dn=TN;function RN(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;c===void 0&&(c=t[a]),i?Vo(r,a,c):Dn(r,a,c)}return r}var Hr=RN;var ox=Math.max;function _N(t,e,r){return e=ox(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=ox(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),Jv(t,this,a)}}var sx=_N;function bN(t,e){return rx(sx(t,e,Xt),t+"")}var Xo=bN;var CN=9007199254740991;function kN(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=CN}var Yo=kN;function SN(t){return t!=null&&Yo(t.length)&&!$t(t)}var it=SN;function EN(t,e,r){if(!Ue(r))return!1;var n=typeof e;return(n=="number"?it(r)&&Pn(e,r.length):n=="string"&&e in r)?Br(r[e],t):!1}var In=EN;function AN(t){return Xo(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&In(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,o)}return e})}var ax=AN;var wN=Object.prototype;function NN(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||wN;return t===r}var Gr=NN;function PN(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var cx=PN;var DN="[object Arguments]";function IN(t){return Qe(t)&&Ft(t)==DN}var sp=IN;var ux=Object.prototype,ON=ux.hasOwnProperty,LN=ux.propertyIsEnumerable,MN=sp((function(){return arguments})())?sp:function(t){return Qe(t)&&ON.call(t,"callee")&&!LN.call(t,"callee")},On=MN;function FN(){return!1}var lx=FN;var hx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,dx=hx&&typeof module=="object"&&module&&!module.nodeType&&module,$N=dx&&dx.exports===hx,fx=$N?nt.Buffer:void 0,qN=fx?fx.isBuffer:void 0,UN=qN||lx,dn=UN;var jN="[object Arguments]",WN="[object Array]",BN="[object Boolean]",HN="[object Date]",GN="[object Error]",zN="[object Function]",KN="[object Map]",VN="[object Number]",XN="[object Object]",YN="[object RegExp]",JN="[object Set]",QN="[object String]",ZN="[object WeakMap]",eP="[object ArrayBuffer]",tP="[object DataView]",rP="[object Float32Array]",nP="[object Float64Array]",iP="[object Int8Array]",oP="[object Int16Array]",sP="[object Int32Array]",aP="[object Uint8Array]",cP="[object Uint8ClampedArray]",uP="[object Uint16Array]",lP="[object Uint32Array]",Ne={};Ne[rP]=Ne[nP]=Ne[iP]=Ne[oP]=Ne[sP]=Ne[aP]=Ne[cP]=Ne[uP]=Ne[lP]=!0;Ne[jN]=Ne[WN]=Ne[eP]=Ne[BN]=Ne[tP]=Ne[HN]=Ne[GN]=Ne[zN]=Ne[KN]=Ne[VN]=Ne[XN]=Ne[YN]=Ne[JN]=Ne[QN]=Ne[ZN]=!1;function dP(t){return Qe(t)&&Yo(t.length)&&!!Ne[Ft(t)]}var px=dP;function fP(t){return function(e){return t(e)}}var zr=fP;var mx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ja=mx&&typeof module=="object"&&module&&!module.nodeType&&module,hP=ja&&ja.exports===mx,ap=hP&&zu.process,pP=(function(){try{var t=ja&&ja.require&&ja.require("util").types;return t||ap&&ap.binding&&ap.binding("util")}catch{}})(),gr=pP;var gx=gr&&gr.isTypedArray,mP=gx?zr(gx):px,Jo=mP;var gP=Object.prototype,yP=gP.hasOwnProperty;function vP(t,e){var r=q(t),n=!r&&On(t),i=!r&&!n&&dn(t),o=!r&&!n&&!i&&Jo(t),s=r||n||i||o,a=s?cx(t.length,String):[],c=a.length;for(var u in t)(e||yP.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Pn(u,c)))&&a.push(u);return a}var Qu=vP;function xP(t,e){return function(r){return t(e(r))}}var Zu=xP;var TP=Zu(Object.keys,Object),yx=TP;var RP=Object.prototype,_P=RP.hasOwnProperty;function bP(t){if(!Gr(t))return yx(t);var e=[];for(var r in Object(t))_P.call(t,r)&&r!="constructor"&&e.push(r);return e}var el=bP;function CP(t){return it(t)?Qu(t):el(t)}var Re=CP;var kP=Object.prototype,SP=kP.hasOwnProperty,EP=ax(function(t,e){if(Gr(e)||it(e)){Hr(e,Re(e),t);return}for(var r in e)SP.call(e,r)&&Dn(t,r,e[r])}),_t=EP;function AP(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var vx=AP;var wP=Object.prototype,NP=wP.hasOwnProperty;function PP(t){if(!Ue(t))return vx(t);var e=Gr(t),r=[];for(var n in t)n=="constructor"&&(e||!NP.call(t,n))||r.push(n);return r}var xx=PP;function DP(t){return it(t)?Qu(t,!0):xx(t)}var Ln=DP;var IP=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,OP=/^\w*$/;function LP(t,e){if(q(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ur(t)?!0:OP.test(t)||!IP.test(t)||e!=null&&t in Object(e)}var Qo=LP;var MP=Yt(Object,"create"),fn=MP;function FP(){this.__data__=fn?fn(null):{},this.size=0}var Tx=FP;function $P(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Rx=$P;var qP="__lodash_hash_undefined__",UP=Object.prototype,jP=UP.hasOwnProperty;function WP(t){var e=this.__data__;if(fn){var r=e[t];return r===qP?void 0:r}return jP.call(e,t)?e[t]:void 0}var _x=WP;var BP=Object.prototype,HP=BP.hasOwnProperty;function GP(t){var e=this.__data__;return fn?e[t]!==void 0:HP.call(e,t)}var bx=GP;var zP="__lodash_hash_undefined__";function KP(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=fn&&e===void 0?zP:e,this}var Cx=KP;function Zo(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])}}Zo.prototype.clear=Tx;Zo.prototype.delete=Rx;Zo.prototype.get=_x;Zo.prototype.has=bx;Zo.prototype.set=Cx;var cp=Zo;function VP(){this.__data__=[],this.size=0}var kx=VP;function XP(t,e){for(var r=t.length;r--;)if(Br(t[r][0],e))return r;return-1}var Mn=XP;var YP=Array.prototype,JP=YP.splice;function QP(t){var e=this.__data__,r=Mn(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():JP.call(e,r,1),--this.size,!0}var Sx=QP;function ZP(t){var e=this.__data__,r=Mn(e,t);return r<0?void 0:e[r][1]}var Ex=ZP;function eD(t){return Mn(this.__data__,t)>-1}var Ax=eD;function tD(t,e){var r=this.__data__,n=Mn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var wx=tD;function es(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])}}es.prototype.clear=kx;es.prototype.delete=Sx;es.prototype.get=Ex;es.prototype.has=Ax;es.prototype.set=wx;var Fn=es;var rD=Yt(nt,"Map"),$n=rD;function nD(){this.size=0,this.__data__={hash:new cp,map:new($n||Fn),string:new cp}}var Nx=nD;function iD(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Px=iD;function oD(t,e){var r=t.__data__;return Px(e)?r[typeof e=="string"?"string":"hash"]:r.map}var qn=oD;function sD(t){var e=qn(this,t).delete(t);return this.size-=e?1:0,e}var Dx=sD;function aD(t){return qn(this,t).get(t)}var Ix=aD;function cD(t){return qn(this,t).has(t)}var Ox=cD;function uD(t,e){var r=qn(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var Lx=uD;function ts(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])}}ts.prototype.clear=Nx;ts.prototype.delete=Dx;ts.prototype.get=Ix;ts.prototype.has=Ox;ts.prototype.set=Lx;var bi=ts;var lD="Expected a function";function up(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(lD);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(up.Cache||bi),r}up.Cache=bi;var Mx=up;var dD=500;function fD(t){var e=Mx(t,function(n){return r.size===dD&&r.clear(),n}),r=e.cache;return e}var Fx=fD;var hD=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pD=/\\(\\)?/g,mD=Fx(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(hD,function(r,n,i,o){e.push(i?o.replace(pD,"$1"):n||r)}),e}),$x=mD;function gD(t){return t==null?"":$v(t)}var qx=gD;function yD(t,e){return q(t)?t:Qo(t,e)?[t]:$x(qx(t))}var Un=yD;var vD=1/0;function xD(t){if(typeof t=="string"||Ur(t))return t;var e=t+"";return e=="0"&&1/t==-vD?"-0":e}var Kr=xD;function TD(t,e){e=Un(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Kr(e[r++])];return r&&r==n?t:void 0}var rs=TD;function RD(t,e,r){var n=t==null?void 0:rs(t,e);return n===void 0?r:n}var Ux=RD;function _D(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var ns=_D;var jx=pt?pt.isConcatSpreadable:void 0;function bD(t){return q(t)||On(t)||!!(jx&&t&&t[jx])}var Wx=bD;function Bx(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=Wx),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?Bx(a,e-1,r,n,i):ns(i,a):n||(i[i.length]=a)}return i}var is=Bx;function CD(t){var e=t==null?0:t.length;return e?is(t,1):[]}var Ze=CD;var kD=Zu(Object.getPrototypeOf,Object),tl=kD;function SD(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}var rl=SD;function ED(t,e,r,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}var Hx=ED;function AD(){this.__data__=new Fn,this.size=0}var Gx=AD;function wD(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var zx=wD;function ND(t){return this.__data__.get(t)}var Kx=ND;function PD(t){return this.__data__.has(t)}var Vx=PD;var DD=200;function ID(t,e){var r=this.__data__;if(r instanceof Fn){var n=r.__data__;if(!$n||n.length<DD-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new bi(n)}return r.set(t,e),this.size=r.size,this}var Xx=ID;function os(t){var e=this.__data__=new Fn(t);this.size=e.size}os.prototype.clear=Gx;os.prototype.delete=zx;os.prototype.get=Kx;os.prototype.has=Vx;os.prototype.set=Xx;var jn=os;function OD(t,e){return t&&Hr(e,Re(e),t)}var Yx=OD;function LD(t,e){return t&&Hr(e,Ln(e),t)}var Jx=LD;var tT=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Qx=tT&&typeof module=="object"&&module&&!module.nodeType&&module,MD=Qx&&Qx.exports===tT,Zx=MD?nt.Buffer:void 0,eT=Zx?Zx.allocUnsafe:void 0;function FD(t,e){if(e)return t.slice();var r=t.length,n=eT?eT(r):new t.constructor(r);return t.copy(n),n}var rT=FD;function $D(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}var ss=$D;function qD(){return[]}var nl=qD;var UD=Object.prototype,jD=UD.propertyIsEnumerable,nT=Object.getOwnPropertySymbols,WD=nT?function(t){return t==null?[]:(t=Object(t),ss(nT(t),function(e){return jD.call(t,e)}))}:nl,as=WD;function BD(t,e){return Hr(t,as(t),e)}var iT=BD;var HD=Object.getOwnPropertySymbols,GD=HD?function(t){for(var e=[];t;)ns(e,as(t)),t=tl(t);return e}:nl,il=GD;function zD(t,e){return Hr(t,il(t),e)}var oT=zD;function KD(t,e,r){var n=e(t);return q(t)?n:ns(n,r(t))}var ol=KD;function VD(t){return ol(t,Re,as)}var Wa=VD;function XD(t){return ol(t,Ln,il)}var sl=XD;var YD=Yt(nt,"DataView"),al=YD;var JD=Yt(nt,"Promise"),cl=JD;var QD=Yt(nt,"Set"),Wn=QD;var sT="[object Map]",ZD="[object Object]",aT="[object Promise]",cT="[object Set]",uT="[object WeakMap]",lT="[object DataView]",eI=ln(al),tI=ln($n),rI=ln(cl),nI=ln(Wn),iI=ln(Vu),Ci=Ft;(al&&Ci(new al(new ArrayBuffer(1)))!=lT||$n&&Ci(new $n)!=sT||cl&&Ci(cl.resolve())!=aT||Wn&&Ci(new Wn)!=cT||Vu&&Ci(new Vu)!=uT)&&(Ci=function(t){var e=Ft(t),r=e==ZD?t.constructor:void 0,n=r?ln(r):"";if(n)switch(n){case eI:return lT;case tI:return sT;case rI:return aT;case nI:return cT;case iI:return uT}return e});var wr=Ci;var oI=Object.prototype,sI=oI.hasOwnProperty;function aI(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&sI.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var dT=aI;var cI=nt.Uint8Array,cs=cI;function uI(t){var e=new t.constructor(t.byteLength);return new cs(e).set(new cs(t)),e}var us=uI;function lI(t,e){var r=e?us(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var fT=lI;var dI=/\w*$/;function fI(t){var e=new t.constructor(t.source,dI.exec(t));return e.lastIndex=t.lastIndex,e}var hT=fI;var pT=pt?pt.prototype:void 0,mT=pT?pT.valueOf:void 0;function hI(t){return mT?Object(mT.call(t)):{}}var gT=hI;function pI(t,e){var r=e?us(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var yT=pI;var mI="[object Boolean]",gI="[object Date]",yI="[object Map]",vI="[object Number]",xI="[object RegExp]",TI="[object Set]",RI="[object String]",_I="[object Symbol]",bI="[object ArrayBuffer]",CI="[object DataView]",kI="[object Float32Array]",SI="[object Float64Array]",EI="[object Int8Array]",AI="[object Int16Array]",wI="[object Int32Array]",NI="[object Uint8Array]",PI="[object Uint8ClampedArray]",DI="[object Uint16Array]",II="[object Uint32Array]";function OI(t,e,r){var n=t.constructor;switch(e){case bI:return us(t);case mI:case gI:return new n(+t);case CI:return fT(t,r);case kI:case SI:case EI:case AI:case wI:case NI:case PI:case DI:case II:return yT(t,r);case yI:return new n;case vI:case RI:return new n(t);case xI:return hT(t);case TI:return new n;case _I:return gT(t)}}var vT=OI;function LI(t){return typeof t.constructor=="function"&&!Gr(t)?Yv(tl(t)):{}}var xT=LI;var MI="[object Map]";function FI(t){return Qe(t)&&wr(t)==MI}var TT=FI;var RT=gr&&gr.isMap,$I=RT?zr(RT):TT,_T=$I;var qI="[object Set]";function UI(t){return Qe(t)&&wr(t)==qI}var bT=UI;var CT=gr&&gr.isSet,jI=CT?zr(CT):bT,kT=jI;var WI=1,BI=2,HI=4,ST="[object Arguments]",GI="[object Array]",zI="[object Boolean]",KI="[object Date]",VI="[object Error]",ET="[object Function]",XI="[object GeneratorFunction]",YI="[object Map]",JI="[object Number]",AT="[object Object]",QI="[object RegExp]",ZI="[object Set]",eO="[object String]",tO="[object Symbol]",rO="[object WeakMap]",nO="[object ArrayBuffer]",iO="[object DataView]",oO="[object Float32Array]",sO="[object Float64Array]",aO="[object Int8Array]",cO="[object Int16Array]",uO="[object Int32Array]",lO="[object Uint8Array]",dO="[object Uint8ClampedArray]",fO="[object Uint16Array]",hO="[object Uint32Array]",_e={};_e[ST]=_e[GI]=_e[nO]=_e[iO]=_e[zI]=_e[KI]=_e[oO]=_e[sO]=_e[aO]=_e[cO]=_e[uO]=_e[YI]=_e[JI]=_e[AT]=_e[QI]=_e[ZI]=_e[eO]=_e[tO]=_e[lO]=_e[dO]=_e[fO]=_e[hO]=!0;_e[VI]=_e[ET]=_e[rO]=!1;function ul(t,e,r,n,i,o){var s,a=e&WI,c=e&BI,u=e&HI;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!Ue(t))return t;var l=q(t);if(l){if(s=dT(t),!a)return Qv(t,s)}else{var d=wr(t),f=d==ET||d==XI;if(dn(t))return rT(t,a);if(d==AT||d==ST||f&&!i){if(s=c||f?{}:xT(t),!a)return c?oT(t,Jx(s,t)):iT(t,Yx(s,t))}else{if(!_e[d])return i?t:{};s=vT(t,d,a)}}o||(o=new jn);var p=o.get(t);if(p)return p;o.set(t,s),kT(t)?t.forEach(function(k){s.add(ul(k,e,r,k,t,o))}):_T(t)&&t.forEach(function(k,R){s.set(R,ul(k,e,r,R,t,o))});var v=u?c?sl:Wa:c?Ln:Re,T=l?void 0:v(t);return Xu(T||t,function(k,R){T&&(R=k,k=t[R]),Dn(s,R,ul(k,e,r,R,t,o))}),s}var wT=ul;var pO=4;function mO(t){return wT(t,pO)}var be=mO;function gO(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i}var Vr=gO;var yO="__lodash_hash_undefined__";function vO(t){return this.__data__.set(t,yO),this}var NT=vO;function xO(t){return this.__data__.has(t)}var PT=xO;function ll(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new bi;++e<r;)this.add(t[e])}ll.prototype.add=ll.prototype.push=NT;ll.prototype.has=PT;var ls=ll;function TO(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var dl=TO;function RO(t,e){return t.has(e)}var ds=RO;var _O=1,bO=2;function CO(t,e,r,n,i,o){var s=r&_O,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(t),l=o.get(e);if(u&&l)return u==e&&l==t;var d=-1,f=!0,p=r&bO?new ls:void 0;for(o.set(t,e),o.set(e,t);++d<a;){var v=t[d],T=e[d];if(n)var k=s?n(T,v,d,e,t,o):n(v,T,d,t,e,o);if(k!==void 0){if(k)continue;f=!1;break}if(p){if(!dl(e,function(R,g){if(!ds(p,g)&&(v===R||i(v,R,r,n,o)))return p.push(g)})){f=!1;break}}else if(!(v===T||i(v,T,r,n,o))){f=!1;break}}return o.delete(t),o.delete(e),f}var fl=CO;function kO(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var DT=kO;function SO(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var fs=SO;var EO=1,AO=2,wO="[object Boolean]",NO="[object Date]",PO="[object Error]",DO="[object Map]",IO="[object Number]",OO="[object RegExp]",LO="[object Set]",MO="[object String]",FO="[object Symbol]",$O="[object ArrayBuffer]",qO="[object DataView]",IT=pt?pt.prototype:void 0,lp=IT?IT.valueOf:void 0;function UO(t,e,r,n,i,o,s){switch(r){case qO:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case $O:return!(t.byteLength!=e.byteLength||!o(new cs(t),new cs(e)));case wO:case NO:case IO:return Br(+t,+e);case PO:return t.name==e.name&&t.message==e.message;case OO:case MO:return t==e+"";case DO:var a=DT;case LO:var c=n&EO;if(a||(a=fs),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;n|=AO,s.set(t,e);var l=fl(a(t),a(e),n,i,o,s);return s.delete(t),l;case FO:if(lp)return lp.call(t)==lp.call(e)}return!1}var OT=UO;var jO=1,WO=Object.prototype,BO=WO.hasOwnProperty;function HO(t,e,r,n,i,o){var s=r&jO,a=Wa(t),c=a.length,u=Wa(e),l=u.length;if(c!=l&&!s)return!1;for(var d=c;d--;){var f=a[d];if(!(s?f in e:BO.call(e,f)))return!1}var p=o.get(t),v=o.get(e);if(p&&v)return p==e&&v==t;var T=!0;o.set(t,e),o.set(e,t);for(var k=s;++d<c;){f=a[d];var R=t[f],g=e[f];if(n)var h=s?n(g,R,f,e,t,o):n(R,g,f,t,e,o);if(!(h===void 0?R===g||i(R,g,r,n,o):h)){T=!1;break}k||(k=f=="constructor")}if(T&&!k){var _=t.constructor,w=e.constructor;_!=w&&"constructor"in t&&"constructor"in e&&!(typeof _=="function"&&_ instanceof _&&typeof w=="function"&&w instanceof w)&&(T=!1)}return o.delete(t),o.delete(e),T}var LT=HO;var GO=1,MT="[object Arguments]",FT="[object Array]",hl="[object Object]",zO=Object.prototype,$T=zO.hasOwnProperty;function KO(t,e,r,n,i,o){var s=q(t),a=q(e),c=s?FT:wr(t),u=a?FT:wr(e);c=c==MT?hl:c,u=u==MT?hl:u;var l=c==hl,d=u==hl,f=c==u;if(f&&dn(t)){if(!dn(e))return!1;s=!0,l=!1}if(f&&!l)return o||(o=new jn),s||Jo(t)?fl(t,e,r,n,i,o):OT(t,e,c,r,n,i,o);if(!(r&GO)){var p=l&&$T.call(t,"__wrapped__"),v=d&&$T.call(e,"__wrapped__");if(p||v){var T=p?t.value():t,k=v?e.value():e;return o||(o=new jn),i(T,k,r,n,o)}}return f?(o||(o=new jn),LT(t,e,r,n,i,o)):!1}var qT=KO;function UT(t,e,r,n,i){return t===e?!0:t==null||e==null||!Qe(t)&&!Qe(e)?t!==t&&e!==e:qT(t,e,r,n,UT,i)}var pl=UT;var VO=1,XO=2;function YO(t,e,r,n){var i=r.length,o=i,s=!n;if(t==null)return!o;for(t=Object(t);i--;){var a=r[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){a=r[i];var c=a[0],u=t[c],l=a[1];if(s&&a[2]){if(u===void 0&&!(c in t))return!1}else{var d=new jn;if(n)var f=n(u,l,c,t,e,d);if(!(f===void 0?pl(l,u,VO|XO,n,d):f))return!1}}return!0}var jT=YO;function JO(t){return t===t&&!Ue(t)}var ml=JO;function QO(t){for(var e=Re(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,ml(i)]}return e}var WT=QO;function ZO(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var gl=ZO;function e0(t){var e=WT(t);return e.length==1&&e[0][2]?gl(e[0][0],e[0][1]):function(r){return r===t||jT(r,t,e)}}var BT=e0;function t0(t,e){return t!=null&&e in Object(t)}var HT=t0;function r0(t,e,r){e=Un(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=Kr(e[n]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&Yo(i)&&Pn(s,i)&&(q(t)||On(t)))}var yl=r0;function n0(t,e){return t!=null&&yl(t,e,HT)}var GT=n0;var i0=1,o0=2;function s0(t,e){return Qo(t)&&ml(e)?gl(Kr(t),e):function(r){var n=Ux(r,t);return n===void 0&&n===e?GT(r,t):pl(e,n,i0|o0)}}var zT=s0;function a0(t){return function(e){return e?.[t]}}var KT=a0;function c0(t){return function(e){return rs(e,t)}}var VT=c0;function u0(t){return Qo(t)?KT(Kr(t)):VT(t)}var XT=u0;function l0(t){return typeof t=="function"?t:t==null?Xt:typeof t=="object"?q(t)?zT(t[0],t[1]):BT(t):XT(t)}var ze=l0;function d0(t,e,r,n){for(var i=-1,o=t==null?0:t.length;++i<o;){var s=t[i];e(n,s,r(s),t)}return n}var YT=d0;function f0(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++i];if(r(o[c],c,o)===!1)break}return e}}var JT=f0;var h0=JT(),QT=h0;function p0(t,e){return t&&QT(t,e,Re)}var ZT=p0;function m0(t,e){return function(r,n){if(r==null)return r;if(!it(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var eR=m0;var g0=eR(ZT),Jt=g0;function y0(t,e,r,n){return Jt(t,function(i,o,s){e(n,i,r(i),s)}),n}var tR=y0;function v0(t,e){return function(r,n){var i=q(r)?YT:tR,o=e?e():{};return i(r,t,ze(n,2),o)}}var rR=v0;var nR=Object.prototype,x0=nR.hasOwnProperty,T0=Xo(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&In(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],s=Ln(o),a=-1,c=s.length;++a<c;){var u=s[a],l=t[u];(l===void 0||Br(l,nR[u])&&!x0.call(t,u))&&(t[u]=o[u])}return t}),hs=T0;function R0(t){return Qe(t)&&it(t)}var dp=R0;function _0(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var vl=_0;var b0=200;function C0(t,e,r,n){var i=-1,o=Ju,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;r&&(e=jr(e,zr(r))),n?(o=vl,s=!1):e.length>=b0&&(o=ds,s=!1,e=new ls(e));e:for(;++i<a;){var l=t[i],d=r==null?l:r(l);if(l=n||l!==0?l:0,s&&d===d){for(var f=u;f--;)if(e[f]===d)continue e;c.push(l)}else o(e,d,n)||c.push(l)}return c}var iR=C0;var k0=Xo(function(t,e){return dp(t)?iR(t,is(e,1,dp,!0)):[]}),Bn=k0;function S0(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var Xr=S0;function E0(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Wr(e),rl(t,e<0?0:e,n)):[]}var et=E0;function A0(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Wr(e),e=n-e,rl(t,0,e<0?0:e)):[]}var hn=A0;function w0(t){return typeof t=="function"?t:Xt}var oR=w0;function N0(t,e){var r=q(t)?Xu:Jt;return r(t,oR(e))}var O=N0;function P0(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var sR=P0;function D0(t,e){var r=!0;return Jt(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var aR=D0;function I0(t,e,r){var n=q(t)?sR:aR;return r&&In(t,e,r)&&(e=void 0),n(t,ze(e,3))}var At=I0;function O0(t,e){var r=[];return Jt(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var xl=O0;function L0(t,e){var r=q(t)?ss:xl;return r(t,ze(e,3))}var mt=L0;function M0(t){return function(e,r,n){var i=Object(e);if(!it(e)){var o=ze(r,3);e=Re(e),r=function(a){return o(i[a],a,i)}}var s=t(e,r,n);return s>-1?i[o?e[s]:s]:void 0}}var cR=M0;var F0=Math.max;function $0(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Wr(r);return i<0&&(i=F0(n+i,0)),Yu(t,ze(e,3),i)}var uR=$0;var q0=cR(uR),Yr=q0;function U0(t){return t&&t.length?t[0]:void 0}var gt=U0;function j0(t,e){var r=-1,n=it(t)?Array(t.length):[];return Jt(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var lR=j0;function W0(t,e){var r=q(t)?jr:lR;return r(t,ze(e,3))}var N=W0;function B0(t,e){return is(N(t,e),1)}var bt=B0;var H0=Object.prototype,G0=H0.hasOwnProperty,z0=rR(function(t,e,r){G0.call(t,r)?t[r].push(e):Vo(t,r,[e])}),fp=z0;var K0=Object.prototype,V0=K0.hasOwnProperty;function X0(t,e){return t!=null&&V0.call(t,e)}var dR=X0;function Y0(t,e){return t!=null&&yl(t,e,dR)}var $=Y0;var J0="[object String]";function Q0(t){return typeof t=="string"||!q(t)&&Qe(t)&&Ft(t)==J0}var dt=Q0;function Z0(t,e){return jr(e,function(r){return t[r]})}var fR=Z0;function eL(t){return t==null?[]:fR(t,Re(t))}var me=eL;var tL=Math.max;function rL(t,e,r,n){t=it(t)?t:me(t),r=r&&!n?Wr(r):0;var i=t.length;return r<0&&(r=tL(i+r,0)),dt(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Ko(t,e,r)>-1}var Oe=rL;var nL=Math.max;function iL(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Wr(r);return i<0&&(i=nL(n+i,0)),Ko(t,e,i)}var Tl=iL;var oL="[object Map]",sL="[object Set]",aL=Object.prototype,cL=aL.hasOwnProperty;function uL(t){if(t==null)return!0;if(it(t)&&(q(t)||typeof t=="string"||typeof t.splice=="function"||dn(t)||Jo(t)||On(t)))return!t.length;var e=wr(t);if(e==oL||e==sL)return!t.size;if(Gr(t))return!el(t).length;for(var r in t)if(cL.call(t,r))return!1;return!0}var Q=uL;var lL="[object RegExp]";function dL(t){return Qe(t)&&Ft(t)==lL}var hR=dL;var pR=gr&&gr.isRegExp,fL=pR?zr(pR):hR,yr=fL;function hL(t){return t===void 0}var wt=hL;function pL(t,e){return t<e}var mR=pL;function mL(t,e,r){for(var n=-1,i=t.length;++n<i;){var o=t[n],s=e(o);if(s!=null&&(a===void 0?s===s&&!Ur(s):r(s,a)))var a=s,c=o}return c}var gR=mL;function gL(t){return t&&t.length?gR(t,Xt,mR):void 0}var yR=gL;var yL="Expected a function";function vL(t){if(typeof t!="function")throw new TypeError(yL);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var vR=vL;function xL(t,e,r,n){if(!Ue(t))return t;e=Un(e,t);for(var i=-1,o=e.length,s=o-1,a=t;a!=null&&++i<o;){var c=Kr(e[i]),u=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var l=a[c];u=n?n(l,c,a):void 0,u===void 0&&(u=Ue(l)?l:Pn(e[i+1])?[]:{})}Dn(a,c,u),a=a[c]}return t}var xR=xL;function TL(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var s=e[n],a=rs(t,s);r(a,s)&&xR(o,Un(s,t),a)}return o}var TR=TL;function RL(t,e){if(t==null)return{};var r=jr(sl(t),function(n){return[n]});return e=ze(e),TR(t,r,function(n,i){return e(n,i[0])})}var Qt=RL;function _L(t,e,r,n,i){return i(t,function(o,s,a){r=n?(n=!1,o):e(r,o,s,a)}),r}var RR=_L;function bL(t,e,r){var n=q(t)?Hx:RR,i=arguments.length<3;return n(t,ze(e,4),r,i,Jt)}var We=bL;function CL(t,e){var r=q(t)?ss:xl;return r(t,vR(ze(e,3)))}var Hn=CL;function kL(t,e){var r;return Jt(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var _R=kL;function SL(t,e,r){var n=q(t)?dl:_R;return r&&In(t,e,r)&&(e=void 0),n(t,ze(e,3))}var Ba=SL;var EL=1/0,AL=Wn&&1/fs(new Wn([,-0]))[1]==EL?function(t){return new Wn(t)}:je,bR=AL;var wL=200;function NL(t,e,r){var n=-1,i=Ju,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=vl;else if(o>=wL){var u=e?null:bR(t);if(u)return fs(u);s=!1,i=ds,c=new ls}else c=e?[]:a;e:for(;++n<o;){var l=t[n],d=e?e(l):l;if(l=r||l!==0?l:0,s&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;e&&c.push(d),a.push(l)}else i(c,d,r)||(c!==a&&c.push(d),a.push(l))}return a}var Rl=NL;function PL(t){return t&&t.length?Rl(t):[]}var ps=PL;function DL(t,e){return t&&t.length?Rl(t,ze(e,2)):[]}var CR=DL;function ms(t){console&&console.error&&console.error(`Error: ${t}`)}function Ha(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Ga(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function za(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function IL(t){return OL(t)?t.LABEL:t.name}function OL(t){return dt(t.LABEL)&&t.LABEL!==""}var ur=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),O(this.definition,r=>{r.accept(e)})}},fe=class extends ur{constructor(e){super([]),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},qt=class extends ur{constructor(e){super(e.definition),this.orgText="",_t(this,Qt(e,r=>r!==void 0))}},Ce=class extends ur{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,_t(this,Qt(e,r=>r!==void 0))}},he=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},ke=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},Se=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},ie=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},ye=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},ve=class extends ur{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,_t(this,Qt(e,r=>r!==void 0))}},ee=class{constructor(e){this.idx=1,_t(this,Qt(e,r=>r!==void 0))}accept(e){e.visit(this)}};function _l(t){return N(t,gs)}function gs(t){function e(r){return N(r,gs)}if(t instanceof fe){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return dt(t.label)&&(r.label=t.label),r}else{if(t instanceof Ce)return{type:"Alternative",definition:e(t.definition)};if(t instanceof he)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof ke)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Se)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:gs(new ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof ye)return{type:"RepetitionWithSeparator",idx:t.idx,separator:gs(new ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof ie)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof ve)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof ee){let r={type:"Terminal",name:t.terminalType.name,label:IL(t.terminalType),idx:t.idx};dt(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=yr(n)?n.source:n),r}else{if(t instanceof qt)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var Ut=class{visit(e){let r=e;switch(r.constructor){case fe:return this.visitNonTerminal(r);case Ce:return this.visitAlternative(r);case he:return this.visitOption(r);case ke:return this.visitRepetitionMandatory(r);case Se:return this.visitRepetitionMandatoryWithSeparator(r);case ye:return this.visitRepetitionWithSeparator(r);case ie:return this.visitRepetition(r);case ve:return this.visitAlternation(r);case ee:return this.visitTerminal(r);case qt:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function hp(t){return t instanceof Ce||t instanceof he||t instanceof ie||t instanceof ke||t instanceof Se||t instanceof ye||t instanceof ee||t instanceof qt}function ki(t,e=[]){return t instanceof he||t instanceof ie||t instanceof ye?!0:t instanceof ve?Ba(t.definition,n=>ki(n,e)):t instanceof fe&&Oe(e,t)?!1:t instanceof ur?(t instanceof fe&&e.push(t),At(t.definition,n=>ki(n,e))):!1}function pp(t){return t instanceof ve}function Zt(t){if(t instanceof fe)return"SUBRULE";if(t instanceof he)return"OPTION";if(t instanceof ve)return"OR";if(t instanceof ke)return"AT_LEAST_ONE";if(t instanceof Se)return"AT_LEAST_ONE_SEP";if(t instanceof ye)return"MANY_SEP";if(t instanceof ie)return"MANY";if(t instanceof ee)return"CONSUME";throw Error("non exhaustive match")}var pn=class{walk(e,r=[]){O(e.definition,(n,i)=>{let o=et(e.definition,i+1);if(n instanceof fe)this.walkProdRef(n,o,r);else if(n instanceof ee)this.walkTerminal(n,o,r);else if(n instanceof Ce)this.walkFlat(n,o,r);else if(n instanceof he)this.walkOption(n,o,r);else if(n instanceof ke)this.walkAtLeastOne(n,o,r);else if(n instanceof Se)this.walkAtLeastOneSep(n,o,r);else if(n instanceof ye)this.walkManySep(n,o,r);else if(n instanceof ie)this.walkMany(n,o,r);else if(n instanceof ve)this.walkOr(n,o,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new he({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=kR(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new he({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=kR(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);O(e.definition,o=>{let s=new Ce({definition:[o]});this.walk(s,i)})}};function kR(t,e,r){return[new he({definition:[new ee({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function Si(t){if(t instanceof fe)return Si(t.referencedRule);if(t instanceof ee)return FL(t);if(hp(t))return LL(t);if(pp(t))return ML(t);throw Error("non exhaustive match")}function LL(t){let e=[],r=t.definition,n=0,i=r.length>n,o,s=!0;for(;i&&s;)o=r[n],s=ki(o),e=e.concat(Si(o)),n=n+1,i=r.length>n;return ps(e)}function ML(t){let e=N(t.definition,r=>Si(r));return ps(Ze(e))}function FL(t){return[t.terminalType]}var bl="_~IN~_";var mp=class extends pn{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=$L(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),s=new Ce({definition:o}),a=Si(s);this.follows[i]=a}};function SR(t){let e={};return O(t,r=>{let n=new mp(r).startWalking();_t(e,n)}),e}function $L(t,e){return t.name+e+bl}var Cl={},qL=new xi;function ys(t){let e=t.toString();if(Cl.hasOwnProperty(e))return Cl[e];{let r=qL.pattern(e);return Cl[e]=r,r}}function ER(){Cl={}}var wR="Complement Sets are not supported for first char optimization",Ka=`Unable to use "first char" lexer optimizations:
47
- `;function NR(t,e=!1){try{let r=ys(t);return gp(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===wR)e&&Ha(`${Ka} Unable to optimize: < ${t.toString()} >
45
+ `.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let 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)}},Ti=new zh;function UA(t){try{typeof t!="string"&&(t=t.source),t=`/${t}/`;let e=Cv.pattern(t),r=[];for(let n of e.value.value)Ti.reset(t),Ti.visit(n),r.push({start:Ti.startRegexp,end:Ti.endRegex});return r}catch{return[]}}function Vh(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Ti.reset(t),Ti.visit(Cv.pattern(t)),Ti.multiline}catch{return!1}}var Sv=`\f
46
+ \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function La(t){let e=typeof t=="string"?new RegExp(t):t;return Sv.some(r=>e.test(r))}function wn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xh(t,e){let r=kv(t),n=e.match(r);return!!n&&n[0].length>0}function kv(t){typeof t=="string"&&(t=new RegExp(t));let e=t,r=t.source,n=0;function i(){let o="",s;function a(u){o+=r.substr(n,u),n+=u}function c(u){o+="(?:"+r.substr(n,u)+"|$)",n+=u}for(;n<r.length;)switch(r[n]){case"\\":switch(r[n+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?r[n+2]==="{"?c(r.indexOf("}",n)-n+1):c(6):c(2);break;case"p":case"P":e.unicode?c(r.indexOf("}",n)-n+1):c(2);break;case"k":c(r.indexOf(">",n)-n+1);break;default:c(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=n,s=s.exec(r)||[],c(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=n,s=s.exec(r),s?a(s[0].length):c(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":o+="(?:",n+=3,o+=i()+"|$)";break;case"=":o+="(?=",n+=3,o+=i()+")";break;case"!":s=n,n+=3,i(),o+=r.substr(s,n-s);break;case"<":switch(r[n+3]){case"=":case"!":s=n,n+=4,i(),o+=r.substr(s,n-s);break;default:a(r.indexOf(">",n)-n+1),o+=i()+"|$)";break}break}else a(1),o+=i()+"|$)";break;case")":return++n,o;default:c(1);break}return o}return new RegExp(i(),t.flags)}function Ma(t){return t.rules.find(e=>Ie(e)&&e.entry)}function Ev(t){return t.rules.filter(e=>Mt(e)&&e.hidden)}function Fa(t,e){let r=new Set,n=Ma(t);if(!n)return new Set(t.rules);let i=[n].concat(Ev(t));for(let s of i)Av(s,r,e);let o=new Set;for(let s of t.rules)(r.has(s.name)||Mt(s)&&s.hidden)&&o.add(s);return o}function Av(t,e,r){e.add(t.name),cr(t).forEach(n=>{if(Vt(n)||r&&$u(n)){let i=n.rule.ref;i&&!e.has(i.name)&&Av(i,e,r)}})}function jA(t){let e=new Set;return cr(t).forEach(r=>{sr(r)&&(Ie(r.type.ref)&&e.add(r.type.ref),Aa(r.type.ref)&&Ie(r.type.ref.$container)&&e.add(r.type.ref.$container))}),e}function $a(t){if(t.terminal)return t.terminal;if(t.type.ref){let e=Hu(t.type.ref);return e?.terminal}}function Qh(t){return t.hidden&&!La(Nn(t))}function Zh(t,e){return!t||!e?[]:ep(t,e,t.astNode,!0)}function qa(t,e,r){if(!t||!e)return;let n=ep(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]}function ep(t,e,r,n){if(!n){let i=ar(t.grammarSource,Et);if(i&&i.feature===e)return[t]}return Er(t)&&t.astNode===r?t.content.flatMap(i=>ep(i,e,r,!1)):[]}function WA(t,e){return t?rp(t,e,t?.astNode):[]}function tp(t,e,r){if(!t)return;let n=rp(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]}function rp(t,e,r){if(t.astNode!==r)return[];if(lt(t.grammarSource)&&t.grammarSource.value===e)return[t];let n=di(t).iterator(),i,o=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?lt(s.grammarSource)&&s.grammarSource.value===e&&o.push(s):n.prune()}while(!i.done);return o}function np(t){var e;let r=t.astNode;for(;r===((e=t.container)===null||e===void 0?void 0:e.astNode);){let n=ar(t.grammarSource,Et);if(n)return n;t=t.container}}function Hu(t){let e=t;return Aa(e)&&(Ar(e.$container)?e=e.$container.$container:Ie(e.$container)?e=e.$container:Fr(e.$container)),wv(t,e,new Map)}function wv(t,e,r){var n;function i(o,s){let a;return ar(o,Et)||(a=wv(s,s,r)),r.set(t,a),a}if(r.has(t))return r.get(t);r.set(t,void 0);for(let o of cr(e)){if(Et(o)&&o.feature.toLowerCase()==="name")return r.set(t,o),o;if(Vt(o)&&Ie(o.rule.ref))return i(o,o.rule.ref);if(Fu(o)&&(!((n=o.typeRef)===null||n===void 0)&&n.ref))return i(o,o.typeRef.ref)}}function Nv(t){let e=t.$container;if(pr(e)){let r=e.elements,n=r.indexOf(t);for(let i=n-1;i>=0;i--){let o=r[i];if(Ar(o))return o;{let s=cr(r[i]).find(Ar);if(s)return s}}}if(mi(e))return Nv(e)}function Ri(t,e){return t==="?"||t==="*"||pr(e)&&!!e.guardCondition}function ip(t){return t==="*"||t==="+"}function BA(t){return t==="+="}function Ua(t){return Pv(t,new Set)}function Pv(t,e){if(e.has(t))return!0;e.add(t);for(let r of cr(t))if(Vt(r)){if(!r.rule.ref||Ie(r.rule.ref)&&!Pv(r.rule.ref,e))return!1}else{if(Et(r))return!1;if(Ar(r))return!1}return!!t.definition}function HA(t){return Jh(t.type,new Set)}function Jh(t,e){if(e.has(t))return!0;if(e.add(t),Sh(t))return!1;if(Ph(t))return!1;if(Ih(t))return t.types.every(r=>Jh(r,e));if(Fu(t)){if(t.primitiveType!==void 0)return!0;if(t.stringType!==void 0)return!0;if(t.typeRef!==void 0){let r=t.typeRef.ref;return wa(r)?Jh(r.type,e):!1}else return!1}else return!1}function qr(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){let e=t.returnType.ref;if(e){if(Ie(e))return e.name;if(Mu(e)||wa(e))return e.name}}}function _i(t){var e;if(Ie(t))return Ua(t)?t.name:(e=qr(t))!==null&&e!==void 0?e:t.name;if(Mu(t)||wa(t)||Dh(t))return t.name;if(Ar(t)){let r=Dv(t);if(r)return r}else if(Aa(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function Dv(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return _i(t.type.ref)}function GA(t){var e,r,n;return Mt(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":Ua(t)?t.name:(n=qr(t))!==null&&n!==void 0?n:t.name}function op(t){var e,r,n;return Mt(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":(n=qr(t))!==null&&n!==void 0?n:t.name}function Nn(t){let e={s:!1,i:!1,u:!1},r=zo(t.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(r,n)}var sp=/[\s\S]/.source;function zo(t,e){if($h(t))return zA(t);if(qh(t))return KA(t);if(Oh(t))return YA(t);if($u(t)){let r=t.rule.ref;if(!r)throw new Error("Missing rule reference.");return un(zo(r.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(Mh(t))return XA(t);if(Uh(t))return VA(t);if(Fh(t)){let r=t.regex.lastIndexOf("/"),n=t.regex.substring(1,r),i=t.regex.substring(r+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),un(n,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(jh(t))return un(sp,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function zA(t){return un(t.elements.map(e=>zo(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function KA(t){return un(t.elements.map(e=>zo(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function VA(t){return un(`${sp}*?${zo(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function XA(t){return un(`(?!${zo(t.terminal)})${sp}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function YA(t){return t.right?un(`[${Yh(t.left)}-${Yh(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):un(Yh(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function Yh(t){return wn(t.value)}function un(t,e){var r;return(e.wrap!==!1||e.lookahead)&&(t=`(${(r=e.lookahead)!==null&&r!==void 0?r:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}function ap(t){let e=[],r=t.Grammar;for(let n of r.rules)Mt(n)&&Qh(n)&&Vh(Nn(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:Iu}}var JA=typeof window=="object"&&window&&window.Object===Object&&window,zu=JA;var QA=typeof self=="object"&&self&&self.Object===Object&&self,ZA=zu||QA||Function("return this")(),nt=ZA;var ew=nt.Symbol,pt=ew;var Iv=Object.prototype,tw=Iv.hasOwnProperty,rw=Iv.toString,ja=pt?pt.toStringTag:void 0;function nw(t){var e=tw.call(t,ja),r=t[ja];try{t[ja]=void 0;var n=!0}catch{}var i=rw.call(t);return n&&(e?t[ja]=r:delete t[ja]),i}var Ov=nw;var iw=Object.prototype,ow=iw.toString;function sw(t){return ow.call(t)}var Lv=sw;var aw="[object Null]",cw="[object Undefined]",Mv=pt?pt.toStringTag:void 0;function uw(t){return t==null?t===void 0?cw:aw:Mv&&Mv in Object(t)?Ov(t):Lv(t)}var Ft=uw;function lw(t){return t!=null&&typeof t=="object"}var Qe=lw;var dw="[object Symbol]";function fw(t){return typeof t=="symbol"||Qe(t)&&Ft(t)==dw}var Ur=fw;function hw(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var jr=hw;var pw=Array.isArray,q=pw;var mw=1/0,Fv=pt?pt.prototype:void 0,$v=Fv?Fv.toString:void 0;function qv(t){if(typeof t=="string")return t;if(q(t))return jr(t,qv)+"";if(Ur(t))return $v?$v.call(t):"";var e=t+"";return e=="0"&&1/t==-mw?"-0":e}var Uv=qv;var gw=/\s/;function yw(t){for(var e=t.length;e--&&gw.test(t.charAt(e)););return e}var jv=yw;var vw=/^\s+/;function xw(t){return t&&t.slice(0,jv(t)+1).replace(vw,"")}var Wv=xw;function Tw(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ue=Tw;var Bv=NaN,Rw=/^[-+]0x[0-9a-f]+$/i,_w=/^0b[01]+$/i,bw=/^0o[0-7]+$/i,Cw=parseInt;function Sw(t){if(typeof t=="number")return t;if(Ur(t))return Bv;if(Ue(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ue(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Wv(t);var r=_w.test(t);return r||bw.test(t)?Cw(t.slice(2),r?2:8):Rw.test(t)?Bv:+t}var Hv=Sw;var Gv=1/0,kw=17976931348623157e292;function Ew(t){if(!t)return t===0?t:0;if(t=Hv(t),t===Gv||t===-Gv){var e=t<0?-1:1;return e*kw}return t===t?t:0}var zv=Ew;function Aw(t){var e=zv(t),r=e%1;return e===e?r?e-r:e:0}var Wr=Aw;function ww(t){return t}var Xt=ww;var Nw="[object AsyncFunction]",Pw="[object Function]",Dw="[object GeneratorFunction]",Iw="[object Proxy]";function Ow(t){if(!Ue(t))return!1;var e=Ft(t);return e==Pw||e==Dw||e==Nw||e==Iw}var $t=Ow;var Lw=nt["__core-js_shared__"],Ku=Lw;var Kv=(function(){var t=/[^.]+$/.exec(Ku&&Ku.keys&&Ku.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Mw(t){return!!Kv&&Kv in t}var Vv=Mw;var Fw=Function.prototype,$w=Fw.toString;function qw(t){if(t!=null){try{return $w.call(t)}catch{}try{return t+""}catch{}}return""}var ln=qw;var Uw=/[\\^$.*+?()[\]{}|]/g,jw=/^\[object .+?Constructor\]$/,Ww=Function.prototype,Bw=Object.prototype,Hw=Ww.toString,Gw=Bw.hasOwnProperty,zw=RegExp("^"+Hw.call(Gw).replace(Uw,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kw(t){if(!Ue(t)||Vv(t))return!1;var e=$t(t)?zw:jw;return e.test(ln(t))}var Xv=Kw;function Vw(t,e){return t?.[e]}var Yv=Vw;function Xw(t,e){var r=Yv(t,e);return Xv(r)?r:void 0}var Yt=Xw;var Yw=Yt(nt,"WeakMap"),Vu=Yw;var Jv=Object.create,Jw=(function(){function t(){}return function(e){if(!Ue(e))return{};if(Jv)return Jv(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),Qv=Jw;function Qw(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Zv=Qw;function Zw(){}var je=Zw;function eN(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var ex=eN;var tN=800,rN=16,nN=Date.now;function iN(t){var e=0,r=0;return function(){var n=nN(),i=rN-(n-r);if(r=n,i>0){if(++e>=tN)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var tx=iN;function oN(t){return function(){return t}}var rx=oN;var sN=(function(){try{var t=Yt(Object,"defineProperty");return t({},"",{}),t}catch{}})(),Ko=sN;var aN=Ko?function(t,e){return Ko(t,"toString",{configurable:!0,enumerable:!1,value:rx(e),writable:!0})}:Xt,nx=aN;var cN=tx(nx),ix=cN;function uN(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Xu=uN;function lN(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}var Yu=lN;function dN(t){return t!==t}var ox=dN;function fN(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var sx=fN;function hN(t,e,r){return e===e?sx(t,e,r):Yu(t,ox,r)}var Vo=hN;function pN(t,e){var r=t==null?0:t.length;return!!r&&Vo(t,e,0)>-1}var Ju=pN;var mN=9007199254740991,gN=/^(?:0|[1-9]\d*)$/;function yN(t,e){var r=typeof t;return e=e??mN,!!e&&(r=="number"||r!="symbol"&&gN.test(t))&&t>-1&&t%1==0&&t<e}var Pn=yN;function vN(t,e,r){e=="__proto__"&&Ko?Ko(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Xo=vN;function xN(t,e){return t===e||t!==t&&e!==e}var Br=xN;var TN=Object.prototype,RN=TN.hasOwnProperty;function _N(t,e,r){var n=t[e];(!(RN.call(t,e)&&Br(n,r))||r===void 0&&!(e in t))&&Xo(t,e,r)}var Dn=_N;function bN(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;c===void 0&&(c=t[a]),i?Xo(r,a,c):Dn(r,a,c)}return r}var Hr=bN;var ax=Math.max;function CN(t,e,r){return e=ax(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=ax(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),Zv(t,this,a)}}var cx=CN;function SN(t,e){return ix(cx(t,e,Xt),t+"")}var Yo=SN;var kN=9007199254740991;function EN(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=kN}var Jo=EN;function AN(t){return t!=null&&Jo(t.length)&&!$t(t)}var it=AN;function wN(t,e,r){if(!Ue(r))return!1;var n=typeof e;return(n=="number"?it(r)&&Pn(e,r.length):n=="string"&&e in r)?Br(r[e],t):!1}var In=wN;function NN(t){return Yo(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&In(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,o)}return e})}var ux=NN;var PN=Object.prototype;function DN(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||PN;return t===r}var Gr=DN;function IN(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var lx=IN;var ON="[object Arguments]";function LN(t){return Qe(t)&&Ft(t)==ON}var cp=LN;var dx=Object.prototype,MN=dx.hasOwnProperty,FN=dx.propertyIsEnumerable,$N=cp((function(){return arguments})())?cp:function(t){return Qe(t)&&MN.call(t,"callee")&&!FN.call(t,"callee")},On=$N;function qN(){return!1}var fx=qN;var mx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hx=mx&&typeof module=="object"&&module&&!module.nodeType&&module,UN=hx&&hx.exports===mx,px=UN?nt.Buffer:void 0,jN=px?px.isBuffer:void 0,WN=jN||fx,dn=WN;var BN="[object Arguments]",HN="[object Array]",GN="[object Boolean]",zN="[object Date]",KN="[object Error]",VN="[object Function]",XN="[object Map]",YN="[object Number]",JN="[object Object]",QN="[object RegExp]",ZN="[object Set]",eP="[object String]",tP="[object WeakMap]",rP="[object ArrayBuffer]",nP="[object DataView]",iP="[object Float32Array]",oP="[object Float64Array]",sP="[object Int8Array]",aP="[object Int16Array]",cP="[object Int32Array]",uP="[object Uint8Array]",lP="[object Uint8ClampedArray]",dP="[object Uint16Array]",fP="[object Uint32Array]",Ne={};Ne[iP]=Ne[oP]=Ne[sP]=Ne[aP]=Ne[cP]=Ne[uP]=Ne[lP]=Ne[dP]=Ne[fP]=!0;Ne[BN]=Ne[HN]=Ne[rP]=Ne[GN]=Ne[nP]=Ne[zN]=Ne[KN]=Ne[VN]=Ne[XN]=Ne[YN]=Ne[JN]=Ne[QN]=Ne[ZN]=Ne[eP]=Ne[tP]=!1;function hP(t){return Qe(t)&&Jo(t.length)&&!!Ne[Ft(t)]}var gx=hP;function pP(t){return function(e){return t(e)}}var zr=pP;var yx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wa=yx&&typeof module=="object"&&module&&!module.nodeType&&module,mP=Wa&&Wa.exports===yx,up=mP&&zu.process,gP=(function(){try{var t=Wa&&Wa.require&&Wa.require("util").types;return t||up&&up.binding&&up.binding("util")}catch{}})(),gr=gP;var vx=gr&&gr.isTypedArray,yP=vx?zr(vx):gx,Qo=yP;var vP=Object.prototype,xP=vP.hasOwnProperty;function TP(t,e){var r=q(t),n=!r&&On(t),i=!r&&!n&&dn(t),o=!r&&!n&&!i&&Qo(t),s=r||n||i||o,a=s?lx(t.length,String):[],c=a.length;for(var u in t)(e||xP.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Pn(u,c)))&&a.push(u);return a}var Qu=TP;function RP(t,e){return function(r){return t(e(r))}}var Zu=RP;var _P=Zu(Object.keys,Object),xx=_P;var bP=Object.prototype,CP=bP.hasOwnProperty;function SP(t){if(!Gr(t))return xx(t);var e=[];for(var r in Object(t))CP.call(t,r)&&r!="constructor"&&e.push(r);return e}var el=SP;function kP(t){return it(t)?Qu(t):el(t)}var Re=kP;var EP=Object.prototype,AP=EP.hasOwnProperty,wP=ux(function(t,e){if(Gr(e)||it(e)){Hr(e,Re(e),t);return}for(var r in e)AP.call(e,r)&&Dn(t,r,e[r])}),_t=wP;function NP(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Tx=NP;var PP=Object.prototype,DP=PP.hasOwnProperty;function IP(t){if(!Ue(t))return Tx(t);var e=Gr(t),r=[];for(var n in t)n=="constructor"&&(e||!DP.call(t,n))||r.push(n);return r}var Rx=IP;function OP(t){return it(t)?Qu(t,!0):Rx(t)}var Ln=OP;var LP=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,MP=/^\w*$/;function FP(t,e){if(q(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ur(t)?!0:MP.test(t)||!LP.test(t)||e!=null&&t in Object(e)}var Zo=FP;var $P=Yt(Object,"create"),fn=$P;function qP(){this.__data__=fn?fn(null):{},this.size=0}var _x=qP;function UP(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var bx=UP;var jP="__lodash_hash_undefined__",WP=Object.prototype,BP=WP.hasOwnProperty;function HP(t){var e=this.__data__;if(fn){var r=e[t];return r===jP?void 0:r}return BP.call(e,t)?e[t]:void 0}var Cx=HP;var GP=Object.prototype,zP=GP.hasOwnProperty;function KP(t){var e=this.__data__;return fn?e[t]!==void 0:zP.call(e,t)}var Sx=KP;var VP="__lodash_hash_undefined__";function XP(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=fn&&e===void 0?VP:e,this}var kx=XP;function es(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])}}es.prototype.clear=_x;es.prototype.delete=bx;es.prototype.get=Cx;es.prototype.has=Sx;es.prototype.set=kx;var lp=es;function YP(){this.__data__=[],this.size=0}var Ex=YP;function JP(t,e){for(var r=t.length;r--;)if(Br(t[r][0],e))return r;return-1}var Mn=JP;var QP=Array.prototype,ZP=QP.splice;function eD(t){var e=this.__data__,r=Mn(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():ZP.call(e,r,1),--this.size,!0}var Ax=eD;function tD(t){var e=this.__data__,r=Mn(e,t);return r<0?void 0:e[r][1]}var wx=tD;function rD(t){return Mn(this.__data__,t)>-1}var Nx=rD;function nD(t,e){var r=this.__data__,n=Mn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Px=nD;function ts(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])}}ts.prototype.clear=Ex;ts.prototype.delete=Ax;ts.prototype.get=wx;ts.prototype.has=Nx;ts.prototype.set=Px;var Fn=ts;var iD=Yt(nt,"Map"),$n=iD;function oD(){this.size=0,this.__data__={hash:new lp,map:new($n||Fn),string:new lp}}var Dx=oD;function sD(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ix=sD;function aD(t,e){var r=t.__data__;return Ix(e)?r[typeof e=="string"?"string":"hash"]:r.map}var qn=aD;function cD(t){var e=qn(this,t).delete(t);return this.size-=e?1:0,e}var Ox=cD;function uD(t){return qn(this,t).get(t)}var Lx=uD;function lD(t){return qn(this,t).has(t)}var Mx=lD;function dD(t,e){var r=qn(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var Fx=dD;function rs(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])}}rs.prototype.clear=Dx;rs.prototype.delete=Ox;rs.prototype.get=Lx;rs.prototype.has=Mx;rs.prototype.set=Fx;var bi=rs;var fD="Expected a function";function dp(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(fD);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(dp.Cache||bi),r}dp.Cache=bi;var $x=dp;var hD=500;function pD(t){var e=$x(t,function(n){return r.size===hD&&r.clear(),n}),r=e.cache;return e}var qx=pD;var mD=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gD=/\\(\\)?/g,yD=qx(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(mD,function(r,n,i,o){e.push(i?o.replace(gD,"$1"):n||r)}),e}),Ux=yD;function vD(t){return t==null?"":Uv(t)}var jx=vD;function xD(t,e){return q(t)?t:Zo(t,e)?[t]:Ux(jx(t))}var Un=xD;var TD=1/0;function RD(t){if(typeof t=="string"||Ur(t))return t;var e=t+"";return e=="0"&&1/t==-TD?"-0":e}var Kr=RD;function _D(t,e){e=Un(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Kr(e[r++])];return r&&r==n?t:void 0}var ns=_D;function bD(t,e,r){var n=t==null?void 0:ns(t,e);return n===void 0?r:n}var Wx=bD;function CD(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var is=CD;var Bx=pt?pt.isConcatSpreadable:void 0;function SD(t){return q(t)||On(t)||!!(Bx&&t&&t[Bx])}var Hx=SD;function Gx(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=Hx),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?Gx(a,e-1,r,n,i):is(i,a):n||(i[i.length]=a)}return i}var os=Gx;function kD(t){var e=t==null?0:t.length;return e?os(t,1):[]}var Ze=kD;var ED=Zu(Object.getPrototypeOf,Object),tl=ED;function AD(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}var rl=AD;function wD(t,e,r,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}var zx=wD;function ND(){this.__data__=new Fn,this.size=0}var Kx=ND;function PD(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Vx=PD;function DD(t){return this.__data__.get(t)}var Xx=DD;function ID(t){return this.__data__.has(t)}var Yx=ID;var OD=200;function LD(t,e){var r=this.__data__;if(r instanceof Fn){var n=r.__data__;if(!$n||n.length<OD-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new bi(n)}return r.set(t,e),this.size=r.size,this}var Jx=LD;function ss(t){var e=this.__data__=new Fn(t);this.size=e.size}ss.prototype.clear=Kx;ss.prototype.delete=Vx;ss.prototype.get=Xx;ss.prototype.has=Yx;ss.prototype.set=Jx;var jn=ss;function MD(t,e){return t&&Hr(e,Re(e),t)}var Qx=MD;function FD(t,e){return t&&Hr(e,Ln(e),t)}var Zx=FD;var nT=typeof exports=="object"&&exports&&!exports.nodeType&&exports,eT=nT&&typeof module=="object"&&module&&!module.nodeType&&module,$D=eT&&eT.exports===nT,tT=$D?nt.Buffer:void 0,rT=tT?tT.allocUnsafe:void 0;function qD(t,e){if(e)return t.slice();var r=t.length,n=rT?rT(r):new t.constructor(r);return t.copy(n),n}var iT=qD;function UD(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}var as=UD;function jD(){return[]}var nl=jD;var WD=Object.prototype,BD=WD.propertyIsEnumerable,oT=Object.getOwnPropertySymbols,HD=oT?function(t){return t==null?[]:(t=Object(t),as(oT(t),function(e){return BD.call(t,e)}))}:nl,cs=HD;function GD(t,e){return Hr(t,cs(t),e)}var sT=GD;var zD=Object.getOwnPropertySymbols,KD=zD?function(t){for(var e=[];t;)is(e,cs(t)),t=tl(t);return e}:nl,il=KD;function VD(t,e){return Hr(t,il(t),e)}var aT=VD;function XD(t,e,r){var n=e(t);return q(t)?n:is(n,r(t))}var ol=XD;function YD(t){return ol(t,Re,cs)}var Ba=YD;function JD(t){return ol(t,Ln,il)}var sl=JD;var QD=Yt(nt,"DataView"),al=QD;var ZD=Yt(nt,"Promise"),cl=ZD;var eI=Yt(nt,"Set"),Wn=eI;var cT="[object Map]",tI="[object Object]",uT="[object Promise]",lT="[object Set]",dT="[object WeakMap]",fT="[object DataView]",rI=ln(al),nI=ln($n),iI=ln(cl),oI=ln(Wn),sI=ln(Vu),Ci=Ft;(al&&Ci(new al(new ArrayBuffer(1)))!=fT||$n&&Ci(new $n)!=cT||cl&&Ci(cl.resolve())!=uT||Wn&&Ci(new Wn)!=lT||Vu&&Ci(new Vu)!=dT)&&(Ci=function(t){var e=Ft(t),r=e==tI?t.constructor:void 0,n=r?ln(r):"";if(n)switch(n){case rI:return fT;case nI:return cT;case iI:return uT;case oI:return lT;case sI:return dT}return e});var wr=Ci;var aI=Object.prototype,cI=aI.hasOwnProperty;function uI(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&cI.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var hT=uI;var lI=nt.Uint8Array,us=lI;function dI(t){var e=new t.constructor(t.byteLength);return new us(e).set(new us(t)),e}var ls=dI;function fI(t,e){var r=e?ls(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var pT=fI;var hI=/\w*$/;function pI(t){var e=new t.constructor(t.source,hI.exec(t));return e.lastIndex=t.lastIndex,e}var mT=pI;var gT=pt?pt.prototype:void 0,yT=gT?gT.valueOf:void 0;function mI(t){return yT?Object(yT.call(t)):{}}var vT=mI;function gI(t,e){var r=e?ls(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var xT=gI;var yI="[object Boolean]",vI="[object Date]",xI="[object Map]",TI="[object Number]",RI="[object RegExp]",_I="[object Set]",bI="[object String]",CI="[object Symbol]",SI="[object ArrayBuffer]",kI="[object DataView]",EI="[object Float32Array]",AI="[object Float64Array]",wI="[object Int8Array]",NI="[object Int16Array]",PI="[object Int32Array]",DI="[object Uint8Array]",II="[object Uint8ClampedArray]",OI="[object Uint16Array]",LI="[object Uint32Array]";function MI(t,e,r){var n=t.constructor;switch(e){case SI:return ls(t);case yI:case vI:return new n(+t);case kI:return pT(t,r);case EI:case AI:case wI:case NI:case PI:case DI:case II:case OI:case LI:return xT(t,r);case xI:return new n;case TI:case bI:return new n(t);case RI:return mT(t);case _I:return new n;case CI:return vT(t)}}var TT=MI;function FI(t){return typeof t.constructor=="function"&&!Gr(t)?Qv(tl(t)):{}}var RT=FI;var $I="[object Map]";function qI(t){return Qe(t)&&wr(t)==$I}var _T=qI;var bT=gr&&gr.isMap,UI=bT?zr(bT):_T,CT=UI;var jI="[object Set]";function WI(t){return Qe(t)&&wr(t)==jI}var ST=WI;var kT=gr&&gr.isSet,BI=kT?zr(kT):ST,ET=BI;var HI=1,GI=2,zI=4,AT="[object Arguments]",KI="[object Array]",VI="[object Boolean]",XI="[object Date]",YI="[object Error]",wT="[object Function]",JI="[object GeneratorFunction]",QI="[object Map]",ZI="[object Number]",NT="[object Object]",eO="[object RegExp]",tO="[object Set]",rO="[object String]",nO="[object Symbol]",iO="[object WeakMap]",oO="[object ArrayBuffer]",sO="[object DataView]",aO="[object Float32Array]",cO="[object Float64Array]",uO="[object Int8Array]",lO="[object Int16Array]",dO="[object Int32Array]",fO="[object Uint8Array]",hO="[object Uint8ClampedArray]",pO="[object Uint16Array]",mO="[object Uint32Array]",_e={};_e[AT]=_e[KI]=_e[oO]=_e[sO]=_e[VI]=_e[XI]=_e[aO]=_e[cO]=_e[uO]=_e[lO]=_e[dO]=_e[QI]=_e[ZI]=_e[NT]=_e[eO]=_e[tO]=_e[rO]=_e[nO]=_e[fO]=_e[hO]=_e[pO]=_e[mO]=!0;_e[YI]=_e[wT]=_e[iO]=!1;function ul(t,e,r,n,i,o){var s,a=e&HI,c=e&GI,u=e&zI;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!Ue(t))return t;var l=q(t);if(l){if(s=hT(t),!a)return ex(t,s)}else{var d=wr(t),f=d==wT||d==JI;if(dn(t))return iT(t,a);if(d==NT||d==AT||f&&!i){if(s=c||f?{}:RT(t),!a)return c?aT(t,Zx(s,t)):sT(t,Qx(s,t))}else{if(!_e[d])return i?t:{};s=TT(t,d,a)}}o||(o=new jn);var p=o.get(t);if(p)return p;o.set(t,s),ET(t)?t.forEach(function(S){s.add(ul(S,e,r,S,t,o))}):CT(t)&&t.forEach(function(S,R){s.set(R,ul(S,e,r,R,t,o))});var v=u?c?sl:Ba:c?Ln:Re,T=l?void 0:v(t);return Xu(T||t,function(S,R){T&&(R=S,S=t[R]),Dn(s,R,ul(S,e,r,R,t,o))}),s}var PT=ul;var gO=4;function yO(t){return PT(t,gO)}var be=yO;function vO(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i}var Vr=vO;var xO="__lodash_hash_undefined__";function TO(t){return this.__data__.set(t,xO),this}var DT=TO;function RO(t){return this.__data__.has(t)}var IT=RO;function ll(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new bi;++e<r;)this.add(t[e])}ll.prototype.add=ll.prototype.push=DT;ll.prototype.has=IT;var ds=ll;function _O(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var dl=_O;function bO(t,e){return t.has(e)}var fs=bO;var CO=1,SO=2;function kO(t,e,r,n,i,o){var s=r&CO,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(t),l=o.get(e);if(u&&l)return u==e&&l==t;var d=-1,f=!0,p=r&SO?new ds:void 0;for(o.set(t,e),o.set(e,t);++d<a;){var v=t[d],T=e[d];if(n)var S=s?n(T,v,d,e,t,o):n(v,T,d,t,e,o);if(S!==void 0){if(S)continue;f=!1;break}if(p){if(!dl(e,function(R,g){if(!fs(p,g)&&(v===R||i(v,R,r,n,o)))return p.push(g)})){f=!1;break}}else if(!(v===T||i(v,T,r,n,o))){f=!1;break}}return o.delete(t),o.delete(e),f}var fl=kO;function EO(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var OT=EO;function AO(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var hs=AO;var wO=1,NO=2,PO="[object Boolean]",DO="[object Date]",IO="[object Error]",OO="[object Map]",LO="[object Number]",MO="[object RegExp]",FO="[object Set]",$O="[object String]",qO="[object Symbol]",UO="[object ArrayBuffer]",jO="[object DataView]",LT=pt?pt.prototype:void 0,fp=LT?LT.valueOf:void 0;function WO(t,e,r,n,i,o,s){switch(r){case jO:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case UO:return!(t.byteLength!=e.byteLength||!o(new us(t),new us(e)));case PO:case DO:case LO:return Br(+t,+e);case IO:return t.name==e.name&&t.message==e.message;case MO:case $O:return t==e+"";case OO:var a=OT;case FO:var c=n&wO;if(a||(a=hs),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;n|=NO,s.set(t,e);var l=fl(a(t),a(e),n,i,o,s);return s.delete(t),l;case qO:if(fp)return fp.call(t)==fp.call(e)}return!1}var MT=WO;var BO=1,HO=Object.prototype,GO=HO.hasOwnProperty;function zO(t,e,r,n,i,o){var s=r&BO,a=Ba(t),c=a.length,u=Ba(e),l=u.length;if(c!=l&&!s)return!1;for(var d=c;d--;){var f=a[d];if(!(s?f in e:GO.call(e,f)))return!1}var p=o.get(t),v=o.get(e);if(p&&v)return p==e&&v==t;var T=!0;o.set(t,e),o.set(e,t);for(var S=s;++d<c;){f=a[d];var R=t[f],g=e[f];if(n)var h=s?n(g,R,f,e,t,o):n(R,g,f,t,e,o);if(!(h===void 0?R===g||i(R,g,r,n,o):h)){T=!1;break}S||(S=f=="constructor")}if(T&&!S){var _=t.constructor,w=e.constructor;_!=w&&"constructor"in t&&"constructor"in e&&!(typeof _=="function"&&_ instanceof _&&typeof w=="function"&&w instanceof w)&&(T=!1)}return o.delete(t),o.delete(e),T}var FT=zO;var KO=1,$T="[object Arguments]",qT="[object Array]",hl="[object Object]",VO=Object.prototype,UT=VO.hasOwnProperty;function XO(t,e,r,n,i,o){var s=q(t),a=q(e),c=s?qT:wr(t),u=a?qT:wr(e);c=c==$T?hl:c,u=u==$T?hl:u;var l=c==hl,d=u==hl,f=c==u;if(f&&dn(t)){if(!dn(e))return!1;s=!0,l=!1}if(f&&!l)return o||(o=new jn),s||Qo(t)?fl(t,e,r,n,i,o):MT(t,e,c,r,n,i,o);if(!(r&KO)){var p=l&&UT.call(t,"__wrapped__"),v=d&&UT.call(e,"__wrapped__");if(p||v){var T=p?t.value():t,S=v?e.value():e;return o||(o=new jn),i(T,S,r,n,o)}}return f?(o||(o=new jn),FT(t,e,r,n,i,o)):!1}var jT=XO;function WT(t,e,r,n,i){return t===e?!0:t==null||e==null||!Qe(t)&&!Qe(e)?t!==t&&e!==e:jT(t,e,r,n,WT,i)}var pl=WT;var YO=1,JO=2;function QO(t,e,r,n){var i=r.length,o=i,s=!n;if(t==null)return!o;for(t=Object(t);i--;){var a=r[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){a=r[i];var c=a[0],u=t[c],l=a[1];if(s&&a[2]){if(u===void 0&&!(c in t))return!1}else{var d=new jn;if(n)var f=n(u,l,c,t,e,d);if(!(f===void 0?pl(l,u,YO|JO,n,d):f))return!1}}return!0}var BT=QO;function ZO(t){return t===t&&!Ue(t)}var ml=ZO;function e0(t){for(var e=Re(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,ml(i)]}return e}var HT=e0;function t0(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var gl=t0;function r0(t){var e=HT(t);return e.length==1&&e[0][2]?gl(e[0][0],e[0][1]):function(r){return r===t||BT(r,t,e)}}var GT=r0;function n0(t,e){return t!=null&&e in Object(t)}var zT=n0;function i0(t,e,r){e=Un(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=Kr(e[n]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&Jo(i)&&Pn(s,i)&&(q(t)||On(t)))}var yl=i0;function o0(t,e){return t!=null&&yl(t,e,zT)}var KT=o0;var s0=1,a0=2;function c0(t,e){return Zo(t)&&ml(e)?gl(Kr(t),e):function(r){var n=Wx(r,t);return n===void 0&&n===e?KT(r,t):pl(e,n,s0|a0)}}var VT=c0;function u0(t){return function(e){return e?.[t]}}var XT=u0;function l0(t){return function(e){return ns(e,t)}}var YT=l0;function d0(t){return Zo(t)?XT(Kr(t)):YT(t)}var JT=d0;function f0(t){return typeof t=="function"?t:t==null?Xt:typeof t=="object"?q(t)?VT(t[0],t[1]):GT(t):JT(t)}var Ke=f0;function h0(t,e,r,n){for(var i=-1,o=t==null?0:t.length;++i<o;){var s=t[i];e(n,s,r(s),t)}return n}var QT=h0;function p0(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++i];if(r(o[c],c,o)===!1)break}return e}}var ZT=p0;var m0=ZT(),eR=m0;function g0(t,e){return t&&eR(t,e,Re)}var tR=g0;function y0(t,e){return function(r,n){if(r==null)return r;if(!it(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var rR=y0;var v0=rR(tR),Jt=v0;function x0(t,e,r,n){return Jt(t,function(i,o,s){e(n,i,r(i),s)}),n}var nR=x0;function T0(t,e){return function(r,n){var i=q(r)?QT:nR,o=e?e():{};return i(r,t,Ke(n,2),o)}}var iR=T0;var oR=Object.prototype,R0=oR.hasOwnProperty,_0=Yo(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&In(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],s=Ln(o),a=-1,c=s.length;++a<c;){var u=s[a],l=t[u];(l===void 0||Br(l,oR[u])&&!R0.call(t,u))&&(t[u]=o[u])}return t}),ps=_0;function b0(t){return Qe(t)&&it(t)}var hp=b0;function C0(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var vl=C0;var S0=200;function k0(t,e,r,n){var i=-1,o=Ju,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;r&&(e=jr(e,zr(r))),n?(o=vl,s=!1):e.length>=S0&&(o=fs,s=!1,e=new ds(e));e:for(;++i<a;){var l=t[i],d=r==null?l:r(l);if(l=n||l!==0?l:0,s&&d===d){for(var f=u;f--;)if(e[f]===d)continue e;c.push(l)}else o(e,d,n)||c.push(l)}return c}var sR=k0;var E0=Yo(function(t,e){return hp(t)?sR(t,os(e,1,hp,!0)):[]}),Bn=E0;function A0(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var Xr=A0;function w0(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Wr(e),rl(t,e<0?0:e,n)):[]}var et=w0;function N0(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Wr(e),e=n-e,rl(t,0,e<0?0:e)):[]}var hn=N0;function P0(t){return typeof t=="function"?t:Xt}var aR=P0;function D0(t,e){var r=q(t)?Xu:Jt;return r(t,aR(e))}var O=D0;function I0(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var cR=I0;function O0(t,e){var r=!0;return Jt(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var uR=O0;function L0(t,e,r){var n=q(t)?cR:uR;return r&&In(t,e,r)&&(e=void 0),n(t,Ke(e,3))}var At=L0;function M0(t,e){var r=[];return Jt(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var xl=M0;function F0(t,e){var r=q(t)?as:xl;return r(t,Ke(e,3))}var mt=F0;function $0(t){return function(e,r,n){var i=Object(e);if(!it(e)){var o=Ke(r,3);e=Re(e),r=function(a){return o(i[a],a,i)}}var s=t(e,r,n);return s>-1?i[o?e[s]:s]:void 0}}var lR=$0;var q0=Math.max;function U0(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Wr(r);return i<0&&(i=q0(n+i,0)),Yu(t,Ke(e,3),i)}var dR=U0;var j0=lR(dR),Yr=j0;function W0(t){return t&&t.length?t[0]:void 0}var gt=W0;function B0(t,e){var r=-1,n=it(t)?Array(t.length):[];return Jt(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var fR=B0;function H0(t,e){var r=q(t)?jr:fR;return r(t,Ke(e,3))}var N=H0;function G0(t,e){return os(N(t,e),1)}var bt=G0;var z0=Object.prototype,K0=z0.hasOwnProperty,V0=iR(function(t,e,r){K0.call(t,r)?t[r].push(e):Xo(t,r,[e])}),pp=V0;var X0=Object.prototype,Y0=X0.hasOwnProperty;function J0(t,e){return t!=null&&Y0.call(t,e)}var hR=J0;function Q0(t,e){return t!=null&&yl(t,e,hR)}var $=Q0;var Z0="[object String]";function eL(t){return typeof t=="string"||!q(t)&&Qe(t)&&Ft(t)==Z0}var dt=eL;function tL(t,e){return jr(e,function(r){return t[r]})}var pR=tL;function rL(t){return t==null?[]:pR(t,Re(t))}var me=rL;var nL=Math.max;function iL(t,e,r,n){t=it(t)?t:me(t),r=r&&!n?Wr(r):0;var i=t.length;return r<0&&(r=nL(i+r,0)),dt(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Vo(t,e,r)>-1}var Oe=iL;var oL=Math.max;function sL(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Wr(r);return i<0&&(i=oL(n+i,0)),Vo(t,e,i)}var Tl=sL;var aL="[object Map]",cL="[object Set]",uL=Object.prototype,lL=uL.hasOwnProperty;function dL(t){if(t==null)return!0;if(it(t)&&(q(t)||typeof t=="string"||typeof t.splice=="function"||dn(t)||Qo(t)||On(t)))return!t.length;var e=wr(t);if(e==aL||e==cL)return!t.size;if(Gr(t))return!el(t).length;for(var r in t)if(lL.call(t,r))return!1;return!0}var Q=dL;var fL="[object RegExp]";function hL(t){return Qe(t)&&Ft(t)==fL}var mR=hL;var gR=gr&&gr.isRegExp,pL=gR?zr(gR):mR,yr=pL;function mL(t){return t===void 0}var wt=mL;function gL(t,e){return t<e}var yR=gL;function yL(t,e,r){for(var n=-1,i=t.length;++n<i;){var o=t[n],s=e(o);if(s!=null&&(a===void 0?s===s&&!Ur(s):r(s,a)))var a=s,c=o}return c}var vR=yL;function vL(t){return t&&t.length?vR(t,Xt,yR):void 0}var xR=vL;var xL="Expected a function";function TL(t){if(typeof t!="function")throw new TypeError(xL);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var TR=TL;function RL(t,e,r,n){if(!Ue(t))return t;e=Un(e,t);for(var i=-1,o=e.length,s=o-1,a=t;a!=null&&++i<o;){var c=Kr(e[i]),u=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var l=a[c];u=n?n(l,c,a):void 0,u===void 0&&(u=Ue(l)?l:Pn(e[i+1])?[]:{})}Dn(a,c,u),a=a[c]}return t}var RR=RL;function _L(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var s=e[n],a=ns(t,s);r(a,s)&&RR(o,Un(s,t),a)}return o}var _R=_L;function bL(t,e){if(t==null)return{};var r=jr(sl(t),function(n){return[n]});return e=Ke(e),_R(t,r,function(n,i){return e(n,i[0])})}var Qt=bL;function CL(t,e,r,n,i){return i(t,function(o,s,a){r=n?(n=!1,o):e(r,o,s,a)}),r}var bR=CL;function SL(t,e,r){var n=q(t)?zx:bR,i=arguments.length<3;return n(t,Ke(e,4),r,i,Jt)}var We=SL;function kL(t,e){var r=q(t)?as:xl;return r(t,TR(Ke(e,3)))}var Hn=kL;function EL(t,e){var r;return Jt(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var CR=EL;function AL(t,e,r){var n=q(t)?dl:CR;return r&&In(t,e,r)&&(e=void 0),n(t,Ke(e,3))}var Ha=AL;var wL=1/0,NL=Wn&&1/hs(new Wn([,-0]))[1]==wL?function(t){return new Wn(t)}:je,SR=NL;var PL=200;function DL(t,e,r){var n=-1,i=Ju,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=vl;else if(o>=PL){var u=e?null:SR(t);if(u)return hs(u);s=!1,i=fs,c=new ds}else c=e?[]:a;e:for(;++n<o;){var l=t[n],d=e?e(l):l;if(l=r||l!==0?l:0,s&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;e&&c.push(d),a.push(l)}else i(c,d,r)||(c!==a&&c.push(d),a.push(l))}return a}var Rl=DL;function IL(t){return t&&t.length?Rl(t):[]}var ms=IL;function OL(t,e){return t&&t.length?Rl(t,Ke(e,2)):[]}var kR=OL;function gs(t){console&&console.error&&console.error(`Error: ${t}`)}function Ga(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function za(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function Ka(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function LL(t){return ML(t)?t.LABEL:t.name}function ML(t){return dt(t.LABEL)&&t.LABEL!==""}var ur=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),O(this.definition,r=>{r.accept(e)})}},fe=class extends ur{constructor(e){super([]),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},qt=class extends ur{constructor(e){super(e.definition),this.orgText="",_t(this,Qt(e,r=>r!==void 0))}},Ce=class extends ur{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,_t(this,Qt(e,r=>r!==void 0))}},he=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},Se=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},ke=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},ie=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},ye=class extends ur{constructor(e){super(e.definition),this.idx=1,_t(this,Qt(e,r=>r!==void 0))}},ve=class extends ur{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,_t(this,Qt(e,r=>r!==void 0))}},ee=class{constructor(e){this.idx=1,_t(this,Qt(e,r=>r!==void 0))}accept(e){e.visit(this)}};function _l(t){return N(t,ys)}function ys(t){function e(r){return N(r,ys)}if(t instanceof fe){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return dt(t.label)&&(r.label=t.label),r}else{if(t instanceof Ce)return{type:"Alternative",definition:e(t.definition)};if(t instanceof he)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Se)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof ke)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:ys(new ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof ye)return{type:"RepetitionWithSeparator",idx:t.idx,separator:ys(new ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof ie)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof ve)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof ee){let r={type:"Terminal",name:t.terminalType.name,label:LL(t.terminalType),idx:t.idx};dt(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=yr(n)?n.source:n),r}else{if(t instanceof qt)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var Ut=class{visit(e){let r=e;switch(r.constructor){case fe:return this.visitNonTerminal(r);case Ce:return this.visitAlternative(r);case he:return this.visitOption(r);case Se:return this.visitRepetitionMandatory(r);case ke:return this.visitRepetitionMandatoryWithSeparator(r);case ye:return this.visitRepetitionWithSeparator(r);case ie:return this.visitRepetition(r);case ve:return this.visitAlternation(r);case ee:return this.visitTerminal(r);case qt:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function mp(t){return t instanceof Ce||t instanceof he||t instanceof ie||t instanceof Se||t instanceof ke||t instanceof ye||t instanceof ee||t instanceof qt}function Si(t,e=[]){return t instanceof he||t instanceof ie||t instanceof ye?!0:t instanceof ve?Ha(t.definition,n=>Si(n,e)):t instanceof fe&&Oe(e,t)?!1:t instanceof ur?(t instanceof fe&&e.push(t),At(t.definition,n=>Si(n,e))):!1}function gp(t){return t instanceof ve}function Zt(t){if(t instanceof fe)return"SUBRULE";if(t instanceof he)return"OPTION";if(t instanceof ve)return"OR";if(t instanceof Se)return"AT_LEAST_ONE";if(t instanceof ke)return"AT_LEAST_ONE_SEP";if(t instanceof ye)return"MANY_SEP";if(t instanceof ie)return"MANY";if(t instanceof ee)return"CONSUME";throw Error("non exhaustive match")}var pn=class{walk(e,r=[]){O(e.definition,(n,i)=>{let o=et(e.definition,i+1);if(n instanceof fe)this.walkProdRef(n,o,r);else if(n instanceof ee)this.walkTerminal(n,o,r);else if(n instanceof Ce)this.walkFlat(n,o,r);else if(n instanceof he)this.walkOption(n,o,r);else if(n instanceof Se)this.walkAtLeastOne(n,o,r);else if(n instanceof ke)this.walkAtLeastOneSep(n,o,r);else if(n instanceof ye)this.walkManySep(n,o,r);else if(n instanceof ie)this.walkMany(n,o,r);else if(n instanceof ve)this.walkOr(n,o,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new he({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=ER(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new he({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=ER(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);O(e.definition,o=>{let s=new Ce({definition:[o]});this.walk(s,i)})}};function ER(t,e,r){return[new he({definition:[new ee({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function ki(t){if(t instanceof fe)return ki(t.referencedRule);if(t instanceof ee)return qL(t);if(mp(t))return FL(t);if(gp(t))return $L(t);throw Error("non exhaustive match")}function FL(t){let e=[],r=t.definition,n=0,i=r.length>n,o,s=!0;for(;i&&s;)o=r[n],s=Si(o),e=e.concat(ki(o)),n=n+1,i=r.length>n;return ms(e)}function $L(t){let e=N(t.definition,r=>ki(r));return ms(Ze(e))}function qL(t){return[t.terminalType]}var bl="_~IN~_";var yp=class extends pn{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=UL(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),s=new Ce({definition:o}),a=ki(s);this.follows[i]=a}};function AR(t){let e={};return O(t,r=>{let n=new yp(r).startWalking();_t(e,n)}),e}function UL(t,e){return t.name+e+bl}var Cl={},jL=new xi;function vs(t){let e=t.toString();if(Cl.hasOwnProperty(e))return Cl[e];{let r=jL.pattern(e);return Cl[e]=r,r}}function wR(){Cl={}}var PR="Complement Sets are not supported for first char optimization",Va=`Unable to use "first char" lexer optimizations:
47
+ `;function DR(t,e=!1){try{let r=vs(t);return vp(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===PR)e&&Ga(`${Va} Unable to optimize: < ${t.toString()} >
48
48
  Complement Sets cannot be automatically optimized.
49
49
  This will disable the lexer's first char optimizations.
50
50
  See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";e&&(n=`
51
51
  This will disable the lexer's first char optimizations.
52
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),ms(`${Ka}
52
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),gs(`${Va}
53
53
  Failed parsing: < ${t.toString()} >
54
54
  Using the @chevrotain/regexp-to-ast library
55
- Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function gp(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)gp(t.value[i],e,r);break;case"Alternative":let n=t.value;for(let i=0;i<n.length;i++){let o=n[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let s=o;switch(s.type){case"Character":kl(s.value,e,r);break;case"Set":if(s.complement===!0)throw Error(wR);O(s.value,c=>{if(typeof c=="number")kl(c,e,r);else{let u=c;if(r===!0)for(let l=u.from;l<=u.to;l++)kl(l,e,r);else{for(let l=u.from;l<=u.to&&l<vs;l++)kl(l,e,r);if(u.to>=vs){let l=u.from>=vs?u.from:vs,d=u.to,f=Jr(l),p=Jr(d);for(let v=f;v<=p;v++)e[v]=v}}}});break;case"Group":gp(s.value,e,r);break;default:throw Error("Non Exhaustive Match")}let a=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&yp(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return me(e)}function kl(t,e,r){let n=Jr(t);e[n]=n,r===!0&&UL(t,e)}function UL(t,e){let r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){let i=Jr(n.charCodeAt(0));e[i]=i}else{let i=r.toLowerCase();if(i!==r){let o=Jr(i.charCodeAt(0));e[o]=o}}}function AR(t,e){return Yr(t.value,r=>{if(typeof r=="number")return Oe(e,r);{let n=r;return Yr(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function yp(t){let e=t.quantifier;return e&&e.atLeast===0?!0:t.value?q(t.value)?At(t.value,yp):yp(t.value):!1}var vp=class extends $r{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){Oe(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?AR(e,this.targetCharCodes)===void 0&&(this.found=!0):AR(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Sl(t,e){if(e instanceof RegExp){let r=ys(e),n=new vp(t);return n.visit(r),n.found}else return Yr(e,r=>Oe(t,r.charCodeAt(0)))!==void 0}var Ei="PATTERN",xs="defaultMode",El="modes",Tp=typeof new RegExp("(?:)").sticky=="boolean";function IR(t,e){e=hs(e,{useSticky:Tp,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
56
- `],tracer:(g,h)=>h()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{iM()});let n;r("Reject Lexer.NA",()=>{n=Hn(t,g=>g[Ei]===Me.NA)});let i=!1,o;r("Transform Patterns",()=>{i=!1,o=N(n,g=>{let h=g[Ei];if(yr(h)){let _=h.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!h.ignoreCase?_:_.length===2&&_[0]==="\\"&&!Oe(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:e.useSticky?DR(h):PR(h)}else{if($t(h))return i=!0,{exec:h};if(typeof h=="object")return i=!0,h;if(typeof h=="string"){if(h.length===1)return h;{let _=h.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),w=new RegExp(_);return e.useSticky?DR(w):PR(w)}}else throw Error("non exhaustive match")}})});let s,a,c,u,l;r("misc mapping",()=>{s=N(n,g=>g.tokenTypeIdx),a=N(n,g=>{let h=g.GROUP;if(h!==Me.SKIPPED){if(dt(h))return h;if(wt(h))return!1;throw Error("non exhaustive match")}}),c=N(n,g=>{let h=g.LONGER_ALT;if(h)return q(h)?N(h,w=>Tl(n,w)):[Tl(n,h)]}),u=N(n,g=>g.PUSH_MODE),l=N(n,g=>$(g,"POP_MODE"))});let d;r("Line Terminator Handling",()=>{let g=jR(e.lineTerminatorCharacters);d=N(n,h=>!1),e.positionTracking!=="onlyOffset"&&(d=N(n,h=>$(h,"LINE_BREAKS")?!!h.LINE_BREAKS:UR(h,g)===!1&&Sl(g,h.PATTERN)))});let f,p,v,T;r("Misc Mapping #2",()=>{f=N(n,$R),p=N(o,rM),v=We(n,(g,h)=>{let _=h.GROUP;return dt(_)&&_!==Me.SKIPPED&&(g[_]=[]),g},{}),T=N(o,(g,h)=>({pattern:o[h],longerAlt:c[h],canLineTerminator:d[h],isCustom:f[h],short:p[h],group:a[h],push:u[h],pop:l[h],tokenTypeIdx:s[h],tokenType:n[h]}))});let k=!0,R=[];return e.safeMode||r("First Char Optimization",()=>{R=We(n,(g,h,_)=>{if(typeof h.PATTERN=="string"){let w=h.PATTERN.charCodeAt(0),J=Jr(w);xp(g,J,T[_])}else if(q(h.START_CHARS_HINT)){let w;O(h.START_CHARS_HINT,J=>{let Bt=typeof J=="string"?J.charCodeAt(0):J,Ye=Jr(Bt);w!==Ye&&(w=Ye,xp(g,Ye,T[_]))})}else if(yr(h.PATTERN))if(h.PATTERN.unicode)k=!1,e.ensureOptimizations&&ms(`${Ka} Unable to analyze < ${h.PATTERN.toString()} > pattern.
55
+ Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function vp(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)vp(t.value[i],e,r);break;case"Alternative":let n=t.value;for(let i=0;i<n.length;i++){let o=n[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let s=o;switch(s.type){case"Character":Sl(s.value,e,r);break;case"Set":if(s.complement===!0)throw Error(PR);O(s.value,c=>{if(typeof c=="number")Sl(c,e,r);else{let u=c;if(r===!0)for(let l=u.from;l<=u.to;l++)Sl(l,e,r);else{for(let l=u.from;l<=u.to&&l<xs;l++)Sl(l,e,r);if(u.to>=xs){let l=u.from>=xs?u.from:xs,d=u.to,f=Jr(l),p=Jr(d);for(let v=f;v<=p;v++)e[v]=v}}}});break;case"Group":vp(s.value,e,r);break;default:throw Error("Non Exhaustive Match")}let a=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&xp(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return me(e)}function Sl(t,e,r){let n=Jr(t);e[n]=n,r===!0&&WL(t,e)}function WL(t,e){let r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){let i=Jr(n.charCodeAt(0));e[i]=i}else{let i=r.toLowerCase();if(i!==r){let o=Jr(i.charCodeAt(0));e[o]=o}}}function NR(t,e){return Yr(t.value,r=>{if(typeof r=="number")return Oe(e,r);{let n=r;return Yr(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function xp(t){let e=t.quantifier;return e&&e.atLeast===0?!0:t.value?q(t.value)?At(t.value,xp):xp(t.value):!1}var Tp=class extends $r{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){Oe(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?NR(e,this.targetCharCodes)===void 0&&(this.found=!0):NR(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function kl(t,e){if(e instanceof RegExp){let r=vs(e),n=new Tp(t);return n.visit(r),n.found}else return Yr(e,r=>Oe(t,r.charCodeAt(0)))!==void 0}var Ei="PATTERN",Ts="defaultMode",El="modes",_p=typeof new RegExp("(?:)").sticky=="boolean";function LR(t,e){e=ps(e,{useSticky:_p,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
56
+ `],tracer:(g,h)=>h()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{sM()});let n;r("Reject Lexer.NA",()=>{n=Hn(t,g=>g[Ei]===Me.NA)});let i=!1,o;r("Transform Patterns",()=>{i=!1,o=N(n,g=>{let h=g[Ei];if(yr(h)){let _=h.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!h.ignoreCase?_:_.length===2&&_[0]==="\\"&&!Oe(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:e.useSticky?OR(h):IR(h)}else{if($t(h))return i=!0,{exec:h};if(typeof h=="object")return i=!0,h;if(typeof h=="string"){if(h.length===1)return h;{let _=h.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),w=new RegExp(_);return e.useSticky?OR(w):IR(w)}}else throw Error("non exhaustive match")}})});let s,a,c,u,l;r("misc mapping",()=>{s=N(n,g=>g.tokenTypeIdx),a=N(n,g=>{let h=g.GROUP;if(h!==Me.SKIPPED){if(dt(h))return h;if(wt(h))return!1;throw Error("non exhaustive match")}}),c=N(n,g=>{let h=g.LONGER_ALT;if(h)return q(h)?N(h,w=>Tl(n,w)):[Tl(n,h)]}),u=N(n,g=>g.PUSH_MODE),l=N(n,g=>$(g,"POP_MODE"))});let d;r("Line Terminator Handling",()=>{let g=BR(e.lineTerminatorCharacters);d=N(n,h=>!1),e.positionTracking!=="onlyOffset"&&(d=N(n,h=>$(h,"LINE_BREAKS")?!!h.LINE_BREAKS:WR(h,g)===!1&&kl(g,h.PATTERN)))});let f,p,v,T;r("Misc Mapping #2",()=>{f=N(n,UR),p=N(o,iM),v=We(n,(g,h)=>{let _=h.GROUP;return dt(_)&&_!==Me.SKIPPED&&(g[_]=[]),g},{}),T=N(o,(g,h)=>({pattern:o[h],longerAlt:c[h],canLineTerminator:d[h],isCustom:f[h],short:p[h],group:a[h],push:u[h],pop:l[h],tokenTypeIdx:s[h],tokenType:n[h]}))});let S=!0,R=[];return e.safeMode||r("First Char Optimization",()=>{R=We(n,(g,h,_)=>{if(typeof h.PATTERN=="string"){let w=h.PATTERN.charCodeAt(0),J=Jr(w);Rp(g,J,T[_])}else if(q(h.START_CHARS_HINT)){let w;O(h.START_CHARS_HINT,J=>{let Bt=typeof J=="string"?J.charCodeAt(0):J,Ye=Jr(Bt);w!==Ye&&(w=Ye,Rp(g,Ye,T[_]))})}else if(yr(h.PATTERN))if(h.PATTERN.unicode)S=!1,e.ensureOptimizations&&gs(`${Va} Unable to analyze < ${h.PATTERN.toString()} > pattern.
57
57
  The regexp unicode flag is not currently supported by the regexp-to-ast library.
58
58
  This will disable the lexer's first char optimizations.
59
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let w=NR(h.PATTERN,e.ensureOptimizations);Q(w)&&(k=!1),O(w,J=>{xp(g,J,T[_])})}else e.ensureOptimizations&&ms(`${Ka} TokenType: <${h.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
59
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let w=DR(h.PATTERN,e.ensureOptimizations);Q(w)&&(S=!1),O(w,J=>{Rp(g,J,T[_])})}else e.ensureOptimizations&&gs(`${Va} TokenType: <${h.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
60
60
  This will disable the lexer's first char optimizations.
61
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),k=!1;return g},[])}),{emptyGroups:v,patternIdxToConfig:T,charCodeToPatternIdxToConfig:R,hasCustom:i,canBeOptimized:k}}function OR(t,e){let r=[],n=WL(t);r=r.concat(n.errors);let i=BL(n.valid),o=i.valid;return r=r.concat(i.errors),r=r.concat(jL(o)),r=r.concat(JL(o)),r=r.concat(QL(o,e)),r=r.concat(ZL(o)),r}function jL(t){let e=[],r=mt(t,n=>yr(n[Ei]));return e=e.concat(GL(r)),e=e.concat(VL(r)),e=e.concat(XL(r)),e=e.concat(YL(r)),e=e.concat(zL(r)),e}function WL(t){let e=mt(t,i=>!$(i,Ei)),r=N(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Le.MISSING_PATTERN,tokenTypes:[i]})),n=Bn(t,e);return{errors:r,valid:n}}function BL(t){let e=mt(t,i=>{let o=i[Ei];return!yr(o)&&!$t(o)&&!$(o,"exec")&&!dt(o)}),r=N(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Le.INVALID_PATTERN,tokenTypes:[i]})),n=Bn(t,e);return{errors:r,valid:n}}var HL=/[^\\][$]/;function GL(t){class e extends $r{constructor(){super(...arguments),this.found=!1}visitEndAnchor(o){this.found=!0}}let r=mt(t,i=>{let o=i.PATTERN;try{let s=ys(o),a=new e;return a.visit(s),a.found}catch{return HL.test(o.source)}});return N(r,i=>({message:`Unexpected RegExp Anchor Error:
61
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),S=!1;return g},[])}),{emptyGroups:v,patternIdxToConfig:T,charCodeToPatternIdxToConfig:R,hasCustom:i,canBeOptimized:S}}function MR(t,e){let r=[],n=HL(t);r=r.concat(n.errors);let i=GL(n.valid),o=i.valid;return r=r.concat(i.errors),r=r.concat(BL(o)),r=r.concat(ZL(o)),r=r.concat(eM(o,e)),r=r.concat(tM(o)),r}function BL(t){let e=[],r=mt(t,n=>yr(n[Ei]));return e=e.concat(KL(r)),e=e.concat(YL(r)),e=e.concat(JL(r)),e=e.concat(QL(r)),e=e.concat(VL(r)),e}function HL(t){let e=mt(t,i=>!$(i,Ei)),r=N(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Le.MISSING_PATTERN,tokenTypes:[i]})),n=Bn(t,e);return{errors:r,valid:n}}function GL(t){let e=mt(t,i=>{let o=i[Ei];return!yr(o)&&!$t(o)&&!$(o,"exec")&&!dt(o)}),r=N(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Le.INVALID_PATTERN,tokenTypes:[i]})),n=Bn(t,e);return{errors:r,valid:n}}var zL=/[^\\][$]/;function KL(t){class e extends $r{constructor(){super(...arguments),this.found=!1}visitEndAnchor(o){this.found=!0}}let r=mt(t,i=>{let o=i.PATTERN;try{let s=vs(o),a=new e;return a.visit(s),a.found}catch{return zL.test(o.source)}});return N(r,i=>({message:`Unexpected RegExp Anchor Error:
62
62
  Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
63
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Le.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function zL(t){let e=mt(t,n=>n.PATTERN.test(""));return N(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Le.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var KL=/[^\\[][\^]|^\^/;function VL(t){class e extends $r{constructor(){super(...arguments),this.found=!1}visitStartAnchor(o){this.found=!0}}let r=mt(t,i=>{let o=i.PATTERN;try{let s=ys(o),a=new e;return a.visit(s),a.found}catch{return KL.test(o.source)}});return N(r,i=>({message:`Unexpected RegExp Anchor Error:
63
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Le.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function VL(t){let e=mt(t,n=>n.PATTERN.test(""));return N(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Le.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var XL=/[^\\[][\^]|^\^/;function YL(t){class e extends $r{constructor(){super(...arguments),this.found=!1}visitStartAnchor(o){this.found=!0}}let r=mt(t,i=>{let o=i.PATTERN;try{let s=vs(o),a=new e;return a.visit(s),a.found}catch{return XL.test(o.source)}});return N(r,i=>({message:`Unexpected RegExp Anchor Error:
64
64
  Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
65
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Le.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function XL(t){let e=mt(t,n=>{let i=n[Ei];return i instanceof RegExp&&(i.multiline||i.global)});return N(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Le.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function YL(t){let e=[],r=N(t,o=>We(t,(s,a)=>(o.PATTERN.source===a.PATTERN.source&&!Oe(e,a)&&a.PATTERN!==Me.NA&&(e.push(a),s.push(a)),s),[]));r=Vr(r);let n=mt(r,o=>o.length>1);return N(n,o=>{let s=N(o,c=>c.name);return{message:`The same RegExp pattern ->${gt(o).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:Le.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}})}function JL(t){let e=mt(t,n=>{if(!$(n,"GROUP"))return!1;let i=n.GROUP;return i!==Me.SKIPPED&&i!==Me.NA&&!dt(i)});return N(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Le.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function QL(t,e){let r=mt(t,i=>i.PUSH_MODE!==void 0&&!Oe(e,i.PUSH_MODE));return N(r,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Le.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function ZL(t){let e=[],r=We(t,(n,i,o)=>{let s=i.PATTERN;return s===Me.NA||(dt(s)?n.push({str:s,idx:o,tokenType:i}):yr(s)&&tM(s)&&n.push({str:s.source,idx:o,tokenType:i})),n},[]);return O(t,(n,i)=>{O(r,({str:o,idx:s,tokenType:a})=>{if(i<s&&eM(o,n.PATTERN)){let c=`Token: ->${a.name}<- can never be matched.
65
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Le.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function JL(t){let e=mt(t,n=>{let i=n[Ei];return i instanceof RegExp&&(i.multiline||i.global)});return N(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Le.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function QL(t){let e=[],r=N(t,o=>We(t,(s,a)=>(o.PATTERN.source===a.PATTERN.source&&!Oe(e,a)&&a.PATTERN!==Me.NA&&(e.push(a),s.push(a)),s),[]));r=Vr(r);let n=mt(r,o=>o.length>1);return N(n,o=>{let s=N(o,c=>c.name);return{message:`The same RegExp pattern ->${gt(o).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:Le.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}})}function ZL(t){let e=mt(t,n=>{if(!$(n,"GROUP"))return!1;let i=n.GROUP;return i!==Me.SKIPPED&&i!==Me.NA&&!dt(i)});return N(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Le.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function eM(t,e){let r=mt(t,i=>i.PUSH_MODE!==void 0&&!Oe(e,i.PUSH_MODE));return N(r,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Le.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function tM(t){let e=[],r=We(t,(n,i,o)=>{let s=i.PATTERN;return s===Me.NA||(dt(s)?n.push({str:s,idx:o,tokenType:i}):yr(s)&&nM(s)&&n.push({str:s.source,idx:o,tokenType:i})),n},[]);return O(t,(n,i)=>{O(r,({str:o,idx:s,tokenType:a})=>{if(i<s&&rM(o,n.PATTERN)){let c=`Token: ->${a.name}<- can never be matched.
66
66
  Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
67
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:Le.UNREACHABLE_PATTERN,tokenTypes:[n,a]})}})}),e}function eM(t,e){if(yr(e)){let r=e.exec(t);return r!==null&&r.index===0}else{if($t(e))return e(t,0,[],{});if($(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function tM(t){return Yr([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>t.source.indexOf(r)!==-1)===void 0}function PR(t){let e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function DR(t){let e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function LR(t,e,r){let n=[];return $(t,xs)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+xs+`> property in its definition
67
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:Le.UNREACHABLE_PATTERN,tokenTypes:[n,a]})}})}),e}function rM(t,e){if(yr(e)){let r=e.exec(t);return r!==null&&r.index===0}else{if($t(e))return e(t,0,[],{});if($(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function nM(t){return Yr([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>t.source.indexOf(r)!==-1)===void 0}function IR(t){let e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function OR(t){let e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function FR(t,e,r){let n=[];return $(t,Ts)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Ts+`> property in its definition
68
68
  `,type:Le.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),$(t,El)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+El+`> property in its definition
69
- `,type:Le.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),$(t,El)&&$(t,xs)&&!$(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${xs}: <${t.defaultMode}>which does not exist
69
+ `,type:Le.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),$(t,El)&&$(t,Ts)&&!$(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Ts}: <${t.defaultMode}>which does not exist
70
70
  `,type:Le.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),$(t,El)&&O(t.modes,(i,o)=>{O(i,(s,a)=>{if(wt(s))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${o}> at index: <${a}>
71
71
  `,type:Le.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if($(s,"LONGER_ALT")){let c=q(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT];O(c,u=>{!wt(u)&&!Oe(i,u)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${s.name}> outside of mode <${o}>
72
- `,type:Le.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function MR(t,e,r){let n=[],i=!1,o=Vr(Ze(me(t.modes))),s=Hn(o,c=>c[Ei]===Me.NA),a=jR(r);return e&&O(s,c=>{let u=UR(c,a);if(u!==!1){let d={message:nM(c,u),type:u.issue,tokenType:c};n.push(d)}else $(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):Sl(a,c.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
72
+ `,type:Le.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function $R(t,e,r){let n=[],i=!1,o=Vr(Ze(me(t.modes))),s=Hn(o,c=>c[Ei]===Me.NA),a=BR(r);return e&&O(s,c=>{let u=WR(c,a);if(u!==!1){let d={message:oM(c,u),type:u.issue,tokenType:c};n.push(d)}else $(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):kl(a,c.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
73
73
  This Lexer has been defined to track line and column information,
74
74
  But none of the Token Types can be identified as matching a line terminator.
75
75
  See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
76
- for details.`,type:Le.NO_LINE_BREAKS_FLAGS}),n}function FR(t){let e={},r=Re(t);return O(r,n=>{let i=t[n];if(q(i))e[n]=[];else throw Error("non exhaustive match")}),e}function $R(t){let e=t.PATTERN;if(yr(e))return!1;if($t(e))return!0;if($(e,"exec"))return!0;if(dt(e))return!1;throw Error("non exhaustive match")}function rM(t){return dt(t)&&t.length===1?t.charCodeAt(0):!1}var qR={test:function(t){let e=t.length;for(let r=this.lastIndex;r<e;r++){let 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},lastIndex:0};function UR(t,e){if($(t,"LINE_BREAKS"))return!1;if(yr(t.PATTERN)){try{Sl(e,t.PATTERN)}catch(r){return{issue:Le.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(dt(t.PATTERN))return!1;if($R(t))return{issue:Le.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function nM(t,e){if(e.issue===Le.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
76
+ for details.`,type:Le.NO_LINE_BREAKS_FLAGS}),n}function qR(t){let e={},r=Re(t);return O(r,n=>{let i=t[n];if(q(i))e[n]=[];else throw Error("non exhaustive match")}),e}function UR(t){let e=t.PATTERN;if(yr(e))return!1;if($t(e))return!0;if($(e,"exec"))return!0;if(dt(e))return!1;throw Error("non exhaustive match")}function iM(t){return dt(t)&&t.length===1?t.charCodeAt(0):!1}var jR={test:function(t){let e=t.length;for(let r=this.lastIndex;r<e;r++){let 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},lastIndex:0};function WR(t,e){if($(t,"LINE_BREAKS"))return!1;if(yr(t.PATTERN)){try{kl(e,t.PATTERN)}catch(r){return{issue:Le.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(dt(t.PATTERN))return!1;if(UR(t))return{issue:Le.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function oM(t,e){if(e.issue===Le.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
77
77
  The problem is in the <${t.name}> Token Type
78
78
  Root cause: ${e.errMsg}.
79
79
  For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===Le.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
80
80
  The problem is in the <${t.name}> Token Type
81
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function jR(t){return N(t,r=>dt(r)?r.charCodeAt(0):r)}function xp(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}var vs=256,Al=[];function Jr(t){return t<vs?t:Al[t]}function iM(){if(Q(Al)){Al=new Array(65536);for(let t=0;t<65536;t++)Al[t]=t>255?255+~~(t/255):t}}function mn(t,e){let r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}function Ts(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}var WR=1,HR={};function gn(t){let e=oM(t);sM(e),cM(e),aM(e),O(e,r=>{r.isParent=r.categoryMatches.length>0})}function oM(t){let e=be(t),r=t,n=!0;for(;n;){r=Vr(Ze(N(r,o=>o.CATEGORIES)));let i=Bn(r,e);e=e.concat(i),Q(i)?n=!1:r=i}return e}function sM(t){O(t,e=>{Rp(e)||(HR[WR]=e,e.tokenTypeIdx=WR++),BR(e)&&!q(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),BR(e)||(e.CATEGORIES=[]),uM(e)||(e.categoryMatches=[]),lM(e)||(e.categoryMatchesMap={})})}function aM(t){O(t,e=>{e.categoryMatches=[],O(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(HR[n].tokenTypeIdx)})})}function cM(t){O(t,e=>{GR([],e)})}function GR(t,e){O(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),O(e.CATEGORIES,r=>{let n=t.concat(e);Oe(n,r)||GR(n,r)})}function Rp(t){return $(t,"tokenTypeIdx")}function BR(t){return $(t,"CATEGORIES")}function uM(t){return $(t,"categoryMatches")}function lM(t){return $(t,"categoryMatchesMap")}function zR(t){return $(t,"tokenTypeIdx")}var Rs={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}};var Le;(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"})(Le||(Le={}));var Va={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
82
- `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Rs,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Va);var Me=class{constructor(e,r=Va){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,o)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${i}>`);let{time:a,value:c}=Ga(o),u=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${s}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,c}else return o()},typeof r=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
83
- a boolean 2nd argument is no longer supported`);this.config=_t({},Va,r);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,o=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Va.lineTerminatorsPattern)this.config.lineTerminatorsPattern=qR;else if(this.config.lineTerminatorCharacters===Va.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
84
- 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),q(e)?i={modes:{defaultMode:be(e)},defaultMode:xs}:(o=!1,i=be(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(LR(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(MR(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},O(i.modes,(a,c)=>{i.modes[c]=Hn(a,u=>wt(u))});let s=Re(i.modes);if(O(i.modes,(a,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(OR(a,s))}),Q(this.lexerDefinitionErrors)){gn(a);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=IR(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=u.charCodeToPatternIdxToConfig,this.emptyGroups=_t({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!Q(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let c=N(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
81
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function BR(t){return N(t,r=>dt(r)?r.charCodeAt(0):r)}function Rp(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}var xs=256,Al=[];function Jr(t){return t<xs?t:Al[t]}function sM(){if(Q(Al)){Al=new Array(65536);for(let t=0;t<65536;t++)Al[t]=t>255?255+~~(t/255):t}}function mn(t,e){let r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}function Rs(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}var HR=1,zR={};function gn(t){let e=aM(t);cM(e),lM(e),uM(e),O(e,r=>{r.isParent=r.categoryMatches.length>0})}function aM(t){let e=be(t),r=t,n=!0;for(;n;){r=Vr(Ze(N(r,o=>o.CATEGORIES)));let i=Bn(r,e);e=e.concat(i),Q(i)?n=!1:r=i}return e}function cM(t){O(t,e=>{bp(e)||(zR[HR]=e,e.tokenTypeIdx=HR++),GR(e)&&!q(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),GR(e)||(e.CATEGORIES=[]),dM(e)||(e.categoryMatches=[]),fM(e)||(e.categoryMatchesMap={})})}function uM(t){O(t,e=>{e.categoryMatches=[],O(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(zR[n].tokenTypeIdx)})})}function lM(t){O(t,e=>{KR([],e)})}function KR(t,e){O(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),O(e.CATEGORIES,r=>{let n=t.concat(e);Oe(n,r)||KR(n,r)})}function bp(t){return $(t,"tokenTypeIdx")}function GR(t){return $(t,"CATEGORIES")}function dM(t){return $(t,"categoryMatches")}function fM(t){return $(t,"categoryMatchesMap")}function VR(t){return $(t,"tokenTypeIdx")}var _s={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}};var Le;(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"})(Le||(Le={}));var Xa={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
82
+ `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:_s,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Xa);var Me=class{constructor(e,r=Xa){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,o)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${i}>`);let{time:a,value:c}=za(o),u=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${s}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,c}else return o()},typeof r=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
83
+ a boolean 2nd argument is no longer supported`);this.config=_t({},Xa,r);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,o=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Xa.lineTerminatorsPattern)this.config.lineTerminatorsPattern=jR;else if(this.config.lineTerminatorCharacters===Xa.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
84
+ 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),q(e)?i={modes:{defaultMode:be(e)},defaultMode:Ts}:(o=!1,i=be(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(FR(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat($R(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},O(i.modes,(a,c)=>{i.modes[c]=Hn(a,u=>wt(u))});let s=Re(i.modes);if(O(i.modes,(a,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(MR(a,s))}),Q(this.lexerDefinitionErrors)){gn(a);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=LR(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=u.charCodeToPatternIdxToConfig,this.emptyGroups=_t({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!Q(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let c=N(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
85
85
  `);throw new Error(`Errors detected in definition of Lexer:
86
- `+c)}O(this.lexerDefinitionWarning,a=>{Ha(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(Tp?(this.chopInput=Xt,this.match=this.matchWithTest):(this.updateLastIndex=je,this.match=this.matchWithExec),o&&(this.handleModes=je),this.trackStartLines===!1&&(this.computeNewColumn=Xt),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=je),/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",()=>{let a=We(this.canModeBeOptimized,(c,u,l)=>(u===!1&&c.push(l),c),[]);if(r.ensureOptimizations&&!Q(a))throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
86
+ `+c)}O(this.lexerDefinitionWarning,a=>{Ga(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(_p?(this.chopInput=Xt,this.match=this.matchWithTest):(this.updateLastIndex=je,this.match=this.matchWithExec),o&&(this.handleModes=je),this.trackStartLines===!1&&(this.computeNewColumn=Xt),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=je),/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",()=>{let a=We(this.canModeBeOptimized,(c,u,l)=>(u===!1&&c.push(l),c),[]);if(r.ensureOptimizations&&!Q(a))throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
87
87
  Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
88
- Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{ER()}),this.TRACE_INIT("toFastProperties",()=>{za(this)})})}tokenize(e,r=this.defaultMode){if(!Q(this.lexerDefinitionErrors)){let i=N(this.lexerDefinitionErrors,o=>o.message).join(`-----------------------
88
+ Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{wR()}),this.TRACE_INIT("toFastProperties",()=>{Ka(this)})})}tokenize(e,r=this.defaultMode){if(!Q(this.lexerDefinitionErrors)){let i=N(this.lexerDefinitionErrors,o=>o.message).join(`-----------------------
89
89
  `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
90
- `+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,o,s,a,c,u,l,d,f,p,v,T,k,R,g,h=e,_=h.length,w=0,J=0,Bt=this.hasCustom?0:Math.floor(e.length/10),Ye=new Array(Bt),ir=[],Ht=this.trackStartLines?1:void 0,I=this.trackStartLines?1:void 0,S=FR(this.emptyGroups),U=this.trackStartLines,M=this.config.lineTerminatorsPattern,ne=0,K=[],H=[],ct=[],F=[];Object.freeze(F);let b;function Te(){return K}function Eu(ht){let zt=Jr(ht),kn=H[zt];return kn===void 0?F:kn}let hh=ht=>{if(ct.length===1&&ht.tokenType.PUSH_MODE===void 0){let zt=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ht);ir.push({offset:ht.startOffset,line:ht.startLine,column:ht.startColumn,length:ht.image.length,message:zt})}else{ct.pop();let zt=Xr(ct);K=this.patternIdxToConfig[zt],H=this.charCodeToPatternIdxToConfig[zt],ne=K.length;let kn=this.canModeBeOptimized[zt]&&this.config.safeMode===!1;H&&kn?b=Eu:b=Te}};function pa(ht){ct.push(ht),H=this.charCodeToPatternIdxToConfig[ht],K=this.patternIdxToConfig[ht],ne=K.length,ne=K.length;let zt=this.canModeBeOptimized[ht]&&this.config.safeMode===!1;H&&zt?b=Eu:b=Te}pa.call(this,r);let Gt,Au=this.config.recoveryEnabled;for(;w<_;){c=null;let ht=h.charCodeAt(w),zt=b(ht),kn=zt.length;for(n=0;n<kn;n++){Gt=zt[n];let Ot=Gt.pattern;u=null;let kr=Gt.short;if(kr!==!1?ht===kr&&(c=Ot):Gt.isCustom===!0?(g=Ot.exec(h,w,Ye,S),g!==null?(c=g[0],g.payload!==void 0&&(u=g.payload)):c=null):(this.updateLastIndex(Ot,w),c=this.match(Ot,e,w)),c!==null){if(a=Gt.longerAlt,a!==void 0){let Tt=a.length;for(o=0;o<Tt;o++){let Sr=K[a[o]],cn=Sr.pattern;if(l=null,Sr.isCustom===!0?(g=cn.exec(h,w,Ye,S),g!==null?(s=g[0],g.payload!==void 0&&(l=g.payload)):s=null):(this.updateLastIndex(cn,w),s=this.match(cn,e,w)),s&&s.length>c.length){c=s,u=l,Gt=Sr;break}}}break}}if(c!==null){if(d=c.length,f=Gt.group,f!==void 0&&(p=Gt.tokenTypeIdx,v=this.createTokenInstance(c,w,p,Gt.tokenType,Ht,I,d),this.handlePayload(v,u),f===!1?J=this.addToken(Ye,J,v):S[f].push(v)),e=this.chopInput(e,d),w=w+d,I=this.computeNewColumn(I,d),U===!0&&Gt.canLineTerminator===!0){let Ot=0,kr,Tt;M.lastIndex=0;do kr=M.test(c),kr===!0&&(Tt=M.lastIndex-1,Ot++);while(kr===!0);Ot!==0&&(Ht=Ht+Ot,I=d-Tt,this.updateTokenEndLineColumnLocation(v,f,Tt,Ot,Ht,I,d))}this.handleModes(Gt,hh,pa,v)}else{let Ot=w,kr=Ht,Tt=I,Sr=Au===!1;for(;Sr===!1&&w<_;)for(e=this.chopInput(e,1),w++,i=0;i<ne;i++){let cn=K[i],Sn=cn.pattern,wu=cn.short;if(wu!==!1?h.charCodeAt(w)===wu&&(Sr=!0):cn.isCustom===!0?Sr=Sn.exec(h,w,Ye,S)!==null:(this.updateLastIndex(Sn,w),Sr=Sn.exec(e)!==null),Sr===!0)break}if(T=w-Ot,I=this.computeNewColumn(I,T),R=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(h,Ot,T,kr,Tt),ir.push({offset:Ot,line:kr,column:Tt,length:T,message:R}),Au===!1)break}}return this.hasCustom||(Ye.length=J),{tokens:Ye,groups:S,errors:ir}}handleModes(e,r,n,i){if(e.pop===!0){let o=e.push;r(i),o!==void 0&&n.call(this,o)}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,i,o,s,a){let c,u;r!==void 0&&(c=n===a-1,u=c?-1:0,i===1&&c===!0||(e.endLine=o+u,e.endColumn=s-1+-u))}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,n,i){return{image:e,startOffset:r,tokenTypeIdx:n,tokenType:i}}createStartOnlyToken(e,r,n,i,o,s){return{image:e,startOffset:r,startLine:o,startColumn:s,tokenTypeIdx:n,tokenType:i}}createFullToken(e,r,n,i,o,s,a){return{image:e,startOffset:r,endOffset:r+a-1,startLine:o,endLine:o,startColumn:s,endColumn:s+a-1,tokenTypeIdx:n,tokenType:i}}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){let n=e.exec(r);return n!==null?n[0]:null}};Me.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";Me.NA=/NOT_APPLICABLE/;function yn(t){return _p(t)?t.LABEL:t.name}function _p(t){return dt(t.LABEL)&&t.LABEL!==""}var dM="parent",KR="categories",VR="label",XR="group",YR="push_mode",JR="pop_mode",QR="longer_alt",ZR="line_breaks",e_="start_chars_hint";function Gn(t){return fM(t)}function fM(t){let e=t.pattern,r={};if(r.name=t.name,wt(e)||(r.PATTERN=e),$(t,dM))throw`The parent property is no longer supported.
91
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return $(t,KR)&&(r.CATEGORIES=t[KR]),gn([r]),$(t,VR)&&(r.LABEL=t[VR]),$(t,XR)&&(r.GROUP=t[XR]),$(t,JR)&&(r.POP_MODE=t[JR]),$(t,YR)&&(r.PUSH_MODE=t[YR]),$(t,QR)&&(r.LONGER_ALT=t[QR]),$(t,ZR)&&(r.LINE_BREAKS=t[ZR]),$(t,e_)&&(r.START_CHARS_HINT=t[e_]),r}var lr=Gn({name:"EOF",pattern:Me.NA});gn([lr]);function vn(t,e,r,n,i,o,s,a){return{image:e,startOffset:r,endOffset:n,startLine:i,endLine:o,startColumn:s,endColumn:a,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function Xa(t,e){return mn(t,e)}var xn={buildMismatchTokenMessage({expected:t,actual:e,previous:r,ruleName:n}){return`Expecting ${_p(t)?`--> ${yn(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:i}){let o="Expecting: ",a=`
90
+ `+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,o,s,a,c,u,l,d,f,p,v,T,S,R,g,h=e,_=h.length,w=0,J=0,Bt=this.hasCustom?0:Math.floor(e.length/10),Ye=new Array(Bt),ir=[],Ht=this.trackStartLines?1:void 0,I=this.trackStartLines?1:void 0,k=qR(this.emptyGroups),U=this.trackStartLines,M=this.config.lineTerminatorsPattern,ne=0,K=[],H=[],ct=[],F=[];Object.freeze(F);let b;function Te(){return K}function Eu(ht){let zt=Jr(ht),Sn=H[zt];return Sn===void 0?F:Sn}let mh=ht=>{if(ct.length===1&&ht.tokenType.PUSH_MODE===void 0){let zt=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ht);ir.push({offset:ht.startOffset,line:ht.startLine,column:ht.startColumn,length:ht.image.length,message:zt})}else{ct.pop();let zt=Xr(ct);K=this.patternIdxToConfig[zt],H=this.charCodeToPatternIdxToConfig[zt],ne=K.length;let Sn=this.canModeBeOptimized[zt]&&this.config.safeMode===!1;H&&Sn?b=Eu:b=Te}};function ma(ht){ct.push(ht),H=this.charCodeToPatternIdxToConfig[ht],K=this.patternIdxToConfig[ht],ne=K.length,ne=K.length;let zt=this.canModeBeOptimized[ht]&&this.config.safeMode===!1;H&&zt?b=Eu:b=Te}ma.call(this,r);let Gt,Au=this.config.recoveryEnabled;for(;w<_;){c=null;let ht=h.charCodeAt(w),zt=b(ht),Sn=zt.length;for(n=0;n<Sn;n++){Gt=zt[n];let Ot=Gt.pattern;u=null;let Sr=Gt.short;if(Sr!==!1?ht===Sr&&(c=Ot):Gt.isCustom===!0?(g=Ot.exec(h,w,Ye,k),g!==null?(c=g[0],g.payload!==void 0&&(u=g.payload)):c=null):(this.updateLastIndex(Ot,w),c=this.match(Ot,e,w)),c!==null){if(a=Gt.longerAlt,a!==void 0){let Tt=a.length;for(o=0;o<Tt;o++){let kr=K[a[o]],cn=kr.pattern;if(l=null,kr.isCustom===!0?(g=cn.exec(h,w,Ye,k),g!==null?(s=g[0],g.payload!==void 0&&(l=g.payload)):s=null):(this.updateLastIndex(cn,w),s=this.match(cn,e,w)),s&&s.length>c.length){c=s,u=l,Gt=kr;break}}}break}}if(c!==null){if(d=c.length,f=Gt.group,f!==void 0&&(p=Gt.tokenTypeIdx,v=this.createTokenInstance(c,w,p,Gt.tokenType,Ht,I,d),this.handlePayload(v,u),f===!1?J=this.addToken(Ye,J,v):k[f].push(v)),e=this.chopInput(e,d),w=w+d,I=this.computeNewColumn(I,d),U===!0&&Gt.canLineTerminator===!0){let Ot=0,Sr,Tt;M.lastIndex=0;do Sr=M.test(c),Sr===!0&&(Tt=M.lastIndex-1,Ot++);while(Sr===!0);Ot!==0&&(Ht=Ht+Ot,I=d-Tt,this.updateTokenEndLineColumnLocation(v,f,Tt,Ot,Ht,I,d))}this.handleModes(Gt,mh,ma,v)}else{let Ot=w,Sr=Ht,Tt=I,kr=Au===!1;for(;kr===!1&&w<_;)for(e=this.chopInput(e,1),w++,i=0;i<ne;i++){let cn=K[i],kn=cn.pattern,wu=cn.short;if(wu!==!1?h.charCodeAt(w)===wu&&(kr=!0):cn.isCustom===!0?kr=kn.exec(h,w,Ye,k)!==null:(this.updateLastIndex(kn,w),kr=kn.exec(e)!==null),kr===!0)break}if(T=w-Ot,I=this.computeNewColumn(I,T),R=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(h,Ot,T,Sr,Tt),ir.push({offset:Ot,line:Sr,column:Tt,length:T,message:R}),Au===!1)break}}return this.hasCustom||(Ye.length=J),{tokens:Ye,groups:k,errors:ir}}handleModes(e,r,n,i){if(e.pop===!0){let o=e.push;r(i),o!==void 0&&n.call(this,o)}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,i,o,s,a){let c,u;r!==void 0&&(c=n===a-1,u=c?-1:0,i===1&&c===!0||(e.endLine=o+u,e.endColumn=s-1+-u))}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,n,i){return{image:e,startOffset:r,tokenTypeIdx:n,tokenType:i}}createStartOnlyToken(e,r,n,i,o,s){return{image:e,startOffset:r,startLine:o,startColumn:s,tokenTypeIdx:n,tokenType:i}}createFullToken(e,r,n,i,o,s,a){return{image:e,startOffset:r,endOffset:r+a-1,startLine:o,endLine:o,startColumn:s,endColumn:s+a-1,tokenTypeIdx:n,tokenType:i}}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){let n=e.exec(r);return n!==null?n[0]:null}};Me.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";Me.NA=/NOT_APPLICABLE/;function yn(t){return Cp(t)?t.LABEL:t.name}function Cp(t){return dt(t.LABEL)&&t.LABEL!==""}var hM="parent",XR="categories",YR="label",JR="group",QR="push_mode",ZR="pop_mode",e_="longer_alt",t_="line_breaks",r_="start_chars_hint";function Gn(t){return pM(t)}function pM(t){let e=t.pattern,r={};if(r.name=t.name,wt(e)||(r.PATTERN=e),$(t,hM))throw`The parent property is no longer supported.
91
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return $(t,XR)&&(r.CATEGORIES=t[XR]),gn([r]),$(t,YR)&&(r.LABEL=t[YR]),$(t,JR)&&(r.GROUP=t[JR]),$(t,ZR)&&(r.POP_MODE=t[ZR]),$(t,QR)&&(r.PUSH_MODE=t[QR]),$(t,e_)&&(r.LONGER_ALT=t[e_]),$(t,t_)&&(r.LINE_BREAKS=t[t_]),$(t,r_)&&(r.START_CHARS_HINT=t[r_]),r}var lr=Gn({name:"EOF",pattern:Me.NA});gn([lr]);function vn(t,e,r,n,i,o,s,a){return{image:e,startOffset:r,endOffset:n,startLine:i,endLine:o,startColumn:s,endColumn:a,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function Ya(t,e){return mn(t,e)}var xn={buildMismatchTokenMessage({expected:t,actual:e,previous:r,ruleName:n}){return`Expecting ${Cp(t)?`--> ${yn(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:i}){let o="Expecting: ",a=`
92
92
  but found: '`+gt(e).image+"'";if(n)return o+n+a;{let c=We(t,(f,p)=>f.concat(p),[]),u=N(c,f=>`[${N(f,p=>yn(p)).join(", ")}]`),d=`one of these possible Token sequences:
93
93
  ${N(u,(f,p)=>` ${p+1}. ${f}`).join(`
94
94
  `)}`;return o+d+a}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:r,ruleName:n}){let i="Expecting: ",s=`
95
95
  but found: '`+gt(e).image+"'";if(r)return i+r+s;{let c=`expecting at least one iteration which starts with one of these possible Token sequences::
96
- <${N(t,u=>`[${N(u,l=>yn(l)).join(",")}]`).join(" ,")}>`;return i+c+s}}};Object.freeze(xn);var t_={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
96
+ <${N(t,u=>`[${N(u,l=>yn(l)).join(",")}]`).join(" ,")}>`;return i+c+s}}};Object.freeze(xn);var n_={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
97
97
  inside top level rule: ->`+t.name+"<-"}},Nr={buildDuplicateFoundError(t,e){function r(l){return l instanceof ee?l.terminalType.name:l instanceof fe?l.nonTerminalName:""}let n=t.name,i=gt(e),o=i.idx,s=Zt(i),a=r(i),c=o>0,u=`->${s}${c?o:""}<- ${a?`with argument: ->${a}<-`:""}
98
98
  appears more than once (${e.length} times) in the top level rule: ->${n}<-.
99
99
  For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
@@ -118,44 +118,44 @@ rule: <${e}> can be invoked from itself (directly or indirectly)
118
118
  without consuming any Tokens. The grammar path that causes this is:
119
119
  ${n}
120
120
  To fix this refactor your grammar to remove the left recursion.
121
- see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof qt?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function r_(t,e){let r=new bp(t,e);return r.resolveRefs(),r.errors}var bp=class extends Ut{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){O(me(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:ft.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var Cp=class extends pn{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=be(this.path.ruleStack).reverse(),this.occurrenceStack=be(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){let i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){Q(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},wl=class extends Cp{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){let i=r.concat(n),o=new Ce({definition:i});this.possibleTokTypes=Si(o),this.found=!0}}},_s=class extends pn{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}},Nl=class extends _s{walkMany(e,r,n){if(e.idx===this.occurrence){let i=gt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}},Ya=class extends _s{walkManySep(e,r,n){if(e.idx===this.occurrence){let i=gt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}},Pl=class extends _s{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let i=gt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}},Ja=class extends _s{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let i=gt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}};function Dl(t,e,r=[]){r=be(r);let n=[],i=0;function o(a){return a.concat(et(t,i+1))}function s(a){let c=Dl(o(a),e,r);return n.concat(c)}for(;r.length<e&&i<t.length;){let a=t[i];if(a instanceof Ce)return s(a.definition);if(a instanceof fe)return s(a.definition);if(a instanceof he)n=s(a.definition);else if(a instanceof ke){let c=a.definition.concat([new ie({definition:a.definition})]);return s(c)}else if(a instanceof Se){let c=[new Ce({definition:a.definition}),new ie({definition:[new ee({terminalType:a.separator})].concat(a.definition)})];return s(c)}else if(a instanceof ye){let c=a.definition.concat([new ie({definition:[new ee({terminalType:a.separator})].concat(a.definition)})]);n=s(c)}else if(a instanceof ie){let c=a.definition.concat([new ie({definition:a.definition})]);n=s(c)}else{if(a instanceof ve)return O(a.definition,c=>{Q(c.definition)===!1&&(n=s(c.definition))}),n;if(a instanceof ee)r.push(a.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:et(t,i)}),n}function Il(t,e,r,n){let i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE",a=!1,c=e.length,u=c-n-1,l=[],d=[];for(d.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!Q(d);){let f=d.pop();if(f===s){a&&Xr(d).idx<=u&&d.pop();continue}let p=f.def,v=f.idx,T=f.ruleStack,k=f.occurrenceStack;if(Q(p))continue;let R=p[0];if(R===i){let g={idx:v,def:et(p),ruleStack:hn(T),occurrenceStack:hn(k)};d.push(g)}else if(R instanceof ee)if(v<c-1){let g=v+1,h=e[g];if(r(h,R.terminalType)){let _={idx:g,def:et(p),ruleStack:T,occurrenceStack:k};d.push(_)}}else if(v===c-1)l.push({nextTokenType:R.terminalType,nextTokenOccurrence:R.idx,ruleStack:T,occurrenceStack:k}),a=!0;else throw Error("non exhaustive match");else if(R instanceof fe){let g=be(T);g.push(R.nonTerminalName);let h=be(k);h.push(R.idx);let _={idx:v,def:R.definition.concat(o,et(p)),ruleStack:g,occurrenceStack:h};d.push(_)}else if(R instanceof he){let g={idx:v,def:et(p),ruleStack:T,occurrenceStack:k};d.push(g),d.push(s);let h={idx:v,def:R.definition.concat(et(p)),ruleStack:T,occurrenceStack:k};d.push(h)}else if(R instanceof ke){let g=new ie({definition:R.definition,idx:R.idx}),h=R.definition.concat([g],et(p)),_={idx:v,def:h,ruleStack:T,occurrenceStack:k};d.push(_)}else if(R instanceof Se){let g=new ee({terminalType:R.separator}),h=new ie({definition:[g].concat(R.definition),idx:R.idx}),_=R.definition.concat([h],et(p)),w={idx:v,def:_,ruleStack:T,occurrenceStack:k};d.push(w)}else if(R instanceof ye){let g={idx:v,def:et(p),ruleStack:T,occurrenceStack:k};d.push(g),d.push(s);let h=new ee({terminalType:R.separator}),_=new ie({definition:[h].concat(R.definition),idx:R.idx}),w=R.definition.concat([_],et(p)),J={idx:v,def:w,ruleStack:T,occurrenceStack:k};d.push(J)}else if(R instanceof ie){let g={idx:v,def:et(p),ruleStack:T,occurrenceStack:k};d.push(g),d.push(s);let h=new ie({definition:R.definition,idx:R.idx}),_=R.definition.concat([h],et(p)),w={idx:v,def:_,ruleStack:T,occurrenceStack:k};d.push(w)}else if(R instanceof ve)for(let g=R.definition.length-1;g>=0;g--){let h=R.definition[g],_={idx:v,def:h.definition.concat(et(p)),ruleStack:T,occurrenceStack:k};d.push(_),d.push(s)}else if(R instanceof Ce)d.push({idx:v,def:R.definition.concat(et(p)),ruleStack:T,occurrenceStack:k});else if(R instanceof qt)d.push(hM(R,v,T,k));else throw Error("non exhaustive match")}return l}function hM(t,e,r,n){let i=be(r);i.push(t.name);let o=be(n);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var Fe;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(Fe||(Fe={}));function Qa(t){if(t instanceof he||t==="Option")return Fe.OPTION;if(t instanceof ie||t==="Repetition")return Fe.REPETITION;if(t instanceof ke||t==="RepetitionMandatory")return Fe.REPETITION_MANDATORY;if(t instanceof Se||t==="RepetitionMandatoryWithSeparator")return Fe.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof ye||t==="RepetitionWithSeparator")return Fe.REPETITION_WITH_SEPARATOR;if(t instanceof ve||t==="Alternation")return Fe.ALTERNATION;throw Error("non exhaustive match")}function Ll(t){let{occurrence:e,rule:r,prodType:n,maxLookahead:i}=t,o=Qa(n);return o===Fe.ALTERNATION?bs(e,r,i):Cs(e,r,o,i)}function i_(t,e,r,n,i,o){let s=bs(t,e,r),a=l_(s)?Ts:mn;return o(s,n,a,i)}function o_(t,e,r,n,i,o){let s=Cs(t,e,i,r),a=l_(s)?Ts:mn;return o(s[0],a,n)}function s_(t,e,r,n){let i=t.length,o=At(t,s=>At(s,a=>a.length===1));if(e)return function(s){let a=N(s,c=>c.GATE);for(let c=0;c<i;c++){let u=t[c],l=u.length,d=a[c];if(!(d!==void 0&&d.call(this)===!1))e:for(let f=0;f<l;f++){let p=u[f],v=p.length;for(let T=0;T<v;T++){let k=this.LA(T+1);if(r(k,p[T])===!1)continue e}return c}}};if(o&&!n){let s=N(t,c=>Ze(c)),a=We(s,(c,u,l)=>(O(u,d=>{$(c,d.tokenTypeIdx)||(c[d.tokenTypeIdx]=l),O(d.categoryMatches,f=>{$(c,f)||(c[f]=l)})}),c),{});return function(){let c=this.LA(1);return a[c.tokenTypeIdx]}}else return function(){for(let s=0;s<i;s++){let a=t[s],c=a.length;e:for(let u=0;u<c;u++){let l=a[u],d=l.length;for(let f=0;f<d;f++){let p=this.LA(f+1);if(r(p,l[f])===!1)continue e}return s}}}}function a_(t,e,r){let n=At(t,o=>o.length===1),i=t.length;if(n&&!r){let o=Ze(t);if(o.length===1&&Q(o[0].categoryMatches)){let a=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{let s=We(o,(a,c,u)=>(a[c.tokenTypeIdx]=!0,O(c.categoryMatches,l=>{a[l]=!0}),a),[]);return function(){let a=this.LA(1);return s[a.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let s=t[o],a=s.length;for(let c=0;c<a;c++){let u=this.LA(c+1);if(e(u,s[c])===!1)continue e}return!0}return!1}}var Sp=class extends pn{constructor(e,r,n){super(),this.topProd=e,this.targetOccurrence=r,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===r?(this.restDef=n.concat(i),!0):!1}walkOption(e,r,n){this.checkIsTarget(e,Fe.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,Fe.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,Fe.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,Fe.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,Fe.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},Ol=class extends Ut{constructor(e,r,n){super(),this.targetOccurrence=e,this.targetProdType=r,this.targetRef=n,this.result=[]}checkIsTarget(e,r){e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Fe.OPTION)}visitRepetition(e){this.checkIsTarget(e,Fe.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Fe.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Fe.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Fe.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Fe.ALTERNATION)}};function n_(t){let e=new Array(t);for(let r=0;r<t;r++)e[r]=[];return e}function kp(t){let e=[""];for(let r=0;r<t.length;r++){let n=t[r],i=[];for(let o=0;o<e.length;o++){let s=e[o];i.push(s+"_"+n.tokenTypeIdx);for(let a=0;a<n.categoryMatches.length;a++){let c="_"+n.categoryMatches[a];i.push(s+c)}}e=i}return e}function pM(t,e,r){for(let n=0;n<t.length;n++){if(n===r)continue;let i=t[n];for(let o=0;o<e.length;o++){let s=e[o];if(i[s]===!0)return!1}}return!0}function c_(t,e){let r=N(t,s=>Dl([s],1)),n=n_(r.length),i=N(r,s=>{let a={};return O(s,c=>{let u=kp(c.partialPath);O(u,l=>{a[l]=!0})}),a}),o=r;for(let s=1;s<=e;s++){let a=o;o=n_(a.length);for(let c=0;c<a.length;c++){let u=a[c];for(let l=0;l<u.length;l++){let d=u[l].partialPath,f=u[l].suffixDef,p=kp(d);if(pM(i,p,c)||Q(f)||d.length===e){let T=n[c];if(Ml(T,d)===!1){T.push(d);for(let k=0;k<p.length;k++){let R=p[k];i[c][R]=!0}}}else{let T=Dl(f,s+1,d);o[c]=o[c].concat(T),O(T,k=>{let R=kp(k.partialPath);O(R,g=>{i[c][g]=!0})})}}}}return n}function bs(t,e,r,n){let i=new Ol(t,Fe.ALTERNATION,n);return e.accept(i),c_(i.result,r)}function Cs(t,e,r,n){let i=new Ol(t,r);e.accept(i);let o=i.result,a=new Sp(e,t,r).startWalking(),c=new Ce({definition:o}),u=new Ce({definition:a});return c_([c,u],n)}function Ml(t,e){e:for(let r=0;r<t.length;r++){let n=t[r];if(n.length===e.length){for(let i=0;i<n.length;i++){let o=e[i],s=n[i];if((o===s||s.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function u_(t,e){return t.length<e.length&&At(t,(r,n)=>{let i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function l_(t){return At(t,e=>At(e,r=>At(r,n=>Q(n.categoryMatches))))}function d_(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return N(e,r=>Object.assign({type:ft.CUSTOM_LOOKAHEAD_VALIDATION},r))}function f_(t,e,r,n){let i=bt(t,c=>mM(c,r)),o=RM(t,e,r),s=bt(t,c=>vM(c,r)),a=bt(t,c=>yM(c,t,n,r));return i.concat(o,s,a)}function mM(t,e){let r=new Ep;t.accept(r);let n=r.allProductions,i=fp(n,gM),o=Qt(i,a=>a.length>1);return N(me(o),a=>{let c=gt(a),u=e.buildDuplicateFoundError(t,a),l=Zt(c),d={message:u,type:ft.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:c.idx},f=h_(c);return f&&(d.parameter=f),d})}function gM(t){return`${Zt(t)}_#_${t.idx}_#_${h_(t)}`}function h_(t){return t instanceof ee?t.terminalType.name:t instanceof fe?t.nonTerminalName:""}var Ep=class extends Ut{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function yM(t,e,r,n){let i=[];if(We(e,(s,a)=>a.name===t.name?s+1:s,0)>1){let s=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});i.push({message:s,type:ft.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function p_(t,e,r){let n=[],i;return Oe(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:ft.INVALID_RULE_OVERRIDE,ruleName:t})),n}function wp(t,e,r,n=[]){let i=[],o=Fl(e.definition);if(Q(o))return[];{let s=t.name;Oe(o,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:ft.LEFT_RECURSION,ruleName:s});let c=Bn(o,n.concat([t])),u=bt(c,l=>{let d=be(n);return d.push(l),wp(t,l,r,d)});return i.concat(u)}}function Fl(t){let e=[];if(Q(t))return e;let r=gt(t);if(r instanceof fe)e.push(r.referencedRule);else if(r instanceof Ce||r instanceof he||r instanceof ke||r instanceof Se||r instanceof ye||r instanceof ie)e=e.concat(Fl(r.definition));else if(r instanceof ve)e=Ze(N(r.definition,o=>Fl(o.definition)));else if(!(r instanceof ee))throw Error("non exhaustive match");let n=ki(r),i=t.length>1;if(n&&i){let o=et(t);return e.concat(Fl(o))}else return e}var Za=class extends Ut{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function m_(t,e){let r=new Za;t.accept(r);let n=r.alternations;return bt(n,o=>{let s=hn(o.definition);return bt(s,(a,c)=>{let u=Il([a],[],mn,1);return Q(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:o,emptyChoiceIdx:c}),type:ft.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:o.idx,alternative:c+1}]:[]})})}function g_(t,e,r){let n=new Za;t.accept(n);let i=n.alternations;return i=Hn(i,s=>s.ignoreAmbiguities===!0),bt(i,s=>{let a=s.idx,c=s.maxLookahead||e,u=bs(a,t,c,s),l=xM(u,s,t,r),d=TM(u,s,t,r);return l.concat(d)})}var Ap=class extends Ut{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function vM(t,e){let r=new Za;t.accept(r);let n=r.alternations;return bt(n,o=>o.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:o}),type:ft.TOO_MANY_ALTS,ruleName:t.name,occurrence:o.idx}]:[])}function y_(t,e,r){let n=[];return O(t,i=>{let o=new Ap;i.accept(o);let s=o.allProductions;O(s,a=>{let c=Qa(a),u=a.maxLookahead||e,l=a.idx,f=Cs(l,i,c,u)[0];if(Q(Ze(f))){let p=r.buildEmptyRepetitionError({topLevelRule:i,repetition:a});n.push({message:p,type:ft.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function xM(t,e,r,n){let i=[],o=We(t,(a,c,u)=>(e.definition[u].ignoreAmbiguities===!0||O(c,l=>{let d=[u];O(t,(f,p)=>{u!==p&&Ml(f,l)&&e.definition[p].ignoreAmbiguities!==!0&&d.push(p)}),d.length>1&&!Ml(i,l)&&(i.push(l),a.push({alts:d,path:l}))}),a),[]);return N(o,a=>{let c=N(a.alts,l=>l+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:ft.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:a.alts}})}function TM(t,e,r,n){let i=We(t,(s,a,c)=>{let u=N(a,l=>({idx:c,path:l}));return s.concat(u)},[]);return Vr(bt(i,s=>{if(e.definition[s.idx].ignoreAmbiguities===!0)return[];let c=s.idx,u=s.path,l=mt(i,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<c&&u_(f.path,u));return N(l,f=>{let p=[f.idx+1,c+1],v=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:p,prefixPath:f.path}),type:ft.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:v,alternatives:p}})}))}function RM(t,e,r){let n=[],i=N(e,o=>o.name);return O(t,o=>{let s=o.name;if(Oe(i,s)){let a=r.buildNamespaceConflictError(o);n.push({message:a,type:ft.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),n}function v_(t){let e=hs(t,{errMsgProvider:t_}),r={};return O(t.rules,n=>{r[n.name]=n}),r_(r,e.errMsgProvider)}function x_(t){return t=hs(t,{errMsgProvider:Nr}),f_(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var T_="MismatchedTokenException",R_="NoViableAltException",__="EarlyExitException",b_="NotAllInputParsedException",C_=[T_,R_,__,b_];Object.freeze(C_);function zn(t){return Oe(C_,t.name)}var ks=class extends Error{constructor(e,r){super(e),this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},Ai=class extends ks{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=T_}},ec=class extends ks{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=R_}},tc=class extends ks{constructor(e,r){super(e,r),this.name=b_}},rc=class extends ks{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=__}};var Np={},Dp="InRuleRecoveryException",Pp=class extends Error{constructor(e){super(e),this.name=Dp}},$l=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=$(e,"recoveryEnabled")?e.recoveryEnabled:jt.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=_M)}getTokenToInsert(e){let r=vn(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,n,i){let o=this.findReSyncTokenType(),s=this.exportLexerState(),a=[],c=!1,u=this.LA(1),l=this.LA(1),d=()=>{let f=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:f,ruleName:this.getCurrRuleFullName()}),v=new Ai(p,u,this.LA(0));v.resyncedTokens=hn(a),this.SAVE_ERROR(v)};for(;!c;)if(this.tokenMatcher(l,i)){d();return}else if(n.call(this)){d(),e.apply(this,r);return}else this.tokenMatcher(l,o)?c=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,a));this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,r,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))}getFollowsForInRuleRecovery(e,r){let n=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Pp("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||Q(r))return!1;let n=this.LA(1);return Yr(r,o=>this.tokenMatcher(n,o))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(r);return Oe(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let i=Yr(e,o=>Xa(r,o));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Np;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return N(e,(n,i)=>i===0?Np:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=N(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return Ze(e)}getFollowSetFromFollowKey(e){if(e===Np)return[lr];let r=e.ruleName+e.idxInCallingRule+bl+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,lr)||r.push(e),r}reSyncTo(e){let r=[],n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,r);return hn(r)}attemptInRepetitionRecovery(e,r,n,i,o,s,a){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),i=be(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return N(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function _M(t,e,r,n,i,o,s){let a=this.getKeyForAutomaticLookahead(n,i),c=this.firstAfterRepMap[a];if(c===void 0){let f=this.getCurrRuleFullName(),p=this.getGAstProductions()[f];c=new o(p,i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence,d=c.isEndOfRule;this.RULE_STACK.length===1&&d&&u===void 0&&(u=lr,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(t,e,r,u)}function ql(t,e,r){return r|e|t}var Tn=class{constructor(e){var r;this.maxLookahead=(r=e?.maxLookahead)!==null&&r!==void 0?r:jt.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(Q(r)){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...n,...i,...o]}return r}validateNoLeftRecursion(e){return bt(e,r=>wp(r,r,Nr))}validateEmptyOrAlternatives(e){return bt(e,r=>m_(r,Nr))}validateAmbiguousAlternationAlternatives(e,r){return bt(e,n=>g_(n,r,Nr))}validateSomeNonEmptyLookaheadPath(e,r){return y_(e,r,Nr)}buildLookaheadForAlternation(e){return i_(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,s_)}buildLookaheadForOptional(e){return o_(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Qa(e.prodType),a_)}};var jl=class{initLooksAhead(e){this.dynamicTokensEnabled=$(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:jt.dynamicTokensEnabled,this.maxLookahead=$(e,"maxLookahead")?e.maxLookahead:jt.maxLookahead,this.lookaheadStrategy=$(e,"lookaheadStrategy")?e.lookaheadStrategy:new Tn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){O(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:o,repetitionMandatory:s,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=bM(r);O(n,u=>{let l=u.idx===0?"":u.idx;this.TRACE_INIT(`${Zt(u)}${l}`,()=>{let d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:r,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=ql(this.fullRuleNameToShort[r.name],256,u.idx);this.setLaFuncCache(f,d)})}),O(i,u=>{this.computeLookaheadFunc(r,u.idx,768,"Repetition",u.maxLookahead,Zt(u))}),O(o,u=>{this.computeLookaheadFunc(r,u.idx,512,"Option",u.maxLookahead,Zt(u))}),O(s,u=>{this.computeLookaheadFunc(r,u.idx,1024,"RepetitionMandatory",u.maxLookahead,Zt(u))}),O(a,u=>{this.computeLookaheadFunc(r,u.idx,1536,"RepetitionMandatoryWithSeparator",u.maxLookahead,Zt(u))}),O(c,u=>{this.computeLookaheadFunc(r,u.idx,1280,"RepetitionWithSeparator",u.maxLookahead,Zt(u))})})})}computeLookaheadFunc(e,r,n,i,o,s){this.TRACE_INIT(`${s}${r===0?"":r}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:o||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),c=ql(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(c,a)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return ql(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},Ip=class extends Ut{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},Ul=new Ip;function bM(t){Ul.reset(),t.accept(Ul);let e=Ul.dslMethods;return Ul.reset(),e}function Mp(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function Fp(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function k_(t,e,r){t.children[r]===void 0?t.children[r]=[e]:t.children[r].push(e)}function S_(t,e,r){t.children[e]===void 0?t.children[e]=[r]:t.children[e].push(r)}var CM="name";function $p(t,e){Object.defineProperty(t,CM,{enumerable:!1,configurable:!0,writable:!1,value:e})}function kM(t,e){let r=Re(t),n=r.length;for(let i=0;i<n;i++){let o=r[i],s=t[o],a=s.length;for(let c=0;c<a;c++){let u=s[c];u.tokenTypeIdx===void 0&&this[u.name](u.children,e)}}}function E_(t,e){let r=function(){};$p(r,t+"BaseSemantics");let n={visit:function(i,o){if(q(i)&&(i=i[0]),!wt(i))return this[i.name](i.children,o)},validateVisitor:function(){let i=SM(this,e);if(!Q(i)){let o=N(i,s=>s.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
121
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof qt?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function i_(t,e){let r=new Sp(t,e);return r.resolveRefs(),r.errors}var Sp=class extends Ut{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){O(me(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:ft.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var kp=class extends pn{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=be(this.path.ruleStack).reverse(),this.occurrenceStack=be(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){let i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){Q(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},wl=class extends kp{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){let i=r.concat(n),o=new Ce({definition:i});this.possibleTokTypes=ki(o),this.found=!0}}},bs=class extends pn{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}},Nl=class extends bs{walkMany(e,r,n){if(e.idx===this.occurrence){let i=gt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}},Ja=class extends bs{walkManySep(e,r,n){if(e.idx===this.occurrence){let i=gt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}},Pl=class extends bs{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let i=gt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}},Qa=class extends bs{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let i=gt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}};function Dl(t,e,r=[]){r=be(r);let n=[],i=0;function o(a){return a.concat(et(t,i+1))}function s(a){let c=Dl(o(a),e,r);return n.concat(c)}for(;r.length<e&&i<t.length;){let a=t[i];if(a instanceof Ce)return s(a.definition);if(a instanceof fe)return s(a.definition);if(a instanceof he)n=s(a.definition);else if(a instanceof Se){let c=a.definition.concat([new ie({definition:a.definition})]);return s(c)}else if(a instanceof ke){let c=[new Ce({definition:a.definition}),new ie({definition:[new ee({terminalType:a.separator})].concat(a.definition)})];return s(c)}else if(a instanceof ye){let c=a.definition.concat([new ie({definition:[new ee({terminalType:a.separator})].concat(a.definition)})]);n=s(c)}else if(a instanceof ie){let c=a.definition.concat([new ie({definition:a.definition})]);n=s(c)}else{if(a instanceof ve)return O(a.definition,c=>{Q(c.definition)===!1&&(n=s(c.definition))}),n;if(a instanceof ee)r.push(a.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:et(t,i)}),n}function Il(t,e,r,n){let i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE",a=!1,c=e.length,u=c-n-1,l=[],d=[];for(d.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!Q(d);){let f=d.pop();if(f===s){a&&Xr(d).idx<=u&&d.pop();continue}let p=f.def,v=f.idx,T=f.ruleStack,S=f.occurrenceStack;if(Q(p))continue;let R=p[0];if(R===i){let g={idx:v,def:et(p),ruleStack:hn(T),occurrenceStack:hn(S)};d.push(g)}else if(R instanceof ee)if(v<c-1){let g=v+1,h=e[g];if(r(h,R.terminalType)){let _={idx:g,def:et(p),ruleStack:T,occurrenceStack:S};d.push(_)}}else if(v===c-1)l.push({nextTokenType:R.terminalType,nextTokenOccurrence:R.idx,ruleStack:T,occurrenceStack:S}),a=!0;else throw Error("non exhaustive match");else if(R instanceof fe){let g=be(T);g.push(R.nonTerminalName);let h=be(S);h.push(R.idx);let _={idx:v,def:R.definition.concat(o,et(p)),ruleStack:g,occurrenceStack:h};d.push(_)}else if(R instanceof he){let g={idx:v,def:et(p),ruleStack:T,occurrenceStack:S};d.push(g),d.push(s);let h={idx:v,def:R.definition.concat(et(p)),ruleStack:T,occurrenceStack:S};d.push(h)}else if(R instanceof Se){let g=new ie({definition:R.definition,idx:R.idx}),h=R.definition.concat([g],et(p)),_={idx:v,def:h,ruleStack:T,occurrenceStack:S};d.push(_)}else if(R instanceof ke){let g=new ee({terminalType:R.separator}),h=new ie({definition:[g].concat(R.definition),idx:R.idx}),_=R.definition.concat([h],et(p)),w={idx:v,def:_,ruleStack:T,occurrenceStack:S};d.push(w)}else if(R instanceof ye){let g={idx:v,def:et(p),ruleStack:T,occurrenceStack:S};d.push(g),d.push(s);let h=new ee({terminalType:R.separator}),_=new ie({definition:[h].concat(R.definition),idx:R.idx}),w=R.definition.concat([_],et(p)),J={idx:v,def:w,ruleStack:T,occurrenceStack:S};d.push(J)}else if(R instanceof ie){let g={idx:v,def:et(p),ruleStack:T,occurrenceStack:S};d.push(g),d.push(s);let h=new ie({definition:R.definition,idx:R.idx}),_=R.definition.concat([h],et(p)),w={idx:v,def:_,ruleStack:T,occurrenceStack:S};d.push(w)}else if(R instanceof ve)for(let g=R.definition.length-1;g>=0;g--){let h=R.definition[g],_={idx:v,def:h.definition.concat(et(p)),ruleStack:T,occurrenceStack:S};d.push(_),d.push(s)}else if(R instanceof Ce)d.push({idx:v,def:R.definition.concat(et(p)),ruleStack:T,occurrenceStack:S});else if(R instanceof qt)d.push(mM(R,v,T,S));else throw Error("non exhaustive match")}return l}function mM(t,e,r,n){let i=be(r);i.push(t.name);let o=be(n);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var Fe;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(Fe||(Fe={}));function Za(t){if(t instanceof he||t==="Option")return Fe.OPTION;if(t instanceof ie||t==="Repetition")return Fe.REPETITION;if(t instanceof Se||t==="RepetitionMandatory")return Fe.REPETITION_MANDATORY;if(t instanceof ke||t==="RepetitionMandatoryWithSeparator")return Fe.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof ye||t==="RepetitionWithSeparator")return Fe.REPETITION_WITH_SEPARATOR;if(t instanceof ve||t==="Alternation")return Fe.ALTERNATION;throw Error("non exhaustive match")}function Ll(t){let{occurrence:e,rule:r,prodType:n,maxLookahead:i}=t,o=Za(n);return o===Fe.ALTERNATION?Cs(e,r,i):Ss(e,r,o,i)}function s_(t,e,r,n,i,o){let s=Cs(t,e,r),a=f_(s)?Rs:mn;return o(s,n,a,i)}function a_(t,e,r,n,i,o){let s=Ss(t,e,i,r),a=f_(s)?Rs:mn;return o(s[0],a,n)}function c_(t,e,r,n){let i=t.length,o=At(t,s=>At(s,a=>a.length===1));if(e)return function(s){let a=N(s,c=>c.GATE);for(let c=0;c<i;c++){let u=t[c],l=u.length,d=a[c];if(!(d!==void 0&&d.call(this)===!1))e:for(let f=0;f<l;f++){let p=u[f],v=p.length;for(let T=0;T<v;T++){let S=this.LA(T+1);if(r(S,p[T])===!1)continue e}return c}}};if(o&&!n){let s=N(t,c=>Ze(c)),a=We(s,(c,u,l)=>(O(u,d=>{$(c,d.tokenTypeIdx)||(c[d.tokenTypeIdx]=l),O(d.categoryMatches,f=>{$(c,f)||(c[f]=l)})}),c),{});return function(){let c=this.LA(1);return a[c.tokenTypeIdx]}}else return function(){for(let s=0;s<i;s++){let a=t[s],c=a.length;e:for(let u=0;u<c;u++){let l=a[u],d=l.length;for(let f=0;f<d;f++){let p=this.LA(f+1);if(r(p,l[f])===!1)continue e}return s}}}}function u_(t,e,r){let n=At(t,o=>o.length===1),i=t.length;if(n&&!r){let o=Ze(t);if(o.length===1&&Q(o[0].categoryMatches)){let a=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{let s=We(o,(a,c,u)=>(a[c.tokenTypeIdx]=!0,O(c.categoryMatches,l=>{a[l]=!0}),a),[]);return function(){let a=this.LA(1);return s[a.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let s=t[o],a=s.length;for(let c=0;c<a;c++){let u=this.LA(c+1);if(e(u,s[c])===!1)continue e}return!0}return!1}}var Ap=class extends pn{constructor(e,r,n){super(),this.topProd=e,this.targetOccurrence=r,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===r?(this.restDef=n.concat(i),!0):!1}walkOption(e,r,n){this.checkIsTarget(e,Fe.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,Fe.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,Fe.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,Fe.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,Fe.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},Ol=class extends Ut{constructor(e,r,n){super(),this.targetOccurrence=e,this.targetProdType=r,this.targetRef=n,this.result=[]}checkIsTarget(e,r){e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Fe.OPTION)}visitRepetition(e){this.checkIsTarget(e,Fe.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Fe.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Fe.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Fe.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Fe.ALTERNATION)}};function o_(t){let e=new Array(t);for(let r=0;r<t;r++)e[r]=[];return e}function Ep(t){let e=[""];for(let r=0;r<t.length;r++){let n=t[r],i=[];for(let o=0;o<e.length;o++){let s=e[o];i.push(s+"_"+n.tokenTypeIdx);for(let a=0;a<n.categoryMatches.length;a++){let c="_"+n.categoryMatches[a];i.push(s+c)}}e=i}return e}function gM(t,e,r){for(let n=0;n<t.length;n++){if(n===r)continue;let i=t[n];for(let o=0;o<e.length;o++){let s=e[o];if(i[s]===!0)return!1}}return!0}function l_(t,e){let r=N(t,s=>Dl([s],1)),n=o_(r.length),i=N(r,s=>{let a={};return O(s,c=>{let u=Ep(c.partialPath);O(u,l=>{a[l]=!0})}),a}),o=r;for(let s=1;s<=e;s++){let a=o;o=o_(a.length);for(let c=0;c<a.length;c++){let u=a[c];for(let l=0;l<u.length;l++){let d=u[l].partialPath,f=u[l].suffixDef,p=Ep(d);if(gM(i,p,c)||Q(f)||d.length===e){let T=n[c];if(Ml(T,d)===!1){T.push(d);for(let S=0;S<p.length;S++){let R=p[S];i[c][R]=!0}}}else{let T=Dl(f,s+1,d);o[c]=o[c].concat(T),O(T,S=>{let R=Ep(S.partialPath);O(R,g=>{i[c][g]=!0})})}}}}return n}function Cs(t,e,r,n){let i=new Ol(t,Fe.ALTERNATION,n);return e.accept(i),l_(i.result,r)}function Ss(t,e,r,n){let i=new Ol(t,r);e.accept(i);let o=i.result,a=new Ap(e,t,r).startWalking(),c=new Ce({definition:o}),u=new Ce({definition:a});return l_([c,u],n)}function Ml(t,e){e:for(let r=0;r<t.length;r++){let n=t[r];if(n.length===e.length){for(let i=0;i<n.length;i++){let o=e[i],s=n[i];if((o===s||s.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function d_(t,e){return t.length<e.length&&At(t,(r,n)=>{let i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function f_(t){return At(t,e=>At(e,r=>At(r,n=>Q(n.categoryMatches))))}function h_(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return N(e,r=>Object.assign({type:ft.CUSTOM_LOOKAHEAD_VALIDATION},r))}function p_(t,e,r,n){let i=bt(t,c=>yM(c,r)),o=bM(t,e,r),s=bt(t,c=>TM(c,r)),a=bt(t,c=>xM(c,t,n,r));return i.concat(o,s,a)}function yM(t,e){let r=new wp;t.accept(r);let n=r.allProductions,i=pp(n,vM),o=Qt(i,a=>a.length>1);return N(me(o),a=>{let c=gt(a),u=e.buildDuplicateFoundError(t,a),l=Zt(c),d={message:u,type:ft.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:c.idx},f=m_(c);return f&&(d.parameter=f),d})}function vM(t){return`${Zt(t)}_#_${t.idx}_#_${m_(t)}`}function m_(t){return t instanceof ee?t.terminalType.name:t instanceof fe?t.nonTerminalName:""}var wp=class extends Ut{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function xM(t,e,r,n){let i=[];if(We(e,(s,a)=>a.name===t.name?s+1:s,0)>1){let s=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});i.push({message:s,type:ft.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function g_(t,e,r){let n=[],i;return Oe(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:ft.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Pp(t,e,r,n=[]){let i=[],o=Fl(e.definition);if(Q(o))return[];{let s=t.name;Oe(o,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:ft.LEFT_RECURSION,ruleName:s});let c=Bn(o,n.concat([t])),u=bt(c,l=>{let d=be(n);return d.push(l),Pp(t,l,r,d)});return i.concat(u)}}function Fl(t){let e=[];if(Q(t))return e;let r=gt(t);if(r instanceof fe)e.push(r.referencedRule);else if(r instanceof Ce||r instanceof he||r instanceof Se||r instanceof ke||r instanceof ye||r instanceof ie)e=e.concat(Fl(r.definition));else if(r instanceof ve)e=Ze(N(r.definition,o=>Fl(o.definition)));else if(!(r instanceof ee))throw Error("non exhaustive match");let n=Si(r),i=t.length>1;if(n&&i){let o=et(t);return e.concat(Fl(o))}else return e}var ec=class extends Ut{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function y_(t,e){let r=new ec;t.accept(r);let n=r.alternations;return bt(n,o=>{let s=hn(o.definition);return bt(s,(a,c)=>{let u=Il([a],[],mn,1);return Q(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:o,emptyChoiceIdx:c}),type:ft.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:o.idx,alternative:c+1}]:[]})})}function v_(t,e,r){let n=new ec;t.accept(n);let i=n.alternations;return i=Hn(i,s=>s.ignoreAmbiguities===!0),bt(i,s=>{let a=s.idx,c=s.maxLookahead||e,u=Cs(a,t,c,s),l=RM(u,s,t,r),d=_M(u,s,t,r);return l.concat(d)})}var Np=class extends Ut{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function TM(t,e){let r=new ec;t.accept(r);let n=r.alternations;return bt(n,o=>o.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:o}),type:ft.TOO_MANY_ALTS,ruleName:t.name,occurrence:o.idx}]:[])}function x_(t,e,r){let n=[];return O(t,i=>{let o=new Np;i.accept(o);let s=o.allProductions;O(s,a=>{let c=Za(a),u=a.maxLookahead||e,l=a.idx,f=Ss(l,i,c,u)[0];if(Q(Ze(f))){let p=r.buildEmptyRepetitionError({topLevelRule:i,repetition:a});n.push({message:p,type:ft.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function RM(t,e,r,n){let i=[],o=We(t,(a,c,u)=>(e.definition[u].ignoreAmbiguities===!0||O(c,l=>{let d=[u];O(t,(f,p)=>{u!==p&&Ml(f,l)&&e.definition[p].ignoreAmbiguities!==!0&&d.push(p)}),d.length>1&&!Ml(i,l)&&(i.push(l),a.push({alts:d,path:l}))}),a),[]);return N(o,a=>{let c=N(a.alts,l=>l+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:ft.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:a.alts}})}function _M(t,e,r,n){let i=We(t,(s,a,c)=>{let u=N(a,l=>({idx:c,path:l}));return s.concat(u)},[]);return Vr(bt(i,s=>{if(e.definition[s.idx].ignoreAmbiguities===!0)return[];let c=s.idx,u=s.path,l=mt(i,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<c&&d_(f.path,u));return N(l,f=>{let p=[f.idx+1,c+1],v=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:p,prefixPath:f.path}),type:ft.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:v,alternatives:p}})}))}function bM(t,e,r){let n=[],i=N(e,o=>o.name);return O(t,o=>{let s=o.name;if(Oe(i,s)){let a=r.buildNamespaceConflictError(o);n.push({message:a,type:ft.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),n}function T_(t){let e=ps(t,{errMsgProvider:n_}),r={};return O(t.rules,n=>{r[n.name]=n}),i_(r,e.errMsgProvider)}function R_(t){return t=ps(t,{errMsgProvider:Nr}),p_(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var __="MismatchedTokenException",b_="NoViableAltException",C_="EarlyExitException",S_="NotAllInputParsedException",k_=[__,b_,C_,S_];Object.freeze(k_);function zn(t){return Oe(k_,t.name)}var ks=class extends Error{constructor(e,r){super(e),this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},Ai=class extends ks{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=__}},tc=class extends ks{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=b_}},rc=class extends ks{constructor(e,r){super(e,r),this.name=S_}},nc=class extends ks{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=C_}};var Dp={},Op="InRuleRecoveryException",Ip=class extends Error{constructor(e){super(e),this.name=Op}},$l=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=$(e,"recoveryEnabled")?e.recoveryEnabled:jt.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=CM)}getTokenToInsert(e){let r=vn(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,n,i){let o=this.findReSyncTokenType(),s=this.exportLexerState(),a=[],c=!1,u=this.LA(1),l=this.LA(1),d=()=>{let f=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:f,ruleName:this.getCurrRuleFullName()}),v=new Ai(p,u,this.LA(0));v.resyncedTokens=hn(a),this.SAVE_ERROR(v)};for(;!c;)if(this.tokenMatcher(l,i)){d();return}else if(n.call(this)){d(),e.apply(this,r);return}else this.tokenMatcher(l,o)?c=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,a));this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,r,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))}getFollowsForInRuleRecovery(e,r){let n=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Ip("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||Q(r))return!1;let n=this.LA(1);return Yr(r,o=>this.tokenMatcher(n,o))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(r);return Oe(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let i=Yr(e,o=>Ya(r,o));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Dp;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return N(e,(n,i)=>i===0?Dp:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=N(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return Ze(e)}getFollowSetFromFollowKey(e){if(e===Dp)return[lr];let r=e.ruleName+e.idxInCallingRule+bl+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,lr)||r.push(e),r}reSyncTo(e){let r=[],n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,r);return hn(r)}attemptInRepetitionRecovery(e,r,n,i,o,s,a){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),i=be(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return N(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function CM(t,e,r,n,i,o,s){let a=this.getKeyForAutomaticLookahead(n,i),c=this.firstAfterRepMap[a];if(c===void 0){let f=this.getCurrRuleFullName(),p=this.getGAstProductions()[f];c=new o(p,i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence,d=c.isEndOfRule;this.RULE_STACK.length===1&&d&&u===void 0&&(u=lr,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(t,e,r,u)}function ql(t,e,r){return r|e|t}var Tn=class{constructor(e){var r;this.maxLookahead=(r=e?.maxLookahead)!==null&&r!==void 0?r:jt.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(Q(r)){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...n,...i,...o]}return r}validateNoLeftRecursion(e){return bt(e,r=>Pp(r,r,Nr))}validateEmptyOrAlternatives(e){return bt(e,r=>y_(r,Nr))}validateAmbiguousAlternationAlternatives(e,r){return bt(e,n=>v_(n,r,Nr))}validateSomeNonEmptyLookaheadPath(e,r){return x_(e,r,Nr)}buildLookaheadForAlternation(e){return s_(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,c_)}buildLookaheadForOptional(e){return a_(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Za(e.prodType),u_)}};var jl=class{initLooksAhead(e){this.dynamicTokensEnabled=$(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:jt.dynamicTokensEnabled,this.maxLookahead=$(e,"maxLookahead")?e.maxLookahead:jt.maxLookahead,this.lookaheadStrategy=$(e,"lookaheadStrategy")?e.lookaheadStrategy:new Tn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){O(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:o,repetitionMandatory:s,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=SM(r);O(n,u=>{let l=u.idx===0?"":u.idx;this.TRACE_INIT(`${Zt(u)}${l}`,()=>{let d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:r,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=ql(this.fullRuleNameToShort[r.name],256,u.idx);this.setLaFuncCache(f,d)})}),O(i,u=>{this.computeLookaheadFunc(r,u.idx,768,"Repetition",u.maxLookahead,Zt(u))}),O(o,u=>{this.computeLookaheadFunc(r,u.idx,512,"Option",u.maxLookahead,Zt(u))}),O(s,u=>{this.computeLookaheadFunc(r,u.idx,1024,"RepetitionMandatory",u.maxLookahead,Zt(u))}),O(a,u=>{this.computeLookaheadFunc(r,u.idx,1536,"RepetitionMandatoryWithSeparator",u.maxLookahead,Zt(u))}),O(c,u=>{this.computeLookaheadFunc(r,u.idx,1280,"RepetitionWithSeparator",u.maxLookahead,Zt(u))})})})}computeLookaheadFunc(e,r,n,i,o,s){this.TRACE_INIT(`${s}${r===0?"":r}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:o||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),c=ql(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(c,a)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return ql(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},Lp=class extends Ut{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},Ul=new Lp;function SM(t){Ul.reset(),t.accept(Ul);let e=Ul.dslMethods;return Ul.reset(),e}function $p(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function qp(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function E_(t,e,r){t.children[r]===void 0?t.children[r]=[e]:t.children[r].push(e)}function A_(t,e,r){t.children[e]===void 0?t.children[e]=[r]:t.children[e].push(r)}var kM="name";function Up(t,e){Object.defineProperty(t,kM,{enumerable:!1,configurable:!0,writable:!1,value:e})}function EM(t,e){let r=Re(t),n=r.length;for(let i=0;i<n;i++){let o=r[i],s=t[o],a=s.length;for(let c=0;c<a;c++){let u=s[c];u.tokenTypeIdx===void 0&&this[u.name](u.children,e)}}}function w_(t,e){let r=function(){};Up(r,t+"BaseSemantics");let n={visit:function(i,o){if(q(i)&&(i=i[0]),!wt(i))return this[i.name](i.children,o)},validateVisitor:function(){let i=AM(this,e);if(!Q(i)){let o=N(i,s=>s.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
122
122
  ${o.join(`
123
123
 
124
124
  `).replace(/\n/g,`
125
- `)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function A_(t,e,r){let n=function(){};$p(n,t+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return O(e,o=>{i[o]=kM}),n.prototype=i,n.prototype.constructor=n,n}var qp;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(qp||(qp={}));function SM(t,e){return EM(t,e)}function EM(t,e){let r=mt(e,i=>$t(t[i])===!1),n=N(r,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:qp.MISSING_METHOD,methodName:i}));return Vr(n)}var Gl=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=$(e,"nodeLocationTracking")?e.nodeLocationTracking:jt.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=je,this.cstFinallyStateUpdate=je,this.cstPostTerminal=je,this.cstPostNonTerminal=je,this.cstPostRule=je;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Fp,this.setNodeLocationFromNode=Fp,this.cstPostRule=je,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=je,this.setNodeLocationFromNode=je,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Mp,this.setNodeLocationFromNode=Mp,this.cstPostRule=je,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=je,this.setNodeLocationFromNode=je,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=je,this.setNodeLocationFromNode=je,this.cstPostRule=je,this.setInitialNodeLocation=je;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){let r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let 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){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];k_(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];S_(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(wt(this.baseCstVisitorConstructor)){let e=E_(this.className,Re(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(wt(this.baseCstVisitorWithDefaultsConstructor)){let e=A_(this.className,Re(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}};var zl=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Ss}LA(e){let r=this.currIdx+e;return r<0||this.tokVectorLength<=r?Ss:this.tokVector[r]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}};var Kl=class{ACTION(e){return e.call(this)}consume(e,r,n){return this.consumeInternal(r,e,n)}subrule(e,r,n){return this.subruleInternal(r,e,n)}option(e,r){return this.optionInternal(r,e)}or(e,r){return this.orInternal(r,e)}many(e,r){return this.manyInternal(e,r)}atLeastOne(e,r){return this.atLeastOneInternal(e,r)}CONSUME(e,r){return this.consumeInternal(e,0,r)}CONSUME1(e,r){return this.consumeInternal(e,1,r)}CONSUME2(e,r){return this.consumeInternal(e,2,r)}CONSUME3(e,r){return this.consumeInternal(e,3,r)}CONSUME4(e,r){return this.consumeInternal(e,4,r)}CONSUME5(e,r){return this.consumeInternal(e,5,r)}CONSUME6(e,r){return this.consumeInternal(e,6,r)}CONSUME7(e,r){return this.consumeInternal(e,7,r)}CONSUME8(e,r){return this.consumeInternal(e,8,r)}CONSUME9(e,r){return this.consumeInternal(e,9,r)}SUBRULE(e,r){return this.subruleInternal(e,0,r)}SUBRULE1(e,r){return this.subruleInternal(e,1,r)}SUBRULE2(e,r){return this.subruleInternal(e,2,r)}SUBRULE3(e,r){return this.subruleInternal(e,3,r)}SUBRULE4(e,r){return this.subruleInternal(e,4,r)}SUBRULE5(e,r){return this.subruleInternal(e,5,r)}SUBRULE6(e,r){return this.subruleInternal(e,6,r)}SUBRULE7(e,r){return this.subruleInternal(e,7,r)}SUBRULE8(e,r){return this.subruleInternal(e,8,r)}SUBRULE9(e,r){return this.subruleInternal(e,9,r)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,r,n=Es){if(Oe(this.definedRulesNames,e)){let s={message:Nr.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:ft.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);let i=this.defineRule(e,r,n);return this[e]=i,i}OVERRIDE_RULE(e,r,n=Es){let i=p_(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let o=this.defineRule(e,r,n);return this[e]=o,o}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);let n=this.saveRecogState();try{return e.apply(this,r),!0}catch(i){if(zn(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return _l(me(this.gastProductionsCache))}};var Vl=class{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Ts,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},$(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
125
+ `)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function N_(t,e,r){let n=function(){};Up(n,t+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return O(e,o=>{i[o]=EM}),n.prototype=i,n.prototype.constructor=n,n}var jp;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(jp||(jp={}));function AM(t,e){return wM(t,e)}function wM(t,e){let r=mt(e,i=>$t(t[i])===!1),n=N(r,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:jp.MISSING_METHOD,methodName:i}));return Vr(n)}var Gl=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=$(e,"nodeLocationTracking")?e.nodeLocationTracking:jt.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=je,this.cstFinallyStateUpdate=je,this.cstPostTerminal=je,this.cstPostNonTerminal=je,this.cstPostRule=je;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=qp,this.setNodeLocationFromNode=qp,this.cstPostRule=je,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=je,this.setNodeLocationFromNode=je,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=$p,this.setNodeLocationFromNode=$p,this.cstPostRule=je,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=je,this.setNodeLocationFromNode=je,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=je,this.setNodeLocationFromNode=je,this.cstPostRule=je,this.setInitialNodeLocation=je;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){let r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let 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){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];E_(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];A_(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(wt(this.baseCstVisitorConstructor)){let e=w_(this.className,Re(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(wt(this.baseCstVisitorWithDefaultsConstructor)){let e=N_(this.className,Re(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}};var zl=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Es}LA(e){let r=this.currIdx+e;return r<0||this.tokVectorLength<=r?Es:this.tokVector[r]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}};var Kl=class{ACTION(e){return e.call(this)}consume(e,r,n){return this.consumeInternal(r,e,n)}subrule(e,r,n){return this.subruleInternal(r,e,n)}option(e,r){return this.optionInternal(r,e)}or(e,r){return this.orInternal(r,e)}many(e,r){return this.manyInternal(e,r)}atLeastOne(e,r){return this.atLeastOneInternal(e,r)}CONSUME(e,r){return this.consumeInternal(e,0,r)}CONSUME1(e,r){return this.consumeInternal(e,1,r)}CONSUME2(e,r){return this.consumeInternal(e,2,r)}CONSUME3(e,r){return this.consumeInternal(e,3,r)}CONSUME4(e,r){return this.consumeInternal(e,4,r)}CONSUME5(e,r){return this.consumeInternal(e,5,r)}CONSUME6(e,r){return this.consumeInternal(e,6,r)}CONSUME7(e,r){return this.consumeInternal(e,7,r)}CONSUME8(e,r){return this.consumeInternal(e,8,r)}CONSUME9(e,r){return this.consumeInternal(e,9,r)}SUBRULE(e,r){return this.subruleInternal(e,0,r)}SUBRULE1(e,r){return this.subruleInternal(e,1,r)}SUBRULE2(e,r){return this.subruleInternal(e,2,r)}SUBRULE3(e,r){return this.subruleInternal(e,3,r)}SUBRULE4(e,r){return this.subruleInternal(e,4,r)}SUBRULE5(e,r){return this.subruleInternal(e,5,r)}SUBRULE6(e,r){return this.subruleInternal(e,6,r)}SUBRULE7(e,r){return this.subruleInternal(e,7,r)}SUBRULE8(e,r){return this.subruleInternal(e,8,r)}SUBRULE9(e,r){return this.subruleInternal(e,9,r)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,r,n=As){if(Oe(this.definedRulesNames,e)){let s={message:Nr.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:ft.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);let i=this.defineRule(e,r,n);return this[e]=i,i}OVERRIDE_RULE(e,r,n=As){let i=g_(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let o=this.defineRule(e,r,n);return this[e]=o,o}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);let n=this.saveRecogState();try{return e.apply(this,r),!0}catch(i){if(zn(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return _l(me(this.gastProductionsCache))}};var Vl=class{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Rs,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},$(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
126
126
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
127
127
  For Further details.`);if(q(e)){if(Q(e))throw Error(`A Token Vocabulary cannot be empty.
128
128
  Note that the first argument for the parser constructor
129
129
  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.
130
130
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
131
- For Further details.`)}if(q(e))this.tokensMap=We(e,(o,s)=>(o[s.name]=s,o),{});else if($(e,"modes")&&At(Ze(me(e.modes)),zR)){let o=Ze(me(e.modes)),s=ps(o);this.tokensMap=We(s,(a,c)=>(a[c.name]=c,a),{})}else if(Ue(e))this.tokensMap=be(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=lr;let n=$(e,"modes")?Ze(me(e.modes)):me(e),i=At(n,o=>Q(o.categoryMatches));this.tokenMatcher=i?Ts:mn,gn(me(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'
132
- Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=$(n,"resyncEnabled")?n.resyncEnabled:Es.resyncEnabled,o=$(n,"recoveryValueFunc")?n.recoveryValueFunc:Es.recoveryValueFunc,s=this.ruleShortNameIdx<<12;this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s;let a;return this.outputCst===!0?a=function(...l){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,l);let d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,i,o)}finally{this.ruleFinallyStateUpdate()}}:a=function(...l){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,l)}catch(d){return this.invokeRuleCatch(d,i,o)}finally{this.ruleFinallyStateUpdate()}},Object.assign(a,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,n){let i=this.RULE_STACK.length===1,o=r&&!this.isBackTracking()&&this.recoveryEnabled;if(zn(e)){let s=e;if(o){let a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(s.resyncedTokens=this.reSyncTo(a),this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return n(e);else{if(this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,s.partialCstResult=c}throw s}}else{if(i)return this.moveToTerminatedState(),n(e);throw s}}else throw e}optionInternal(e,r){let n=this.getKeyForAutomaticLookahead(512,r);return this.optionInternalLogic(e,r,n)}optionInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),o;if(typeof e!="function"){o=e.DEF;let s=e.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=e;if(i.call(this)===!0)return o.call(this)}atLeastOneInternal(e,r){let n=this.getKeyForAutomaticLookahead(1024,e);return this.atLeastOneInternalLogic(e,r,n)}atLeastOneInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),o;if(typeof r!="function"){o=r.DEF;let s=r.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=r;if(i.call(this)===!0){let s=this.doSingleRepetition(o);for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o)}else throw this.raiseEarlyExitException(e,Fe.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],i,1024,e,Pl)}atLeastOneSepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,r,n)}atLeastOneSepFirstInternalLogic(e,r,n){let i=r.DEF,o=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA(1),o);for(;this.tokenMatcher(this.LA(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,o,a,i,Ja],a,1536,e,Ja)}else throw this.raiseEarlyExitException(e,Fe.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){let n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,r,n)}manyInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),o;if(typeof r!="function"){o=r.DEF;let a=r.GATE;if(a!==void 0){let c=i;i=()=>a.call(this)&&c.call(this)}}else o=r;let s=!0;for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],i,768,e,Nl,s)}manySepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,r,n)}manySepFirstInternalLogic(e,r,n){let i=r.DEF,o=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA(1),o);for(;this.tokenMatcher(this.LA(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,o,a,i,Ya],a,1280,e,Ya)}}repetitionSepSecondInternal(e,r,n,i,o){for(;n();)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,n,i,o],n,1536,e,o)}doSingleRepetition(e){let r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){let n=this.getKeyForAutomaticLookahead(256,r),i=q(e)?e:e.DEF,s=this.getLaFuncFromCache(n).call(this,i);if(s!==void 0)return i[s].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new tc(r,e))}}subruleInternal(e,r,n){let i;try{let o=n!==void 0?n.ARGS:void 0;return this.subruleIdx=r,i=e.apply(this,o),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(o){throw this.subruleInternalError(o,n,e.ruleName)}}subruleInternalError(e,r,n){throw zn(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,r!==void 0&&r.LABEL!==void 0?r.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,r,n){let i;try{let o=this.LA(1);this.tokenMatcher(o,e)===!0?(this.consumeToken(),i=o):this.consumeInternalError(e,o,n)}catch(o){i=this.consumeInternalRecovery(e,r,o)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i}consumeInternalError(e,r,n){let i,o=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:r,previous:o,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Ai(i,r,o))}consumeInternalRecovery(e,r,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,r);try{return this.tryInRuleRecovery(e,i)}catch(o){throw o.name===Dp?n:o}}else throw n}saveRecogState(){let e=this.errors,r=be(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:r,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,r,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(r)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),lr)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}};var Xl=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=$(e,"errorMessageProvider")?e.errorMessageProvider:jt.errorMessageProvider}SAVE_ERROR(e){if(zn(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:be(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return be(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,n){let i=this.getCurrRuleFullName(),o=this.getGAstProductions()[i],a=Cs(e,o,r,this.maxLookahead)[0],c=[];for(let l=1;l<=this.maxLookahead;l++)c.push(this.LA(l));let u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:c,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new rc(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],o=bs(e,i,this.maxLookahead),s=[];for(let u=1;u<=this.maxLookahead;u++)s.push(this.LA(u));let a=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:o,actual:s,previous:a,customUserDescription:r,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new ec(c,this.LA(1),a))}};var Yl=class{initContentAssist(){}computeContentAssist(e,r){let n=this.gastProductionsCache[e];if(wt(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Il([n],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=gt(e.ruleStack),i=this.getGAstProductions()[r];return new wl(i,e).startWalking()}};var Zl={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Zl);var w_=!0,N_=Math.pow(2,8)-1,D_=Gn({name:"RECORDING_PHASE_TOKEN",pattern:Me.NA});gn([D_]);var I_=vn(D_,`This IToken indicates the Parser is in Recording Phase
133
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(I_);var wM={name:`This CSTNode indicates the Parser is in Recording Phase
134
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Jl=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++){let r=e>0?e:"";this[`CONSUME${r}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${r}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},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",()=>{let e=this;for(let r=0;r<10;r++){let 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 Ss}topLevelRuleRecord(e,r){try{let n=new qt({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+`
131
+ For Further details.`)}if(q(e))this.tokensMap=We(e,(o,s)=>(o[s.name]=s,o),{});else if($(e,"modes")&&At(Ze(me(e.modes)),VR)){let o=Ze(me(e.modes)),s=ms(o);this.tokensMap=We(s,(a,c)=>(a[c.name]=c,a),{})}else if(Ue(e))this.tokensMap=be(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=lr;let n=$(e,"modes")?Ze(me(e.modes)):me(e),i=At(n,o=>Q(o.categoryMatches));this.tokenMatcher=i?Rs:mn,gn(me(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'
132
+ Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=$(n,"resyncEnabled")?n.resyncEnabled:As.resyncEnabled,o=$(n,"recoveryValueFunc")?n.recoveryValueFunc:As.recoveryValueFunc,s=this.ruleShortNameIdx<<12;this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s;let a;return this.outputCst===!0?a=function(...l){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,l);let d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,i,o)}finally{this.ruleFinallyStateUpdate()}}:a=function(...l){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,l)}catch(d){return this.invokeRuleCatch(d,i,o)}finally{this.ruleFinallyStateUpdate()}},Object.assign(a,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,n){let i=this.RULE_STACK.length===1,o=r&&!this.isBackTracking()&&this.recoveryEnabled;if(zn(e)){let s=e;if(o){let a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(s.resyncedTokens=this.reSyncTo(a),this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return n(e);else{if(this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,s.partialCstResult=c}throw s}}else{if(i)return this.moveToTerminatedState(),n(e);throw s}}else throw e}optionInternal(e,r){let n=this.getKeyForAutomaticLookahead(512,r);return this.optionInternalLogic(e,r,n)}optionInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),o;if(typeof e!="function"){o=e.DEF;let s=e.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=e;if(i.call(this)===!0)return o.call(this)}atLeastOneInternal(e,r){let n=this.getKeyForAutomaticLookahead(1024,e);return this.atLeastOneInternalLogic(e,r,n)}atLeastOneInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),o;if(typeof r!="function"){o=r.DEF;let s=r.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=r;if(i.call(this)===!0){let s=this.doSingleRepetition(o);for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o)}else throw this.raiseEarlyExitException(e,Fe.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],i,1024,e,Pl)}atLeastOneSepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,r,n)}atLeastOneSepFirstInternalLogic(e,r,n){let i=r.DEF,o=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA(1),o);for(;this.tokenMatcher(this.LA(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,o,a,i,Qa],a,1536,e,Qa)}else throw this.raiseEarlyExitException(e,Fe.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){let n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,r,n)}manyInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),o;if(typeof r!="function"){o=r.DEF;let a=r.GATE;if(a!==void 0){let c=i;i=()=>a.call(this)&&c.call(this)}}else o=r;let s=!0;for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],i,768,e,Nl,s)}manySepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,r,n)}manySepFirstInternalLogic(e,r,n){let i=r.DEF,o=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA(1),o);for(;this.tokenMatcher(this.LA(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,o,a,i,Ja],a,1280,e,Ja)}}repetitionSepSecondInternal(e,r,n,i,o){for(;n();)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,n,i,o],n,1536,e,o)}doSingleRepetition(e){let r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){let n=this.getKeyForAutomaticLookahead(256,r),i=q(e)?e:e.DEF,s=this.getLaFuncFromCache(n).call(this,i);if(s!==void 0)return i[s].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new rc(r,e))}}subruleInternal(e,r,n){let i;try{let o=n!==void 0?n.ARGS:void 0;return this.subruleIdx=r,i=e.apply(this,o),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(o){throw this.subruleInternalError(o,n,e.ruleName)}}subruleInternalError(e,r,n){throw zn(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,r!==void 0&&r.LABEL!==void 0?r.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,r,n){let i;try{let o=this.LA(1);this.tokenMatcher(o,e)===!0?(this.consumeToken(),i=o):this.consumeInternalError(e,o,n)}catch(o){i=this.consumeInternalRecovery(e,r,o)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i}consumeInternalError(e,r,n){let i,o=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:r,previous:o,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Ai(i,r,o))}consumeInternalRecovery(e,r,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,r);try{return this.tryInRuleRecovery(e,i)}catch(o){throw o.name===Op?n:o}}else throw n}saveRecogState(){let e=this.errors,r=be(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:r,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,r,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(r)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),lr)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}};var Xl=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=$(e,"errorMessageProvider")?e.errorMessageProvider:jt.errorMessageProvider}SAVE_ERROR(e){if(zn(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:be(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return be(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,n){let i=this.getCurrRuleFullName(),o=this.getGAstProductions()[i],a=Ss(e,o,r,this.maxLookahead)[0],c=[];for(let l=1;l<=this.maxLookahead;l++)c.push(this.LA(l));let u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:c,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new nc(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],o=Cs(e,i,this.maxLookahead),s=[];for(let u=1;u<=this.maxLookahead;u++)s.push(this.LA(u));let a=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:o,actual:s,previous:a,customUserDescription:r,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new tc(c,this.LA(1),a))}};var Yl=class{initContentAssist(){}computeContentAssist(e,r){let n=this.gastProductionsCache[e];if(wt(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Il([n],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=gt(e.ruleStack),i=this.getGAstProductions()[r];return new wl(i,e).startWalking()}};var Zl={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Zl);var P_=!0,D_=Math.pow(2,8)-1,O_=Gn({name:"RECORDING_PHASE_TOKEN",pattern:Me.NA});gn([O_]);var L_=vn(O_,`This IToken indicates the Parser is in Recording Phase
133
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(L_);var PM={name:`This CSTNode indicates the Parser is in Recording Phase
134
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Jl=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++){let r=e>0?e:"";this[`CONSUME${r}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${r}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},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",()=>{let e=this;for(let r=0;r<10;r++){let 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 Es}topLevelRuleRecord(e,r){try{let n=new qt({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+`
135
135
  This error was thrown during the "grammar recording phase" For more info see:
136
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return ic.call(this,he,e,r)}atLeastOneInternalRecord(e,r){ic.call(this,ke,r,e)}atLeastOneSepFirstInternalRecord(e,r){ic.call(this,Se,r,e,w_)}manyInternalRecord(e,r){ic.call(this,ie,r,e)}manySepFirstInternalRecord(e,r){ic.call(this,ye,r,e,w_)}orInternalRecord(e,r){return NM.call(this,e,r)}subruleInternalRecord(e,r,n){if(Ql(r),!e||$(e,"ruleName")===!1){let a=new Error(`<SUBRULE${P_(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
137
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=Xr(this.recordingProdStack),o=e.ruleName,s=new fe({idx:r,nonTerminalName:o,label:n?.LABEL,referencedRule:void 0});return i.definition.push(s),this.outputCst?wM:Zl}consumeInternalRecord(e,r,n){if(Ql(r),!Rp(e)){let s=new Error(`<CONSUME${P_(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
138
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=Xr(this.recordingProdStack),o=new ee({idx:r,terminalType:e,label:n?.LABEL});return i.definition.push(o),I_}};function ic(t,e,r,n=!1){Ql(r);let i=Xr(this.recordingProdStack),o=$t(e)?e:e.DEF,s=new t({definition:[],idx:r});return n&&(s.separator=e.SEP),$(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),Zl}function NM(t,e){Ql(e);let r=Xr(this.recordingProdStack),n=q(t)===!1,i=n===!1?t:t.DEF,o=new ve({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});$(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD);let s=Ba(i,a=>$t(a.GATE));return o.hasPredicates=s,r.definition.push(o),O(i,a=>{let c=new Ce({definition:[]});o.definition.push(c),$(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:$(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),Zl}function P_(t){return t===0?"":`${t}`}function Ql(t){if(t<0||t>N_){let e=new Error(`Invalid DSL Method idx value: <${t}>
139
- Idx value must be a none negative value smaller than ${N_+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var ed=class{initPerformanceTracer(e){if($(e,"traceInitPerf")){let 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=jt.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:i,value:o}=Ga(r),s=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,o}else return r()}};function O_(t,e){e.forEach(r=>{let n=r.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let o=Object.getOwnPropertyDescriptor(n,i);o&&(o.get||o.set)?Object.defineProperty(t.prototype,i,o):t.prototype[i]=r.prototype[i]})})}var Ss=vn(lr,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Ss);var jt=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:xn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Es=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),ft;(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"})(ft||(ft={}));function td(t=void 0){return function(){return t}}var oc=class t{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{za(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),O(this.definedRulesNames,i=>{let s=this[i].originalGrammarAction,a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=v_({rules:me(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(Q(n)&&this.skipValidations===!1){let i=x_({rules:me(this.gastProductionsCache),tokenTypes:me(this.tokensMap),errMsgProvider:Nr,grammarName:r}),o=d_({lookaheadStrategy:this.lookaheadStrategy,rules:me(this.gastProductionsCache),tokenTypes:me(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,o)}}),Q(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=SR(me(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,o;(o=(i=this.lookaheadStrategy).initialize)===null||o===void 0||o.call(i,{rules:me(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(me(this.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!Q(this.definitionErrors))throw e=N(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
136
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return oc.call(this,he,e,r)}atLeastOneInternalRecord(e,r){oc.call(this,Se,r,e)}atLeastOneSepFirstInternalRecord(e,r){oc.call(this,ke,r,e,P_)}manyInternalRecord(e,r){oc.call(this,ie,r,e)}manySepFirstInternalRecord(e,r){oc.call(this,ye,r,e,P_)}orInternalRecord(e,r){return DM.call(this,e,r)}subruleInternalRecord(e,r,n){if(Ql(r),!e||$(e,"ruleName")===!1){let a=new Error(`<SUBRULE${I_(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
137
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=Xr(this.recordingProdStack),o=e.ruleName,s=new fe({idx:r,nonTerminalName:o,label:n?.LABEL,referencedRule:void 0});return i.definition.push(s),this.outputCst?PM:Zl}consumeInternalRecord(e,r,n){if(Ql(r),!bp(e)){let s=new Error(`<CONSUME${I_(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
138
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=Xr(this.recordingProdStack),o=new ee({idx:r,terminalType:e,label:n?.LABEL});return i.definition.push(o),L_}};function oc(t,e,r,n=!1){Ql(r);let i=Xr(this.recordingProdStack),o=$t(e)?e:e.DEF,s=new t({definition:[],idx:r});return n&&(s.separator=e.SEP),$(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),Zl}function DM(t,e){Ql(e);let r=Xr(this.recordingProdStack),n=q(t)===!1,i=n===!1?t:t.DEF,o=new ve({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});$(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD);let s=Ha(i,a=>$t(a.GATE));return o.hasPredicates=s,r.definition.push(o),O(i,a=>{let c=new Ce({definition:[]});o.definition.push(c),$(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:$(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),Zl}function I_(t){return t===0?"":`${t}`}function Ql(t){if(t<0||t>D_){let e=new Error(`Invalid DSL Method idx value: <${t}>
139
+ Idx value must be a none negative value smaller than ${D_+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var ed=class{initPerformanceTracer(e){if($(e,"traceInitPerf")){let 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=jt.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:i,value:o}=za(r),s=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,o}else return r()}};function M_(t,e){e.forEach(r=>{let n=r.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let o=Object.getOwnPropertyDescriptor(n,i);o&&(o.get||o.set)?Object.defineProperty(t.prototype,i,o):t.prototype[i]=r.prototype[i]})})}var Es=vn(lr,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Es);var jt=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:xn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),As=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),ft;(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"})(ft||(ft={}));function td(t=void 0){return function(){return t}}var sc=class t{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{Ka(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),O(this.definedRulesNames,i=>{let s=this[i].originalGrammarAction,a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=T_({rules:me(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(Q(n)&&this.skipValidations===!1){let i=R_({rules:me(this.gastProductionsCache),tokenTypes:me(this.tokensMap),errMsgProvider:Nr,grammarName:r}),o=h_({lookaheadStrategy:this.lookaheadStrategy,rules:me(this.gastProductionsCache),tokenTypes:me(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,o)}}),Q(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=AR(me(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,o;(o=(i=this.lookaheadStrategy).initialize)===null||o===void 0||o.call(i,{rules:me(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(me(this.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!Q(this.definitionErrors))throw e=N(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
140
140
  ${e.join(`
141
141
  -------------------------------
142
142
  `)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let 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),$(r,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
143
143
  Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
144
144
  See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
145
- For further details.`);this.skipValidations=$(r,"skipValidations")?r.skipValidations:jt.skipValidations}};oc.DEFER_DEFINITION_ERRORS_HANDLING=!1;O_(oc,[$l,jl,Gl,zl,Vl,Kl,Xl,Yl,Jl,ed]);var sc=class extends oc{constructor(e,r=jt){let n=be(r);n.outputCst=!1,super(e,n)}};function wi(t,e,r){return`${t.name}_${e}_${r}`}var Kn=1,DM=2,L_=4,M_=5;var Ns=7,IM=8,OM=9,LM=10,MM=11,F_=12,ac=class{constructor(e){this.target=e}isEpsilon(){return!1}},As=class extends ac{constructor(e,r){super(e),this.tokenType=r}},cc=class extends ac{constructor(e){super(e)}isEpsilon(){return!0}},ws=class extends ac{constructor(e,r,n){super(e),this.rule=r,this.followState=n}isEpsilon(){return!0}};function $_(t){let e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};FM(e,t);let r=t.length;for(let n=0;n<r;n++){let i=t[n],o=Ni(e,i,i);o!==void 0&&VM(e,i,o)}return e}function FM(t,e){let r=e.length;for(let n=0;n<r;n++){let i=e[n],o=yt(t,i,void 0,{type:DM}),s=yt(t,i,void 0,{type:Ns});o.stop=s,t.ruleToStartState.set(i,o),t.ruleToStopState.set(i,s)}}function q_(t,e,r){return r instanceof ee?jp(t,e,r.terminalType,r):r instanceof fe?KM(t,e,r):r instanceof ve?WM(t,e,r):r instanceof he?BM(t,e,r):r instanceof ie?$M(t,e,r):r instanceof ye?qM(t,e,r):r instanceof ke?UM(t,e,r):r instanceof Se?jM(t,e,r):Ni(t,e,r)}function $M(t,e,r){let n=yt(t,e,r,{type:M_});Vn(t,n);let i=Ps(t,e,n,r,Ni(t,e,r));return j_(t,e,r,i)}function qM(t,e,r){let n=yt(t,e,r,{type:M_});Vn(t,n);let i=Ps(t,e,n,r,Ni(t,e,r)),o=jp(t,e,r.separator,r);return j_(t,e,r,i,o)}function UM(t,e,r){let n=yt(t,e,r,{type:L_});Vn(t,n);let i=Ps(t,e,n,r,Ni(t,e,r));return U_(t,e,r,i)}function jM(t,e,r){let n=yt(t,e,r,{type:L_});Vn(t,n);let i=Ps(t,e,n,r,Ni(t,e,r)),o=jp(t,e,r.separator,r);return U_(t,e,r,i,o)}function WM(t,e,r){let n=yt(t,e,r,{type:Kn});Vn(t,n);let i=N(r.definition,s=>q_(t,e,s));return Ps(t,e,n,r,...i)}function BM(t,e,r){let n=yt(t,e,r,{type:Kn});Vn(t,n);let i=Ps(t,e,n,r,Ni(t,e,r));return HM(t,e,r,i)}function Ni(t,e,r){let n=mt(N(r.definition,i=>q_(t,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:zM(t,n)}function U_(t,e,r,n,i){let o=n.left,s=n.right,a=yt(t,e,r,{type:MM});Vn(t,a);let c=yt(t,e,r,{type:F_});return o.loopback=a,c.loopback=a,t.decisionMap[wi(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=a,ot(s,a),i===void 0?(ot(a,o),ot(a,c)):(ot(a,c),ot(a,i.left),ot(i.right,o)),{left:o,right:c}}function j_(t,e,r,n,i){let o=n.left,s=n.right,a=yt(t,e,r,{type:LM});Vn(t,a);let c=yt(t,e,r,{type:F_}),u=yt(t,e,r,{type:OM});return a.loopback=u,c.loopback=u,ot(a,o),ot(a,c),ot(s,u),i!==void 0?(ot(u,c),ot(u,i.left),ot(i.right,o)):ot(u,a),t.decisionMap[wi(e,i?"RepetitionWithSeparator":"Repetition",r.idx)]=a,{left:a,right:c}}function HM(t,e,r,n){let i=n.left,o=n.right;return ot(i,o),t.decisionMap[wi(e,"Option",r.idx)]=i,n}function Vn(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function Ps(t,e,r,n,...i){let o=yt(t,e,n,{type:IM,start:r});r.end=o;for(let a of i)a!==void 0?(ot(r,a.left),ot(a.right,o)):ot(r,o);let s={left:r,right:o};return t.decisionMap[wi(e,GM(n),n.idx)]=r,s}function GM(t){if(t instanceof ve)return"Alternation";if(t instanceof he)return"Option";if(t instanceof ie)return"Repetition";if(t instanceof ye)return"RepetitionWithSeparator";if(t instanceof ke)return"RepetitionMandatory";if(t instanceof Se)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function zM(t,e){let r=e.length;for(let o=0;o<r-1;o++){let s=e[o],a;s.left.transitions.length===1&&(a=s.left.transitions[0]);let c=a instanceof ws,u=a,l=e[o+1].left;s.left.type===Kn&&s.right.type===Kn&&a!==void 0&&(c&&u.followState===s.right||a.target===s.right)?(c?u.followState=l:a.target=l,XM(t,s.right)):ot(s.right,l)}let n=e[0],i=e[r-1];return{left:n.left,right:i.right}}function jp(t,e,r,n){let i=yt(t,e,n,{type:Kn}),o=yt(t,e,n,{type:Kn});return Wp(i,new As(o,r)),{left:i,right:o}}function KM(t,e,r){let n=r.referencedRule,i=t.ruleToStartState.get(n),o=yt(t,e,r,{type:Kn}),s=yt(t,e,r,{type:Kn}),a=new ws(i,n,s);return Wp(o,a),{left:o,right:s}}function VM(t,e,r){let n=t.ruleToStartState.get(e);ot(n,r.left);let i=t.ruleToStopState.get(e);return ot(r.right,i),{left:n,right:i}}function ot(t,e){let r=new cc(e);Wp(t,r)}function yt(t,e,r,n){let i=Object.assign({atn:t,production:r,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:t.states.length},n);return t.states.push(i),i}function Wp(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function XM(t,e){t.states.splice(t.states.indexOf(e),1)}var uc={},Ds=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let r=Bp(e);r in this.map||(this.map[r]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return N(this.configs,e=>e.alt)}get key(){let e="";for(let r in this.map)e+=r+":";return e}};function Bp(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(r=>r.stateNumber.toString()).join("_")}`}function YM(t,e){let r={};return n=>{let i=n.toString(),o=r[i];return o!==void 0||(o={atnStartState:t,decision:e,states:{}},r[i]=o),o}}var rd=class{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,r){this.predicates[e]=r}toString(){let e="",r=this.predicates.length;for(let n=0;n<r;n++)e+=this.predicates[n]===!0?"1":"0";return e}},W_=new rd,lc=class extends Tn{constructor(e){var r;super(),this.logging=(r=e?.logging)!==null&&r!==void 0?r:(n=>console.log(n))}initialize(e){this.atn=$_(e.rules),this.dfas=JM(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){let{prodOccurrence:r,rule:n,hasPredicates:i,dynamicTokensEnabled:o}=e,s=this.dfas,a=this.logging,c=wi(n,"Alternation",r),l=this.atn.decisionMap[c].decision,d=N(Ll({maxLookahead:1,occurrence:r,prodType:"Alternation",rule:n}),f=>N(f,p=>p[0]));if(B_(d,!1)&&!o){let f=We(d,(p,v,T)=>(O(v,k=>{k&&(p[k.tokenTypeIdx]=T,O(k.categoryMatches,R=>{p[R]=T}))}),p),{});return i?function(p){var v;let T=this.LA(1),k=f[T.tokenTypeIdx];if(p!==void 0&&k!==void 0){let R=(v=p[k])===null||v===void 0?void 0:v.GATE;if(R!==void 0&&R.call(this)===!1)return}return k}:function(){let p=this.LA(1);return f[p.tokenTypeIdx]}}else return i?function(f){let p=new rd,v=f===void 0?0:f.length;for(let k=0;k<v;k++){let R=f?.[k].GATE;p.set(k,R===void 0||R.call(this))}let T=Hp.call(this,s,l,p,a);return typeof T=="number"?T:void 0}:function(){let f=Hp.call(this,s,l,W_,a);return typeof f=="number"?f:void 0}}buildLookaheadForOptional(e){let{prodOccurrence:r,rule:n,prodType:i,dynamicTokensEnabled:o}=e,s=this.dfas,a=this.logging,c=wi(n,i,r),l=this.atn.decisionMap[c].decision,d=N(Ll({maxLookahead:1,occurrence:r,prodType:i,rule:n}),f=>N(f,p=>p[0]));if(B_(d)&&d[0][0]&&!o){let f=d[0],p=Ze(f);if(p.length===1&&Q(p[0].categoryMatches)){let T=p[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===T}}else{let v=We(p,(T,k)=>(k!==void 0&&(T[k.tokenTypeIdx]=!0,O(k.categoryMatches,R=>{T[R]=!0})),T),{});return function(){let T=this.LA(1);return v[T.tokenTypeIdx]===!0}}}return function(){let f=Hp.call(this,s,l,W_,a);return typeof f=="object"?!1:f===0}}};function B_(t,e=!0){let r=new Set;for(let n of t){let i=new Set;for(let o of n){if(o===void 0){if(e)break;return!1}let s=[o.tokenTypeIdx].concat(o.categoryMatches);for(let a of s)if(r.has(a)){if(!i.has(a))return!1}else r.add(a),i.add(a)}}return!0}function JM(t){let e=t.decisionStates.length,r=Array(e);for(let n=0;n<e;n++)r[n]=YM(t.decisionStates[n],n);return r}function Hp(t,e,r,n){let i=t[e](r),o=i.start;if(o===void 0){let a=cF(i.atnStartState);o=z_(i,G_(a)),i.start=o}return QM.apply(this,[i,o,r,n])}function QM(t,e,r,n){let i=e,o=1,s=[],a=this.LA(o++);for(;;){let c=iF(i,a);if(c===void 0&&(c=ZM.apply(this,[t,i,a,o,r,n])),c===uc)return nF(s,i,a);if(c.isAcceptState===!0)return c.prediction;i=c,s.push(a),a=this.LA(o++)}}function ZM(t,e,r,n,i,o){let s=oF(e.configs,r,i);if(s.size===0)return H_(t,e,r,uc),uc;let a=G_(s),c=aF(s,i);if(c!==void 0)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;else if(fF(s)){let u=yR(s.alts);a.isAcceptState=!0,a.prediction=u,a.configs.uniqueAlt=u,eF.apply(this,[t,n,s.alts,o])}return a=H_(t,e,r,a),a}function eF(t,e,r,n){let i=[];for(let u=1;u<=e;u++)i.push(this.LA(u).tokenType);let o=t.atnStartState,s=o.rule,a=o.production,c=tF({topLevelRule:s,ambiguityIndices:r,production:a,prefixPath:i});n(c)}function tF(t){let e=N(t.prefixPath,i=>yn(i)).join(", "),r=t.production.idx===0?"":t.production.idx,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${rF(t.production)}${r}> inside <${t.topLevelRule.name}> Rule,
145
+ For further details.`);this.skipValidations=$(r,"skipValidations")?r.skipValidations:jt.skipValidations}};sc.DEFER_DEFINITION_ERRORS_HANDLING=!1;M_(sc,[$l,jl,Gl,zl,Vl,Kl,Xl,Yl,Jl,ed]);var ac=class extends sc{constructor(e,r=jt){let n=be(r);n.outputCst=!1,super(e,n)}};function wi(t,e,r){return`${t.name}_${e}_${r}`}var Kn=1,OM=2,F_=4,$_=5;var Ps=7,LM=8,MM=9,FM=10,$M=11,q_=12,cc=class{constructor(e){this.target=e}isEpsilon(){return!1}},ws=class extends cc{constructor(e,r){super(e),this.tokenType=r}},uc=class extends cc{constructor(e){super(e)}isEpsilon(){return!0}},Ns=class extends cc{constructor(e,r,n){super(e),this.rule=r,this.followState=n}isEpsilon(){return!0}};function U_(t){let e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};qM(e,t);let r=t.length;for(let n=0;n<r;n++){let i=t[n],o=Ni(e,i,i);o!==void 0&&YM(e,i,o)}return e}function qM(t,e){let r=e.length;for(let n=0;n<r;n++){let i=e[n],o=yt(t,i,void 0,{type:OM}),s=yt(t,i,void 0,{type:Ps});o.stop=s,t.ruleToStartState.set(i,o),t.ruleToStopState.set(i,s)}}function j_(t,e,r){return r instanceof ee?Bp(t,e,r.terminalType,r):r instanceof fe?XM(t,e,r):r instanceof ve?HM(t,e,r):r instanceof he?GM(t,e,r):r instanceof ie?UM(t,e,r):r instanceof ye?jM(t,e,r):r instanceof Se?WM(t,e,r):r instanceof ke?BM(t,e,r):Ni(t,e,r)}function UM(t,e,r){let n=yt(t,e,r,{type:$_});Vn(t,n);let i=Ds(t,e,n,r,Ni(t,e,r));return B_(t,e,r,i)}function jM(t,e,r){let n=yt(t,e,r,{type:$_});Vn(t,n);let i=Ds(t,e,n,r,Ni(t,e,r)),o=Bp(t,e,r.separator,r);return B_(t,e,r,i,o)}function WM(t,e,r){let n=yt(t,e,r,{type:F_});Vn(t,n);let i=Ds(t,e,n,r,Ni(t,e,r));return W_(t,e,r,i)}function BM(t,e,r){let n=yt(t,e,r,{type:F_});Vn(t,n);let i=Ds(t,e,n,r,Ni(t,e,r)),o=Bp(t,e,r.separator,r);return W_(t,e,r,i,o)}function HM(t,e,r){let n=yt(t,e,r,{type:Kn});Vn(t,n);let i=N(r.definition,s=>j_(t,e,s));return Ds(t,e,n,r,...i)}function GM(t,e,r){let n=yt(t,e,r,{type:Kn});Vn(t,n);let i=Ds(t,e,n,r,Ni(t,e,r));return zM(t,e,r,i)}function Ni(t,e,r){let n=mt(N(r.definition,i=>j_(t,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:VM(t,n)}function W_(t,e,r,n,i){let o=n.left,s=n.right,a=yt(t,e,r,{type:$M});Vn(t,a);let c=yt(t,e,r,{type:q_});return o.loopback=a,c.loopback=a,t.decisionMap[wi(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=a,ot(s,a),i===void 0?(ot(a,o),ot(a,c)):(ot(a,c),ot(a,i.left),ot(i.right,o)),{left:o,right:c}}function B_(t,e,r,n,i){let o=n.left,s=n.right,a=yt(t,e,r,{type:FM});Vn(t,a);let c=yt(t,e,r,{type:q_}),u=yt(t,e,r,{type:MM});return a.loopback=u,c.loopback=u,ot(a,o),ot(a,c),ot(s,u),i!==void 0?(ot(u,c),ot(u,i.left),ot(i.right,o)):ot(u,a),t.decisionMap[wi(e,i?"RepetitionWithSeparator":"Repetition",r.idx)]=a,{left:a,right:c}}function zM(t,e,r,n){let i=n.left,o=n.right;return ot(i,o),t.decisionMap[wi(e,"Option",r.idx)]=i,n}function Vn(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function Ds(t,e,r,n,...i){let o=yt(t,e,n,{type:LM,start:r});r.end=o;for(let a of i)a!==void 0?(ot(r,a.left),ot(a.right,o)):ot(r,o);let s={left:r,right:o};return t.decisionMap[wi(e,KM(n),n.idx)]=r,s}function KM(t){if(t instanceof ve)return"Alternation";if(t instanceof he)return"Option";if(t instanceof ie)return"Repetition";if(t instanceof ye)return"RepetitionWithSeparator";if(t instanceof Se)return"RepetitionMandatory";if(t instanceof ke)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function VM(t,e){let r=e.length;for(let o=0;o<r-1;o++){let s=e[o],a;s.left.transitions.length===1&&(a=s.left.transitions[0]);let c=a instanceof Ns,u=a,l=e[o+1].left;s.left.type===Kn&&s.right.type===Kn&&a!==void 0&&(c&&u.followState===s.right||a.target===s.right)?(c?u.followState=l:a.target=l,JM(t,s.right)):ot(s.right,l)}let n=e[0],i=e[r-1];return{left:n.left,right:i.right}}function Bp(t,e,r,n){let i=yt(t,e,n,{type:Kn}),o=yt(t,e,n,{type:Kn});return Hp(i,new ws(o,r)),{left:i,right:o}}function XM(t,e,r){let n=r.referencedRule,i=t.ruleToStartState.get(n),o=yt(t,e,r,{type:Kn}),s=yt(t,e,r,{type:Kn}),a=new Ns(i,n,s);return Hp(o,a),{left:o,right:s}}function YM(t,e,r){let n=t.ruleToStartState.get(e);ot(n,r.left);let i=t.ruleToStopState.get(e);return ot(r.right,i),{left:n,right:i}}function ot(t,e){let r=new uc(e);Hp(t,r)}function yt(t,e,r,n){let i=Object.assign({atn:t,production:r,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:t.states.length},n);return t.states.push(i),i}function Hp(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function JM(t,e){t.states.splice(t.states.indexOf(e),1)}var lc={},Is=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let r=Gp(e);r in this.map||(this.map[r]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return N(this.configs,e=>e.alt)}get key(){let e="";for(let r in this.map)e+=r+":";return e}};function Gp(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(r=>r.stateNumber.toString()).join("_")}`}function QM(t,e){let r={};return n=>{let i=n.toString(),o=r[i];return o!==void 0||(o={atnStartState:t,decision:e,states:{}},r[i]=o),o}}var rd=class{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,r){this.predicates[e]=r}toString(){let e="",r=this.predicates.length;for(let n=0;n<r;n++)e+=this.predicates[n]===!0?"1":"0";return e}},H_=new rd,dc=class extends Tn{constructor(e){var r;super(),this.logging=(r=e?.logging)!==null&&r!==void 0?r:(n=>console.log(n))}initialize(e){this.atn=U_(e.rules),this.dfas=ZM(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){let{prodOccurrence:r,rule:n,hasPredicates:i,dynamicTokensEnabled:o}=e,s=this.dfas,a=this.logging,c=wi(n,"Alternation",r),l=this.atn.decisionMap[c].decision,d=N(Ll({maxLookahead:1,occurrence:r,prodType:"Alternation",rule:n}),f=>N(f,p=>p[0]));if(G_(d,!1)&&!o){let f=We(d,(p,v,T)=>(O(v,S=>{S&&(p[S.tokenTypeIdx]=T,O(S.categoryMatches,R=>{p[R]=T}))}),p),{});return i?function(p){var v;let T=this.LA(1),S=f[T.tokenTypeIdx];if(p!==void 0&&S!==void 0){let R=(v=p[S])===null||v===void 0?void 0:v.GATE;if(R!==void 0&&R.call(this)===!1)return}return S}:function(){let p=this.LA(1);return f[p.tokenTypeIdx]}}else return i?function(f){let p=new rd,v=f===void 0?0:f.length;for(let S=0;S<v;S++){let R=f?.[S].GATE;p.set(S,R===void 0||R.call(this))}let T=zp.call(this,s,l,p,a);return typeof T=="number"?T:void 0}:function(){let f=zp.call(this,s,l,H_,a);return typeof f=="number"?f:void 0}}buildLookaheadForOptional(e){let{prodOccurrence:r,rule:n,prodType:i,dynamicTokensEnabled:o}=e,s=this.dfas,a=this.logging,c=wi(n,i,r),l=this.atn.decisionMap[c].decision,d=N(Ll({maxLookahead:1,occurrence:r,prodType:i,rule:n}),f=>N(f,p=>p[0]));if(G_(d)&&d[0][0]&&!o){let f=d[0],p=Ze(f);if(p.length===1&&Q(p[0].categoryMatches)){let T=p[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===T}}else{let v=We(p,(T,S)=>(S!==void 0&&(T[S.tokenTypeIdx]=!0,O(S.categoryMatches,R=>{T[R]=!0})),T),{});return function(){let T=this.LA(1);return v[T.tokenTypeIdx]===!0}}}return function(){let f=zp.call(this,s,l,H_,a);return typeof f=="object"?!1:f===0}}};function G_(t,e=!0){let r=new Set;for(let n of t){let i=new Set;for(let o of n){if(o===void 0){if(e)break;return!1}let s=[o.tokenTypeIdx].concat(o.categoryMatches);for(let a of s)if(r.has(a)){if(!i.has(a))return!1}else r.add(a),i.add(a)}}return!0}function ZM(t){let e=t.decisionStates.length,r=Array(e);for(let n=0;n<e;n++)r[n]=QM(t.decisionStates[n],n);return r}function zp(t,e,r,n){let i=t[e](r),o=i.start;if(o===void 0){let a=lF(i.atnStartState);o=V_(i,K_(a)),i.start=o}return eF.apply(this,[i,o,r,n])}function eF(t,e,r,n){let i=e,o=1,s=[],a=this.LA(o++);for(;;){let c=sF(i,a);if(c===void 0&&(c=tF.apply(this,[t,i,a,o,r,n])),c===lc)return oF(s,i,a);if(c.isAcceptState===!0)return c.prediction;i=c,s.push(a),a=this.LA(o++)}}function tF(t,e,r,n,i,o){let s=aF(e.configs,r,i);if(s.size===0)return z_(t,e,r,lc),lc;let a=K_(s),c=uF(s,i);if(c!==void 0)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;else if(pF(s)){let u=xR(s.alts);a.isAcceptState=!0,a.prediction=u,a.configs.uniqueAlt=u,rF.apply(this,[t,n,s.alts,o])}return a=z_(t,e,r,a),a}function rF(t,e,r,n){let i=[];for(let u=1;u<=e;u++)i.push(this.LA(u).tokenType);let o=t.atnStartState,s=o.rule,a=o.production,c=nF({topLevelRule:s,ambiguityIndices:r,production:a,prefixPath:i});n(c)}function nF(t){let e=N(t.prefixPath,i=>yn(i)).join(", "),r=t.production.idx===0?"":t.production.idx,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${iF(t.production)}${r}> inside <${t.topLevelRule.name}> Rule,
146
146
  <${e}> may appears as a prefix path in all these alternatives.
147
147
  `;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
148
- For Further details.`,n}function rF(t){if(t instanceof fe)return"SUBRULE";if(t instanceof he)return"OPTION";if(t instanceof ve)return"OR";if(t instanceof ke)return"AT_LEAST_ONE";if(t instanceof Se)return"AT_LEAST_ONE_SEP";if(t instanceof ye)return"MANY_SEP";if(t instanceof ie)return"MANY";if(t instanceof ee)return"CONSUME";throw Error("non exhaustive match")}function nF(t,e,r){let n=bt(e.configs.elements,o=>o.state.transitions),i=CR(n.filter(o=>o instanceof As).map(o=>o.tokenType),o=>o.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:t}}function iF(t,e){return t.edges[e.tokenTypeIdx]}function oF(t,e,r){let n=new Ds,i=[];for(let s of t.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===Ns){i.push(s);continue}let a=s.state.transitions.length;for(let c=0;c<a;c++){let u=s.state.transitions[c],l=sF(u,e);l!==void 0&&n.add({state:l,alt:s.alt,stack:s.stack})}}let o;if(i.length===0&&n.size===1&&(o=n),o===void 0){o=new Ds;for(let s of n.elements)nd(s,o)}if(i.length>0&&!lF(o))for(let s of i)o.add(s);return o}function sF(t,e){if(t instanceof As&&Xa(e,t.tokenType))return t.target}function aF(t,e){let r;for(let 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}function G_(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function H_(t,e,r,n){return n=z_(t,n),e.edges[r.tokenTypeIdx]=n,n}function z_(t,e){if(e===uc)return e;let r=e.configs.key,n=t.states[r];return n!==void 0?n:(e.configs.finalize(),t.states[r]=e,e)}function cF(t){let e=new Ds,r=t.transitions.length;for(let n=0;n<r;n++){let o={state:t.transitions[n].target,alt:n,stack:[]};nd(o,e)}return e}function nd(t,e){let r=t.state;if(r.type===Ns){if(t.stack.length>0){let i=[...t.stack],s={state:i.pop(),alt:t.alt,stack:i};nd(s,e)}else e.add(t);return}r.epsilonOnlyTransitions||e.add(t);let n=r.transitions.length;for(let i=0;i<n;i++){let o=r.transitions[i],s=uF(t,o);s!==void 0&&nd(s,e)}}function uF(t,e){if(e instanceof cc)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof ws){let r=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:r}}}function lF(t){for(let e of t.elements)if(e.state.type===Ns)return!0;return!1}function dF(t){for(let e of t.elements)if(e.state.type!==Ns)return!1;return!0}function fF(t){if(dF(t))return!0;let e=hF(t.elements);return pF(e)&&!mF(e)}function hF(t){let e=new Map;for(let r of t){let n=Bp(r,!1),i=e.get(n);i===void 0&&(i={},e.set(n,i)),i[r.alt]=!0}return e}function pF(t){for(let e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function mF(t){for(let e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}Ii();var vc=class{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?e:this.rootNode}buildRootNode(e){return this.rootNode=new $s(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let r=new Li;return r.grammarSource=e,r.root=this.rootNode,this.current.content.push(r),this.nodeStack.push(r),r}buildLeafNode(e,r){let n=new Oi(e.startOffset,e.image.length,eo(e),e.tokenType,!r);return n.grammarSource=r,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){let r=e.container;if(r){let n=r.content.indexOf(e);n>=0&&r.content.splice(n,1)}}addHiddenNodes(e){let r=[];for(let o of e){let s=new Oi(o.startOffset,o.image.length,eo(o),o.tokenType,!0);s.root=this.rootNode,r.push(s)}let n=this.current,i=!1;if(n.content.length>0){n.content.push(...r);return}for(;n.container;){let o=n.container.content.indexOf(n);if(o>0){n.container.content.splice(o,0,...r),i=!0;break}n=n.container}i||this.rootNode.content.unshift(...r)}construct(e){let r=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=r;let n=this.nodeStack.pop();n?.content.length===0&&this.removeNode(n)}},xc=class{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,r;let n=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(r=this.container)===null||r===void 0?void 0:r.astNode;if(!n)throw new Error("This node has no associated AST element");return n}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}},Oi=class extends xc{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,r,n,i,o=!1){super(),this._hidden=o,this._offset=e,this._tokenType=i,this._length=r,this._range=n}},Li=class extends xc{constructor(){super(...arguments),this.content=new Km(this)}get children(){return this.content}get offset(){var e,r;return(r=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&r!==void 0?r:0}get length(){return this.end-this.offset}get end(){var e,r;return(r=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&r!==void 0?r:0}get range(){let e=this.firstNonHiddenNode,r=this.lastNonHiddenNode;if(e&&r){if(this._rangeCache===void 0){let{range:n}=e,{range:i}=r;this._rangeCache={start:n.start,end:i.end.line<n.start.line?n.start:i.end}}return this._rangeCache}else return{start:ce.create(0,0),end:ce.create(0,0)}}get firstNonHiddenNode(){for(let e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){let r=this.content[e];if(!r.hidden)return r}return this.content[this.content.length-1]}},Km=class t extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,t.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,r,...n){return this.addParents(n),super.splice(e,r,...n)}addParents(e){for(let r of e)r.container=this.parent}},$s=class extends Li{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}};var hd=Symbol("Datatype");function Vm(t){return t.$type===hd}var K_="\u200B",V_=t=>t.endsWith(K_)?t:t+K_,Tc=class{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;let r=this.lexer.definition,n=e.LanguageMetaData.mode==="production";this.wrapper=new Xm(r,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:n,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,r){this.wrapper.wrapOr(e,r)}optional(e,r){this.wrapper.wrapOption(e,r)}many(e,r){this.wrapper.wrapMany(e,r)}atLeastOne(e,r){this.wrapper.wrapAtLeastOne(e,r)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},Rc=class extends Tc{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new vc,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,r){let n=this.computeRuleType(e),i=this.wrapper.DEFINE_RULE(V_(e.name),this.startImplementation(n,r).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment){if(qa(e))return hd;{let r=qr(e);return r??e.name}}}parse(e,r={}){this.nodeBuilder.buildRootNode(e);let n=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=n.tokens;let i=r.rule?this.allRules.get(r.rule):this.mainRule;if(!i)throw new Error(r.rule?`No rule found with name '${r.rule}'`:"No main rule available.");let o=this.doParse(i);return this.nodeBuilder.addHiddenNodes(n.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:o,lexerErrors:n.errors,lexerReport:n.report,parserErrors:this.wrapper.errors}}doParse(e){let r=e.call(this.wrapper,{});if(this.stack.length>0&&(r=this.construct()),r===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return r}startImplementation(e,r){return n=>{let i=!this.isRecording()&&e!==void 0;if(i){let o={$type:e};this.stack.push(o),e===hd&&(o.value="")}return r(n),i?this.construct():void 0}}extractHiddenTokens(e){let r=this.lexerResult.hidden;if(!r.length)return[];let n=e.startOffset;for(let i=0;i<r.length;i++)if(r[i].startOffset>n)return r.splice(0,i);return r.splice(0,r.length)}consume(e,r,n){let i=this.wrapper.wrapConsume(e,r);if(!this.isRecording()&&this.isValidToken(i)){let o=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(o);let s=this.nodeBuilder.buildLeafNode(i,n),{assignment:a,isCrossRef:c}=this.getAssignment(n),u=this.current;if(a){let l=lt(n)?i.image:this.converter.convert(i.image,s);this.assign(a.operator,a.feature,l,s,c)}else if(Vm(u)){let l=i.image;lt(n)||(l=this.converter.convert(l,s).toString()),u.value+=l}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,r,n,i,o){let s;!this.isRecording()&&!n&&(s=this.nodeBuilder.buildCompositeNode(i));let a;try{a=this.wrapper.wrapSubrule(e,r,o)}finally{this.isRecording()||(a===void 0&&!n&&(a=this.construct()),a!==void 0&&s&&s.length>0&&this.performSubruleAssignment(a,i,s))}}performSubruleAssignment(e,r,n){let{assignment:i,isCrossRef:o}=this.getAssignment(r);if(i)this.assign(i.operator,i.feature,e,n,o);else if(!i){let s=this.current;if(Vm(s))s.value+=e.toString();else if(typeof e=="object"&&e){let c=this.assignWithoutOverride(e,s);this.stack.pop(),this.stack.push(c)}}}action(e,r){if(!this.isRecording()){let n=this.current;if(r.feature&&r.operator){n=this.construct(),this.nodeBuilder.removeNode(n.$cstNode),this.nodeBuilder.buildCompositeNode(r).content.push(n.$cstNode);let o={$type:e};this.stack.push(o),this.assign(r.operator,r.feature,n,n.$cstNode,!1)}else n.$type=e}}construct(){if(this.isRecording())return;let e=this.current;return qu(e),this.nodeBuilder.construct(e),this.stack.pop(),Vm(e)?this.converter.convert(e.value,e.$cstNode):(Na(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){let r=ar(e,Et);this.assignmentMap.set(e,{assignment:r,isCrossRef:r?sr(r.terminal):!1})}return this.assignmentMap.get(e)}assign(e,r,n,i,o){let s=this.current,a;switch(o&&typeof n=="string"?a=this.linker.buildReference(s,r,i,n):a=n,e){case"=":{s[r]=a;break}case"?=":{s[r]=!0;break}case"+=":Array.isArray(s[r])||(s[r]=[]),s[r].push(a)}}assignWithoutOverride(e,r){for(let[i,o]of Object.entries(r)){let s=e[i];s===void 0?e[i]=o:Array.isArray(s)&&Array.isArray(o)&&(o.push(...s),e[i]=o)}let n=e.$cstNode;return n&&(n.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}},pd=class{buildMismatchTokenMessage(e){return xn.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return xn.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return xn.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return xn.buildEarlyExitMessage(e)}},qs=class extends pd{buildMismatchTokenMessage({expected:e,actual:r}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${r.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},_c=class extends Tc{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let r=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=r.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,r){let n=this.wrapper.DEFINE_RULE(V_(e.name),this.startImplementation(r).bind(this));return this.allRules.set(e.name,n),e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return r=>{let n=this.keepStackSize();try{e(r)}finally{this.resetStackSize(n)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,r,n){this.wrapper.wrapConsume(e,r),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,r,n,i,o){this.before(i),this.wrapper.wrapSubrule(e,r,o),this.after(i)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let r=this.elementStack.lastIndexOf(e);r>=0&&this.elementStack.splice(r)}}get currIdx(){return this.wrapper.currIdx}},yF={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new qs},Xm=class extends sc{constructor(e,r){let n=r&&"maxLookahead"in r;super(e,Object.assign(Object.assign(Object.assign({},yF),{lookaheadStrategy:n?new Tn({maxLookahead:r.maxLookahead}):new lc({logging:r.skipValidations?()=>{}:void 0})}),r))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,r,n){return this.RULE(e,r,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,r){return this.consume(e,r,void 0)}wrapSubrule(e,r,n){return this.subrule(e,r,{ARGS:[n]})}wrapOr(e,r){this.or(e,r)}wrapOption(e,r){this.option(e,r)}wrapMany(e,r){this.many(e,r)}wrapAtLeastOne(e,r){this.atLeastOne(e,r)}};function bc(t,e,r){return vF({parser:e,tokens:r,ruleNames:new Map},t),e}function vF(t,e){let r=Ma(e,!1),n=Z(e.rules).filter(Ie).filter(i=>r.has(i));for(let i of n){let o=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(i,Mi(o,i.definition))}}function Mi(t,e,r=!1){let n;if(lt(e))n=kF(t,e);else if(Ar(e))n=xF(t,e);else if(Et(e))n=Mi(t,e.terminal);else if(sr(e))n=X_(t,e);else if(Vt(e))n=TF(t,e);else if(jo(e))n=_F(t,e);else if(Wo(e))n=bF(t,e);else if(pr(e))n=CF(t,e);else if(Ih(e)){let i=t.consume++;n=()=>t.parser.consume(i,lr,e)}else throw new hi(e.$cstNode,`Unexpected element type: ${e.$type}`);return Y_(t,r?void 0:md(e),n,e.cardinality)}function xF(t,e){let r=_i(e);return()=>t.parser.action(r,e)}function TF(t,e){let r=e.rule.ref;if(Ie(r)){let n=t.subrule++,i=r.fragment,o=e.arguments.length>0?RF(r,e.arguments):()=>({});return s=>t.parser.subrule(n,J_(t,r),i,e,o(s))}else if(Mt(r)){let n=t.consume++,i=Ym(t,r.name);return()=>t.parser.consume(n,i,e)}else if(r)Fr(r);else throw new hi(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function RF(t,e){let r=e.map(n=>_n(n.value));return n=>{let i={};for(let o=0;o<r.length;o++){let s=t.parameters[o],a=r[o];i[s.name]=a(n)}return i}}function _n(t){if(Sh(t)){let e=_n(t.left),r=_n(t.right);return n=>e(n)||r(n)}else if(kh(t)){let e=_n(t.left),r=_n(t.right);return n=>e(n)&&r(n)}else if(Eh(t)){let e=_n(t.value);return r=>!e(r)}else if(Ah(t)){let e=t.parameter.ref.name;return r=>r!==void 0&&r[e]===!0}else if(Ch(t)){let e=!!t.true;return()=>e}Fr(t)}function _F(t,e){if(e.elements.length===1)return Mi(t,e.elements[0]);{let r=[];for(let i of e.elements){let o={ALT:Mi(t,i,!0)},s=md(i);s&&(o.GATE=_n(s)),r.push(o)}let n=t.or++;return i=>t.parser.alternatives(n,r.map(o=>{let s={ALT:()=>o.ALT(i)},a=o.GATE;return a&&(s.GATE=()=>a(i)),s}))}}function bF(t,e){if(e.elements.length===1)return Mi(t,e.elements[0]);let r=[];for(let a of e.elements){let c={ALT:Mi(t,a,!0)},u=md(a);u&&(c.GATE=_n(u)),r.push(c)}let n=t.or++,i=(a,c)=>{let u=c.getRuleStack().join("-");return`uGroup_${a}_${u}`},o=a=>t.parser.alternatives(n,r.map((c,u)=>{let l={ALT:()=>!0},d=t.parser;l.ALT=()=>{if(c.ALT(a),!d.isRecording()){let p=i(n,d);d.unorderedGroups.get(p)||d.unorderedGroups.set(p,[]);let v=d.unorderedGroups.get(p);typeof v?.[u]>"u"&&(v[u]=!0)}};let f=c.GATE;return f?l.GATE=()=>f(a):l.GATE=()=>{let p=d.unorderedGroups.get(i(n,d));return!p?.[u]},l})),s=Y_(t,md(e),o,"*");return a=>{s(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(n,t.parser))}}function CF(t,e){let r=e.elements.map(n=>Mi(t,n));return n=>r.forEach(i=>i(n))}function md(t){if(pr(t))return t.guardCondition}function X_(t,e,r=e.terminal){if(r)if(Vt(r)&&Ie(r.rule.ref)){let n=r.rule.ref,i=t.subrule++;return o=>t.parser.subrule(i,J_(t,n),!1,e,o)}else if(Vt(r)&&Mt(r.rule.ref)){let n=t.consume++,i=Ym(t,r.rule.ref.name);return()=>t.parser.consume(n,i,e)}else if(lt(r)){let n=t.consume++,i=Ym(t,r.value);return()=>t.parser.consume(n,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);let n=Hu(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+_i(e.type.ref));return X_(t,e,i)}}function kF(t,e){let r=t.consume++,n=t.tokens[e.value];if(!n)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(r,n,e)}function Y_(t,e,r,n){let i=e&&_n(e);if(!n)if(i){let o=t.or++;return s=>t.parser.alternatives(o,[{ALT:()=>r(s),GATE:()=>i(s)},{ALT:td(),GATE:()=>!i(s)}])}else return r;if(n==="*"){let o=t.many++;return s=>t.parser.many(o,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else if(n==="+"){let o=t.many++;if(i){let s=t.or++;return a=>t.parser.alternatives(s,[{ALT:()=>t.parser.atLeastOne(o,{DEF:()=>r(a)}),GATE:()=>i(a)},{ALT:td(),GATE:()=>!i(a)}])}else return s=>t.parser.atLeastOne(o,{DEF:()=>r(s)})}else if(n==="?"){let o=t.optional++;return s=>t.parser.optional(o,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else Fr(n)}function J_(t,e){let r=SF(t,e),n=t.parser.getRule(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function SF(t,e){if(Ie(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let r=e,n=r.$container,i=e.$type;for(;!Ie(n);)(pr(n)||jo(n)||Wo(n))&&(i=n.elements.indexOf(r).toString()+":"+i),r=n,n=n.$container;return i=n.name+":"+i,t.ruleNames.set(e,i),i}}function Ym(t,e){let r=t.tokens[e];if(!r)throw new Error(`Token "${e}" not found."`);return r}function Jm(t){let e=t.Grammar,r=t.parser.Lexer,n=new _c(t);return bc(e,n,r.definition),n.finalize(),n}function Qm(t){let e=Q_(t);return e.finalize(),e}function Q_(t){let e=t.Grammar,r=t.parser.Lexer,n=new Rc(t);return bc(e,n,r.definition)}var Fi=class{constructor(){this.diagnostics=[]}buildTokens(e,r){let n=Z(Ma(e,!1)),i=this.buildTerminalTokens(n),o=this.buildKeywordTokens(n,i,r);return o.push(...i),o}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Mt).filter(r=>!r.fragment).map(r=>this.buildTerminalToken(r)).toArray()}buildTerminalToken(e){let r=Nn(e),n=this.requiresCustomPattern(r)?this.regexPatternFunction(r):r,i={name:e.name,PATTERN:n};return typeof n=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=Oa(r)?Me.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")||e.flags.includes("s")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){let r=new RegExp(e,e.flags+"y");return(n,i)=>(r.lastIndex=i,r.exec(n))}buildKeywordTokens(e,r,n){return e.filter(Ie).flatMap(i=>cr(i).filter(lt)).distinct(i=>i.value).toArray().sort((i,o)=>o.value.length-i.value.length).map(i=>this.buildKeywordToken(i,r,!!n?.caseInsensitive))}buildKeywordToken(e,r,n){let i=this.buildKeywordPattern(e,n),o={name:e.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(e,r)};return typeof i=="function"&&(o.LINE_BREAKS=!0),o}buildKeywordPattern(e,r){return r?new RegExp(wn(e.value),"i"):e.value}findLongerAlt(e,r){return r.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&Kh("^"+o.source+"$",e.value)&&n.push(i),n},[])}};var Cc=class{convert(e,r){let n=r.grammarSource;if(sr(n)&&(n=Fa(n)),Vt(n)){let i=n.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,r)}return e}runConverter(e,r,n){var i;switch(e.name.toUpperCase()){case"INT":return Qr.convertInt(r);case"STRING":return Qr.convertString(r);case"ID":return Qr.convertID(r)}switch((i=np(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Qr.convertNumber(r);case"boolean":return Qr.convertBoolean(r);case"bigint":return Qr.convertBigint(r);case"date":return Qr.convertDate(r);default:return r}}},Qr;(function(t){function e(u){let l="";for(let d=1;d<u.length-1;d++){let f=u.charAt(d);if(f==="\\"){let p=u.charAt(++d);l+=r(p)}else l+=f}return l}t.convertString=e;function r(u){switch(u){case"b":return"\b";case"f":return"\f";case"n":return`
149
- `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return u}}function n(u){return u.charAt(0)==="^"?u.substring(1):u}t.convertID=n;function i(u){return parseInt(u)}t.convertInt=i;function o(u){return BigInt(u)}t.convertBigint=o;function s(u){return new Date(u)}t.convertDate=s;function a(u){return Number(u)}t.convertNumber=a;function c(u){return u.toLowerCase()==="true"}t.convertBoolean=c})(Qr||(Qr={}));var B={};se(B,hr(kc(),1));function og(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}var xd=0,rb=10;function Td(){return xd=performance.now(),new B.CancellationTokenSource}function nb(t){rb=t}var Zr=Symbol("OperationCancelled");function en(t){return t===Zr}async function Be(t){if(t===B.CancellationToken.None)return;let e=performance.now();if(e-xd>=rb&&(xd=e,await og(),xd=performance.now()),t.isCancellationRequested)throw Zr}var Wt=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=n=>(e(n),this),this.reject=n=>(r(n),this)})}};var Rd=class t{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){for(let n of e)if(t.isIncremental(n)){let i=sb(n.range),o=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,o)+n.text+this._content.substring(s,this._content.length);let a=Math.max(i.start.line,0),c=Math.max(i.end.line,0),u=this._lineOffsets,l=ib(n.text,!1,o);if(c-a===l.length)for(let f=0,p=l.length;f<p;f++)u[f+a+1]=l[f];else l.length<1e4?u.splice(a+1,c-a,...l):this._lineOffsets=u=u.slice(0,a+1).concat(l,u.slice(c+1));let d=n.text.length-(s-o);if(d!==0)for(let f=a+1+l.length,p=u.length;f<p;f++)u[f]=u[f]+d}else if(t.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=ib(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:e};for(;n<i;){let s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}let o=n-1;return e=this.ensureBeforeEOL(e,r[o]),{line:o,character:e-r[o]}}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line];if(e.character<=0)return n;let i=e.line+1<r.length?r[e.line+1]:this._content.length,o=Math.min(n+e.character,i);return this.ensureBeforeEOL(o,n)}ensureBeforeEOL(e,r){for(;e>r&&ob(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},Yn;(function(t){function e(i,o,s,a){return new Rd(i,o,s,a)}t.create=e;function r(i,o,s){if(i instanceof Rd)return i.update(o,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,o){let s=i.getText(),a=sg(o.map(MF),(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),c=0,u=[];for(let l of a){let d=i.offsetAt(l.range.start);if(d<c)throw new Error("Overlapping edit");d>c&&u.push(s.substring(c,d)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(s.substr(c)),u.join("")}t.applyEdits=n})(Yn||(Yn={}));function sg(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);sg(n,e),sg(i,e);let o=0,s=0,a=0;for(;o<n.length&&s<i.length;)e(n[o],i[s])<=0?t[a++]=n[o++]:t[a++]=i[s++];for(;o<n.length;)t[a++]=n[o++];for(;s<i.length;)t[a++]=i[s++];return t}function ib(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);ob(o)&&(o===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function ob(t){return t===13||t===10}function sb(t){let e=t.start,r=t.end;return e.line>r.line||e.line===r.line&&e.character>r.character?{start:r,end:e}:t}function MF(t){let e=sb(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var ab;(()=>{"use strict";var t={470:i=>{function o(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}function s(c,u){for(var l,d="",f=0,p=-1,v=0,T=0;T<=c.length;++T){if(T<c.length)l=c.charCodeAt(T);else{if(l===47)break;l=47}if(l===47){if(!(p===T-1||v===1))if(p!==T-1&&v===2){if(d.length<2||f!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var k=d.lastIndexOf("/");if(k!==d.length-1){k===-1?(d="",f=0):f=(d=d.slice(0,k)).length-1-d.lastIndexOf("/"),p=T,v=0;continue}}else if(d.length===2||d.length===1){d="",f=0,p=T,v=0;continue}}u&&(d.length>0?d+="/..":d="..",f=2)}else d.length>0?d+="/"+c.slice(p+1,T):d=c.slice(p+1,T),f=T-p-1;p=T,v=0}else l===46&&v!==-1?++v:v=-1}return d}var a={resolve:function(){for(var c,u="",l=!1,d=arguments.length-1;d>=-1&&!l;d--){var f;d>=0?f=arguments[d]:(c===void 0&&(c=process.cwd()),f=c),o(f),f.length!==0&&(u=f+"/"+u,l=f.charCodeAt(0)===47)}return u=s(u,!l),l?u.length>0?"/"+u:"/":u.length>0?u:"."},normalize:function(c){if(o(c),c.length===0)return".";var u=c.charCodeAt(0)===47,l=c.charCodeAt(c.length-1)===47;return(c=s(c,!u)).length!==0||u||(c="."),c.length>0&&l&&(c+="/"),u?"/"+c:c},isAbsolute:function(c){return o(c),c.length>0&&c.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var c,u=0;u<arguments.length;++u){var l=arguments[u];o(l),l.length>0&&(c===void 0?c=l:c+="/"+l)}return c===void 0?".":a.normalize(c)},relative:function(c,u){if(o(c),o(u),c===u||(c=a.resolve(c))===(u=a.resolve(u)))return"";for(var l=1;l<c.length&&c.charCodeAt(l)===47;++l);for(var d=c.length,f=d-l,p=1;p<u.length&&u.charCodeAt(p)===47;++p);for(var v=u.length-p,T=f<v?f:v,k=-1,R=0;R<=T;++R){if(R===T){if(v>T){if(u.charCodeAt(p+R)===47)return u.slice(p+R+1);if(R===0)return u.slice(p+R)}else f>T&&(c.charCodeAt(l+R)===47?k=R:R===0&&(k=0));break}var g=c.charCodeAt(l+R);if(g!==u.charCodeAt(p+R))break;g===47&&(k=R)}var h="";for(R=l+k+1;R<=d;++R)R!==d&&c.charCodeAt(R)!==47||(h.length===0?h+="..":h+="/..");return h.length>0?h+u.slice(p+k):(p+=k,u.charCodeAt(p)===47&&++p,u.slice(p))},_makeLong:function(c){return c},dirname:function(c){if(o(c),c.length===0)return".";for(var u=c.charCodeAt(0),l=u===47,d=-1,f=!0,p=c.length-1;p>=1;--p)if((u=c.charCodeAt(p))===47){if(!f){d=p;break}}else f=!1;return d===-1?l?"/":".":l&&d===1?"//":c.slice(0,d)},basename:function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');o(c);var l,d=0,f=-1,p=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var v=u.length-1,T=-1;for(l=c.length-1;l>=0;--l){var k=c.charCodeAt(l);if(k===47){if(!p){d=l+1;break}}else T===-1&&(p=!1,T=l+1),v>=0&&(k===u.charCodeAt(v)?--v==-1&&(f=l):(v=-1,f=T))}return d===f?f=T:f===-1&&(f=c.length),c.slice(d,f)}for(l=c.length-1;l>=0;--l)if(c.charCodeAt(l)===47){if(!p){d=l+1;break}}else f===-1&&(p=!1,f=l+1);return f===-1?"":c.slice(d,f)},extname:function(c){o(c);for(var u=-1,l=0,d=-1,f=!0,p=0,v=c.length-1;v>=0;--v){var T=c.charCodeAt(v);if(T!==47)d===-1&&(f=!1,d=v+1),T===46?u===-1?u=v:p!==1&&(p=1):u!==-1&&(p=-1);else if(!f){l=v+1;break}}return u===-1||d===-1||p===0||p===1&&u===d-1&&u===l+1?"":c.slice(u,d)},format:function(c){if(c===null||typeof c!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof c);return(function(u,l){var d=l.dir||l.root,f=l.base||(l.name||"")+(l.ext||"");return d?d===l.root?d+f:d+"/"+f:f})(0,c)},parse:function(c){o(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var l,d=c.charCodeAt(0),f=d===47;f?(u.root="/",l=1):l=0;for(var p=-1,v=0,T=-1,k=!0,R=c.length-1,g=0;R>=l;--R)if((d=c.charCodeAt(R))!==47)T===-1&&(k=!1,T=R+1),d===46?p===-1?p=R:g!==1&&(g=1):p!==-1&&(g=-1);else if(!k){v=R+1;break}return p===-1||T===-1||g===0||g===1&&p===T-1&&p===v+1?T!==-1&&(u.base=u.name=v===0&&f?c.slice(1,T):c.slice(v,T)):(v===0&&f?(u.name=c.slice(1,p),u.base=c.slice(1,T)):(u.name=c.slice(v,p),u.base=c.slice(v,T)),u.ext=c.slice(p,T)),v>0?u.dir=c.slice(0,v-1):f&&(u.dir="/"),u},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,i.exports=a}},e={};function r(i){var o=e[i];if(o!==void 0)return o.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.d=(i,o)=>{for(var s in o)r.o(o,s)&&!r.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:o[s]})},r.o=(i,o)=>Object.prototype.hasOwnProperty.call(i,o),r.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var n={};(()=>{let i;r.r(n),r.d(n,{URI:()=>f,Utils:()=>Ht}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let o=/^\w[\w\d+.-]*$/,s=/^\//,a=/^\/\//;function c(I,S){if(!I.scheme&&S)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${I.authority}", path: "${I.path}", query: "${I.query}", fragment: "${I.fragment}"}`);if(I.scheme&&!o.test(I.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(I.path){if(I.authority){if(!s.test(I.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a.test(I.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}let u="",l="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class f{static isUri(S){return S instanceof f||!!S&&typeof S.authority=="string"&&typeof S.fragment=="string"&&typeof S.path=="string"&&typeof S.query=="string"&&typeof S.scheme=="string"&&typeof S.fsPath=="string"&&typeof S.with=="function"&&typeof S.toString=="function"}scheme;authority;path;query;fragment;constructor(S,U,M,ne,K,H=!1){typeof S=="object"?(this.scheme=S.scheme||u,this.authority=S.authority||u,this.path=S.path||u,this.query=S.query||u,this.fragment=S.fragment||u):(this.scheme=(function(ct,F){return ct||F?ct:"file"})(S,H),this.authority=U||u,this.path=(function(ct,F){switch(ct){case"https":case"http":case"file":F?F[0]!==l&&(F=l+F):F=l}return F})(this.scheme,M||u),this.query=ne||u,this.fragment=K||u,c(this,H))}get fsPath(){return g(this,!1)}with(S){if(!S)return this;let{scheme:U,authority:M,path:ne,query:K,fragment:H}=S;return U===void 0?U=this.scheme:U===null&&(U=u),M===void 0?M=this.authority:M===null&&(M=u),ne===void 0?ne=this.path:ne===null&&(ne=u),K===void 0?K=this.query:K===null&&(K=u),H===void 0?H=this.fragment:H===null&&(H=u),U===this.scheme&&M===this.authority&&ne===this.path&&K===this.query&&H===this.fragment?this:new v(U,M,ne,K,H)}static parse(S,U=!1){let M=d.exec(S);return M?new v(M[2]||u,J(M[4]||u),J(M[5]||u),J(M[7]||u),J(M[9]||u),U):new v(u,u,u,u,u)}static file(S){let U=u;if(i&&(S=S.replace(/\\/g,l)),S[0]===l&&S[1]===l){let M=S.indexOf(l,2);M===-1?(U=S.substring(2),S=l):(U=S.substring(2,M),S=S.substring(M)||l)}return new v("file",U,S,u,u)}static from(S){let U=new v(S.scheme,S.authority,S.path,S.query,S.fragment);return c(U,!0),U}toString(S=!1){return h(this,S)}toJSON(){return this}static revive(S){if(S){if(S instanceof f)return S;{let U=new v(S);return U._formatted=S.external,U._fsPath=S._sep===p?S.fsPath:null,U}}return S}}let p=i?1:void 0;class v extends f{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=g(this,!1)),this._fsPath}toString(S=!1){return S?h(this,!0):(this._formatted||(this._formatted=h(this,!1)),this._formatted)}toJSON(){let S={$mid:1};return this._fsPath&&(S.fsPath=this._fsPath,S._sep=p),this._formatted&&(S.external=this._formatted),this.path&&(S.path=this.path),this.scheme&&(S.scheme=this.scheme),this.authority&&(S.authority=this.authority),this.query&&(S.query=this.query),this.fragment&&(S.fragment=this.fragment),S}}let T={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function k(I,S,U){let M,ne=-1;for(let K=0;K<I.length;K++){let H=I.charCodeAt(K);if(H>=97&&H<=122||H>=65&&H<=90||H>=48&&H<=57||H===45||H===46||H===95||H===126||S&&H===47||U&&H===91||U&&H===93||U&&H===58)ne!==-1&&(M+=encodeURIComponent(I.substring(ne,K)),ne=-1),M!==void 0&&(M+=I.charAt(K));else{M===void 0&&(M=I.substr(0,K));let ct=T[H];ct!==void 0?(ne!==-1&&(M+=encodeURIComponent(I.substring(ne,K)),ne=-1),M+=ct):ne===-1&&(ne=K)}}return ne!==-1&&(M+=encodeURIComponent(I.substring(ne))),M!==void 0?M:I}function R(I){let S;for(let U=0;U<I.length;U++){let M=I.charCodeAt(U);M===35||M===63?(S===void 0&&(S=I.substr(0,U)),S+=T[M]):S!==void 0&&(S+=I[U])}return S!==void 0?S:I}function g(I,S){let U;return U=I.authority&&I.path.length>1&&I.scheme==="file"?`//${I.authority}${I.path}`:I.path.charCodeAt(0)===47&&(I.path.charCodeAt(1)>=65&&I.path.charCodeAt(1)<=90||I.path.charCodeAt(1)>=97&&I.path.charCodeAt(1)<=122)&&I.path.charCodeAt(2)===58?S?I.path.substr(1):I.path[1].toLowerCase()+I.path.substr(2):I.path,i&&(U=U.replace(/\//g,"\\")),U}function h(I,S){let U=S?R:k,M="",{scheme:ne,authority:K,path:H,query:ct,fragment:F}=I;if(ne&&(M+=ne,M+=":"),(K||ne==="file")&&(M+=l,M+=l),K){let b=K.indexOf("@");if(b!==-1){let Te=K.substr(0,b);K=K.substr(b+1),b=Te.lastIndexOf(":"),b===-1?M+=U(Te,!1,!1):(M+=U(Te.substr(0,b),!1,!1),M+=":",M+=U(Te.substr(b+1),!1,!0)),M+="@"}K=K.toLowerCase(),b=K.lastIndexOf(":"),b===-1?M+=U(K,!1,!0):(M+=U(K.substr(0,b),!1,!0),M+=K.substr(b))}if(H){if(H.length>=3&&H.charCodeAt(0)===47&&H.charCodeAt(2)===58){let b=H.charCodeAt(1);b>=65&&b<=90&&(H=`/${String.fromCharCode(b+32)}:${H.substr(3)}`)}else if(H.length>=2&&H.charCodeAt(1)===58){let b=H.charCodeAt(0);b>=65&&b<=90&&(H=`${String.fromCharCode(b+32)}:${H.substr(2)}`)}M+=U(H,!0,!1)}return ct&&(M+="?",M+=U(ct,!1,!1)),F&&(M+="#",M+=S?F:k(F,!1,!1)),M}function _(I){try{return decodeURIComponent(I)}catch{return I.length>3?I.substr(0,3)+_(I.substr(3)):I}}let w=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function J(I){return I.match(w)?I.replace(w,(S=>_(S))):I}var Bt=r(470);let Ye=Bt.posix||Bt,ir="/";var Ht;(function(I){I.joinPath=function(S,...U){return S.with({path:Ye.join(S.path,...U)})},I.resolvePath=function(S,...U){let M=S.path,ne=!1;M[0]!==ir&&(M=ir+M,ne=!0);let K=Ye.resolve(M,...U);return ne&&K[0]===ir&&!S.authority&&(K=K.substring(1)),S.with({path:K})},I.dirname=function(S){if(S.path.length===0||S.path===ir)return S;let U=Ye.dirname(S.path);return U.length===1&&U.charCodeAt(0)===46&&(U=""),S.with({path:U})},I.basename=function(S){return Ye.basename(S.path)},I.extname=function(S){return Ye.extname(S.path)}})(Ht||(Ht={}))})(),ab=n})();var{URI:tt,Utils:Bs}=ab;var oe;(function(t){t.basename=Bs.basename,t.dirname=Bs.dirname,t.extname=Bs.extname,t.joinPath=Bs.joinPath,t.resolvePath=Bs.resolvePath;let e=typeof process=="object"&&(process==null?void 0:process.platform)==="win32";function r(o,s){return o?.toString()===s?.toString()}t.equals=r;function n(o,s){let a=typeof o=="string"?tt.parse(o).path:o.path,c=typeof s=="string"?tt.parse(s).path:s.path,u=a.split("/").filter(v=>v.length>0),l=c.split("/").filter(v=>v.length>0);if(e){let v=/^[A-Z]:$/;if(u[0]&&v.test(u[0])&&(u[0]=u[0].toLowerCase()),l[0]&&v.test(l[0])&&(l[0]=l[0].toLowerCase()),u[0]!==l[0])return c.substring(1)}let d=0;for(;d<u.length&&u[d]===l[d];d++);let f="../".repeat(u.length-d),p=l.slice(d).join("/");return f+p}t.relative=n;function i(o){return tt.parse(o.toString()).toString()}t.normalize=i})(oe||(oe={}));var xe;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(xe||(xe={}));var Sc=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,r=B.CancellationToken.None){let n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,r)}fromTextDocument(e,r,n){return r=r??tt.parse(e.uri),B.CancellationToken.is(n)?this.createAsync(r,e,n):this.create(r,e,n)}fromString(e,r,n){return B.CancellationToken.is(n)?this.createAsync(r,e,n):this.create(r,e,n)}fromModel(e,r){return this.create(r,{$model:e})}create(e,r,n){if(typeof r=="string"){let i=this.parse(e,r,n);return this.createLangiumDocument(i,e,void 0,r)}else if("$model"in r){let i={value:r.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,e)}else{let i=this.parse(e,r.getText(),n);return this.createLangiumDocument(i,e,r)}}async createAsync(e,r,n){if(typeof r=="string"){let i=await this.parseAsync(e,r,n);return this.createLangiumDocument(i,e,void 0,r)}else{let i=await this.parseAsync(e,r.getText(),n);return this.createLangiumDocument(i,e,r)}}createLangiumDocument(e,r,n,i){let o;if(n)o={parseResult:e,uri:r,state:xe.Parsed,references:[],textDocument:n};else{let s=this.createTextDocumentGetter(r,i);o={parseResult:e,uri:r,state:xe.Parsed,references:[],get textDocument(){return s()}}}return e.value.$document=o,o}async update(e,r){var n,i;let o=(n=e.parseResult.value.$cstNode)===null||n===void 0?void 0:n.root.fullText,s=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),a=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{let c=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:c})}return o!==a&&(e.parseResult=await this.parseAsync(e.uri,a,r),e.parseResult.value.$document=e),e.state=xe.Parsed,e}parse(e,r,n){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r,n)}parseAsync(e,r,n){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(r,n)}createTextDocumentGetter(e,r){let n=this.serviceRegistry,i;return()=>i??(i=Yn.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,r??""))}},Ec=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return Z(this.documentMap.values())}addDocument(e){let r=e.uri.toString();if(this.documentMap.has(r))throw new Error(`A document with the URI '${r}' is already present.`);this.documentMap.set(r,e)}getDocument(e){let r=e.toString();return this.documentMap.get(r)}async getOrCreateDocument(e,r){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,r),this.addDocument(n),n)}createDocument(e,r,n){if(n)return this.langiumDocumentFactory.fromString(r,e,n).then(i=>(this.addDocument(i),i));{let i=this.langiumDocumentFactory.fromString(r,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(this.serviceRegistry.getServices(e).references.Linker.unlink(n),n.state=xe.Changed,n.precomputedScopes=void 0,n.diagnostics=void 0),n}deleteDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=xe.Changed,this.documentMap.delete(r)),n}};var ag=Symbol("ref_resolving"),Ac=class{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,r=B.CancellationToken.None){for(let n of mr(e.parseResult.value))await Be(r),Bo(n).forEach(i=>this.doLink(i,e))}doLink(e,r){var n;let i=e.reference;if(i._ref===void 0){i._ref=ag;try{let o=this.getCandidate(e);if(li(o))i._ref=o;else if(i._nodeDescription=o,this.langiumDocuments().hasDocument(o.documentUri)){let s=this.loadAstNode(o);i._ref=s??this.createLinkingError(e,o)}else i._ref=void 0}catch(o){console.error(`An error occurred while resolving reference to '${i.$refText}':`,o);let s=(n=o.message)!==null&&n!==void 0?n:String(o);i._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${i.$refText}': ${s}`})}r.references.push(i)}}unlink(e){for(let r of e.references)delete r._ref,delete r._nodeDescription;e.references=[]}getCandidate(e){let n=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return n??this.createLinkingError(e)}buildReference(e,r,n,i){let o=this,s={$refNode:n,$refText:i,get ref(){var a;if(we(this._ref))return this._ref;if(yh(this._nodeDescription)){let c=o.loadAstNode(this._nodeDescription);this._ref=c??o.createLinkingError({reference:s,container:e,property:r},this._nodeDescription)}else if(this._ref===void 0){this._ref=ag;let c=wa(e).$document,u=o.getLinkedNode({reference:s,container:e,property:r});if(u.error&&c&&c.state<xe.ComputedScopes)return this._ref=void 0;this._ref=(a=u.node)!==null&&a!==void 0?a:u.error,this._nodeDescription=u.descr,c?.references.push(this)}else if(this._ref===ag)throw new Error(`Cyclic reference resolution detected: ${o.astNodeLocator.getAstNodePath(e)}/${r} (symbol '${i}')`);return we(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return li(this._ref)?this._ref:void 0}};return s}getLinkedNode(e){var r;try{let n=this.getCandidate(e);if(li(n))return{error:n};let i=this.loadAstNode(n);return i?{node:i,descr:n}:{descr:n,error:this.createLinkingError(e,n)}}catch(n){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,n);let i=(r=n.message)!==null&&r!==void 0?r:String(n);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${i}`})}}}loadAstNode(e){if(e.node)return e.node;let r=this.langiumDocuments().getDocument(e.documentUri);if(r)return this.astNodeLocator.getAstNode(r.parseResult.value,e.path)}createLinkingError(e,r){let n=wa(e.container).$document;n&&n.state<xe.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);let i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:r})}};function _d(t){return typeof t.name=="string"}var wc=class{getName(e){if(_d(e))return e.name}getNameNode(e){return $a(e.$cstNode,"name")}};var Nc=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let r=tp(e),n=e.astNode;if(r&&n){let i=n[r.feature];if(Rt(i))return i.ref;if(Array.isArray(i)){for(let o of i)if(Rt(o)&&o.$refNode&&o.$refNode.offset<=e.offset&&o.$refNode.end>=e.end)return o.ref}}if(n){let i=this.nameProvider.getNameNode(n);if(i&&(i===e||Th(e,i)))return n}}}findDeclarationNode(e){let r=this.findDeclaration(e);if(r?.$cstNode){let n=this.nameProvider.getNameNode(r);return n??r.$cstNode}}findReferences(e,r){let n=[];if(r.includeDeclaration){let o=this.getReferenceToSelf(e);o&&n.push(o)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return r.documentUri&&(i=i.filter(o=>oe.equals(o.sourceUri,r.documentUri))),n.push(...i),Z(n)}getReferenceToSelf(e){let r=this.nameProvider.getNameNode(e);if(r){let n=rt(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:fi(r),local:!0}}}};var Pr=class{constructor(e){if(this.map=new Map,e)for(let[r,n]of e)this.add(r,n)}get size(){return Zi.sum(Z(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,r){if(r===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let i=n.indexOf(r);if(i>=0)return n.length===1?this.map.delete(e):n.splice(i,1),!0}return!1}}get(e){var r;return(r=this.map.get(e))!==null&&r!==void 0?r:[]}has(e,r){if(r===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(r)>=0:!1}}add(e,r){return this.map.has(e)?this.map.get(e).push(r):this.map.set(e,[r]),this}addAll(e,r){return this.map.has(e)?this.map.get(e).push(...r):this.map.set(e,Array.from(r)),this}forEach(e){this.map.forEach((r,n)=>r.forEach(i=>e(i,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return Z(this.map.entries()).flatMap(([e,r])=>r.map(n=>[e,n]))}keys(){return Z(this.map.keys())}values(){return Z(this.map.values()).flat()}entriesGroupedByKey(){return Z(this.map.entries())}},qi=class{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[r,n]of e)this.set(r,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,r){return this.map.set(e,r),this.inverse.set(r,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let r=this.map.get(e);return r!==void 0?(this.map.delete(e),this.inverse.delete(r),!0):!1}};var Pc=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,r=B.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,r)}async computeExportsForNode(e,r,n=yi,i=B.CancellationToken.None){let o=[];this.exportNode(e,o,r);for(let s of n(e))await Be(i),this.exportNode(s,o,r);return o}exportNode(e,r,n){let i=this.nameProvider.getName(e);i&&r.push(this.descriptions.createDescription(e,i,n))}async computeLocalScopes(e,r=B.CancellationToken.None){let n=e.parseResult.value,i=new Pr;for(let o of cr(n))await Be(r),this.processNode(o,e,i);return i}processNode(e,r,n){let i=e.$container;if(i){let o=this.nameProvider.getName(e);o&&n.add(i,this.descriptions.createDescription(e,o,r))}}};var Hs=class{constructor(e,r,n){var i;this.elements=e,this.outerScope=r,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let r=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===e.toLowerCase()):this.elements.find(n=>n.name===e);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}},Dc=class{constructor(e,r,n){var i;this.elements=new Map,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1;for(let o of e){let s=this.caseInsensitive?o.name.toLowerCase():o.name;this.elements.set(s,o)}this.outerScope=r}getElement(e){let r=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(r);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=Z(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},FF={getElement(){},getAllElements(){return va}};var Gs=class{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}},Ic=class extends Gs{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,r){this.throwIfDisposed(),this.cache.set(e,r)}get(e,r){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(r){let n=r();return this.cache.set(e,n),n}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},Ui=class extends Gs{constructor(e){super(),this.cache=new Map,this.converter=e??(r=>r)}has(e,r){return this.throwIfDisposed(),this.cacheForContext(e).has(r)}set(e,r,n){this.throwIfDisposed(),this.cacheForContext(e).set(r,n)}get(e,r,n){this.throwIfDisposed();let i=this.cacheForContext(e);if(i.has(r))return i.get(r);if(n){let o=n();return i.set(r,o),o}else return}delete(e,r){return this.throwIfDisposed(),this.cacheForContext(e).delete(r)}clear(e){if(this.throwIfDisposed(),e){let r=this.converter(e);this.cache.delete(r)}else this.cache.clear()}cacheForContext(e){let r=this.converter(e),n=this.cache.get(r);return n||(n=new Map,this.cache.set(r,n)),n}},bd=class extends Ui{constructor(e,r){super(n=>n.toString()),r?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(r,n=>{this.clear(n.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{for(let o of i)this.clear(o)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{let o=n.concat(i);for(let s of o)this.clear(s)}))}},zs=class extends Ic{constructor(e,r){super(),r?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(r,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}};var Oc=class{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new zs(e.shared)}getScope(e){let r=[],n=this.reflection.getReferenceType(e),i=rt(e.container).precomputedScopes;if(i){let s=e.container;do{let a=i.get(s);a.length>0&&r.push(Z(a).filter(c=>this.reflection.isSubtype(c.type,n))),s=s.$container}while(s)}let o=this.getGlobalScope(n,e);for(let s=r.length-1;s>=0;s--)o=this.createScope(r[s],o);return o}createScope(e,r,n){return new Hs(Z(e),r,n)}createScopeForNodes(e,r,n){let i=Z(e).map(o=>{let s=this.nameProvider.getName(o);if(s)return this.descriptions.createDescription(o,s)}).nonNullable();return new Hs(i,r,n)}getGlobalScope(e,r){return this.globalScopeCache.get(e,()=>new Dc(this.indexManager.allElements(e)))}};function Mc(t){return typeof t.$comment=="string"}function cb(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}var Lc=class{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,r){let n=r??{},i=r?.replacer,o=(a,c)=>this.replacer(a,c,n),s=i?(a,c)=>i(a,c,o):o;try{return this.currentDocument=rt(e),JSON.stringify(e,s,r?.space)}finally{this.currentDocument=void 0}}deserialize(e,r){let n=r??{},i=JSON.parse(e);return this.linkNode(i,i,n),i}replacer(e,r,{refText:n,sourceText:i,textRegions:o,comments:s,uriConverter:a}){var c,u,l,d;if(!this.ignoreProperties.has(e))if(Rt(r)){let f=r.ref,p=n?r.$refText:void 0;if(f){let v=rt(f),T="";this.currentDocument&&this.currentDocument!==v&&(a?T=a(v.uri,r):T=v.uri.toString());let k=this.astNodeLocator.getAstNodePath(f);return{$ref:`${T}#${k}`,$refText:p}}else return{$error:(u=(c=r.error)===null||c===void 0?void 0:c.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:p}}else if(we(r)){let f;if(o&&(f=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},r)),(!e||r.$document)&&f?.$textRegion&&(f.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(f??(f=Object.assign({},r)),f.$sourceText=(d=r.$cstNode)===null||d===void 0?void 0:d.text),s){f??(f=Object.assign({},r));let p=this.commentProvider.getComment(r);p&&(f.$comment=p.replace(/\r/g,""))}return f??r}else return r}addAstNodeRegionWithAssignmentsTo(e){let r=n=>({offset:n.offset,end:n.end,length:n.length,range:n.range});if(e.$cstNode){let n=e.$textRegion=r(e.$cstNode),i=n.assignments={};return Object.keys(e).filter(o=>!o.startsWith("$")).forEach(o=>{let s=Jh(e.$cstNode,o).map(r);s.length!==0&&(i[o]=s)}),e}}linkNode(e,r,n,i,o,s){for(let[c,u]of Object.entries(e))if(Array.isArray(u))for(let l=0;l<u.length;l++){let d=u[l];cb(d)?u[l]=this.reviveReference(e,c,r,d,n):we(d)&&this.linkNode(d,r,n,e,c,l)}else cb(u)?e[c]=this.reviveReference(e,c,r,u,n):we(u)&&this.linkNode(u,r,n,e,c);let a=e;a.$container=i,a.$containerProperty=o,a.$containerIndex=s}reviveReference(e,r,n,i,o){let s=i.$refText,a=i.$error;if(i.$ref){let c=this.getRefNode(n,i.$ref,o.uriConverter);if(we(c))return s||(s=this.nameProvider.getName(c)),{$refText:s??"",ref:c};a=c}if(a){let c={$refText:s??""};return c.error={container:e,property:r,message:a,reference:c},c}else return}getRefNode(e,r,n){try{let i=r.indexOf("#");if(i===0){let c=this.astNodeLocator.getAstNode(e,r.substring(1));return c||"Could not resolve path: "+r}if(i<0){let c=n?n(r):tt.parse(r),u=this.langiumDocuments.getDocument(c);return u?u.parseResult.value:"Could not find document for URI: "+r}let o=n?n(r.substring(0,i)):tt.parse(r.substring(0,i)),s=this.langiumDocuments.getDocument(o);if(!s)return"Could not find document for URI: "+r;if(i===r.length-1)return s.parseResult.value;let a=this.astNodeLocator.getAstNode(s.parseResult.value,r.substring(i+1));return a||"Could not resolve URI: "+r}catch(i){return String(i)}}};var Fc=class{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=e?.workspace.TextDocuments}register(e){let r=e.LanguageMetaData;for(let n of r.fileExtensions)this.fileExtensionMap.has(n)&&console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${r.languageId}'.`),this.fileExtensionMap.set(n,e);if(r.fileNames)for(let n of r.fileNames)this.fileNameMap.has(n)&&console.warn(`The file name ${n} is used by multiple languages. It is now assigned to '${r.languageId}'.`),this.fileNameMap.set(n,e);this.languageIdMap.set(r.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){var r,n,i;if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let o=(n=(r=this.textDocuments)===null||r===void 0?void 0:r.get(e))===null||n===void 0?void 0:n.languageId;if(o!==void 0){let u=this.languageIdMap.get(o);if(u)return u}let s=oe.extname(e),a=oe.basename(e),c=(i=this.fileNameMap.get(a))!==null&&i!==void 0?i:this.fileExtensionMap.get(s);if(!c)throw o?new Error(`The service registry contains no services for the extension '${s}' for language '${o}'.`):new Error(`The service registry contains no services for the extension '${s}'.`);return c}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}};function ji(t){return{code:t}}var Ks;(function(t){t.all=["fast","slow","built-in"]})(Ks||(Ks={}));var $c=class{constructor(e){this.entries=new Pr,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,r=this,n="fast"){if(n==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(let[i,o]of Object.entries(e)){let s=o;if(Array.isArray(s))for(let a of s){let c={check:this.wrapValidationException(a,r),category:n};this.addEntry(i,c)}else if(typeof s=="function"){let a={check:this.wrapValidationException(s,r),category:n};this.addEntry(i,a)}else Fr(s)}}wrapValidationException(e,r){return async(n,i,o)=>{await this.handleException(()=>e.call(r,n,i,o),"An error occurred during validation",i,n)}}async handleException(e,r,n,i){try{await e()}catch(o){if(en(o))throw o;console.error(`${r}:`,o),o instanceof Error&&o.stack&&console.error(o.stack);let s=o instanceof Error?o.message:String(o);n("error",`${r}: ${s}`,{node:i})}}addEntry(e,r){if(e==="AstNode"){this.entries.add("AstNode",r);return}for(let n of this.reflection.getAllSubTypes(e))this.entries.add(n,r)}getChecks(e,r){let n=Z(this.entries.get(e)).concat(this.entries.get("AstNode"));return r&&(n=n.filter(i=>r.includes(i.category))),n.map(i=>i.check)}registerBeforeDocument(e,r=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",r))}registerAfterDocument(e,r=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",r))}wrapPreparationException(e,r,n){return async(i,o,s,a)=>{await this.handleException(()=>e.call(n,i,o,s,a),r,o,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}};var Wi=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,r={},n=B.CancellationToken.None){let i=e.parseResult,o=[];if(await Be(n),(!r.categories||r.categories.includes("built-in"))&&(this.processLexingErrors(i,o,r),r.stopAfterLexingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===xr.LexingError})||(this.processParsingErrors(i,o,r),r.stopAfterParsingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===xr.ParsingError}))||(this.processLinkingErrors(e,o,r),r.stopAfterLinkingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===xr.LinkingError}))))return o;try{o.push(...await this.validateAst(i.value,r,n))}catch(s){if(en(s))throw s;console.error("An error occurred during validation:",s)}return await Be(n),o}processLexingErrors(e,r,n){var i,o,s;let a=[...e.lexerErrors,...(o=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&o!==void 0?o:[]];for(let c of a){let u=(s=c.severity)!==null&&s!==void 0?s:"error",l={severity:Cd(u),range:{start:{line:c.line-1,character:c.column-1},end:{line:c.line-1,character:c.column+c.length-1}},message:c.message,data:lb(u),source:this.getSource()};r.push(l)}}processParsingErrors(e,r,n){for(let i of e.parserErrors){let o;if(isNaN(i.token.startOffset)){if("previousToken"in i){let s=i.previousToken;if(isNaN(s.startOffset)){let a={line:0,character:0};o={start:a,end:a}}else{let a={line:s.endLine-1,character:s.endColumn};o={start:a,end:a}}}}else o=eo(i.token);if(o){let s={severity:Cd("error"),range:o,message:i.message,data:ji(xr.ParsingError),source:this.getSource()};r.push(s)}}}processLinkingErrors(e,r,n){for(let i of e.references){let o=i.error;if(o){let s={node:o.container,property:o.property,index:o.index,data:{code:xr.LinkingError,containerType:o.container.$type,property:o.property,refText:o.reference.$refText}};r.push(this.toDiagnostic("error",o.message,s))}}}async validateAst(e,r,n=B.CancellationToken.None){let i=[],o=(s,a,c)=>{i.push(this.toDiagnostic(s,a,c))};return await this.validateAstBefore(e,r,o,n),await this.validateAstNodes(e,r,o,n),await this.validateAstAfter(e,r,o,n),i}async validateAstBefore(e,r,n,i=B.CancellationToken.None){var o;let s=this.validationRegistry.checksBefore;for(let a of s)await Be(i),await a(e,n,(o=r.categories)!==null&&o!==void 0?o:[],i)}async validateAstNodes(e,r,n,i=B.CancellationToken.None){await Promise.all(mr(e).map(async o=>{await Be(i);let s=this.validationRegistry.getChecks(o.$type,r.categories);for(let a of s)await a(o,n,i)}))}async validateAstAfter(e,r,n,i=B.CancellationToken.None){var o;let s=this.validationRegistry.checksAfter;for(let a of s)await Be(i),await a(e,n,(o=r.categories)!==null&&o!==void 0?o:[],i)}toDiagnostic(e,r,n){return{message:r,range:ub(n),severity:Cd(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};function ub(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=$a(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=Zh(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Cd(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}function lb(t){switch(t){case"error":return ji(xr.LexingError);case"warning":return ji(xr.LexingWarning);case"info":return ji(xr.LexingInfo);case"hint":return ji(xr.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var xr;(function(t){t.LexingError="lexing-error",t.LexingWarning="lexing-warning",t.LexingInfo="lexing-info",t.LexingHint="lexing-hint",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(xr||(xr={}));var qc=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,r,n){let i=n??rt(e);r??(r=this.nameProvider.getName(e));let o=this.astNodeLocator.getAstNodePath(e);if(!r)throw new Error(`Node at path ${o} has no name.`);let s,a=()=>{var c;return s??(s=fi((c=this.nameProvider.getNameNode(e))!==null&&c!==void 0?c:e.$cstNode))};return{node:e,name:r,get nameSegment(){return a()},selectionSegment:fi(e.$cstNode),type:e.$type,documentUri:i.uri,path:o}}},Uc=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,r=B.CancellationToken.None){let n=[],i=e.parseResult.value;for(let o of mr(i))await Be(r),Bo(o).filter(s=>!li(s)).forEach(s=>{let a=this.createDescription(s);a&&n.push(a)});return n}createDescription(e){let r=e.reference.$nodeDescription,n=e.reference.$refNode;if(!r||!n)return;let i=rt(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:r.documentUri,targetPath:r.path,segment:fi(n),local:oe.equals(r.documentUri,i)}}};var jc=class{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let r=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return r+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:r}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return r!==void 0?e+this.indexSeparator+r:e}getAstNode(e,r){return r.split(this.segmentSeparator).reduce((i,o)=>{if(!i||o.length===0)return i;let s=o.indexOf(this.indexSeparator);if(s>0){let a=o.substring(0,s),c=parseInt(o.substring(s+1)),u=i[a];return u?.[c]}return i[o]},e)}};var Pe={};se(Pe,hr($i(),1));var Wc=class{constructor(e){this._ready=new Wt,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new Pe.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var r,n;this.workspaceConfig=(n=(r=e.capabilities.workspace)===null||r===void 0?void 0:r.configuration)!==null&&n!==void 0?n:!1}async initialized(e){if(this.workspaceConfig){if(e.register){let r=this.serviceRegistry.all;e.register({section:r.map(n=>this.toSectionName(n.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let r=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await e.fetchConfiguration(r);r.forEach((i,o)=>{this.updateSectionConfiguration(i.section,n[o])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(r=>{let n=e.settings[r];this.updateSectionConfiguration(r,n),this.onConfigurationSectionUpdateEmitter.fire({section:r,configuration:n})})}updateSectionConfiguration(e,r){this.settings[e]=r}async getConfiguration(e,r){await this.ready;let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][r]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}};var Jn;(function(t){function e(r){return{dispose:async()=>await r()}}t.create=e})(Jn||(Jn={}));var Bc=class{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Pr,this.documentPhaseListeners=new Pr,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=xe.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,r={},n=B.CancellationToken.None){var i,o;for(let s of e){let a=s.uri.toString();if(s.state===xe.Validated){if(typeof r.validation=="boolean"&&r.validation)s.state=xe.IndexedReferences,s.diagnostics=void 0,this.buildState.delete(a);else if(typeof r.validation=="object"){let c=this.buildState.get(a),u=(i=c?.result)===null||i===void 0?void 0:i.validationChecks;if(u){let d=((o=r.validation.categories)!==null&&o!==void 0?o:Ks.all).filter(f=>!u.includes(f));d.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},r.validation),{categories:d})},result:c.result}),s.state=xe.IndexedReferences)}}}else this.buildState.delete(a)}this.currentState=xe.Changed,await this.emitUpdate(e.map(s=>s.uri),[]),await this.buildDocuments(e,r,n)}async update(e,r,n=B.CancellationToken.None){this.currentState=xe.Changed;for(let s of r)this.langiumDocuments.deleteDocument(s),this.buildState.delete(s.toString()),this.indexManager.remove(s);for(let s of e){if(!this.langiumDocuments.invalidateDocument(s)){let c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},s);c.state=xe.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(s.toString())}let i=Z(e).concat(r).map(s=>s.toString()).toSet();this.langiumDocuments.all.filter(s=>!i.has(s.uri.toString())&&this.shouldRelink(s,i)).forEach(s=>{this.serviceRegistry.getServices(s.uri).references.Linker.unlink(s),s.state=Math.min(s.state,xe.ComputedScopes),s.diagnostics=void 0}),await this.emitUpdate(e,r),await Be(n);let o=this.sortDocuments(this.langiumDocuments.all.filter(s=>{var a;return s.state<xe.Linked||!(!((a=this.buildState.get(s.uri.toString()))===null||a===void 0)&&a.completed)}).toArray());await this.buildDocuments(o,this.updateBuildOptions,n)}async emitUpdate(e,r){await Promise.all(this.updateListeners.map(n=>n(e,r)))}sortDocuments(e){let r=0,n=e.length-1;for(;r<n;){for(;r<e.length&&this.hasTextDocument(e[r]);)r++;for(;n>=0&&!this.hasTextDocument(e[n]);)n--;r<n&&([e[r],e[n]]=[e[n],e[r]])}return e}hasTextDocument(e){var r;return!!(!((r=this.textDocuments)===null||r===void 0)&&r.get(e.uri))}shouldRelink(e,r){return e.references.some(n=>n.error!==void 0)?!0:this.indexManager.isAffected(e,r)}onUpdate(e){return this.updateListeners.push(e),Jn.create(()=>{let r=this.updateListeners.indexOf(e);r>=0&&this.updateListeners.splice(r,1)})}async buildDocuments(e,r,n){this.prepareBuild(e,r),await this.runCancelable(e,xe.Parsed,n,s=>this.langiumDocumentFactory.update(s,n)),await this.runCancelable(e,xe.IndexedContent,n,s=>this.indexManager.updateContent(s,n)),await this.runCancelable(e,xe.ComputedScopes,n,async s=>{let a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await a.computeLocalScopes(s,n)});let i=e.filter(s=>this.shouldLink(s));await this.runCancelable(i,xe.Linked,n,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,n)),await this.runCancelable(i,xe.IndexedReferences,n,s=>this.indexManager.updateReferences(s,n));let o=e.filter(s=>this.shouldValidate(s));await this.runCancelable(o,xe.Validated,n,s=>this.validate(s,n));for(let s of e){let a=this.buildState.get(s.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,r){for(let n of e){let i=n.uri.toString(),o=this.buildState.get(i);(!o||o.completed)&&this.buildState.set(i,{completed:!1,options:r,result:o?.result})}}async runCancelable(e,r,n,i){let o=e.filter(a=>a.state<r);for(let a of o)await Be(n),await i(a),a.state=r,await this.notifyDocumentPhase(a,r,n);let s=e.filter(a=>a.state===r);await this.notifyBuildPhase(s,r,n),this.currentState=r}onBuildPhase(e,r){return this.buildPhaseListeners.add(e,r),Jn.create(()=>{this.buildPhaseListeners.delete(e,r)})}onDocumentPhase(e,r){return this.documentPhaseListeners.add(e,r),Jn.create(()=>{this.documentPhaseListeners.delete(e,r)})}waitUntil(e,r,n){let i;if(r&&"path"in r?i=r:n=r,n??(n=B.CancellationToken.None),i){let o=this.langiumDocuments.getDocument(i);if(o&&o.state>=e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Zr):new Promise((o,s)=>{let a=this.onBuildPhase(e,()=>{if(a.dispose(),c.dispose(),i){let u=this.langiumDocuments.getDocument(i);o(u?.uri)}else o(void 0)}),c=n.onCancellationRequested(()=>{a.dispose(),c.dispose(),s(Zr)})})}async notifyDocumentPhase(e,r,n){let o=this.documentPhaseListeners.get(r).slice();for(let s of o)try{await s(e,n)}catch(a){if(!en(a))throw a}}async notifyBuildPhase(e,r,n){if(e.length===0)return;let o=this.buildPhaseListeners.get(r).slice();for(let s of o)await Be(n),await s(e,n)}shouldLink(e){var r;return(r=this.getBuildOptions(e).eagerLinking)!==null&&r!==void 0?r:!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,r){var n,i;let o=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,s=this.getBuildOptions(e).validation,a=typeof s=="object"?s:void 0,c=await o.validateDocument(e,a,r);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;let u=this.buildState.get(e.uri.toString());if(u){(n=u.result)!==null&&n!==void 0||(u.result={});let l=(i=a?.categories)!==null&&i!==void 0?i:Ks.all;u.result.validationChecks?u.result.validationChecks.push(...l):u.result.validationChecks=[...l]}}getBuildOptions(e){var r,n;return(n=(r=this.buildState.get(e.uri.toString()))===null||r===void 0?void 0:r.options)!==null&&n!==void 0?n:{}}};var Hc=class{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Ui,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,r){let n=rt(e).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(s=>{oe.equals(s.targetUri,n)&&s.targetPath===r&&i.push(s)})}),Z(i)}allElements(e,r){let n=Z(this.symbolIndex.keys());return r&&(n=n.filter(i=>!r||r.has(i))),n.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,r){var n;return r?this.symbolByTypeIndex.get(e,r,()=>{var o;return((o=this.symbolIndex.get(e))!==null&&o!==void 0?o:[]).filter(a=>this.astReflection.isSubtype(a.type,r))}):(n=this.symbolIndex.get(e))!==null&&n!==void 0?n:[]}remove(e){let r=e.toString();this.symbolIndex.delete(r),this.symbolByTypeIndex.clear(r),this.referenceIndex.delete(r)}async updateContent(e,r=B.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,r),o=e.uri.toString();this.symbolIndex.set(o,i),this.symbolByTypeIndex.clear(o)}async updateReferences(e,r=B.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,r);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,r){let n=this.referenceIndex.get(e.uri.toString());return n?n.some(i=>!i.local&&r.has(i.targetUri.toString())):!1}};var Gc=class{constructor(e){this.initialBuildOptions={},this._ready=new Wt,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){var r;this.folders=(r=e.workspaceFolders)!==null&&r!==void 0?r:void 0}initialized(e){return this.mutex.write(r=>{var n;return this.initializeWorkspace((n=this.folders)!==null&&n!==void 0?n:[],r)})}async initializeWorkspace(e,r=B.CancellationToken.None){let n=await this.performStartup(e);await Be(r),await this.documentBuilder.build(n,this.initialBuildOptions,r)}async performStartup(e){let r=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),n=this.serviceRegistry.all.flatMap(s=>{var a;return(a=s.LanguageMetaData.fileNames)!==null&&a!==void 0?a:[]}),i=[],o=s=>{i.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,o),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,{fileExtensions:r,fileNames:n},o))),this._ready.resolve(),i}loadAdditionalDocuments(e,r){return Promise.resolve()}getRootFolder(e){return tt.parse(e.uri)}async traverseFolder(e,r,n,i){let o=await this.fileSystemProvider.readDirectory(r);await Promise.all(o.map(async s=>{if(this.includeEntry(e,s,n)){if(s.isDirectory)await this.traverseFolder(e,s.uri,n,i);else if(s.isFile){let a=await this.langiumDocuments.getOrCreateDocument(s.uri);i(a)}}}))}includeEntry(e,r,n){let i=oe.basename(r.uri);return i.startsWith(".")?!1:r.isDirectory?i!=="node_modules"&&i!=="out":r.isFile?n.fileExtensions.includes(oe.extname(r.uri))||n.fileNames.includes(oe.basename(r.uri)):!1}};var zc=class{buildUnexpectedCharactersMessage(e,r,n,i,o){return Rs.buildUnexpectedCharactersMessage(e,r,n,i,o)}buildUnableToPopLexerModeMessage(e){return Rs.buildUnableToPopLexerModeMessage(e)}},kd={mode:"full"},Bi=class{constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;let r=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(r);let n=cg(r)?Object.values(r):r,i=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new Me(n,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,r=kd){var n,i,o;let s=this.chevrotainLexer.tokenize(e);return{tokens:s.tokens,errors:s.errors,hidden:(n=s.groups.hidden)!==null&&n!==void 0?n:[],report:(o=(i=this.tokenBuilder).flushLexingReport)===null||o===void 0?void 0:o.call(i,e)}}toTokenTypeDictionary(e){if(cg(e))return e;let r=ug(e)?Object.values(e.modes).flat():e,n={};return r.forEach(i=>n[i.name]=i),n}};function Sd(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function ug(t){return t&&"modes"in t&&"defaultMode"in t}function cg(t){return!Sd(t)&&!ug(t)}Ii();function Xc(t,e,r){let n,i;typeof t=="string"?(i=e,n=r):(i=t.range.start,n=e),i||(i=ce.create(0,0));let o=hb(t),s=fg(n),a=qF({lines:o,position:i,options:s});return HF({index:0,tokens:a,position:i})}function Yc(t,e){let r=fg(e),n=hb(t);if(n.length===0)return!1;let i=n[0],o=n[n.length-1],s=r.start,a=r.end;return!!s?.exec(i)&&!!a?.exec(o)}function hb(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(Gh)}var db=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,$F=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function qF(t){var e,r,n;let i=[],o=t.position.line,s=t.position.character;for(let a=0;a<t.lines.length;a++){let c=a===0,u=a===t.lines.length-1,l=t.lines[a],d=0;if(c&&t.options.start){let p=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);p&&(d=p.index+p[0].length)}else{let p=(r=t.options.line)===null||r===void 0?void 0:r.exec(l);p&&(d=p.index+p[0].length)}if(u){let p=(n=t.options.end)===null||n===void 0?void 0:n.exec(l);p&&(l=l.substring(0,p.index))}if(l=l.substring(0,BF(l)),dg(l,d)>=l.length){if(i.length>0){let p=ce.create(o,s);i.push({type:"break",content:"",range:te.create(p,p)})}}else{db.lastIndex=d;let p=db.exec(l);if(p){let v=p[0],T=p[1],k=ce.create(o,s+d),R=ce.create(o,s+d+v.length);i.push({type:"tag",content:T,range:te.create(k,R)}),d+=v.length,d=dg(l,d)}if(d<l.length){let v=l.substring(d),T=Array.from(v.matchAll($F));i.push(...UF(T,v,o,s+d))}}o++,s=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function UF(t,e,r,n){let i=[];if(t.length===0){let o=ce.create(r,n),s=ce.create(r,n+e.length);i.push({type:"text",content:e,range:te.create(o,s)})}else{let o=0;for(let a of t){let c=a.index,u=e.substring(o,c);u.length>0&&i.push({type:"text",content:e.substring(o,c),range:te.create(ce.create(r,o+n),ce.create(r,c+n))});let l=u.length+1,d=a[1];if(i.push({type:"inline-tag",content:d,range:te.create(ce.create(r,o+l+n),ce.create(r,o+l+d.length+n))}),l+=d.length,a.length===4){l+=a[2].length;let f=a[3];i.push({type:"text",content:f,range:te.create(ce.create(r,o+l+n),ce.create(r,o+l+f.length+n))})}else i.push({type:"text",content:"",range:te.create(ce.create(r,o+l+n),ce.create(r,o+l+n))});o=c+a[0].length}let s=e.substring(o);s.length>0&&i.push({type:"text",content:s,range:te.create(ce.create(r,o+n),ce.create(r,o+n+s.length))})}return i}var jF=/\S/,WF=/\s*$/;function dg(t,e){let r=t.substring(e).match(jF);return r?e+r.index:t.length}function BF(t){let e=t.match(WF);if(e&&typeof e.index=="number")return e.index}function HF(t){var e,r,n,i;let o=ce.create(t.position.line,t.position.character);if(t.tokens.length===0)return new Ed([],te.create(o,o));let s=[];for(;t.index<t.tokens.length;){let u=GF(t,s[s.length-1]);u&&s.push(u)}let a=(r=(e=s[0])===null||e===void 0?void 0:e.range.start)!==null&&r!==void 0?r:o,c=(i=(n=s[s.length-1])===null||n===void 0?void 0:n.range.end)!==null&&i!==void 0?i:o;return new Ed(s,te.create(a,c))}function GF(t,e){let r=t.tokens[t.index];if(r.type==="tag")return mb(t,!1);if(r.type==="text"||r.type==="inline-tag")return pb(t);zF(r,e),t.index++}function zF(t,e){if(e){let r=new Ad("",t.range);"inlines"in e?e.inlines.push(r):e.content.inlines.push(r)}}function pb(t){let e=t.tokens[t.index],r=e,n=e,i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(KF(t)),n=e,e=t.tokens[t.index];return new Vc(i,te.create(r.range.start,n.range.end))}function KF(t){return t.tokens[t.index].type==="inline-tag"?mb(t,!0):gb(t)}function mb(t,e){let r=t.tokens[t.index++],n=r.content.substring(1),i=t.tokens[t.index];if(i?.type==="text")if(e){let o=gb(t);return new Kc(n,new Vc([o],o.range),e,te.create(r.range.start,o.range.end))}else{let o=pb(t);return new Kc(n,o,e,te.create(r.range.start,o.range.end))}else{let o=r.range;return new Kc(n,new Vc([],o),e,o)}}function gb(t){let e=t.tokens[t.index++];return new Ad(e.content,e.range)}function fg(t){if(!t)return fg({start:"/**",end:"*/",line:"*"});let{start:e,end:r,line:n}=t;return{start:lg(e,!0),end:lg(r,!1),line:lg(n,!0)}}function lg(t,e){if(typeof t=="string"||typeof t=="object"){let r=typeof t=="string"?wn(t):t.source;return e?new RegExp(`^\\s*${r}`):new RegExp(`\\s*${r}\\s*$`)}else return t}var Ed=class{constructor(e,r){this.elements=e,this.range=r}getTag(e){return this.getAllTags().find(r=>r.name===e)}getTags(e){return this.getAllTags().filter(r=>r.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(let r of this.elements)if(e.length===0)e=r.toString();else{let n=r.toString();e+=fb(e)+n}return e.trim()}toMarkdown(e){let r="";for(let n of this.elements)if(r.length===0)r=n.toMarkdown(e);else{let i=n.toMarkdown(e);r+=fb(r)+i}return r.trim()}},Kc=class{constructor(e,r,n,i){this.name=e,this.content=r,this.inline=n,this.range=i}toString(){let e=`@${this.name}`,r=this.content.toString();return this.content.inlines.length===1?e=`${e} ${r}`:this.content.inlines.length>1&&(e=`${e}
150
- ${r}`),this.inline?`{${e}}`:e}toMarkdown(e){var r,n;return(n=(r=e?.renderTag)===null||r===void 0?void 0:r.call(e,this))!==null&&n!==void 0?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){let r=this.content.toMarkdown(e);if(this.inline){let o=VF(this.name,r,e??{});if(typeof o=="string")return o}let n="";e?.tag==="italic"||e?.tag===void 0?n="*":e?.tag==="bold"?n="**":e?.tag==="bold-italic"&&(n="***");let i=`${n}@${this.name}${n}`;return this.content.inlines.length===1?i=`${i} \u2014 ${r}`:this.content.inlines.length>1&&(i=`${i}
151
- ${r}`),this.inline?`{${i}}`:i}};function VF(t,e,r){var n,i;if(t==="linkplain"||t==="linkcode"||t==="link"){let o=e.indexOf(" "),s=e;if(o>0){let c=dg(e,o);s=e.substring(c),e=e.substring(0,o)}return(t==="linkcode"||t==="link"&&r.link==="code")&&(s=`\`${s}\``),(i=(n=r.renderLink)===null||n===void 0?void 0:n.call(r,e,s))!==null&&i!==void 0?i:XF(e,s)}}function XF(t,e){try{return tt.parse(t,!0),`[${e}](${t})`}catch{return t}}var Vc=class{constructor(e,r){this.inlines=e,this.range=r}toString(){let e="";for(let r=0;r<this.inlines.length;r++){let n=this.inlines[r],i=this.inlines[r+1];e+=n.toString(),i&&i.range.start.line>n.range.start.line&&(e+=`
148
+ For Further details.`,n}function iF(t){if(t instanceof fe)return"SUBRULE";if(t instanceof he)return"OPTION";if(t instanceof ve)return"OR";if(t instanceof Se)return"AT_LEAST_ONE";if(t instanceof ke)return"AT_LEAST_ONE_SEP";if(t instanceof ye)return"MANY_SEP";if(t instanceof ie)return"MANY";if(t instanceof ee)return"CONSUME";throw Error("non exhaustive match")}function oF(t,e,r){let n=bt(e.configs.elements,o=>o.state.transitions),i=kR(n.filter(o=>o instanceof ws).map(o=>o.tokenType),o=>o.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:t}}function sF(t,e){return t.edges[e.tokenTypeIdx]}function aF(t,e,r){let n=new Is,i=[];for(let s of t.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===Ps){i.push(s);continue}let a=s.state.transitions.length;for(let c=0;c<a;c++){let u=s.state.transitions[c],l=cF(u,e);l!==void 0&&n.add({state:l,alt:s.alt,stack:s.stack})}}let o;if(i.length===0&&n.size===1&&(o=n),o===void 0){o=new Is;for(let s of n.elements)nd(s,o)}if(i.length>0&&!fF(o))for(let s of i)o.add(s);return o}function cF(t,e){if(t instanceof ws&&Ya(e,t.tokenType))return t.target}function uF(t,e){let r;for(let 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}function K_(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function z_(t,e,r,n){return n=V_(t,n),e.edges[r.tokenTypeIdx]=n,n}function V_(t,e){if(e===lc)return e;let r=e.configs.key,n=t.states[r];return n!==void 0?n:(e.configs.finalize(),t.states[r]=e,e)}function lF(t){let e=new Is,r=t.transitions.length;for(let n=0;n<r;n++){let o={state:t.transitions[n].target,alt:n,stack:[]};nd(o,e)}return e}function nd(t,e){let r=t.state;if(r.type===Ps){if(t.stack.length>0){let i=[...t.stack],s={state:i.pop(),alt:t.alt,stack:i};nd(s,e)}else e.add(t);return}r.epsilonOnlyTransitions||e.add(t);let n=r.transitions.length;for(let i=0;i<n;i++){let o=r.transitions[i],s=dF(t,o);s!==void 0&&nd(s,e)}}function dF(t,e){if(e instanceof uc)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof Ns){let r=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:r}}}function fF(t){for(let e of t.elements)if(e.state.type===Ps)return!0;return!1}function hF(t){for(let e of t.elements)if(e.state.type!==Ps)return!1;return!0}function pF(t){if(hF(t))return!0;let e=mF(t.elements);return gF(e)&&!yF(e)}function mF(t){let e=new Map;for(let r of t){let n=Gp(r,!1),i=e.get(n);i===void 0&&(i={},e.set(n,i)),i[r.alt]=!0}return e}function gF(t){for(let e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function yF(t){for(let e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}Ii();var xc=class{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?e:this.rootNode}buildRootNode(e){return this.rootNode=new qs(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let r=new Li;return r.grammarSource=e,r.root=this.rootNode,this.current.content.push(r),this.nodeStack.push(r),r}buildLeafNode(e,r){let n=new Oi(e.startOffset,e.image.length,to(e),e.tokenType,!r);return n.grammarSource=r,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){let r=e.container;if(r){let n=r.content.indexOf(e);n>=0&&r.content.splice(n,1)}}addHiddenNodes(e){let r=[];for(let o of e){let s=new Oi(o.startOffset,o.image.length,to(o),o.tokenType,!0);s.root=this.rootNode,r.push(s)}let n=this.current,i=!1;if(n.content.length>0){n.content.push(...r);return}for(;n.container;){let o=n.container.content.indexOf(n);if(o>0){n.container.content.splice(o,0,...r),i=!0;break}n=n.container}i||this.rootNode.content.unshift(...r)}construct(e){let r=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=r;let n=this.nodeStack.pop();n?.content.length===0&&this.removeNode(n)}},Tc=class{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,r;let n=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(r=this.container)===null||r===void 0?void 0:r.astNode;if(!n)throw new Error("This node has no associated AST element");return n}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}},Oi=class extends Tc{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,r,n,i,o=!1){super(),this._hidden=o,this._offset=e,this._tokenType=i,this._length=r,this._range=n}},Li=class extends Tc{constructor(){super(...arguments),this.content=new Xm(this)}get children(){return this.content}get offset(){var e,r;return(r=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&r!==void 0?r:0}get length(){return this.end-this.offset}get end(){var e,r;return(r=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&r!==void 0?r:0}get range(){let e=this.firstNonHiddenNode,r=this.lastNonHiddenNode;if(e&&r){if(this._rangeCache===void 0){let{range:n}=e,{range:i}=r;this._rangeCache={start:n.start,end:i.end.line<n.start.line?n.start:i.end}}return this._rangeCache}else return{start:ce.create(0,0),end:ce.create(0,0)}}get firstNonHiddenNode(){for(let e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){let r=this.content[e];if(!r.hidden)return r}return this.content[this.content.length-1]}},Xm=class t extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,t.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,r,...n){return this.addParents(n),super.splice(e,r,...n)}addParents(e){for(let r of e)r.container=this.parent}},qs=class extends Li{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}};var hd=Symbol("Datatype");function Ym(t){return t.$type===hd}var X_="\u200B",Y_=t=>t.endsWith(X_)?t:t+X_,Rc=class{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;let r=this.lexer.definition,n=e.LanguageMetaData.mode==="production";this.wrapper=new Jm(r,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:n,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,r){this.wrapper.wrapOr(e,r)}optional(e,r){this.wrapper.wrapOption(e,r)}many(e,r){this.wrapper.wrapMany(e,r)}atLeastOne(e,r){this.wrapper.wrapAtLeastOne(e,r)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},_c=class extends Rc{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new xc,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,r){let n=this.computeRuleType(e),i=this.wrapper.DEFINE_RULE(Y_(e.name),this.startImplementation(n,r).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment){if(Ua(e))return hd;{let r=qr(e);return r??e.name}}}parse(e,r={}){this.nodeBuilder.buildRootNode(e);let n=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=n.tokens;let i=r.rule?this.allRules.get(r.rule):this.mainRule;if(!i)throw new Error(r.rule?`No rule found with name '${r.rule}'`:"No main rule available.");let o=this.doParse(i);return this.nodeBuilder.addHiddenNodes(n.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:o,lexerErrors:n.errors,lexerReport:n.report,parserErrors:this.wrapper.errors}}doParse(e){let r=e.call(this.wrapper,{});if(this.stack.length>0&&(r=this.construct()),r===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return r}startImplementation(e,r){return n=>{let i=!this.isRecording()&&e!==void 0;if(i){let o={$type:e};this.stack.push(o),e===hd&&(o.value="")}return r(n),i?this.construct():void 0}}extractHiddenTokens(e){let r=this.lexerResult.hidden;if(!r.length)return[];let n=e.startOffset;for(let i=0;i<r.length;i++)if(r[i].startOffset>n)return r.splice(0,i);return r.splice(0,r.length)}consume(e,r,n){let i=this.wrapper.wrapConsume(e,r);if(!this.isRecording()&&this.isValidToken(i)){let o=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(o);let s=this.nodeBuilder.buildLeafNode(i,n),{assignment:a,isCrossRef:c}=this.getAssignment(n),u=this.current;if(a){let l=lt(n)?i.image:this.converter.convert(i.image,s);this.assign(a.operator,a.feature,l,s,c)}else if(Ym(u)){let l=i.image;lt(n)||(l=this.converter.convert(l,s).toString()),u.value+=l}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,r,n,i,o){let s;!this.isRecording()&&!n&&(s=this.nodeBuilder.buildCompositeNode(i));let a;try{a=this.wrapper.wrapSubrule(e,r,o)}finally{this.isRecording()||(a===void 0&&!n&&(a=this.construct()),a!==void 0&&s&&s.length>0&&this.performSubruleAssignment(a,i,s))}}performSubruleAssignment(e,r,n){let{assignment:i,isCrossRef:o}=this.getAssignment(r);if(i)this.assign(i.operator,i.feature,e,n,o);else if(!i){let s=this.current;if(Ym(s))s.value+=e.toString();else if(typeof e=="object"&&e){let c=this.assignWithoutOverride(e,s);this.stack.pop(),this.stack.push(c)}}}action(e,r){if(!this.isRecording()){let n=this.current;if(r.feature&&r.operator){n=this.construct(),this.nodeBuilder.removeNode(n.$cstNode),this.nodeBuilder.buildCompositeNode(r).content.push(n.$cstNode);let o={$type:e};this.stack.push(o),this.assign(r.operator,r.feature,n,n.$cstNode,!1)}else n.$type=e}}construct(){if(this.isRecording())return;let e=this.current;return qu(e),this.nodeBuilder.construct(e),this.stack.pop(),Ym(e)?this.converter.convert(e.value,e.$cstNode):(Pa(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){let r=ar(e,Et);this.assignmentMap.set(e,{assignment:r,isCrossRef:r?sr(r.terminal):!1})}return this.assignmentMap.get(e)}assign(e,r,n,i,o){let s=this.current,a;switch(o&&typeof n=="string"?a=this.linker.buildReference(s,r,i,n):a=n,e){case"=":{s[r]=a;break}case"?=":{s[r]=!0;break}case"+=":Array.isArray(s[r])||(s[r]=[]),s[r].push(a)}}assignWithoutOverride(e,r){for(let[i,o]of Object.entries(r)){let s=e[i];s===void 0?e[i]=o:Array.isArray(s)&&Array.isArray(o)&&(o.push(...s),e[i]=o)}let n=e.$cstNode;return n&&(n.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}},pd=class{buildMismatchTokenMessage(e){return xn.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return xn.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return xn.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return xn.buildEarlyExitMessage(e)}},Us=class extends pd{buildMismatchTokenMessage({expected:e,actual:r}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${r.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},bc=class extends Rc{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let r=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=r.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,r){let n=this.wrapper.DEFINE_RULE(Y_(e.name),this.startImplementation(r).bind(this));return this.allRules.set(e.name,n),e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return r=>{let n=this.keepStackSize();try{e(r)}finally{this.resetStackSize(n)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,r,n){this.wrapper.wrapConsume(e,r),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,r,n,i,o){this.before(i),this.wrapper.wrapSubrule(e,r,o),this.after(i)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let r=this.elementStack.lastIndexOf(e);r>=0&&this.elementStack.splice(r)}}get currIdx(){return this.wrapper.currIdx}},xF={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Us},Jm=class extends ac{constructor(e,r){let n=r&&"maxLookahead"in r;super(e,Object.assign(Object.assign(Object.assign({},xF),{lookaheadStrategy:n?new Tn({maxLookahead:r.maxLookahead}):new dc({logging:r.skipValidations?()=>{}:void 0})}),r))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,r,n){return this.RULE(e,r,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,r){return this.consume(e,r,void 0)}wrapSubrule(e,r,n){return this.subrule(e,r,{ARGS:[n]})}wrapOr(e,r){this.or(e,r)}wrapOption(e,r){this.option(e,r)}wrapMany(e,r){this.many(e,r)}wrapAtLeastOne(e,r){this.atLeastOne(e,r)}};function Cc(t,e,r){return TF({parser:e,tokens:r,ruleNames:new Map},t),e}function TF(t,e){let r=Fa(e,!1),n=Z(e.rules).filter(Ie).filter(i=>r.has(i));for(let i of n){let o=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(i,Mi(o,i.definition))}}function Mi(t,e,r=!1){let n;if(lt(e))n=EF(t,e);else if(Ar(e))n=RF(t,e);else if(Et(e))n=Mi(t,e.terminal);else if(sr(e))n=J_(t,e);else if(Vt(e))n=_F(t,e);else if(Wo(e))n=CF(t,e);else if(Bo(e))n=SF(t,e);else if(pr(e))n=kF(t,e);else if(Lh(e)){let i=t.consume++;n=()=>t.parser.consume(i,lr,e)}else throw new hi(e.$cstNode,`Unexpected element type: ${e.$type}`);return Q_(t,r?void 0:md(e),n,e.cardinality)}function RF(t,e){let r=_i(e);return()=>t.parser.action(r,e)}function _F(t,e){let r=e.rule.ref;if(Ie(r)){let n=t.subrule++,i=r.fragment,o=e.arguments.length>0?bF(r,e.arguments):()=>({});return s=>t.parser.subrule(n,Z_(t,r),i,e,o(s))}else if(Mt(r)){let n=t.consume++,i=Qm(t,r.name);return()=>t.parser.consume(n,i,e)}else if(r)Fr(r);else throw new hi(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function bF(t,e){let r=e.map(n=>_n(n.value));return n=>{let i={};for(let o=0;o<r.length;o++){let s=t.parameters[o],a=r[o];i[s.name]=a(n)}return i}}function _n(t){if(Ah(t)){let e=_n(t.left),r=_n(t.right);return n=>e(n)||r(n)}else if(Eh(t)){let e=_n(t.left),r=_n(t.right);return n=>e(n)&&r(n)}else if(wh(t)){let e=_n(t.value);return r=>!e(r)}else if(Nh(t)){let e=t.parameter.ref.name;return r=>r!==void 0&&r[e]===!0}else if(kh(t)){let e=!!t.true;return()=>e}Fr(t)}function CF(t,e){if(e.elements.length===1)return Mi(t,e.elements[0]);{let r=[];for(let i of e.elements){let o={ALT:Mi(t,i,!0)},s=md(i);s&&(o.GATE=_n(s)),r.push(o)}let n=t.or++;return i=>t.parser.alternatives(n,r.map(o=>{let s={ALT:()=>o.ALT(i)},a=o.GATE;return a&&(s.GATE=()=>a(i)),s}))}}function SF(t,e){if(e.elements.length===1)return Mi(t,e.elements[0]);let r=[];for(let a of e.elements){let c={ALT:Mi(t,a,!0)},u=md(a);u&&(c.GATE=_n(u)),r.push(c)}let n=t.or++,i=(a,c)=>{let u=c.getRuleStack().join("-");return`uGroup_${a}_${u}`},o=a=>t.parser.alternatives(n,r.map((c,u)=>{let l={ALT:()=>!0},d=t.parser;l.ALT=()=>{if(c.ALT(a),!d.isRecording()){let p=i(n,d);d.unorderedGroups.get(p)||d.unorderedGroups.set(p,[]);let v=d.unorderedGroups.get(p);typeof v?.[u]>"u"&&(v[u]=!0)}};let f=c.GATE;return f?l.GATE=()=>f(a):l.GATE=()=>{let p=d.unorderedGroups.get(i(n,d));return!p?.[u]},l})),s=Q_(t,md(e),o,"*");return a=>{s(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(n,t.parser))}}function kF(t,e){let r=e.elements.map(n=>Mi(t,n));return n=>r.forEach(i=>i(n))}function md(t){if(pr(t))return t.guardCondition}function J_(t,e,r=e.terminal){if(r)if(Vt(r)&&Ie(r.rule.ref)){let n=r.rule.ref,i=t.subrule++;return o=>t.parser.subrule(i,Z_(t,n),!1,e,o)}else if(Vt(r)&&Mt(r.rule.ref)){let n=t.consume++,i=Qm(t,r.rule.ref.name);return()=>t.parser.consume(n,i,e)}else if(lt(r)){let n=t.consume++,i=Qm(t,r.value);return()=>t.parser.consume(n,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);let n=Hu(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+_i(e.type.ref));return J_(t,e,i)}}function EF(t,e){let r=t.consume++,n=t.tokens[e.value];if(!n)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(r,n,e)}function Q_(t,e,r,n){let i=e&&_n(e);if(!n)if(i){let o=t.or++;return s=>t.parser.alternatives(o,[{ALT:()=>r(s),GATE:()=>i(s)},{ALT:td(),GATE:()=>!i(s)}])}else return r;if(n==="*"){let o=t.many++;return s=>t.parser.many(o,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else if(n==="+"){let o=t.many++;if(i){let s=t.or++;return a=>t.parser.alternatives(s,[{ALT:()=>t.parser.atLeastOne(o,{DEF:()=>r(a)}),GATE:()=>i(a)},{ALT:td(),GATE:()=>!i(a)}])}else return s=>t.parser.atLeastOne(o,{DEF:()=>r(s)})}else if(n==="?"){let o=t.optional++;return s=>t.parser.optional(o,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else Fr(n)}function Z_(t,e){let r=AF(t,e),n=t.parser.getRule(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function AF(t,e){if(Ie(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let r=e,n=r.$container,i=e.$type;for(;!Ie(n);)(pr(n)||Wo(n)||Bo(n))&&(i=n.elements.indexOf(r).toString()+":"+i),r=n,n=n.$container;return i=n.name+":"+i,t.ruleNames.set(e,i),i}}function Qm(t,e){let r=t.tokens[e];if(!r)throw new Error(`Token "${e}" not found."`);return r}function Zm(t){let e=t.Grammar,r=t.parser.Lexer,n=new bc(t);return Cc(e,n,r.definition),n.finalize(),n}function eg(t){let e=eb(t);return e.finalize(),e}function eb(t){let e=t.Grammar,r=t.parser.Lexer,n=new _c(t);return Cc(e,n,r.definition)}var Fi=class{constructor(){this.diagnostics=[]}buildTokens(e,r){let n=Z(Fa(e,!1)),i=this.buildTerminalTokens(n),o=this.buildKeywordTokens(n,i,r);return o.push(...i),o}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Mt).filter(r=>!r.fragment).map(r=>this.buildTerminalToken(r)).toArray()}buildTerminalToken(e){let r=Nn(e),n=this.requiresCustomPattern(r)?this.regexPatternFunction(r):r,i={name:e.name,PATTERN:n};return typeof n=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=La(r)?Me.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")||e.flags.includes("s")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){let r=new RegExp(e,e.flags+"y");return(n,i)=>(r.lastIndex=i,r.exec(n))}buildKeywordTokens(e,r,n){return e.filter(Ie).flatMap(i=>cr(i).filter(lt)).distinct(i=>i.value).toArray().sort((i,o)=>o.value.length-i.value.length).map(i=>this.buildKeywordToken(i,r,!!n?.caseInsensitive))}buildKeywordToken(e,r,n){let i=this.buildKeywordPattern(e,n),o={name:e.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(e,r)};return typeof i=="function"&&(o.LINE_BREAKS=!0),o}buildKeywordPattern(e,r){return r?new RegExp(wn(e.value),"i"):e.value}findLongerAlt(e,r){return r.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&Xh("^"+o.source+"$",e.value)&&n.push(i),n},[])}};var $i=class{convert(e,r){let n=r.grammarSource;if(sr(n)&&(n=$a(n)),Vt(n)){let i=n.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,r)}return e}runConverter(e,r,n){var i;switch(e.name.toUpperCase()){case"INT":return Qr.convertInt(r);case"STRING":return Qr.convertString(r);case"ID":return Qr.convertID(r)}switch((i=op(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Qr.convertNumber(r);case"boolean":return Qr.convertBoolean(r);case"bigint":return Qr.convertBigint(r);case"date":return Qr.convertDate(r);default:return r}}},Qr;(function(t){function e(u){let l="";for(let d=1;d<u.length-1;d++){let f=u.charAt(d);if(f==="\\"){let p=u.charAt(++d);l+=r(p)}else l+=f}return l}t.convertString=e;function r(u){switch(u){case"b":return"\b";case"f":return"\f";case"n":return`
149
+ `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return u}}function n(u){return u.charAt(0)==="^"?u.substring(1):u}t.convertID=n;function i(u){return parseInt(u)}t.convertInt=i;function o(u){return BigInt(u)}t.convertBigint=o;function s(u){return new Date(u)}t.convertDate=s;function a(u){return Number(u)}t.convertNumber=a;function c(u){return u.toLowerCase()==="true"}t.convertBoolean=c})(Qr||(Qr={}));var B={};se(B,hr(Sc(),1));function ag(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}var xd=0,ib=10;function Td(){return xd=performance.now(),new B.CancellationTokenSource}function ob(t){ib=t}var Zr=Symbol("OperationCancelled");function en(t){return t===Zr}async function Be(t){if(t===B.CancellationToken.None)return;let e=performance.now();if(e-xd>=ib&&(xd=e,await ag(),xd=performance.now()),t.isCancellationRequested)throw Zr}var Wt=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=n=>(e(n),this),this.reject=n=>(r(n),this)})}};var Rd=class t{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){for(let n of e)if(t.isIncremental(n)){let i=cb(n.range),o=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,o)+n.text+this._content.substring(s,this._content.length);let a=Math.max(i.start.line,0),c=Math.max(i.end.line,0),u=this._lineOffsets,l=sb(n.text,!1,o);if(c-a===l.length)for(let f=0,p=l.length;f<p;f++)u[f+a+1]=l[f];else l.length<1e4?u.splice(a+1,c-a,...l):this._lineOffsets=u=u.slice(0,a+1).concat(l,u.slice(c+1));let d=n.text.length-(s-o);if(d!==0)for(let f=a+1+l.length,p=u.length;f<p;f++)u[f]=u[f]+d}else if(t.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=sb(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:e};for(;n<i;){let s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}let o=n-1;return e=this.ensureBeforeEOL(e,r[o]),{line:o,character:e-r[o]}}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line];if(e.character<=0)return n;let i=e.line+1<r.length?r[e.line+1]:this._content.length,o=Math.min(n+e.character,i);return this.ensureBeforeEOL(o,n)}ensureBeforeEOL(e,r){for(;e>r&&ab(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},Yn;(function(t){function e(i,o,s,a){return new Rd(i,o,s,a)}t.create=e;function r(i,o,s){if(i instanceof Rd)return i.update(o,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,o){let s=i.getText(),a=cg(o.map($F),(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),c=0,u=[];for(let l of a){let d=i.offsetAt(l.range.start);if(d<c)throw new Error("Overlapping edit");d>c&&u.push(s.substring(c,d)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(s.substr(c)),u.join("")}t.applyEdits=n})(Yn||(Yn={}));function cg(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);cg(n,e),cg(i,e);let o=0,s=0,a=0;for(;o<n.length&&s<i.length;)e(n[o],i[s])<=0?t[a++]=n[o++]:t[a++]=i[s++];for(;o<n.length;)t[a++]=n[o++];for(;s<i.length;)t[a++]=i[s++];return t}function sb(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);ab(o)&&(o===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function ab(t){return t===13||t===10}function cb(t){let e=t.start,r=t.end;return e.line>r.line||e.line===r.line&&e.character>r.character?{start:r,end:e}:t}function $F(t){let e=cb(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var ub;(()=>{"use strict";var t={470:i=>{function o(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}function s(c,u){for(var l,d="",f=0,p=-1,v=0,T=0;T<=c.length;++T){if(T<c.length)l=c.charCodeAt(T);else{if(l===47)break;l=47}if(l===47){if(!(p===T-1||v===1))if(p!==T-1&&v===2){if(d.length<2||f!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var S=d.lastIndexOf("/");if(S!==d.length-1){S===-1?(d="",f=0):f=(d=d.slice(0,S)).length-1-d.lastIndexOf("/"),p=T,v=0;continue}}else if(d.length===2||d.length===1){d="",f=0,p=T,v=0;continue}}u&&(d.length>0?d+="/..":d="..",f=2)}else d.length>0?d+="/"+c.slice(p+1,T):d=c.slice(p+1,T),f=T-p-1;p=T,v=0}else l===46&&v!==-1?++v:v=-1}return d}var a={resolve:function(){for(var c,u="",l=!1,d=arguments.length-1;d>=-1&&!l;d--){var f;d>=0?f=arguments[d]:(c===void 0&&(c=process.cwd()),f=c),o(f),f.length!==0&&(u=f+"/"+u,l=f.charCodeAt(0)===47)}return u=s(u,!l),l?u.length>0?"/"+u:"/":u.length>0?u:"."},normalize:function(c){if(o(c),c.length===0)return".";var u=c.charCodeAt(0)===47,l=c.charCodeAt(c.length-1)===47;return(c=s(c,!u)).length!==0||u||(c="."),c.length>0&&l&&(c+="/"),u?"/"+c:c},isAbsolute:function(c){return o(c),c.length>0&&c.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var c,u=0;u<arguments.length;++u){var l=arguments[u];o(l),l.length>0&&(c===void 0?c=l:c+="/"+l)}return c===void 0?".":a.normalize(c)},relative:function(c,u){if(o(c),o(u),c===u||(c=a.resolve(c))===(u=a.resolve(u)))return"";for(var l=1;l<c.length&&c.charCodeAt(l)===47;++l);for(var d=c.length,f=d-l,p=1;p<u.length&&u.charCodeAt(p)===47;++p);for(var v=u.length-p,T=f<v?f:v,S=-1,R=0;R<=T;++R){if(R===T){if(v>T){if(u.charCodeAt(p+R)===47)return u.slice(p+R+1);if(R===0)return u.slice(p+R)}else f>T&&(c.charCodeAt(l+R)===47?S=R:R===0&&(S=0));break}var g=c.charCodeAt(l+R);if(g!==u.charCodeAt(p+R))break;g===47&&(S=R)}var h="";for(R=l+S+1;R<=d;++R)R!==d&&c.charCodeAt(R)!==47||(h.length===0?h+="..":h+="/..");return h.length>0?h+u.slice(p+S):(p+=S,u.charCodeAt(p)===47&&++p,u.slice(p))},_makeLong:function(c){return c},dirname:function(c){if(o(c),c.length===0)return".";for(var u=c.charCodeAt(0),l=u===47,d=-1,f=!0,p=c.length-1;p>=1;--p)if((u=c.charCodeAt(p))===47){if(!f){d=p;break}}else f=!1;return d===-1?l?"/":".":l&&d===1?"//":c.slice(0,d)},basename:function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');o(c);var l,d=0,f=-1,p=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var v=u.length-1,T=-1;for(l=c.length-1;l>=0;--l){var S=c.charCodeAt(l);if(S===47){if(!p){d=l+1;break}}else T===-1&&(p=!1,T=l+1),v>=0&&(S===u.charCodeAt(v)?--v==-1&&(f=l):(v=-1,f=T))}return d===f?f=T:f===-1&&(f=c.length),c.slice(d,f)}for(l=c.length-1;l>=0;--l)if(c.charCodeAt(l)===47){if(!p){d=l+1;break}}else f===-1&&(p=!1,f=l+1);return f===-1?"":c.slice(d,f)},extname:function(c){o(c);for(var u=-1,l=0,d=-1,f=!0,p=0,v=c.length-1;v>=0;--v){var T=c.charCodeAt(v);if(T!==47)d===-1&&(f=!1,d=v+1),T===46?u===-1?u=v:p!==1&&(p=1):u!==-1&&(p=-1);else if(!f){l=v+1;break}}return u===-1||d===-1||p===0||p===1&&u===d-1&&u===l+1?"":c.slice(u,d)},format:function(c){if(c===null||typeof c!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof c);return(function(u,l){var d=l.dir||l.root,f=l.base||(l.name||"")+(l.ext||"");return d?d===l.root?d+f:d+"/"+f:f})(0,c)},parse:function(c){o(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var l,d=c.charCodeAt(0),f=d===47;f?(u.root="/",l=1):l=0;for(var p=-1,v=0,T=-1,S=!0,R=c.length-1,g=0;R>=l;--R)if((d=c.charCodeAt(R))!==47)T===-1&&(S=!1,T=R+1),d===46?p===-1?p=R:g!==1&&(g=1):p!==-1&&(g=-1);else if(!S){v=R+1;break}return p===-1||T===-1||g===0||g===1&&p===T-1&&p===v+1?T!==-1&&(u.base=u.name=v===0&&f?c.slice(1,T):c.slice(v,T)):(v===0&&f?(u.name=c.slice(1,p),u.base=c.slice(1,T)):(u.name=c.slice(v,p),u.base=c.slice(v,T)),u.ext=c.slice(p,T)),v>0?u.dir=c.slice(0,v-1):f&&(u.dir="/"),u},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,i.exports=a}},e={};function r(i){var o=e[i];if(o!==void 0)return o.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.d=(i,o)=>{for(var s in o)r.o(o,s)&&!r.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:o[s]})},r.o=(i,o)=>Object.prototype.hasOwnProperty.call(i,o),r.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var n={};(()=>{let i;r.r(n),r.d(n,{URI:()=>f,Utils:()=>Ht}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let o=/^\w[\w\d+.-]*$/,s=/^\//,a=/^\/\//;function c(I,k){if(!I.scheme&&k)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${I.authority}", path: "${I.path}", query: "${I.query}", fragment: "${I.fragment}"}`);if(I.scheme&&!o.test(I.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(I.path){if(I.authority){if(!s.test(I.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a.test(I.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}let u="",l="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class f{static isUri(k){return k instanceof f||!!k&&typeof k.authority=="string"&&typeof k.fragment=="string"&&typeof k.path=="string"&&typeof k.query=="string"&&typeof k.scheme=="string"&&typeof k.fsPath=="string"&&typeof k.with=="function"&&typeof k.toString=="function"}scheme;authority;path;query;fragment;constructor(k,U,M,ne,K,H=!1){typeof k=="object"?(this.scheme=k.scheme||u,this.authority=k.authority||u,this.path=k.path||u,this.query=k.query||u,this.fragment=k.fragment||u):(this.scheme=(function(ct,F){return ct||F?ct:"file"})(k,H),this.authority=U||u,this.path=(function(ct,F){switch(ct){case"https":case"http":case"file":F?F[0]!==l&&(F=l+F):F=l}return F})(this.scheme,M||u),this.query=ne||u,this.fragment=K||u,c(this,H))}get fsPath(){return g(this,!1)}with(k){if(!k)return this;let{scheme:U,authority:M,path:ne,query:K,fragment:H}=k;return U===void 0?U=this.scheme:U===null&&(U=u),M===void 0?M=this.authority:M===null&&(M=u),ne===void 0?ne=this.path:ne===null&&(ne=u),K===void 0?K=this.query:K===null&&(K=u),H===void 0?H=this.fragment:H===null&&(H=u),U===this.scheme&&M===this.authority&&ne===this.path&&K===this.query&&H===this.fragment?this:new v(U,M,ne,K,H)}static parse(k,U=!1){let M=d.exec(k);return M?new v(M[2]||u,J(M[4]||u),J(M[5]||u),J(M[7]||u),J(M[9]||u),U):new v(u,u,u,u,u)}static file(k){let U=u;if(i&&(k=k.replace(/\\/g,l)),k[0]===l&&k[1]===l){let M=k.indexOf(l,2);M===-1?(U=k.substring(2),k=l):(U=k.substring(2,M),k=k.substring(M)||l)}return new v("file",U,k,u,u)}static from(k){let U=new v(k.scheme,k.authority,k.path,k.query,k.fragment);return c(U,!0),U}toString(k=!1){return h(this,k)}toJSON(){return this}static revive(k){if(k){if(k instanceof f)return k;{let U=new v(k);return U._formatted=k.external,U._fsPath=k._sep===p?k.fsPath:null,U}}return k}}let p=i?1:void 0;class v extends f{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=g(this,!1)),this._fsPath}toString(k=!1){return k?h(this,!0):(this._formatted||(this._formatted=h(this,!1)),this._formatted)}toJSON(){let k={$mid:1};return this._fsPath&&(k.fsPath=this._fsPath,k._sep=p),this._formatted&&(k.external=this._formatted),this.path&&(k.path=this.path),this.scheme&&(k.scheme=this.scheme),this.authority&&(k.authority=this.authority),this.query&&(k.query=this.query),this.fragment&&(k.fragment=this.fragment),k}}let T={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function S(I,k,U){let M,ne=-1;for(let K=0;K<I.length;K++){let H=I.charCodeAt(K);if(H>=97&&H<=122||H>=65&&H<=90||H>=48&&H<=57||H===45||H===46||H===95||H===126||k&&H===47||U&&H===91||U&&H===93||U&&H===58)ne!==-1&&(M+=encodeURIComponent(I.substring(ne,K)),ne=-1),M!==void 0&&(M+=I.charAt(K));else{M===void 0&&(M=I.substr(0,K));let ct=T[H];ct!==void 0?(ne!==-1&&(M+=encodeURIComponent(I.substring(ne,K)),ne=-1),M+=ct):ne===-1&&(ne=K)}}return ne!==-1&&(M+=encodeURIComponent(I.substring(ne))),M!==void 0?M:I}function R(I){let k;for(let U=0;U<I.length;U++){let M=I.charCodeAt(U);M===35||M===63?(k===void 0&&(k=I.substr(0,U)),k+=T[M]):k!==void 0&&(k+=I[U])}return k!==void 0?k:I}function g(I,k){let U;return U=I.authority&&I.path.length>1&&I.scheme==="file"?`//${I.authority}${I.path}`:I.path.charCodeAt(0)===47&&(I.path.charCodeAt(1)>=65&&I.path.charCodeAt(1)<=90||I.path.charCodeAt(1)>=97&&I.path.charCodeAt(1)<=122)&&I.path.charCodeAt(2)===58?k?I.path.substr(1):I.path[1].toLowerCase()+I.path.substr(2):I.path,i&&(U=U.replace(/\//g,"\\")),U}function h(I,k){let U=k?R:S,M="",{scheme:ne,authority:K,path:H,query:ct,fragment:F}=I;if(ne&&(M+=ne,M+=":"),(K||ne==="file")&&(M+=l,M+=l),K){let b=K.indexOf("@");if(b!==-1){let Te=K.substr(0,b);K=K.substr(b+1),b=Te.lastIndexOf(":"),b===-1?M+=U(Te,!1,!1):(M+=U(Te.substr(0,b),!1,!1),M+=":",M+=U(Te.substr(b+1),!1,!0)),M+="@"}K=K.toLowerCase(),b=K.lastIndexOf(":"),b===-1?M+=U(K,!1,!0):(M+=U(K.substr(0,b),!1,!0),M+=K.substr(b))}if(H){if(H.length>=3&&H.charCodeAt(0)===47&&H.charCodeAt(2)===58){let b=H.charCodeAt(1);b>=65&&b<=90&&(H=`/${String.fromCharCode(b+32)}:${H.substr(3)}`)}else if(H.length>=2&&H.charCodeAt(1)===58){let b=H.charCodeAt(0);b>=65&&b<=90&&(H=`${String.fromCharCode(b+32)}:${H.substr(2)}`)}M+=U(H,!0,!1)}return ct&&(M+="?",M+=U(ct,!1,!1)),F&&(M+="#",M+=k?F:S(F,!1,!1)),M}function _(I){try{return decodeURIComponent(I)}catch{return I.length>3?I.substr(0,3)+_(I.substr(3)):I}}let w=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function J(I){return I.match(w)?I.replace(w,(k=>_(k))):I}var Bt=r(470);let Ye=Bt.posix||Bt,ir="/";var Ht;(function(I){I.joinPath=function(k,...U){return k.with({path:Ye.join(k.path,...U)})},I.resolvePath=function(k,...U){let M=k.path,ne=!1;M[0]!==ir&&(M=ir+M,ne=!0);let K=Ye.resolve(M,...U);return ne&&K[0]===ir&&!k.authority&&(K=K.substring(1)),k.with({path:K})},I.dirname=function(k){if(k.path.length===0||k.path===ir)return k;let U=Ye.dirname(k.path);return U.length===1&&U.charCodeAt(0)===46&&(U=""),k.with({path:U})},I.basename=function(k){return Ye.basename(k.path)},I.extname=function(k){return Ye.extname(k.path)}})(Ht||(Ht={}))})(),ub=n})();var{URI:tt,Utils:Hs}=ub;var oe;(function(t){t.basename=Hs.basename,t.dirname=Hs.dirname,t.extname=Hs.extname,t.joinPath=Hs.joinPath,t.resolvePath=Hs.resolvePath;let e=typeof process=="object"&&(process==null?void 0:process.platform)==="win32";function r(o,s){return o?.toString()===s?.toString()}t.equals=r;function n(o,s){let a=typeof o=="string"?tt.parse(o).path:o.path,c=typeof s=="string"?tt.parse(s).path:s.path,u=a.split("/").filter(v=>v.length>0),l=c.split("/").filter(v=>v.length>0);if(e){let v=/^[A-Z]:$/;if(u[0]&&v.test(u[0])&&(u[0]=u[0].toLowerCase()),l[0]&&v.test(l[0])&&(l[0]=l[0].toLowerCase()),u[0]!==l[0])return c.substring(1)}let d=0;for(;d<u.length&&u[d]===l[d];d++);let f="../".repeat(u.length-d),p=l.slice(d).join("/");return f+p}t.relative=n;function i(o){return tt.parse(o.toString()).toString()}t.normalize=i})(oe||(oe={}));var xe;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(xe||(xe={}));var kc=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,r=B.CancellationToken.None){let n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,r)}fromTextDocument(e,r,n){return r=r??tt.parse(e.uri),B.CancellationToken.is(n)?this.createAsync(r,e,n):this.create(r,e,n)}fromString(e,r,n){return B.CancellationToken.is(n)?this.createAsync(r,e,n):this.create(r,e,n)}fromModel(e,r){return this.create(r,{$model:e})}create(e,r,n){if(typeof r=="string"){let i=this.parse(e,r,n);return this.createLangiumDocument(i,e,void 0,r)}else if("$model"in r){let i={value:r.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,e)}else{let i=this.parse(e,r.getText(),n);return this.createLangiumDocument(i,e,r)}}async createAsync(e,r,n){if(typeof r=="string"){let i=await this.parseAsync(e,r,n);return this.createLangiumDocument(i,e,void 0,r)}else{let i=await this.parseAsync(e,r.getText(),n);return this.createLangiumDocument(i,e,r)}}createLangiumDocument(e,r,n,i){let o;if(n)o={parseResult:e,uri:r,state:xe.Parsed,references:[],textDocument:n};else{let s=this.createTextDocumentGetter(r,i);o={parseResult:e,uri:r,state:xe.Parsed,references:[],get textDocument(){return s()}}}return e.value.$document=o,o}async update(e,r){var n,i;let o=(n=e.parseResult.value.$cstNode)===null||n===void 0?void 0:n.root.fullText,s=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),a=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{let c=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:c})}return o!==a&&(e.parseResult=await this.parseAsync(e.uri,a,r),e.parseResult.value.$document=e),e.state=xe.Parsed,e}parse(e,r,n){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r,n)}parseAsync(e,r,n){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(r,n)}createTextDocumentGetter(e,r){let n=this.serviceRegistry,i;return()=>i??(i=Yn.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,r??""))}},Ec=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return Z(this.documentMap.values())}addDocument(e){let r=e.uri.toString();if(this.documentMap.has(r))throw new Error(`A document with the URI '${r}' is already present.`);this.documentMap.set(r,e)}getDocument(e){let r=e.toString();return this.documentMap.get(r)}async getOrCreateDocument(e,r){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,r),this.addDocument(n),n)}createDocument(e,r,n){if(n)return this.langiumDocumentFactory.fromString(r,e,n).then(i=>(this.addDocument(i),i));{let i=this.langiumDocumentFactory.fromString(r,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(this.serviceRegistry.getServices(e).references.Linker.unlink(n),n.state=xe.Changed,n.precomputedScopes=void 0,n.diagnostics=void 0),n}deleteDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=xe.Changed,this.documentMap.delete(r)),n}};var ug=Symbol("ref_resolving"),Ac=class{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,r=B.CancellationToken.None){for(let n of mr(e.parseResult.value))await Be(r),Ho(n).forEach(i=>this.doLink(i,e))}doLink(e,r){var n;let i=e.reference;if(i._ref===void 0){i._ref=ug;try{let o=this.getCandidate(e);if(li(o))i._ref=o;else if(i._nodeDescription=o,this.langiumDocuments().hasDocument(o.documentUri)){let s=this.loadAstNode(o);i._ref=s??this.createLinkingError(e,o)}else i._ref=void 0}catch(o){console.error(`An error occurred while resolving reference to '${i.$refText}':`,o);let s=(n=o.message)!==null&&n!==void 0?n:String(o);i._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${i.$refText}': ${s}`})}r.references.push(i)}}unlink(e){for(let r of e.references)delete r._ref,delete r._nodeDescription;e.references=[]}getCandidate(e){let n=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return n??this.createLinkingError(e)}buildReference(e,r,n,i){let o=this,s={$refNode:n,$refText:i,get ref(){var a;if(we(this._ref))return this._ref;if(xh(this._nodeDescription)){let c=o.loadAstNode(this._nodeDescription);this._ref=c??o.createLinkingError({reference:s,container:e,property:r},this._nodeDescription)}else if(this._ref===void 0){this._ref=ug;let c=Na(e).$document,u=o.getLinkedNode({reference:s,container:e,property:r});if(u.error&&c&&c.state<xe.ComputedScopes)return this._ref=void 0;this._ref=(a=u.node)!==null&&a!==void 0?a:u.error,this._nodeDescription=u.descr,c?.references.push(this)}else if(this._ref===ug)throw new Error(`Cyclic reference resolution detected: ${o.astNodeLocator.getAstNodePath(e)}/${r} (symbol '${i}')`);return we(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return li(this._ref)?this._ref:void 0}};return s}getLinkedNode(e){var r;try{let n=this.getCandidate(e);if(li(n))return{error:n};let i=this.loadAstNode(n);return i?{node:i,descr:n}:{descr:n,error:this.createLinkingError(e,n)}}catch(n){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,n);let i=(r=n.message)!==null&&r!==void 0?r:String(n);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${i}`})}}}loadAstNode(e){if(e.node)return e.node;let r=this.langiumDocuments().getDocument(e.documentUri);if(r)return this.astNodeLocator.getAstNode(r.parseResult.value,e.path)}createLinkingError(e,r){let n=Na(e.container).$document;n&&n.state<xe.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);let i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:r})}};function _d(t){return typeof t.name=="string"}var wc=class{getName(e){if(_d(e))return e.name}getNameNode(e){return qa(e.$cstNode,"name")}};var Nc=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let r=np(e),n=e.astNode;if(r&&n){let i=n[r.feature];if(Rt(i))return i.ref;if(Array.isArray(i)){for(let o of i)if(Rt(o)&&o.$refNode&&o.$refNode.offset<=e.offset&&o.$refNode.end>=e.end)return o.ref}}if(n){let i=this.nameProvider.getNameNode(n);if(i&&(i===e||_h(e,i)))return n}}}findDeclarationNode(e){let r=this.findDeclaration(e);if(r?.$cstNode){let n=this.nameProvider.getNameNode(r);return n??r.$cstNode}}findReferences(e,r){let n=[];if(r.includeDeclaration){let o=this.getReferenceToSelf(e);o&&n.push(o)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return r.documentUri&&(i=i.filter(o=>oe.equals(o.sourceUri,r.documentUri))),n.push(...i),Z(n)}getReferenceToSelf(e){let r=this.nameProvider.getNameNode(e);if(r){let n=rt(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:fi(r),local:!0}}}};var Pr=class{constructor(e){if(this.map=new Map,e)for(let[r,n]of e)this.add(r,n)}get size(){return eo.sum(Z(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,r){if(r===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let i=n.indexOf(r);if(i>=0)return n.length===1?this.map.delete(e):n.splice(i,1),!0}return!1}}get(e){var r;return(r=this.map.get(e))!==null&&r!==void 0?r:[]}has(e,r){if(r===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(r)>=0:!1}}add(e,r){return this.map.has(e)?this.map.get(e).push(r):this.map.set(e,[r]),this}addAll(e,r){return this.map.has(e)?this.map.get(e).push(...r):this.map.set(e,Array.from(r)),this}forEach(e){this.map.forEach((r,n)=>r.forEach(i=>e(i,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return Z(this.map.entries()).flatMap(([e,r])=>r.map(n=>[e,n]))}keys(){return Z(this.map.keys())}values(){return Z(this.map.values()).flat()}entriesGroupedByKey(){return Z(this.map.entries())}},Ui=class{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[r,n]of e)this.set(r,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,r){return this.map.set(e,r),this.inverse.set(r,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let r=this.map.get(e);return r!==void 0?(this.map.delete(e),this.inverse.delete(r),!0):!1}};var Pc=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,r=B.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,r)}async computeExportsForNode(e,r,n=yi,i=B.CancellationToken.None){let o=[];this.exportNode(e,o,r);for(let s of n(e))await Be(i),this.exportNode(s,o,r);return o}exportNode(e,r,n){let i=this.nameProvider.getName(e);i&&r.push(this.descriptions.createDescription(e,i,n))}async computeLocalScopes(e,r=B.CancellationToken.None){let n=e.parseResult.value,i=new Pr;for(let o of cr(n))await Be(r),this.processNode(o,e,i);return i}processNode(e,r,n){let i=e.$container;if(i){let o=this.nameProvider.getName(e);o&&n.add(i,this.descriptions.createDescription(e,o,r))}}};var Gs=class{constructor(e,r,n){var i;this.elements=e,this.outerScope=r,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let r=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===e.toLowerCase()):this.elements.find(n=>n.name===e);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}},Dc=class{constructor(e,r,n){var i;this.elements=new Map,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1;for(let o of e){let s=this.caseInsensitive?o.name.toLowerCase():o.name;this.elements.set(s,o)}this.outerScope=r}getElement(e){let r=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(r);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=Z(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},qF={getElement(){},getAllElements(){return xa}};var zs=class{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}},Ic=class extends zs{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,r){this.throwIfDisposed(),this.cache.set(e,r)}get(e,r){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(r){let n=r();return this.cache.set(e,n),n}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},ji=class extends zs{constructor(e){super(),this.cache=new Map,this.converter=e??(r=>r)}has(e,r){return this.throwIfDisposed(),this.cacheForContext(e).has(r)}set(e,r,n){this.throwIfDisposed(),this.cacheForContext(e).set(r,n)}get(e,r,n){this.throwIfDisposed();let i=this.cacheForContext(e);if(i.has(r))return i.get(r);if(n){let o=n();return i.set(r,o),o}else return}delete(e,r){return this.throwIfDisposed(),this.cacheForContext(e).delete(r)}clear(e){if(this.throwIfDisposed(),e){let r=this.converter(e);this.cache.delete(r)}else this.cache.clear()}cacheForContext(e){let r=this.converter(e),n=this.cache.get(r);return n||(n=new Map,this.cache.set(r,n)),n}},bd=class extends ji{constructor(e,r){super(n=>n.toString()),r?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(r,n=>{this.clear(n.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{for(let o of i)this.clear(o)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{let o=n.concat(i);for(let s of o)this.clear(s)}))}},Ks=class extends Ic{constructor(e,r){super(),r?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(r,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}};var Oc=class{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new Ks(e.shared)}getScope(e){let r=[],n=this.reflection.getReferenceType(e),i=rt(e.container).precomputedScopes;if(i){let s=e.container;do{let a=i.get(s);a.length>0&&r.push(Z(a).filter(c=>this.reflection.isSubtype(c.type,n))),s=s.$container}while(s)}let o=this.getGlobalScope(n,e);for(let s=r.length-1;s>=0;s--)o=this.createScope(r[s],o);return o}createScope(e,r,n){return new Gs(Z(e),r,n)}createScopeForNodes(e,r,n){let i=Z(e).map(o=>{let s=this.nameProvider.getName(o);if(s)return this.descriptions.createDescription(o,s)}).nonNullable();return new Gs(i,r,n)}getGlobalScope(e,r){return this.globalScopeCache.get(e,()=>new Dc(this.indexManager.allElements(e)))}};function Mc(t){return typeof t.$comment=="string"}function lb(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}var Lc=class{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,r){let n=r??{},i=r?.replacer,o=(a,c)=>this.replacer(a,c,n),s=i?(a,c)=>i(a,c,o):o;try{return this.currentDocument=rt(e),JSON.stringify(e,s,r?.space)}finally{this.currentDocument=void 0}}deserialize(e,r){let n=r??{},i=JSON.parse(e);return this.linkNode(i,i,n),i}replacer(e,r,{refText:n,sourceText:i,textRegions:o,comments:s,uriConverter:a}){var c,u,l,d;if(!this.ignoreProperties.has(e))if(Rt(r)){let f=r.ref,p=n?r.$refText:void 0;if(f){let v=rt(f),T="";this.currentDocument&&this.currentDocument!==v&&(a?T=a(v.uri,r):T=v.uri.toString());let S=this.astNodeLocator.getAstNodePath(f);return{$ref:`${T}#${S}`,$refText:p}}else return{$error:(u=(c=r.error)===null||c===void 0?void 0:c.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:p}}else if(we(r)){let f;if(o&&(f=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},r)),(!e||r.$document)&&f?.$textRegion&&(f.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(f??(f=Object.assign({},r)),f.$sourceText=(d=r.$cstNode)===null||d===void 0?void 0:d.text),s){f??(f=Object.assign({},r));let p=this.commentProvider.getComment(r);p&&(f.$comment=p.replace(/\r/g,""))}return f??r}else return r}addAstNodeRegionWithAssignmentsTo(e){let r=n=>({offset:n.offset,end:n.end,length:n.length,range:n.range});if(e.$cstNode){let n=e.$textRegion=r(e.$cstNode),i=n.assignments={};return Object.keys(e).filter(o=>!o.startsWith("$")).forEach(o=>{let s=Zh(e.$cstNode,o).map(r);s.length!==0&&(i[o]=s)}),e}}linkNode(e,r,n,i,o,s){for(let[c,u]of Object.entries(e))if(Array.isArray(u))for(let l=0;l<u.length;l++){let d=u[l];lb(d)?u[l]=this.reviveReference(e,c,r,d,n):we(d)&&this.linkNode(d,r,n,e,c,l)}else lb(u)?e[c]=this.reviveReference(e,c,r,u,n):we(u)&&this.linkNode(u,r,n,e,c);let a=e;a.$container=i,a.$containerProperty=o,a.$containerIndex=s}reviveReference(e,r,n,i,o){let s=i.$refText,a=i.$error;if(i.$ref){let c=this.getRefNode(n,i.$ref,o.uriConverter);if(we(c))return s||(s=this.nameProvider.getName(c)),{$refText:s??"",ref:c};a=c}if(a){let c={$refText:s??""};return c.error={container:e,property:r,message:a,reference:c},c}else return}getRefNode(e,r,n){try{let i=r.indexOf("#");if(i===0){let c=this.astNodeLocator.getAstNode(e,r.substring(1));return c||"Could not resolve path: "+r}if(i<0){let c=n?n(r):tt.parse(r),u=this.langiumDocuments.getDocument(c);return u?u.parseResult.value:"Could not find document for URI: "+r}let o=n?n(r.substring(0,i)):tt.parse(r.substring(0,i)),s=this.langiumDocuments.getDocument(o);if(!s)return"Could not find document for URI: "+r;if(i===r.length-1)return s.parseResult.value;let a=this.astNodeLocator.getAstNode(s.parseResult.value,r.substring(i+1));return a||"Could not resolve URI: "+r}catch(i){return String(i)}}};var Fc=class{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=e?.workspace.TextDocuments}register(e){let r=e.LanguageMetaData;for(let n of r.fileExtensions)this.fileExtensionMap.has(n)&&console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${r.languageId}'.`),this.fileExtensionMap.set(n,e);if(r.fileNames)for(let n of r.fileNames)this.fileNameMap.has(n)&&console.warn(`The file name ${n} is used by multiple languages. It is now assigned to '${r.languageId}'.`),this.fileNameMap.set(n,e);this.languageIdMap.set(r.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){var r,n,i;if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let o=(n=(r=this.textDocuments)===null||r===void 0?void 0:r.get(e))===null||n===void 0?void 0:n.languageId;if(o!==void 0){let u=this.languageIdMap.get(o);if(u)return u}let s=oe.extname(e),a=oe.basename(e),c=(i=this.fileNameMap.get(a))!==null&&i!==void 0?i:this.fileExtensionMap.get(s);if(!c)throw o?new Error(`The service registry contains no services for the extension '${s}' for language '${o}'.`):new Error(`The service registry contains no services for the extension '${s}'.`);return c}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}};function Wi(t){return{code:t}}var Vs;(function(t){t.all=["fast","slow","built-in"]})(Vs||(Vs={}));var $c=class{constructor(e){this.entries=new Pr,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,r=this,n="fast"){if(n==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(let[i,o]of Object.entries(e)){let s=o;if(Array.isArray(s))for(let a of s){let c={check:this.wrapValidationException(a,r),category:n};this.addEntry(i,c)}else if(typeof s=="function"){let a={check:this.wrapValidationException(s,r),category:n};this.addEntry(i,a)}else Fr(s)}}wrapValidationException(e,r){return async(n,i,o)=>{await this.handleException(()=>e.call(r,n,i,o),"An error occurred during validation",i,n)}}async handleException(e,r,n,i){try{await e()}catch(o){if(en(o))throw o;console.error(`${r}:`,o),o instanceof Error&&o.stack&&console.error(o.stack);let s=o instanceof Error?o.message:String(o);n("error",`${r}: ${s}`,{node:i})}}addEntry(e,r){if(e==="AstNode"){this.entries.add("AstNode",r);return}for(let n of this.reflection.getAllSubTypes(e))this.entries.add(n,r)}getChecks(e,r){let n=Z(this.entries.get(e)).concat(this.entries.get("AstNode"));return r&&(n=n.filter(i=>r.includes(i.category))),n.map(i=>i.check)}registerBeforeDocument(e,r=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",r))}registerAfterDocument(e,r=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",r))}wrapPreparationException(e,r,n){return async(i,o,s,a)=>{await this.handleException(()=>e.call(n,i,o,s,a),r,o,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}};var Bi=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,r={},n=B.CancellationToken.None){let i=e.parseResult,o=[];if(await Be(n),(!r.categories||r.categories.includes("built-in"))&&(this.processLexingErrors(i,o,r),r.stopAfterLexingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===xr.LexingError})||(this.processParsingErrors(i,o,r),r.stopAfterParsingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===xr.ParsingError}))||(this.processLinkingErrors(e,o,r),r.stopAfterLinkingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===xr.LinkingError}))))return o;try{o.push(...await this.validateAst(i.value,r,n))}catch(s){if(en(s))throw s;console.error("An error occurred during validation:",s)}return await Be(n),o}processLexingErrors(e,r,n){var i,o,s;let a=[...e.lexerErrors,...(o=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&o!==void 0?o:[]];for(let c of a){let u=(s=c.severity)!==null&&s!==void 0?s:"error",l={severity:Cd(u),range:{start:{line:c.line-1,character:c.column-1},end:{line:c.line-1,character:c.column+c.length-1}},message:c.message,data:fb(u),source:this.getSource()};r.push(l)}}processParsingErrors(e,r,n){for(let i of e.parserErrors){let o;if(isNaN(i.token.startOffset)){if("previousToken"in i){let s=i.previousToken;if(isNaN(s.startOffset)){let a={line:0,character:0};o={start:a,end:a}}else{let a={line:s.endLine-1,character:s.endColumn};o={start:a,end:a}}}}else o=to(i.token);if(o){let s={severity:Cd("error"),range:o,message:i.message,data:Wi(xr.ParsingError),source:this.getSource()};r.push(s)}}}processLinkingErrors(e,r,n){for(let i of e.references){let o=i.error;if(o){let s={node:o.container,property:o.property,index:o.index,data:{code:xr.LinkingError,containerType:o.container.$type,property:o.property,refText:o.reference.$refText}};r.push(this.toDiagnostic("error",o.message,s))}}}async validateAst(e,r,n=B.CancellationToken.None){let i=[],o=(s,a,c)=>{i.push(this.toDiagnostic(s,a,c))};return await this.validateAstBefore(e,r,o,n),await this.validateAstNodes(e,r,o,n),await this.validateAstAfter(e,r,o,n),i}async validateAstBefore(e,r,n,i=B.CancellationToken.None){var o;let s=this.validationRegistry.checksBefore;for(let a of s)await Be(i),await a(e,n,(o=r.categories)!==null&&o!==void 0?o:[],i)}async validateAstNodes(e,r,n,i=B.CancellationToken.None){await Promise.all(mr(e).map(async o=>{await Be(i);let s=this.validationRegistry.getChecks(o.$type,r.categories);for(let a of s)await a(o,n,i)}))}async validateAstAfter(e,r,n,i=B.CancellationToken.None){var o;let s=this.validationRegistry.checksAfter;for(let a of s)await Be(i),await a(e,n,(o=r.categories)!==null&&o!==void 0?o:[],i)}toDiagnostic(e,r,n){return{message:r,range:db(n),severity:Cd(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};function db(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=qa(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=tp(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Cd(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}function fb(t){switch(t){case"error":return Wi(xr.LexingError);case"warning":return Wi(xr.LexingWarning);case"info":return Wi(xr.LexingInfo);case"hint":return Wi(xr.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var xr;(function(t){t.LexingError="lexing-error",t.LexingWarning="lexing-warning",t.LexingInfo="lexing-info",t.LexingHint="lexing-hint",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(xr||(xr={}));var qc=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,r,n){let i=n??rt(e);r??(r=this.nameProvider.getName(e));let o=this.astNodeLocator.getAstNodePath(e);if(!r)throw new Error(`Node at path ${o} has no name.`);let s,a=()=>{var c;return s??(s=fi((c=this.nameProvider.getNameNode(e))!==null&&c!==void 0?c:e.$cstNode))};return{node:e,name:r,get nameSegment(){return a()},selectionSegment:fi(e.$cstNode),type:e.$type,documentUri:i.uri,path:o}}},Uc=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,r=B.CancellationToken.None){let n=[],i=e.parseResult.value;for(let o of mr(i))await Be(r),Ho(o).filter(s=>!li(s)).forEach(s=>{let a=this.createDescription(s);a&&n.push(a)});return n}createDescription(e){let r=e.reference.$nodeDescription,n=e.reference.$refNode;if(!r||!n)return;let i=rt(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:r.documentUri,targetPath:r.path,segment:fi(n),local:oe.equals(r.documentUri,i)}}};var jc=class{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let r=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return r+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:r}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return r!==void 0?e+this.indexSeparator+r:e}getAstNode(e,r){return r.split(this.segmentSeparator).reduce((i,o)=>{if(!i||o.length===0)return i;let s=o.indexOf(this.indexSeparator);if(s>0){let a=o.substring(0,s),c=parseInt(o.substring(s+1)),u=i[a];return u?.[c]}return i[o]},e)}};var Pe={};se(Pe,hr(qi(),1));var Wc=class{constructor(e){this._ready=new Wt,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new Pe.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var r,n;this.workspaceConfig=(n=(r=e.capabilities.workspace)===null||r===void 0?void 0:r.configuration)!==null&&n!==void 0?n:!1}async initialized(e){if(this.workspaceConfig){if(e.register){let r=this.serviceRegistry.all;e.register({section:r.map(n=>this.toSectionName(n.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let r=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await e.fetchConfiguration(r);r.forEach((i,o)=>{this.updateSectionConfiguration(i.section,n[o])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(r=>{let n=e.settings[r];this.updateSectionConfiguration(r,n),this.onConfigurationSectionUpdateEmitter.fire({section:r,configuration:n})})}updateSectionConfiguration(e,r){this.settings[e]=r}async getConfiguration(e,r){await this.ready;let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][r]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}};var Jn;(function(t){function e(r){return{dispose:async()=>await r()}}t.create=e})(Jn||(Jn={}));var Bc=class{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Pr,this.documentPhaseListeners=new Pr,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=xe.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,r={},n=B.CancellationToken.None){var i,o;for(let s of e){let a=s.uri.toString();if(s.state===xe.Validated){if(typeof r.validation=="boolean"&&r.validation)s.state=xe.IndexedReferences,s.diagnostics=void 0,this.buildState.delete(a);else if(typeof r.validation=="object"){let c=this.buildState.get(a),u=(i=c?.result)===null||i===void 0?void 0:i.validationChecks;if(u){let d=((o=r.validation.categories)!==null&&o!==void 0?o:Vs.all).filter(f=>!u.includes(f));d.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},r.validation),{categories:d})},result:c.result}),s.state=xe.IndexedReferences)}}}else this.buildState.delete(a)}this.currentState=xe.Changed,await this.emitUpdate(e.map(s=>s.uri),[]),await this.buildDocuments(e,r,n)}async update(e,r,n=B.CancellationToken.None){this.currentState=xe.Changed;for(let s of r)this.langiumDocuments.deleteDocument(s),this.buildState.delete(s.toString()),this.indexManager.remove(s);for(let s of e){if(!this.langiumDocuments.invalidateDocument(s)){let c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},s);c.state=xe.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(s.toString())}let i=Z(e).concat(r).map(s=>s.toString()).toSet();this.langiumDocuments.all.filter(s=>!i.has(s.uri.toString())&&this.shouldRelink(s,i)).forEach(s=>{this.serviceRegistry.getServices(s.uri).references.Linker.unlink(s),s.state=Math.min(s.state,xe.ComputedScopes),s.diagnostics=void 0}),await this.emitUpdate(e,r),await Be(n);let o=this.sortDocuments(this.langiumDocuments.all.filter(s=>{var a;return s.state<xe.Linked||!(!((a=this.buildState.get(s.uri.toString()))===null||a===void 0)&&a.completed)}).toArray());await this.buildDocuments(o,this.updateBuildOptions,n)}async emitUpdate(e,r){await Promise.all(this.updateListeners.map(n=>n(e,r)))}sortDocuments(e){let r=0,n=e.length-1;for(;r<n;){for(;r<e.length&&this.hasTextDocument(e[r]);)r++;for(;n>=0&&!this.hasTextDocument(e[n]);)n--;r<n&&([e[r],e[n]]=[e[n],e[r]])}return e}hasTextDocument(e){var r;return!!(!((r=this.textDocuments)===null||r===void 0)&&r.get(e.uri))}shouldRelink(e,r){return e.references.some(n=>n.error!==void 0)?!0:this.indexManager.isAffected(e,r)}onUpdate(e){return this.updateListeners.push(e),Jn.create(()=>{let r=this.updateListeners.indexOf(e);r>=0&&this.updateListeners.splice(r,1)})}async buildDocuments(e,r,n){this.prepareBuild(e,r),await this.runCancelable(e,xe.Parsed,n,s=>this.langiumDocumentFactory.update(s,n)),await this.runCancelable(e,xe.IndexedContent,n,s=>this.indexManager.updateContent(s,n)),await this.runCancelable(e,xe.ComputedScopes,n,async s=>{let a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await a.computeLocalScopes(s,n)});let i=e.filter(s=>this.shouldLink(s));await this.runCancelable(i,xe.Linked,n,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,n)),await this.runCancelable(i,xe.IndexedReferences,n,s=>this.indexManager.updateReferences(s,n));let o=e.filter(s=>this.shouldValidate(s));await this.runCancelable(o,xe.Validated,n,s=>this.validate(s,n));for(let s of e){let a=this.buildState.get(s.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,r){for(let n of e){let i=n.uri.toString(),o=this.buildState.get(i);(!o||o.completed)&&this.buildState.set(i,{completed:!1,options:r,result:o?.result})}}async runCancelable(e,r,n,i){let o=e.filter(a=>a.state<r);for(let a of o)await Be(n),await i(a),a.state=r,await this.notifyDocumentPhase(a,r,n);let s=e.filter(a=>a.state===r);await this.notifyBuildPhase(s,r,n),this.currentState=r}onBuildPhase(e,r){return this.buildPhaseListeners.add(e,r),Jn.create(()=>{this.buildPhaseListeners.delete(e,r)})}onDocumentPhase(e,r){return this.documentPhaseListeners.add(e,r),Jn.create(()=>{this.documentPhaseListeners.delete(e,r)})}waitUntil(e,r,n){let i;if(r&&"path"in r?i=r:n=r,n??(n=B.CancellationToken.None),i){let o=this.langiumDocuments.getDocument(i);if(o&&o.state>=e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Zr):new Promise((o,s)=>{let a=this.onBuildPhase(e,()=>{if(a.dispose(),c.dispose(),i){let u=this.langiumDocuments.getDocument(i);o(u?.uri)}else o(void 0)}),c=n.onCancellationRequested(()=>{a.dispose(),c.dispose(),s(Zr)})})}async notifyDocumentPhase(e,r,n){let o=this.documentPhaseListeners.get(r).slice();for(let s of o)try{await s(e,n)}catch(a){if(!en(a))throw a}}async notifyBuildPhase(e,r,n){if(e.length===0)return;let o=this.buildPhaseListeners.get(r).slice();for(let s of o)await Be(n),await s(e,n)}shouldLink(e){var r;return(r=this.getBuildOptions(e).eagerLinking)!==null&&r!==void 0?r:!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,r){var n,i;let o=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,s=this.getBuildOptions(e).validation,a=typeof s=="object"?s:void 0,c=await o.validateDocument(e,a,r);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;let u=this.buildState.get(e.uri.toString());if(u){(n=u.result)!==null&&n!==void 0||(u.result={});let l=(i=a?.categories)!==null&&i!==void 0?i:Vs.all;u.result.validationChecks?u.result.validationChecks.push(...l):u.result.validationChecks=[...l]}}getBuildOptions(e){var r,n;return(n=(r=this.buildState.get(e.uri.toString()))===null||r===void 0?void 0:r.options)!==null&&n!==void 0?n:{}}};var Hc=class{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new ji,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,r){let n=rt(e).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(s=>{oe.equals(s.targetUri,n)&&s.targetPath===r&&i.push(s)})}),Z(i)}allElements(e,r){let n=Z(this.symbolIndex.keys());return r&&(n=n.filter(i=>!r||r.has(i))),n.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,r){var n;return r?this.symbolByTypeIndex.get(e,r,()=>{var o;return((o=this.symbolIndex.get(e))!==null&&o!==void 0?o:[]).filter(a=>this.astReflection.isSubtype(a.type,r))}):(n=this.symbolIndex.get(e))!==null&&n!==void 0?n:[]}remove(e){let r=e.toString();this.symbolIndex.delete(r),this.symbolByTypeIndex.clear(r),this.referenceIndex.delete(r)}async updateContent(e,r=B.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,r),o=e.uri.toString();this.symbolIndex.set(o,i),this.symbolByTypeIndex.clear(o)}async updateReferences(e,r=B.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,r);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,r){let n=this.referenceIndex.get(e.uri.toString());return n?n.some(i=>!i.local&&r.has(i.targetUri.toString())):!1}};var Gc=class{constructor(e){this.initialBuildOptions={},this._ready=new Wt,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){var r;this.folders=(r=e.workspaceFolders)!==null&&r!==void 0?r:void 0}initialized(e){return this.mutex.write(r=>{var n;return this.initializeWorkspace((n=this.folders)!==null&&n!==void 0?n:[],r)})}async initializeWorkspace(e,r=B.CancellationToken.None){let n=await this.performStartup(e);await Be(r),await this.documentBuilder.build(n,this.initialBuildOptions,r)}async performStartup(e){let r=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),n=this.serviceRegistry.all.flatMap(s=>{var a;return(a=s.LanguageMetaData.fileNames)!==null&&a!==void 0?a:[]}),i=[],o=s=>{i.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,o),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,{fileExtensions:r,fileNames:n},o))),this._ready.resolve(),i}loadAdditionalDocuments(e,r){return Promise.resolve()}getRootFolder(e){return tt.parse(e.uri)}async traverseFolder(e,r,n,i){let o=await this.fileSystemProvider.readDirectory(r);await Promise.all(o.map(async s=>{if(this.includeEntry(e,s,n)){if(s.isDirectory)await this.traverseFolder(e,s.uri,n,i);else if(s.isFile){let a=await this.langiumDocuments.getOrCreateDocument(s.uri);i(a)}}}))}includeEntry(e,r,n){let i=oe.basename(r.uri);return i.startsWith(".")?!1:r.isDirectory?i!=="node_modules"&&i!=="out":r.isFile?n.fileExtensions.includes(oe.extname(r.uri))||n.fileNames.includes(oe.basename(r.uri)):!1}};var zc=class{buildUnexpectedCharactersMessage(e,r,n,i,o){return _s.buildUnexpectedCharactersMessage(e,r,n,i,o)}buildUnableToPopLexerModeMessage(e){return _s.buildUnableToPopLexerModeMessage(e)}},Sd={mode:"full"},Hi=class{constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;let r=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(r);let n=lg(r)?Object.values(r):r,i=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new Me(n,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,r=Sd){var n,i,o;let s=this.chevrotainLexer.tokenize(e);return{tokens:s.tokens,errors:s.errors,hidden:(n=s.groups.hidden)!==null&&n!==void 0?n:[],report:(o=(i=this.tokenBuilder).flushLexingReport)===null||o===void 0?void 0:o.call(i,e)}}toTokenTypeDictionary(e){if(lg(e))return e;let r=dg(e)?Object.values(e.modes).flat():e,n={};return r.forEach(i=>n[i.name]=i),n}};function kd(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function dg(t){return t&&"modes"in t&&"defaultMode"in t}function lg(t){return!kd(t)&&!dg(t)}Ii();function Xc(t,e,r){let n,i;typeof t=="string"?(i=e,n=r):(i=t.range.start,n=e),i||(i=ce.create(0,0));let o=mb(t),s=pg(n),a=jF({lines:o,position:i,options:s});return zF({index:0,tokens:a,position:i})}function Yc(t,e){let r=pg(e),n=mb(t);if(n.length===0)return!1;let i=n[0],o=n[n.length-1],s=r.start,a=r.end;return!!s?.exec(i)&&!!a?.exec(o)}function mb(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(Kh)}var hb=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,UF=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function jF(t){var e,r,n;let i=[],o=t.position.line,s=t.position.character;for(let a=0;a<t.lines.length;a++){let c=a===0,u=a===t.lines.length-1,l=t.lines[a],d=0;if(c&&t.options.start){let p=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);p&&(d=p.index+p[0].length)}else{let p=(r=t.options.line)===null||r===void 0?void 0:r.exec(l);p&&(d=p.index+p[0].length)}if(u){let p=(n=t.options.end)===null||n===void 0?void 0:n.exec(l);p&&(l=l.substring(0,p.index))}if(l=l.substring(0,GF(l)),hg(l,d)>=l.length){if(i.length>0){let p=ce.create(o,s);i.push({type:"break",content:"",range:te.create(p,p)})}}else{hb.lastIndex=d;let p=hb.exec(l);if(p){let v=p[0],T=p[1],S=ce.create(o,s+d),R=ce.create(o,s+d+v.length);i.push({type:"tag",content:T,range:te.create(S,R)}),d+=v.length,d=hg(l,d)}if(d<l.length){let v=l.substring(d),T=Array.from(v.matchAll(UF));i.push(...WF(T,v,o,s+d))}}o++,s=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function WF(t,e,r,n){let i=[];if(t.length===0){let o=ce.create(r,n),s=ce.create(r,n+e.length);i.push({type:"text",content:e,range:te.create(o,s)})}else{let o=0;for(let a of t){let c=a.index,u=e.substring(o,c);u.length>0&&i.push({type:"text",content:e.substring(o,c),range:te.create(ce.create(r,o+n),ce.create(r,c+n))});let l=u.length+1,d=a[1];if(i.push({type:"inline-tag",content:d,range:te.create(ce.create(r,o+l+n),ce.create(r,o+l+d.length+n))}),l+=d.length,a.length===4){l+=a[2].length;let f=a[3];i.push({type:"text",content:f,range:te.create(ce.create(r,o+l+n),ce.create(r,o+l+f.length+n))})}else i.push({type:"text",content:"",range:te.create(ce.create(r,o+l+n),ce.create(r,o+l+n))});o=c+a[0].length}let s=e.substring(o);s.length>0&&i.push({type:"text",content:s,range:te.create(ce.create(r,o+n),ce.create(r,o+n+s.length))})}return i}var BF=/\S/,HF=/\s*$/;function hg(t,e){let r=t.substring(e).match(BF);return r?e+r.index:t.length}function GF(t){let e=t.match(HF);if(e&&typeof e.index=="number")return e.index}function zF(t){var e,r,n,i;let o=ce.create(t.position.line,t.position.character);if(t.tokens.length===0)return new Ed([],te.create(o,o));let s=[];for(;t.index<t.tokens.length;){let u=KF(t,s[s.length-1]);u&&s.push(u)}let a=(r=(e=s[0])===null||e===void 0?void 0:e.range.start)!==null&&r!==void 0?r:o,c=(i=(n=s[s.length-1])===null||n===void 0?void 0:n.range.end)!==null&&i!==void 0?i:o;return new Ed(s,te.create(a,c))}function KF(t,e){let r=t.tokens[t.index];if(r.type==="tag")return yb(t,!1);if(r.type==="text"||r.type==="inline-tag")return gb(t);VF(r,e),t.index++}function VF(t,e){if(e){let r=new Ad("",t.range);"inlines"in e?e.inlines.push(r):e.content.inlines.push(r)}}function gb(t){let e=t.tokens[t.index],r=e,n=e,i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(XF(t)),n=e,e=t.tokens[t.index];return new Vc(i,te.create(r.range.start,n.range.end))}function XF(t){return t.tokens[t.index].type==="inline-tag"?yb(t,!0):vb(t)}function yb(t,e){let r=t.tokens[t.index++],n=r.content.substring(1),i=t.tokens[t.index];if(i?.type==="text")if(e){let o=vb(t);return new Kc(n,new Vc([o],o.range),e,te.create(r.range.start,o.range.end))}else{let o=gb(t);return new Kc(n,o,e,te.create(r.range.start,o.range.end))}else{let o=r.range;return new Kc(n,new Vc([],o),e,o)}}function vb(t){let e=t.tokens[t.index++];return new Ad(e.content,e.range)}function pg(t){if(!t)return pg({start:"/**",end:"*/",line:"*"});let{start:e,end:r,line:n}=t;return{start:fg(e,!0),end:fg(r,!1),line:fg(n,!0)}}function fg(t,e){if(typeof t=="string"||typeof t=="object"){let r=typeof t=="string"?wn(t):t.source;return e?new RegExp(`^\\s*${r}`):new RegExp(`\\s*${r}\\s*$`)}else return t}var Ed=class{constructor(e,r){this.elements=e,this.range=r}getTag(e){return this.getAllTags().find(r=>r.name===e)}getTags(e){return this.getAllTags().filter(r=>r.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(let r of this.elements)if(e.length===0)e=r.toString();else{let n=r.toString();e+=pb(e)+n}return e.trim()}toMarkdown(e){let r="";for(let n of this.elements)if(r.length===0)r=n.toMarkdown(e);else{let i=n.toMarkdown(e);r+=pb(r)+i}return r.trim()}},Kc=class{constructor(e,r,n,i){this.name=e,this.content=r,this.inline=n,this.range=i}toString(){let e=`@${this.name}`,r=this.content.toString();return this.content.inlines.length===1?e=`${e} ${r}`:this.content.inlines.length>1&&(e=`${e}
150
+ ${r}`),this.inline?`{${e}}`:e}toMarkdown(e){var r,n;return(n=(r=e?.renderTag)===null||r===void 0?void 0:r.call(e,this))!==null&&n!==void 0?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){let r=this.content.toMarkdown(e);if(this.inline){let o=YF(this.name,r,e??{});if(typeof o=="string")return o}let n="";e?.tag==="italic"||e?.tag===void 0?n="*":e?.tag==="bold"?n="**":e?.tag==="bold-italic"&&(n="***");let i=`${n}@${this.name}${n}`;return this.content.inlines.length===1?i=`${i} \u2014 ${r}`:this.content.inlines.length>1&&(i=`${i}
151
+ ${r}`),this.inline?`{${i}}`:i}};function YF(t,e,r){var n,i;if(t==="linkplain"||t==="linkcode"||t==="link"){let o=e.indexOf(" "),s=e;if(o>0){let c=hg(e,o);s=e.substring(c),e=e.substring(0,o)}return(t==="linkcode"||t==="link"&&r.link==="code")&&(s=`\`${s}\``),(i=(n=r.renderLink)===null||n===void 0?void 0:n.call(r,e,s))!==null&&i!==void 0?i:JF(e,s)}}function JF(t,e){try{return tt.parse(t,!0),`[${e}](${t})`}catch{return t}}var Vc=class{constructor(e,r){this.inlines=e,this.range=r}toString(){let e="";for(let r=0;r<this.inlines.length;r++){let n=this.inlines[r],i=this.inlines[r+1];e+=n.toString(),i&&i.range.start.line>n.range.start.line&&(e+=`
152
152
  `)}return e}toMarkdown(e){let r="";for(let n=0;n<this.inlines.length;n++){let i=this.inlines[n],o=this.inlines[n+1];r+=i.toMarkdown(e),o&&o.range.start.line>i.range.start.line&&(r+=`
153
- `)}return r}},Ad=class{constructor(e,r){this.text=e,this.range=r}toString(){return this.text}toMarkdown(){return this.text}};function fb(t){return t.endsWith(`
153
+ `)}return r}},Ad=class{constructor(e,r){this.text=e,this.range=r}toString(){return this.text}toMarkdown(){return this.text}};function pb(t){return t.endsWith(`
154
154
  `)?`
155
155
  `:`
156
156
 
157
- `}var Jc=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let r=this.commentProvider.getComment(e);if(r&&Yc(r))return Xc(r).toMarkdown({renderLink:(i,o)=>this.documentationLinkRenderer(e,i,o),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,r,n){var i;let o=(i=this.findNameInPrecomputedScopes(e,r))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,r);if(o&&o.nameSegment){let s=o.nameSegment.range.start.line+1,a=o.nameSegment.range.start.character+1,c=o.documentUri.with({fragment:`L${s},${a}`});return`[${n}](${c.toString()})`}else return}documentationTagRenderer(e,r){}findNameInPrecomputedScopes(e,r){let i=rt(e).precomputedScopes;if(!i)return;let o=e;do{let a=i.get(o).find(c=>c.name===r);if(a)return a;o=o.$container}while(o)}findNameInGlobalScope(e,r){return this.indexManager.allElements().find(i=>i.name===r)}};var Qc=class{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var r;return Mc(e)?e.$comment:(r=xa(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||r===void 0?void 0:r.text}};var Zc=class{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,r){return Promise.resolve(this.syncParser.parse(e))}},hg=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;){let e=this.createWorker();e.onReady(()=>{if(this.queue.length>0){let r=this.queue.shift();r&&(e.lock(),r.resolve(e))}}),this.workerPool.push(e)}}async parse(e,r){let n=await this.acquireParserWorker(r),i=new Wt,o,s=r.onCancellationRequested(()=>{o=setTimeout(()=>{this.terminateWorker(n)},this.terminationDelay)});return n.parse(e).then(a=>{let c=this.hydrator.hydrate(a);i.resolve(c)}).catch(a=>{i.reject(a)}).finally(()=>{s.dispose(),clearTimeout(o)}),i.promise}terminateWorker(e){e.terminate();let r=this.workerPool.indexOf(e);r>=0&&this.workerPool.splice(r,1)}async acquireParserWorker(e){this.initializeWorkers();for(let n of this.workerPool)if(n.ready)return n.lock(),n;let r=new Wt;return e.onCancellationRequested(()=>{let n=this.queue.indexOf(r);n>=0&&this.queue.splice(n,1),r.reject(Zr)}),this.queue.push(r),r.promise}},pg=class{get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,r,n,i){this.onReadyEmitter=new Pe.Emitter,this.deferred=new Wt,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=i,r(o=>{let s=o;this.deferred.resolve(s),this.unlock()}),n(o=>{this.deferred.reject(o),this.unlock()})}terminate(){this.deferred.reject(Zr),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 Wt,this.sendMessage(e),this.deferred.promise}};var eu=class{constructor(){this.previousTokenSource=new B.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let r=Td();return this.previousTokenSource=r,this.enqueue(this.writeQueue,e,r.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,r,n=B.CancellationToken.None){let i=new Wt,o={action:r,deferred:i,cancellationToken:n};return e.push(o),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:r,deferred:n,cancellationToken:i})=>{try{let o=await Promise.resolve().then(()=>r(i));n.resolve(o)}catch(o){en(o)?n.resolve(void 0):n.reject(o)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}};var tu=class{constructor(e){this.grammarElementIdMap=new qi,this.tokenTypeIdMap=new qi,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(r=>Object.assign(Object.assign({},r),{message:r.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){let r=new Map,n=new Map;for(let i of mr(e))r.set(i,{});if(e.$cstNode)for(let i of di(e.$cstNode))n.set(i,{});return{astNodes:r,cstNodes:n}}dehydrateAstNode(e,r){let n=r.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,r));for(let[i,o]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];n[i]=s;for(let a of o)we(a)?s.push(this.dehydrateAstNode(a,r)):Rt(a)?s.push(this.dehydrateReference(a,r)):s.push(a)}else we(o)?n[i]=this.dehydrateAstNode(o,r):Rt(o)?n[i]=this.dehydrateReference(o,r):o!==void 0&&(n[i]=o);return n}dehydrateReference(e,r){let n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=r.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,r){let n=r.cstNodes.get(e);return ya(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=r.astNodes.get(e.astNode),Er(e)?n.content=e.content.map(i=>this.dehydrateCstNode(i,r)):An(e)&&(n.tokenType=e.tokenType.name,n.offset=e.offset,n.length=e.length,n.startLine=e.range.start.line,n.startColumn=e.range.start.character,n.endLine=e.range.end.line,n.endColumn=e.range.end.character),n}hydrate(e){let r=e.value,n=this.createHydrationContext(r);return"$cstNode"in r&&this.hydrateCstNode(r.$cstNode,n),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(r,n)}}createHydrationContext(e){let r=new Map,n=new Map;for(let o of mr(e))r.set(o,{});let i;if(e.$cstNode)for(let o of di(e.$cstNode)){let s;"fullText"in o?(s=new $s(o.fullText),i=s):"content"in o?s=new Li:"tokenType"in o&&(s=this.hydrateCstLeafNode(o)),s&&(n.set(o,s),s.root=i)}return{astNodes:r,cstNodes:n}}hydrateAstNode(e,r){let n=r.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode&&(n.$cstNode=r.cstNodes.get(e.$cstNode));for(let[i,o]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];n[i]=s;for(let a of o)we(a)?s.push(this.setParent(this.hydrateAstNode(a,r),n)):Rt(a)?s.push(this.hydrateReference(a,n,i,r)):s.push(a)}else we(o)?n[i]=this.setParent(this.hydrateAstNode(o,r),n):Rt(o)?n[i]=this.hydrateReference(o,n,i,r):o!==void 0&&(n[i]=o);return n}setParent(e,r){return e.$container=r,e}hydrateReference(e,r,n,i){return this.linker.buildReference(r,n,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,r,n=0){let i=r.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=r.astNodes.get(e.astNode),Er(i))for(let o of e.content){let s=this.hydrateCstNode(o,r,n++);i.content.push(s)}return i}hydrateCstLeafNode(e){let r=this.getTokenType(e.tokenType),n=e.offset,i=e.length,o=e.startLine,s=e.startColumn,a=e.endLine,c=e.endColumn,u=e.hidden;return new Oi(n,i,{start:{line:o,character:s},end:{line:a,character:c}},r,u)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(let r of mr(this.grammar))mi(r)&&this.grammarElementIdMap.set(r,e++)}};function ru(t){return{documentation:{CommentProvider:e=>new Qc(e),DocumentationProvider:e=>new Jc(e)},parser:{AsyncParser:e=>new Zc(e),GrammarConfig:e=>op(e),LangiumParser:e=>Qm(e),CompletionParser:e=>Jm(e),ValueConverter:()=>new Cc,TokenBuilder:()=>new Fi,Lexer:e=>new Bi(e),ParserErrorMessageProvider:()=>new qs,LexerErrorMessageProvider:()=>new zc},workspace:{AstNodeLocator:()=>new jc,AstNodeDescriptionProvider:e=>new qc(e),ReferenceDescriptionProvider:e=>new Uc(e)},references:{Linker:e=>new Ac(e),NameProvider:()=>new wc,ScopeProvider:e=>new Oc(e),ScopeComputation:e=>new Pc(e),References:e=>new Nc(e)},serializer:{Hydrator:e=>new tu(e),JsonSerializer:e=>new Lc(e)},validation:{DocumentValidator:e=>new Wi(e),ValidationRegistry:e=>new $c(e)},shared:()=>t.shared}}function nu(t){return{ServiceRegistry:e=>new Fc(e),workspace:{LangiumDocuments:e=>new Ec(e),LangiumDocumentFactory:e=>new Sc(e),DocumentBuilder:e=>new Bc(e),IndexManager:e=>new Hc(e),WorkspaceManager:e=>new Gc(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new eu,ConfigurationProvider:e=>new Wc(e)}}}var Vs;(function(t){t.merge=(e,r)=>wd(wd({},e),r)})(Vs||(Vs={}));function Hi(t,e,r,n,i,o,s,a,c){let u=[t,e,r,n,i,o,s,a,c].reduce(wd,{});return Tb(u)}var xb=Symbol("isProxy");function iu(t){if(t&&t[xb])for(let e of Object.values(t))iu(e);return t}function Tb(t,e){let r=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(n,i)=>i===xb?!0:vb(n,i,t,e||r),getOwnPropertyDescriptor:(n,i)=>(vb(n,i,t,e||r),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return r}var yb=Symbol();function vb(t,e,r,n){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===yb)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in r){let i=r[e];t[e]=yb;try{t[e]=typeof i=="function"?i(n):Tb(i,n)}catch(o){throw t[e]=o instanceof Error?o:void 0,o}return t[e]}else return}function wd(t,e){if(e){for(let[r,n]of Object.entries(e))if(n!==void 0){let i=t[r];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?t[r]=wd(i,n):t[r]=n}}return t}var mg={indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[]},Gi;(function(t){t.REGULAR="indentation-sensitive",t.IGNORE_INDENTATION="ignore-indentation"})(Gi||(Gi={}));var Nd=class extends Fi{constructor(e=mg){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options=Object.assign(Object.assign({},mg),e),this.indentTokenType=Gn({name:this.options.indentTokenName,pattern:this.indentMatcher.bind(this),line_breaks:!1}),this.dedentTokenType=Gn({name:this.options.dedentTokenName,pattern:this.dedentMatcher.bind(this),line_breaks:!1})}buildTokens(e,r){let n=super.buildTokens(e,r);if(!Sd(n))throw new Error("Invalid tokens built by default builder");let{indentTokenName:i,dedentTokenName:o,whitespaceTokenName:s,ignoreIndentationDelimiters:a}=this.options,c,u,l,d=[];for(let f of n){for(let[p,v]of a)f.name===p?f.PUSH_MODE=Gi.IGNORE_INDENTATION:f.name===v&&(f.POP_MODE=!0);f.name===o?c=f:f.name===i?u=f:f.name===s?l=f:d.push(f)}if(!c||!u||!l)throw new Error("Some indentation/whitespace tokens not found!");return a.length>0?{modes:{[Gi.REGULAR]:[c,u,...d,l],[Gi.IGNORE_INDENTATION]:[...d,l]},defaultMode:Gi.REGULAR}:[c,u,l,...d]}flushLexingReport(e){let r=super.flushLexingReport(e);return Object.assign(Object.assign({},r),{remainingDedents:this.flushRemainingDedents(e)})}isStartOfLine(e,r){return r===0||`\r
158
- `.includes(e[r-1])}matchWhitespace(e,r,n,i){var o;this.whitespaceRegExp.lastIndex=r;let s=this.whitespaceRegExp.exec(e);return{currIndentLevel:(o=s?.[0].length)!==null&&o!==void 0?o:0,prevIndentLevel:this.indentationStack.at(-1),match:s}}createIndentationTokenInstance(e,r,n,i){let o=this.getLineNumber(r,i);return vn(e,n,i,i+n.length,o,o,1,n.length)}getLineNumber(e,r){return e.substring(0,r).split(/\r\n|\r|\n/).length}indentMatcher(e,r,n,i){if(!this.isStartOfLine(e,r))return null;let{currIndentLevel:o,prevIndentLevel:s,match:a}=this.matchWhitespace(e,r,n,i);return o<=s?null:(this.indentationStack.push(o),a)}dedentMatcher(e,r,n,i){var o,s,a,c;if(!this.isStartOfLine(e,r))return null;let{currIndentLevel:u,prevIndentLevel:l,match:d}=this.matchWhitespace(e,r,n,i);if(u>=l)return null;let f=this.indentationStack.lastIndexOf(u);if(f===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${u} at offset: ${r}. Current indentation stack: ${this.indentationStack}`,offset:r,length:(s=(o=d?.[0])===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0,line:this.getLineNumber(e,r),column:1}),null;let p=this.indentationStack.length-f-1,v=(c=(a=e.substring(0,r).match(/[\r\n]+$/))===null||a===void 0?void 0:a[0].length)!==null&&c!==void 0?c:1;for(let T=0;T<p;T++){let k=this.createIndentationTokenInstance(this.dedentTokenType,e,"",r-(v-1));n.push(k),this.indentationStack.pop()}return null}buildTerminalToken(e){let r=super.buildTerminalToken(e),{indentTokenName:n,dedentTokenName:i,whitespaceTokenName:o}=this.options;return r.name===n?this.indentTokenType:r.name===i?this.dedentTokenType:r.name===o?Gn({name:o,pattern:this.whitespaceRegExp,group:Me.SKIPPED}):r}flushRemainingDedents(e){let r=[];for(;this.indentationStack.length>1;)r.push(this.createIndentationTokenInstance(this.dedentTokenType,e,"",e.length)),this.indentationStack.pop();return this.indentationStack=[0],r}},gg=class extends Bi{constructor(e){if(super(e),e.parser.TokenBuilder instanceof Nd)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(e,r=kd){let n=super.tokenize(e),i=n.report;r?.mode==="full"&&n.tokens.push(...i.remainingDedents),i.remainingDedents=[];let{indentTokenType:o,dedentTokenType:s}=this.indentationTokenBuilder,a=o.tokenTypeIdx,c=s.tokenTypeIdx,u=[],l=n.tokens.length-1;for(let d=0;d<l;d++){let f=n.tokens[d],p=n.tokens[d+1];if(f.tokenTypeIdx===a&&p.tokenTypeIdx===c){d++;continue}u.push(f)}return l>=0&&u.push(n.tokens[l]),n.tokens=u,n}};var ue={};En(ue,{AstUtils:()=>Uu,BiMap:()=>qi,Cancellation:()=>B,ContextCache:()=>Ui,CstUtils:()=>Ou,DONE_RESULT:()=>St,Deferred:()=>Wt,Disposable:()=>Jn,DisposableCache:()=>Gs,DocumentCache:()=>bd,EMPTY_STREAM:()=>va,ErrorWithLocation:()=>hi,GrammarUtils:()=>Gu,MultiMap:()=>Pr,OperationCancelled:()=>Zr,Reduction:()=>Zi,RegExpUtils:()=>Bu,SimpleCache:()=>Ic,StreamImpl:()=>or,TreeStreamImpl:()=>Lr,URI:()=>tt,UriUtils:()=>oe,WorkspaceCache:()=>zs,assertUnreachable:()=>Fr,delayNextTick:()=>og,interruptAndCheck:()=>Be,isOperationCancelled:()=>en,loadGrammarFromJson:()=>Dd,setInterruptionPeriod:()=>nb,startCancelableOperation:()=>Td,stream:()=>Z});se(ue,Pe);var Pd=class{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}},ou={fileSystemProvider:()=>new Pd};var YF={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},JF={AstReflection:()=>new Uo};function QF(){let t=Hi(nu(ou),JF),e=Hi(ru({shared:t}),YF);return t.ServiceRegistry.register(e),e}function Dd(t){var e;let r=QF(),n=r.serializer.JsonSerializer.deserialize(t);return r.shared.workspace.LangiumDocumentFactory.fromModel(n,tt.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}se(Ke,ue);var ha=hr(an(),1);function tv(t,e){let r={stacks:t,tokens:e};return B$(r),r.stacks.flat().forEach(i=>{i.property=void 0}),IE(r.stacks).map(i=>i[i.length-1])}function rv(t){let{next:e,cardinalities:r,visited:n,plus:i}=t,o=[],s=e.feature;if(n.has(s))return[];pr(s)||n.add(s);let a,c=s;for(;c.$container;)if(pr(c.$container)){a=c.$container;break}else if(mi(c.$container))c=c.$container;else break;if(rp(c.cardinality)){let u=fa({next:{feature:c,type:e.type},cardinalities:r,visited:n,plus:i});for(let l of u)i.add(l.feature);o.push(...u)}if(a){let u=a.elements.indexOf(c);u!==void 0&&u<a.elements.length-1&&o.push(...DE({feature:a,type:e.type},u+1,r,n,i)),o.every(l=>Ri(l.feature.cardinality,l.feature)||Ri(r.get(l.feature))||i.has(l.feature))&&o.push(...rv({next:{feature:a,type:e.type},cardinalities:r,visited:n,plus:i}))}return o}function Uf(t){return we(t)&&(t={feature:t}),fa({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function fa(t){var e,r,n;let{next:i,cardinalities:o,visited:s,plus:a}=t;if(i===void 0)return[];let{feature:c,type:u}=i;if(pr(c))return s.has(c)?[]:(s.add(c),DE(i,0,o,s,a).map(l=>qf(l,c.cardinality,o)));if(jo(c)||Wo(c))return c.elements.flatMap(l=>fa({next:{feature:l,type:u,property:i.property},cardinalities:o,visited:s,plus:a})).map(l=>qf(l,c.cardinality,o));if(Et(c)){let l={feature:c.terminal,type:u,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return fa({next:l,cardinalities:o,visited:s,plus:a}).map(d=>qf(d,c.cardinality,o))}else{if(Ar(c))return rv({next:{feature:c,type:_i(c),property:(r=i.property)!==null&&r!==void 0?r:c.feature},cardinalities:o,visited:s,plus:a});if(Vt(c)&&Ie(c.rule.ref)){let l=c.rule.ref,d={feature:l.definition,type:l.fragment||l.dataType?void 0:(n=qr(l))!==null&&n!==void 0?n:l.name,property:i.property};return fa({next:d,cardinalities:o,visited:s,plus:a}).map(f=>qf(f,c.cardinality,o))}else return[i]}}function qf(t,e,r){return r.set(t.feature,e),t}function DE(t,e,r,n,i){var o;let s=[],a;for(;e<t.feature.elements.length&&(a={feature:t.feature.elements[e++],type:t.type},s.push(...fa({next:a,cardinalities:r,visited:n,plus:i})),!!Ri((o=a.feature.cardinality)!==null&&o!==void 0?o:r.get(a.feature),a.feature)););return s}function B$(t){for(let e of t.tokens){let r=IE(t.stacks,e);t.stacks=r}}function IE(t,e){let r=[];for(let n of t)r.push(...H$(n,e));return r}function H$(t,e){let r=new Map,n=new Set(t.map(o=>o.feature).filter(G$)),i=[];for(;t.length>0;){let o=t.pop(),s=rv({next:o,cardinalities:r,plus:n,visited:new Set}).filter(a=>e?nv(a.feature,e):!0);for(let a of s)i.push([...t,a]);if(!s.every(a=>Ri(a.feature.cardinality,a.feature)||Ri(r.get(a.feature))))break}return i}function G$(t){if(t.cardinality==="+")return!0;let e=ar(t,Et);return!!(e&&e.cardinality==="+")}function nv(t,e){if(lt(t))return t.value===e.image;if(Vt(t))return z$(t.rule.ref,e);if(sr(t)){let r=Fa(t);if(r)return nv(r,e)}return!1}function z$(t,e){return Ie(t)?Uf(t.definition).some(n=>nv(n.feature,e)):Mt(t)?Nn(t).test(e.image):!1}function OE(t){let e=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.triggerCharacters)!==null&&i!==void 0?i:[]}))),r=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.allCommitCharacters)!==null&&i!==void 0?i:[]})));return{triggerCharacters:e.length>0?e:void 0,allCommitCharacters:r.length>0?r:void 0}}var jf=class{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.lexer=e.parser.Lexer,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.fuzzyMatcher=e.shared.lsp.FuzzyMatcher,this.grammarConfig=e.parser.GrammarConfig,this.astReflection=e.shared.AstReflection,this.documentationProvider=e.documentation.DocumentationProvider}async getCompletion(e,r,n){let i=[],o=this.buildContexts(e,r.position),s=(u,l)=>{let d=this.fillCompletionItem(u,l);d&&i.push(d)},a=u=>lt(u.feature)?u.feature.value:u.feature,c=[];for(let u of o)if(await Promise.all(Z(u.features).distinct(a).exclude(c).map(l=>this.completionFor(u,l,s))),c.push(...u.features),!this.continueCompletion(i))break;return ha.CompletionList.create(this.deduplicateItems(i),!0)}deduplicateItems(e){return Z(e).distinct(r=>`${r.kind}_${r.label}_${r.detail}`).toArray()}findFeaturesAt(e,r){let n=e.getText({start:ha.Position.create(0,0),end:e.positionAt(r)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let c=La(this.grammar),u=Uf({feature:c.definition,type:qr(c)});return o.length>0?(o.shift(),tv(u.map(l=>[l]),o)):u}let s=[...o].splice(i.tokenIndex);return tv([i.elementStack.map(c=>({feature:c}))],s)}*buildContexts(e,r){var n,i;let o=e.parseResult.value.$cstNode;if(!o)return;let s=e.textDocument,a=s.getText(),c=s.offsetAt(r),u={document:e,textDocument:s,offset:c,position:r},l=this.findDataTypeRuleStart(o,c);if(l){let[g,h]=l,_=(n=Ta(o,g))===null||n===void 0?void 0:n.astNode;yield Object.assign(Object.assign({},u),{node:_,tokenOffset:g,tokenEndOffset:h,features:this.findFeaturesAt(s,g)})}let{nextTokenStart:d,nextTokenEnd:f,previousTokenStart:p,previousTokenEnd:v}=this.backtrackToAnyToken(a,c),T=d;c<=d&&p!==void 0&&(T=p);let k=(i=Ta(o,T))===null||i===void 0?void 0:i.astNode,R=!0;if(p!==void 0&&v!==void 0&&v===c&&(yield Object.assign(Object.assign({},u),{node:k,tokenOffset:p,tokenEndOffset:v,features:this.findFeaturesAt(s,p)}),R=this.performNextTokenCompletion(e,a.substring(p,v),p,v),R&&(yield Object.assign(Object.assign({},u),{node:k,tokenOffset:v,tokenEndOffset:v,features:this.findFeaturesAt(s,v)}))),k)R&&(yield Object.assign(Object.assign({},u),{node:k,tokenOffset:d,tokenEndOffset:f,features:this.findFeaturesAt(s,d)}));else{let g=La(this.grammar);if(!g)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},u),{tokenOffset:d,tokenEndOffset:f,features:Uf(g.definition)})}}performNextTokenCompletion(e,r,n,i){return/\P{L}$/u.test(r)}findDataTypeRuleStart(e,r){var n,i;let o=Kt(e,r,this.grammarConfig.nameRegexp),s=!!(!((n=ar(o?.grammarSource,Ie))===null||n===void 0)&&n.dataType);if(s){for(;s;)o=o?.container,s=!!(!((i=ar(o?.grammarSource,Ie))===null||i===void 0)&&i.dataType);if(o)return[o.offset,o.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,r){let n=this.lexer.tokenize(e).tokens;if(n.length===0)return{nextTokenStart:r,nextTokenEnd:r};let i;for(let o of n){if(o.startOffset>=r)return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};if(o.endOffset>=r)return{nextTokenStart:o.startOffset,nextTokenEnd:o.endOffset+1,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};i=o}return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0}}completionFor(e,r,n){if(lt(r.feature))return this.completionForKeyword(e,r.feature,n);if(sr(r.feature)&&e.node)return this.completionForCrossReference(e,r,n)}completionForCrossReference(e,r,n){let i=ar(r.feature,Et),o=e.node;if(i&&o){r.type&&(o={$type:r.type,$container:o,$containerProperty:r.property},Na(this.astReflection,o));let s={reference:{$refText:""},container:o,property:i.feature};try{for(let a of this.getReferenceCandidates(s,e))n(e,this.createReferenceCompletionItem(a))}catch(a){console.error(a)}}}getReferenceCandidates(e,r){return this.scopeProvider.getScope(e).getAllElements()}createReferenceCompletionItem(e){let r=this.nodeKindProvider.getCompletionItemKind(e),n=this.getReferenceDocumentation(e);return{nodeDescription:e,kind:r,documentation:n,detail:e.type,sortText:"0"}}getReferenceDocumentation(e){if(!e.node)return;let r=this.documentationProvider.getDocumentation(e.node);if(r)return{kind:"markdown",value:r}}completionForKeyword(e,r,n){this.filterKeyword(e,r)&&n(e,{label:r.value,kind:this.getKeywordCompletionItemKind(r),detail:"Keyword",sortText:"1"})}getKeywordCompletionItemKind(e){return ha.CompletionItemKind.Keyword}filterKeyword(e,r){return/\p{L}/u.test(r.value)}fillCompletionItem(e,r){var n,i;let o;if(typeof r.label=="string")o=r.label;else if("node"in r){let u=this.nameProvider.getName(r.node);if(!u)return;o=u}else if("nodeDescription"in r)o=r.nodeDescription.name;else return;let s;typeof((n=r.textEdit)===null||n===void 0?void 0:n.newText)=="string"?s=r.textEdit.newText:typeof r.insertText=="string"?s=r.insertText:s=o;let a=(i=r.textEdit)!==null&&i!==void 0?i:this.buildCompletionTextEdit(e,o,s);return a?{additionalTextEdits:r.additionalTextEdits,command:r.command,commitCharacters:r.commitCharacters,data:r.data,detail:r.detail,documentation:r.documentation,filterText:r.filterText,insertText:r.insertText,insertTextFormat:r.insertTextFormat,insertTextMode:r.insertTextMode,kind:r.kind,labelDetails:r.labelDetails,preselect:r.preselect,sortText:r.sortText,tags:r.tags,textEditText:r.textEditText,textEdit:a,label:o}:void 0}buildCompletionTextEdit(e,r,n){let o=e.textDocument.getText().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(o,r)){let s=e.textDocument.positionAt(e.tokenOffset),a=e.position;return{newText:n,range:{start:s,end:a}}}else return}};var LE=hr(an(),1);var Wf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,r,n){let i=e.parseResult.value;if(i.$cstNode){let o=i.$cstNode,s=Kt(o,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(s)return this.collectLocationLinks(s,r)}}collectLocationLinks(e,r){var n;let i=this.findLink(e);if(i)return[LE.LocationLink.create(i.targetDocument.textDocument.uri,((n=i.target.astNode.$cstNode)!==null&&n!==void 0?n:i.target).range,i.target.range,i.source.range)]}findLink(e){let r=this.references.findDeclarationNode(e);if(r?.astNode){let n=rt(r.astNode);if(r&&n)return{source:e,target:r,targetDocument:n}}}};var ME=hr(an(),1);var Bf=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,r,n){let i=e.parseResult.value.$cstNode;if(!i)return;let o=Kt(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!o)return;let s=this.references.findDeclaration(o);if(s){let a=oe.equals(rt(s).uri,e.uri),c={documentUri:e.uri,includeDeclaration:a};return this.references.findReferences(s,c).map(l=>this.createDocumentHighlight(l)).toArray()}}createDocumentHighlight(e){return ME.DocumentHighlight.create(e.segment.range)}};var Hf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e,r,n){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,r){let n=r.$cstNode,i=this.nameProvider.getNameNode(r);if(i&&n){let o=this.nameProvider.getName(r);return[{kind:this.nodeKindProvider.getSymbolKind(r),name:o||i.text,range:n.range,selectionRange:i.range,children:this.getChildSymbols(e,r)}]}else return this.getChildSymbols(e,r)||[]}getChildSymbols(e,r){let n=[];for(let i of yi(r)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}};var Tu=hr(an(),1);var Gf=class{constructor(e){this.workspaceManager=e.workspace.WorkspaceManager,this.documentBuilder=e.workspace.DocumentBuilder,this.workspaceLock=e.workspace.WorkspaceLock,this.serviceRegistry=e.ServiceRegistry;let r=!1;e.lsp.LanguageServer.onInitialize(n=>{var i,o;r=!!(!((o=(i=n.capabilities.workspace)===null||i===void 0?void 0:i.didChangeWatchedFiles)===null||o===void 0)&&o.dynamicRegistration)}),e.lsp.LanguageServer.onInitialized(n=>{r&&this.registerFileWatcher(e)})}registerFileWatcher(e){let r=[],n=Z(e.ServiceRegistry.all).flatMap(o=>o.LanguageMetaData.fileExtensions).map(o=>o.startsWith(".")?o.substring(1):o).distinct().toArray();n.length>0&&r.push({globPattern:n.length===1?`**/*.${n[0]}`:`**/*.{${n.join(",")}}`});let i=Z(e.ServiceRegistry.all).flatMap(o=>{var s;return(s=o.LanguageMetaData.fileNames)!==null&&s!==void 0?s:[]}).distinct().toArray();if(i.length>0&&r.push({globPattern:i.length===1?`**/${i[0]}`:`**/{${i.join(",")}}`}),r.length>0){let o=e.lsp.Connection,s={watchers:r};o?.client.register(Tu.DidChangeWatchedFilesNotification.type,s)}}fireDocumentUpdate(e,r){e=e.filter(n=>this.serviceRegistry.hasServices(n)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(n=>this.documentBuilder.update(e,r,n))}).catch(n=>{console.error("Workspace initialization failed. Could not perform document update.",n)})}didChangeContent(e){this.fireDocumentUpdate([tt.parse(e.document.uri)],[])}didChangeWatchedFiles(e){let r=Z(e.changes).filter(i=>i.type!==Tu.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>tt.parse(i.uri)).toArray(),n=Z(e.changes).filter(i=>i.type===Tu.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>tt.parse(i.uri)).toArray();this.fireDocumentUpdate(r,n)}};var Ru=hr(an(),1);var zf=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,r,n){let i=[],o=s=>i.push(s);return this.collectFolding(e,o),i}collectFolding(e,r){var n;let i=(n=e.parseResult)===null||n===void 0?void 0:n.value;if(i){if(this.shouldProcessContent(i)){let o=cr(i).iterator(),s;do if(s=o.next(),!s.done){let a=s.value;this.shouldProcess(a)&&this.collectObjectFolding(e,a,r),this.shouldProcessContent(a)||o.prune()}while(!s.done)}this.collectCommentFolding(e,i,r)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,r,n){let i=r.$cstNode;if(i){let o=this.toFoldingRange(e,i);o&&n(o)}}collectCommentFolding(e,r,n){let i=r.$cstNode;if(i){for(let o of xh(i))if(this.commentNames.includes(o.tokenType.name)){let s=this.toFoldingRange(e,o,Ru.FoldingRangeKind.Comment);s&&n(s)}}}toFoldingRange(e,r,n){let i=r.range,o=i.start,s=i.end;if(!(s.line-o.line<2))return this.includeLastFoldingLine(r,n)||(s=e.textDocument.positionAt(e.textDocument.offsetAt({line:s.line,character:0})-1)),Ru.FoldingRange.create(o.line,s.line,o.character,s.character,n)}includeLastFoldingLine(e,r){if(r===Ru.FoldingRangeKind.Comment)return!1;let n=e.text,i=n.charAt(n.length-1);return!(i==="}"||i===")"||i==="]")}};var Kf=class{match(e,r){if(e.length===0)return!0;let n=!1,i,o=0,s=r.length;for(let a=0;a<s;a++){let c=r.charCodeAt(a),u=e.charCodeAt(o);if((c===u||this.toUpperCharCode(c)===this.toUpperCharCode(u))&&(n||(n=i===void 0||this.isWordTransition(i,c)),n&&o++,o===e.length))return!0;i=c}return!1}isWordTransition(e,r){return FE<=e&&e<=$E&&K$<=r&&r<=V$||e===qE&&r!==qE}toUpperCharCode(e){return FE<=e&&e<=$E?e-32:e}},FE=97,$E=122,K$=65,V$=90,qE=95;var iv=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,r){var n,i;let o=(i=(n=e.parseResult)===null||n===void 0?void 0:n.value)===null||i===void 0?void 0:i.$cstNode;if(o){let s=e.textDocument.offsetAt(r.position),a=Kt(o,s,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>s){let c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c);if(lt(a.grammarSource))return this.getKeywordHoverContent(a.grammarSource)}}}getKeywordHoverContent(e){var r;let n=Mc(e)?e.$comment:void 0;if(n||(n=(r=xa(e.$cstNode,["ML_COMMENT"]))===null||r===void 0?void 0:r.text),n&&Yc(n)){let i=Xc(n).toMarkdown();if(i)return{contents:{kind:"markdown",value:i}}}}},Vf=class extends iv{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){let r=this.documentationProvider.getDocumentation(e);if(r)return{contents:{kind:"markdown",value:r}}}};var Cn=hr(Xe(),1);var re=hr(an(),1);var X$={[re.SemanticTokenTypes.class]:0,[re.SemanticTokenTypes.comment]:1,[re.SemanticTokenTypes.enum]:2,[re.SemanticTokenTypes.enumMember]:3,[re.SemanticTokenTypes.event]:4,[re.SemanticTokenTypes.function]:5,[re.SemanticTokenTypes.interface]:6,[re.SemanticTokenTypes.keyword]:7,[re.SemanticTokenTypes.macro]:8,[re.SemanticTokenTypes.method]:9,[re.SemanticTokenTypes.modifier]:10,[re.SemanticTokenTypes.namespace]:11,[re.SemanticTokenTypes.number]:12,[re.SemanticTokenTypes.operator]:13,[re.SemanticTokenTypes.parameter]:14,[re.SemanticTokenTypes.property]:15,[re.SemanticTokenTypes.regexp]:16,[re.SemanticTokenTypes.string]:17,[re.SemanticTokenTypes.struct]:18,[re.SemanticTokenTypes.type]:19,[re.SemanticTokenTypes.typeParameter]:20,[re.SemanticTokenTypes.variable]:21,[re.SemanticTokenTypes.decorator]:22},Y$={[re.SemanticTokenModifiers.abstract]:1,[re.SemanticTokenModifiers.async]:2,[re.SemanticTokenModifiers.declaration]:4,[re.SemanticTokenModifiers.defaultLibrary]:8,[re.SemanticTokenModifiers.definition]:16,[re.SemanticTokenModifiers.deprecated]:32,[re.SemanticTokenModifiers.documentation]:64,[re.SemanticTokenModifiers.modification]:128,[re.SemanticTokenModifiers.readonly]:256,[re.SemanticTokenModifiers.static]:512},Zee={legend:{tokenTypes:Object.keys(X$),tokenModifiers:Object.keys(Y$)},full:{delta:!0},range:!0};function jE(t){let e=[],r=[],n=!0,i=!0,o=!0;for(let s of t)s&&(s.legend.tokenTypes.forEach((a,c)=>{let u=e[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token types. They use the same index ${c}.`);e[c]=a}),s.legend.tokenModifiers.forEach((a,c)=>{let u=r[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token modifier. They use the same index ${c}.`);r[c]=a}),s.full?typeof s.full=="object"&&!s.full.delta&&(i=!1):n=!1,s.range||(o=!1));return{legend:{tokenTypes:e,tokenModifiers:r},full:n&&{delta:i},range:o}}var UE;(function(t){function e(n,i,o){let s=new Map;Object.entries(i).forEach(([u,l])=>s.set(l,u));let a=0,c=0;return r(n.data,5).map(u=>{a+=u[0],u[0]!==0&&(c=0),c+=u[1];let l=u[2];return{offset:o.textDocument.offsetAt({line:a,character:c}),tokenType:s.get(u[3]),tokenModifiers:u[4],text:o.textDocument.getText({start:{line:a,character:c},end:{line:a,character:c+l}})}})}t.decode=e;function r(n,i){let o=[];for(let s=0;s<n.length;s+=i){let a=n.slice(s,s+i);o.push(a)}return o}})(UE||(UE={}));function WE(t){let e=[],r=[];t.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&r.push(...i.retriggerCharacters)});let n={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:r.length>0?Array.from(new Set(r)).sort():void 0};return n.triggerCharacters?n:void 0}var Xf=class{constructor(e){this.onInitializeEmitter=new Cn.Emitter,this.onInitializedEmitter=new Cn.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.fireInitializeOnDefaultServices(e),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){iu(this.services),this.services.ServiceRegistry.all.forEach(e=>iu(e))}hasService(e){return this.services.ServiceRegistry.all.some(n=>e(n)!==void 0)}buildInitializeResult(e){var r,n,i,o;let s=this.services.lsp.DocumentUpdateHandler,a=(r=this.services.lsp.FileOperationHandler)===null||r===void 0?void 0:r.fileOperationOptions,c=this.services.ServiceRegistry.all,u=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.Formatter}),l=c.map(F=>{var b,Te;return(Te=(b=F.lsp)===null||b===void 0?void 0:b.Formatter)===null||Te===void 0?void 0:Te.formatOnTypeOptions}).find(F=>!!F),d=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.CodeActionProvider}),f=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.SemanticTokenProvider}),p=jE(c.map(F=>{var b,Te;return(Te=(b=F.lsp)===null||b===void 0?void 0:b.SemanticTokenProvider)===null||Te===void 0?void 0:Te.semanticTokensOptions})),v=(i=(n=this.services.lsp)===null||n===void 0?void 0:n.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,T=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DocumentLinkProvider}),k=WE(c.map(F=>{var b,Te;return(Te=(b=F.lsp)===null||b===void 0?void 0:b.SignatureHelp)===null||Te===void 0?void 0:Te.signatureHelpOptions})),R=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.TypeProvider}),g=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.ImplementationProvider}),h=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.CompletionProvider}),_=OE(c.map(F=>{var b,Te;return(Te=(b=F.lsp)===null||b===void 0?void 0:b.CompletionProvider)===null||Te===void 0?void 0:Te.completionOptions})),w=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.ReferencesProvider}),J=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DocumentSymbolProvider}),Bt=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DefinitionProvider}),Ye=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DocumentHighlightProvider}),ir=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.FoldingRangeProvider}),Ht=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.HoverProvider}),I=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.RenameProvider}),S=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.CallHierarchyProvider}),U=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.TypeHierarchyProvider}),M=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.CodeLensProvider}),ne=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DeclarationProvider}),K=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.InlayHintProvider}),H=(o=this.services.lsp)===null||o===void 0?void 0:o.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:a},executeCommandProvider:v&&{commands:v},textDocumentSync:{change:Cn.TextDocumentSyncKind.Incremental,openClose:!0,save:!!s.didSaveDocument,willSave:!!s.willSaveDocument,willSaveWaitUntil:!!s.willSaveDocumentWaitUntil},completionProvider:h?_:void 0,referencesProvider:w,documentSymbolProvider:J,definitionProvider:Bt,typeDefinitionProvider:R,documentHighlightProvider:Ye,codeActionProvider:d,documentFormattingProvider:u,documentRangeFormattingProvider:u,documentOnTypeFormattingProvider:l,foldingRangeProvider:ir,hoverProvider:Ht,renameProvider:I?{prepareProvider:!0}:void 0,semanticTokensProvider:f?p:void 0,signatureHelpProvider:k,implementationProvider:g,callHierarchyProvider:S?{}:void 0,typeHierarchyProvider:U?{}:void 0,documentLinkProvider:T?{resolveProvider:!1}:void 0,codeLensProvider:M?{resolveProvider:!1}:void 0,declarationProvider:ne,inlayHintProvider:K?{resolveProvider:!1}:void 0,workspaceSymbolProvider:H?{resolveProvider:!!H.resolveSymbol}:void 0}}}initialized(e){this.fireInitializedOnDefaultServices(e),this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}fireInitializeOnDefaultServices(e){this.services.workspace.ConfigurationProvider.initialize(e),this.services.workspace.WorkspaceManager.initialize(e)}fireInitializedOnDefaultServices(e){let r=this.services.lsp.Connection,n=r?Object.assign(Object.assign({},e),{register:i=>r.client.register(Cn.DidChangeConfigurationNotification.type,i),fetchConfiguration:i=>r.workspace.getConfiguration(i)}):e;this.services.workspace.ConfigurationProvider.initialized(n).catch(i=>console.error("Error in ConfigurationProvider initialization:",i)),this.services.workspace.WorkspaceManager.initialized(e).catch(i=>console.error("Error in WorkspaceManager initialization:",i))}};var Jf=hr(an(),1),Yf=class{getSymbolKind(e){return Jf.SymbolKind.Field}getCompletionItemKind(e){return Jf.CompletionItemKind.Reference}};var BE=hr(an(),1);var Qf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,r,n){let i=e.parseResult.value.$cstNode;if(!i)return[];let o=Kt(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);return o?this.getReferences(o,r,e):[]}getReferences(e,r,n){let i=[],o=this.references.findDeclaration(e);if(o){let s={includeDeclaration:r.context.includeDeclaration};this.references.findReferences(o,s).forEach(a=>{i.push(BE.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}};Ii();var Zf=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,r,n){let i={},o=e.parseResult.value.$cstNode;if(!o)return;let s=e.textDocument.offsetAt(r.position),a=Kt(o,s,this.grammarConfig.nameRegexp);if(!a)return;let c=this.references.findDeclaration(a);if(!c)return;let u={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(c,u).forEach(d=>{let f=vr.replace(d.segment.range,r.newName),p=d.sourceUri.toString();i[p]?i[p].push(f):i[p]=[f]}),{changes:i}}prepareRename(e,r,n){return this.renameNodeRange(e,r.position)}renameNodeRange(e,r){let n=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(r);if(n&&i){let o=Kt(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.astNode&&_d(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}};var eh=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,r=B.CancellationToken.None){let n=[],i=e.query.toLowerCase();for(let o of this.indexManager.allElements())if(await Be(r),this.fuzzyMatcher.match(i,o.name)){let s=this.getWorkspaceSymbol(o);s&&n.push(s)}return n}getWorkspaceSymbol(e){let r=e.nameSegment;if(r)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:r.range,uri:e.documentUri.toString()}}}};var xt=hr(an(),1);var _u=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new xt.Emitter,this._onDidOpen=new xt.Emitter,this._onDidClose=new xt.Emitter,this._onDidSave=new xt.Emitter,this._onWillSave=new xt.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(oe.normalize(e))}set(e){let r=oe.normalize(e.uri),n=!0;this._syncedDocuments.has(r)&&(n=!1),this._syncedDocuments.set(r,e);let i=Object.freeze({document:e});return this._onDidOpen.fire(i),this._onDidChangeContent.fire(i),n}delete(e){let r=oe.normalize(typeof e=="object"&&"uri"in e?e.uri:e),n=this._syncedDocuments.get(r);n!==void 0&&(this._syncedDocuments.delete(r),this._onDidClose.fire(Object.freeze({document:n})))}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=xt.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=oe.normalize(i.uri),s=this._configuration.create(o,i.languageId,i.version,i.text);this._syncedDocuments.set(o,s);let a=Object.freeze({document:s});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:s}=i;if(s==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=oe.normalize(i.uri),c=this._syncedDocuments.get(a);c!==void 0&&(c=this._configuration.update(c,o,s),this._syncedDocuments.set(a,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),r.push(e.onDidCloseTextDocument(n=>{let i=oe.normalize(n.textDocument.uri),o=this._syncedDocuments.get(i);o!==void 0&&(this._syncedDocuments.delete(i),this._onDidClose.fire(Object.freeze({document:o})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(oe.normalize(n.textDocument.uri));i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(oe.normalize(n.textDocument.uri));return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(oe.normalize(n.textDocument.uri));i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),xt.Disposable.create(()=>{r.forEach(n=>n.dispose())})}},th=class{constructor(e){this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new xt.Emitter,this._onDidSave=new xt.Emitter,this._onDidChange=new xt.Emitter,this._onDidClose=new xt.Emitter,"listen"in e?this._cellTextDocuments=e:this._cellTextDocuments=new _u(e)}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(oe.normalize(e))}getNotebookCell(e){let r=this.notebookCellMap.get(oe.normalize(e));return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"||"scheme"in e?e:e.document,n=this.notebookCellMap.get(oe.normalize(r));return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let r=new rh,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{let o=oe.normalize(i.notebookDocument.uri);this.notebookDocuments.set(o,i.notebookDocument);for(let s of i.cellTextDocuments)r.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=oe.normalize(i.notebookDocument.uri),s=this.notebookDocuments.get(o);if(s===void 0)return;s.version=i.notebookDocument.version;let a=s.metadata,c=!1,u=i.change;u.metadata!==void 0&&(c=!0,s.metadata=u.metadata);let l=[],d=[],f=[],p=[];if(u.cells!==void 0){let g=u.cells;if(g.structure!==void 0){let h=g.structure.array;if(s.cells.splice(h.start,h.deleteCount,...h.cells!==void 0?h.cells:[]),g.structure.didOpen!==void 0)for(let _ of g.structure.didOpen)r.openTextDocument({textDocument:_}),l.push(_.uri);if(g.structure.didClose)for(let _ of g.structure.didClose)r.closeTextDocument({textDocument:_}),d.push(_.uri)}if(g.data!==void 0){let h=new Map(g.data.map(_=>[_.document,_]));for(let _=0;_<=s.cells.length;_++){let w=h.get(s.cells[_].document);if(w!==void 0){let J=s.cells.splice(_,1,w);if(f.push({old:J[0],new:w}),h.delete(w.document),h.size===0)break}}}if(g.textContent!==void 0)for(let h of g.textContent)r.changeTextDocument({textDocument:h.document,contentChanges:h.changes}),p.push(h.document.uri)}this.updateCellMap(s);let v={notebookDocument:s};c&&(v.metadata={old:a,new:s.metadata});let T=[];for(let g of l)T.push(this.getNotebookCell(g));let k=[];for(let g of d)k.push(this.getNotebookCell(g));let R=[];for(let g of p)R.push(this.getNotebookCell(g));(T.length>0||k.length>0||f.length>0||R.length>0)&&(v.cells={added:T,removed:k,changed:{data:f,textContent:R}}),(v.metadata!==void 0||v.cells!==void 0)&&this._onDidChange.fire(v)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.getNotebookDocument(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=oe.normalize(i.notebookDocument.uri),s=this.notebookDocuments.get(o);if(s!==void 0){this._onDidClose.fire(s);for(let a of i.cellTextDocuments)r.closeTextDocument({textDocument:a});this.notebookDocuments.delete(o);for(let a of s.cells)this.notebookCellMap.delete(a.document)}})),xt.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}},rh=class t{onDidOpenTextDocument(e){return this.openHandler=e,xt.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,xt.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,xt.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};rh.NULL_DISPOSE=Object.freeze({dispose:()=>{}});function HE(t){return Vs.merge(ru(t),J$(t))}function J$(t){return{lsp:{CompletionProvider:e=>new jf(e),DocumentSymbolProvider:e=>new Hf(e),HoverProvider:e=>new Vf(e),FoldingRangeProvider:e=>new zf(e),ReferencesProvider:e=>new Qf(e),DefinitionProvider:e=>new Wf(e),DocumentHighlightProvider:e=>new Bf(e),RenameProvider:e=>new Zf(e)},shared:()=>t.shared}}function GE(t){return Vs.merge(nu(t),Q$(t))}function Q$(t){return{lsp:{Connection:()=>t.connection,LanguageServer:e=>new Xf(e),DocumentUpdateHandler:e=>new Gf(e),WorkspaceSymbolProvider:e=>new eh(e),NodeKindProvider:()=>new Yf,FuzzyMatcher:()=>new Kf},workspace:{TextDocuments:()=>new _u(Yn),NotebookDocuments:e=>new th(e.workspace.TextDocuments)}}}var zE="BlockCommand";var KE="LineCommand";var ov="AddressParam";var nh="CheckActionCommand";var ih="CheckAlarmCommand";var oh="CheckCommand";var sv="CodeParam";var bu="CountCommand";function uv(t){return fv.isInstance(t,bu)}var sh="DelayCommand";var Cu="LoopCommand";function lv(t){return fv.isInstance(t,Cu)}var ah="Model";var ku="ScheduleCommand";function dv(t){return fv.isInstance(t,ku)}var av="TimeParam";var ch="UnwatchCommand";var cv="ValueParam";var uh="WatchCommand";var lh="WriteCommand";var dh="TypeDeclare";var Su=class extends ui{getAllTypes(){return[ov,zE,nh,ih,oh,sv,bu,sh,KE,Cu,ah,ku,av,dh,ch,cv,uh,lh]}computeIsSubtype(e,r){switch(e){case nh:case ih:case oh:case sh:case ch:case uh:case lh:return this.isSubtype(KE,r);case bu:case Cu:case ku:return this.isSubtype(zE,r);case dh:return this.isSubtype(ah,r);default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;throw new Error(`${r} is not a valid reference id.`)}getTypeMetaData(e){switch(e){case ov:return{name:ov,properties:[{name:"bitWidth"},{name:"module"},{name:"value"}]};case nh:return{name:nh,properties:[{name:"code"}]};case ih:return{name:ih,properties:[{name:"codes",defaultValue:[]},{name:"codes2",defaultValue:[]}]};case oh:return{name:oh,properties:[{name:"address"},{name:"address2"},{name:"value"},{name:"value2"}]};case sv:return{name:sv,properties:[{name:"value"}]};case bu:return{name:bu,properties:[{name:"commands",defaultValue:[]},{name:"times"}]};case sh:return{name:sh,properties:[{name:"time"}]};case Cu:return{name:Cu,properties:[{name:"commands",defaultValue:[]},{name:"time"}]};case ah:return{name:ah,properties:[{name:"commands",defaultValue:[]}]};case ku:return{name:ku,properties:[{name:"commands",defaultValue:[]},{name:"time"}]};case av:return{name:av,properties:[{name:"value"}]};case ch:return{name:ch,properties:[{name:"address"}]};case cv:return{name:cv,properties:[{name:"value"}]};case uh:return{name:uh,properties:[{name:"address"},{name:"value"},{name:"value2"}]};case lh:return{name:lh,properties:[{name:"address"},{name:"address2"},{name:"value"}]};case dh:return{name:dh,properties:[{name:"commands",defaultValue:[]},{name:"value"}]};default:return{name:e,properties:[]}}}},fv=new Su;var VE,XE=()=>VE??(VE=Dd('{"$type":"Grammar","isDeclared":true,"name":"Acspec","rules":[{"$type":"ParserRule","entry":true,"name":"Model","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TypeDeclare","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"use"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"unit"},{"$type":"Keyword","value":"init"}]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineCommand","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BlockCommand","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WriteCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"write"},{"$type":"Keyword","value":"write!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"address2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check"},{"$type":"Keyword","value":"check!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Assignment","feature":"address2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckAlarmCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check_alarm"},{"$type":"Keyword","value":"check_alarm!"}]},{"$type":"Assignment","feature":"codes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"codes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"codes2","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"codes2","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckActionCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check_action"},{"$type":"Keyword","value":"check_action!"}]},{"$type":"Assignment","feature":"code","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WatchCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"watch"},{"$type":"Keyword","value":"watch!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UnwatchCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"unwatch"},{"$type":"Keyword","value":"unwatch!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DelayCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"delay"},{"$type":"Keyword","value":"delay!"}]},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ScheduleCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"schedule"},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LoopCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"loop"},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CountCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"count"},{"$type":"Assignment","feature":"times","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AddressParam","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"bitWidth","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Keyword","value":")"}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"module","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ValueParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CodeParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TimeParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/"},"fragment":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[_a-zA-Z][\\\\w_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?\\\\d+(\\\\.\\\\d+)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SL_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"types":[],"usedGrammars":[]}'));var eq={languageId:"acspec",fileExtensions:[".tsc"],caseInsensitive:!1,mode:"production"},YE={AstReflection:()=>new Su},JE={Grammar:()=>XE(),LanguageMetaData:()=>eq,parser:{}};function QE(t){let e=t.validation.ValidationRegistry,r=t.validation.AcspecValidator,n={WriteCommand:r.checkWriteCommand,CheckCommand:r.checkCheckCommand,DelayCommand:r.checkDelayCommand,CheckAlarmCommand:r.checkAlarmCommand,CheckActionCommand:r.checkActionCommand,WatchCommand:r.checkWatchCommand,UnwatchCommand:r.checkUnwatchCommand,ScheduleCommand:r.checkScheduleCommand,LoopCommand:r.checkLoopCommand,CountCommand:r.checkCountCommand};e.register(n,r)}var fh=class{validateAddress(e){return e?/^[A-Z]+[0-9]+$/.test(e):!1}checkAddressParam(e,r){e&&(this.validateAddress(e.value)||r("error","\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5BC4\u5B58\u5668\u5730\u5740\uFF0C\u4F8B\u5982\uFF1AM0100",{node:e,property:"value"}),e.bitWidth!==void 0&&(!Number.isInteger(e.bitWidth)||e.bitWidth<0)&&r("error","\u5730\u5740\u4F4D\u5BBD\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570\uFF0C\u4F8B\u598216\u621632",{node:e,property:"bitWidth"}),e.module!==void 0&&(!Number.isInteger(e.module)||e.module<0)&&r("error","\u6A21\u5757\u53F7\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:e,property:"module"}))}checkWriteCommand(e,r){this.checkAddressParam(e.address,r),this.checkAddressParam(e.address2,r)}checkCheckCommand(e,r){this.checkAddressParam(e.address,r),this.checkAddressParam(e.address2,r),e.value&&e.value2&&e.value2.value<=e.value.value&&r("error","\u6700\u5927\u503C\u5FC5\u987B\u5927\u4E8E\u6700\u5C0F\u503C",{node:e.value2,property:"value"})}checkAlarmCommand(e,r){Array.isArray(e.codes)&&(e.codes.forEach(n=>{(!Number.isInteger(n.value)||n.value<0)&&r("error","\u544A\u8B66\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:n,property:"value"})}),Array.isArray(e.codes2)&&e.codes2.forEach(n=>{(!Number.isInteger(n.value)||n.value<0)&&r("error","\u544A\u8B66\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:n,property:"value"})}))}checkActionCommand(e,r){e.code&&(!Number.isInteger(e.code.value)||e.code.value<0)&&r("error","\u52A8\u4F5C\u72B6\u6001\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:e.code,property:"value"})}checkWatchCommand(e,r){this.checkAddressParam(e.address,r),e.value&&e.value2&&e.value2.value<=e.value.value&&r("error","\u6700\u5927\u503C\u5FC5\u987B\u5927\u4E8E\u6700\u5C0F\u503C",{node:e.value2,property:"value"})}checkUnwatchCommand(e,r){this.checkAddressParam(e.address,r)}checkDelayCommand(e,r){e.time&&(typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5EF6\u8FDF\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"})}checkScheduleCommand(e,r){e.time&&((typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5B9A\u65F6\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757\uFF0C\u53EF\u4EE5\u4F7F\u7528\u66F4\u7B80\u6D01\u7684delay\u547D\u4EE4\u66FF\u4EE3\uFF0C\u4F8B\u5982\uFF1Adelay "+e.time.value,{node:e}))}checkLoopCommand(e,r){e.time&&((typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5B9A\u65F6\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757\uFF0C\u53EF\u4EE5\u4F7F\u7528\u66F4\u7B80\u6D01\u7684delay\u547D\u4EE4\u66FF\u4EE3\uFF0C\u4F8B\u5982\uFF1Adelay "+e.time.value,{node:e}))}checkCountCommand(e,r){e.times&&((!Number.isInteger(e.times.value)||e.times.value<=0)&&r("error","\u91CD\u590D\u6B21\u6570\u5FC5\u987B\u662F\u6B63\u6574\u6570",{node:e.times,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757",{node:e}))}};var tq={validation:{AcspecValidator:()=>new fh}};function ZE(t){let e=Hi(GE(t),YE),r=Hi(HE({shared:e}),JE,tq);return e.ServiceRegistry.register(r),QE(r),{shared:e,Acspec:r}}var{shared:eA,Acspec:rq}=ZE(ou),nq=new Wi(rq),tA=new Set(["address","address2","value","value2","time","times","code","codes","codes2"]),rA=new Set(["value","module","bitWidth"]);async function Jte(t){let e="file:///example.tcs",r={},n,i=eA.workspace.LangiumDocuments.createDocument(e,t),o=await nq.validateDocument(i),s=i.parseResult.value;if(!Array.isArray(o)||o.length===0){r.$type=s.$type,r.value=s.value,r.commands=[];for(let a of s.commands){let c={};if(dv(a)||lv(a)||uv(a)){c.$type=a.$type,dv(a)||lv(a)?c.time=a.time.value:uv(a)&&(c.times=a.times.value),c.commands=[];for(let u of a.commands){let l={};Object.keys(u).forEach(d=>{if(tA.has(d)){let f=u[d];d==="codes"||d==="codes2"?l[d]=f.map(p=>p.value):d==="address"||d==="address2"?l[d]=Array.from(rA).reduce((p,v)=>(v in f&&(p[v]=f[v]),p),{}):l[d]=f.value}}),l.$type=u.$type,l.text=u.$cstNode.text,l.important=u.$cstNode.text.includes("!"),l.range=u.$cstNode.range,c.commands.push(l)}}else Object.keys(a).forEach(u=>{if(tA.has(u)){let l=a[u];u==="codes"||u==="codes2"?c[u]=l.map(d=>d.value):u==="address"||u==="address2"?c[u]=Array.from(rA).reduce((d,f)=>(f in l&&(d[f]=l[f]),d),{}):c[u]=l.value}}),c.$type=a.$type,c.text=a.$cstNode.text,c.important=a.$cstNode.text.includes("!"),c.range=a.$cstNode.range;r.commands.push(c)}}return eA.workspace.LangiumDocuments.deleteDocument(e),Object.keys(r).length>0&&(n=JSON.stringify(r)),{syntaxTree:n,diagnostics:o}}export{Jte as getSyntaxTree};
157
+ `}var Jc=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let r=this.commentProvider.getComment(e);if(r&&Yc(r))return Xc(r).toMarkdown({renderLink:(i,o)=>this.documentationLinkRenderer(e,i,o),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,r,n){var i;let o=(i=this.findNameInPrecomputedScopes(e,r))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,r);if(o&&o.nameSegment){let s=o.nameSegment.range.start.line+1,a=o.nameSegment.range.start.character+1,c=o.documentUri.with({fragment:`L${s},${a}`});return`[${n}](${c.toString()})`}else return}documentationTagRenderer(e,r){}findNameInPrecomputedScopes(e,r){let i=rt(e).precomputedScopes;if(!i)return;let o=e;do{let a=i.get(o).find(c=>c.name===r);if(a)return a;o=o.$container}while(o)}findNameInGlobalScope(e,r){return this.indexManager.allElements().find(i=>i.name===r)}};var Qc=class{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var r;return Mc(e)?e.$comment:(r=Ta(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||r===void 0?void 0:r.text}};var Zc=class{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,r){return Promise.resolve(this.syncParser.parse(e))}},mg=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;){let e=this.createWorker();e.onReady(()=>{if(this.queue.length>0){let r=this.queue.shift();r&&(e.lock(),r.resolve(e))}}),this.workerPool.push(e)}}async parse(e,r){let n=await this.acquireParserWorker(r),i=new Wt,o,s=r.onCancellationRequested(()=>{o=setTimeout(()=>{this.terminateWorker(n)},this.terminationDelay)});return n.parse(e).then(a=>{let c=this.hydrator.hydrate(a);i.resolve(c)}).catch(a=>{i.reject(a)}).finally(()=>{s.dispose(),clearTimeout(o)}),i.promise}terminateWorker(e){e.terminate();let r=this.workerPool.indexOf(e);r>=0&&this.workerPool.splice(r,1)}async acquireParserWorker(e){this.initializeWorkers();for(let n of this.workerPool)if(n.ready)return n.lock(),n;let r=new Wt;return e.onCancellationRequested(()=>{let n=this.queue.indexOf(r);n>=0&&this.queue.splice(n,1),r.reject(Zr)}),this.queue.push(r),r.promise}},gg=class{get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,r,n,i){this.onReadyEmitter=new Pe.Emitter,this.deferred=new Wt,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=i,r(o=>{let s=o;this.deferred.resolve(s),this.unlock()}),n(o=>{this.deferred.reject(o),this.unlock()})}terminate(){this.deferred.reject(Zr),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 Wt,this.sendMessage(e),this.deferred.promise}};var eu=class{constructor(){this.previousTokenSource=new B.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let r=Td();return this.previousTokenSource=r,this.enqueue(this.writeQueue,e,r.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,r,n=B.CancellationToken.None){let i=new Wt,o={action:r,deferred:i,cancellationToken:n};return e.push(o),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:r,deferred:n,cancellationToken:i})=>{try{let o=await Promise.resolve().then(()=>r(i));n.resolve(o)}catch(o){en(o)?n.resolve(void 0):n.reject(o)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}};var tu=class{constructor(e){this.grammarElementIdMap=new Ui,this.tokenTypeIdMap=new Ui,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(r=>Object.assign(Object.assign({},r),{message:r.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){let r=new Map,n=new Map;for(let i of mr(e))r.set(i,{});if(e.$cstNode)for(let i of di(e.$cstNode))n.set(i,{});return{astNodes:r,cstNodes:n}}dehydrateAstNode(e,r){let n=r.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,r));for(let[i,o]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];n[i]=s;for(let a of o)we(a)?s.push(this.dehydrateAstNode(a,r)):Rt(a)?s.push(this.dehydrateReference(a,r)):s.push(a)}else we(o)?n[i]=this.dehydrateAstNode(o,r):Rt(o)?n[i]=this.dehydrateReference(o,r):o!==void 0&&(n[i]=o);return n}dehydrateReference(e,r){let n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=r.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,r){let n=r.cstNodes.get(e);return va(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=r.astNodes.get(e.astNode),Er(e)?n.content=e.content.map(i=>this.dehydrateCstNode(i,r)):An(e)&&(n.tokenType=e.tokenType.name,n.offset=e.offset,n.length=e.length,n.startLine=e.range.start.line,n.startColumn=e.range.start.character,n.endLine=e.range.end.line,n.endColumn=e.range.end.character),n}hydrate(e){let r=e.value,n=this.createHydrationContext(r);return"$cstNode"in r&&this.hydrateCstNode(r.$cstNode,n),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(r,n)}}createHydrationContext(e){let r=new Map,n=new Map;for(let o of mr(e))r.set(o,{});let i;if(e.$cstNode)for(let o of di(e.$cstNode)){let s;"fullText"in o?(s=new qs(o.fullText),i=s):"content"in o?s=new Li:"tokenType"in o&&(s=this.hydrateCstLeafNode(o)),s&&(n.set(o,s),s.root=i)}return{astNodes:r,cstNodes:n}}hydrateAstNode(e,r){let n=r.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode&&(n.$cstNode=r.cstNodes.get(e.$cstNode));for(let[i,o]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];n[i]=s;for(let a of o)we(a)?s.push(this.setParent(this.hydrateAstNode(a,r),n)):Rt(a)?s.push(this.hydrateReference(a,n,i,r)):s.push(a)}else we(o)?n[i]=this.setParent(this.hydrateAstNode(o,r),n):Rt(o)?n[i]=this.hydrateReference(o,n,i,r):o!==void 0&&(n[i]=o);return n}setParent(e,r){return e.$container=r,e}hydrateReference(e,r,n,i){return this.linker.buildReference(r,n,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,r,n=0){let i=r.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=r.astNodes.get(e.astNode),Er(i))for(let o of e.content){let s=this.hydrateCstNode(o,r,n++);i.content.push(s)}return i}hydrateCstLeafNode(e){let r=this.getTokenType(e.tokenType),n=e.offset,i=e.length,o=e.startLine,s=e.startColumn,a=e.endLine,c=e.endColumn,u=e.hidden;return new Oi(n,i,{start:{line:o,character:s},end:{line:a,character:c}},r,u)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(let r of mr(this.grammar))mi(r)&&this.grammarElementIdMap.set(r,e++)}};function ru(t){return{documentation:{CommentProvider:e=>new Qc(e),DocumentationProvider:e=>new Jc(e)},parser:{AsyncParser:e=>new Zc(e),GrammarConfig:e=>ap(e),LangiumParser:e=>eg(e),CompletionParser:e=>Zm(e),ValueConverter:()=>new $i,TokenBuilder:()=>new Fi,Lexer:e=>new Hi(e),ParserErrorMessageProvider:()=>new Us,LexerErrorMessageProvider:()=>new zc},workspace:{AstNodeLocator:()=>new jc,AstNodeDescriptionProvider:e=>new qc(e),ReferenceDescriptionProvider:e=>new Uc(e)},references:{Linker:e=>new Ac(e),NameProvider:()=>new wc,ScopeProvider:e=>new Oc(e),ScopeComputation:e=>new Pc(e),References:e=>new Nc(e)},serializer:{Hydrator:e=>new tu(e),JsonSerializer:e=>new Lc(e)},validation:{DocumentValidator:e=>new Bi(e),ValidationRegistry:e=>new $c(e)},shared:()=>t.shared}}function nu(t){return{ServiceRegistry:e=>new Fc(e),workspace:{LangiumDocuments:e=>new Ec(e),LangiumDocumentFactory:e=>new kc(e),DocumentBuilder:e=>new Bc(e),IndexManager:e=>new Hc(e),WorkspaceManager:e=>new Gc(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new eu,ConfigurationProvider:e=>new Wc(e)}}}var Xs;(function(t){t.merge=(e,r)=>wd(wd({},e),r)})(Xs||(Xs={}));function Gi(t,e,r,n,i,o,s,a,c){let u=[t,e,r,n,i,o,s,a,c].reduce(wd,{});return _b(u)}var Rb=Symbol("isProxy");function iu(t){if(t&&t[Rb])for(let e of Object.values(t))iu(e);return t}function _b(t,e){let r=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(n,i)=>i===Rb?!0:Tb(n,i,t,e||r),getOwnPropertyDescriptor:(n,i)=>(Tb(n,i,t,e||r),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return r}var xb=Symbol();function Tb(t,e,r,n){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===xb)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in r){let i=r[e];t[e]=xb;try{t[e]=typeof i=="function"?i(n):_b(i,n)}catch(o){throw t[e]=o instanceof Error?o:void 0,o}return t[e]}else return}function wd(t,e){if(e){for(let[r,n]of Object.entries(e))if(n!==void 0){let i=t[r];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?t[r]=wd(i,n):t[r]=n}}return t}var yg={indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[]},zi;(function(t){t.REGULAR="indentation-sensitive",t.IGNORE_INDENTATION="ignore-indentation"})(zi||(zi={}));var Nd=class extends Fi{constructor(e=yg){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options=Object.assign(Object.assign({},yg),e),this.indentTokenType=Gn({name:this.options.indentTokenName,pattern:this.indentMatcher.bind(this),line_breaks:!1}),this.dedentTokenType=Gn({name:this.options.dedentTokenName,pattern:this.dedentMatcher.bind(this),line_breaks:!1})}buildTokens(e,r){let n=super.buildTokens(e,r);if(!kd(n))throw new Error("Invalid tokens built by default builder");let{indentTokenName:i,dedentTokenName:o,whitespaceTokenName:s,ignoreIndentationDelimiters:a}=this.options,c,u,l,d=[];for(let f of n){for(let[p,v]of a)f.name===p?f.PUSH_MODE=zi.IGNORE_INDENTATION:f.name===v&&(f.POP_MODE=!0);f.name===o?c=f:f.name===i?u=f:f.name===s?l=f:d.push(f)}if(!c||!u||!l)throw new Error("Some indentation/whitespace tokens not found!");return a.length>0?{modes:{[zi.REGULAR]:[c,u,...d,l],[zi.IGNORE_INDENTATION]:[...d,l]},defaultMode:zi.REGULAR}:[c,u,l,...d]}flushLexingReport(e){let r=super.flushLexingReport(e);return Object.assign(Object.assign({},r),{remainingDedents:this.flushRemainingDedents(e)})}isStartOfLine(e,r){return r===0||`\r
158
+ `.includes(e[r-1])}matchWhitespace(e,r,n,i){var o;this.whitespaceRegExp.lastIndex=r;let s=this.whitespaceRegExp.exec(e);return{currIndentLevel:(o=s?.[0].length)!==null&&o!==void 0?o:0,prevIndentLevel:this.indentationStack.at(-1),match:s}}createIndentationTokenInstance(e,r,n,i){let o=this.getLineNumber(r,i);return vn(e,n,i,i+n.length,o,o,1,n.length)}getLineNumber(e,r){return e.substring(0,r).split(/\r\n|\r|\n/).length}indentMatcher(e,r,n,i){if(!this.isStartOfLine(e,r))return null;let{currIndentLevel:o,prevIndentLevel:s,match:a}=this.matchWhitespace(e,r,n,i);return o<=s?null:(this.indentationStack.push(o),a)}dedentMatcher(e,r,n,i){var o,s,a,c;if(!this.isStartOfLine(e,r))return null;let{currIndentLevel:u,prevIndentLevel:l,match:d}=this.matchWhitespace(e,r,n,i);if(u>=l)return null;let f=this.indentationStack.lastIndexOf(u);if(f===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${u} at offset: ${r}. Current indentation stack: ${this.indentationStack}`,offset:r,length:(s=(o=d?.[0])===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0,line:this.getLineNumber(e,r),column:1}),null;let p=this.indentationStack.length-f-1,v=(c=(a=e.substring(0,r).match(/[\r\n]+$/))===null||a===void 0?void 0:a[0].length)!==null&&c!==void 0?c:1;for(let T=0;T<p;T++){let S=this.createIndentationTokenInstance(this.dedentTokenType,e,"",r-(v-1));n.push(S),this.indentationStack.pop()}return null}buildTerminalToken(e){let r=super.buildTerminalToken(e),{indentTokenName:n,dedentTokenName:i,whitespaceTokenName:o}=this.options;return r.name===n?this.indentTokenType:r.name===i?this.dedentTokenType:r.name===o?Gn({name:o,pattern:this.whitespaceRegExp,group:Me.SKIPPED}):r}flushRemainingDedents(e){let r=[];for(;this.indentationStack.length>1;)r.push(this.createIndentationTokenInstance(this.dedentTokenType,e,"",e.length)),this.indentationStack.pop();return this.indentationStack=[0],r}},vg=class extends Hi{constructor(e){if(super(e),e.parser.TokenBuilder instanceof Nd)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(e,r=Sd){let n=super.tokenize(e),i=n.report;r?.mode==="full"&&n.tokens.push(...i.remainingDedents),i.remainingDedents=[];let{indentTokenType:o,dedentTokenType:s}=this.indentationTokenBuilder,a=o.tokenTypeIdx,c=s.tokenTypeIdx,u=[],l=n.tokens.length-1;for(let d=0;d<l;d++){let f=n.tokens[d],p=n.tokens[d+1];if(f.tokenTypeIdx===a&&p.tokenTypeIdx===c){d++;continue}u.push(f)}return l>=0&&u.push(n.tokens[l]),n.tokens=u,n}};var ue={};En(ue,{AstUtils:()=>Uu,BiMap:()=>Ui,Cancellation:()=>B,ContextCache:()=>ji,CstUtils:()=>Ou,DONE_RESULT:()=>kt,Deferred:()=>Wt,Disposable:()=>Jn,DisposableCache:()=>zs,DocumentCache:()=>bd,EMPTY_STREAM:()=>xa,ErrorWithLocation:()=>hi,GrammarUtils:()=>Gu,MultiMap:()=>Pr,OperationCancelled:()=>Zr,Reduction:()=>eo,RegExpUtils:()=>Bu,SimpleCache:()=>Ic,StreamImpl:()=>or,TreeStreamImpl:()=>Lr,URI:()=>tt,UriUtils:()=>oe,WorkspaceCache:()=>Ks,assertUnreachable:()=>Fr,delayNextTick:()=>ag,interruptAndCheck:()=>Be,isOperationCancelled:()=>en,loadGrammarFromJson:()=>Dd,setInterruptionPeriod:()=>ob,startCancelableOperation:()=>Td,stream:()=>Z});se(ue,Pe);var Pd=class{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}},ou={fileSystemProvider:()=>new Pd};var QF={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},ZF={AstReflection:()=>new jo};function e1(){let t=Gi(nu(ou),ZF),e=Gi(ru({shared:t}),QF);return t.ServiceRegistry.register(e),e}function Dd(t){var e;let r=e1(),n=r.serializer.JsonSerializer.deserialize(t);return r.shared.workspace.LangiumDocumentFactory.fromModel(n,tt.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}se(He,ue);var pa=hr(an(),1);function nv(t,e){let r={stacks:t,tokens:e};return G$(r),r.stacks.flat().forEach(i=>{i.property=void 0}),LE(r.stacks).map(i=>i[i.length-1])}function iv(t){let{next:e,cardinalities:r,visited:n,plus:i}=t,o=[],s=e.feature;if(n.has(s))return[];pr(s)||n.add(s);let a,c=s;for(;c.$container;)if(pr(c.$container)){a=c.$container;break}else if(mi(c.$container))c=c.$container;else break;if(ip(c.cardinality)){let u=ha({next:{feature:c,type:e.type},cardinalities:r,visited:n,plus:i});for(let l of u)i.add(l.feature);o.push(...u)}if(a){let u=a.elements.indexOf(c);u!==void 0&&u<a.elements.length-1&&o.push(...OE({feature:a,type:e.type},u+1,r,n,i)),o.every(l=>Ri(l.feature.cardinality,l.feature)||Ri(r.get(l.feature))||i.has(l.feature))&&o.push(...iv({next:{feature:a,type:e.type},cardinalities:r,visited:n,plus:i}))}return o}function Uf(t){return we(t)&&(t={feature:t}),ha({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function ha(t){var e,r,n;let{next:i,cardinalities:o,visited:s,plus:a}=t;if(i===void 0)return[];let{feature:c,type:u}=i;if(pr(c))return s.has(c)?[]:(s.add(c),OE(i,0,o,s,a).map(l=>qf(l,c.cardinality,o)));if(Wo(c)||Bo(c))return c.elements.flatMap(l=>ha({next:{feature:l,type:u,property:i.property},cardinalities:o,visited:s,plus:a})).map(l=>qf(l,c.cardinality,o));if(Et(c)){let l={feature:c.terminal,type:u,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return ha({next:l,cardinalities:o,visited:s,plus:a}).map(d=>qf(d,c.cardinality,o))}else{if(Ar(c))return iv({next:{feature:c,type:_i(c),property:(r=i.property)!==null&&r!==void 0?r:c.feature},cardinalities:o,visited:s,plus:a});if(Vt(c)&&Ie(c.rule.ref)){let l=c.rule.ref,d={feature:l.definition,type:l.fragment||l.dataType?void 0:(n=qr(l))!==null&&n!==void 0?n:l.name,property:i.property};return ha({next:d,cardinalities:o,visited:s,plus:a}).map(f=>qf(f,c.cardinality,o))}else return[i]}}function qf(t,e,r){return r.set(t.feature,e),t}function OE(t,e,r,n,i){var o;let s=[],a;for(;e<t.feature.elements.length&&(a={feature:t.feature.elements[e++],type:t.type},s.push(...ha({next:a,cardinalities:r,visited:n,plus:i})),!!Ri((o=a.feature.cardinality)!==null&&o!==void 0?o:r.get(a.feature),a.feature)););return s}function G$(t){for(let e of t.tokens){let r=LE(t.stacks,e);t.stacks=r}}function LE(t,e){let r=[];for(let n of t)r.push(...z$(n,e));return r}function z$(t,e){let r=new Map,n=new Set(t.map(o=>o.feature).filter(K$)),i=[];for(;t.length>0;){let o=t.pop(),s=iv({next:o,cardinalities:r,plus:n,visited:new Set}).filter(a=>e?ov(a.feature,e):!0);for(let a of s)i.push([...t,a]);if(!s.every(a=>Ri(a.feature.cardinality,a.feature)||Ri(r.get(a.feature))))break}return i}function K$(t){if(t.cardinality==="+")return!0;let e=ar(t,Et);return!!(e&&e.cardinality==="+")}function ov(t,e){if(lt(t))return t.value===e.image;if(Vt(t))return V$(t.rule.ref,e);if(sr(t)){let r=$a(t);if(r)return ov(r,e)}return!1}function V$(t,e){return Ie(t)?Uf(t.definition).some(n=>ov(n.feature,e)):Mt(t)?Nn(t).test(e.image):!1}function ME(t){let e=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.triggerCharacters)!==null&&i!==void 0?i:[]}))),r=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.allCommitCharacters)!==null&&i!==void 0?i:[]})));return{triggerCharacters:e.length>0?e:void 0,allCommitCharacters:r.length>0?r:void 0}}var jf=class{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.lexer=e.parser.Lexer,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.fuzzyMatcher=e.shared.lsp.FuzzyMatcher,this.grammarConfig=e.parser.GrammarConfig,this.astReflection=e.shared.AstReflection,this.documentationProvider=e.documentation.DocumentationProvider}async getCompletion(e,r,n){let i=[],o=this.buildContexts(e,r.position),s=(u,l)=>{let d=this.fillCompletionItem(u,l);d&&i.push(d)},a=u=>lt(u.feature)?u.feature.value:u.feature,c=[];for(let u of o)if(await Promise.all(Z(u.features).distinct(a).exclude(c).map(l=>this.completionFor(u,l,s))),c.push(...u.features),!this.continueCompletion(i))break;return pa.CompletionList.create(this.deduplicateItems(i),!0)}deduplicateItems(e){return Z(e).distinct(r=>`${r.kind}_${r.label}_${r.detail}`).toArray()}findFeaturesAt(e,r){let n=e.getText({start:pa.Position.create(0,0),end:e.positionAt(r)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let c=Ma(this.grammar),u=Uf({feature:c.definition,type:qr(c)});return o.length>0?(o.shift(),nv(u.map(l=>[l]),o)):u}let s=[...o].splice(i.tokenIndex);return nv([i.elementStack.map(c=>({feature:c}))],s)}*buildContexts(e,r){var n,i;let o=e.parseResult.value.$cstNode;if(!o)return;let s=e.textDocument,a=s.getText(),c=s.offsetAt(r),u={document:e,textDocument:s,offset:c,position:r},l=this.findDataTypeRuleStart(o,c);if(l){let[g,h]=l,_=(n=Ra(o,g))===null||n===void 0?void 0:n.astNode;yield Object.assign(Object.assign({},u),{node:_,tokenOffset:g,tokenEndOffset:h,features:this.findFeaturesAt(s,g)})}let{nextTokenStart:d,nextTokenEnd:f,previousTokenStart:p,previousTokenEnd:v}=this.backtrackToAnyToken(a,c),T=d;c<=d&&p!==void 0&&(T=p);let S=(i=Ra(o,T))===null||i===void 0?void 0:i.astNode,R=!0;if(p!==void 0&&v!==void 0&&v===c&&(yield Object.assign(Object.assign({},u),{node:S,tokenOffset:p,tokenEndOffset:v,features:this.findFeaturesAt(s,p)}),R=this.performNextTokenCompletion(e,a.substring(p,v),p,v),R&&(yield Object.assign(Object.assign({},u),{node:S,tokenOffset:v,tokenEndOffset:v,features:this.findFeaturesAt(s,v)}))),S)R&&(yield Object.assign(Object.assign({},u),{node:S,tokenOffset:d,tokenEndOffset:f,features:this.findFeaturesAt(s,d)}));else{let g=Ma(this.grammar);if(!g)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},u),{tokenOffset:d,tokenEndOffset:f,features:Uf(g.definition)})}}performNextTokenCompletion(e,r,n,i){return/\P{L}$/u.test(r)}findDataTypeRuleStart(e,r){var n,i;let o=Kt(e,r,this.grammarConfig.nameRegexp),s=!!(!((n=ar(o?.grammarSource,Ie))===null||n===void 0)&&n.dataType);if(s){for(;s;)o=o?.container,s=!!(!((i=ar(o?.grammarSource,Ie))===null||i===void 0)&&i.dataType);if(o)return[o.offset,o.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,r){let n=this.lexer.tokenize(e).tokens;if(n.length===0)return{nextTokenStart:r,nextTokenEnd:r};let i;for(let o of n){if(o.startOffset>=r)return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};if(o.endOffset>=r)return{nextTokenStart:o.startOffset,nextTokenEnd:o.endOffset+1,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};i=o}return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0}}completionFor(e,r,n){if(lt(r.feature))return this.completionForKeyword(e,r.feature,n);if(sr(r.feature)&&e.node)return this.completionForCrossReference(e,r,n)}completionForCrossReference(e,r,n){let i=ar(r.feature,Et),o=e.node;if(i&&o){r.type&&(o={$type:r.type,$container:o,$containerProperty:r.property},Pa(this.astReflection,o));let s={reference:{$refText:""},container:o,property:i.feature};try{for(let a of this.getReferenceCandidates(s,e))n(e,this.createReferenceCompletionItem(a))}catch(a){console.error(a)}}}getReferenceCandidates(e,r){return this.scopeProvider.getScope(e).getAllElements()}createReferenceCompletionItem(e){let r=this.nodeKindProvider.getCompletionItemKind(e),n=this.getReferenceDocumentation(e);return{nodeDescription:e,kind:r,documentation:n,detail:e.type,sortText:"0"}}getReferenceDocumentation(e){if(!e.node)return;let r=this.documentationProvider.getDocumentation(e.node);if(r)return{kind:"markdown",value:r}}completionForKeyword(e,r,n){this.filterKeyword(e,r)&&n(e,{label:r.value,kind:this.getKeywordCompletionItemKind(r),detail:"Keyword",sortText:"1"})}getKeywordCompletionItemKind(e){return pa.CompletionItemKind.Keyword}filterKeyword(e,r){return/\p{L}/u.test(r.value)}fillCompletionItem(e,r){var n,i;let o;if(typeof r.label=="string")o=r.label;else if("node"in r){let u=this.nameProvider.getName(r.node);if(!u)return;o=u}else if("nodeDescription"in r)o=r.nodeDescription.name;else return;let s;typeof((n=r.textEdit)===null||n===void 0?void 0:n.newText)=="string"?s=r.textEdit.newText:typeof r.insertText=="string"?s=r.insertText:s=o;let a=(i=r.textEdit)!==null&&i!==void 0?i:this.buildCompletionTextEdit(e,o,s);return a?{additionalTextEdits:r.additionalTextEdits,command:r.command,commitCharacters:r.commitCharacters,data:r.data,detail:r.detail,documentation:r.documentation,filterText:r.filterText,insertText:r.insertText,insertTextFormat:r.insertTextFormat,insertTextMode:r.insertTextMode,kind:r.kind,labelDetails:r.labelDetails,preselect:r.preselect,sortText:r.sortText,tags:r.tags,textEditText:r.textEditText,textEdit:a,label:o}:void 0}buildCompletionTextEdit(e,r,n){let o=e.textDocument.getText().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(o,r)){let s=e.textDocument.positionAt(e.tokenOffset),a=e.position;return{newText:n,range:{start:s,end:a}}}else return}};var FE=hr(an(),1);var Wf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,r,n){let i=e.parseResult.value;if(i.$cstNode){let o=i.$cstNode,s=Kt(o,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(s)return this.collectLocationLinks(s,r)}}collectLocationLinks(e,r){var n;let i=this.findLink(e);if(i)return[FE.LocationLink.create(i.targetDocument.textDocument.uri,((n=i.target.astNode.$cstNode)!==null&&n!==void 0?n:i.target).range,i.target.range,i.source.range)]}findLink(e){let r=this.references.findDeclarationNode(e);if(r?.astNode){let n=rt(r.astNode);if(r&&n)return{source:e,target:r,targetDocument:n}}}};var $E=hr(an(),1);var Bf=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,r,n){let i=e.parseResult.value.$cstNode;if(!i)return;let o=Kt(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!o)return;let s=this.references.findDeclaration(o);if(s){let a=oe.equals(rt(s).uri,e.uri),c={documentUri:e.uri,includeDeclaration:a};return this.references.findReferences(s,c).map(l=>this.createDocumentHighlight(l)).toArray()}}createDocumentHighlight(e){return $E.DocumentHighlight.create(e.segment.range)}};var Hf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e,r,n){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,r){let n=r.$cstNode,i=this.nameProvider.getNameNode(r);if(i&&n){let o=this.nameProvider.getName(r);return[{kind:this.nodeKindProvider.getSymbolKind(r),name:o||i.text,range:n.range,selectionRange:i.range,children:this.getChildSymbols(e,r)}]}else return this.getChildSymbols(e,r)||[]}getChildSymbols(e,r){let n=[];for(let i of yi(r)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}};var Tu=hr(an(),1);var Gf=class{constructor(e){this.workspaceManager=e.workspace.WorkspaceManager,this.documentBuilder=e.workspace.DocumentBuilder,this.workspaceLock=e.workspace.WorkspaceLock,this.serviceRegistry=e.ServiceRegistry;let r=!1;e.lsp.LanguageServer.onInitialize(n=>{var i,o;r=!!(!((o=(i=n.capabilities.workspace)===null||i===void 0?void 0:i.didChangeWatchedFiles)===null||o===void 0)&&o.dynamicRegistration)}),e.lsp.LanguageServer.onInitialized(n=>{r&&this.registerFileWatcher(e)})}registerFileWatcher(e){let r=[],n=Z(e.ServiceRegistry.all).flatMap(o=>o.LanguageMetaData.fileExtensions).map(o=>o.startsWith(".")?o.substring(1):o).distinct().toArray();n.length>0&&r.push({globPattern:n.length===1?`**/*.${n[0]}`:`**/*.{${n.join(",")}}`});let i=Z(e.ServiceRegistry.all).flatMap(o=>{var s;return(s=o.LanguageMetaData.fileNames)!==null&&s!==void 0?s:[]}).distinct().toArray();if(i.length>0&&r.push({globPattern:i.length===1?`**/${i[0]}`:`**/{${i.join(",")}}`}),r.length>0){let o=e.lsp.Connection,s={watchers:r};o?.client.register(Tu.DidChangeWatchedFilesNotification.type,s)}}fireDocumentUpdate(e,r){e=e.filter(n=>this.serviceRegistry.hasServices(n)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(n=>this.documentBuilder.update(e,r,n))}).catch(n=>{console.error("Workspace initialization failed. Could not perform document update.",n)})}didChangeContent(e){this.fireDocumentUpdate([tt.parse(e.document.uri)],[])}didChangeWatchedFiles(e){let r=Z(e.changes).filter(i=>i.type!==Tu.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>tt.parse(i.uri)).toArray(),n=Z(e.changes).filter(i=>i.type===Tu.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>tt.parse(i.uri)).toArray();this.fireDocumentUpdate(r,n)}};var Ru=hr(an(),1);var zf=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,r,n){let i=[],o=s=>i.push(s);return this.collectFolding(e,o),i}collectFolding(e,r){var n;let i=(n=e.parseResult)===null||n===void 0?void 0:n.value;if(i){if(this.shouldProcessContent(i)){let o=cr(i).iterator(),s;do if(s=o.next(),!s.done){let a=s.value;this.shouldProcess(a)&&this.collectObjectFolding(e,a,r),this.shouldProcessContent(a)||o.prune()}while(!s.done)}this.collectCommentFolding(e,i,r)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,r,n){let i=r.$cstNode;if(i){let o=this.toFoldingRange(e,i);o&&n(o)}}collectCommentFolding(e,r,n){let i=r.$cstNode;if(i){for(let o of Rh(i))if(this.commentNames.includes(o.tokenType.name)){let s=this.toFoldingRange(e,o,Ru.FoldingRangeKind.Comment);s&&n(s)}}}toFoldingRange(e,r,n){let i=r.range,o=i.start,s=i.end;if(!(s.line-o.line<2))return this.includeLastFoldingLine(r,n)||(s=e.textDocument.positionAt(e.textDocument.offsetAt({line:s.line,character:0})-1)),Ru.FoldingRange.create(o.line,s.line,o.character,s.character,n)}includeLastFoldingLine(e,r){if(r===Ru.FoldingRangeKind.Comment)return!1;let n=e.text,i=n.charAt(n.length-1);return!(i==="}"||i===")"||i==="]")}};var Kf=class{match(e,r){if(e.length===0)return!0;let n=!1,i,o=0,s=r.length;for(let a=0;a<s;a++){let c=r.charCodeAt(a),u=e.charCodeAt(o);if((c===u||this.toUpperCharCode(c)===this.toUpperCharCode(u))&&(n||(n=i===void 0||this.isWordTransition(i,c)),n&&o++,o===e.length))return!0;i=c}return!1}isWordTransition(e,r){return qE<=e&&e<=UE&&X$<=r&&r<=Y$||e===jE&&r!==jE}toUpperCharCode(e){return qE<=e&&e<=UE?e-32:e}},qE=97,UE=122,X$=65,Y$=90,jE=95;var sv=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,r){var n,i;let o=(i=(n=e.parseResult)===null||n===void 0?void 0:n.value)===null||i===void 0?void 0:i.$cstNode;if(o){let s=e.textDocument.offsetAt(r.position),a=Kt(o,s,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>s){let c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c);if(lt(a.grammarSource))return this.getKeywordHoverContent(a.grammarSource)}}}getKeywordHoverContent(e){var r;let n=Mc(e)?e.$comment:void 0;if(n||(n=(r=Ta(e.$cstNode,["ML_COMMENT"]))===null||r===void 0?void 0:r.text),n&&Yc(n)){let i=Xc(n).toMarkdown();if(i)return{contents:{kind:"markdown",value:i}}}}},Vf=class extends sv{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){let r=this.documentationProvider.getDocumentation(e);if(r)return{contents:{kind:"markdown",value:r}}}};var Cn=hr(Xe(),1);var re=hr(an(),1);var J$={[re.SemanticTokenTypes.class]:0,[re.SemanticTokenTypes.comment]:1,[re.SemanticTokenTypes.enum]:2,[re.SemanticTokenTypes.enumMember]:3,[re.SemanticTokenTypes.event]:4,[re.SemanticTokenTypes.function]:5,[re.SemanticTokenTypes.interface]:6,[re.SemanticTokenTypes.keyword]:7,[re.SemanticTokenTypes.macro]:8,[re.SemanticTokenTypes.method]:9,[re.SemanticTokenTypes.modifier]:10,[re.SemanticTokenTypes.namespace]:11,[re.SemanticTokenTypes.number]:12,[re.SemanticTokenTypes.operator]:13,[re.SemanticTokenTypes.parameter]:14,[re.SemanticTokenTypes.property]:15,[re.SemanticTokenTypes.regexp]:16,[re.SemanticTokenTypes.string]:17,[re.SemanticTokenTypes.struct]:18,[re.SemanticTokenTypes.type]:19,[re.SemanticTokenTypes.typeParameter]:20,[re.SemanticTokenTypes.variable]:21,[re.SemanticTokenTypes.decorator]:22},Q$={[re.SemanticTokenModifiers.abstract]:1,[re.SemanticTokenModifiers.async]:2,[re.SemanticTokenModifiers.declaration]:4,[re.SemanticTokenModifiers.defaultLibrary]:8,[re.SemanticTokenModifiers.definition]:16,[re.SemanticTokenModifiers.deprecated]:32,[re.SemanticTokenModifiers.documentation]:64,[re.SemanticTokenModifiers.modification]:128,[re.SemanticTokenModifiers.readonly]:256,[re.SemanticTokenModifiers.static]:512},tte={legend:{tokenTypes:Object.keys(J$),tokenModifiers:Object.keys(Q$)},full:{delta:!0},range:!0};function BE(t){let e=[],r=[],n=!0,i=!0,o=!0;for(let s of t)s&&(s.legend.tokenTypes.forEach((a,c)=>{let u=e[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token types. They use the same index ${c}.`);e[c]=a}),s.legend.tokenModifiers.forEach((a,c)=>{let u=r[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token modifier. They use the same index ${c}.`);r[c]=a}),s.full?typeof s.full=="object"&&!s.full.delta&&(i=!1):n=!1,s.range||(o=!1));return{legend:{tokenTypes:e,tokenModifiers:r},full:n&&{delta:i},range:o}}var WE;(function(t){function e(n,i,o){let s=new Map;Object.entries(i).forEach(([u,l])=>s.set(l,u));let a=0,c=0;return r(n.data,5).map(u=>{a+=u[0],u[0]!==0&&(c=0),c+=u[1];let l=u[2];return{offset:o.textDocument.offsetAt({line:a,character:c}),tokenType:s.get(u[3]),tokenModifiers:u[4],text:o.textDocument.getText({start:{line:a,character:c},end:{line:a,character:c+l}})}})}t.decode=e;function r(n,i){let o=[];for(let s=0;s<n.length;s+=i){let a=n.slice(s,s+i);o.push(a)}return o}})(WE||(WE={}));function HE(t){let e=[],r=[];t.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&r.push(...i.retriggerCharacters)});let n={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:r.length>0?Array.from(new Set(r)).sort():void 0};return n.triggerCharacters?n:void 0}var Xf=class{constructor(e){this.onInitializeEmitter=new Cn.Emitter,this.onInitializedEmitter=new Cn.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.fireInitializeOnDefaultServices(e),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){iu(this.services),this.services.ServiceRegistry.all.forEach(e=>iu(e))}hasService(e){return this.services.ServiceRegistry.all.some(n=>e(n)!==void 0)}buildInitializeResult(e){var r,n,i,o;let s=this.services.lsp.DocumentUpdateHandler,a=(r=this.services.lsp.FileOperationHandler)===null||r===void 0?void 0:r.fileOperationOptions,c=this.services.ServiceRegistry.all,u=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.Formatter}),l=c.map(F=>{var b,Te;return(Te=(b=F.lsp)===null||b===void 0?void 0:b.Formatter)===null||Te===void 0?void 0:Te.formatOnTypeOptions}).find(F=>!!F),d=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.CodeActionProvider}),f=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.SemanticTokenProvider}),p=BE(c.map(F=>{var b,Te;return(Te=(b=F.lsp)===null||b===void 0?void 0:b.SemanticTokenProvider)===null||Te===void 0?void 0:Te.semanticTokensOptions})),v=(i=(n=this.services.lsp)===null||n===void 0?void 0:n.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,T=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DocumentLinkProvider}),S=HE(c.map(F=>{var b,Te;return(Te=(b=F.lsp)===null||b===void 0?void 0:b.SignatureHelp)===null||Te===void 0?void 0:Te.signatureHelpOptions})),R=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.TypeProvider}),g=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.ImplementationProvider}),h=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.CompletionProvider}),_=ME(c.map(F=>{var b,Te;return(Te=(b=F.lsp)===null||b===void 0?void 0:b.CompletionProvider)===null||Te===void 0?void 0:Te.completionOptions})),w=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.ReferencesProvider}),J=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DocumentSymbolProvider}),Bt=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DefinitionProvider}),Ye=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DocumentHighlightProvider}),ir=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.FoldingRangeProvider}),Ht=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.HoverProvider}),I=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.RenameProvider}),k=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.CallHierarchyProvider}),U=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.TypeHierarchyProvider}),M=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.CodeLensProvider}),ne=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.DeclarationProvider}),K=this.hasService(F=>{var b;return(b=F.lsp)===null||b===void 0?void 0:b.InlayHintProvider}),H=(o=this.services.lsp)===null||o===void 0?void 0:o.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:a},executeCommandProvider:v&&{commands:v},textDocumentSync:{change:Cn.TextDocumentSyncKind.Incremental,openClose:!0,save:!!s.didSaveDocument,willSave:!!s.willSaveDocument,willSaveWaitUntil:!!s.willSaveDocumentWaitUntil},completionProvider:h?_:void 0,referencesProvider:w,documentSymbolProvider:J,definitionProvider:Bt,typeDefinitionProvider:R,documentHighlightProvider:Ye,codeActionProvider:d,documentFormattingProvider:u,documentRangeFormattingProvider:u,documentOnTypeFormattingProvider:l,foldingRangeProvider:ir,hoverProvider:Ht,renameProvider:I?{prepareProvider:!0}:void 0,semanticTokensProvider:f?p:void 0,signatureHelpProvider:S,implementationProvider:g,callHierarchyProvider:k?{}:void 0,typeHierarchyProvider:U?{}:void 0,documentLinkProvider:T?{resolveProvider:!1}:void 0,codeLensProvider:M?{resolveProvider:!1}:void 0,declarationProvider:ne,inlayHintProvider:K?{resolveProvider:!1}:void 0,workspaceSymbolProvider:H?{resolveProvider:!!H.resolveSymbol}:void 0}}}initialized(e){this.fireInitializedOnDefaultServices(e),this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}fireInitializeOnDefaultServices(e){this.services.workspace.ConfigurationProvider.initialize(e),this.services.workspace.WorkspaceManager.initialize(e)}fireInitializedOnDefaultServices(e){let r=this.services.lsp.Connection,n=r?Object.assign(Object.assign({},e),{register:i=>r.client.register(Cn.DidChangeConfigurationNotification.type,i),fetchConfiguration:i=>r.workspace.getConfiguration(i)}):e;this.services.workspace.ConfigurationProvider.initialized(n).catch(i=>console.error("Error in ConfigurationProvider initialization:",i)),this.services.workspace.WorkspaceManager.initialized(e).catch(i=>console.error("Error in WorkspaceManager initialization:",i))}};var Jf=hr(an(),1),Yf=class{getSymbolKind(e){return Jf.SymbolKind.Field}getCompletionItemKind(e){return Jf.CompletionItemKind.Reference}};var GE=hr(an(),1);var Qf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,r,n){let i=e.parseResult.value.$cstNode;if(!i)return[];let o=Kt(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);return o?this.getReferences(o,r,e):[]}getReferences(e,r,n){let i=[],o=this.references.findDeclaration(e);if(o){let s={includeDeclaration:r.context.includeDeclaration};this.references.findReferences(o,s).forEach(a=>{i.push(GE.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}};Ii();var Zf=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,r,n){let i={},o=e.parseResult.value.$cstNode;if(!o)return;let s=e.textDocument.offsetAt(r.position),a=Kt(o,s,this.grammarConfig.nameRegexp);if(!a)return;let c=this.references.findDeclaration(a);if(!c)return;let u={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(c,u).forEach(d=>{let f=vr.replace(d.segment.range,r.newName),p=d.sourceUri.toString();i[p]?i[p].push(f):i[p]=[f]}),{changes:i}}prepareRename(e,r,n){return this.renameNodeRange(e,r.position)}renameNodeRange(e,r){let n=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(r);if(n&&i){let o=Kt(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.astNode&&_d(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}};var eh=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,r=B.CancellationToken.None){let n=[],i=e.query.toLowerCase();for(let o of this.indexManager.allElements())if(await Be(r),this.fuzzyMatcher.match(i,o.name)){let s=this.getWorkspaceSymbol(o);s&&n.push(s)}return n}getWorkspaceSymbol(e){let r=e.nameSegment;if(r)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:r.range,uri:e.documentUri.toString()}}}};var xt=hr(an(),1);var _u=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new xt.Emitter,this._onDidOpen=new xt.Emitter,this._onDidClose=new xt.Emitter,this._onDidSave=new xt.Emitter,this._onWillSave=new xt.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(oe.normalize(e))}set(e){let r=oe.normalize(e.uri),n=!0;this._syncedDocuments.has(r)&&(n=!1),this._syncedDocuments.set(r,e);let i=Object.freeze({document:e});return this._onDidOpen.fire(i),this._onDidChangeContent.fire(i),n}delete(e){let r=oe.normalize(typeof e=="object"&&"uri"in e?e.uri:e),n=this._syncedDocuments.get(r);n!==void 0&&(this._syncedDocuments.delete(r),this._onDidClose.fire(Object.freeze({document:n})))}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=xt.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=oe.normalize(i.uri),s=this._configuration.create(o,i.languageId,i.version,i.text);this._syncedDocuments.set(o,s);let a=Object.freeze({document:s});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:s}=i;if(s==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=oe.normalize(i.uri),c=this._syncedDocuments.get(a);c!==void 0&&(c=this._configuration.update(c,o,s),this._syncedDocuments.set(a,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),r.push(e.onDidCloseTextDocument(n=>{let i=oe.normalize(n.textDocument.uri),o=this._syncedDocuments.get(i);o!==void 0&&(this._syncedDocuments.delete(i),this._onDidClose.fire(Object.freeze({document:o})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(oe.normalize(n.textDocument.uri));i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(oe.normalize(n.textDocument.uri));return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(oe.normalize(n.textDocument.uri));i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),xt.Disposable.create(()=>{r.forEach(n=>n.dispose())})}},th=class{constructor(e){this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new xt.Emitter,this._onDidSave=new xt.Emitter,this._onDidChange=new xt.Emitter,this._onDidClose=new xt.Emitter,"listen"in e?this._cellTextDocuments=e:this._cellTextDocuments=new _u(e)}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(oe.normalize(e))}getNotebookCell(e){let r=this.notebookCellMap.get(oe.normalize(e));return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"||"scheme"in e?e:e.document,n=this.notebookCellMap.get(oe.normalize(r));return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let r=new rh,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{let o=oe.normalize(i.notebookDocument.uri);this.notebookDocuments.set(o,i.notebookDocument);for(let s of i.cellTextDocuments)r.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=oe.normalize(i.notebookDocument.uri),s=this.notebookDocuments.get(o);if(s===void 0)return;s.version=i.notebookDocument.version;let a=s.metadata,c=!1,u=i.change;u.metadata!==void 0&&(c=!0,s.metadata=u.metadata);let l=[],d=[],f=[],p=[];if(u.cells!==void 0){let g=u.cells;if(g.structure!==void 0){let h=g.structure.array;if(s.cells.splice(h.start,h.deleteCount,...h.cells!==void 0?h.cells:[]),g.structure.didOpen!==void 0)for(let _ of g.structure.didOpen)r.openTextDocument({textDocument:_}),l.push(_.uri);if(g.structure.didClose)for(let _ of g.structure.didClose)r.closeTextDocument({textDocument:_}),d.push(_.uri)}if(g.data!==void 0){let h=new Map(g.data.map(_=>[_.document,_]));for(let _=0;_<=s.cells.length;_++){let w=h.get(s.cells[_].document);if(w!==void 0){let J=s.cells.splice(_,1,w);if(f.push({old:J[0],new:w}),h.delete(w.document),h.size===0)break}}}if(g.textContent!==void 0)for(let h of g.textContent)r.changeTextDocument({textDocument:h.document,contentChanges:h.changes}),p.push(h.document.uri)}this.updateCellMap(s);let v={notebookDocument:s};c&&(v.metadata={old:a,new:s.metadata});let T=[];for(let g of l)T.push(this.getNotebookCell(g));let S=[];for(let g of d)S.push(this.getNotebookCell(g));let R=[];for(let g of p)R.push(this.getNotebookCell(g));(T.length>0||S.length>0||f.length>0||R.length>0)&&(v.cells={added:T,removed:S,changed:{data:f,textContent:R}}),(v.metadata!==void 0||v.cells!==void 0)&&this._onDidChange.fire(v)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.getNotebookDocument(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=oe.normalize(i.notebookDocument.uri),s=this.notebookDocuments.get(o);if(s!==void 0){this._onDidClose.fire(s);for(let a of i.cellTextDocuments)r.closeTextDocument({textDocument:a});this.notebookDocuments.delete(o);for(let a of s.cells)this.notebookCellMap.delete(a.document)}})),xt.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}},rh=class t{onDidOpenTextDocument(e){return this.openHandler=e,xt.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,xt.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,xt.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};rh.NULL_DISPOSE=Object.freeze({dispose:()=>{}});function zE(t){return Xs.merge(ru(t),Z$(t))}function Z$(t){return{lsp:{CompletionProvider:e=>new jf(e),DocumentSymbolProvider:e=>new Hf(e),HoverProvider:e=>new Vf(e),FoldingRangeProvider:e=>new zf(e),ReferencesProvider:e=>new Qf(e),DefinitionProvider:e=>new Wf(e),DocumentHighlightProvider:e=>new Bf(e),RenameProvider:e=>new Zf(e)},shared:()=>t.shared}}function KE(t){return Xs.merge(nu(t),eq(t))}function eq(t){return{lsp:{Connection:()=>t.connection,LanguageServer:e=>new Xf(e),DocumentUpdateHandler:e=>new Gf(e),WorkspaceSymbolProvider:e=>new eh(e),NodeKindProvider:()=>new Yf,FuzzyMatcher:()=>new Kf},workspace:{TextDocuments:()=>new _u(Yn),NotebookDocuments:e=>new th(e.workspace.TextDocuments)}}}var VE="BlockCommand";var XE="LineCommand";var av="AddressParam";var nh="CheckActionCommand";var ih="CheckAlarmCommand";var oh="CheckCommand";var cv="CodeParam";var bu="CountCommand";function dv(t){return pv.isInstance(t,bu)}var sh="DelayCommand";var Cu="LoopCommand";function fv(t){return pv.isInstance(t,Cu)}var ah="Model";var Su="ScheduleCommand";function hv(t){return pv.isInstance(t,Su)}var uv="TimeParam";var ch="UnwatchCommand";var lv="ValueParam";var uh="WatchCommand";var lh="WriteCommand";var dh="StrictMode";var fh="TypeDeclare";var ku=class extends ui{getAllTypes(){return[av,VE,nh,ih,oh,cv,bu,sh,XE,Cu,ah,Su,dh,uv,fh,ch,lv,uh,lh]}computeIsSubtype(e,r){switch(e){case nh:case ih:case oh:case sh:case ch:case uh:case lh:return this.isSubtype(XE,r);case bu:case Cu:case Su:return this.isSubtype(VE,r);case dh:case fh:return this.isSubtype(ah,r);default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;throw new Error(`${r} is not a valid reference id.`)}getTypeMetaData(e){switch(e){case av:return{name:av,properties:[{name:"bitWidth"},{name:"module"},{name:"value"}]};case nh:return{name:nh,properties:[{name:"code"}]};case ih:return{name:ih,properties:[{name:"codes",defaultValue:[]},{name:"codes2",defaultValue:[]}]};case oh:return{name:oh,properties:[{name:"address"},{name:"address2"},{name:"value"},{name:"value2"}]};case cv:return{name:cv,properties:[{name:"value"}]};case bu:return{name:bu,properties:[{name:"commands",defaultValue:[]},{name:"times"}]};case sh:return{name:sh,properties:[{name:"time"}]};case Cu:return{name:Cu,properties:[{name:"commands",defaultValue:[]},{name:"time"}]};case ah:return{name:ah,properties:[{name:"commands",defaultValue:[]}]};case Su:return{name:Su,properties:[{name:"commands",defaultValue:[]},{name:"time"}]};case uv:return{name:uv,properties:[{name:"value"}]};case ch:return{name:ch,properties:[{name:"address"}]};case lv:return{name:lv,properties:[{name:"value"}]};case uh:return{name:uh,properties:[{name:"address"},{name:"value"},{name:"value2"}]};case lh:return{name:lh,properties:[{name:"address"},{name:"address2"},{name:"value"}]};case dh:return{name:dh,properties:[{name:"commands",defaultValue:[]},{name:"strict"}]};case fh:return{name:fh,properties:[{name:"commands",defaultValue:[]},{name:"value"}]};default:return{name:e,properties:[]}}}},pv=new ku;var YE,JE=()=>YE??(YE=Dd('{"$type":"Grammar","isDeclared":true,"name":"Acspec","rules":[{"$type":"ParserRule","entry":true,"name":"Model","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}]},"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TypeDeclare","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"use"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"unit"},{"$type":"Keyword","value":"init"}]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"StrictMode","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"use"},{"$type":"Assignment","feature":"strict","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"strict"},{"$type":"Keyword","value":"lenient"}]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineCommand","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BlockCommand","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WriteCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"write"},{"$type":"Keyword","value":"write!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"address2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check"},{"$type":"Keyword","value":"check!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Assignment","feature":"address2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckAlarmCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check_alarm"},{"$type":"Keyword","value":"check_alarm!"}]},{"$type":"Assignment","feature":"codes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"codes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"codes2","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"codes2","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}],"cardinality":"*"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckActionCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check_action"},{"$type":"Keyword","value":"check_action!"}]},{"$type":"Assignment","feature":"code","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WatchCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"watch"},{"$type":"Keyword","value":"watch!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UnwatchCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"unwatch"},{"$type":"Keyword","value":"unwatch!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DelayCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"delay"},{"$type":"Keyword","value":"delay!"}]},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ScheduleCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"schedule"},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LoopCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"loop"},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CountCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"count"},{"$type":"Assignment","feature":"times","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AddressParam","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"bitWidth","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Keyword","value":")"}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"module","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ValueParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CodeParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TimeParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/"},"fragment":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[_a-zA-Z][\\\\w_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(-?(?:0[xX][0-9a-fA-F](?:_?[0-9a-fA-F])*|0[bB][01](?:_?[01])*|0[oO][0-7](?:_?[0-7])*|(?:\\\\d(?:_?\\\\d)*)(?:\\\\.\\\\d(?:_?\\\\d)*)?(?:[eE][+-]?\\\\d(?:_?\\\\d)*)?))/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SL_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"types":[],"usedGrammars":[]}'));var rq={languageId:"acspec",fileExtensions:[".tsc"],caseInsensitive:!1,mode:"production"},QE={AstReflection:()=>new ku},ZE={Grammar:()=>JE(),LanguageMetaData:()=>rq,parser:{}};function eA(t){let e=t.validation.ValidationRegistry,r=t.validation.AcspecValidator,n={WriteCommand:r.checkWriteCommand,CheckCommand:r.checkCheckCommand,DelayCommand:r.checkDelayCommand,CheckAlarmCommand:r.checkAlarmCommand,CheckActionCommand:r.checkActionCommand,WatchCommand:r.checkWatchCommand,UnwatchCommand:r.checkUnwatchCommand,ScheduleCommand:r.checkScheduleCommand,LoopCommand:r.checkLoopCommand,CountCommand:r.checkCountCommand};e.register(n,r)}var hh=class{validateAddress(e){return e?/^[A-Z]+[0-9]+$/.test(e):!1}checkAddressParam(e,r){e&&(this.validateAddress(e.value)||r("error","\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5BC4\u5B58\u5668\u5730\u5740\uFF0C\u4F8B\u5982\uFF1AM0100",{node:e,property:"value"}),e.bitWidth!==void 0&&(!Number.isInteger(e.bitWidth)||e.bitWidth<0)&&r("error","\u5730\u5740\u4F4D\u5BBD\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570\uFF0C\u4F8B\u598216\u621632",{node:e,property:"bitWidth"}),e.module!==void 0&&(!Number.isInteger(e.module)||e.module<0)&&r("error","\u6A21\u5757\u53F7\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:e,property:"module"}))}checkWriteCommand(e,r){this.checkAddressParam(e.address,r),this.checkAddressParam(e.address2,r)}checkCheckCommand(e,r){this.checkAddressParam(e.address,r),this.checkAddressParam(e.address2,r),e.value&&e.value2&&e.value2.value<=e.value.value&&r("error","\u6700\u5927\u503C\u5FC5\u987B\u5927\u4E8E\u6700\u5C0F\u503C",{node:e.value2,property:"value"})}checkAlarmCommand(e,r){Array.isArray(e.codes)&&(e.codes.forEach(n=>{(!Number.isInteger(n.value)||n.value<0)&&r("error","\u544A\u8B66\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:n,property:"value"})}),Array.isArray(e.codes2)&&e.codes2.forEach(n=>{(!Number.isInteger(n.value)||n.value<0)&&r("error","\u544A\u8B66\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:n,property:"value"})}))}checkActionCommand(e,r){e.code&&(!Number.isInteger(e.code.value)||e.code.value<0)&&r("error","\u52A8\u4F5C\u72B6\u6001\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:e.code,property:"value"})}checkWatchCommand(e,r){this.checkAddressParam(e.address,r),e.value&&e.value2&&e.value2.value<=e.value.value&&r("error","\u6700\u5927\u503C\u5FC5\u987B\u5927\u4E8E\u6700\u5C0F\u503C",{node:e.value2,property:"value"})}checkUnwatchCommand(e,r){this.checkAddressParam(e.address,r)}checkDelayCommand(e,r){e.time&&(typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5EF6\u8FDF\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"})}checkScheduleCommand(e,r){e.time&&((typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5B9A\u65F6\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757\uFF0C\u53EF\u4EE5\u4F7F\u7528\u66F4\u7B80\u6D01\u7684delay\u547D\u4EE4\u66FF\u4EE3\uFF0C\u4F8B\u5982\uFF1Adelay "+e.time.value,{node:e}))}checkLoopCommand(e,r){e.time&&((typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5B9A\u65F6\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757\uFF0C\u53EF\u4EE5\u4F7F\u7528\u66F4\u7B80\u6D01\u7684delay\u547D\u4EE4\u66FF\u4EE3\uFF0C\u4F8B\u5982\uFF1Adelay "+e.time.value,{node:e}))}checkCountCommand(e,r){e.times&&((!Number.isInteger(e.times.value)||e.times.value<=0)&&r("error","\u91CD\u590D\u6B21\u6570\u5FC5\u987B\u662F\u6B63\u6574\u6570",{node:e.times,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757",{node:e}))}};var ph=class extends $i{runConverter(e,r,n){return e.name.toUpperCase()==="NUMBER"&&(r=r.replace(/_/g,"")),super.runConverter(e,r,n)}};var nq={validation:{AcspecValidator:()=>new hh},parser:{ValueConverter:()=>new ph}};function tA(t){let e=Gi(KE(t),QE),r=Gi(zE({shared:e}),ZE,nq);return e.ServiceRegistry.register(r),eA(r),{shared:e,Acspec:r}}var{shared:rA,Acspec:iq}=tA(ou),oq=new Bi(iq),nA=new Set(["address","address2","value","value2","time","times","code","codes","codes2"]),iA=new Set(["value","module","bitWidth"]);async function ire(t){let e="file:///example.tcs",r={},n,i=rA.workspace.LangiumDocuments.createDocument(e,t),o=await oq.validateDocument(i),s=i.parseResult.value;if(!Array.isArray(o)||o.length===0){r.$type="TypeDeclare",r.value=s.value,r.strict=s.strict,r.commands=[];for(let a of s.commands){let c={};if(hv(a)||fv(a)||dv(a)){c.$type=a.$type,hv(a)||fv(a)?c.time=a.time.value:dv(a)&&(c.times=a.times.value),c.commands=[];for(let u of a.commands){let l={};Object.keys(u).forEach(d=>{if(nA.has(d)){let f=u[d];d==="codes"||d==="codes2"?l[d]=f.map(p=>p.value):d==="address"||d==="address2"?l[d]=Array.from(iA).reduce((p,v)=>(v in f&&(p[v]=f[v]),p),{}):l[d]=f.value}}),l.$type=u.$type,l.text=u.$cstNode.text,l.important=u.$cstNode.text.includes("!"),l.range=u.$cstNode.range,c.commands.push(l)}}else Object.keys(a).forEach(u=>{if(nA.has(u)){let l=a[u];u==="codes"||u==="codes2"?c[u]=l.map(d=>d.value):u==="address"||u==="address2"?c[u]=Array.from(iA).reduce((d,f)=>(f in l&&(d[f]=l[f]),d),{}):c[u]=l.value}}),c.$type=a.$type,c.text=a.$cstNode.text,c.important=a.$cstNode.text.includes("!"),c.range=a.$cstNode.range;r.commands.push(c)}}return rA.workspace.LangiumDocuments.deleteDocument(e),Object.keys(r).length>0&&(n=JSON.stringify(r)),{syntaxTree:n,diagnostics:o}}export{ire as getSyntaxTree};
159
159
  /*! Bundled license information:
160
160
 
161
161
  lodash-es/lodash.js: