factoriomod-debug 2.0.11 → 2.0.13

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.
@@ -2,21 +2,21 @@
2
2
  import {createRequire} from 'module'
3
3
  const require = createRequire(import.meta.url)
4
4
 
5
- import{H as Ra,I as Sr,J as xa,L as an,M as br,N as _r,O as Fa,P as qa,a as I,c as F,e as sn,h as Qn,k as lt,l as Pe,m as on,n as wr,o as L,p as Pa,q as Dr,r as qd,s as Id,t as Ed}from"./chunk-VB5SSWJG.js";var Ie=F(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.asPromise=oe.thenable=oe.typedArray=oe.stringArray=oe.array=oe.func=oe.error=oe.number=oe.string=oe.boolean=void 0;function Hd(a){return a===!0||a===!1}oe.boolean=Hd;function Ua(a){return typeof a=="string"||a instanceof String}oe.string=Ua;function Nd(a){return typeof a=="number"||a instanceof Number}oe.number=Nd;function Kd(a){return a instanceof Error}oe.error=Kd;function Ha(a){return typeof a=="function"}oe.func=Ha;function Na(a){return Array.isArray(a)}oe.array=Na;function jd(a){return Na(a)&&a.every(e=>Ua(e))}oe.stringArray=jd;function Wd(a,e){return Array.isArray(a)&&a.every(e)}oe.typedArray=Wd;function Ka(a){return a&&Ha(a.then)}oe.thenable=Ka;function $d(a){return a instanceof Promise?a:Ka(a)?new Promise((e,t)=>{a.then(n=>e(n),n=>t(n))}):Promise.resolve(a)}oe.asPromise=$d});var oi=F(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.forEach=Ce.mapAsync=Ce.map=Ce.clearTestMode=Ce.setTestMode=Ce.Semaphore=Ce.Delayer=void 0;var dn=L(),Ar=class{constructor(e){this.defaultDelay=e,this.timeout=void 0,this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0}trigger(e,t=this.defaultDelay){return this.task=e,t>=0&&this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(n=>{this.onSuccess=n}).then(()=>{this.completionPromise=void 0,this.onSuccess=void 0;var n=this.task();return this.task=void 0,n})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,dn.RAL)().timer.setTimeout(()=>{this.timeout=void 0,this.onSuccess(void 0)},t>=0?t:this.defaultDelay)),this.completionPromise}forceDelivery(){if(!this.completionPromise)return;this.cancelTimeout();let e=this.task();return this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0,e}isTriggered(){return this.timeout!==void 0}cancel(){this.cancelTimeout(),this.completionPromise=void 0}cancelTimeout(){this.timeout!==void 0&&(this.timeout.dispose(),this.timeout=void 0)}};Ce.Delayer=Ar;var Or=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((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,dn.RAL)().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 t=e.thunk();t instanceof Promise?t.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};Ce.Semaphore=Or;var Lr=!1;function zd(){Lr=!0}Ce.setTestMode=zd;function Vd(){Lr=!1}Ce.clearTestMode=Vd;var ja=15,cn=class{constructor(e=ja){this.yieldAfter=Lr===!0?Math.max(e,2):Math.max(e,ja),this.startTime=Date.now(),this.counter=0,this.total=0,this.counterInterval=1}start(){this.counter=0,this.total=0,this.counterInterval=1,this.startTime=Date.now()}shouldYield(){if(++this.counter>=this.counterInterval){let e=Date.now()-this.startTime,t=Math.max(0,this.yieldAfter-e);if(this.total+=this.counter,this.counter=0,e>=this.yieldAfter||t<=1)return this.counterInterval=1,this.total=0,!0;switch(e){case 0:case 1:this.counterInterval=this.total*2;break}}return!1}};async function Bd(a,e,t,n){if(a.length===0)return[];let i=new Array(a.length),r=new cn(n?.yieldAfter);function s(d){r.start();for(let l=d;l<a.length;l++)if(i[l]=e(a[l]),r.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let c=s(0);for(;c!==-1&&!(t!==void 0&&t.isCancellationRequested);)c=await new Promise(d=>{(0,dn.RAL)().timer.setImmediate(()=>{d(s(c))})});return i}Ce.map=Bd;async function Yd(a,e,t,n){if(a.length===0)return[];let i=new Array(a.length),r=new cn(n?.yieldAfter);async function s(d){r.start();for(let l=d;l<a.length;l++)if(i[l]=await e(a[l],t),r.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let c=await s(0);for(;c!==-1&&!(t!==void 0&&t.isCancellationRequested);)c=await new Promise(d=>{(0,dn.RAL)().timer.setImmediate(()=>{d(s(c))})});return i}Ce.mapAsync=Yd;async function Jd(a,e,t,n){if(a.length===0)return;let i=new cn(n?.yieldAfter);function r(c){i.start();for(let d=c;d<a.length;d++)if(e(a[d]),i.shouldYield())return n?.yieldCallback&&n.yieldCallback(),d+1;return-1}let s=r(0);for(;s!==-1&&!(t!==void 0&&t.isCancellationRequested);)s=await new Promise(c=>{(0,dn.RAL)().timer.setImmediate(()=>{c(r(s))})})}Ce.forEach=Jd});var Nr=F(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});var Qd=I("vscode"),Ur=class extends Qd.CompletionItem{constructor(e){super(e)}};Hr.default=Ur});var Wr=F(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});var Gd=I("vscode"),Kr=class extends Gd.CodeLens{constructor(e){super(e)}};jr.default=Kr});var Vr=F(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});var Zd=I("vscode"),$r=class extends Zd.DocumentLink{constructor(e,t){super(e,t)}};zr.default=$r});var Jr=F(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});var Xd=I("vscode"),Br=class extends Xd.CodeAction{constructor(e,t){super(e),this.data=t}};Yr.default=Br});var Zr=F(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.ProtocolDiagnostic=Nt.DiagnosticCode=void 0;var eu=I("vscode"),Qr=Ie(),Wa;(function(a){function e(t){let n=t;return n!=null&&(Qr.number(n.value)||Qr.string(n.value))&&Qr.string(n.target)}a.is=e})(Wa||(Nt.DiagnosticCode=Wa={}));var Gr=class extends eu.Diagnostic{constructor(e,t,n,i){super(e,t,n),this.data=i,this.hasDiagnosticCode=!1}};Nt.ProtocolDiagnostic=Gr});var ts=F(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});var tu=I("vscode"),Xr=class extends tu.CallHierarchyItem{constructor(e,t,n,i,r,s,c){super(e,t,n,i,r,s),c!==void 0&&(this.data=c)}};es.default=Xr});var rs=F(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});var nu=I("vscode"),ns=class extends nu.TypeHierarchyItem{constructor(e,t,n,i,r,s,c){super(e,t,n,i,r,s),c!==void 0&&(this.data=c)}};is.default=ns});var as=F(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});var ai=I("vscode"),ss=class extends ai.SymbolInformation{constructor(e,t,n,i,r){let s=!(i instanceof ai.Uri);super(e,t,n,s?i:new ai.Location(i,new ai.Range(0,0,0,0))),this.hasRange=s,r!==void 0&&(this.data=r)}};os.default=ss});var us=F(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});var iu=I("vscode"),cs=class extends iu.InlayHint{constructor(e,t,n){super(e,t,n)}};ds.default=cs});var Ba=F(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.createConverter=void 0;var de=I("vscode"),O=L(),St=Ie(),$a=oi(),ru=Nr(),su=Wr(),ou=Vr(),za=Jr(),Va=Zr(),au=ts(),cu=rs(),du=as(),uu=us(),ls;(function(a){function e(t){let n=t;return n&&!!n.inserting&&!!n.replacing}a.is=e})(ls||(ls={}));function lu(a){let t=a||(u=>u.toString());function n(u){return t(u)}function i(u){return{uri:t(u.uri)}}function r(u){return{uri:t(u.uri),languageId:u.languageId,version:u.version,text:u.getText()}}function s(u){return{uri:t(u.uri),version:u.version}}function c(u){return{textDocument:r(u)}}function d(u){let w=u;return!!w.document&&!!w.contentChanges}function l(u){let w=u;return!!w.uri&&!!w.version}function g(u,w,R){if(l(u))return{textDocument:{uri:t(u.uri),version:u.version},contentChanges:[{text:u.getText()}]};if(d(u)){let B=w,Q=R;return{textDocument:{uri:t(B),version:Q},contentChanges:u.contentChanges.map(ke=>{let We=ke.range;return{range:{start:{line:We.start.line,character:We.start.character},end:{line:We.end.line,character:We.end.character}},rangeLength:ke.rangeLength,text:ke.text}})}}else throw Error("Unsupported text document change parameter")}function h(u){return{textDocument:i(u)}}function f(u,w=!1){let R={textDocument:i(u)};return w&&(R.text=u.getText()),R}function v(u){switch(u){case de.TextDocumentSaveReason.Manual:return O.TextDocumentSaveReason.Manual;case de.TextDocumentSaveReason.AfterDelay:return O.TextDocumentSaveReason.AfterDelay;case de.TextDocumentSaveReason.FocusOut:return O.TextDocumentSaveReason.FocusOut}return O.TextDocumentSaveReason.Manual}function p(u){return{textDocument:i(u.document),reason:v(u.reason)}}function y(u){return{files:u.files.map(w=>({uri:t(w)}))}}function C(u){return{files:u.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function b(u){return{files:u.files.map(w=>({uri:t(w)}))}}function T(u){return{files:u.files.map(w=>({uri:t(w)}))}}function P(u){return{files:u.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function q(u){return{files:u.files.map(w=>({uri:t(w)}))}}function ce(u,w){return{textDocument:i(u),position:at(w)}}function V(u){switch(u){case de.CompletionTriggerKind.TriggerCharacter:return O.CompletionTriggerKind.TriggerCharacter;case de.CompletionTriggerKind.TriggerForIncompleteCompletions:return O.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return O.CompletionTriggerKind.Invoked}}function X(u,w,R){return{textDocument:i(u),position:at(w),context:{triggerKind:V(R.triggerKind),triggerCharacter:R.triggerCharacter}}}function Je(u){switch(u){case de.SignatureHelpTriggerKind.Invoke:return O.SignatureHelpTriggerKind.Invoked;case de.SignatureHelpTriggerKind.TriggerCharacter:return O.SignatureHelpTriggerKind.TriggerCharacter;case de.SignatureHelpTriggerKind.ContentChange:return O.SignatureHelpTriggerKind.ContentChange}}function rt(u){return{label:u.label}}function Qe(u){return u.map(rt)}function st(u){return{label:u.label,parameters:Qe(u.parameters)}}function It(u){return u.map(st)}function Et(u){return u===void 0?u:{signatures:It(u.signatures),activeSignature:u.activeSignature,activeParameter:u.activeParameter}}function ot(u,w,R){return{textDocument:i(u),position:at(w),context:{isRetrigger:R.isRetrigger,triggerCharacter:R.triggerCharacter,triggerKind:Je(R.triggerKind),activeSignatureHelp:Et(R.activeSignatureHelp)}}}function at(u){return{line:u.line,character:u.character}}function Le(u){return u==null?u:{line:u.line>O.uinteger.MAX_VALUE?O.uinteger.MAX_VALUE:u.line,character:u.character>O.uinteger.MAX_VALUE?O.uinteger.MAX_VALUE:u.character}}function rr(u,w){return $a.map(u,Le,w)}function En(u){return u.map(Le)}function pe(u){return u==null?u:{start:Le(u.start),end:Le(u.end)}}function Mn(u){return u.map(pe)}function ct(u){return u==null?u:O.Location.create(n(u.uri),pe(u.range))}function Ge(u){switch(u){case de.DiagnosticSeverity.Error:return O.DiagnosticSeverity.Error;case de.DiagnosticSeverity.Warning:return O.DiagnosticSeverity.Warning;case de.DiagnosticSeverity.Information:return O.DiagnosticSeverity.Information;case de.DiagnosticSeverity.Hint:return O.DiagnosticSeverity.Hint}}function sr(u){if(!u)return;let w=[];for(let R of u){let B=An(R);B!==void 0&&w.push(B)}return w.length>0?w:void 0}function An(u){switch(u){case de.DiagnosticTag.Unnecessary:return O.DiagnosticTag.Unnecessary;case de.DiagnosticTag.Deprecated:return O.DiagnosticTag.Deprecated;default:return}}function On(u){return{message:u.message,location:ct(u.location)}}function Ln(u){return u.map(On)}function or(u){if(u!=null)return St.number(u)||St.string(u)?u:{value:u.value,target:n(u.target)}}function Zt(u){let w=O.Diagnostic.create(pe(u.range),u.message),R=u instanceof Va.ProtocolDiagnostic?u:void 0;R!==void 0&&R.data!==void 0&&(w.data=R.data);let B=or(u.code);return Va.DiagnosticCode.is(B)?R!==void 0&&R.hasDiagnosticCode?w.code=B:(w.code=B.value,w.codeDescription={href:B.target}):w.code=B,St.number(u.severity)&&(w.severity=Ge(u.severity)),Array.isArray(u.tags)&&(w.tags=sr(u.tags)),u.relatedInformation&&(w.relatedInformation=Ln(u.relatedInformation)),u.source&&(w.source=u.source),w}function Mt(u,w){return u==null?u:$a.map(u,Zt,w)}function At(u){return u==null?u:u.map(Zt)}function ar(u,w){switch(u){case"$string":return w;case O.MarkupKind.PlainText:return{kind:u,value:w};case O.MarkupKind.Markdown:return{kind:u,value:w.value};default:return`Unsupported Markup content received. Kind is: ${u}`}}function dt(u){if(u===de.CompletionItemTag.Deprecated)return O.CompletionItemTag.Deprecated}function Un(u){if(u===void 0)return u;let w=[];for(let R of u){let B=dt(R);B!==void 0&&w.push(B)}return w}function Ot(u,w){return w!==void 0?w:u+1}function Hn(u,w=!1){let R,B;St.string(u.label)?R=u.label:(R=u.label.label,w&&(u.label.detail!==void 0||u.label.description!==void 0)&&(B={detail:u.label.detail,description:u.label.description}));let Q={label:R};B!==void 0&&(Q.labelDetails=B);let fe=u instanceof ru.default?u:void 0;u.detail&&(Q.detail=u.detail),u.documentation&&(!fe||fe.documentationFormat==="$string"?Q.documentation=u.documentation:Q.documentation=ar(fe.documentationFormat,u.documentation)),u.filterText&&(Q.filterText=u.filterText),cr(Q,u),St.number(u.kind)&&(Q.kind=Ot(u.kind,fe&&fe.originalItemKind)),u.sortText&&(Q.sortText=u.sortText),u.additionalTextEdits&&(Q.additionalTextEdits=Ue(u.additionalTextEdits)),u.commitCharacters&&(Q.commitCharacters=u.commitCharacters.slice()),u.command&&(Q.command=Ze(u.command)),(u.preselect===!0||u.preselect===!1)&&(Q.preselect=u.preselect);let ke=Un(u.tags);if(fe){if(fe.data!==void 0&&(Q.data=fe.data),fe.deprecated===!0||fe.deprecated===!1){if(fe.deprecated===!0&&ke!==void 0&&ke.length>0){let We=ke.indexOf(de.CompletionItemTag.Deprecated);We!==-1&&ke.splice(We,1)}Q.deprecated=fe.deprecated}fe.insertTextMode!==void 0&&(Q.insertTextMode=fe.insertTextMode)}return ke!==void 0&&ke.length>0&&(Q.tags=ke),Q.insertTextMode===void 0&&u.keepWhitespace===!0&&(Q.insertTextMode=O.InsertTextMode.adjustIndentation),Q}function cr(u,w){let R=O.InsertTextFormat.PlainText,B,Q;w.textEdit?(B=w.textEdit.newText,Q=w.textEdit.range):w.insertText instanceof de.SnippetString?(R=O.InsertTextFormat.Snippet,B=w.insertText.value):B=w.insertText,w.range&&(Q=w.range),u.insertTextFormat=R,w.fromEdit&&B!==void 0&&Q!==void 0?u.textEdit=Xt(B,Q):u.insertText=B}function Xt(u,w){return ls.is(w)?O.InsertReplaceEdit.create(u,pe(w.inserting),pe(w.replacing)):{newText:u,range:pe(w)}}function en(u){return{range:pe(u.range),newText:u.newText}}function Ue(u){return u==null?u:u.map(en)}function wt(u){return u<=de.SymbolKind.TypeParameter?u+1:O.SymbolKind.Property}function qe(u){return u}function ut(u){return u.map(qe)}function dr(u,w,R){return{textDocument:i(u),position:at(w),context:{includeDeclaration:R.includeDeclaration}}}async function Nn(u,w){let R=O.CodeAction.create(u.title);if(u instanceof za.default&&u.data!==void 0&&(R.data=u.data),u.kind!==void 0&&(R.kind=jn(u.kind)),u.diagnostics!==void 0&&(R.diagnostics=await Mt(u.diagnostics,w)),u.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return u.command!==void 0&&(R.command=Ze(u.command)),u.isPreferred!==void 0&&(R.isPreferred=u.isPreferred),u.disabled!==void 0&&(R.disabled={reason:u.disabled.reason}),R}function ur(u){let w=O.CodeAction.create(u.title);if(u instanceof za.default&&u.data!==void 0&&(w.data=u.data),u.kind!==void 0&&(w.kind=jn(u.kind)),u.diagnostics!==void 0&&(w.diagnostics=At(u.diagnostics)),u.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return u.command!==void 0&&(w.command=Ze(u.command)),u.isPreferred!==void 0&&(w.isPreferred=u.isPreferred),u.disabled!==void 0&&(w.disabled={reason:u.disabled.reason}),w}async function Kn(u,w){if(u==null)return u;let R;return u.only&&St.string(u.only.value)&&(R=[u.only.value]),O.CodeActionContext.create(await Mt(u.diagnostics,w),R,tn(u.triggerKind))}function lr(u){if(u==null)return u;let w;return u.only&&St.string(u.only.value)&&(w=[u.only.value]),O.CodeActionContext.create(At(u.diagnostics),w,tn(u.triggerKind))}function tn(u){switch(u){case de.CodeActionTriggerKind.Invoke:return O.CodeActionTriggerKind.Invoked;case de.CodeActionTriggerKind.Automatic:return O.CodeActionTriggerKind.Automatic;default:return}}function jn(u){if(u!=null)return u.value}function Wn(u){return u==null?u:O.InlineValueContext.create(u.frameId,pe(u.stoppedLocation))}function pr(u,w,R){return{context:O.InlineCompletionContext.create(R.triggerKind,R.selectedCompletionInfo),textDocument:i(u),position:Le(w)}}function Ze(u){let w=O.Command.create(u.title,u.command);return u.arguments&&(w.arguments=u.arguments),w}function $n(u){let w=O.CodeLens.create(pe(u.range));return u.command&&(w.command=Ze(u.command)),u instanceof su.default&&u.data&&(w.data=u.data),w}function fr(u,w){let R={tabSize:u.tabSize,insertSpaces:u.insertSpaces};return w.trimTrailingWhitespace&&(R.trimTrailingWhitespace=!0),w.trimFinalNewlines&&(R.trimFinalNewlines=!0),w.insertFinalNewline&&(R.insertFinalNewline=!0),R}function zn(u){return{textDocument:i(u)}}function hr(u){return{textDocument:i(u)}}function Vn(u){let w=O.DocumentLink.create(pe(u.range));u.target&&(w.target=n(u.target)),u.tooltip!==void 0&&(w.tooltip=u.tooltip);let R=u instanceof ou.default?u:void 0;return R&&R.data&&(w.data=R.data),w}function Bn(u){return{textDocument:i(u)}}function gr(u){let w={name:u.name,kind:wt(u.kind),uri:n(u.uri),range:pe(u.range),selectionRange:pe(u.selectionRange)};return u.detail!==void 0&&u.detail.length>0&&(w.detail=u.detail),u.tags!==void 0&&(w.tags=ut(u.tags)),u instanceof au.default&&u.data!==void 0&&(w.data=u.data),w}function nn(u){let w={name:u.name,kind:wt(u.kind),uri:n(u.uri),range:pe(u.range),selectionRange:pe(u.selectionRange)};return u.detail!==void 0&&u.detail.length>0&&(w.detail=u.detail),u.tags!==void 0&&(w.tags=ut(u.tags)),u instanceof cu.default&&u.data!==void 0&&(w.data=u.data),w}function mr(u){let w=u instanceof du.default?{name:u.name,kind:wt(u.kind),location:u.hasRange?ct(u.location):{uri:t(u.location.uri)},data:u.data}:{name:u.name,kind:wt(u.kind),location:ct(u.location)};return u.tags!==void 0&&(w.tags=ut(u.tags)),u.containerName!==""&&(w.containerName=u.containerName),w}function Yn(u){let w=typeof u.label=="string"?u.label:u.label.map(vr),R=O.InlayHint.create(Le(u.position),w);return u.kind!==void 0&&(R.kind=u.kind),u.textEdits!==void 0&&(R.textEdits=Ue(u.textEdits)),u.tooltip!==void 0&&(R.tooltip=rn(u.tooltip)),u.paddingLeft!==void 0&&(R.paddingLeft=u.paddingLeft),u.paddingRight!==void 0&&(R.paddingRight=u.paddingRight),u instanceof uu.default&&u.data!==void 0&&(R.data=u.data),R}function vr(u){let w=O.InlayHintLabelPart.create(u.value);return u.location!==void 0&&(w.location=ct(u.location)),u.command!==void 0&&(w.command=Ze(u.command)),u.tooltip!==void 0&&(w.tooltip=rn(u.tooltip)),w}function rn(u){return typeof u=="string"?u:{kind:O.MarkupKind.Markdown,value:u.value}}return{asUri:n,asTextDocumentIdentifier:i,asTextDocumentItem:r,asVersionedTextDocumentIdentifier:s,asOpenTextDocumentParams:c,asChangeTextDocumentParams:g,asCloseTextDocumentParams:h,asSaveTextDocumentParams:f,asWillSaveTextDocumentParams:p,asDidCreateFilesParams:y,asDidRenameFilesParams:C,asDidDeleteFilesParams:b,asWillCreateFilesParams:T,asWillRenameFilesParams:P,asWillDeleteFilesParams:q,asTextDocumentPositionParams:ce,asCompletionParams:X,asSignatureHelpParams:ot,asWorkerPosition:at,asRange:pe,asRanges:Mn,asPosition:Le,asPositions:rr,asPositionsSync:En,asLocation:ct,asDiagnosticSeverity:Ge,asDiagnosticTag:An,asDiagnostic:Zt,asDiagnostics:Mt,asDiagnosticsSync:At,asCompletionItem:Hn,asTextEdit:en,asSymbolKind:wt,asSymbolTag:qe,asSymbolTags:ut,asReferenceParams:dr,asCodeAction:Nn,asCodeActionSync:ur,asCodeActionContext:Kn,asCodeActionContextSync:lr,asInlineValueContext:Wn,asCommand:Ze,asCodeLens:$n,asFormattingOptions:fr,asDocumentSymbolParams:zn,asCodeLensParams:hr,asDocumentLink:Vn,asDocumentLinkParams:Bn,asCallHierarchyItem:gr,asTypeHierarchyItem:nn,asInlayHint:Yn,asWorkspaceSymbol:mr,asInlineCompletionParams:pr}}ci.createConverter=lu});var Qa=F(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.createConverter=void 0;var k=I("vscode"),M=L(),Ee=Ie(),$=oi(),pu=Nr(),fu=Wr(),hu=Vr(),gu=Jr(),Ya=Zr(),mu=ts(),vu=rs(),yu=as(),Cu=us(),Ja=L(),di;(function(a){function e(t){let n=t;return n&&Ee.string(n.language)&&Ee.string(n.value)}a.is=e})(di||(di={}));function wu(a,e,t){let i=a||(o=>k.Uri.parse(o));function r(o){return i(o)}function s(o){let m=[];for(let D of o)if(typeof D=="string")m.push(D);else if(Ja.NotebookCellTextDocumentFilter.is(D))if(typeof D.notebook=="string")m.push({notebookType:D.notebook,language:D.language});else{let x=D.notebook.notebookType??"*";m.push({notebookType:x,scheme:D.notebook.scheme,pattern:D.notebook.pattern,language:D.language})}else Ja.TextDocumentFilter.is(D)&&m.push({language:D.language,scheme:D.scheme,pattern:D.pattern});return m}async function c(o,m){return $.map(o,l,m)}function d(o){let m=new Array(o.length);for(let D=0;D<o.length;D++)m[D]=l(o[D]);return m}function l(o){let m=new Ya.ProtocolDiagnostic(p(o.range),o.message,C(o.severity),o.data);if(o.code!==void 0){if(typeof o.code=="string"||typeof o.code=="number")M.CodeDescription.is(o.codeDescription)?m.code={value:o.code,target:r(o.codeDescription.href)}:m.code=o.code;else if(Ya.DiagnosticCode.is(o.code)){m.hasDiagnosticCode=!0;let D=o.code;m.code={value:D.value,target:r(D.target)}}}return o.source&&(m.source=o.source),o.relatedInformation&&(m.relatedInformation=g(o.relatedInformation)),Array.isArray(o.tags)&&(m.tags=h(o.tags)),m}function g(o){let m=new Array(o.length);for(let D=0;D<o.length;D++){let x=o[D];m[D]=new k.DiagnosticRelatedInformation(Ge(x.location),x.message)}return m}function h(o){if(!o)return;let m=[];for(let D of o){let x=f(D);x!==void 0&&m.push(x)}return m.length>0?m:void 0}function f(o){switch(o){case M.DiagnosticTag.Unnecessary:return k.DiagnosticTag.Unnecessary;case M.DiagnosticTag.Deprecated:return k.DiagnosticTag.Deprecated;default:return}}function v(o){return o?new k.Position(o.line,o.character):void 0}function p(o){return o?new k.Range(o.start.line,o.start.character,o.end.line,o.end.character):void 0}async function y(o,m){return $.map(o,D=>new k.Range(D.start.line,D.start.character,D.end.line,D.end.character),m)}function C(o){if(o==null)return k.DiagnosticSeverity.Error;switch(o){case M.DiagnosticSeverity.Error:return k.DiagnosticSeverity.Error;case M.DiagnosticSeverity.Warning:return k.DiagnosticSeverity.Warning;case M.DiagnosticSeverity.Information:return k.DiagnosticSeverity.Information;case M.DiagnosticSeverity.Hint:return k.DiagnosticSeverity.Hint}return k.DiagnosticSeverity.Error}function b(o){if(Ee.string(o))return P(o);if(di.is(o))return P().appendCodeblock(o.value,o.language);if(Array.isArray(o)){let m=[];for(let D of o){let x=P();di.is(D)?x.appendCodeblock(D.value,D.language):x.appendMarkdown(D),m.push(x)}return m}else return P(o)}function T(o){if(Ee.string(o))return o;switch(o.kind){case M.MarkupKind.Markdown:return P(o.value);case M.MarkupKind.PlainText:return o.value;default:return`Unsupported Markup content received. Kind is: ${o.kind}`}}function P(o){let m;if(o===void 0||typeof o=="string")m=new k.MarkdownString(o);else switch(o.kind){case M.MarkupKind.Markdown:m=new k.MarkdownString(o.value);break;case M.MarkupKind.PlainText:m=new k.MarkdownString,m.appendText(o.value);break;default:m=new k.MarkdownString,m.appendText(`Unsupported Markup content received. Kind is: ${o.kind}`);break}return m.isTrusted=e,m.supportHtml=t,m}function q(o){if(o)return new k.Hover(b(o.contents),p(o.range))}async function ce(o,m,D){if(!o)return;if(Array.isArray(o))return $.map(o,$e=>Qe($e,m),D);let x=o,{defaultRange:he,commitCharacters:ye}=V(x,m),J=await $.map(x.items,$e=>Qe($e,ye,he,x.itemDefaults?.insertTextMode,x.itemDefaults?.insertTextFormat,x.itemDefaults?.data),D);return new k.CompletionList(J,x.isIncomplete)}function V(o,m){let D=o.itemDefaults?.editRange,x=o.itemDefaults?.commitCharacters??m;return M.Range.is(D)?{defaultRange:p(D),commitCharacters:x}:D!==void 0?{defaultRange:{inserting:p(D.insert),replacing:p(D.replace)},commitCharacters:x}:{defaultRange:void 0,commitCharacters:x}}function X(o){return M.CompletionItemKind.Text<=o&&o<=M.CompletionItemKind.TypeParameter?[o-1,void 0]:[k.CompletionItemKind.Text,o]}function Je(o){if(o===M.CompletionItemTag.Deprecated)return k.CompletionItemTag.Deprecated}function rt(o){if(o==null)return[];let m=[];for(let D of o){let x=Je(D);x!==void 0&&m.push(x)}return m}function Qe(o,m,D,x,he,ye){let J=rt(o.tags),$e=st(o),G=new pu.default($e);o.detail&&(G.detail=o.detail),o.documentation&&(G.documentation=T(o.documentation),G.documentationFormat=Ee.string(o.documentation)?"$string":o.documentation.kind),o.filterText&&(G.filterText=o.filterText);let Jn=It(o,D,he);if(Jn&&(G.insertText=Jn.text,G.range=Jn.range,G.fromEdit=Jn.fromEdit),Ee.number(o.kind)){let[Fd,ka]=X(o.kind);G.kind=Fd,ka&&(G.originalItemKind=ka)}o.sortText&&(G.sortText=o.sortText),o.additionalTextEdits&&(G.additionalTextEdits=Le(o.additionalTextEdits));let _a=o.commitCharacters!==void 0?Ee.stringArray(o.commitCharacters)?o.commitCharacters:void 0:m;_a&&(G.commitCharacters=_a.slice()),o.command&&(G.command=Ue(o.command)),(o.deprecated===!0||o.deprecated===!1)&&(G.deprecated=o.deprecated,o.deprecated===!0&&J.push(k.CompletionItemTag.Deprecated)),(o.preselect===!0||o.preselect===!1)&&(G.preselect=o.preselect);let Ta=o.data??ye;Ta!==void 0&&(G.data=Ta),J.length>0&&(G.tags=J);let Cr=o.insertTextMode??x;return Cr!==void 0&&(G.insertTextMode=Cr,Cr===M.InsertTextMode.asIs&&(G.keepWhitespace=!0)),G}function st(o){return M.CompletionItemLabelDetails.is(o.labelDetails)?{label:o.label,detail:o.labelDetails.detail,description:o.labelDetails.description}:o.label}function It(o,m,D){let x=o.insertTextFormat??D;if(o.textEdit!==void 0||m!==void 0){let[he,ye]=o.textEdit!==void 0?Et(o.textEdit):[m,o.textEditText??o.label];return x===M.InsertTextFormat.Snippet?{text:new k.SnippetString(ye),range:he,fromEdit:!0}:{text:ye,range:he,fromEdit:!0}}else return o.insertText?x===M.InsertTextFormat.Snippet?{text:new k.SnippetString(o.insertText),fromEdit:!1}:{text:o.insertText,fromEdit:!1}:void 0}function Et(o){return M.InsertReplaceEdit.is(o)?[{inserting:p(o.insert),replacing:p(o.replace)},o.newText]:[p(o.range),o.newText]}function ot(o){if(o)return new k.TextEdit(p(o.range),o.newText)}async function at(o,m){if(o)return $.map(o,ot,m)}function Le(o){if(!o)return;let m=new Array(o.length);for(let D=0;D<o.length;D++)m[D]=ot(o[D]);return m}async function rr(o,m){if(!o)return;let D=new k.SignatureHelp;return Ee.number(o.activeSignature)?D.activeSignature=o.activeSignature:D.activeSignature=0,Ee.number(o.activeParameter)?D.activeParameter=o.activeParameter:D.activeParameter=0,o.signatures&&(D.signatures=await En(o.signatures,m)),D}async function En(o,m){return $.mapAsync(o,pe,m)}async function pe(o,m){let D=new k.SignatureInformation(o.label);return o.documentation!==void 0&&(D.documentation=T(o.documentation)),o.parameters!==void 0&&(D.parameters=await Mn(o.parameters,m)),o.activeParameter!==void 0&&(D.activeParameter=o.activeParameter),D}function Mn(o,m){return $.map(o,ct,m)}function ct(o){let m=new k.ParameterInformation(o.label);return o.documentation&&(m.documentation=T(o.documentation)),m}function Ge(o){return o?new k.Location(i(o.uri),p(o.range)):void 0}async function sr(o,m){if(o)return Ln(o,m)}async function An(o,m){if(o)return Ln(o,m)}function On(o){if(!o)return;let m={targetUri:i(o.targetUri),targetRange:p(o.targetRange),originSelectionRange:p(o.originSelectionRange),targetSelectionRange:p(o.targetSelectionRange)};if(!m.targetSelectionRange)throw new Error("targetSelectionRange must not be undefined or null");return m}async function Ln(o,m){if(o)if(Ee.array(o)){if(o.length===0)return[];if(M.LocationLink.is(o[0])){let D=o;return $.map(D,On,m)}else{let D=o;return $.map(D,Ge,m)}}else return M.LocationLink.is(o)?[On(o)]:Ge(o)}async function or(o,m){if(o)return $.map(o,Ge,m)}async function Zt(o,m){if(o)return $.map(o,Mt,m)}function Mt(o){let m=new k.DocumentHighlight(p(o.range));return Ee.number(o.kind)&&(m.kind=At(o.kind)),m}function At(o){switch(o){case M.DocumentHighlightKind.Text:return k.DocumentHighlightKind.Text;case M.DocumentHighlightKind.Read:return k.DocumentHighlightKind.Read;case M.DocumentHighlightKind.Write:return k.DocumentHighlightKind.Write}return k.DocumentHighlightKind.Text}async function ar(o,m){if(o)return $.map(o,Hn,m)}function dt(o){return o<=M.SymbolKind.TypeParameter?o-1:k.SymbolKind.Property}function Un(o){if(o===M.SymbolTag.Deprecated)return k.SymbolTag.Deprecated}function Ot(o){if(o==null)return;let m=[];for(let D of o){let x=Un(D);x!==void 0&&m.push(x)}return m.length===0?void 0:m}function Hn(o){let m=o.data,D=o.location,x=D.range===void 0||m!==void 0?new yu.default(o.name,dt(o.kind),o.containerName??"",D.range===void 0?i(D.uri):new k.Location(i(o.location.uri),p(D.range)),m):new k.SymbolInformation(o.name,dt(o.kind),o.containerName??"",new k.Location(i(o.location.uri),p(D.range)));return en(x,o),x}async function cr(o,m){if(o!=null)return $.map(o,Xt,m)}function Xt(o){let m=new k.DocumentSymbol(o.name,o.detail||"",dt(o.kind),p(o.range),p(o.selectionRange));if(en(m,o),o.children!==void 0&&o.children.length>0){let D=[];for(let x of o.children)D.push(Xt(x));m.children=D}return m}function en(o,m){o.tags=Ot(m.tags),m.deprecated&&(o.tags?o.tags.includes(k.SymbolTag.Deprecated)||(o.tags=o.tags.concat(k.SymbolTag.Deprecated)):o.tags=[k.SymbolTag.Deprecated])}function Ue(o){let m={title:o.title,command:o.command};return o.arguments&&(m.arguments=o.arguments),m}async function wt(o,m){if(o)return $.map(o,Ue,m)}let qe=new Map;qe.set(M.CodeActionKind.Empty,k.CodeActionKind.Empty),qe.set(M.CodeActionKind.QuickFix,k.CodeActionKind.QuickFix),qe.set(M.CodeActionKind.Refactor,k.CodeActionKind.Refactor),qe.set(M.CodeActionKind.RefactorExtract,k.CodeActionKind.RefactorExtract),qe.set(M.CodeActionKind.RefactorInline,k.CodeActionKind.RefactorInline),qe.set(M.CodeActionKind.RefactorRewrite,k.CodeActionKind.RefactorRewrite),qe.set(M.CodeActionKind.Source,k.CodeActionKind.Source),qe.set(M.CodeActionKind.SourceOrganizeImports,k.CodeActionKind.SourceOrganizeImports);function ut(o){if(o==null)return;let m=qe.get(o);if(m)return m;let D=o.split(".");m=k.CodeActionKind.Empty;for(let x of D)m=m.append(x);return m}function dr(o){if(o!=null)return o.map(m=>ut(m))}async function Nn(o,m){if(o==null)return;let D=new gu.default(o.title,o.data);return o.kind!==void 0&&(D.kind=ut(o.kind)),o.diagnostics!==void 0&&(D.diagnostics=d(o.diagnostics)),o.edit!==void 0&&(D.edit=await tn(o.edit,m)),o.command!==void 0&&(D.command=Ue(o.command)),o.isPreferred!==void 0&&(D.isPreferred=o.isPreferred),o.disabled!==void 0&&(D.disabled={reason:o.disabled.reason}),D}function ur(o,m){return $.mapAsync(o,async D=>M.Command.is(D)?Ue(D):Nn(D,m),m)}function Kn(o){if(!o)return;let m=new fu.default(p(o.range));return o.command&&(m.command=Ue(o.command)),o.data!==void 0&&o.data!==null&&(m.data=o.data),m}async function lr(o,m){if(o)return $.map(o,Kn,m)}async function tn(o,m){if(!o)return;let D=new Map;if(o.changeAnnotations!==void 0){let ye=o.changeAnnotations;await $.forEach(Object.keys(ye),J=>{let $e=jn(ye[J]);D.set(J,$e)},m)}let x=ye=>{if(ye!==void 0)return D.get(ye)},he=new k.WorkspaceEdit;if(o.documentChanges){let ye=o.documentChanges;await $.forEach(ye,J=>{if(M.CreateFile.is(J))he.createFile(i(J.uri),J.options,x(J.annotationId));else if(M.RenameFile.is(J))he.renameFile(i(J.oldUri),i(J.newUri),J.options,x(J.annotationId));else if(M.DeleteFile.is(J))he.deleteFile(i(J.uri),J.options,x(J.annotationId));else if(M.TextDocumentEdit.is(J)){let $e=i(J.textDocument.uri);for(let G of J.edits)M.AnnotatedTextEdit.is(G)?he.replace($e,p(G.range),G.newText,x(G.annotationId)):he.replace($e,p(G.range),G.newText)}else throw new Error(`Unknown workspace edit change received:
6
- ${JSON.stringify(J,void 0,4)}`)},m)}else if(o.changes){let ye=o.changes;await $.forEach(Object.keys(ye),J=>{he.set(i(J),Le(ye[J]))},m)}return he}function jn(o){if(o!==void 0)return{label:o.label,needsConfirmation:!!o.needsConfirmation,description:o.description}}function Wn(o){let m=p(o.range),D=o.target?r(o.target):void 0,x=new hu.default(m,D);return o.tooltip!==void 0&&(x.tooltip=o.tooltip),o.data!==void 0&&o.data!==null&&(x.data=o.data),x}async function pr(o,m){if(o)return $.map(o,Wn,m)}function Ze(o){return new k.Color(o.red,o.green,o.blue,o.alpha)}function $n(o){return new k.ColorInformation(p(o.range),Ze(o.color))}async function fr(o,m){if(o)return $.map(o,$n,m)}function zn(o){let m=new k.ColorPresentation(o.label);return m.additionalTextEdits=Le(o.additionalTextEdits),o.textEdit&&(m.textEdit=ot(o.textEdit)),m}async function hr(o,m){if(o)return $.map(o,zn,m)}function Vn(o){if(o)switch(o){case M.FoldingRangeKind.Comment:return k.FoldingRangeKind.Comment;case M.FoldingRangeKind.Imports:return k.FoldingRangeKind.Imports;case M.FoldingRangeKind.Region:return k.FoldingRangeKind.Region}}function Bn(o){return new k.FoldingRange(o.startLine,o.endLine,Vn(o.kind))}async function gr(o,m){if(o)return $.map(o,Bn,m)}function nn(o){return new k.SelectionRange(p(o.range),o.parent?nn(o.parent):void 0)}async function mr(o,m){return Array.isArray(o)?$.map(o,nn,m):[]}function Yn(o){return M.InlineValueText.is(o)?new k.InlineValueText(p(o.range),o.text):M.InlineValueVariableLookup.is(o)?new k.InlineValueVariableLookup(p(o.range),o.variableName,o.caseSensitiveLookup):new k.InlineValueEvaluatableExpression(p(o.range),o.expression)}async function vr(o,m){return Array.isArray(o)?$.map(o,Yn,m):[]}async function rn(o,m){let D=typeof o.label=="string"?o.label:await $.map(o.label,u,m),x=new Cu.default(v(o.position),D);return o.kind!==void 0&&(x.kind=o.kind),o.textEdits!==void 0&&(x.textEdits=await at(o.textEdits,m)),o.tooltip!==void 0&&(x.tooltip=w(o.tooltip)),o.paddingLeft!==void 0&&(x.paddingLeft=o.paddingLeft),o.paddingRight!==void 0&&(x.paddingRight=o.paddingRight),o.data!==void 0&&(x.data=o.data),x}function u(o){let m=new k.InlayHintLabelPart(o.value);return o.location!==void 0&&(m.location=Ge(o.location)),o.tooltip!==void 0&&(m.tooltip=w(o.tooltip)),o.command!==void 0&&(m.command=Ue(o.command)),m}function w(o){return typeof o=="string"?o:P(o)}async function R(o,m){if(Array.isArray(o))return $.mapAsync(o,rn,m)}function B(o){if(o===null)return;let m=new mu.default(dt(o.kind),o.name,o.detail||"",r(o.uri),p(o.range),p(o.selectionRange),o.data);return o.tags!==void 0&&(m.tags=Ot(o.tags)),m}async function Q(o,m){if(o!==null)return $.map(o,B,m)}async function fe(o,m){return new k.CallHierarchyIncomingCall(B(o.from),await y(o.fromRanges,m))}async function ke(o,m){if(o!==null)return $.mapAsync(o,fe,m)}async function We(o,m){return new k.CallHierarchyOutgoingCall(B(o.to),await y(o.fromRanges,m))}async function Dd(o,m){if(o!==null)return $.mapAsync(o,We,m)}async function Sd(o,m){if(o!=null)return new k.SemanticTokens(new Uint32Array(o.data),o.resultId)}function Sa(o){return new k.SemanticTokensEdit(o.start,o.deleteCount,o.data!==void 0?new Uint32Array(o.data):void 0)}async function bd(o,m){if(o!=null)return new k.SemanticTokensEdits(o.edits.map(Sa),o.resultId)}function _d(o){return o}async function Td(o,m){if(o!=null)return new k.LinkedEditingRanges(await y(o.ranges,m),kd(o.wordPattern))}function kd(o){if(o!=null)return new RegExp(o)}function ba(o){if(o===null)return;let m=new vu.default(dt(o.kind),o.name,o.detail||"",r(o.uri),p(o.range),p(o.selectionRange),o.data);return o.tags!==void 0&&(m.tags=Ot(o.tags)),m}async function Pd(o,m){if(o!==null)return $.map(o,ba,m)}function Rd(o){if(Ee.string(o))return o;if(M.RelativePattern.is(o)){if(M.URI.is(o.baseUri))return new k.RelativePattern(r(o.baseUri),o.pattern);if(M.WorkspaceFolder.is(o.baseUri)){let m=k.workspace.getWorkspaceFolder(r(o.baseUri.uri));return m!==void 0?new k.RelativePattern(m,o.pattern):void 0}}}async function xd(o,m){if(!o)return;if(Array.isArray(o))return $.map(o,he=>yr(he),m);let D=o,x=await $.map(D.items,he=>yr(he),m);return new k.InlineCompletionList(x)}function yr(o){let m;typeof o.insertText=="string"?m=o.insertText:m=new k.SnippetString(o.insertText.value);let D;o.command&&(D=Ue(o.command));let x=new k.InlineCompletionItem(m,p(o.range),D);return o.filterText&&(x.filterText=o.filterText),x}return{asUri:r,asDocumentSelector:s,asDiagnostics:c,asDiagnostic:l,asRange:p,asRanges:y,asPosition:v,asDiagnosticSeverity:C,asDiagnosticTag:f,asHover:q,asCompletionResult:ce,asCompletionItem:Qe,asTextEdit:ot,asTextEdits:at,asSignatureHelp:rr,asSignatureInformations:En,asSignatureInformation:pe,asParameterInformations:Mn,asParameterInformation:ct,asDeclarationResult:sr,asDefinitionResult:An,asLocation:Ge,asReferences:or,asDocumentHighlights:Zt,asDocumentHighlight:Mt,asDocumentHighlightKind:At,asSymbolKind:dt,asSymbolTag:Un,asSymbolTags:Ot,asSymbolInformations:ar,asSymbolInformation:Hn,asDocumentSymbols:cr,asDocumentSymbol:Xt,asCommand:Ue,asCommands:wt,asCodeAction:Nn,asCodeActionKind:ut,asCodeActionKinds:dr,asCodeActionResult:ur,asCodeLens:Kn,asCodeLenses:lr,asWorkspaceEdit:tn,asDocumentLink:Wn,asDocumentLinks:pr,asFoldingRangeKind:Vn,asFoldingRange:Bn,asFoldingRanges:gr,asColor:Ze,asColorInformation:$n,asColorInformations:fr,asColorPresentation:zn,asColorPresentations:hr,asSelectionRange:nn,asSelectionRanges:mr,asInlineValue:Yn,asInlineValues:vr,asInlayHint:rn,asInlayHints:R,asSemanticTokensLegend:_d,asSemanticTokens:Sd,asSemanticTokensEdit:Sa,asSemanticTokensEdits:bd,asCallHierarchyItem:B,asCallHierarchyItems:Q,asCallHierarchyIncomingCall:fe,asCallHierarchyIncomingCalls:ke,asCallHierarchyOutgoingCall:We,asCallHierarchyOutgoingCalls:Dd,asLinkedEditingRanges:Td,asTypeHierarchyItem:ba,asTypeHierarchyItems:Pd,asGlobPattern:Rd,asInlineCompletionResult:xd,asInlineCompletionItem:yr}}ui.createConverter=wu});var te=F(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.generateUuid=Me.parse=Me.isUUID=Me.v4=Me.empty=void 0;var un=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},ln=class a extends un{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return a._oneOf(a._chars)}constructor(){super([a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),"-",a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),"-","4",a._randomHex(),a._randomHex(),a._randomHex(),"-",a._oneOf(a._timeHighBits),a._randomHex(),a._randomHex(),a._randomHex(),"-",a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex()].join(""))}};ln._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];ln._timeHighBits=["8","9","a","b"];Me.empty=new un("00000000-0000-0000-0000-000000000000");function Ga(){return new ln}Me.v4=Ga;var Du=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Za(a){return Du.test(a)}Me.isUUID=Za;function Su(a){if(!Za(a))throw new Error("invalid uuid");return new un(a)}Me.parse=Su;function bu(){return Ga().asHex()}Me.generateUuid=bu});var fs=F(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.ProgressPart=void 0;var Xa=I("vscode"),ec=L(),tc=Ie(),ps=class{constructor(e,t,n){this._client=e,this._token=t,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(ec.WorkDoneProgress.type,this._token,i=>{switch(i.kind){case"begin":this.begin(i);break;case"report":this.report(i);break;case"end":this.done(),n&&n(this);break}})}begin(e){this._infinite=e.percentage===void 0,this._lspProgressDisposable!==void 0&&Xa.window.withProgress({location:Xa.ProgressLocation.Window,cancellable:e.cancellable,title:e.title},async(t,n)=>{if(this._lspProgressDisposable!==void 0)return this._progress=t,this._cancellationToken=n,this._tokenDisposable=this._cancellationToken.onCancellationRequested(()=>{this._client.sendNotification(ec.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(e),new Promise((i,r)=>{this._resolve=i,this._reject=r})})}report(e){if(this._infinite&&tc.string(e.message))this._progress!==void 0&&this._progress.report({message:e.message});else if(tc.number(e.percentage)){let t=Math.max(0,Math.min(e.percentage,100)),n=Math.max(0,t-this._reported);this._reported+=n,this._progress!==void 0&&this._progress.report({message:e.message,increment:n})}}cancel(){this.cleanup(),this._reject!==void 0&&(this._reject(),this._resolve=void 0,this._reject=void 0)}done(){this.cleanup(),this._resolve!==void 0&&(this._resolve(),this._resolve=void 0,this._reject=void 0)}cleanup(){this._lspProgressDisposable!==void 0&&(this._lspProgressDisposable.dispose(),this._lspProgressDisposable=void 0),this._tokenDisposable!==void 0&&(this._tokenDisposable.dispose(),this._tokenDisposable=void 0),this._progress=void 0,this._cancellationToken=void 0}};li.ProgressPart=ps});var W=F(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.WorkspaceFeature=ge.TextDocumentLanguageFeature=ge.TextDocumentEventFeature=ge.DynamicDocumentFeature=ge.DynamicFeature=ge.StaticFeature=ge.ensure=ge.LSPCancellationError=void 0;var bt=I("vscode"),hs=L(),Se=Ie(),nc=te(),gs=class extends bt.CancellationError{constructor(e){super(),this.data=e}};ge.LSPCancellationError=gs;function _u(a,e){return a[e]===void 0&&(a[e]={}),a[e]}ge.ensure=_u;var ic;(function(a){function e(t){let n=t;return n!=null&&Se.func(n.fillClientCapabilities)&&Se.func(n.initialize)&&Se.func(n.getState)&&Se.func(n.clear)&&(n.fillInitializeParams===void 0||Se.func(n.fillInitializeParams))}a.is=e})(ic||(ge.StaticFeature=ic={}));var rc;(function(a){function e(t){let n=t;return n!=null&&Se.func(n.fillClientCapabilities)&&Se.func(n.initialize)&&Se.func(n.getState)&&Se.func(n.clear)&&(n.fillInitializeParams===void 0||Se.func(n.fillInitializeParams))&&Se.func(n.register)&&Se.func(n.unregister)&&n.registrationType!==void 0}a.is=e})(rc||(ge.DynamicFeature=rc={}));var pn=class{constructor(e){this._client=e}getState(){let e=this.getDocumentSelectors(),t=0;for(let i of e){t++;for(let r of bt.workspace.textDocuments)if(bt.languages.match(i,r)>0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}let n=t>0;return{kind:"document",id:this.registrationType.method,registrations:n,matches:!1}}};ge.DynamicDocumentFeature=pn;var ms=class extends pn{static textDocumentFilter(e,t){for(let n of e)if(bt.languages.match(n,t)>0)return!0;return!1}constructor(e,t,n,i,r,s,c){super(e),this._event=t,this._type=n,this._middleware=i,this._createParams=r,this._textDocument=s,this._selectorFilter=c,this._selectors=new Map,this._onNotificationSent=new bt.EventEmitter}getStateInfo(){return[this._selectors.values(),!1]}getDocumentSelectors(){return this._selectors.values()}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=this._event(t=>{this.callback(t).catch(n=>{this._client.error(`Sending document notification ${this._type.method} failed.`,n)})})),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}async callback(e){let t=async n=>{let i=this._createParams(n);await this._client.sendNotification(this._type,i),this.notificationSent(this.getTextDocument(n),this._type,i)};if(this.matches(e)){let n=this._middleware();return n?n(e,i=>t(i)):t(e)}}matches(e){return this._client.hasDedicatedTextSynchronizationFeature(this._textDocument(e))?!1:!this._selectorFilter||this._selectorFilter(this._selectors.values(),e)}get onNotificationSent(){return this._onNotificationSent.event}notificationSent(e,t,n){this._onNotificationSent.fire({textDocument:e,type:t,params:n})}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._onNotificationSent.dispose(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(e){for(let t of this._selectors.values())if(bt.languages.match(t,e)>0)return{send:n=>this.callback(n)}}};ge.TextDocumentEventFeature=ms;var vs=class extends pn{constructor(e,t){super(e),this._registrationType=t,this._registrations=new Map}*getDocumentSelectors(){for(let e of this._registrations.values()){let t=e.data.registerOptions.documentSelector;t!==null&&(yield this._client.protocol2CodeConverter.asDocumentSelector(t))}}get registrationType(){return this._registrationType}register(e){if(!e.registerOptions.documentSelector)return;let t=this.registerLanguageProvider(e.registerOptions,e.id);this._registrations.set(e.id,{disposable:t[0],data:e,provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&t.disposable.dispose()}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getRegistration(e,t){if(t){if(hs.TextDocumentRegistrationOptions.is(t)){let n=hs.StaticRegistrationOptions.hasId(t)?t.id:nc.generateUuid(),i=t.documentSelector??e;if(i)return[n,Object.assign({},t,{documentSelector:i})]}else if(Se.boolean(t)&&t===!0||hs.WorkDoneProgressOptions.is(t)){if(!e)return[void 0,void 0];let n=Se.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e});return[nc.generateUuid(),n]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(e,t){if(!(!e||!t))return Se.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e})}getProvider(e){for(let t of this._registrations.values()){let n=t.data.registerOptions.documentSelector;if(n!==null&&bt.languages.match(this._client.protocol2CodeConverter.asDocumentSelector(n),e)>0)return t.provider}}getAllProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};ge.TextDocumentLanguageFeature=vs;var ys=class{constructor(e,t){this._client=e,this._registrationType=t,this._registrations=new Map}getState(){let e=this._registrations.size>0;return{kind:"workspace",id:this._registrationType.method,registrations:e}}get registrationType(){return this._registrationType}register(e){let t=this.registerLanguageProvider(e.registerOptions);this._registrations.set(e.id,{disposable:t[0],provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&t.disposable.dispose()}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};ge.WorkspaceFeature=ys});var ks=F(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.DiagnosticFeature=ft.DiagnosticPullMode=ft.vsdiag=void 0;var Tu=Dr(),N=I("vscode"),ae=L(),ku=te(),Cs=W();function pi(a,e){return a[e]===void 0&&(a[e]={}),a[e]}var Ae;(function(a){let e;(function(t){t.full="full",t.unChanged="unChanged"})(e=a.DocumentDiagnosticReportKind||(a.DocumentDiagnosticReportKind={}))})(Ae||(ft.vsdiag=Ae={}));var fi;(function(a){a.onType="onType",a.onSave="onSave"})(fi||(ft.DiagnosticPullMode=fi={}));var we;(function(a){a.active="open",a.reschedule="reschedule",a.outDated="drop"})(we||(we={}));var ws=class a{constructor(){this.open=new Set,this._onOpen=new N.EventEmitter,this._onClose=new N.EventEmitter,a.fillTabResources(this.open);let e=t=>{if(t.closed.length===0&&t.opened.length===0)return;let n=this.open,i=new Set;a.fillTabResources(i);let r=new Set,s=new Set(i);for(let c of n.values())i.has(c)?s.delete(c):r.add(c);if(this.open=i,r.size>0){let c=new Set;for(let d of r)c.add(N.Uri.parse(d));this._onClose.fire(c)}if(s.size>0){let c=new Set;for(let d of s)c.add(N.Uri.parse(d));this._onOpen.fire(c)}};N.window.tabGroups.onDidChangeTabs!==void 0?this.disposable=N.window.tabGroups.onDidChangeTabs(e):this.disposable={dispose:()=>{}}}get onClose(){return this._onClose.event}get onOpen(){return this._onOpen.event}dispose(){this.disposable.dispose()}isActive(e){return e instanceof N.Uri?N.window.activeTextEditor?.document.uri===e:N.window.activeTextEditor?.document===e}isVisible(e){let t=e instanceof N.Uri?e:e.uri;return this.open.has(t.toString())}getTabResources(){let e=new Set;return a.fillTabResources(new Set,e),e}static fillTabResources(e,t){let n=e??new Set;for(let i of N.window.tabGroups.all)for(let r of i.tabs){let s=r.input,c;s instanceof N.TabInputText?c=s.uri:s instanceof N.TabInputTextDiff?c=s.modified:s instanceof N.TabInputCustom&&(c=s.uri),c!==void 0&&!n.has(c.toString())&&(n.add(c.toString()),t!==void 0&&t.add(c))}}},le;(function(a){a[a.document=1]="document",a[a.workspace=2]="workspace"})(le||(le={}));var Xe;(function(a){function e(t){return t instanceof N.Uri?t.toString():t.uri.toString()}a.asKey=e})(Xe||(Xe={}));var Ds=class{constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(e,t,n){let i=e===le.document?this.documentPullStates:this.workspacePullStates,[r,s,c]=t instanceof N.Uri?[t.toString(),t,n]:[t.uri.toString(),t.uri,t.version],d=i.get(r);return d===void 0&&(d={document:s,pulledVersion:c,resultId:void 0},i.set(r,d)),d}update(e,t,n,i){let r=e===le.document?this.documentPullStates:this.workspacePullStates,[s,c,d,l]=t instanceof N.Uri?[t.toString(),t,n,i]:[t.uri.toString(),t.uri,t.version,n],g=r.get(s);g===void 0?(g={document:c,pulledVersion:d,resultId:l},r.set(s,g)):(g.pulledVersion=d,g.resultId=l)}unTrack(e,t){let n=Xe.asKey(t);(e===le.document?this.documentPullStates:this.workspacePullStates).delete(n)}tracks(e,t){let n=Xe.asKey(t);return(e===le.document?this.documentPullStates:this.workspacePullStates).has(n)}getResultId(e,t){let n=Xe.asKey(t);return(e===le.document?this.documentPullStates:this.workspacePullStates).get(n)?.resultId}getAllResultIds(){let e=[];for(let[t,n]of this.workspacePullStates)this.documentPullStates.has(t)&&(n=this.documentPullStates.get(t)),n.resultId!==void 0&&e.push({uri:t,value:n.resultId});return e}},Ss=class{constructor(e,t,n){this.client=e,this.tabs=t,this.options=n,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new N.EventEmitter,this.provider=this.createProvider(),this.diagnostics=N.languages.createDiagnosticCollection(n.identifier),this.openRequests=new Map,this.documentStates=new Ds,this.workspaceErrorCounter=0}knows(e,t){let n=t instanceof N.Uri?t:t.uri;return this.documentStates.tracks(e,t)||this.openRequests.has(n.toString())}forget(e,t){this.documentStates.unTrack(e,t)}pull(e,t){if(this.isDisposed)return;let n=e instanceof N.Uri?e:e.uri;this.pullAsync(e).then(()=>{t&&t()},i=>{this.client.error(`Document pull failed for text document ${n.toString()}`,i,!1)})}async pullAsync(e,t){if(this.isDisposed)return;let n=e instanceof N.Uri,i=n?e:e.uri,r=i.toString();t=n?t:e.version;let s=this.openRequests.get(r),c=n?this.documentStates.track(le.document,e,t):this.documentStates.track(le.document,e);if(s===void 0){let d=new N.CancellationTokenSource;this.openRequests.set(r,{state:we.active,document:e,version:t,tokenSource:d});let l,g;try{l=await this.provider.provideDiagnostics(e,c.resultId,d.token)??{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}}catch(h){if(h instanceof Cs.LSPCancellationError&&ae.DiagnosticServerCancellationData.is(h.data)&&h.data.retriggerRequest===!1&&(g={state:we.outDated,document:e}),g===void 0&&h instanceof N.CancellationError)g={state:we.reschedule,document:e};else throw h}if(g=g??this.openRequests.get(r),g===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${r}`),this.diagnostics.delete(i);return}if(this.openRequests.delete(r),!this.tabs.isVisible(e)){this.documentStates.unTrack(le.document,e);return}if(g.state===we.outDated)return;l!==void 0&&(l.kind===Ae.DocumentDiagnosticReportKind.full&&this.diagnostics.set(i,l.items),c.pulledVersion=t,c.resultId=l.resultId),g.state===we.reschedule&&this.pull(e)}else s.state===we.active?(s.tokenSource.cancel(),this.openRequests.set(r,{state:we.reschedule,document:s.document})):s.state===we.outDated&&this.openRequests.set(r,{state:we.reschedule,document:s.document})}forgetDocument(e){let t=e instanceof N.Uri?e:e.uri,n=t.toString(),i=this.openRequests.get(n);this.options.workspaceDiagnostics?i!==void 0?this.openRequests.set(n,{state:we.reschedule,document:e}):this.pull(e,()=>{this.forget(le.document,e)}):(i!==void 0&&(i.state===we.active&&i.tokenSource.cancel(),this.openRequests.set(n,{state:we.outDated,document:e})),this.diagnostics.delete(t),this.forget(le.document,e))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,ae.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},e=>{!(e instanceof Cs.LSPCancellationError)&&!ae.DiagnosticServerCancellationData.is(e.data)&&(this.client.error("Workspace diagnostic pull failed.",e,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,ae.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3))})}async pullWorkspaceAsync(){if(!this.provider.provideWorkspaceDiagnostics||this.isDisposed)return;this.workspaceCancellation!==void 0&&(this.workspaceCancellation.cancel(),this.workspaceCancellation=void 0),this.workspaceCancellation=new N.CancellationTokenSource;let e=this.documentStates.getAllResultIds().map(t=>({uri:this.client.protocol2CodeConverter.asUri(t.uri),value:t.value}));await this.provider.provideWorkspaceDiagnostics(e,this.workspaceCancellation.token,t=>{if(!(!t||this.isDisposed))for(let n of t.items)n.kind===Ae.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(le.document,n.uri)||this.diagnostics.set(n.uri,n.items)),this.documentStates.update(le.workspace,n.uri,n.version??void 0,n.resultId)})}createProvider(){let e={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(t,n,i)=>{let r=(c,d,l)=>{let g={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(c instanceof N.Uri?c:c.uri)},previousResultId:d};return this.isDisposed===!0||!this.client.isRunning()?{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(ae.DocumentDiagnosticRequest.type,g,l).then(async h=>h==null||this.isDisposed||l.isCancellationRequested?{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}:h.kind===ae.DocumentDiagnosticReportKind.Full?{kind:Ae.DocumentDiagnosticReportKind.full,resultId:h.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(h.items,l)}:{kind:Ae.DocumentDiagnosticReportKind.unChanged,resultId:h.resultId},h=>this.client.handleFailedRequest(ae.DocumentDiagnosticRequest.type,l,h,{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}))},s=this.client.middleware;return s.provideDiagnostics?s.provideDiagnostics(t,n,i,r):r(t,n,i)}};return this.options.workspaceDiagnostics&&(e.provideWorkspaceDiagnostics=(t,n,i)=>{let r=async l=>l.kind===ae.DocumentDiagnosticReportKind.Full?{kind:Ae.DocumentDiagnosticReportKind.full,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version,items:await this.client.protocol2CodeConverter.asDiagnostics(l.items,n)}:{kind:Ae.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version},s=l=>{let g=[];for(let h of l)g.push({uri:this.client.code2ProtocolConverter.asUri(h.uri),value:h.value});return g},c=(l,g)=>{let h=(0,ku.generateUuid)(),f=this.client.onProgress(ae.WorkspaceDiagnosticRequest.partialResult,h,async p=>{if(p==null){i(null);return}let y={items:[]};for(let C of p.items)try{y.items.push(await r(C))}catch(b){this.client.error("Converting workspace diagnostics failed.",b)}i(y)}),v={identifier:this.options.identifier,previousResultIds:s(l),partialResultToken:h};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(ae.WorkspaceDiagnosticRequest.type,v,g).then(async p=>{if(g.isCancellationRequested)return{items:[]};let y={items:[]};for(let C of p.items)y.items.push(await r(C));return f.dispose(),i(y),{items:[]}},p=>(f.dispose(),this.client.handleFailedRequest(ae.DocumentDiagnosticRequest.type,g,p,{items:[]})))},d=this.client.middleware;return d.provideWorkspaceDiagnostics?d.provideWorkspaceDiagnostics(t,n,i,c):c(t,n,i)}),e}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(let[e,t]of this.openRequests)t.state===we.active&&t.tokenSource.cancel(),this.openRequests.set(e,{state:we.outDated,document:t.document});this.diagnostics.dispose()}},bs=class{constructor(e){this.diagnosticRequestor=e,this.documents=new ae.LinkedMap,this.isDisposed=!1}add(e){if(this.isDisposed===!0)return;let t=Xe.asKey(e);this.documents.has(t)||(this.documents.set(t,e,ae.Touch.Last),this.trigger())}remove(e){let t=Xe.asKey(e);this.documents.delete(t),this.documents.size===0?this.stop():t===this.endDocumentKey()&&(this.endDocument=this.documents.last)}trigger(){if(this.isDisposed!==!0){if(this.intervalHandle!==void 0){this.endDocument=this.documents.last;return}this.endDocument=this.documents.last,this.intervalHandle=(0,ae.RAL)().timer.setInterval(()=>{let e=this.documents.first;if(e!==void 0){let t=Xe.asKey(e);this.diagnosticRequestor.pull(e),this.documents.set(t,e,ae.Touch.Last),t===this.endDocumentKey()&&this.stop()}},200)}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear()}stop(){this.intervalHandle?.dispose(),this.intervalHandle=void 0,this.endDocument=void 0}endDocumentKey(){return this.endDocument!==void 0?Xe.asKey(this.endDocument):void 0}},_s=class{constructor(e,t,n){let i=e.clientOptions.diagnosticPullOptions??{onChange:!0,onSave:!1},r=e.protocol2CodeConverter.asDocumentSelector(n.documentSelector),s=[],c=p=>{let y=n.documentSelector;if(i.match!==void 0)return i.match(y,p);for(let C of y)if(ae.TextDocumentFilter.is(C)){if(typeof C=="string"||C.language!==void 0&&C.language!=="*"||C.scheme!==void 0&&C.scheme!=="*"&&C.scheme!==p.scheme)return!1;if(C.pattern!==void 0){let b=new Tu.Minimatch(C.pattern,{noext:!0});if(!b.makeRe()||!b.match(p.fsPath))return!1}}return!0},d=p=>p instanceof N.Uri?c(p):N.languages.match(r,p)>0&&t.isVisible(p),l=p=>p instanceof N.Uri?this.activeTextDocument?.uri.toString()===p.toString():this.activeTextDocument===p;this.diagnosticRequestor=new Ss(e,t,n),this.backgroundScheduler=new bs(this.diagnosticRequestor);let g=p=>{!d(p)||!n.interFileDependencies||l(p)||this.backgroundScheduler.add(p)};this.activeTextDocument=N.window.activeTextEditor?.document,N.window.onDidChangeActiveTextEditor(p=>{let y=this.activeTextDocument;this.activeTextDocument=p?.document,y!==void 0&&g(y),this.activeTextDocument!==void 0&&this.backgroundScheduler.remove(this.activeTextDocument)});let h=e.getFeature(ae.DidOpenTextDocumentNotification.method);s.push(h.onNotificationSent(p=>{let y=p.textDocument;this.diagnosticRequestor.knows(le.document,y)||d(y)&&this.diagnosticRequestor.pull(y,()=>{g(y)})})),s.push(t.onOpen(p=>{for(let y of p){if(this.diagnosticRequestor.knows(le.document,y))continue;let C=y.toString(),b;for(let T of N.workspace.textDocuments)if(C===T.uri.toString()){b=T;break}b!==void 0&&d(b)&&this.diagnosticRequestor.pull(b,()=>{g(b)})}}));let f=new Set;for(let p of N.workspace.textDocuments)d(p)&&(this.diagnosticRequestor.pull(p,()=>{g(p)}),f.add(p.uri.toString()));if(i.onTabs===!0)for(let p of t.getTabResources())!f.has(p.toString())&&d(p)&&this.diagnosticRequestor.pull(p,()=>{g(p)});if(i.onChange===!0){let p=e.getFeature(ae.DidChangeTextDocumentNotification.method);s.push(p.onNotificationSent(async y=>{let C=y.textDocument;(i.filter===void 0||!i.filter(C,fi.onType))&&this.diagnosticRequestor.knows(le.document,C)&&this.diagnosticRequestor.pull(C,()=>{this.backgroundScheduler.trigger()})}))}if(i.onSave===!0){let p=e.getFeature(ae.DidSaveTextDocumentNotification.method);s.push(p.onNotificationSent(y=>{let C=y.textDocument;(i.filter===void 0||!i.filter(C,fi.onSave))&&this.diagnosticRequestor.knows(le.document,C)&&this.diagnosticRequestor.pull(y.textDocument,()=>{this.backgroundScheduler.trigger()})}))}let v=e.getFeature(ae.DidCloseTextDocumentNotification.method);s.push(v.onNotificationSent(p=>{this.cleanUpDocument(p.textDocument)})),t.onClose(p=>{for(let y of p)this.cleanUpDocument(y)}),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(let p of N.workspace.textDocuments)d(p)&&this.diagnosticRequestor.pull(p)}),n.workspaceDiagnostics===!0&&n.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=N.Disposable.from(...s,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}cleanUpDocument(e){this.diagnosticRequestor.knows(le.document,e)&&(this.diagnosticRequestor.forgetDocument(e),this.backgroundScheduler.remove(e))}},Ts=class extends Cs.TextDocumentLanguageFeature{constructor(e){super(e,ae.DocumentDiagnosticRequest.type)}fillClientCapabilities(e){let t=pi(pi(e,"textDocument"),"diagnostic");t.dynamicRegistration=!0,t.relatedDocumentSupport=!1,pi(pi(e,"workspace"),"diagnostics").refreshSupport=!0}initialize(e,t){this._client.onRequest(ae.DiagnosticRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeDiagnosticsEmitter.fire()});let[i,r]=this.getRegistration(t,e.diagnosticProvider);!i||!r||this.register({id:i,registerOptions:r})}clear(){this.tabs!==void 0&&(this.tabs.dispose(),this.tabs=void 0),super.clear()}registerLanguageProvider(e){this.tabs===void 0&&(this.tabs=new ws);let t=new _s(this._client,this.tabs,e);return[t.disposable,t]}};ft.DiagnosticFeature=Ts});var ac=F(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.NotebookDocumentSyncFeature=void 0;var De=I("vscode"),Pu=Dr(),et=L(),Ru=te(),sc=Ie();function oc(a,e){return a[e]===void 0&&(a[e]={}),a[e]}var Kt;(function(a){let e;(function(t){function n(f,v){return{version:f.version,uri:v.asUri(f.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function i(f,v,p){let y=et.NotebookDocument.create(p.asUri(f.uri),f.notebookType,f.version,r(v,p));return Object.keys(f.metadata).length>0&&(y.metadata=s(f.metadata)),y}t.asNotebookDocument=i;function r(f,v){return f.map(p=>c(p,v))}t.asNotebookCells=r;function s(f){return l(new Set,f)}t.asMetadata=s;function c(f,v){let p=et.NotebookCell.create(d(f.kind),v.asUri(f.document.uri));return Object.keys(f.metadata).length>0&&(p.metadata=s(f.metadata)),f.executionSummary!==void 0&&sc.number(f.executionSummary.executionOrder)&&sc.boolean(f.executionSummary.success)&&(p.executionSummary={executionOrder:f.executionSummary.executionOrder,success:f.executionSummary.success}),p}t.asNotebookCell=c;function d(f){switch(f){case De.NotebookCellKind.Markup:return et.NotebookCellKind.Markup;case De.NotebookCellKind.Code:return et.NotebookCellKind.Code}}function l(f,v){if(f.has(v))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(v)){let p=[];for(let y of v)if(y!==null&&typeof y=="object"||Array.isArray(y))p.push(l(f,y));else{if(y instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");p.push(y)}return p}else{let p=Object.keys(v),y=Object.create(null);for(let C of p){let b=v[C];if(b!==null&&typeof b=="object"||Array.isArray(b))y[C]=l(f,b);else{if(b instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");y[C]=b}}return y}}function g(f,v){let p=v.asChangeTextDocumentParams(f,f.document.uri,f.document.version);return{document:p.textDocument,changes:p.contentChanges}}t.asTextContentChange=g;function h(f,v){let p=Object.create(null);if(f.metadata&&(p.metadata=a.c2p.asMetadata(f.metadata)),f.cells!==void 0){let y=Object.create(null),C=f.cells;C.structure&&(y.structure={array:{start:C.structure.array.start,deleteCount:C.structure.array.deleteCount,cells:C.structure.array.cells!==void 0?C.structure.array.cells.map(b=>a.c2p.asNotebookCell(b,v)):void 0},didOpen:C.structure.didOpen!==void 0?C.structure.didOpen.map(b=>v.asOpenTextDocumentParams(b.document).textDocument):void 0,didClose:C.structure.didClose!==void 0?C.structure.didClose.map(b=>v.asCloseTextDocumentParams(b.document).textDocument):void 0}),C.data!==void 0&&(y.data=C.data.map(b=>a.c2p.asNotebookCell(b,v))),C.textContent!==void 0&&(y.textContent=C.textContent.map(b=>a.c2p.asTextContentChange(b,v))),Object.keys(y).length>0&&(p.cells=y)}return p}t.asNotebookDocumentChangeEvent=h})(e=a.c2p||(a.c2p={}))})(Kt||(Kt={}));var Ps;(function(a){function e(c,d,l){let g=c.length,h=d.length,f=0;for(;f<h&&f<g&&t(c[f],d[f],l);)f++;if(f<h&&f<g){let v=g-1,p=h-1;for(;v>=0&&p>=0&&t(c[v],d[p],l);)v--,p--;let y=v+1-f,C=f===p+1?void 0:d.slice(f,p+1);return C!==void 0?{start:f,deleteCount:y,cells:C}:{start:f,deleteCount:y}}else return f<h?{start:f,deleteCount:0,cells:d.slice(f)}:f<g?{start:f,deleteCount:g-f}:void 0}a.computeDiff=e;function t(c,d,l=!0){return c.kind!==d.kind||c.document.uri.toString()!==d.document.uri.toString()||c.document.languageId!==d.document.languageId||!n(c.executionSummary,d.executionSummary)?!1:!l||l&&r(c.metadata,d.metadata)}function n(c,d){return c===d?!0:c===void 0||d===void 0?!1:c.executionOrder===d.executionOrder&&c.success===d.success&&i(c.timing,d.timing)}function i(c,d){return c===d?!0:c===void 0||d===void 0?!1:c.startTime===d.startTime&&c.endTime===d.endTime}function r(c,d){if(c===d)return!0;if(c==null||d===null||d===void 0||typeof c!=typeof d||typeof c!="object")return!1;let l=Array.isArray(c),g=Array.isArray(d);if(l!==g)return!1;if(l&&g){if(c.length!==d.length)return!1;for(let h=0;h<c.length;h++)if(!r(c[h],d[h]))return!1}if(s(c)&&s(d)){let h=Object.keys(c),f=Object.keys(d);if(h.length!==f.length||(h.sort(),f.sort(),!r(h,f)))return!1;for(let v=0;v<h.length;v++){let p=h[v];if(!r(c[p],d[p]))return!1}return!0}return!1}function s(c){return c!==null&&typeof c=="object"}a.isObjectLiteral=s})(Ps||(Ps={}));var Rs;(function(a){function e(t,n){if(typeof t=="string")return t==="*"||n.notebookType===t;if(t.notebookType!==void 0&&t.notebookType!=="*"&&n.notebookType!==t.notebookType)return!1;let i=n.uri;if(t.scheme!==void 0&&t.scheme!=="*"&&i.scheme!==t.scheme)return!1;if(t.pattern!==void 0){let r=new Pu.Minimatch(t.pattern,{noext:!0});if(!r.makeRe()||!r.match(i.fsPath))return!1}return!0}a.matchNotebook=e})(Rs||(Rs={}));var hi;(function(a){function e(n){let i=n.notebookSelector,r=[];for(let s of i){let c=(typeof s.notebook=="string"?s.notebook:s.notebook?.notebookType)??"*",d=typeof s.notebook=="string"?void 0:s.notebook?.scheme,l=typeof s.notebook=="string"?void 0:s.notebook?.pattern;if(s.cells!==void 0)for(let g of s.cells)r.push(t(c,d,l,g.language));else r.push(t(c,d,l,void 0))}return r}a.asDocumentSelector=e;function t(n,i,r,s){return i===void 0&&r===void 0?{notebook:n,language:s}:{notebook:{notebookType:n,scheme:i,pattern:r},language:s}}})(hi||(hi={}));var gi;(function(a){function e(t){return{cells:t,uris:new Set(t.map(n=>n.document.uri.toString()))}}a.create=e})(gi||(gi={}));var jt=class{constructor(e,t){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(hi.asDocumentSelector(t)),De.workspace.onDidOpenNotebookDocument(n=>{this.notebookDidOpen.add(n.uri.toString()),this.didOpen(n)},void 0,this.disposables);for(let n of De.workspace.notebookDocuments)this.notebookDidOpen.add(n.uri.toString()),this.didOpen(n);De.workspace.onDidChangeNotebookDocument(n=>this.didChangeNotebookDocument(n),void 0,this.disposables),this.options.save===!0&&De.workspace.onDidSaveNotebookDocument(n=>this.didSave(n),void 0,this.disposables),De.workspace.onDidCloseNotebookDocument(n=>{this.didClose(n),this.notebookDidOpen.delete(n.uri.toString())},void 0,this.disposables)}getState(){for(let e of De.workspace.notebookDocuments)if(this.getMatchingCells(e)!==void 0)return{kind:"document",id:"$internal",registrations:!0,matches:!0};return{kind:"document",id:"$internal",registrations:!0,matches:!1}}get mode(){return"notebook"}handles(e){return De.languages.match(this.selector,e)>0}didOpenNotebookCellTextDocument(e,t){if(De.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let n=this.notebookSyncInfo.get(e.uri.toString()),i=this.cellMatches(e,t);if(n!==void 0){let r=n.uris.has(t.document.uri.toString());if(i&&r||!i&&!r)return;if(i){let s=this.getMatchingCells(e);if(s!==void 0){let c=this.asNotebookDocumentChangeEvent(e,void 0,n,s);c!==void 0&&this.doSendChange(c,s).catch(()=>{})}}}else i&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t){De.languages.match(this.selector,t.document)!==0&&this.doSendChange({notebook:e,cells:{textContent:[t]}},void 0).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let n=this.notebookSyncInfo.get(e.uri.toString());if(n===void 0)return;let i=t.document.uri,r=n.cells.findIndex(s=>s.document.uri.toString()===i.toString());if(r!==-1)if(r===0&&n.cells.length===1)this.doSendClose(e,n.cells).catch(()=>{});else{let s=n.cells.slice(),c=s.splice(r,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:r,deleteCount:1},didClose:c}}},s).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t=this.getMatchingCells(e),n=this.notebookSyncInfo.get(e.uri.toString())){if(n!==void 0)if(t!==void 0){let i=this.asNotebookDocumentChangeEvent(e,void 0,n,t);i!==void 0&&this.doSendChange(i,t).catch(()=>{})}else this.doSendClose(e,[]).catch(()=>{});else{if(t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,n=this.notebookSyncInfo.get(t.uri.toString());if(n===void 0){if(e.contentChanges.length===0)return;let i=this.getMatchingCells(t);if(i===void 0)return;this.didOpen(t,i,n)}else{let i=this.getMatchingCells(t);if(i===void 0){this.didClose(t,n);return}let r=this.asNotebookDocumentChangeEvent(e.notebook,e,n,i);r!==void 0&&this.doSendChange(r,i).catch(()=>{})}}didSave(e){this.notebookSyncInfo.get(e.uri.toString())!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.notebookSyncInfo.get(e.uri.toString())){if(t===void 0)return;let n=e.getCells().filter(i=>t.uris.has(i.document.uri.toString()));this.doSendClose(e,n).catch(()=>{})}async sendDidOpenNotebookDocument(e){let t=this.getMatchingCells(e);if(t!==void 0)return this.doSendOpen(e,t)}async doSendOpen(e,t){let n=async(r,s)=>{let c=Kt.c2p.asNotebookDocument(r,s,this.client.code2ProtocolConverter),d=s.map(l=>this.client.code2ProtocolConverter.asTextDocumentItem(l.document));try{await this.client.sendNotification(et.DidOpenNotebookDocumentNotification.type,{notebookDocument:c,cellTextDocuments:d})}catch(l){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",l),l}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),gi.create(t)),i?.didOpen!==void 0?i.didOpen(e,t,n):n(e,t)}async sendDidChangeNotebookDocument(e){return this.doSendChange(e,void 0)}async doSendChange(e,t=this.getMatchingCells(e.notebook)){let n=async r=>{try{await this.client.sendNotification(et.DidChangeNotebookDocumentNotification.type,{notebookDocument:Kt.c2p.asVersionedNotebookDocumentIdentifier(r.notebook,this.client.code2ProtocolConverter),change:Kt.c2p.asNotebookDocumentChangeEvent(r,this.client.code2ProtocolConverter)})}catch(s){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",s),s}},i=this.client.middleware?.notebooks;return e.cells?.structure!==void 0&&this.notebookSyncInfo.set(e.notebook.uri.toString(),gi.create(t??[])),i?.didChange!==void 0?i?.didChange(e,n):n(e)}async sendDidSaveNotebookDocument(e){return this.doSendSave(e)}async doSendSave(e){let t=async i=>{try{await this.client.sendNotification(et.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}})}catch(r){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",r),r}},n=this.client.middleware?.notebooks;return n?.didSave!==void 0?n.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){return this.doSendClose(e,this.getMatchingCells(e)??[])}async doSendClose(e,t){let n=async(r,s)=>{try{await this.client.sendNotification(et.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(r.uri)},cellTextDocuments:s.map(c=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(c.document))})}catch(c){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",c),c}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),i?.didClose!==void 0?i.didClose(e,t,n):n(e,t)}asNotebookDocumentChangeEvent(e,t,n,i){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let r={notebook:e};t?.metadata!==void 0&&(r.metadata=Kt.c2p.asMetadata(t.metadata));let s;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let c=[];s=new Set(i.map(d=>d.document.uri.toString()));for(let d of t.cellChanges)s.has(d.cell.document.uri.toString())&&(d.executionSummary!==void 0||d.metadata!==void 0)&&c.push(d.cell);c.length>0&&(r.cells=r.cells??{},r.cells.data=c)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&n!==void 0&&i!==void 0){let c=n.cells,d=i,l=Ps.computeDiff(c,d,!1),g,h;if(l!==void 0){g=l.cells===void 0?new Map:new Map(l.cells.map(p=>[p.document.uri.toString(),p])),h=l.deleteCount===0?new Map:new Map(c.slice(l.start,l.start+l.deleteCount).map(p=>[p.document.uri.toString(),p]));for(let p of Array.from(h.keys()))g.has(p)&&(h.delete(p),g.delete(p));r.cells=r.cells??{};let f=[],v=[];if(g.size>0||h.size>0){for(let p of g.values())f.push(p);for(let p of h.values())v.push(p)}r.cells.structure={array:l,didOpen:f,didClose:v}}}return Object.keys(r).length>1?r:void 0}getMatchingCells(e,t=e.getCells()){if(this.options.notebookSelector!==void 0){for(let n of this.options.notebookSelector)if(n.notebook===void 0||Rs.matchNotebook(n.notebook,e)){let i=this.filterCells(e,t,n.cells);return i.length===0?void 0:i}}}cellMatches(e,t){let n=this.getMatchingCells(e,[t]);return n!==void 0&&n[0]===t}filterCells(e,t,n){let i=n!==void 0?t.filter(r=>{let s=r.document.languageId;return n.some((c=>c.language==="*"||s===c.language))}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,i):i}},mi=class a{constructor(e){this.client=e,this.registrations=new Map,this.registrationType=et.NotebookDocumentSyncRegistrationType.type,De.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==a.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let r of this.registrations.values())r instanceof jt&&r.didOpenNotebookCellTextDocument(n,i)}),De.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let n=t.document;if(n.uri.scheme!==a.CellScheme)return;let[i]=this.findNotebookDocumentAndCell(n);if(i!==void 0)for(let r of this.registrations.values())r instanceof jt&&r.didChangeNotebookCellTextDocument(i,t)}),De.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==a.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let r of this.registrations.values())r instanceof jt&&r.didCloseNotebookCellTextDocument(n,i)})}getState(){if(this.registrations.size===0)return{kind:"document",id:this.registrationType.method,registrations:!1,matches:!1};for(let e of this.registrations.values()){let t=e.getState();if(t.kind==="document"&&t.registrations===!0&&t.matches===!0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!1}}fillClientCapabilities(e){let t=oc(oc(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(hi.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let n=t.id??Ru.generateUuid();this.register({id:n,registerOptions:t})}register(e){let t=new jt(this.client,e.registerOptions);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t&&t.dispose()}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear()}handles(e){if(e.uri.scheme!==a.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&De.languages.match(this.dedicatedChannel,e)>0)return!0;for(let t of this.registrations.values())if(t.handles(e))return!0;return!1}getProvider(e){for(let t of this.registrations.values())if(t.handles(e.document))return t}findNotebookDocumentAndCell(e){let t=e.uri.toString();for(let n of De.workspace.notebookDocuments)for(let i of n.getCells())if(i.document.uri.toString()===t)return[n,i];return[void 0,void 0]}};vi.NotebookDocumentSyncFeature=mi;mi.CellScheme="vscode-notebook-cell"});var dc=F(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.SyncConfigurationFeature=ht.toJSONObject=ht.ConfigurationFeature=void 0;var Wt=I("vscode"),fn=L(),xu=Ie(),Fu=te(),cc=W(),xs=class{constructor(e){this._client=e}getState(){return{kind:"static"}}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.configuration=!0}initialize(){let e=this._client;e.onRequest(fn.ConfigurationRequest.type,(t,n)=>{let i=s=>{let c=[];for(let d of s.items){let l=d.scopeUri!==void 0&&d.scopeUri!==null?this._client.protocol2CodeConverter.asUri(d.scopeUri):void 0;c.push(this.getConfiguration(l,d.section!==null?d.section:void 0))}return c},r=e.middleware.workspace;return r&&r.configuration?r.configuration(t,n,i):i(t,n)})}getConfiguration(e,t){let n=null;if(t){let i=t.lastIndexOf(".");if(i===-1)n=_t(Wt.workspace.getConfiguration(void 0,e).get(t));else{let r=Wt.workspace.getConfiguration(t.substr(0,i),e);r&&(n=_t(r.get(t.substr(i+1))))}}else{let i=Wt.workspace.getConfiguration(void 0,e);n={};for(let r of Object.keys(i))i.has(r)&&(n[r]=_t(i.get(r)))}return n===void 0&&(n=null),n}clear(){}};ht.ConfigurationFeature=xs;function _t(a){if(a){if(Array.isArray(a))return a.map(_t);if(typeof a=="object"){let e=Object.create(null);for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=_t(a[t]));return e}}return a}ht.toJSONObject=_t;var Fs=class{constructor(e){this._client=e,this.isCleared=!1,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return fn.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,cc.ensure)((0,cc.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:Fu.generateUuid(),registerOptions:{section:e}})}register(e){let t=Wt.workspace.onDidChangeConfiguration(n=>{this.onDidChangeConfiguration(e.registerOptions.section,n)});this._listeners.set(e.id,t),e.registerOptions.section!==void 0&&this.onDidChangeConfiguration(e.registerOptions.section,void 0)}unregister(e){let t=this._listeners.get(e);t&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear(),this.isCleared=!0}onDidChangeConfiguration(e,t){if(this.isCleared)return;let n;if(xu.string(e)?n=[e]:n=e,n!==void 0&&t!==void 0&&!n.some(c=>t.affectsConfiguration(c)))return;let i=async s=>s===void 0?this._client.sendNotification(fn.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(fn.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(s)}),r=this._client.middleware.workspace?.didChangeConfiguration;(r?r(n,i):i(n)).catch(s=>{this._client.error(`Sending notification ${fn.DidChangeConfigurationNotification.type.method} failed`,s)})}extractSettingsInformation(e){function t(r,s){let c=r;for(let d=0;d<s.length-1;d++){let l=c[s[d]];l||(l=Object.create(null),c[s[d]]=l),c=l}return c}let n=this._client.clientOptions.workspaceFolder?this._client.clientOptions.workspaceFolder.uri:void 0,i=Object.create(null);for(let r=0;r<e.length;r++){let s=e[r],c=s.indexOf("."),d=null;if(c>=0?d=Wt.workspace.getConfiguration(s.substr(0,c),n).get(s.substr(c+1)):d=Wt.workspace.getConfiguration(void 0,n).get(s),d){let l=e[r].split(".");t(i,l)[l[l.length-1]]=_t(d)}}return i}};ht.SyncConfigurationFeature=Fs});var uc=F(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.DidSaveTextDocumentFeature=be.WillSaveWaitUntilFeature=be.WillSaveFeature=be.DidChangeTextDocumentFeature=be.DidCloseTextDocumentFeature=be.DidOpenTextDocumentFeature=void 0;var Re=I("vscode"),Z=L(),ie=W(),$t=te(),qs=class extends ie.TextDocumentEventFeature{constructor(e,t){super(e,Re.workspace.onDidOpenTextDocument,Z.DidOpenTextDocumentNotification.type,()=>e.middleware.didOpen,n=>e.code2ProtocolConverter.asOpenTextDocumentParams(n),n=>n,ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:$t.generateUuid(),registerOptions:{documentSelector:t}})}get registrationType(){return Z.DidOpenTextDocumentNotification.type}register(e){if(super.register(e),!e.registerOptions.documentSelector)return;let t=this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector);Re.workspace.textDocuments.forEach(n=>{let i=n.uri.toString();if(!this._syncedDocuments.has(i)&&Re.languages.match(t,n)>0&&!this._client.hasDedicatedTextSynchronizationFeature(n)){let r=this._client.middleware,s=c=>this._client.sendNotification(this._type,this._createParams(c));(r.didOpen?r.didOpen(n,s):s(n)).catch(c=>{this._client.error(`Sending document notification ${this._type.method} failed`,c)}),this._syncedDocuments.set(i,n)}})}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.set(e.uri.toString(),e),super.notificationSent(e,t,n)}};be.DidOpenTextDocumentFeature=qs;var Is=class extends ie.TextDocumentEventFeature{constructor(e,t,n){super(e,Re.workspace.onDidCloseTextDocument,Z.DidCloseTextDocumentNotification.type,()=>e.middleware.didClose,i=>e.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingTextDocumentChanges=n}get registrationType(){return Z.DidCloseTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:$t.generateUuid(),registerOptions:{documentSelector:t}})}async callback(e){await super.callback(e),this._pendingTextDocumentChanges.delete(e.uri.toString())}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.delete(e.uri.toString()),super.notificationSent(e,t,n)}unregister(e){let t=this._selectors.get(e);super.unregister(e);let n=this._selectors.values();this._syncedDocuments.forEach(i=>{if(Re.languages.match(t,i)>0&&!this._selectorFilter(n,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let r=this._client.middleware,s=c=>this._client.sendNotification(this._type,this._createParams(c));this._syncedDocuments.delete(i.uri.toString()),(r.didClose?r.didClose(i,s):s(i)).catch(c=>{this._client.error(`Sending document notification ${this._type.method} failed`,c)})}})}};be.DidCloseTextDocumentFeature=Is;var Es=class extends ie.DynamicDocumentFeature{constructor(e,t){super(e),this._changeData=new Map,this._onNotificationSent=new Re.EventEmitter,this._onPendingChangeAdded=new Re.EventEmitter,this._pendingTextDocumentChanges=t,this._syncKind=Z.TextDocumentSyncKind.None}get onNotificationSent(){return this._onNotificationSent.event}get onPendingChangeAdded(){return this._onPendingChangeAdded.event}get syncKind(){return this._syncKind}get registrationType(){return Z.DidChangeTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.change!==void 0&&n.change!==Z.TextDocumentSyncKind.None&&this.register({id:$t.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},{syncKind:n.change})})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Re.workspace.onDidChangeTextDocument(this.callback,this)),this._changeData.set(e.id,{syncKind:e.registerOptions.syncKind,documentSelector:this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)}),this.updateSyncKind(e.registerOptions.syncKind))}*getDocumentSelectors(){for(let e of this._changeData.values())yield e.documentSelector}async callback(e){if(e.contentChanges.length===0)return;let t=e.document.uri,n=e.document.version,i=[];for(let r of this._changeData.values())if(Re.languages.match(r.documentSelector,e.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let s=this._client.middleware;if(r.syncKind===Z.TextDocumentSyncKind.Incremental){let c=async d=>{let l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(d,t,n);await this._client.sendNotification(Z.DidChangeTextDocumentNotification.type,l),this.notificationSent(d.document,Z.DidChangeTextDocumentNotification.type,l)};i.push(s.didChange?s.didChange(e,d=>c(d)):c(e))}else if(r.syncKind===Z.TextDocumentSyncKind.Full){let c=async d=>{let l=d.document.uri.toString();this._pendingTextDocumentChanges.set(l,d.document),this._onPendingChangeAdded.fire()};i.push(s.didChange?s.didChange(e,d=>c(d)):c(e))}}return Promise.all(i).then(void 0,r=>{throw this._client.error(`Sending document notification ${Z.DidChangeTextDocumentNotification.type.method} failed`,r),r})}notificationSent(e,t,n){this._onNotificationSent.fire({textDocument:e,type:t,params:n})}unregister(e){if(this._changeData.delete(e),this._changeData.size===0)this._listener&&(this._listener.dispose(),this._listener=void 0),this._syncKind=Z.TextDocumentSyncKind.None;else{this._syncKind=Z.TextDocumentSyncKind.None;for(let t of this._changeData.values())if(this.updateSyncKind(t.syncKind),this._syncKind===Z.TextDocumentSyncKind.Full)break}}clear(){this._pendingTextDocumentChanges.clear(),this._changeData.clear(),this._syncKind=Z.TextDocumentSyncKind.None,this._listener&&(this._listener.dispose(),this._listener=void 0)}getPendingDocumentChanges(e){if(this._pendingTextDocumentChanges.size===0)return[];let t;if(e.size===0)t=Array.from(this._pendingTextDocumentChanges.values()),this._pendingTextDocumentChanges.clear();else{t=[];for(let n of this._pendingTextDocumentChanges)e.has(n[0])||(t.push(n[1]),this._pendingTextDocumentChanges.delete(n[0]))}return t}getProvider(e){for(let t of this._changeData.values())if(Re.languages.match(t.documentSelector,e)>0)return{send:n=>this.callback(n)}}updateSyncKind(e){if(this._syncKind!==Z.TextDocumentSyncKind.Full)switch(e){case Z.TextDocumentSyncKind.Full:this._syncKind=e;break;case Z.TextDocumentSyncKind.Incremental:this._syncKind===Z.TextDocumentSyncKind.None&&(this._syncKind=Z.TextDocumentSyncKind.Incremental);break}}};be.DidChangeTextDocumentFeature=Es;var Ms=class extends ie.TextDocumentEventFeature{constructor(e){super(e,Re.workspace.onWillSaveTextDocument,Z.WillSaveTextDocumentNotification.type,()=>e.middleware.willSave,t=>e.code2ProtocolConverter.asWillSaveTextDocumentParams(t),t=>t.document,(t,n)=>ie.TextDocumentEventFeature.textDocumentFilter(t,n.document))}get registrationType(){return Z.WillSaveTextDocumentNotification.type}fillClientCapabilities(e){let t=(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization");t.willSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSave&&this.register({id:$t.generateUuid(),registerOptions:{documentSelector:t}})}getTextDocument(e){return e.document}};be.WillSaveFeature=Ms;var As=class extends ie.DynamicDocumentFeature{constructor(e){super(e),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return Z.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(e){let t=(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization");t.willSaveWaitUntil=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSaveWaitUntil&&this.register({id:$t.generateUuid(),registerOptions:{documentSelector:t}})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Re.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}callback(e){if(ie.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),e.document)&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let t=this._client.middleware,n=i=>this._client.sendRequest(Z.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async r=>{let s=await this._client.protocol2CodeConverter.asTextEdits(r);return s===void 0?[]:s});e.waitUntil(t.willSaveWaitUntil?t.willSaveWaitUntil(e,n):n(e))}}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}};be.WillSaveWaitUntilFeature=As;var Os=class extends ie.TextDocumentEventFeature{constructor(e){super(e,Re.workspace.onDidSaveTextDocument,Z.DidSaveTextDocumentNotification.type,()=>e.middleware.didSave,t=>e.code2ProtocolConverter.asSaveTextDocumentParams(t,this._includeText),t=>t,ie.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return Z.DidSaveTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").didSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;if(t&&n&&n.save){let i=typeof n.save=="boolean"?{includeText:!1}:{includeText:!!n.save.includeText};this.register({id:$t.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},i)})}}register(e){this._includeText=!!e.registerOptions.includeText,super.register(e)}getTextDocument(e){return e}};be.DidSaveTextDocumentFeature=Os});var lc=F(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.CompletionItemFeature=void 0;var qu=I("vscode"),K=L(),Ls=W(),Iu=te(),Eu=[K.CompletionItemKind.Text,K.CompletionItemKind.Method,K.CompletionItemKind.Function,K.CompletionItemKind.Constructor,K.CompletionItemKind.Field,K.CompletionItemKind.Variable,K.CompletionItemKind.Class,K.CompletionItemKind.Interface,K.CompletionItemKind.Module,K.CompletionItemKind.Property,K.CompletionItemKind.Unit,K.CompletionItemKind.Value,K.CompletionItemKind.Enum,K.CompletionItemKind.Keyword,K.CompletionItemKind.Snippet,K.CompletionItemKind.Color,K.CompletionItemKind.File,K.CompletionItemKind.Reference,K.CompletionItemKind.Folder,K.CompletionItemKind.EnumMember,K.CompletionItemKind.Constant,K.CompletionItemKind.Struct,K.CompletionItemKind.Event,K.CompletionItemKind.Operator,K.CompletionItemKind.TypeParameter],Us=class extends Ls.TextDocumentLanguageFeature{constructor(e){super(e,K.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(e){let t=(0,Ls.ensure)((0,Ls.ensure)(e,"textDocument"),"completion");t.dynamicRegistration=!0,t.contextSupport=!0,t.completionItem={snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[K.MarkupKind.Markdown,K.MarkupKind.PlainText],deprecatedSupport:!0,preselectSupport:!0,tagSupport:{valueSet:[K.CompletionItemTag.Deprecated]},insertReplaceSupport:!0,resolveSupport:{properties:["documentation","detail","additionalTextEdits"]},insertTextModeSupport:{valueSet:[K.InsertTextMode.asIs,K.InsertTextMode.adjustIndentation]},labelDetailsSupport:!0},t.insertTextMode=K.InsertTextMode.adjustIndentation,t.completionItemKind={valueSet:Eu},t.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode","data"]}}initialize(e,t){let n=this.getRegistrationOptions(t,e.completionProvider);n&&this.register({id:Iu.generateUuid(),registerOptions:n})}registerLanguageProvider(e,t){this.labelDetailsSupport.set(t,!!e.completionItem?.labelDetailsSupport);let n=e.triggerCharacters??[],i=e.allCommitCharacters,r=e.documentSelector,s={provideCompletionItems:(c,d,l,g)=>{let h=this._client,f=this._client.middleware,v=(p,y,C,b)=>h.sendRequest(K.CompletionRequest.type,h.code2ProtocolConverter.asCompletionParams(p,y,C),b).then(T=>b.isCancellationRequested?null:h.protocol2CodeConverter.asCompletionResult(T,i,b),T=>h.handleFailedRequest(K.CompletionRequest.type,b,T,null));return f.provideCompletionItem?f.provideCompletionItem(c,d,g,l,v):v(c,d,g,l)},resolveCompletionItem:e.resolveProvider?(c,d)=>{let l=this._client,g=this._client.middleware,h=(f,v)=>l.sendRequest(K.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(f,!!this.labelDetailsSupport.get(t)),v).then(p=>v.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(p),p=>l.handleFailedRequest(K.CompletionResolveRequest.type,v,p,f));return g.resolveCompletionItem?g.resolveCompletionItem(c,d,h):h(c,d)}:void 0};return[qu.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(r),s,...n),s]}};yi.CompletionItemFeature=Us});var pc=F(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.HoverFeature=void 0;var Mu=I("vscode"),hn=L(),Hs=W(),Au=te(),Ns=class extends Hs.TextDocumentLanguageFeature{constructor(e){super(e,hn.HoverRequest.type)}fillClientCapabilities(e){let t=(0,Hs.ensure)((0,Hs.ensure)(e,"textDocument"),"hover");t.dynamicRegistration=!0,t.contentFormat=[hn.MarkupKind.Markdown,hn.MarkupKind.PlainText]}initialize(e,t){let n=this.getRegistrationOptions(t,e.hoverProvider);n&&this.register({id:Au.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideHover:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(hn.HoverRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asHover(v),v=>c.handleFailedRequest(hn.HoverRequest.type,f,v,null)),l=c.middleware;return l.provideHover?l.provideHover(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Mu.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ci.HoverFeature=Ns});var fc=F(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.DefinitionFeature=void 0;var Ou=I("vscode"),Ks=L(),js=W(),Lu=te(),Ws=class extends js.TextDocumentLanguageFeature{constructor(e){super(e,Ks.DefinitionRequest.type)}fillClientCapabilities(e){let t=(0,js.ensure)((0,js.ensure)(e,"textDocument"),"definition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.definitionProvider);n&&this.register({id:Lu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDefinition:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(Ks.DefinitionRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,f),v=>c.handleFailedRequest(Ks.DefinitionRequest.type,f,v,null)),l=c.middleware;return l.provideDefinition?l.provideDefinition(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Ou.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};wi.DefinitionFeature=Ws});var gc=F(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.SignatureHelpFeature=void 0;var hc=I("vscode"),gn=L(),$s=W(),Uu=te(),zs=class extends $s.TextDocumentLanguageFeature{constructor(e){super(e,gn.SignatureHelpRequest.type)}fillClientCapabilities(e){let t=(0,$s.ensure)((0,$s.ensure)(e,"textDocument"),"signatureHelp");t.dynamicRegistration=!0,t.signatureInformation={documentationFormat:[gn.MarkupKind.Markdown,gn.MarkupKind.PlainText]},t.signatureInformation.parameterInformation={labelOffsetSupport:!0},t.signatureInformation.activeParameterSupport=!0,t.contextSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.signatureHelpProvider);n&&this.register({id:Uu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t={provideSignatureHelp:(n,i,r,s)=>{let c=this._client,d=(g,h,f,v)=>c.sendRequest(gn.SignatureHelpRequest.type,c.code2ProtocolConverter.asSignatureHelpParams(g,h,f),v).then(p=>v.isCancellationRequested?null:c.protocol2CodeConverter.asSignatureHelp(p,v),p=>c.handleFailedRequest(gn.SignatureHelpRequest.type,v,p,null)),l=c.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(n,i,s,r,d):d(n,i,s,r)}};return[this.registerProvider(e,t),t]}registerProvider(e,t){let n=this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector);if(e.retriggerCharacters===void 0){let i=e.triggerCharacters||[];return hc.languages.registerSignatureHelpProvider(n,t,...i)}else{let i={triggerCharacters:e.triggerCharacters||[],retriggerCharacters:e.retriggerCharacters||[]};return hc.languages.registerSignatureHelpProvider(n,t,i)}}};Di.SignatureHelpFeature=zs});var mc=F(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.DocumentHighlightFeature=void 0;var Hu=I("vscode"),Vs=L(),Bs=W(),Nu=te(),Ys=class extends Bs.TextDocumentLanguageFeature{constructor(e){super(e,Vs.DocumentHighlightRequest.type)}fillClientCapabilities(e){(0,Bs.ensure)((0,Bs.ensure)(e,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentHighlightProvider);n&&this.register({id:Nu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentHighlights:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(Vs.DocumentHighlightRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDocumentHighlights(v,f),v=>c.handleFailedRequest(Vs.DocumentHighlightRequest.type,f,v,null)),l=c.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,r,s,d):d(i,r,s)}};return[Hu.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Si.DocumentHighlightFeature=Ys});var Gs=F(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.DocumentSymbolFeature=Ye.SupportedSymbolTags=Ye.SupportedSymbolKinds=void 0;var Ku=I("vscode"),z=L(),Js=W(),ju=te();Ye.SupportedSymbolKinds=[z.SymbolKind.File,z.SymbolKind.Module,z.SymbolKind.Namespace,z.SymbolKind.Package,z.SymbolKind.Class,z.SymbolKind.Method,z.SymbolKind.Property,z.SymbolKind.Field,z.SymbolKind.Constructor,z.SymbolKind.Enum,z.SymbolKind.Interface,z.SymbolKind.Function,z.SymbolKind.Variable,z.SymbolKind.Constant,z.SymbolKind.String,z.SymbolKind.Number,z.SymbolKind.Boolean,z.SymbolKind.Array,z.SymbolKind.Object,z.SymbolKind.Key,z.SymbolKind.Null,z.SymbolKind.EnumMember,z.SymbolKind.Struct,z.SymbolKind.Event,z.SymbolKind.Operator,z.SymbolKind.TypeParameter];Ye.SupportedSymbolTags=[z.SymbolTag.Deprecated];var Qs=class extends Js.TextDocumentLanguageFeature{constructor(e){super(e,z.DocumentSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Js.ensure)((0,Js.ensure)(e,"textDocument"),"documentSymbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Ye.SupportedSymbolKinds},t.hierarchicalDocumentSymbolSupport=!0,t.tagSupport={valueSet:Ye.SupportedSymbolTags},t.labelSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentSymbolProvider);n&&this.register({id:ju.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentSymbols:(r,s)=>{let c=this._client,d=async(g,h)=>{try{let f=await c.sendRequest(z.DocumentSymbolRequest.type,c.code2ProtocolConverter.asDocumentSymbolParams(g),h);if(h.isCancellationRequested||f===void 0||f===null)return null;if(f.length===0)return[];{let v=f[0];return z.DocumentSymbol.is(v)?await c.protocol2CodeConverter.asDocumentSymbols(f,h):await c.protocol2CodeConverter.asSymbolInformations(f,h)}}catch(f){return c.handleFailedRequest(z.DocumentSymbolRequest.type,h,f,null)}},l=c.middleware;return l.provideDocumentSymbols?l.provideDocumentSymbols(r,s,d):d(r,s)}},i=e.label!==void 0?{label:e.label}:void 0;return[Ku.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,i),n]}};Ye.DocumentSymbolFeature=Qs});var yc=F(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.WorkspaceSymbolFeature=void 0;var Wu=I("vscode"),mn=L(),Zs=W(),vc=Gs(),$u=te(),Xs=class extends Zs.WorkspaceFeature{constructor(e){super(e,mn.WorkspaceSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Zs.ensure)((0,Zs.ensure)(e,"workspace"),"symbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:vc.SupportedSymbolKinds},t.tagSupport={valueSet:vc.SupportedSymbolTags},t.resolveSupport={properties:["location.range"]}}initialize(e){e.workspaceSymbolProvider&&this.register({id:$u.generateUuid(),registerOptions:e.workspaceSymbolProvider===!0?{workDoneProgress:!1}:e.workspaceSymbolProvider})}registerLanguageProvider(e){let t={provideWorkspaceSymbols:(n,i)=>{let r=this._client,s=(d,l)=>r.sendRequest(mn.WorkspaceSymbolRequest.type,{query:d},l).then(g=>l.isCancellationRequested?null:r.protocol2CodeConverter.asSymbolInformations(g,l),g=>r.handleFailedRequest(mn.WorkspaceSymbolRequest.type,l,g,null)),c=r.middleware;return c.provideWorkspaceSymbols?c.provideWorkspaceSymbols(n,i,s):s(n,i)},resolveWorkspaceSymbol:e.resolveProvider===!0?(n,i)=>{let r=this._client,s=(d,l)=>r.sendRequest(mn.WorkspaceSymbolResolveRequest.type,r.code2ProtocolConverter.asWorkspaceSymbol(d),l).then(g=>l.isCancellationRequested?null:r.protocol2CodeConverter.asSymbolInformation(g),g=>r.handleFailedRequest(mn.WorkspaceSymbolResolveRequest.type,l,g,null)),c=r.middleware;return c.resolveWorkspaceSymbol?c.resolveWorkspaceSymbol(n,i,s):s(n,i)}:void 0};return[Wu.languages.registerWorkspaceSymbolProvider(t),t]}};bi.WorkspaceSymbolFeature=Xs});var Cc=F(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.ReferencesFeature=void 0;var zu=I("vscode"),eo=L(),to=W(),Vu=te(),no=class extends to.TextDocumentLanguageFeature{constructor(e){super(e,eo.ReferencesRequest.type)}fillClientCapabilities(e){(0,to.ensure)((0,to.ensure)(e,"textDocument"),"references").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.referencesProvider);n&&this.register({id:Vu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideReferences:(i,r,s,c)=>{let d=this._client,l=(h,f,v,p)=>d.sendRequest(eo.ReferencesRequest.type,d.code2ProtocolConverter.asReferenceParams(h,f,v),p).then(y=>p.isCancellationRequested?null:d.protocol2CodeConverter.asReferences(y,p),y=>d.handleFailedRequest(eo.ReferencesRequest.type,p,y,null)),g=d.middleware;return g.provideReferences?g.provideReferences(i,r,s,c,l):l(i,r,s,c)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return zu.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};_i.ReferencesFeature=no});var wc=F(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.CodeActionFeature=void 0;var Bu=I("vscode"),xe=L(),Yu=te(),io=W(),ro=class extends io.TextDocumentLanguageFeature{constructor(e){super(e,xe.CodeActionRequest.type)}fillClientCapabilities(e){let t=(0,io.ensure)((0,io.ensure)(e,"textDocument"),"codeAction");t.dynamicRegistration=!0,t.isPreferredSupport=!0,t.disabledSupport=!0,t.dataSupport=!0,t.resolveSupport={properties:["edit"]},t.codeActionLiteralSupport={codeActionKind:{valueSet:[xe.CodeActionKind.Empty,xe.CodeActionKind.QuickFix,xe.CodeActionKind.Refactor,xe.CodeActionKind.RefactorExtract,xe.CodeActionKind.RefactorInline,xe.CodeActionKind.RefactorRewrite,xe.CodeActionKind.Source,xe.CodeActionKind.SourceOrganizeImports]}},t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.codeActionProvider);n&&this.register({id:Yu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideCodeActions:(i,r,s,c)=>{let d=this._client,l=async(h,f,v,p)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),range:d.code2ProtocolConverter.asRange(f),context:d.code2ProtocolConverter.asCodeActionContextSync(v)};return d.sendRequest(xe.CodeActionRequest.type,y,p).then(C=>p.isCancellationRequested||C===null||C===void 0?null:d.protocol2CodeConverter.asCodeActionResult(C,p),C=>d.handleFailedRequest(xe.CodeActionRequest.type,p,C,null))},g=d.middleware;return g.provideCodeActions?g.provideCodeActions(i,r,s,c,l):l(i,r,s,c)},resolveCodeAction:e.resolveProvider?(i,r)=>{let s=this._client,c=this._client.middleware,d=async(l,g)=>s.sendRequest(xe.CodeActionResolveRequest.type,s.code2ProtocolConverter.asCodeActionSync(l),g).then(h=>g.isCancellationRequested?l:s.protocol2CodeConverter.asCodeAction(h,g),h=>s.handleFailedRequest(xe.CodeActionResolveRequest.type,g,h,l));return c.resolveCodeAction?c.resolveCodeAction(i,r,d):d(i,r)}:void 0};return[Bu.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.codeActionKinds?{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(e.codeActionKinds)}:void 0),n]}};Ti.CodeActionFeature=ro});var Sc=F(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.CodeLensFeature=void 0;var Dc=I("vscode"),zt=L(),Ju=te(),vn=W(),so=class extends vn.TextDocumentLanguageFeature{constructor(e){super(e,zt.CodeLensRequest.type)}fillClientCapabilities(e){(0,vn.ensure)((0,vn.ensure)(e,"textDocument"),"codeLens").dynamicRegistration=!0,(0,vn.ensure)((0,vn.ensure)(e,"workspace"),"codeLens").refreshSupport=!0}initialize(e,t){this._client.onRequest(zt.CodeLensRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeCodeLensEmitter.fire()});let i=this.getRegistrationOptions(t,e.codeLensProvider);i&&this.register({id:Ju.generateUuid(),registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Dc.EventEmitter,i={onDidChangeCodeLenses:n.event,provideCodeLenses:(r,s)=>{let c=this._client,d=(g,h)=>c.sendRequest(zt.CodeLensRequest.type,c.code2ProtocolConverter.asCodeLensParams(g),h).then(f=>h.isCancellationRequested?null:c.protocol2CodeConverter.asCodeLenses(f,h),f=>c.handleFailedRequest(zt.CodeLensRequest.type,h,f,null)),l=c.middleware;return l.provideCodeLenses?l.provideCodeLenses(r,s,d):d(r,s)},resolveCodeLens:e.resolveProvider?(r,s)=>{let c=this._client,d=(g,h)=>c.sendRequest(zt.CodeLensResolveRequest.type,c.code2ProtocolConverter.asCodeLens(g),h).then(f=>h.isCancellationRequested?g:c.protocol2CodeConverter.asCodeLens(f),f=>c.handleFailedRequest(zt.CodeLensResolveRequest.type,h,f,g)),l=c.middleware;return l.resolveCodeLens?l.resolveCodeLens(r,s,d):d(r,s)}:void 0};return[Dc.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeCodeLensEmitter:n}]}};ki.CodeLensFeature=so});var bc=F(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.DocumentOnTypeFormattingFeature=gt.DocumentRangeFormattingFeature=gt.DocumentFormattingFeature=void 0;var Pi=I("vscode"),Ne=L(),uo=te(),tt=W(),Vt;(function(a){function e(t){let n=Pi.workspace.getConfiguration("files",t);return{trimTrailingWhitespace:n.get("trimTrailingWhitespace"),trimFinalNewlines:n.get("trimFinalNewlines"),insertFinalNewline:n.get("insertFinalNewline")}}a.fromConfiguration=e})(Vt||(Vt={}));var oo=class extends tt.TextDocumentLanguageFeature{constructor(e){super(e,Ne.DocumentFormattingRequest.type)}fillClientCapabilities(e){(0,tt.ensure)((0,tt.ensure)(e,"textDocument"),"formatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentFormattingProvider);n&&this.register({id:uo.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentFormattingEdits:(i,r,s)=>{let c=this._client,d=(g,h,f)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),options:c.code2ProtocolConverter.asFormattingOptions(h,Vt.fromConfiguration(g))};return c.sendRequest(Ne.DocumentFormattingRequest.type,v,f).then(p=>f.isCancellationRequested?null:c.protocol2CodeConverter.asTextEdits(p,f),p=>c.handleFailedRequest(Ne.DocumentFormattingRequest.type,f,p,null))},l=c.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,r,s,d):d(i,r,s)}};return[Pi.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};gt.DocumentFormattingFeature=oo;var ao=class extends tt.TextDocumentLanguageFeature{constructor(e){super(e,Ne.DocumentRangeFormattingRequest.type)}fillClientCapabilities(e){let t=(0,tt.ensure)((0,tt.ensure)(e,"textDocument"),"rangeFormatting");t.dynamicRegistration=!0,t.rangesSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentRangeFormattingProvider);n&&this.register({id:uo.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentRangeFormattingEdits:(i,r,s,c)=>{let d=this._client,l=(h,f,v,p)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),range:d.code2ProtocolConverter.asRange(f),options:d.code2ProtocolConverter.asFormattingOptions(v,Vt.fromConfiguration(h))};return d.sendRequest(Ne.DocumentRangeFormattingRequest.type,y,p).then(C=>p.isCancellationRequested?null:d.protocol2CodeConverter.asTextEdits(C,p),C=>d.handleFailedRequest(Ne.DocumentRangeFormattingRequest.type,p,C,null))},g=d.middleware;return g.provideDocumentRangeFormattingEdits?g.provideDocumentRangeFormattingEdits(i,r,s,c,l):l(i,r,s,c)}};return e.rangesSupport&&(n.provideDocumentRangesFormattingEdits=(i,r,s,c)=>{let d=this._client,l=(h,f,v,p)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),ranges:d.code2ProtocolConverter.asRanges(f),options:d.code2ProtocolConverter.asFormattingOptions(v,Vt.fromConfiguration(h))};return d.sendRequest(Ne.DocumentRangesFormattingRequest.type,y,p).then(C=>p.isCancellationRequested?null:d.protocol2CodeConverter.asTextEdits(C,p),C=>d.handleFailedRequest(Ne.DocumentRangesFormattingRequest.type,p,C,null))},g=d.middleware;return g.provideDocumentRangesFormattingEdits?g.provideDocumentRangesFormattingEdits(i,r,s,c,l):l(i,r,s,c)}),[Pi.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};gt.DocumentRangeFormattingFeature=ao;var co=class extends tt.TextDocumentLanguageFeature{constructor(e){super(e,Ne.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(e){(0,tt.ensure)((0,tt.ensure)(e,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentOnTypeFormattingProvider);n&&this.register({id:uo.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideOnTypeFormattingEdits:(r,s,c,d,l)=>{let g=this._client,h=(v,p,y,C,b)=>{let T={textDocument:g.code2ProtocolConverter.asTextDocumentIdentifier(v),position:g.code2ProtocolConverter.asPosition(p),ch:y,options:g.code2ProtocolConverter.asFormattingOptions(C,Vt.fromConfiguration(v))};return g.sendRequest(Ne.DocumentOnTypeFormattingRequest.type,T,b).then(P=>b.isCancellationRequested?null:g.protocol2CodeConverter.asTextEdits(P,b),P=>g.handleFailedRequest(Ne.DocumentOnTypeFormattingRequest.type,b,P,null))},f=g.middleware;return f.provideOnTypeFormattingEdits?f.provideOnTypeFormattingEdits(r,s,c,d,l,h):h(r,s,c,d,l)}},i=e.moreTriggerCharacter||[];return[Pi.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.firstTriggerCharacter,...i),n]}};gt.DocumentOnTypeFormattingFeature=co});var Tc=F(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.RenameFeature=void 0;var Qu=I("vscode"),Tt=L(),Gu=te(),_c=Ie(),lo=W(),po=class extends lo.TextDocumentLanguageFeature{constructor(e){super(e,Tt.RenameRequest.type)}fillClientCapabilities(e){let t=(0,lo.ensure)((0,lo.ensure)(e,"textDocument"),"rename");t.dynamicRegistration=!0,t.prepareSupport=!0,t.prepareSupportDefaultBehavior=Tt.PrepareSupportDefaultBehavior.Identifier,t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.renameProvider);n&&(_c.boolean(e.renameProvider)&&(n.prepareProvider=!1),this.register({id:Gu.generateUuid(),registerOptions:n}))}registerLanguageProvider(e){let t=e.documentSelector,n={provideRenameEdits:(i,r,s,c)=>{let d=this._client,l=(h,f,v,p)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),position:d.code2ProtocolConverter.asPosition(f),newName:v};return d.sendRequest(Tt.RenameRequest.type,y,p).then(C=>p.isCancellationRequested?null:d.protocol2CodeConverter.asWorkspaceEdit(C,p),C=>d.handleFailedRequest(Tt.RenameRequest.type,p,C,null,!1))},g=d.middleware;return g.provideRenameEdits?g.provideRenameEdits(i,r,s,c,l):l(i,r,s,c)},prepareRename:e.prepareProvider?(i,r,s)=>{let c=this._client,d=(g,h,f)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),position:c.code2ProtocolConverter.asPosition(h)};return c.sendRequest(Tt.PrepareRenameRequest.type,v,f).then(p=>f.isCancellationRequested?null:Tt.Range.is(p)?c.protocol2CodeConverter.asRange(p):this.isDefaultBehavior(p)?p.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):p&&Tt.Range.is(p.range)?{range:c.protocol2CodeConverter.asRange(p.range),placeholder:p.placeholder}:Promise.reject(new Error("The element can't be renamed.")),p=>{throw typeof p.message=="string"?new Error(p.message):new Error("The element can't be renamed.")})},l=c.middleware;return l.prepareRename?l.prepareRename(i,r,s,d):d(i,r,s)}:void 0};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Qu.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}isDefaultBehavior(e){let t=e;return t&&_c.boolean(t.defaultBehavior)}};Ri.RenameFeature=po});var kc=F(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.DocumentLinkFeature=void 0;var Zu=I("vscode"),yn=L(),fo=W(),Xu=te(),ho=class extends fo.TextDocumentLanguageFeature{constructor(e){super(e,yn.DocumentLinkRequest.type)}fillClientCapabilities(e){let t=(0,fo.ensure)((0,fo.ensure)(e,"textDocument"),"documentLink");t.dynamicRegistration=!0,t.tooltipSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentLinkProvider);n&&this.register({id:Xu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentLinks:(i,r)=>{let s=this._client,c=(l,g)=>s.sendRequest(yn.DocumentLinkRequest.type,s.code2ProtocolConverter.asDocumentLinkParams(l),g).then(h=>g.isCancellationRequested?null:s.protocol2CodeConverter.asDocumentLinks(h,g),h=>s.handleFailedRequest(yn.DocumentLinkRequest.type,g,h,null)),d=s.middleware;return d.provideDocumentLinks?d.provideDocumentLinks(i,r,c):c(i,r)},resolveDocumentLink:e.resolveProvider?(i,r)=>{let s=this._client,c=(l,g)=>s.sendRequest(yn.DocumentLinkResolveRequest.type,s.code2ProtocolConverter.asDocumentLink(l),g).then(h=>g.isCancellationRequested?l:s.protocol2CodeConverter.asDocumentLink(h),h=>s.handleFailedRequest(yn.DocumentLinkResolveRequest.type,g,h,l)),d=s.middleware;return d.resolveDocumentLink?d.resolveDocumentLink(i,r,c):c(i,r)}:void 0};return[Zu.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};xi.DocumentLinkFeature=ho});var Rc=F(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.ExecuteCommandFeature=void 0;var el=I("vscode"),go=L(),tl=te(),Pc=W(),mo=class{constructor(e){this._client=e,this._commands=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._commands.size>0}}get registrationType(){return go.ExecuteCommandRequest.type}fillClientCapabilities(e){(0,Pc.ensure)((0,Pc.ensure)(e,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(e){e.executeCommandProvider&&this.register({id:tl.generateUuid(),registerOptions:Object.assign({},e.executeCommandProvider)})}register(e){let t=this._client,n=t.middleware,i=(r,s)=>{let c={command:r,arguments:s};return t.sendRequest(go.ExecuteCommandRequest.type,c).then(void 0,d=>t.handleFailedRequest(go.ExecuteCommandRequest.type,void 0,d,void 0))};if(e.registerOptions.commands){let r=[];for(let s of e.registerOptions.commands)r.push(el.commands.registerCommand(s,(...c)=>n.executeCommand?n.executeCommand(s,c,i):i(s,c)));this._commands.set(e.id,r)}}unregister(e){let t=this._commands.get(e);t&&t.forEach(n=>n.dispose())}clear(){this._commands.forEach(e=>{e.forEach(t=>t.dispose())}),this._commands.clear()}};Fi.ExecuteCommandFeature=mo});var xc=F(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.FileSystemWatcherFeature=void 0;var nl=I("vscode"),kt=L(),qi=W(),vo=class{constructor(e,t){this._client=e,this._notifyFileEvent=t,this._watchers=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._watchers.size>0}}get registrationType(){return kt.DidChangeWatchedFilesNotification.type}fillClientCapabilities(e){(0,qi.ensure)((0,qi.ensure)(e,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,qi.ensure)((0,qi.ensure)(e,"workspace"),"didChangeWatchedFiles").relativePatternSupport=!0}initialize(e,t){}register(e){if(!Array.isArray(e.registerOptions.watchers))return;let t=[];for(let n of e.registerOptions.watchers){let i=this._client.protocol2CodeConverter.asGlobPattern(n.globPattern);if(i===void 0)continue;let r=!0,s=!0,c=!0;n.kind!==void 0&&n.kind!==null&&(r=(n.kind&kt.WatchKind.Create)!==0,s=(n.kind&kt.WatchKind.Change)!==0,c=(n.kind&kt.WatchKind.Delete)!==0);let d=nl.workspace.createFileSystemWatcher(i,!r,!s,!c);this.hookListeners(d,r,s,c,t),t.push(d)}this._watchers.set(e.id,t)}registerRaw(e,t){let n=[];for(let i of t)this.hookListeners(i,!0,!0,!0,n);this._watchers.set(e,n)}hookListeners(e,t,n,i,r){t&&e.onDidCreate(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:kt.FileChangeType.Created}),null,r),n&&e.onDidChange(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:kt.FileChangeType.Changed}),null,r),i&&e.onDidDelete(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:kt.FileChangeType.Deleted}),null,r)}unregister(e){let t=this._watchers.get(e);if(t)for(let n of t)n.dispose()}clear(){this._watchers.forEach(e=>{for(let t of e)t.dispose()}),this._watchers.clear()}};Ii.FileSystemWatcherFeature=vo});var Fc=F(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.ColorProviderFeature=void 0;var il=I("vscode"),Cn=L(),yo=W(),Co=class extends yo.TextDocumentLanguageFeature{constructor(e){super(e,Cn.DocumentColorRequest.type)}fillClientCapabilities(e){(0,yo.ensure)((0,yo.ensure)(e,"textDocument"),"colorProvider").dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.colorProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideColorPresentations:(i,r,s)=>{let c=this._client,d=(g,h,f)=>{let v={color:g,textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(h.document),range:c.code2ProtocolConverter.asRange(h.range)};return c.sendRequest(Cn.ColorPresentationRequest.type,v,f).then(p=>f.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(p,f),p=>c.handleFailedRequest(Cn.ColorPresentationRequest.type,f,p,null))},l=c.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,r,s,d):d(i,r,s)},provideDocumentColors:(i,r)=>{let s=this._client,c=(l,g)=>{let h={textDocument:s.code2ProtocolConverter.asTextDocumentIdentifier(l)};return s.sendRequest(Cn.DocumentColorRequest.type,h,g).then(f=>g.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(f,g),f=>s.handleFailedRequest(Cn.DocumentColorRequest.type,g,f,null))},d=s.middleware;return d.provideDocumentColors?d.provideDocumentColors(i,r,c):c(i,r)}};return[il.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Ei.ColorProviderFeature=Co});var qc=F(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.ImplementationFeature=void 0;var rl=I("vscode"),wo=L(),Do=W(),So=class extends Do.TextDocumentLanguageFeature{constructor(e){super(e,wo.ImplementationRequest.type)}fillClientCapabilities(e){let t=(0,Do.ensure)((0,Do.ensure)(e,"textDocument"),"implementation");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.implementationProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideImplementation:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(wo.ImplementationRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,f),v=>c.handleFailedRequest(wo.ImplementationRequest.type,f,v,null)),l=c.middleware;return l.provideImplementation?l.provideImplementation(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return rl.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Mi.ImplementationFeature=So});var Ic=F(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.TypeDefinitionFeature=void 0;var sl=I("vscode"),bo=L(),wn=W(),_o=class extends wn.TextDocumentLanguageFeature{constructor(e){super(e,bo.TypeDefinitionRequest.type)}fillClientCapabilities(e){(0,wn.ensure)((0,wn.ensure)(e,"textDocument"),"typeDefinition").dynamicRegistration=!0;let t=(0,wn.ensure)((0,wn.ensure)(e,"textDocument"),"typeDefinition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.typeDefinitionProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideTypeDefinition:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(bo.TypeDefinitionRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,f),v=>c.handleFailedRequest(bo.TypeDefinitionRequest.type,f,v,null)),l=c.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return sl.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ai.TypeDefinitionFeature=_o});var Ec=F(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.WorkspaceFoldersFeature=Bt.arrayDiff=void 0;var ol=te(),Oi=I("vscode"),Dn=L();function To(a,e){if(a!=null)return a[e]}function ko(a,e){return a.filter(t=>e.indexOf(t)<0)}Bt.arrayDiff=ko;var Po=class{constructor(e){this._client=e,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return Dn.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(e){let t=Oi.workspace.workspaceFolders;this.initializeWithFolders(t),t===void 0?e.workspaceFolders=null:e.workspaceFolders=t.map(n=>this.asProtocol(n))}initializeWithFolders(e){this._initialFolders=e}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.workspaceFolders=!0}initialize(e){let t=this._client;t.onRequest(Dn.WorkspaceFoldersRequest.type,r=>{let s=()=>{let d=Oi.workspace.workspaceFolders;return d===void 0?null:d.map(g=>this.asProtocol(g))},c=t.middleware.workspace;return c&&c.workspaceFolders?c.workspaceFolders(r,s):s(r)});let n=To(To(To(e,"workspace"),"workspaceFolders"),"changeNotifications"),i;typeof n=="string"?i=n:n===!0&&(i=ol.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(e){let t;if(this._initialFolders&&e){let n=ko(this._initialFolders,e),i=ko(e,this._initialFolders);(i.length>0||n.length>0)&&(t=this.doSendEvent(i,n))}else this._initialFolders?t=this.doSendEvent([],this._initialFolders):e&&(t=this.doSendEvent(e,[]));t!==void 0&&t.catch(n=>{this._client.error(`Sending notification ${Dn.DidChangeWorkspaceFoldersNotification.type.method} failed`,n)})}doSendEvent(e,t){let n={event:{added:e.map(i=>this.asProtocol(i)),removed:t.map(i=>this.asProtocol(i))}};return this._client.sendNotification(Dn.DidChangeWorkspaceFoldersNotification.type,n)}register(e){let t=e.id,n=this._client,i=Oi.workspace.onDidChangeWorkspaceFolders(r=>{let s=l=>this.doSendEvent(l.added,l.removed),c=n.middleware.workspace;(c&&c.didChangeWorkspaceFolders?c.didChangeWorkspaceFolders(r,s):s(r)).catch(l=>{this._client.error(`Sending notification ${Dn.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(t,i),this.sendInitialEvent(Oi.workspace.workspaceFolders)}unregister(e){let t=this._listeners.get(e);t!==void 0&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear()}asProtocol(e){return e===void 0?null:{uri:this._client.code2ProtocolConverter.asUri(e.uri),name:e.name}}};Bt.WorkspaceFoldersFeature=Po});var Ac=F(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.FoldingRangeFeature=void 0;var Mc=I("vscode"),Pt=L(),Sn=W(),Ro=class extends Sn.TextDocumentLanguageFeature{constructor(e){super(e,Pt.FoldingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Sn.ensure)((0,Sn.ensure)(e,"textDocument"),"foldingRange");t.dynamicRegistration=!0,t.rangeLimit=5e3,t.lineFoldingOnly=!0,t.foldingRangeKind={valueSet:[Pt.FoldingRangeKind.Comment,Pt.FoldingRangeKind.Imports,Pt.FoldingRangeKind.Region]},t.foldingRange={collapsedText:!1},(0,Sn.ensure)((0,Sn.ensure)(e,"workspace"),"foldingRange").refreshSupport=!0}initialize(e,t){this._client.onRequest(Pt.FoldingRangeRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeFoldingRange.fire()});let[n,i]=this.getRegistration(t,e.foldingRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Mc.EventEmitter,i={onDidChangeFoldingRanges:n.event,provideFoldingRanges:(r,s,c)=>{let d=this._client,l=(h,f,v)=>{let p={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h)};return d.sendRequest(Pt.FoldingRangeRequest.type,p,v).then(y=>v.isCancellationRequested?null:d.protocol2CodeConverter.asFoldingRanges(y,v),y=>d.handleFailedRequest(Pt.FoldingRangeRequest.type,v,y,null))},g=d.middleware;return g.provideFoldingRanges?g.provideFoldingRanges(r,s,c,l):l(r,s,c)}};return[Mc.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeFoldingRange:n}]}};Li.FoldingRangeFeature=Ro});var Oc=F(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.DeclarationFeature=void 0;var al=I("vscode"),xo=L(),Fo=W(),qo=class extends Fo.TextDocumentLanguageFeature{constructor(e){super(e,xo.DeclarationRequest.type)}fillClientCapabilities(e){let t=(0,Fo.ensure)((0,Fo.ensure)(e,"textDocument"),"declaration");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.declarationProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDeclaration:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(xo.DeclarationRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDeclarationResult(v,f),v=>c.handleFailedRequest(xo.DeclarationRequest.type,f,v,null)),l=c.middleware;return l.provideDeclaration?l.provideDeclaration(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return al.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ui.DeclarationFeature=qo});var Lc=F(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.SelectionRangeFeature=void 0;var cl=I("vscode"),Io=L(),Eo=W(),Mo=class extends Eo.TextDocumentLanguageFeature{constructor(e){super(e,Io.SelectionRangeRequest.type)}fillClientCapabilities(e){let t=(0,Eo.ensure)((0,Eo.ensure)(e,"textDocument"),"selectionRange");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.selectionRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideSelectionRanges:(i,r,s)=>{let c=this._client,d=async(g,h,f)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),positions:c.code2ProtocolConverter.asPositionsSync(h,f)};return c.sendRequest(Io.SelectionRangeRequest.type,v,f).then(p=>f.isCancellationRequested?null:c.protocol2CodeConverter.asSelectionRanges(p,f),p=>c.handleFailedRequest(Io.SelectionRangeRequest.type,f,p,null))},l=c.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return cl.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Hi.SelectionRangeFeature=Mo});var Hc=F(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.ProgressFeature=void 0;var Uc=L(),dl=fs();function ul(a,e){return a[e]===void 0&&(a[e]=Object.create(null)),a[e]}var Ao=class{constructor(e){this._client=e,this.activeParts=new Set}getState(){return{kind:"window",id:Uc.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(e){ul(e,"window").workDoneProgress=!0}initialize(){let e=this._client,t=i=>{this.activeParts.delete(i)},n=i=>{this.activeParts.add(new dl.ProgressPart(this._client,i.token,t))};e.onRequest(Uc.WorkDoneProgressCreateRequest.type,n)}clear(){for(let e of this.activeParts)e.done();this.activeParts.clear()}};Ni.ProgressFeature=Ao});var Nc=F(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.CallHierarchyFeature=void 0;var ll=I("vscode"),Rt=L(),Oo=W(),Lo=class{constructor(e){this.client=e,this.middleware=e.middleware}prepareCallHierarchy(e,t,n){let i=this.client,r=this.middleware,s=(c,d,l)=>{let g=i.code2ProtocolConverter.asTextDocumentPositionParams(c,d);return i.sendRequest(Rt.CallHierarchyPrepareRequest.type,g,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(h,l),h=>i.handleFailedRequest(Rt.CallHierarchyPrepareRequest.type,l,h,null))};return r.prepareCallHierarchy?r.prepareCallHierarchy(e,t,n,s):s(e,t,n)}provideCallHierarchyIncomingCalls(e,t){let n=this.client,i=this.middleware,r=(s,c)=>{let d={item:n.code2ProtocolConverter.asCallHierarchyItem(s)};return n.sendRequest(Rt.CallHierarchyIncomingCallsRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,c),l=>n.handleFailedRequest(Rt.CallHierarchyIncomingCallsRequest.type,c,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(e,t,r):r(e,t)}provideCallHierarchyOutgoingCalls(e,t){let n=this.client,i=this.middleware,r=(s,c)=>{let d={item:n.code2ProtocolConverter.asCallHierarchyItem(s)};return n.sendRequest(Rt.CallHierarchyOutgoingCallsRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,c),l=>n.handleFailedRequest(Rt.CallHierarchyOutgoingCallsRequest.type,c,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(e,t,r):r(e,t)}},Uo=class extends Oo.TextDocumentLanguageFeature{constructor(e){super(e,Rt.CallHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=e,n=(0,Oo.ensure)((0,Oo.ensure)(t,"textDocument"),"callHierarchy");n.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.callHierarchyProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=this._client,n=new Lo(t);return[ll.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Ki.CallHierarchyFeature=Uo});var Kc=F(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.SemanticTokensFeature=void 0;var ji=I("vscode"),U=L(),bn=W(),pl=Ie(),Ho=class extends bn.TextDocumentLanguageFeature{constructor(e){super(e,U.SemanticTokensRegistrationType.type)}fillClientCapabilities(e){let t=(0,bn.ensure)((0,bn.ensure)(e,"textDocument"),"semanticTokens");t.dynamicRegistration=!0,t.tokenTypes=[U.SemanticTokenTypes.namespace,U.SemanticTokenTypes.type,U.SemanticTokenTypes.class,U.SemanticTokenTypes.enum,U.SemanticTokenTypes.interface,U.SemanticTokenTypes.struct,U.SemanticTokenTypes.typeParameter,U.SemanticTokenTypes.parameter,U.SemanticTokenTypes.variable,U.SemanticTokenTypes.property,U.SemanticTokenTypes.enumMember,U.SemanticTokenTypes.event,U.SemanticTokenTypes.function,U.SemanticTokenTypes.method,U.SemanticTokenTypes.macro,U.SemanticTokenTypes.keyword,U.SemanticTokenTypes.modifier,U.SemanticTokenTypes.comment,U.SemanticTokenTypes.string,U.SemanticTokenTypes.number,U.SemanticTokenTypes.regexp,U.SemanticTokenTypes.operator,U.SemanticTokenTypes.decorator],t.tokenModifiers=[U.SemanticTokenModifiers.declaration,U.SemanticTokenModifiers.definition,U.SemanticTokenModifiers.readonly,U.SemanticTokenModifiers.static,U.SemanticTokenModifiers.deprecated,U.SemanticTokenModifiers.abstract,U.SemanticTokenModifiers.async,U.SemanticTokenModifiers.modification,U.SemanticTokenModifiers.documentation,U.SemanticTokenModifiers.defaultLibrary],t.formats=[U.TokenFormat.Relative],t.requests={range:!0,full:{delta:!0}},t.multilineTokenSupport=!1,t.overlappingTokenSupport=!1,t.serverCancelSupport=!0,t.augmentsSyntaxTokens=!0,(0,bn.ensure)((0,bn.ensure)(e,"workspace"),"semanticTokens").refreshSupport=!0}initialize(e,t){this._client.onRequest(U.SemanticTokensRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeSemanticTokensEmitter.fire()});let[i,r]=this.getRegistration(t,e.semanticTokensProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(e){let t=e.documentSelector,n=pl.boolean(e.full)?e.full:e.full!==void 0,i=e.full!==void 0&&typeof e.full!="boolean"&&e.full.delta===!0,r=new ji.EventEmitter,s=n?{onDidChangeSemanticTokens:r.event,provideDocumentSemanticTokens:(v,p)=>{let y=this._client,C=y.middleware,b=(T,P)=>{let q={textDocument:y.code2ProtocolConverter.asTextDocumentIdentifier(T)};return y.sendRequest(U.SemanticTokensRequest.type,q,P).then(ce=>P.isCancellationRequested?null:y.protocol2CodeConverter.asSemanticTokens(ce,P),ce=>y.handleFailedRequest(U.SemanticTokensRequest.type,P,ce,null))};return C.provideDocumentSemanticTokens?C.provideDocumentSemanticTokens(v,p,b):b(v,p)},provideDocumentSemanticTokensEdits:i?(v,p,y)=>{let C=this._client,b=C.middleware,T=(P,q,ce)=>{let V={textDocument:C.code2ProtocolConverter.asTextDocumentIdentifier(P),previousResultId:q};return C.sendRequest(U.SemanticTokensDeltaRequest.type,V,ce).then(async X=>ce.isCancellationRequested?null:U.SemanticTokens.is(X)?await C.protocol2CodeConverter.asSemanticTokens(X,ce):await C.protocol2CodeConverter.asSemanticTokensEdits(X,ce),X=>C.handleFailedRequest(U.SemanticTokensDeltaRequest.type,ce,X,null))};return b.provideDocumentSemanticTokensEdits?b.provideDocumentSemanticTokensEdits(v,p,y,T):T(v,p,y)}:void 0}:void 0,d=e.range===!0?{provideDocumentRangeSemanticTokens:(v,p,y)=>{let C=this._client,b=C.middleware,T=(P,q,ce)=>{let V={textDocument:C.code2ProtocolConverter.asTextDocumentIdentifier(P),range:C.code2ProtocolConverter.asRange(q)};return C.sendRequest(U.SemanticTokensRangeRequest.type,V,ce).then(X=>ce.isCancellationRequested?null:C.protocol2CodeConverter.asSemanticTokens(X,ce),X=>C.handleFailedRequest(U.SemanticTokensRangeRequest.type,ce,X,null))};return b.provideDocumentRangeSemanticTokens?b.provideDocumentRangeSemanticTokens(v,p,y,T):T(v,p,y)}}:void 0,l=[],g=this._client,h=g.protocol2CodeConverter.asSemanticTokensLegend(e.legend),f=g.protocol2CodeConverter.asDocumentSelector(t);return s!==void 0&&l.push(ji.languages.registerDocumentSemanticTokensProvider(f,s,h)),d!==void 0&&l.push(ji.languages.registerDocumentRangeSemanticTokensProvider(f,d,h)),[new ji.Disposable(()=>l.forEach(v=>v.dispose())),{range:d,full:s,onDidChangeSemanticTokensEmitter:r}]}};Wi.SemanticTokensFeature=Ho});var $c=F(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.WillDeleteFilesFeature=_e.WillRenameFilesFeature=_e.WillCreateFilesFeature=_e.DidDeleteFilesFeature=_e.DidRenameFilesFeature=_e.DidCreateFilesFeature=void 0;var Oe=I("vscode"),fl=Dr(),nt=L(),hl=te();function jc(a,e){return a[e]===void 0&&(a[e]={}),a[e]}function gl(a,e){return a[e]}function Wc(a,e,t){a[e]=t}var _n=class a{constructor(e,t,n,i,r){this._client=e,this._event=t,this._registrationType=n,this._clientCapability=i,this._serverCapability=r,this._filters=new Map}getState(){return{kind:"workspace",id:this._registrationType.method,registrations:this._filters.size>0}}filterSize(){return this._filters.size}get registrationType(){return this._registrationType}fillClientCapabilities(e){let t=jc(jc(e,"workspace"),"fileOperations");Wc(t,"dynamicRegistration",!0),Wc(t,this._clientCapability,!0)}initialize(e){let t=e.workspace?.fileOperations,n=t!==void 0?gl(t,this._serverCapability):void 0;if(n?.filters!==void 0)try{this.register({id:hl.generateUuid(),registerOptions:{filters:n.filters}})}catch(i){this._client.warn(`Ignoring invalid glob pattern for ${this._serverCapability} registration: ${i}`)}}register(e){this._listener||(this._listener=this._event(this.send,this));let t=e.registerOptions.filters.map(n=>{let i=new fl.Minimatch(n.pattern.glob,a.asMinimatchOptions(n.pattern.options));if(!i.makeRe())throw new Error(`Invalid pattern ${n.pattern.glob}!`);return{scheme:n.scheme,matcher:i,kind:n.pattern.matches}});this._filters.set(e.id,t)}unregister(e){this._filters.delete(e),this._filters.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._filters.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getFileType(e){return a.getFileType(e)}async filter(e,t){let n=await Promise.all(e.files.map(async r=>{let s=t(r),c=s.fsPath.replace(/\\/g,"/");for(let d of this._filters.values())for(let l of d)if(!(l.scheme!==void 0&&l.scheme!==s.scheme)){if(l.matcher.match(c)){if(l.kind===void 0)return!0;let g=await this.getFileType(s);if(g===void 0)return this._client.error(`Failed to determine file type for ${s.toString()}.`),!0;if(g===Oe.FileType.File&&l.kind===nt.FileOperationPatternKind.file||g===Oe.FileType.Directory&&l.kind===nt.FileOperationPatternKind.folder)return!0}else if(l.kind===nt.FileOperationPatternKind.folder&&await a.getFileType(s)===Oe.FileType.Directory&&l.matcher.match(`${c}/`))return!0}return!1})),i=e.files.filter((r,s)=>n[s]);return{...e,files:i}}static async getFileType(e){try{return(await Oe.workspace.fs.stat(e)).type}catch{return}}static asMinimatchOptions(e){let t={dot:!0};return e?.ignoreCase===!0&&(t.nocase=!0),t}},$i=class extends _n{constructor(e,t,n,i,r,s,c){super(e,t,n,i,r),this._notificationType=n,this._accessUri=s,this._createParams=c}async send(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let n=async i=>this._client.sendNotification(this._notificationType,this._createParams(i));return this.doSend(t,n)}}},zi=class extends $i{constructor(){super(...arguments),this._fsPathFileTypes=new Map}async getFileType(e){let t=e.fsPath;if(this._fsPathFileTypes.has(t))return this._fsPathFileTypes.get(t);let n=await _n.getFileType(e);return n&&this._fsPathFileTypes.set(t,n),n}async cacheFileTypes(e,t){await this.filter(e,t)}clearFileTypeCache(){this._fsPathFileTypes.clear()}unregister(e){super.unregister(e),this.filterSize()===0&&this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}clear(){super.clear(),this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}},No=class extends $i{constructor(e){super(e,Oe.workspace.onDidCreateFiles,nt.DidCreateFilesNotification.type,"didCreate","didCreate",t=>t,e.code2ProtocolConverter.asDidCreateFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.didCreateFiles?n.didCreateFiles(e,t):t(e)}};_e.DidCreateFilesFeature=No;var Ko=class extends zi{constructor(e){super(e,Oe.workspace.onDidRenameFiles,nt.DidRenameFilesNotification.type,"didRename","didRename",t=>t.oldUri,e.code2ProtocolConverter.asDidRenameFilesParams)}register(e){this._willListener||(this._willListener=Oe.workspace.onWillRenameFiles(this.willRename,this)),super.register(e)}willRename(e){e.waitUntil(this.cacheFileTypes(e,t=>t.oldUri))}doSend(e,t){this.clearFileTypeCache();let n=this._client.middleware.workspace;return n?.didRenameFiles?n.didRenameFiles(e,t):t(e)}};_e.DidRenameFilesFeature=Ko;var jo=class extends zi{constructor(e){super(e,Oe.workspace.onDidDeleteFiles,nt.DidDeleteFilesNotification.type,"didDelete","didDelete",t=>t,e.code2ProtocolConverter.asDidDeleteFilesParams)}register(e){this._willListener||(this._willListener=Oe.workspace.onWillDeleteFiles(this.willDelete,this)),super.register(e)}willDelete(e){e.waitUntil(this.cacheFileTypes(e,t=>t))}doSend(e,t){this.clearFileTypeCache();let n=this._client.middleware.workspace;return n?.didDeleteFiles?n.didDeleteFiles(e,t):t(e)}};_e.DidDeleteFilesFeature=jo;var Tn=class extends _n{constructor(e,t,n,i,r,s,c){super(e,t,n,i,r),this._requestType=n,this._accessUri=s,this._createParams=c}async send(e){let t=this.waitUntil(e);e.waitUntil(t)}async waitUntil(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let n=i=>this._client.sendRequest(this._requestType,this._createParams(i),i.token).then(this._client.protocol2CodeConverter.asWorkspaceEdit);return this.doSend(t,n)}else return}},Wo=class extends Tn{constructor(e){super(e,Oe.workspace.onWillCreateFiles,nt.WillCreateFilesRequest.type,"willCreate","willCreate",t=>t,e.code2ProtocolConverter.asWillCreateFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willCreateFiles?n.willCreateFiles(e,t):t(e)}};_e.WillCreateFilesFeature=Wo;var $o=class extends Tn{constructor(e){super(e,Oe.workspace.onWillRenameFiles,nt.WillRenameFilesRequest.type,"willRename","willRename",t=>t.oldUri,e.code2ProtocolConverter.asWillRenameFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willRenameFiles?n.willRenameFiles(e,t):t(e)}};_e.WillRenameFilesFeature=$o;var zo=class extends Tn{constructor(e){super(e,Oe.workspace.onWillDeleteFiles,nt.WillDeleteFilesRequest.type,"willDelete","willDelete",t=>t,e.code2ProtocolConverter.asWillDeleteFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willDeleteFiles?n.willDeleteFiles(e,t):t(e)}};_e.WillDeleteFilesFeature=zo});var zc=F(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.LinkedEditingFeature=void 0;var ml=I("vscode"),Vo=L(),Bo=W(),Yo=class extends Bo.TextDocumentLanguageFeature{constructor(e){super(e,Vo.LinkedEditingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Bo.ensure)((0,Bo.ensure)(e,"textDocument"),"linkedEditingRange");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.linkedEditingRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideLinkedEditingRanges:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(Vo.LinkedEditingRangeRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asLinkedEditingRanges(v,f),v=>c.handleFailedRequest(Vo.LinkedEditingRangeRequest.type,f,v,null)),l=c.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return ml.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Vi.LinkedEditingFeature=Yo});var Vc=F(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.TypeHierarchyFeature=void 0;var vl=I("vscode"),xt=L(),Jo=W(),Qo=class{constructor(e){this.client=e,this.middleware=e.middleware}prepareTypeHierarchy(e,t,n){let i=this.client,r=this.middleware,s=(c,d,l)=>{let g=i.code2ProtocolConverter.asTextDocumentPositionParams(c,d);return i.sendRequest(xt.TypeHierarchyPrepareRequest.type,g,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(h,l),h=>i.handleFailedRequest(xt.TypeHierarchyPrepareRequest.type,l,h,null))};return r.prepareTypeHierarchy?r.prepareTypeHierarchy(e,t,n,s):s(e,t,n)}provideTypeHierarchySupertypes(e,t){let n=this.client,i=this.middleware,r=(s,c)=>{let d={item:n.code2ProtocolConverter.asTypeHierarchyItem(s)};return n.sendRequest(xt.TypeHierarchySupertypesRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,c),l=>n.handleFailedRequest(xt.TypeHierarchySupertypesRequest.type,c,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(e,t,r):r(e,t)}provideTypeHierarchySubtypes(e,t){let n=this.client,i=this.middleware,r=(s,c)=>{let d={item:n.code2ProtocolConverter.asTypeHierarchyItem(s)};return n.sendRequest(xt.TypeHierarchySubtypesRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,c),l=>n.handleFailedRequest(xt.TypeHierarchySubtypesRequest.type,c,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(e,t,r):r(e,t)}},Go=class extends Jo.TextDocumentLanguageFeature{constructor(e){super(e,xt.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=(0,Jo.ensure)((0,Jo.ensure)(e,"textDocument"),"typeHierarchy");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.typeHierarchyProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=this._client,n=new Qo(t);return[vl.languages.registerTypeHierarchyProvider(t.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Bi.TypeHierarchyFeature=Go});var Yc=F(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.InlineValueFeature=void 0;var Bc=I("vscode"),Yi=L(),kn=W(),Zo=class extends kn.TextDocumentLanguageFeature{constructor(e){super(e,Yi.InlineValueRequest.type)}fillClientCapabilities(e){(0,kn.ensure)((0,kn.ensure)(e,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,kn.ensure)((0,kn.ensure)(e,"workspace"),"inlineValue").refreshSupport=!0}initialize(e,t){this._client.onRequest(Yi.InlineValueRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeInlineValues.fire()});let[n,i]=this.getRegistration(t,e.inlineValueProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Bc.EventEmitter,i={onDidChangeInlineValues:n.event,provideInlineValues:(r,s,c,d)=>{let l=this._client,g=(f,v,p,y)=>{let C={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(f),range:l.code2ProtocolConverter.asRange(v),context:l.code2ProtocolConverter.asInlineValueContext(p)};return l.sendRequest(Yi.InlineValueRequest.type,C,y).then(b=>y.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(b,y),b=>l.handleFailedRequest(Yi.InlineValueRequest.type,y,b,null))},h=l.middleware;return h.provideInlineValues?h.provideInlineValues(r,s,c,d,g):g(r,s,c,d)}};return[this.registerProvider(t,i),{provider:i,onDidChangeInlineValues:n}]}registerProvider(e,t){return Bc.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ji.InlineValueFeature=Zo});var Qc=F(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.InlayHintsFeature=void 0;var Jc=I("vscode"),Yt=L(),Pn=W(),Xo=class extends Pn.TextDocumentLanguageFeature{constructor(e){super(e,Yt.InlayHintRequest.type)}fillClientCapabilities(e){let t=(0,Pn.ensure)((0,Pn.ensure)(e,"textDocument"),"inlayHint");t.dynamicRegistration=!0,t.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,Pn.ensure)((0,Pn.ensure)(e,"workspace"),"inlayHint").refreshSupport=!0}initialize(e,t){this._client.onRequest(Yt.InlayHintRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeInlayHints.fire()});let[n,i]=this.getRegistration(t,e.inlayHintProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Jc.EventEmitter,i={onDidChangeInlayHints:n.event,provideInlayHints:(r,s,c)=>{let d=this._client,l=async(h,f,v)=>{let p={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),range:d.code2ProtocolConverter.asRange(f)};try{let y=await d.sendRequest(Yt.InlayHintRequest.type,p,v);return v.isCancellationRequested?null:d.protocol2CodeConverter.asInlayHints(y,v)}catch(y){return d.handleFailedRequest(Yt.InlayHintRequest.type,v,y,null)}},g=d.middleware;return g.provideInlayHints?g.provideInlayHints(r,s,c,l):l(r,s,c)}};return i.resolveInlayHint=e.resolveProvider===!0?(r,s)=>{let c=this._client,d=async(g,h)=>{try{let f=await c.sendRequest(Yt.InlayHintResolveRequest.type,c.code2ProtocolConverter.asInlayHint(g),h);if(h.isCancellationRequested)return null;let v=c.protocol2CodeConverter.asInlayHint(f,h);return h.isCancellationRequested?null:v}catch(f){return c.handleFailedRequest(Yt.InlayHintResolveRequest.type,h,f,null)}},l=c.middleware;return l.resolveInlayHint?l.resolveInlayHint(r,s,d):d(r,s)}:void 0,[this.registerProvider(t,i),{provider:i,onDidChangeInlayHints:n}]}registerProvider(e,t){return Jc.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Qi.InlayHintsFeature=Xo});var Gc=F(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.InlineCompletionItemFeature=void 0;var yl=I("vscode"),ea=L(),ta=W(),Cl=te(),na=class extends ta.TextDocumentLanguageFeature{constructor(e){super(e,ea.InlineCompletionRequest.type)}fillClientCapabilities(e){let t=(0,ta.ensure)((0,ta.ensure)(e,"textDocument"),"inlineCompletion");t.dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.inlineCompletionProvider);n&&this.register({id:Cl.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideInlineCompletionItems:(i,r,s,c)=>{let d=this._client,l=this._client.middleware,g=(h,f,v,p)=>d.sendRequest(ea.InlineCompletionRequest.type,d.code2ProtocolConverter.asInlineCompletionParams(h,f,v),p).then(y=>p.isCancellationRequested?null:d.protocol2CodeConverter.asInlineCompletionResult(y,p),y=>d.handleFailedRequest(ea.InlineCompletionRequest.type,p,y,null));return l.provideInlineCompletionItems?l.provideInlineCompletionItems(i,r,s,c,g):g(i,r,s,c)}};return[yl.languages.registerInlineCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Gi.InlineCompletionItemFeature=na});var ca=F(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.ProposedFeatures=me.BaseLanguageClient=me.MessageTransports=me.SuspendMode=me.State=me.CloseAction=me.ErrorAction=me.RevealOutputChannelOn=void 0;var Y=I("vscode"),_=L(),wl=Ba(),Dl=Qa(),je=Ie(),Zi=oi(),Zc=te(),Sl=fs(),Ke=W(),bl=ks(),Xc=ac(),ed=dc(),Jt=uc(),_l=lc(),Tl=pc(),kl=fc(),Pl=gc(),Rl=mc(),xl=Gs(),Fl=yc(),ql=Cc(),Il=wc(),El=Sc(),ia=bc(),Ml=Tc(),Al=kc(),Ol=Rc(),Ll=xc(),Ul=Fc(),Hl=qc(),Nl=Ic(),Kl=Ec(),jl=Ac(),Wl=Oc(),$l=Lc(),zl=Hc(),Vl=Nc(),Bl=Kc(),Qt=$c(),Yl=zc(),Jl=Vc(),Ql=Yc(),Gl=Qc(),Zl=Gc(),Ft;(function(a){a[a.Debug=0]="Debug",a[a.Info=1]="Info",a[a.Warn=2]="Warn",a[a.Error=3]="Error",a[a.Never=4]="Never"})(Ft||(me.RevealOutputChannelOn=Ft={}));var xn;(function(a){a[a.Continue=1]="Continue",a[a.Shutdown=2]="Shutdown"})(xn||(me.ErrorAction=xn={}));var mt;(function(a){a[a.DoNotRestart=1]="DoNotRestart",a[a.Restart=2]="Restart"})(mt||(me.CloseAction=mt={}));var Rn;(function(a){a[a.Stopped=1]="Stopped",a[a.Starting=3]="Starting",a[a.Running=2]="Running"})(Rn||(me.State=Rn={}));var td;(function(a){a.off="off",a.on="on"})(td||(me.SuspendMode=td={}));var ra;(function(a){function e(t){return t==null?!1:typeof t=="boolean"||typeof t=="object"&&t!==null&&je.stringArray(t.enabledCommands)?t:!1}a.sanitizeIsTrusted=e})(ra||(ra={}));var sa=class{constructor(e,t){this.client=e,this.maxRestartCount=t,this.restarts=[]}error(e,t,n){return n&&n<=3?{action:xn.Continue}:{action:xn.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:mt.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=180*1e3?{action:mt.DoNotRestart,message:`The ${this.client.name} server crashed ${this.maxRestartCount+1} times in the last 3 minutes. The server will not be restarted. See the output for more information.`}:(this.restarts.shift(),{action:mt.Restart})}},H;(function(a){a.Initial="initial",a.Starting="starting",a.StartFailed="startFailed",a.Running="running",a.Stopping="stopping",a.Stopped="stopped"})(H||(H={}));var nd;(function(a){function e(t){return t&&_.MessageReader.is(t.reader)&&_.MessageWriter.is(t.writer)}a.is=e})(nd||(me.MessageTransports=nd={}));var Fn=class a{constructor(e,t,n){this._traceFormat=_.TraceFormat.Text,this._diagnosticQueue=new Map,this._diagnosticQueueState={state:"idle"},this._features=[],this._dynamicFeatures=new Map,this.workspaceEditLock=new Zi.Semaphore(1),this._id=e,this._name=t,n=n||{};let i={isTrusted:!1,supportHtml:!1};n.markdown!==void 0&&(i.isTrusted=ra.sanitizeIsTrusted(n.markdown.isTrusted),i.supportHtml=n.markdown.supportHtml===!0),this._clientOptions={documentSelector:n.documentSelector??[],synchronize:n.synchronize??{},diagnosticCollectionName:n.diagnosticCollectionName,outputChannelName:n.outputChannelName??this._name,revealOutputChannelOn:n.revealOutputChannelOn??Ft.Error,stdioEncoding:n.stdioEncoding??"utf8",initializationOptions:n.initializationOptions,initializationFailedHandler:n.initializationFailedHandler,progressOnInitialization:!!n.progressOnInitialization,errorHandler:n.errorHandler??this.createDefaultErrorHandler(n.connectionOptions?.maxRestartCount),middleware:n.middleware??{},uriConverters:n.uriConverters,workspaceFolder:n.workspaceFolder,connectionOptions:n.connectionOptions,markdown:i,diagnosticPullOptions:n.diagnosticPullOptions??{onChange:!0,onSave:!1},notebookDocumentOptions:n.notebookDocumentOptions??{}},this._clientOptions.synchronize=this._clientOptions.synchronize||{},this._state=H.Initial,this._ignoredRegistrations=new Set,this._listeners=[],this._notificationHandlers=new Map,this._pendingNotificationHandlers=new Map,this._notificationDisposables=new Map,this._requestHandlers=new Map,this._pendingRequestHandlers=new Map,this._requestDisposables=new Map,this._progressHandlers=new Map,this._pendingProgressHandlers=new Map,this._progressDisposables=new Map,this._connection=void 0,this._initializeResult=void 0,n.outputChannel?(this._outputChannel=n.outputChannel,this._disposeOutputChannel=!1):(this._outputChannel=void 0,this._disposeOutputChannel=!0),this._traceOutputChannel=n.traceOutputChannel,this._diagnostics=void 0,this._pendingOpenNotifications=new Set,this._pendingChangeSemaphore=new Zi.Semaphore(1),this._pendingChangeDelayer=new Zi.Delayer(250),this._fileEvents=[],this._fileEventDelayer=new Zi.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new _.Emitter,this._stateChangeEmitter=new _.Emitter,this._trace=_.Trace.Off,this._tracer={log:(r,s)=>{je.string(r)?this.logTrace(r,s):this.logObjectTrace(r)}},this._c2p=wl.createConverter(n.uriConverters?n.uriConverters.code2Protocol:void 0),this._p2c=Dl.createConverter(n.uriConverters?n.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}get name(){return this._name}get middleware(){return this._clientOptions.middleware??Object.create(null)}get clientOptions(){return this._clientOptions}get protocol2CodeConverter(){return this._p2c}get code2ProtocolConverter(){return this._c2p}get onTelemetry(){return this._telemetryEmitter.event}get onDidChangeState(){return this._stateChangeEmitter.event}get outputChannel(){return this._outputChannel||(this._outputChannel=Y.window.createOutputChannel(this._clientOptions.outputChannelName?this._clientOptions.outputChannelName:this._name)),this._outputChannel}get traceOutputChannel(){return this._traceOutputChannel?this._traceOutputChannel:this.outputChannel}get diagnostics(){return this._diagnostics}get state(){return this.getPublicState()}get $state(){return this._state}set $state(e){let t=this.getPublicState();this._state=e;let n=this.getPublicState();n!==t&&this._stateChangeEmitter.fire({oldState:t,newState:n})}getPublicState(){switch(this.$state){case H.Starting:return Rn.Starting;case H.Running:return Rn.Running;default:return Rn.Stopped}}get initializeResult(){return this._initializeResult}async sendRequest(e,...t){if(this.$state===H.StartFailed||this.$state===H.Stopping||this.$state===H.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));let n=await this.$start();this._didChangeTextDocumentFeature.syncKind===_.TextDocumentSyncKind.Full&&await this.sendPendingFullTextDocumentChanges(n);let i=this._clientOptions.middleware?.sendRequest;if(i!==void 0){let r,s;return t.length===1?_.CancellationToken.is(t[0])?s=t[0]:r=t[0]:t.length===2&&(r=t[0],s=t[1]),i(e,r,s,(c,d,l)=>{let g=[];return d!==void 0&&g.push(d),l!==void 0&&g.push(l),n.sendRequest(c,...g)})}else return n.sendRequest(e,...t)}onRequest(e,t){let n=typeof e=="string"?e:e.method;this._requestHandlers.set(n,t);let i=this.activeConnection(),r;return i!==void 0?(this._requestDisposables.set(n,i.onRequest(e,t)),r={dispose:()=>{let s=this._requestDisposables.get(n);s!==void 0&&(s.dispose(),this._requestDisposables.delete(n))}}):(this._pendingRequestHandlers.set(n,t),r={dispose:()=>{this._pendingRequestHandlers.delete(n);let s=this._requestDisposables.get(n);s!==void 0&&(s.dispose(),this._requestDisposables.delete(n))}}),{dispose:()=>{this._requestHandlers.delete(n),r.dispose()}}}async sendNotification(e,t){if(this.$state===H.StartFailed||this.$state===H.Stopping||this.$state===H.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));let n=this._didChangeTextDocumentFeature.syncKind===_.TextDocumentSyncKind.Full,i;n&&typeof e!="string"&&e.method===_.DidOpenTextDocumentNotification.method&&(i=t?.textDocument.uri,this._pendingOpenNotifications.add(i));let r=await this.$start();n&&await this.sendPendingFullTextDocumentChanges(r),i!==void 0&&this._pendingOpenNotifications.delete(i);let s=this._clientOptions.middleware?.sendNotification;return s?s(e,r.sendNotification.bind(r),t):r.sendNotification(e,t)}onNotification(e,t){let n=typeof e=="string"?e:e.method;this._notificationHandlers.set(n,t);let i=this.activeConnection(),r;return i!==void 0?(this._notificationDisposables.set(n,i.onNotification(e,t)),r={dispose:()=>{let s=this._notificationDisposables.get(n);s!==void 0&&(s.dispose(),this._notificationDisposables.delete(n))}}):(this._pendingNotificationHandlers.set(n,t),r={dispose:()=>{this._pendingNotificationHandlers.delete(n);let s=this._notificationDisposables.get(n);s!==void 0&&(s.dispose(),this._notificationDisposables.delete(n))}}),{dispose:()=>{this._notificationHandlers.delete(n),r.dispose()}}}async sendProgress(e,t,n){if(this.$state===H.StartFailed||this.$state===H.Stopping||this.$state===H.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));try{return(await this.$start()).sendProgress(e,t,n)}catch(i){throw this.error(`Sending progress for token ${t} failed.`,i),i}}onProgress(e,t,n){this._progressHandlers.set(t,{type:e,handler:n});let i=this.activeConnection(),r,s=this._clientOptions.middleware?.handleWorkDoneProgress,c=_.WorkDoneProgress.is(e)&&s!==void 0?d=>{s(t,d,()=>n(d))}:n;return i!==void 0?(this._progressDisposables.set(t,i.onProgress(e,t,c)),r={dispose:()=>{let d=this._progressDisposables.get(t);d!==void 0&&(d.dispose(),this._progressDisposables.delete(t))}}):(this._pendingProgressHandlers.set(t,{type:e,handler:n}),r={dispose:()=>{this._pendingProgressHandlers.delete(t);let d=this._progressDisposables.get(t);d!==void 0&&(d.dispose(),this._progressDisposables.delete(t))}}),{dispose:()=>{this._progressHandlers.delete(t),r.dispose()}}}createDefaultErrorHandler(e){if(e!==void 0&&e<0)throw new Error(`Invalid maxRestartCount: ${e}`);return new sa(this,e??4)}async setTrace(e){this._trace=e;let t=this.activeConnection();t!==void 0&&await t.trace(this._trace,this._tracer,{sendNotification:!1,traceFormat:this._traceFormat})}data2String(e){if(e instanceof _.ResponseError){let t=e;return` Message: ${t.message}
5
+ import{H as Ra,I as Sr,J as xa,L as an,M as br,N as _r,O as Fa,P as qa,a as I,c as F,e as sn,h as Qn,k as lt,l as Pe,m as on,n as wr,o as L,p as Pa,q as Dr,r as qd,s as Id,t as Ed}from"./chunk-S7WJEOJD.js";var Ie=F(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.asPromise=oe.thenable=oe.typedArray=oe.stringArray=oe.array=oe.func=oe.error=oe.number=oe.string=oe.boolean=void 0;function Nd(a){return a===!0||a===!1}oe.boolean=Nd;function Ua(a){return typeof a=="string"||a instanceof String}oe.string=Ua;function Hd(a){return typeof a=="number"||a instanceof Number}oe.number=Hd;function Kd(a){return a instanceof Error}oe.error=Kd;function Na(a){return typeof a=="function"}oe.func=Na;function Ha(a){return Array.isArray(a)}oe.array=Ha;function jd(a){return Ha(a)&&a.every(e=>Ua(e))}oe.stringArray=jd;function Wd(a,e){return Array.isArray(a)&&a.every(e)}oe.typedArray=Wd;function Ka(a){return a&&Na(a.then)}oe.thenable=Ka;function $d(a){return a instanceof Promise?a:Ka(a)?new Promise((e,t)=>{a.then(n=>e(n),n=>t(n))}):Promise.resolve(a)}oe.asPromise=$d});var oi=F(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.forEach=Ce.mapAsync=Ce.map=Ce.clearTestMode=Ce.setTestMode=Ce.Semaphore=Ce.Delayer=void 0;var dn=L(),Ar=class{constructor(e){this.defaultDelay=e,this.timeout=void 0,this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0}trigger(e,t=this.defaultDelay){return this.task=e,t>=0&&this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(n=>{this.onSuccess=n}).then(()=>{this.completionPromise=void 0,this.onSuccess=void 0;var n=this.task();return this.task=void 0,n})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,dn.RAL)().timer.setTimeout(()=>{this.timeout=void 0,this.onSuccess(void 0)},t>=0?t:this.defaultDelay)),this.completionPromise}forceDelivery(){if(!this.completionPromise)return;this.cancelTimeout();let e=this.task();return this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0,e}isTriggered(){return this.timeout!==void 0}cancel(){this.cancelTimeout(),this.completionPromise=void 0}cancelTimeout(){this.timeout!==void 0&&(this.timeout.dispose(),this.timeout=void 0)}};Ce.Delayer=Ar;var Or=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((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,dn.RAL)().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 t=e.thunk();t instanceof Promise?t.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};Ce.Semaphore=Or;var Lr=!1;function zd(){Lr=!0}Ce.setTestMode=zd;function Vd(){Lr=!1}Ce.clearTestMode=Vd;var ja=15,cn=class{constructor(e=ja){this.yieldAfter=Lr===!0?Math.max(e,2):Math.max(e,ja),this.startTime=Date.now(),this.counter=0,this.total=0,this.counterInterval=1}start(){this.counter=0,this.total=0,this.counterInterval=1,this.startTime=Date.now()}shouldYield(){if(++this.counter>=this.counterInterval){let e=Date.now()-this.startTime,t=Math.max(0,this.yieldAfter-e);if(this.total+=this.counter,this.counter=0,e>=this.yieldAfter||t<=1)return this.counterInterval=1,this.total=0,!0;switch(e){case 0:case 1:this.counterInterval=this.total*2;break}}return!1}};async function Bd(a,e,t,n){if(a.length===0)return[];let i=new Array(a.length),r=new cn(n?.yieldAfter);function s(d){r.start();for(let l=d;l<a.length;l++)if(i[l]=e(a[l]),r.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let c=s(0);for(;c!==-1&&!(t!==void 0&&t.isCancellationRequested);)c=await new Promise(d=>{(0,dn.RAL)().timer.setImmediate(()=>{d(s(c))})});return i}Ce.map=Bd;async function Yd(a,e,t,n){if(a.length===0)return[];let i=new Array(a.length),r=new cn(n?.yieldAfter);async function s(d){r.start();for(let l=d;l<a.length;l++)if(i[l]=await e(a[l],t),r.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let c=await s(0);for(;c!==-1&&!(t!==void 0&&t.isCancellationRequested);)c=await new Promise(d=>{(0,dn.RAL)().timer.setImmediate(()=>{d(s(c))})});return i}Ce.mapAsync=Yd;async function Jd(a,e,t,n){if(a.length===0)return;let i=new cn(n?.yieldAfter);function r(c){i.start();for(let d=c;d<a.length;d++)if(e(a[d]),i.shouldYield())return n?.yieldCallback&&n.yieldCallback(),d+1;return-1}let s=r(0);for(;s!==-1&&!(t!==void 0&&t.isCancellationRequested);)s=await new Promise(c=>{(0,dn.RAL)().timer.setImmediate(()=>{c(r(s))})})}Ce.forEach=Jd});var Hr=F(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});var Qd=I("vscode"),Ur=class extends Qd.CompletionItem{constructor(e){super(e)}};Nr.default=Ur});var Wr=F(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});var Gd=I("vscode"),Kr=class extends Gd.CodeLens{constructor(e){super(e)}};jr.default=Kr});var Vr=F(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});var Zd=I("vscode"),$r=class extends Zd.DocumentLink{constructor(e,t){super(e,t)}};zr.default=$r});var Jr=F(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});var Xd=I("vscode"),Br=class extends Xd.CodeAction{constructor(e,t){super(e),this.data=t}};Yr.default=Br});var Zr=F(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.ProtocolDiagnostic=Ht.DiagnosticCode=void 0;var eu=I("vscode"),Qr=Ie(),Wa;(function(a){function e(t){let n=t;return n!=null&&(Qr.number(n.value)||Qr.string(n.value))&&Qr.string(n.target)}a.is=e})(Wa||(Ht.DiagnosticCode=Wa={}));var Gr=class extends eu.Diagnostic{constructor(e,t,n,i){super(e,t,n),this.data=i,this.hasDiagnosticCode=!1}};Ht.ProtocolDiagnostic=Gr});var ts=F(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});var tu=I("vscode"),Xr=class extends tu.CallHierarchyItem{constructor(e,t,n,i,r,s,c){super(e,t,n,i,r,s),c!==void 0&&(this.data=c)}};es.default=Xr});var rs=F(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});var nu=I("vscode"),ns=class extends nu.TypeHierarchyItem{constructor(e,t,n,i,r,s,c){super(e,t,n,i,r,s),c!==void 0&&(this.data=c)}};is.default=ns});var as=F(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});var ai=I("vscode"),ss=class extends ai.SymbolInformation{constructor(e,t,n,i,r){let s=!(i instanceof ai.Uri);super(e,t,n,s?i:new ai.Location(i,new ai.Range(0,0,0,0))),this.hasRange=s,r!==void 0&&(this.data=r)}};os.default=ss});var us=F(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});var iu=I("vscode"),cs=class extends iu.InlayHint{constructor(e,t,n){super(e,t,n)}};ds.default=cs});var Ba=F(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.createConverter=void 0;var de=I("vscode"),O=L(),St=Ie(),$a=oi(),ru=Hr(),su=Wr(),ou=Vr(),za=Jr(),Va=Zr(),au=ts(),cu=rs(),du=as(),uu=us(),ls;(function(a){function e(t){let n=t;return n&&!!n.inserting&&!!n.replacing}a.is=e})(ls||(ls={}));function lu(a){let t=a||(u=>u.toString());function n(u){return t(u)}function i(u){return{uri:t(u.uri)}}function r(u){return{uri:t(u.uri),languageId:u.languageId,version:u.version,text:u.getText()}}function s(u){return{uri:t(u.uri),version:u.version}}function c(u){return{textDocument:r(u)}}function d(u){let w=u;return!!w.document&&!!w.contentChanges}function l(u){let w=u;return!!w.uri&&!!w.version}function g(u,w,R){if(l(u))return{textDocument:{uri:t(u.uri),version:u.version},contentChanges:[{text:u.getText()}]};if(d(u)){let B=w,Q=R;return{textDocument:{uri:t(B),version:Q},contentChanges:u.contentChanges.map(ke=>{let We=ke.range;return{range:{start:{line:We.start.line,character:We.start.character},end:{line:We.end.line,character:We.end.character}},rangeLength:ke.rangeLength,text:ke.text}})}}else throw Error("Unsupported text document change parameter")}function h(u){return{textDocument:i(u)}}function f(u,w=!1){let R={textDocument:i(u)};return w&&(R.text=u.getText()),R}function v(u){switch(u){case de.TextDocumentSaveReason.Manual:return O.TextDocumentSaveReason.Manual;case de.TextDocumentSaveReason.AfterDelay:return O.TextDocumentSaveReason.AfterDelay;case de.TextDocumentSaveReason.FocusOut:return O.TextDocumentSaveReason.FocusOut}return O.TextDocumentSaveReason.Manual}function p(u){return{textDocument:i(u.document),reason:v(u.reason)}}function y(u){return{files:u.files.map(w=>({uri:t(w)}))}}function C(u){return{files:u.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function b(u){return{files:u.files.map(w=>({uri:t(w)}))}}function T(u){return{files:u.files.map(w=>({uri:t(w)}))}}function P(u){return{files:u.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function q(u){return{files:u.files.map(w=>({uri:t(w)}))}}function ce(u,w){return{textDocument:i(u),position:at(w)}}function V(u){switch(u){case de.CompletionTriggerKind.TriggerCharacter:return O.CompletionTriggerKind.TriggerCharacter;case de.CompletionTriggerKind.TriggerForIncompleteCompletions:return O.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return O.CompletionTriggerKind.Invoked}}function X(u,w,R){return{textDocument:i(u),position:at(w),context:{triggerKind:V(R.triggerKind),triggerCharacter:R.triggerCharacter}}}function Je(u){switch(u){case de.SignatureHelpTriggerKind.Invoke:return O.SignatureHelpTriggerKind.Invoked;case de.SignatureHelpTriggerKind.TriggerCharacter:return O.SignatureHelpTriggerKind.TriggerCharacter;case de.SignatureHelpTriggerKind.ContentChange:return O.SignatureHelpTriggerKind.ContentChange}}function rt(u){return{label:u.label}}function Qe(u){return u.map(rt)}function st(u){return{label:u.label,parameters:Qe(u.parameters)}}function It(u){return u.map(st)}function Et(u){return u===void 0?u:{signatures:It(u.signatures),activeSignature:u.activeSignature,activeParameter:u.activeParameter}}function ot(u,w,R){return{textDocument:i(u),position:at(w),context:{isRetrigger:R.isRetrigger,triggerCharacter:R.triggerCharacter,triggerKind:Je(R.triggerKind),activeSignatureHelp:Et(R.activeSignatureHelp)}}}function at(u){return{line:u.line,character:u.character}}function Le(u){return u==null?u:{line:u.line>O.uinteger.MAX_VALUE?O.uinteger.MAX_VALUE:u.line,character:u.character>O.uinteger.MAX_VALUE?O.uinteger.MAX_VALUE:u.character}}function rr(u,w){return $a.map(u,Le,w)}function En(u){return u.map(Le)}function pe(u){return u==null?u:{start:Le(u.start),end:Le(u.end)}}function Mn(u){return u.map(pe)}function ct(u){return u==null?u:O.Location.create(n(u.uri),pe(u.range))}function Ge(u){switch(u){case de.DiagnosticSeverity.Error:return O.DiagnosticSeverity.Error;case de.DiagnosticSeverity.Warning:return O.DiagnosticSeverity.Warning;case de.DiagnosticSeverity.Information:return O.DiagnosticSeverity.Information;case de.DiagnosticSeverity.Hint:return O.DiagnosticSeverity.Hint}}function sr(u){if(!u)return;let w=[];for(let R of u){let B=An(R);B!==void 0&&w.push(B)}return w.length>0?w:void 0}function An(u){switch(u){case de.DiagnosticTag.Unnecessary:return O.DiagnosticTag.Unnecessary;case de.DiagnosticTag.Deprecated:return O.DiagnosticTag.Deprecated;default:return}}function On(u){return{message:u.message,location:ct(u.location)}}function Ln(u){return u.map(On)}function or(u){if(u!=null)return St.number(u)||St.string(u)?u:{value:u.value,target:n(u.target)}}function Zt(u){let w=O.Diagnostic.create(pe(u.range),u.message),R=u instanceof Va.ProtocolDiagnostic?u:void 0;R!==void 0&&R.data!==void 0&&(w.data=R.data);let B=or(u.code);return Va.DiagnosticCode.is(B)?R!==void 0&&R.hasDiagnosticCode?w.code=B:(w.code=B.value,w.codeDescription={href:B.target}):w.code=B,St.number(u.severity)&&(w.severity=Ge(u.severity)),Array.isArray(u.tags)&&(w.tags=sr(u.tags)),u.relatedInformation&&(w.relatedInformation=Ln(u.relatedInformation)),u.source&&(w.source=u.source),w}function Mt(u,w){return u==null?u:$a.map(u,Zt,w)}function At(u){return u==null?u:u.map(Zt)}function ar(u,w){switch(u){case"$string":return w;case O.MarkupKind.PlainText:return{kind:u,value:w};case O.MarkupKind.Markdown:return{kind:u,value:w.value};default:return`Unsupported Markup content received. Kind is: ${u}`}}function dt(u){if(u===de.CompletionItemTag.Deprecated)return O.CompletionItemTag.Deprecated}function Un(u){if(u===void 0)return u;let w=[];for(let R of u){let B=dt(R);B!==void 0&&w.push(B)}return w}function Ot(u,w){return w!==void 0?w:u+1}function Nn(u,w=!1){let R,B;St.string(u.label)?R=u.label:(R=u.label.label,w&&(u.label.detail!==void 0||u.label.description!==void 0)&&(B={detail:u.label.detail,description:u.label.description}));let Q={label:R};B!==void 0&&(Q.labelDetails=B);let fe=u instanceof ru.default?u:void 0;u.detail&&(Q.detail=u.detail),u.documentation&&(!fe||fe.documentationFormat==="$string"?Q.documentation=u.documentation:Q.documentation=ar(fe.documentationFormat,u.documentation)),u.filterText&&(Q.filterText=u.filterText),cr(Q,u),St.number(u.kind)&&(Q.kind=Ot(u.kind,fe&&fe.originalItemKind)),u.sortText&&(Q.sortText=u.sortText),u.additionalTextEdits&&(Q.additionalTextEdits=Ue(u.additionalTextEdits)),u.commitCharacters&&(Q.commitCharacters=u.commitCharacters.slice()),u.command&&(Q.command=Ze(u.command)),(u.preselect===!0||u.preselect===!1)&&(Q.preselect=u.preselect);let ke=Un(u.tags);if(fe){if(fe.data!==void 0&&(Q.data=fe.data),fe.deprecated===!0||fe.deprecated===!1){if(fe.deprecated===!0&&ke!==void 0&&ke.length>0){let We=ke.indexOf(de.CompletionItemTag.Deprecated);We!==-1&&ke.splice(We,1)}Q.deprecated=fe.deprecated}fe.insertTextMode!==void 0&&(Q.insertTextMode=fe.insertTextMode)}return ke!==void 0&&ke.length>0&&(Q.tags=ke),Q.insertTextMode===void 0&&u.keepWhitespace===!0&&(Q.insertTextMode=O.InsertTextMode.adjustIndentation),Q}function cr(u,w){let R=O.InsertTextFormat.PlainText,B,Q;w.textEdit?(B=w.textEdit.newText,Q=w.textEdit.range):w.insertText instanceof de.SnippetString?(R=O.InsertTextFormat.Snippet,B=w.insertText.value):B=w.insertText,w.range&&(Q=w.range),u.insertTextFormat=R,w.fromEdit&&B!==void 0&&Q!==void 0?u.textEdit=Xt(B,Q):u.insertText=B}function Xt(u,w){return ls.is(w)?O.InsertReplaceEdit.create(u,pe(w.inserting),pe(w.replacing)):{newText:u,range:pe(w)}}function en(u){return{range:pe(u.range),newText:u.newText}}function Ue(u){return u==null?u:u.map(en)}function wt(u){return u<=de.SymbolKind.TypeParameter?u+1:O.SymbolKind.Property}function qe(u){return u}function ut(u){return u.map(qe)}function dr(u,w,R){return{textDocument:i(u),position:at(w),context:{includeDeclaration:R.includeDeclaration}}}async function Hn(u,w){let R=O.CodeAction.create(u.title);if(u instanceof za.default&&u.data!==void 0&&(R.data=u.data),u.kind!==void 0&&(R.kind=jn(u.kind)),u.diagnostics!==void 0&&(R.diagnostics=await Mt(u.diagnostics,w)),u.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return u.command!==void 0&&(R.command=Ze(u.command)),u.isPreferred!==void 0&&(R.isPreferred=u.isPreferred),u.disabled!==void 0&&(R.disabled={reason:u.disabled.reason}),R}function ur(u){let w=O.CodeAction.create(u.title);if(u instanceof za.default&&u.data!==void 0&&(w.data=u.data),u.kind!==void 0&&(w.kind=jn(u.kind)),u.diagnostics!==void 0&&(w.diagnostics=At(u.diagnostics)),u.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return u.command!==void 0&&(w.command=Ze(u.command)),u.isPreferred!==void 0&&(w.isPreferred=u.isPreferred),u.disabled!==void 0&&(w.disabled={reason:u.disabled.reason}),w}async function Kn(u,w){if(u==null)return u;let R;return u.only&&St.string(u.only.value)&&(R=[u.only.value]),O.CodeActionContext.create(await Mt(u.diagnostics,w),R,tn(u.triggerKind))}function lr(u){if(u==null)return u;let w;return u.only&&St.string(u.only.value)&&(w=[u.only.value]),O.CodeActionContext.create(At(u.diagnostics),w,tn(u.triggerKind))}function tn(u){switch(u){case de.CodeActionTriggerKind.Invoke:return O.CodeActionTriggerKind.Invoked;case de.CodeActionTriggerKind.Automatic:return O.CodeActionTriggerKind.Automatic;default:return}}function jn(u){if(u!=null)return u.value}function Wn(u){return u==null?u:O.InlineValueContext.create(u.frameId,pe(u.stoppedLocation))}function pr(u,w,R){return{context:O.InlineCompletionContext.create(R.triggerKind,R.selectedCompletionInfo),textDocument:i(u),position:Le(w)}}function Ze(u){let w=O.Command.create(u.title,u.command);return u.arguments&&(w.arguments=u.arguments),w}function $n(u){let w=O.CodeLens.create(pe(u.range));return u.command&&(w.command=Ze(u.command)),u instanceof su.default&&u.data&&(w.data=u.data),w}function fr(u,w){let R={tabSize:u.tabSize,insertSpaces:u.insertSpaces};return w.trimTrailingWhitespace&&(R.trimTrailingWhitespace=!0),w.trimFinalNewlines&&(R.trimFinalNewlines=!0),w.insertFinalNewline&&(R.insertFinalNewline=!0),R}function zn(u){return{textDocument:i(u)}}function hr(u){return{textDocument:i(u)}}function Vn(u){let w=O.DocumentLink.create(pe(u.range));u.target&&(w.target=n(u.target)),u.tooltip!==void 0&&(w.tooltip=u.tooltip);let R=u instanceof ou.default?u:void 0;return R&&R.data&&(w.data=R.data),w}function Bn(u){return{textDocument:i(u)}}function gr(u){let w={name:u.name,kind:wt(u.kind),uri:n(u.uri),range:pe(u.range),selectionRange:pe(u.selectionRange)};return u.detail!==void 0&&u.detail.length>0&&(w.detail=u.detail),u.tags!==void 0&&(w.tags=ut(u.tags)),u instanceof au.default&&u.data!==void 0&&(w.data=u.data),w}function nn(u){let w={name:u.name,kind:wt(u.kind),uri:n(u.uri),range:pe(u.range),selectionRange:pe(u.selectionRange)};return u.detail!==void 0&&u.detail.length>0&&(w.detail=u.detail),u.tags!==void 0&&(w.tags=ut(u.tags)),u instanceof cu.default&&u.data!==void 0&&(w.data=u.data),w}function mr(u){let w=u instanceof du.default?{name:u.name,kind:wt(u.kind),location:u.hasRange?ct(u.location):{uri:t(u.location.uri)},data:u.data}:{name:u.name,kind:wt(u.kind),location:ct(u.location)};return u.tags!==void 0&&(w.tags=ut(u.tags)),u.containerName!==""&&(w.containerName=u.containerName),w}function Yn(u){let w=typeof u.label=="string"?u.label:u.label.map(vr),R=O.InlayHint.create(Le(u.position),w);return u.kind!==void 0&&(R.kind=u.kind),u.textEdits!==void 0&&(R.textEdits=Ue(u.textEdits)),u.tooltip!==void 0&&(R.tooltip=rn(u.tooltip)),u.paddingLeft!==void 0&&(R.paddingLeft=u.paddingLeft),u.paddingRight!==void 0&&(R.paddingRight=u.paddingRight),u instanceof uu.default&&u.data!==void 0&&(R.data=u.data),R}function vr(u){let w=O.InlayHintLabelPart.create(u.value);return u.location!==void 0&&(w.location=ct(u.location)),u.command!==void 0&&(w.command=Ze(u.command)),u.tooltip!==void 0&&(w.tooltip=rn(u.tooltip)),w}function rn(u){return typeof u=="string"?u:{kind:O.MarkupKind.Markdown,value:u.value}}return{asUri:n,asTextDocumentIdentifier:i,asTextDocumentItem:r,asVersionedTextDocumentIdentifier:s,asOpenTextDocumentParams:c,asChangeTextDocumentParams:g,asCloseTextDocumentParams:h,asSaveTextDocumentParams:f,asWillSaveTextDocumentParams:p,asDidCreateFilesParams:y,asDidRenameFilesParams:C,asDidDeleteFilesParams:b,asWillCreateFilesParams:T,asWillRenameFilesParams:P,asWillDeleteFilesParams:q,asTextDocumentPositionParams:ce,asCompletionParams:X,asSignatureHelpParams:ot,asWorkerPosition:at,asRange:pe,asRanges:Mn,asPosition:Le,asPositions:rr,asPositionsSync:En,asLocation:ct,asDiagnosticSeverity:Ge,asDiagnosticTag:An,asDiagnostic:Zt,asDiagnostics:Mt,asDiagnosticsSync:At,asCompletionItem:Nn,asTextEdit:en,asSymbolKind:wt,asSymbolTag:qe,asSymbolTags:ut,asReferenceParams:dr,asCodeAction:Hn,asCodeActionSync:ur,asCodeActionContext:Kn,asCodeActionContextSync:lr,asInlineValueContext:Wn,asCommand:Ze,asCodeLens:$n,asFormattingOptions:fr,asDocumentSymbolParams:zn,asCodeLensParams:hr,asDocumentLink:Vn,asDocumentLinkParams:Bn,asCallHierarchyItem:gr,asTypeHierarchyItem:nn,asInlayHint:Yn,asWorkspaceSymbol:mr,asInlineCompletionParams:pr}}ci.createConverter=lu});var Qa=F(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.createConverter=void 0;var k=I("vscode"),M=L(),Ee=Ie(),$=oi(),pu=Hr(),fu=Wr(),hu=Vr(),gu=Jr(),Ya=Zr(),mu=ts(),vu=rs(),yu=as(),Cu=us(),Ja=L(),di;(function(a){function e(t){let n=t;return n&&Ee.string(n.language)&&Ee.string(n.value)}a.is=e})(di||(di={}));function wu(a,e,t){let i=a||(o=>k.Uri.parse(o));function r(o){return i(o)}function s(o){let m=[];for(let D of o)if(typeof D=="string")m.push(D);else if(Ja.NotebookCellTextDocumentFilter.is(D))if(typeof D.notebook=="string")m.push({notebookType:D.notebook,language:D.language});else{let x=D.notebook.notebookType??"*";m.push({notebookType:x,scheme:D.notebook.scheme,pattern:D.notebook.pattern,language:D.language})}else Ja.TextDocumentFilter.is(D)&&m.push({language:D.language,scheme:D.scheme,pattern:D.pattern});return m}async function c(o,m){return $.map(o,l,m)}function d(o){let m=new Array(o.length);for(let D=0;D<o.length;D++)m[D]=l(o[D]);return m}function l(o){let m=new Ya.ProtocolDiagnostic(p(o.range),o.message,C(o.severity),o.data);if(o.code!==void 0){if(typeof o.code=="string"||typeof o.code=="number")M.CodeDescription.is(o.codeDescription)?m.code={value:o.code,target:r(o.codeDescription.href)}:m.code=o.code;else if(Ya.DiagnosticCode.is(o.code)){m.hasDiagnosticCode=!0;let D=o.code;m.code={value:D.value,target:r(D.target)}}}return o.source&&(m.source=o.source),o.relatedInformation&&(m.relatedInformation=g(o.relatedInformation)),Array.isArray(o.tags)&&(m.tags=h(o.tags)),m}function g(o){let m=new Array(o.length);for(let D=0;D<o.length;D++){let x=o[D];m[D]=new k.DiagnosticRelatedInformation(Ge(x.location),x.message)}return m}function h(o){if(!o)return;let m=[];for(let D of o){let x=f(D);x!==void 0&&m.push(x)}return m.length>0?m:void 0}function f(o){switch(o){case M.DiagnosticTag.Unnecessary:return k.DiagnosticTag.Unnecessary;case M.DiagnosticTag.Deprecated:return k.DiagnosticTag.Deprecated;default:return}}function v(o){return o?new k.Position(o.line,o.character):void 0}function p(o){return o?new k.Range(o.start.line,o.start.character,o.end.line,o.end.character):void 0}async function y(o,m){return $.map(o,D=>new k.Range(D.start.line,D.start.character,D.end.line,D.end.character),m)}function C(o){if(o==null)return k.DiagnosticSeverity.Error;switch(o){case M.DiagnosticSeverity.Error:return k.DiagnosticSeverity.Error;case M.DiagnosticSeverity.Warning:return k.DiagnosticSeverity.Warning;case M.DiagnosticSeverity.Information:return k.DiagnosticSeverity.Information;case M.DiagnosticSeverity.Hint:return k.DiagnosticSeverity.Hint}return k.DiagnosticSeverity.Error}function b(o){if(Ee.string(o))return P(o);if(di.is(o))return P().appendCodeblock(o.value,o.language);if(Array.isArray(o)){let m=[];for(let D of o){let x=P();di.is(D)?x.appendCodeblock(D.value,D.language):x.appendMarkdown(D),m.push(x)}return m}else return P(o)}function T(o){if(Ee.string(o))return o;switch(o.kind){case M.MarkupKind.Markdown:return P(o.value);case M.MarkupKind.PlainText:return o.value;default:return`Unsupported Markup content received. Kind is: ${o.kind}`}}function P(o){let m;if(o===void 0||typeof o=="string")m=new k.MarkdownString(o);else switch(o.kind){case M.MarkupKind.Markdown:m=new k.MarkdownString(o.value);break;case M.MarkupKind.PlainText:m=new k.MarkdownString,m.appendText(o.value);break;default:m=new k.MarkdownString,m.appendText(`Unsupported Markup content received. Kind is: ${o.kind}`);break}return m.isTrusted=e,m.supportHtml=t,m}function q(o){if(o)return new k.Hover(b(o.contents),p(o.range))}async function ce(o,m,D){if(!o)return;if(Array.isArray(o))return $.map(o,$e=>Qe($e,m),D);let x=o,{defaultRange:he,commitCharacters:ye}=V(x,m),J=await $.map(x.items,$e=>Qe($e,ye,he,x.itemDefaults?.insertTextMode,x.itemDefaults?.insertTextFormat,x.itemDefaults?.data),D);return new k.CompletionList(J,x.isIncomplete)}function V(o,m){let D=o.itemDefaults?.editRange,x=o.itemDefaults?.commitCharacters??m;return M.Range.is(D)?{defaultRange:p(D),commitCharacters:x}:D!==void 0?{defaultRange:{inserting:p(D.insert),replacing:p(D.replace)},commitCharacters:x}:{defaultRange:void 0,commitCharacters:x}}function X(o){return M.CompletionItemKind.Text<=o&&o<=M.CompletionItemKind.TypeParameter?[o-1,void 0]:[k.CompletionItemKind.Text,o]}function Je(o){if(o===M.CompletionItemTag.Deprecated)return k.CompletionItemTag.Deprecated}function rt(o){if(o==null)return[];let m=[];for(let D of o){let x=Je(D);x!==void 0&&m.push(x)}return m}function Qe(o,m,D,x,he,ye){let J=rt(o.tags),$e=st(o),G=new pu.default($e);o.detail&&(G.detail=o.detail),o.documentation&&(G.documentation=T(o.documentation),G.documentationFormat=Ee.string(o.documentation)?"$string":o.documentation.kind),o.filterText&&(G.filterText=o.filterText);let Jn=It(o,D,he);if(Jn&&(G.insertText=Jn.text,G.range=Jn.range,G.fromEdit=Jn.fromEdit),Ee.number(o.kind)){let[Fd,ka]=X(o.kind);G.kind=Fd,ka&&(G.originalItemKind=ka)}o.sortText&&(G.sortText=o.sortText),o.additionalTextEdits&&(G.additionalTextEdits=Le(o.additionalTextEdits));let _a=o.commitCharacters!==void 0?Ee.stringArray(o.commitCharacters)?o.commitCharacters:void 0:m;_a&&(G.commitCharacters=_a.slice()),o.command&&(G.command=Ue(o.command)),(o.deprecated===!0||o.deprecated===!1)&&(G.deprecated=o.deprecated,o.deprecated===!0&&J.push(k.CompletionItemTag.Deprecated)),(o.preselect===!0||o.preselect===!1)&&(G.preselect=o.preselect);let Ta=o.data??ye;Ta!==void 0&&(G.data=Ta),J.length>0&&(G.tags=J);let Cr=o.insertTextMode??x;return Cr!==void 0&&(G.insertTextMode=Cr,Cr===M.InsertTextMode.asIs&&(G.keepWhitespace=!0)),G}function st(o){return M.CompletionItemLabelDetails.is(o.labelDetails)?{label:o.label,detail:o.labelDetails.detail,description:o.labelDetails.description}:o.label}function It(o,m,D){let x=o.insertTextFormat??D;if(o.textEdit!==void 0||m!==void 0){let[he,ye]=o.textEdit!==void 0?Et(o.textEdit):[m,o.textEditText??o.label];return x===M.InsertTextFormat.Snippet?{text:new k.SnippetString(ye),range:he,fromEdit:!0}:{text:ye,range:he,fromEdit:!0}}else return o.insertText?x===M.InsertTextFormat.Snippet?{text:new k.SnippetString(o.insertText),fromEdit:!1}:{text:o.insertText,fromEdit:!1}:void 0}function Et(o){return M.InsertReplaceEdit.is(o)?[{inserting:p(o.insert),replacing:p(o.replace)},o.newText]:[p(o.range),o.newText]}function ot(o){if(o)return new k.TextEdit(p(o.range),o.newText)}async function at(o,m){if(o)return $.map(o,ot,m)}function Le(o){if(!o)return;let m=new Array(o.length);for(let D=0;D<o.length;D++)m[D]=ot(o[D]);return m}async function rr(o,m){if(!o)return;let D=new k.SignatureHelp;return Ee.number(o.activeSignature)?D.activeSignature=o.activeSignature:D.activeSignature=0,Ee.number(o.activeParameter)?D.activeParameter=o.activeParameter:D.activeParameter=0,o.signatures&&(D.signatures=await En(o.signatures,m)),D}async function En(o,m){return $.mapAsync(o,pe,m)}async function pe(o,m){let D=new k.SignatureInformation(o.label);return o.documentation!==void 0&&(D.documentation=T(o.documentation)),o.parameters!==void 0&&(D.parameters=await Mn(o.parameters,m)),o.activeParameter!==void 0&&(D.activeParameter=o.activeParameter),D}function Mn(o,m){return $.map(o,ct,m)}function ct(o){let m=new k.ParameterInformation(o.label);return o.documentation&&(m.documentation=T(o.documentation)),m}function Ge(o){return o?new k.Location(i(o.uri),p(o.range)):void 0}async function sr(o,m){if(o)return Ln(o,m)}async function An(o,m){if(o)return Ln(o,m)}function On(o){if(!o)return;let m={targetUri:i(o.targetUri),targetRange:p(o.targetRange),originSelectionRange:p(o.originSelectionRange),targetSelectionRange:p(o.targetSelectionRange)};if(!m.targetSelectionRange)throw new Error("targetSelectionRange must not be undefined or null");return m}async function Ln(o,m){if(o)if(Ee.array(o)){if(o.length===0)return[];if(M.LocationLink.is(o[0])){let D=o;return $.map(D,On,m)}else{let D=o;return $.map(D,Ge,m)}}else return M.LocationLink.is(o)?[On(o)]:Ge(o)}async function or(o,m){if(o)return $.map(o,Ge,m)}async function Zt(o,m){if(o)return $.map(o,Mt,m)}function Mt(o){let m=new k.DocumentHighlight(p(o.range));return Ee.number(o.kind)&&(m.kind=At(o.kind)),m}function At(o){switch(o){case M.DocumentHighlightKind.Text:return k.DocumentHighlightKind.Text;case M.DocumentHighlightKind.Read:return k.DocumentHighlightKind.Read;case M.DocumentHighlightKind.Write:return k.DocumentHighlightKind.Write}return k.DocumentHighlightKind.Text}async function ar(o,m){if(o)return $.map(o,Nn,m)}function dt(o){return o<=M.SymbolKind.TypeParameter?o-1:k.SymbolKind.Property}function Un(o){if(o===M.SymbolTag.Deprecated)return k.SymbolTag.Deprecated}function Ot(o){if(o==null)return;let m=[];for(let D of o){let x=Un(D);x!==void 0&&m.push(x)}return m.length===0?void 0:m}function Nn(o){let m=o.data,D=o.location,x=D.range===void 0||m!==void 0?new yu.default(o.name,dt(o.kind),o.containerName??"",D.range===void 0?i(D.uri):new k.Location(i(o.location.uri),p(D.range)),m):new k.SymbolInformation(o.name,dt(o.kind),o.containerName??"",new k.Location(i(o.location.uri),p(D.range)));return en(x,o),x}async function cr(o,m){if(o!=null)return $.map(o,Xt,m)}function Xt(o){let m=new k.DocumentSymbol(o.name,o.detail||"",dt(o.kind),p(o.range),p(o.selectionRange));if(en(m,o),o.children!==void 0&&o.children.length>0){let D=[];for(let x of o.children)D.push(Xt(x));m.children=D}return m}function en(o,m){o.tags=Ot(m.tags),m.deprecated&&(o.tags?o.tags.includes(k.SymbolTag.Deprecated)||(o.tags=o.tags.concat(k.SymbolTag.Deprecated)):o.tags=[k.SymbolTag.Deprecated])}function Ue(o){let m={title:o.title,command:o.command};return o.arguments&&(m.arguments=o.arguments),m}async function wt(o,m){if(o)return $.map(o,Ue,m)}let qe=new Map;qe.set(M.CodeActionKind.Empty,k.CodeActionKind.Empty),qe.set(M.CodeActionKind.QuickFix,k.CodeActionKind.QuickFix),qe.set(M.CodeActionKind.Refactor,k.CodeActionKind.Refactor),qe.set(M.CodeActionKind.RefactorExtract,k.CodeActionKind.RefactorExtract),qe.set(M.CodeActionKind.RefactorInline,k.CodeActionKind.RefactorInline),qe.set(M.CodeActionKind.RefactorRewrite,k.CodeActionKind.RefactorRewrite),qe.set(M.CodeActionKind.Source,k.CodeActionKind.Source),qe.set(M.CodeActionKind.SourceOrganizeImports,k.CodeActionKind.SourceOrganizeImports);function ut(o){if(o==null)return;let m=qe.get(o);if(m)return m;let D=o.split(".");m=k.CodeActionKind.Empty;for(let x of D)m=m.append(x);return m}function dr(o){if(o!=null)return o.map(m=>ut(m))}async function Hn(o,m){if(o==null)return;let D=new gu.default(o.title,o.data);return o.kind!==void 0&&(D.kind=ut(o.kind)),o.diagnostics!==void 0&&(D.diagnostics=d(o.diagnostics)),o.edit!==void 0&&(D.edit=await tn(o.edit,m)),o.command!==void 0&&(D.command=Ue(o.command)),o.isPreferred!==void 0&&(D.isPreferred=o.isPreferred),o.disabled!==void 0&&(D.disabled={reason:o.disabled.reason}),D}function ur(o,m){return $.mapAsync(o,async D=>M.Command.is(D)?Ue(D):Hn(D,m),m)}function Kn(o){if(!o)return;let m=new fu.default(p(o.range));return o.command&&(m.command=Ue(o.command)),o.data!==void 0&&o.data!==null&&(m.data=o.data),m}async function lr(o,m){if(o)return $.map(o,Kn,m)}async function tn(o,m){if(!o)return;let D=new Map;if(o.changeAnnotations!==void 0){let ye=o.changeAnnotations;await $.forEach(Object.keys(ye),J=>{let $e=jn(ye[J]);D.set(J,$e)},m)}let x=ye=>{if(ye!==void 0)return D.get(ye)},he=new k.WorkspaceEdit;if(o.documentChanges){let ye=o.documentChanges;await $.forEach(ye,J=>{if(M.CreateFile.is(J))he.createFile(i(J.uri),J.options,x(J.annotationId));else if(M.RenameFile.is(J))he.renameFile(i(J.oldUri),i(J.newUri),J.options,x(J.annotationId));else if(M.DeleteFile.is(J))he.deleteFile(i(J.uri),J.options,x(J.annotationId));else if(M.TextDocumentEdit.is(J)){let $e=i(J.textDocument.uri);for(let G of J.edits)M.AnnotatedTextEdit.is(G)?he.replace($e,p(G.range),G.newText,x(G.annotationId)):he.replace($e,p(G.range),G.newText)}else throw new Error(`Unknown workspace edit change received:
6
+ ${JSON.stringify(J,void 0,4)}`)},m)}else if(o.changes){let ye=o.changes;await $.forEach(Object.keys(ye),J=>{he.set(i(J),Le(ye[J]))},m)}return he}function jn(o){if(o!==void 0)return{label:o.label,needsConfirmation:!!o.needsConfirmation,description:o.description}}function Wn(o){let m=p(o.range),D=o.target?r(o.target):void 0,x=new hu.default(m,D);return o.tooltip!==void 0&&(x.tooltip=o.tooltip),o.data!==void 0&&o.data!==null&&(x.data=o.data),x}async function pr(o,m){if(o)return $.map(o,Wn,m)}function Ze(o){return new k.Color(o.red,o.green,o.blue,o.alpha)}function $n(o){return new k.ColorInformation(p(o.range),Ze(o.color))}async function fr(o,m){if(o)return $.map(o,$n,m)}function zn(o){let m=new k.ColorPresentation(o.label);return m.additionalTextEdits=Le(o.additionalTextEdits),o.textEdit&&(m.textEdit=ot(o.textEdit)),m}async function hr(o,m){if(o)return $.map(o,zn,m)}function Vn(o){if(o)switch(o){case M.FoldingRangeKind.Comment:return k.FoldingRangeKind.Comment;case M.FoldingRangeKind.Imports:return k.FoldingRangeKind.Imports;case M.FoldingRangeKind.Region:return k.FoldingRangeKind.Region}}function Bn(o){return new k.FoldingRange(o.startLine,o.endLine,Vn(o.kind))}async function gr(o,m){if(o)return $.map(o,Bn,m)}function nn(o){return new k.SelectionRange(p(o.range),o.parent?nn(o.parent):void 0)}async function mr(o,m){return Array.isArray(o)?$.map(o,nn,m):[]}function Yn(o){return M.InlineValueText.is(o)?new k.InlineValueText(p(o.range),o.text):M.InlineValueVariableLookup.is(o)?new k.InlineValueVariableLookup(p(o.range),o.variableName,o.caseSensitiveLookup):new k.InlineValueEvaluatableExpression(p(o.range),o.expression)}async function vr(o,m){return Array.isArray(o)?$.map(o,Yn,m):[]}async function rn(o,m){let D=typeof o.label=="string"?o.label:await $.map(o.label,u,m),x=new Cu.default(v(o.position),D);return o.kind!==void 0&&(x.kind=o.kind),o.textEdits!==void 0&&(x.textEdits=await at(o.textEdits,m)),o.tooltip!==void 0&&(x.tooltip=w(o.tooltip)),o.paddingLeft!==void 0&&(x.paddingLeft=o.paddingLeft),o.paddingRight!==void 0&&(x.paddingRight=o.paddingRight),o.data!==void 0&&(x.data=o.data),x}function u(o){let m=new k.InlayHintLabelPart(o.value);return o.location!==void 0&&(m.location=Ge(o.location)),o.tooltip!==void 0&&(m.tooltip=w(o.tooltip)),o.command!==void 0&&(m.command=Ue(o.command)),m}function w(o){return typeof o=="string"?o:P(o)}async function R(o,m){if(Array.isArray(o))return $.mapAsync(o,rn,m)}function B(o){if(o===null)return;let m=new mu.default(dt(o.kind),o.name,o.detail||"",r(o.uri),p(o.range),p(o.selectionRange),o.data);return o.tags!==void 0&&(m.tags=Ot(o.tags)),m}async function Q(o,m){if(o!==null)return $.map(o,B,m)}async function fe(o,m){return new k.CallHierarchyIncomingCall(B(o.from),await y(o.fromRanges,m))}async function ke(o,m){if(o!==null)return $.mapAsync(o,fe,m)}async function We(o,m){return new k.CallHierarchyOutgoingCall(B(o.to),await y(o.fromRanges,m))}async function Dd(o,m){if(o!==null)return $.mapAsync(o,We,m)}async function Sd(o,m){if(o!=null)return new k.SemanticTokens(new Uint32Array(o.data),o.resultId)}function Sa(o){return new k.SemanticTokensEdit(o.start,o.deleteCount,o.data!==void 0?new Uint32Array(o.data):void 0)}async function bd(o,m){if(o!=null)return new k.SemanticTokensEdits(o.edits.map(Sa),o.resultId)}function _d(o){return o}async function Td(o,m){if(o!=null)return new k.LinkedEditingRanges(await y(o.ranges,m),kd(o.wordPattern))}function kd(o){if(o!=null)return new RegExp(o)}function ba(o){if(o===null)return;let m=new vu.default(dt(o.kind),o.name,o.detail||"",r(o.uri),p(o.range),p(o.selectionRange),o.data);return o.tags!==void 0&&(m.tags=Ot(o.tags)),m}async function Pd(o,m){if(o!==null)return $.map(o,ba,m)}function Rd(o){if(Ee.string(o))return o;if(M.RelativePattern.is(o)){if(M.URI.is(o.baseUri))return new k.RelativePattern(r(o.baseUri),o.pattern);if(M.WorkspaceFolder.is(o.baseUri)){let m=k.workspace.getWorkspaceFolder(r(o.baseUri.uri));return m!==void 0?new k.RelativePattern(m,o.pattern):void 0}}}async function xd(o,m){if(!o)return;if(Array.isArray(o))return $.map(o,he=>yr(he),m);let D=o,x=await $.map(D.items,he=>yr(he),m);return new k.InlineCompletionList(x)}function yr(o){let m;typeof o.insertText=="string"?m=o.insertText:m=new k.SnippetString(o.insertText.value);let D;o.command&&(D=Ue(o.command));let x=new k.InlineCompletionItem(m,p(o.range),D);return o.filterText&&(x.filterText=o.filterText),x}return{asUri:r,asDocumentSelector:s,asDiagnostics:c,asDiagnostic:l,asRange:p,asRanges:y,asPosition:v,asDiagnosticSeverity:C,asDiagnosticTag:f,asHover:q,asCompletionResult:ce,asCompletionItem:Qe,asTextEdit:ot,asTextEdits:at,asSignatureHelp:rr,asSignatureInformations:En,asSignatureInformation:pe,asParameterInformations:Mn,asParameterInformation:ct,asDeclarationResult:sr,asDefinitionResult:An,asLocation:Ge,asReferences:or,asDocumentHighlights:Zt,asDocumentHighlight:Mt,asDocumentHighlightKind:At,asSymbolKind:dt,asSymbolTag:Un,asSymbolTags:Ot,asSymbolInformations:ar,asSymbolInformation:Nn,asDocumentSymbols:cr,asDocumentSymbol:Xt,asCommand:Ue,asCommands:wt,asCodeAction:Hn,asCodeActionKind:ut,asCodeActionKinds:dr,asCodeActionResult:ur,asCodeLens:Kn,asCodeLenses:lr,asWorkspaceEdit:tn,asDocumentLink:Wn,asDocumentLinks:pr,asFoldingRangeKind:Vn,asFoldingRange:Bn,asFoldingRanges:gr,asColor:Ze,asColorInformation:$n,asColorInformations:fr,asColorPresentation:zn,asColorPresentations:hr,asSelectionRange:nn,asSelectionRanges:mr,asInlineValue:Yn,asInlineValues:vr,asInlayHint:rn,asInlayHints:R,asSemanticTokensLegend:_d,asSemanticTokens:Sd,asSemanticTokensEdit:Sa,asSemanticTokensEdits:bd,asCallHierarchyItem:B,asCallHierarchyItems:Q,asCallHierarchyIncomingCall:fe,asCallHierarchyIncomingCalls:ke,asCallHierarchyOutgoingCall:We,asCallHierarchyOutgoingCalls:Dd,asLinkedEditingRanges:Td,asTypeHierarchyItem:ba,asTypeHierarchyItems:Pd,asGlobPattern:Rd,asInlineCompletionResult:xd,asInlineCompletionItem:yr}}ui.createConverter=wu});var te=F(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.generateUuid=Me.parse=Me.isUUID=Me.v4=Me.empty=void 0;var un=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},ln=class a extends un{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return a._oneOf(a._chars)}constructor(){super([a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),"-",a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),"-","4",a._randomHex(),a._randomHex(),a._randomHex(),"-",a._oneOf(a._timeHighBits),a._randomHex(),a._randomHex(),a._randomHex(),"-",a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex(),a._randomHex()].join(""))}};ln._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];ln._timeHighBits=["8","9","a","b"];Me.empty=new un("00000000-0000-0000-0000-000000000000");function Ga(){return new ln}Me.v4=Ga;var Du=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Za(a){return Du.test(a)}Me.isUUID=Za;function Su(a){if(!Za(a))throw new Error("invalid uuid");return new un(a)}Me.parse=Su;function bu(){return Ga().asHex()}Me.generateUuid=bu});var fs=F(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.ProgressPart=void 0;var Xa=I("vscode"),ec=L(),tc=Ie(),ps=class{constructor(e,t,n){this._client=e,this._token=t,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(ec.WorkDoneProgress.type,this._token,i=>{switch(i.kind){case"begin":this.begin(i);break;case"report":this.report(i);break;case"end":this.done(),n&&n(this);break}})}begin(e){this._infinite=e.percentage===void 0,this._lspProgressDisposable!==void 0&&Xa.window.withProgress({location:Xa.ProgressLocation.Window,cancellable:e.cancellable,title:e.title},async(t,n)=>{if(this._lspProgressDisposable!==void 0)return this._progress=t,this._cancellationToken=n,this._tokenDisposable=this._cancellationToken.onCancellationRequested(()=>{this._client.sendNotification(ec.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(e),new Promise((i,r)=>{this._resolve=i,this._reject=r})})}report(e){if(this._infinite&&tc.string(e.message))this._progress!==void 0&&this._progress.report({message:e.message});else if(tc.number(e.percentage)){let t=Math.max(0,Math.min(e.percentage,100)),n=Math.max(0,t-this._reported);this._reported+=n,this._progress!==void 0&&this._progress.report({message:e.message,increment:n})}}cancel(){this.cleanup(),this._reject!==void 0&&(this._reject(),this._resolve=void 0,this._reject=void 0)}done(){this.cleanup(),this._resolve!==void 0&&(this._resolve(),this._resolve=void 0,this._reject=void 0)}cleanup(){this._lspProgressDisposable!==void 0&&(this._lspProgressDisposable.dispose(),this._lspProgressDisposable=void 0),this._tokenDisposable!==void 0&&(this._tokenDisposable.dispose(),this._tokenDisposable=void 0),this._progress=void 0,this._cancellationToken=void 0}};li.ProgressPart=ps});var W=F(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.WorkspaceFeature=ge.TextDocumentLanguageFeature=ge.TextDocumentEventFeature=ge.DynamicDocumentFeature=ge.DynamicFeature=ge.StaticFeature=ge.ensure=ge.LSPCancellationError=void 0;var bt=I("vscode"),hs=L(),Se=Ie(),nc=te(),gs=class extends bt.CancellationError{constructor(e){super(),this.data=e}};ge.LSPCancellationError=gs;function _u(a,e){return a[e]===void 0&&(a[e]={}),a[e]}ge.ensure=_u;var ic;(function(a){function e(t){let n=t;return n!=null&&Se.func(n.fillClientCapabilities)&&Se.func(n.initialize)&&Se.func(n.getState)&&Se.func(n.clear)&&(n.fillInitializeParams===void 0||Se.func(n.fillInitializeParams))}a.is=e})(ic||(ge.StaticFeature=ic={}));var rc;(function(a){function e(t){let n=t;return n!=null&&Se.func(n.fillClientCapabilities)&&Se.func(n.initialize)&&Se.func(n.getState)&&Se.func(n.clear)&&(n.fillInitializeParams===void 0||Se.func(n.fillInitializeParams))&&Se.func(n.register)&&Se.func(n.unregister)&&n.registrationType!==void 0}a.is=e})(rc||(ge.DynamicFeature=rc={}));var pn=class{constructor(e){this._client=e}getState(){let e=this.getDocumentSelectors(),t=0;for(let i of e){t++;for(let r of bt.workspace.textDocuments)if(bt.languages.match(i,r)>0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}let n=t>0;return{kind:"document",id:this.registrationType.method,registrations:n,matches:!1}}};ge.DynamicDocumentFeature=pn;var ms=class extends pn{static textDocumentFilter(e,t){for(let n of e)if(bt.languages.match(n,t)>0)return!0;return!1}constructor(e,t,n,i,r,s,c){super(e),this._event=t,this._type=n,this._middleware=i,this._createParams=r,this._textDocument=s,this._selectorFilter=c,this._selectors=new Map,this._onNotificationSent=new bt.EventEmitter}getStateInfo(){return[this._selectors.values(),!1]}getDocumentSelectors(){return this._selectors.values()}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=this._event(t=>{this.callback(t).catch(n=>{this._client.error(`Sending document notification ${this._type.method} failed.`,n)})})),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}async callback(e){let t=async n=>{let i=this._createParams(n);await this._client.sendNotification(this._type,i),this.notificationSent(this.getTextDocument(n),this._type,i)};if(this.matches(e)){let n=this._middleware();return n?n(e,i=>t(i)):t(e)}}matches(e){return this._client.hasDedicatedTextSynchronizationFeature(this._textDocument(e))?!1:!this._selectorFilter||this._selectorFilter(this._selectors.values(),e)}get onNotificationSent(){return this._onNotificationSent.event}notificationSent(e,t,n){this._onNotificationSent.fire({textDocument:e,type:t,params:n})}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._onNotificationSent.dispose(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(e){for(let t of this._selectors.values())if(bt.languages.match(t,e)>0)return{send:n=>this.callback(n)}}};ge.TextDocumentEventFeature=ms;var vs=class extends pn{constructor(e,t){super(e),this._registrationType=t,this._registrations=new Map}*getDocumentSelectors(){for(let e of this._registrations.values()){let t=e.data.registerOptions.documentSelector;t!==null&&(yield this._client.protocol2CodeConverter.asDocumentSelector(t))}}get registrationType(){return this._registrationType}register(e){if(!e.registerOptions.documentSelector)return;let t=this.registerLanguageProvider(e.registerOptions,e.id);this._registrations.set(e.id,{disposable:t[0],data:e,provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&t.disposable.dispose()}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getRegistration(e,t){if(t){if(hs.TextDocumentRegistrationOptions.is(t)){let n=hs.StaticRegistrationOptions.hasId(t)?t.id:nc.generateUuid(),i=t.documentSelector??e;if(i)return[n,Object.assign({},t,{documentSelector:i})]}else if(Se.boolean(t)&&t===!0||hs.WorkDoneProgressOptions.is(t)){if(!e)return[void 0,void 0];let n=Se.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e});return[nc.generateUuid(),n]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(e,t){if(!(!e||!t))return Se.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e})}getProvider(e){for(let t of this._registrations.values()){let n=t.data.registerOptions.documentSelector;if(n!==null&&bt.languages.match(this._client.protocol2CodeConverter.asDocumentSelector(n),e)>0)return t.provider}}getAllProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};ge.TextDocumentLanguageFeature=vs;var ys=class{constructor(e,t){this._client=e,this._registrationType=t,this._registrations=new Map}getState(){let e=this._registrations.size>0;return{kind:"workspace",id:this._registrationType.method,registrations:e}}get registrationType(){return this._registrationType}register(e){let t=this.registerLanguageProvider(e.registerOptions);this._registrations.set(e.id,{disposable:t[0],provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&t.disposable.dispose()}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};ge.WorkspaceFeature=ys});var ks=F(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.DiagnosticFeature=ft.DiagnosticPullMode=ft.vsdiag=void 0;var Tu=Dr(),H=I("vscode"),ae=L(),ku=te(),Cs=W();function pi(a,e){return a[e]===void 0&&(a[e]={}),a[e]}var Ae;(function(a){let e;(function(t){t.full="full",t.unChanged="unChanged"})(e=a.DocumentDiagnosticReportKind||(a.DocumentDiagnosticReportKind={}))})(Ae||(ft.vsdiag=Ae={}));var fi;(function(a){a.onType="onType",a.onSave="onSave"})(fi||(ft.DiagnosticPullMode=fi={}));var we;(function(a){a.active="open",a.reschedule="reschedule",a.outDated="drop"})(we||(we={}));var ws=class a{constructor(){this.open=new Set,this._onOpen=new H.EventEmitter,this._onClose=new H.EventEmitter,a.fillTabResources(this.open);let e=t=>{if(t.closed.length===0&&t.opened.length===0)return;let n=this.open,i=new Set;a.fillTabResources(i);let r=new Set,s=new Set(i);for(let c of n.values())i.has(c)?s.delete(c):r.add(c);if(this.open=i,r.size>0){let c=new Set;for(let d of r)c.add(H.Uri.parse(d));this._onClose.fire(c)}if(s.size>0){let c=new Set;for(let d of s)c.add(H.Uri.parse(d));this._onOpen.fire(c)}};H.window.tabGroups.onDidChangeTabs!==void 0?this.disposable=H.window.tabGroups.onDidChangeTabs(e):this.disposable={dispose:()=>{}}}get onClose(){return this._onClose.event}get onOpen(){return this._onOpen.event}dispose(){this.disposable.dispose()}isActive(e){return e instanceof H.Uri?H.window.activeTextEditor?.document.uri===e:H.window.activeTextEditor?.document===e}isVisible(e){let t=e instanceof H.Uri?e:e.uri;return this.open.has(t.toString())}getTabResources(){let e=new Set;return a.fillTabResources(new Set,e),e}static fillTabResources(e,t){let n=e??new Set;for(let i of H.window.tabGroups.all)for(let r of i.tabs){let s=r.input,c;s instanceof H.TabInputText?c=s.uri:s instanceof H.TabInputTextDiff?c=s.modified:s instanceof H.TabInputCustom&&(c=s.uri),c!==void 0&&!n.has(c.toString())&&(n.add(c.toString()),t!==void 0&&t.add(c))}}},le;(function(a){a[a.document=1]="document",a[a.workspace=2]="workspace"})(le||(le={}));var Xe;(function(a){function e(t){return t instanceof H.Uri?t.toString():t.uri.toString()}a.asKey=e})(Xe||(Xe={}));var Ds=class{constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(e,t,n){let i=e===le.document?this.documentPullStates:this.workspacePullStates,[r,s,c]=t instanceof H.Uri?[t.toString(),t,n]:[t.uri.toString(),t.uri,t.version],d=i.get(r);return d===void 0&&(d={document:s,pulledVersion:c,resultId:void 0},i.set(r,d)),d}update(e,t,n,i){let r=e===le.document?this.documentPullStates:this.workspacePullStates,[s,c,d,l]=t instanceof H.Uri?[t.toString(),t,n,i]:[t.uri.toString(),t.uri,t.version,n],g=r.get(s);g===void 0?(g={document:c,pulledVersion:d,resultId:l},r.set(s,g)):(g.pulledVersion=d,g.resultId=l)}unTrack(e,t){let n=Xe.asKey(t);(e===le.document?this.documentPullStates:this.workspacePullStates).delete(n)}tracks(e,t){let n=Xe.asKey(t);return(e===le.document?this.documentPullStates:this.workspacePullStates).has(n)}getResultId(e,t){let n=Xe.asKey(t);return(e===le.document?this.documentPullStates:this.workspacePullStates).get(n)?.resultId}getAllResultIds(){let e=[];for(let[t,n]of this.workspacePullStates)this.documentPullStates.has(t)&&(n=this.documentPullStates.get(t)),n.resultId!==void 0&&e.push({uri:t,value:n.resultId});return e}},Ss=class{constructor(e,t,n){this.client=e,this.tabs=t,this.options=n,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new H.EventEmitter,this.provider=this.createProvider(),this.diagnostics=H.languages.createDiagnosticCollection(n.identifier),this.openRequests=new Map,this.documentStates=new Ds,this.workspaceErrorCounter=0}knows(e,t){let n=t instanceof H.Uri?t:t.uri;return this.documentStates.tracks(e,t)||this.openRequests.has(n.toString())}forget(e,t){this.documentStates.unTrack(e,t)}pull(e,t){if(this.isDisposed)return;let n=e instanceof H.Uri?e:e.uri;this.pullAsync(e).then(()=>{t&&t()},i=>{this.client.error(`Document pull failed for text document ${n.toString()}`,i,!1)})}async pullAsync(e,t){if(this.isDisposed)return;let n=e instanceof H.Uri,i=n?e:e.uri,r=i.toString();t=n?t:e.version;let s=this.openRequests.get(r),c=n?this.documentStates.track(le.document,e,t):this.documentStates.track(le.document,e);if(s===void 0){let d=new H.CancellationTokenSource;this.openRequests.set(r,{state:we.active,document:e,version:t,tokenSource:d});let l,g;try{l=await this.provider.provideDiagnostics(e,c.resultId,d.token)??{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}}catch(h){if(h instanceof Cs.LSPCancellationError&&ae.DiagnosticServerCancellationData.is(h.data)&&h.data.retriggerRequest===!1&&(g={state:we.outDated,document:e}),g===void 0&&h instanceof H.CancellationError)g={state:we.reschedule,document:e};else throw h}if(g=g??this.openRequests.get(r),g===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${r}`),this.diagnostics.delete(i);return}if(this.openRequests.delete(r),!this.tabs.isVisible(e)){this.documentStates.unTrack(le.document,e);return}if(g.state===we.outDated)return;l!==void 0&&(l.kind===Ae.DocumentDiagnosticReportKind.full&&this.diagnostics.set(i,l.items),c.pulledVersion=t,c.resultId=l.resultId),g.state===we.reschedule&&this.pull(e)}else s.state===we.active?(s.tokenSource.cancel(),this.openRequests.set(r,{state:we.reschedule,document:s.document})):s.state===we.outDated&&this.openRequests.set(r,{state:we.reschedule,document:s.document})}forgetDocument(e){let t=e instanceof H.Uri?e:e.uri,n=t.toString(),i=this.openRequests.get(n);this.options.workspaceDiagnostics?i!==void 0?this.openRequests.set(n,{state:we.reschedule,document:e}):this.pull(e,()=>{this.forget(le.document,e)}):(i!==void 0&&(i.state===we.active&&i.tokenSource.cancel(),this.openRequests.set(n,{state:we.outDated,document:e})),this.diagnostics.delete(t),this.forget(le.document,e))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,ae.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},e=>{!(e instanceof Cs.LSPCancellationError)&&!ae.DiagnosticServerCancellationData.is(e.data)&&(this.client.error("Workspace diagnostic pull failed.",e,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,ae.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3))})}async pullWorkspaceAsync(){if(!this.provider.provideWorkspaceDiagnostics||this.isDisposed)return;this.workspaceCancellation!==void 0&&(this.workspaceCancellation.cancel(),this.workspaceCancellation=void 0),this.workspaceCancellation=new H.CancellationTokenSource;let e=this.documentStates.getAllResultIds().map(t=>({uri:this.client.protocol2CodeConverter.asUri(t.uri),value:t.value}));await this.provider.provideWorkspaceDiagnostics(e,this.workspaceCancellation.token,t=>{if(!(!t||this.isDisposed))for(let n of t.items)n.kind===Ae.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(le.document,n.uri)||this.diagnostics.set(n.uri,n.items)),this.documentStates.update(le.workspace,n.uri,n.version??void 0,n.resultId)})}createProvider(){let e={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(t,n,i)=>{let r=(c,d,l)=>{let g={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(c instanceof H.Uri?c:c.uri)},previousResultId:d};return this.isDisposed===!0||!this.client.isRunning()?{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(ae.DocumentDiagnosticRequest.type,g,l).then(async h=>h==null||this.isDisposed||l.isCancellationRequested?{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}:h.kind===ae.DocumentDiagnosticReportKind.Full?{kind:Ae.DocumentDiagnosticReportKind.full,resultId:h.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(h.items,l)}:{kind:Ae.DocumentDiagnosticReportKind.unChanged,resultId:h.resultId},h=>this.client.handleFailedRequest(ae.DocumentDiagnosticRequest.type,l,h,{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}))},s=this.client.middleware;return s.provideDiagnostics?s.provideDiagnostics(t,n,i,r):r(t,n,i)}};return this.options.workspaceDiagnostics&&(e.provideWorkspaceDiagnostics=(t,n,i)=>{let r=async l=>l.kind===ae.DocumentDiagnosticReportKind.Full?{kind:Ae.DocumentDiagnosticReportKind.full,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version,items:await this.client.protocol2CodeConverter.asDiagnostics(l.items,n)}:{kind:Ae.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version},s=l=>{let g=[];for(let h of l)g.push({uri:this.client.code2ProtocolConverter.asUri(h.uri),value:h.value});return g},c=(l,g)=>{let h=(0,ku.generateUuid)(),f=this.client.onProgress(ae.WorkspaceDiagnosticRequest.partialResult,h,async p=>{if(p==null){i(null);return}let y={items:[]};for(let C of p.items)try{y.items.push(await r(C))}catch(b){this.client.error("Converting workspace diagnostics failed.",b)}i(y)}),v={identifier:this.options.identifier,previousResultIds:s(l),partialResultToken:h};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(ae.WorkspaceDiagnosticRequest.type,v,g).then(async p=>{if(g.isCancellationRequested)return{items:[]};let y={items:[]};for(let C of p.items)y.items.push(await r(C));return f.dispose(),i(y),{items:[]}},p=>(f.dispose(),this.client.handleFailedRequest(ae.DocumentDiagnosticRequest.type,g,p,{items:[]})))},d=this.client.middleware;return d.provideWorkspaceDiagnostics?d.provideWorkspaceDiagnostics(t,n,i,c):c(t,n,i)}),e}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(let[e,t]of this.openRequests)t.state===we.active&&t.tokenSource.cancel(),this.openRequests.set(e,{state:we.outDated,document:t.document});this.diagnostics.dispose()}},bs=class{constructor(e){this.diagnosticRequestor=e,this.documents=new ae.LinkedMap,this.isDisposed=!1}add(e){if(this.isDisposed===!0)return;let t=Xe.asKey(e);this.documents.has(t)||(this.documents.set(t,e,ae.Touch.Last),this.trigger())}remove(e){let t=Xe.asKey(e);this.documents.delete(t),this.documents.size===0?this.stop():t===this.endDocumentKey()&&(this.endDocument=this.documents.last)}trigger(){if(this.isDisposed!==!0){if(this.intervalHandle!==void 0){this.endDocument=this.documents.last;return}this.endDocument=this.documents.last,this.intervalHandle=(0,ae.RAL)().timer.setInterval(()=>{let e=this.documents.first;if(e!==void 0){let t=Xe.asKey(e);this.diagnosticRequestor.pull(e),this.documents.set(t,e,ae.Touch.Last),t===this.endDocumentKey()&&this.stop()}},200)}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear()}stop(){this.intervalHandle?.dispose(),this.intervalHandle=void 0,this.endDocument=void 0}endDocumentKey(){return this.endDocument!==void 0?Xe.asKey(this.endDocument):void 0}},_s=class{constructor(e,t,n){let i=e.clientOptions.diagnosticPullOptions??{onChange:!0,onSave:!1},r=e.protocol2CodeConverter.asDocumentSelector(n.documentSelector),s=[],c=p=>{let y=n.documentSelector;if(i.match!==void 0)return i.match(y,p);for(let C of y)if(ae.TextDocumentFilter.is(C)){if(typeof C=="string"||C.language!==void 0&&C.language!=="*"||C.scheme!==void 0&&C.scheme!=="*"&&C.scheme!==p.scheme)return!1;if(C.pattern!==void 0){let b=new Tu.Minimatch(C.pattern,{noext:!0});if(!b.makeRe()||!b.match(p.fsPath))return!1}}return!0},d=p=>p instanceof H.Uri?c(p):H.languages.match(r,p)>0&&t.isVisible(p),l=p=>p instanceof H.Uri?this.activeTextDocument?.uri.toString()===p.toString():this.activeTextDocument===p;this.diagnosticRequestor=new Ss(e,t,n),this.backgroundScheduler=new bs(this.diagnosticRequestor);let g=p=>{!d(p)||!n.interFileDependencies||l(p)||this.backgroundScheduler.add(p)};this.activeTextDocument=H.window.activeTextEditor?.document,H.window.onDidChangeActiveTextEditor(p=>{let y=this.activeTextDocument;this.activeTextDocument=p?.document,y!==void 0&&g(y),this.activeTextDocument!==void 0&&this.backgroundScheduler.remove(this.activeTextDocument)});let h=e.getFeature(ae.DidOpenTextDocumentNotification.method);s.push(h.onNotificationSent(p=>{let y=p.textDocument;this.diagnosticRequestor.knows(le.document,y)||d(y)&&this.diagnosticRequestor.pull(y,()=>{g(y)})})),s.push(t.onOpen(p=>{for(let y of p){if(this.diagnosticRequestor.knows(le.document,y))continue;let C=y.toString(),b;for(let T of H.workspace.textDocuments)if(C===T.uri.toString()){b=T;break}b!==void 0&&d(b)&&this.diagnosticRequestor.pull(b,()=>{g(b)})}}));let f=new Set;for(let p of H.workspace.textDocuments)d(p)&&(this.diagnosticRequestor.pull(p,()=>{g(p)}),f.add(p.uri.toString()));if(i.onTabs===!0)for(let p of t.getTabResources())!f.has(p.toString())&&d(p)&&this.diagnosticRequestor.pull(p,()=>{g(p)});if(i.onChange===!0){let p=e.getFeature(ae.DidChangeTextDocumentNotification.method);s.push(p.onNotificationSent(async y=>{let C=y.textDocument;(i.filter===void 0||!i.filter(C,fi.onType))&&this.diagnosticRequestor.knows(le.document,C)&&this.diagnosticRequestor.pull(C,()=>{this.backgroundScheduler.trigger()})}))}if(i.onSave===!0){let p=e.getFeature(ae.DidSaveTextDocumentNotification.method);s.push(p.onNotificationSent(y=>{let C=y.textDocument;(i.filter===void 0||!i.filter(C,fi.onSave))&&this.diagnosticRequestor.knows(le.document,C)&&this.diagnosticRequestor.pull(y.textDocument,()=>{this.backgroundScheduler.trigger()})}))}let v=e.getFeature(ae.DidCloseTextDocumentNotification.method);s.push(v.onNotificationSent(p=>{this.cleanUpDocument(p.textDocument)})),t.onClose(p=>{for(let y of p)this.cleanUpDocument(y)}),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(let p of H.workspace.textDocuments)d(p)&&this.diagnosticRequestor.pull(p)}),n.workspaceDiagnostics===!0&&n.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=H.Disposable.from(...s,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}cleanUpDocument(e){this.diagnosticRequestor.knows(le.document,e)&&(this.diagnosticRequestor.forgetDocument(e),this.backgroundScheduler.remove(e))}},Ts=class extends Cs.TextDocumentLanguageFeature{constructor(e){super(e,ae.DocumentDiagnosticRequest.type)}fillClientCapabilities(e){let t=pi(pi(e,"textDocument"),"diagnostic");t.dynamicRegistration=!0,t.relatedDocumentSupport=!1,pi(pi(e,"workspace"),"diagnostics").refreshSupport=!0}initialize(e,t){this._client.onRequest(ae.DiagnosticRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeDiagnosticsEmitter.fire()});let[i,r]=this.getRegistration(t,e.diagnosticProvider);!i||!r||this.register({id:i,registerOptions:r})}clear(){this.tabs!==void 0&&(this.tabs.dispose(),this.tabs=void 0),super.clear()}registerLanguageProvider(e){this.tabs===void 0&&(this.tabs=new ws);let t=new _s(this._client,this.tabs,e);return[t.disposable,t]}};ft.DiagnosticFeature=Ts});var ac=F(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.NotebookDocumentSyncFeature=void 0;var De=I("vscode"),Pu=Dr(),et=L(),Ru=te(),sc=Ie();function oc(a,e){return a[e]===void 0&&(a[e]={}),a[e]}var Kt;(function(a){let e;(function(t){function n(f,v){return{version:f.version,uri:v.asUri(f.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function i(f,v,p){let y=et.NotebookDocument.create(p.asUri(f.uri),f.notebookType,f.version,r(v,p));return Object.keys(f.metadata).length>0&&(y.metadata=s(f.metadata)),y}t.asNotebookDocument=i;function r(f,v){return f.map(p=>c(p,v))}t.asNotebookCells=r;function s(f){return l(new Set,f)}t.asMetadata=s;function c(f,v){let p=et.NotebookCell.create(d(f.kind),v.asUri(f.document.uri));return Object.keys(f.metadata).length>0&&(p.metadata=s(f.metadata)),f.executionSummary!==void 0&&sc.number(f.executionSummary.executionOrder)&&sc.boolean(f.executionSummary.success)&&(p.executionSummary={executionOrder:f.executionSummary.executionOrder,success:f.executionSummary.success}),p}t.asNotebookCell=c;function d(f){switch(f){case De.NotebookCellKind.Markup:return et.NotebookCellKind.Markup;case De.NotebookCellKind.Code:return et.NotebookCellKind.Code}}function l(f,v){if(f.has(v))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(v)){let p=[];for(let y of v)if(y!==null&&typeof y=="object"||Array.isArray(y))p.push(l(f,y));else{if(y instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");p.push(y)}return p}else{let p=Object.keys(v),y=Object.create(null);for(let C of p){let b=v[C];if(b!==null&&typeof b=="object"||Array.isArray(b))y[C]=l(f,b);else{if(b instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");y[C]=b}}return y}}function g(f,v){let p=v.asChangeTextDocumentParams(f,f.document.uri,f.document.version);return{document:p.textDocument,changes:p.contentChanges}}t.asTextContentChange=g;function h(f,v){let p=Object.create(null);if(f.metadata&&(p.metadata=a.c2p.asMetadata(f.metadata)),f.cells!==void 0){let y=Object.create(null),C=f.cells;C.structure&&(y.structure={array:{start:C.structure.array.start,deleteCount:C.structure.array.deleteCount,cells:C.structure.array.cells!==void 0?C.structure.array.cells.map(b=>a.c2p.asNotebookCell(b,v)):void 0},didOpen:C.structure.didOpen!==void 0?C.structure.didOpen.map(b=>v.asOpenTextDocumentParams(b.document).textDocument):void 0,didClose:C.structure.didClose!==void 0?C.structure.didClose.map(b=>v.asCloseTextDocumentParams(b.document).textDocument):void 0}),C.data!==void 0&&(y.data=C.data.map(b=>a.c2p.asNotebookCell(b,v))),C.textContent!==void 0&&(y.textContent=C.textContent.map(b=>a.c2p.asTextContentChange(b,v))),Object.keys(y).length>0&&(p.cells=y)}return p}t.asNotebookDocumentChangeEvent=h})(e=a.c2p||(a.c2p={}))})(Kt||(Kt={}));var Ps;(function(a){function e(c,d,l){let g=c.length,h=d.length,f=0;for(;f<h&&f<g&&t(c[f],d[f],l);)f++;if(f<h&&f<g){let v=g-1,p=h-1;for(;v>=0&&p>=0&&t(c[v],d[p],l);)v--,p--;let y=v+1-f,C=f===p+1?void 0:d.slice(f,p+1);return C!==void 0?{start:f,deleteCount:y,cells:C}:{start:f,deleteCount:y}}else return f<h?{start:f,deleteCount:0,cells:d.slice(f)}:f<g?{start:f,deleteCount:g-f}:void 0}a.computeDiff=e;function t(c,d,l=!0){return c.kind!==d.kind||c.document.uri.toString()!==d.document.uri.toString()||c.document.languageId!==d.document.languageId||!n(c.executionSummary,d.executionSummary)?!1:!l||l&&r(c.metadata,d.metadata)}function n(c,d){return c===d?!0:c===void 0||d===void 0?!1:c.executionOrder===d.executionOrder&&c.success===d.success&&i(c.timing,d.timing)}function i(c,d){return c===d?!0:c===void 0||d===void 0?!1:c.startTime===d.startTime&&c.endTime===d.endTime}function r(c,d){if(c===d)return!0;if(c==null||d===null||d===void 0||typeof c!=typeof d||typeof c!="object")return!1;let l=Array.isArray(c),g=Array.isArray(d);if(l!==g)return!1;if(l&&g){if(c.length!==d.length)return!1;for(let h=0;h<c.length;h++)if(!r(c[h],d[h]))return!1}if(s(c)&&s(d)){let h=Object.keys(c),f=Object.keys(d);if(h.length!==f.length||(h.sort(),f.sort(),!r(h,f)))return!1;for(let v=0;v<h.length;v++){let p=h[v];if(!r(c[p],d[p]))return!1}return!0}return!1}function s(c){return c!==null&&typeof c=="object"}a.isObjectLiteral=s})(Ps||(Ps={}));var Rs;(function(a){function e(t,n){if(typeof t=="string")return t==="*"||n.notebookType===t;if(t.notebookType!==void 0&&t.notebookType!=="*"&&n.notebookType!==t.notebookType)return!1;let i=n.uri;if(t.scheme!==void 0&&t.scheme!=="*"&&i.scheme!==t.scheme)return!1;if(t.pattern!==void 0){let r=new Pu.Minimatch(t.pattern,{noext:!0});if(!r.makeRe()||!r.match(i.fsPath))return!1}return!0}a.matchNotebook=e})(Rs||(Rs={}));var hi;(function(a){function e(n){let i=n.notebookSelector,r=[];for(let s of i){let c=(typeof s.notebook=="string"?s.notebook:s.notebook?.notebookType)??"*",d=typeof s.notebook=="string"?void 0:s.notebook?.scheme,l=typeof s.notebook=="string"?void 0:s.notebook?.pattern;if(s.cells!==void 0)for(let g of s.cells)r.push(t(c,d,l,g.language));else r.push(t(c,d,l,void 0))}return r}a.asDocumentSelector=e;function t(n,i,r,s){return i===void 0&&r===void 0?{notebook:n,language:s}:{notebook:{notebookType:n,scheme:i,pattern:r},language:s}}})(hi||(hi={}));var gi;(function(a){function e(t){return{cells:t,uris:new Set(t.map(n=>n.document.uri.toString()))}}a.create=e})(gi||(gi={}));var jt=class{constructor(e,t){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(hi.asDocumentSelector(t)),De.workspace.onDidOpenNotebookDocument(n=>{this.notebookDidOpen.add(n.uri.toString()),this.didOpen(n)},void 0,this.disposables);for(let n of De.workspace.notebookDocuments)this.notebookDidOpen.add(n.uri.toString()),this.didOpen(n);De.workspace.onDidChangeNotebookDocument(n=>this.didChangeNotebookDocument(n),void 0,this.disposables),this.options.save===!0&&De.workspace.onDidSaveNotebookDocument(n=>this.didSave(n),void 0,this.disposables),De.workspace.onDidCloseNotebookDocument(n=>{this.didClose(n),this.notebookDidOpen.delete(n.uri.toString())},void 0,this.disposables)}getState(){for(let e of De.workspace.notebookDocuments)if(this.getMatchingCells(e)!==void 0)return{kind:"document",id:"$internal",registrations:!0,matches:!0};return{kind:"document",id:"$internal",registrations:!0,matches:!1}}get mode(){return"notebook"}handles(e){return De.languages.match(this.selector,e)>0}didOpenNotebookCellTextDocument(e,t){if(De.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let n=this.notebookSyncInfo.get(e.uri.toString()),i=this.cellMatches(e,t);if(n!==void 0){let r=n.uris.has(t.document.uri.toString());if(i&&r||!i&&!r)return;if(i){let s=this.getMatchingCells(e);if(s!==void 0){let c=this.asNotebookDocumentChangeEvent(e,void 0,n,s);c!==void 0&&this.doSendChange(c,s).catch(()=>{})}}}else i&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t){De.languages.match(this.selector,t.document)!==0&&this.doSendChange({notebook:e,cells:{textContent:[t]}},void 0).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let n=this.notebookSyncInfo.get(e.uri.toString());if(n===void 0)return;let i=t.document.uri,r=n.cells.findIndex(s=>s.document.uri.toString()===i.toString());if(r!==-1)if(r===0&&n.cells.length===1)this.doSendClose(e,n.cells).catch(()=>{});else{let s=n.cells.slice(),c=s.splice(r,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:r,deleteCount:1},didClose:c}}},s).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t=this.getMatchingCells(e),n=this.notebookSyncInfo.get(e.uri.toString())){if(n!==void 0)if(t!==void 0){let i=this.asNotebookDocumentChangeEvent(e,void 0,n,t);i!==void 0&&this.doSendChange(i,t).catch(()=>{})}else this.doSendClose(e,[]).catch(()=>{});else{if(t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,n=this.notebookSyncInfo.get(t.uri.toString());if(n===void 0){if(e.contentChanges.length===0)return;let i=this.getMatchingCells(t);if(i===void 0)return;this.didOpen(t,i,n)}else{let i=this.getMatchingCells(t);if(i===void 0){this.didClose(t,n);return}let r=this.asNotebookDocumentChangeEvent(e.notebook,e,n,i);r!==void 0&&this.doSendChange(r,i).catch(()=>{})}}didSave(e){this.notebookSyncInfo.get(e.uri.toString())!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.notebookSyncInfo.get(e.uri.toString())){if(t===void 0)return;let n=e.getCells().filter(i=>t.uris.has(i.document.uri.toString()));this.doSendClose(e,n).catch(()=>{})}async sendDidOpenNotebookDocument(e){let t=this.getMatchingCells(e);if(t!==void 0)return this.doSendOpen(e,t)}async doSendOpen(e,t){let n=async(r,s)=>{let c=Kt.c2p.asNotebookDocument(r,s,this.client.code2ProtocolConverter),d=s.map(l=>this.client.code2ProtocolConverter.asTextDocumentItem(l.document));try{await this.client.sendNotification(et.DidOpenNotebookDocumentNotification.type,{notebookDocument:c,cellTextDocuments:d})}catch(l){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",l),l}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),gi.create(t)),i?.didOpen!==void 0?i.didOpen(e,t,n):n(e,t)}async sendDidChangeNotebookDocument(e){return this.doSendChange(e,void 0)}async doSendChange(e,t=this.getMatchingCells(e.notebook)){let n=async r=>{try{await this.client.sendNotification(et.DidChangeNotebookDocumentNotification.type,{notebookDocument:Kt.c2p.asVersionedNotebookDocumentIdentifier(r.notebook,this.client.code2ProtocolConverter),change:Kt.c2p.asNotebookDocumentChangeEvent(r,this.client.code2ProtocolConverter)})}catch(s){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",s),s}},i=this.client.middleware?.notebooks;return e.cells?.structure!==void 0&&this.notebookSyncInfo.set(e.notebook.uri.toString(),gi.create(t??[])),i?.didChange!==void 0?i?.didChange(e,n):n(e)}async sendDidSaveNotebookDocument(e){return this.doSendSave(e)}async doSendSave(e){let t=async i=>{try{await this.client.sendNotification(et.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}})}catch(r){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",r),r}},n=this.client.middleware?.notebooks;return n?.didSave!==void 0?n.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){return this.doSendClose(e,this.getMatchingCells(e)??[])}async doSendClose(e,t){let n=async(r,s)=>{try{await this.client.sendNotification(et.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(r.uri)},cellTextDocuments:s.map(c=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(c.document))})}catch(c){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",c),c}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),i?.didClose!==void 0?i.didClose(e,t,n):n(e,t)}asNotebookDocumentChangeEvent(e,t,n,i){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let r={notebook:e};t?.metadata!==void 0&&(r.metadata=Kt.c2p.asMetadata(t.metadata));let s;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let c=[];s=new Set(i.map(d=>d.document.uri.toString()));for(let d of t.cellChanges)s.has(d.cell.document.uri.toString())&&(d.executionSummary!==void 0||d.metadata!==void 0)&&c.push(d.cell);c.length>0&&(r.cells=r.cells??{},r.cells.data=c)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&n!==void 0&&i!==void 0){let c=n.cells,d=i,l=Ps.computeDiff(c,d,!1),g,h;if(l!==void 0){g=l.cells===void 0?new Map:new Map(l.cells.map(p=>[p.document.uri.toString(),p])),h=l.deleteCount===0?new Map:new Map(c.slice(l.start,l.start+l.deleteCount).map(p=>[p.document.uri.toString(),p]));for(let p of Array.from(h.keys()))g.has(p)&&(h.delete(p),g.delete(p));r.cells=r.cells??{};let f=[],v=[];if(g.size>0||h.size>0){for(let p of g.values())f.push(p);for(let p of h.values())v.push(p)}r.cells.structure={array:l,didOpen:f,didClose:v}}}return Object.keys(r).length>1?r:void 0}getMatchingCells(e,t=e.getCells()){if(this.options.notebookSelector!==void 0){for(let n of this.options.notebookSelector)if(n.notebook===void 0||Rs.matchNotebook(n.notebook,e)){let i=this.filterCells(e,t,n.cells);return i.length===0?void 0:i}}}cellMatches(e,t){let n=this.getMatchingCells(e,[t]);return n!==void 0&&n[0]===t}filterCells(e,t,n){let i=n!==void 0?t.filter(r=>{let s=r.document.languageId;return n.some((c=>c.language==="*"||s===c.language))}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,i):i}},mi=class a{constructor(e){this.client=e,this.registrations=new Map,this.registrationType=et.NotebookDocumentSyncRegistrationType.type,De.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==a.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let r of this.registrations.values())r instanceof jt&&r.didOpenNotebookCellTextDocument(n,i)}),De.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let n=t.document;if(n.uri.scheme!==a.CellScheme)return;let[i]=this.findNotebookDocumentAndCell(n);if(i!==void 0)for(let r of this.registrations.values())r instanceof jt&&r.didChangeNotebookCellTextDocument(i,t)}),De.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==a.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let r of this.registrations.values())r instanceof jt&&r.didCloseNotebookCellTextDocument(n,i)})}getState(){if(this.registrations.size===0)return{kind:"document",id:this.registrationType.method,registrations:!1,matches:!1};for(let e of this.registrations.values()){let t=e.getState();if(t.kind==="document"&&t.registrations===!0&&t.matches===!0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!1}}fillClientCapabilities(e){let t=oc(oc(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(hi.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let n=t.id??Ru.generateUuid();this.register({id:n,registerOptions:t})}register(e){let t=new jt(this.client,e.registerOptions);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t&&t.dispose()}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear()}handles(e){if(e.uri.scheme!==a.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&De.languages.match(this.dedicatedChannel,e)>0)return!0;for(let t of this.registrations.values())if(t.handles(e))return!0;return!1}getProvider(e){for(let t of this.registrations.values())if(t.handles(e.document))return t}findNotebookDocumentAndCell(e){let t=e.uri.toString();for(let n of De.workspace.notebookDocuments)for(let i of n.getCells())if(i.document.uri.toString()===t)return[n,i];return[void 0,void 0]}};vi.NotebookDocumentSyncFeature=mi;mi.CellScheme="vscode-notebook-cell"});var dc=F(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.SyncConfigurationFeature=ht.toJSONObject=ht.ConfigurationFeature=void 0;var Wt=I("vscode"),fn=L(),xu=Ie(),Fu=te(),cc=W(),xs=class{constructor(e){this._client=e}getState(){return{kind:"static"}}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.configuration=!0}initialize(){let e=this._client;e.onRequest(fn.ConfigurationRequest.type,(t,n)=>{let i=s=>{let c=[];for(let d of s.items){let l=d.scopeUri!==void 0&&d.scopeUri!==null?this._client.protocol2CodeConverter.asUri(d.scopeUri):void 0;c.push(this.getConfiguration(l,d.section!==null?d.section:void 0))}return c},r=e.middleware.workspace;return r&&r.configuration?r.configuration(t,n,i):i(t,n)})}getConfiguration(e,t){let n=null;if(t){let i=t.lastIndexOf(".");if(i===-1)n=_t(Wt.workspace.getConfiguration(void 0,e).get(t));else{let r=Wt.workspace.getConfiguration(t.substr(0,i),e);r&&(n=_t(r.get(t.substr(i+1))))}}else{let i=Wt.workspace.getConfiguration(void 0,e);n={};for(let r of Object.keys(i))i.has(r)&&(n[r]=_t(i.get(r)))}return n===void 0&&(n=null),n}clear(){}};ht.ConfigurationFeature=xs;function _t(a){if(a){if(Array.isArray(a))return a.map(_t);if(typeof a=="object"){let e=Object.create(null);for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=_t(a[t]));return e}}return a}ht.toJSONObject=_t;var Fs=class{constructor(e){this._client=e,this.isCleared=!1,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return fn.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,cc.ensure)((0,cc.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:Fu.generateUuid(),registerOptions:{section:e}})}register(e){let t=Wt.workspace.onDidChangeConfiguration(n=>{this.onDidChangeConfiguration(e.registerOptions.section,n)});this._listeners.set(e.id,t),e.registerOptions.section!==void 0&&this.onDidChangeConfiguration(e.registerOptions.section,void 0)}unregister(e){let t=this._listeners.get(e);t&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear(),this.isCleared=!0}onDidChangeConfiguration(e,t){if(this.isCleared)return;let n;if(xu.string(e)?n=[e]:n=e,n!==void 0&&t!==void 0&&!n.some(c=>t.affectsConfiguration(c)))return;let i=async s=>s===void 0?this._client.sendNotification(fn.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(fn.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(s)}),r=this._client.middleware.workspace?.didChangeConfiguration;(r?r(n,i):i(n)).catch(s=>{this._client.error(`Sending notification ${fn.DidChangeConfigurationNotification.type.method} failed`,s)})}extractSettingsInformation(e){function t(r,s){let c=r;for(let d=0;d<s.length-1;d++){let l=c[s[d]];l||(l=Object.create(null),c[s[d]]=l),c=l}return c}let n=this._client.clientOptions.workspaceFolder?this._client.clientOptions.workspaceFolder.uri:void 0,i=Object.create(null);for(let r=0;r<e.length;r++){let s=e[r],c=s.indexOf("."),d=null;if(c>=0?d=Wt.workspace.getConfiguration(s.substr(0,c),n).get(s.substr(c+1)):d=Wt.workspace.getConfiguration(void 0,n).get(s),d){let l=e[r].split(".");t(i,l)[l[l.length-1]]=_t(d)}}return i}};ht.SyncConfigurationFeature=Fs});var uc=F(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.DidSaveTextDocumentFeature=be.WillSaveWaitUntilFeature=be.WillSaveFeature=be.DidChangeTextDocumentFeature=be.DidCloseTextDocumentFeature=be.DidOpenTextDocumentFeature=void 0;var Re=I("vscode"),Z=L(),ie=W(),$t=te(),qs=class extends ie.TextDocumentEventFeature{constructor(e,t){super(e,Re.workspace.onDidOpenTextDocument,Z.DidOpenTextDocumentNotification.type,()=>e.middleware.didOpen,n=>e.code2ProtocolConverter.asOpenTextDocumentParams(n),n=>n,ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:$t.generateUuid(),registerOptions:{documentSelector:t}})}get registrationType(){return Z.DidOpenTextDocumentNotification.type}register(e){if(super.register(e),!e.registerOptions.documentSelector)return;let t=this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector);Re.workspace.textDocuments.forEach(n=>{let i=n.uri.toString();if(!this._syncedDocuments.has(i)&&Re.languages.match(t,n)>0&&!this._client.hasDedicatedTextSynchronizationFeature(n)){let r=this._client.middleware,s=c=>this._client.sendNotification(this._type,this._createParams(c));(r.didOpen?r.didOpen(n,s):s(n)).catch(c=>{this._client.error(`Sending document notification ${this._type.method} failed`,c)}),this._syncedDocuments.set(i,n)}})}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.set(e.uri.toString(),e),super.notificationSent(e,t,n)}};be.DidOpenTextDocumentFeature=qs;var Is=class extends ie.TextDocumentEventFeature{constructor(e,t,n){super(e,Re.workspace.onDidCloseTextDocument,Z.DidCloseTextDocumentNotification.type,()=>e.middleware.didClose,i=>e.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingTextDocumentChanges=n}get registrationType(){return Z.DidCloseTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:$t.generateUuid(),registerOptions:{documentSelector:t}})}async callback(e){await super.callback(e),this._pendingTextDocumentChanges.delete(e.uri.toString())}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.delete(e.uri.toString()),super.notificationSent(e,t,n)}unregister(e){let t=this._selectors.get(e);super.unregister(e);let n=this._selectors.values();this._syncedDocuments.forEach(i=>{if(Re.languages.match(t,i)>0&&!this._selectorFilter(n,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let r=this._client.middleware,s=c=>this._client.sendNotification(this._type,this._createParams(c));this._syncedDocuments.delete(i.uri.toString()),(r.didClose?r.didClose(i,s):s(i)).catch(c=>{this._client.error(`Sending document notification ${this._type.method} failed`,c)})}})}};be.DidCloseTextDocumentFeature=Is;var Es=class extends ie.DynamicDocumentFeature{constructor(e,t){super(e),this._changeData=new Map,this._onNotificationSent=new Re.EventEmitter,this._onPendingChangeAdded=new Re.EventEmitter,this._pendingTextDocumentChanges=t,this._syncKind=Z.TextDocumentSyncKind.None}get onNotificationSent(){return this._onNotificationSent.event}get onPendingChangeAdded(){return this._onPendingChangeAdded.event}get syncKind(){return this._syncKind}get registrationType(){return Z.DidChangeTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.change!==void 0&&n.change!==Z.TextDocumentSyncKind.None&&this.register({id:$t.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},{syncKind:n.change})})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Re.workspace.onDidChangeTextDocument(this.callback,this)),this._changeData.set(e.id,{syncKind:e.registerOptions.syncKind,documentSelector:this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)}),this.updateSyncKind(e.registerOptions.syncKind))}*getDocumentSelectors(){for(let e of this._changeData.values())yield e.documentSelector}async callback(e){if(e.contentChanges.length===0)return;let t=e.document.uri,n=e.document.version,i=[];for(let r of this._changeData.values())if(Re.languages.match(r.documentSelector,e.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let s=this._client.middleware;if(r.syncKind===Z.TextDocumentSyncKind.Incremental){let c=async d=>{let l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(d,t,n);await this._client.sendNotification(Z.DidChangeTextDocumentNotification.type,l),this.notificationSent(d.document,Z.DidChangeTextDocumentNotification.type,l)};i.push(s.didChange?s.didChange(e,d=>c(d)):c(e))}else if(r.syncKind===Z.TextDocumentSyncKind.Full){let c=async d=>{let l=d.document.uri.toString();this._pendingTextDocumentChanges.set(l,d.document),this._onPendingChangeAdded.fire()};i.push(s.didChange?s.didChange(e,d=>c(d)):c(e))}}return Promise.all(i).then(void 0,r=>{throw this._client.error(`Sending document notification ${Z.DidChangeTextDocumentNotification.type.method} failed`,r),r})}notificationSent(e,t,n){this._onNotificationSent.fire({textDocument:e,type:t,params:n})}unregister(e){if(this._changeData.delete(e),this._changeData.size===0)this._listener&&(this._listener.dispose(),this._listener=void 0),this._syncKind=Z.TextDocumentSyncKind.None;else{this._syncKind=Z.TextDocumentSyncKind.None;for(let t of this._changeData.values())if(this.updateSyncKind(t.syncKind),this._syncKind===Z.TextDocumentSyncKind.Full)break}}clear(){this._pendingTextDocumentChanges.clear(),this._changeData.clear(),this._syncKind=Z.TextDocumentSyncKind.None,this._listener&&(this._listener.dispose(),this._listener=void 0)}getPendingDocumentChanges(e){if(this._pendingTextDocumentChanges.size===0)return[];let t;if(e.size===0)t=Array.from(this._pendingTextDocumentChanges.values()),this._pendingTextDocumentChanges.clear();else{t=[];for(let n of this._pendingTextDocumentChanges)e.has(n[0])||(t.push(n[1]),this._pendingTextDocumentChanges.delete(n[0]))}return t}getProvider(e){for(let t of this._changeData.values())if(Re.languages.match(t.documentSelector,e)>0)return{send:n=>this.callback(n)}}updateSyncKind(e){if(this._syncKind!==Z.TextDocumentSyncKind.Full)switch(e){case Z.TextDocumentSyncKind.Full:this._syncKind=e;break;case Z.TextDocumentSyncKind.Incremental:this._syncKind===Z.TextDocumentSyncKind.None&&(this._syncKind=Z.TextDocumentSyncKind.Incremental);break}}};be.DidChangeTextDocumentFeature=Es;var Ms=class extends ie.TextDocumentEventFeature{constructor(e){super(e,Re.workspace.onWillSaveTextDocument,Z.WillSaveTextDocumentNotification.type,()=>e.middleware.willSave,t=>e.code2ProtocolConverter.asWillSaveTextDocumentParams(t),t=>t.document,(t,n)=>ie.TextDocumentEventFeature.textDocumentFilter(t,n.document))}get registrationType(){return Z.WillSaveTextDocumentNotification.type}fillClientCapabilities(e){let t=(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization");t.willSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSave&&this.register({id:$t.generateUuid(),registerOptions:{documentSelector:t}})}getTextDocument(e){return e.document}};be.WillSaveFeature=Ms;var As=class extends ie.DynamicDocumentFeature{constructor(e){super(e),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return Z.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(e){let t=(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization");t.willSaveWaitUntil=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSaveWaitUntil&&this.register({id:$t.generateUuid(),registerOptions:{documentSelector:t}})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Re.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}callback(e){if(ie.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),e.document)&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let t=this._client.middleware,n=i=>this._client.sendRequest(Z.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async r=>{let s=await this._client.protocol2CodeConverter.asTextEdits(r);return s===void 0?[]:s});e.waitUntil(t.willSaveWaitUntil?t.willSaveWaitUntil(e,n):n(e))}}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}};be.WillSaveWaitUntilFeature=As;var Os=class extends ie.TextDocumentEventFeature{constructor(e){super(e,Re.workspace.onDidSaveTextDocument,Z.DidSaveTextDocumentNotification.type,()=>e.middleware.didSave,t=>e.code2ProtocolConverter.asSaveTextDocumentParams(t,this._includeText),t=>t,ie.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return Z.DidSaveTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").didSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;if(t&&n&&n.save){let i=typeof n.save=="boolean"?{includeText:!1}:{includeText:!!n.save.includeText};this.register({id:$t.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},i)})}}register(e){this._includeText=!!e.registerOptions.includeText,super.register(e)}getTextDocument(e){return e}};be.DidSaveTextDocumentFeature=Os});var lc=F(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.CompletionItemFeature=void 0;var qu=I("vscode"),K=L(),Ls=W(),Iu=te(),Eu=[K.CompletionItemKind.Text,K.CompletionItemKind.Method,K.CompletionItemKind.Function,K.CompletionItemKind.Constructor,K.CompletionItemKind.Field,K.CompletionItemKind.Variable,K.CompletionItemKind.Class,K.CompletionItemKind.Interface,K.CompletionItemKind.Module,K.CompletionItemKind.Property,K.CompletionItemKind.Unit,K.CompletionItemKind.Value,K.CompletionItemKind.Enum,K.CompletionItemKind.Keyword,K.CompletionItemKind.Snippet,K.CompletionItemKind.Color,K.CompletionItemKind.File,K.CompletionItemKind.Reference,K.CompletionItemKind.Folder,K.CompletionItemKind.EnumMember,K.CompletionItemKind.Constant,K.CompletionItemKind.Struct,K.CompletionItemKind.Event,K.CompletionItemKind.Operator,K.CompletionItemKind.TypeParameter],Us=class extends Ls.TextDocumentLanguageFeature{constructor(e){super(e,K.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(e){let t=(0,Ls.ensure)((0,Ls.ensure)(e,"textDocument"),"completion");t.dynamicRegistration=!0,t.contextSupport=!0,t.completionItem={snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[K.MarkupKind.Markdown,K.MarkupKind.PlainText],deprecatedSupport:!0,preselectSupport:!0,tagSupport:{valueSet:[K.CompletionItemTag.Deprecated]},insertReplaceSupport:!0,resolveSupport:{properties:["documentation","detail","additionalTextEdits"]},insertTextModeSupport:{valueSet:[K.InsertTextMode.asIs,K.InsertTextMode.adjustIndentation]},labelDetailsSupport:!0},t.insertTextMode=K.InsertTextMode.adjustIndentation,t.completionItemKind={valueSet:Eu},t.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode","data"]}}initialize(e,t){let n=this.getRegistrationOptions(t,e.completionProvider);n&&this.register({id:Iu.generateUuid(),registerOptions:n})}registerLanguageProvider(e,t){this.labelDetailsSupport.set(t,!!e.completionItem?.labelDetailsSupport);let n=e.triggerCharacters??[],i=e.allCommitCharacters,r=e.documentSelector,s={provideCompletionItems:(c,d,l,g)=>{let h=this._client,f=this._client.middleware,v=(p,y,C,b)=>h.sendRequest(K.CompletionRequest.type,h.code2ProtocolConverter.asCompletionParams(p,y,C),b).then(T=>b.isCancellationRequested?null:h.protocol2CodeConverter.asCompletionResult(T,i,b),T=>h.handleFailedRequest(K.CompletionRequest.type,b,T,null));return f.provideCompletionItem?f.provideCompletionItem(c,d,g,l,v):v(c,d,g,l)},resolveCompletionItem:e.resolveProvider?(c,d)=>{let l=this._client,g=this._client.middleware,h=(f,v)=>l.sendRequest(K.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(f,!!this.labelDetailsSupport.get(t)),v).then(p=>v.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(p),p=>l.handleFailedRequest(K.CompletionResolveRequest.type,v,p,f));return g.resolveCompletionItem?g.resolveCompletionItem(c,d,h):h(c,d)}:void 0};return[qu.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(r),s,...n),s]}};yi.CompletionItemFeature=Us});var pc=F(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.HoverFeature=void 0;var Mu=I("vscode"),hn=L(),Ns=W(),Au=te(),Hs=class extends Ns.TextDocumentLanguageFeature{constructor(e){super(e,hn.HoverRequest.type)}fillClientCapabilities(e){let t=(0,Ns.ensure)((0,Ns.ensure)(e,"textDocument"),"hover");t.dynamicRegistration=!0,t.contentFormat=[hn.MarkupKind.Markdown,hn.MarkupKind.PlainText]}initialize(e,t){let n=this.getRegistrationOptions(t,e.hoverProvider);n&&this.register({id:Au.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideHover:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(hn.HoverRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asHover(v),v=>c.handleFailedRequest(hn.HoverRequest.type,f,v,null)),l=c.middleware;return l.provideHover?l.provideHover(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Mu.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ci.HoverFeature=Hs});var fc=F(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.DefinitionFeature=void 0;var Ou=I("vscode"),Ks=L(),js=W(),Lu=te(),Ws=class extends js.TextDocumentLanguageFeature{constructor(e){super(e,Ks.DefinitionRequest.type)}fillClientCapabilities(e){let t=(0,js.ensure)((0,js.ensure)(e,"textDocument"),"definition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.definitionProvider);n&&this.register({id:Lu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDefinition:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(Ks.DefinitionRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,f),v=>c.handleFailedRequest(Ks.DefinitionRequest.type,f,v,null)),l=c.middleware;return l.provideDefinition?l.provideDefinition(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Ou.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};wi.DefinitionFeature=Ws});var gc=F(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.SignatureHelpFeature=void 0;var hc=I("vscode"),gn=L(),$s=W(),Uu=te(),zs=class extends $s.TextDocumentLanguageFeature{constructor(e){super(e,gn.SignatureHelpRequest.type)}fillClientCapabilities(e){let t=(0,$s.ensure)((0,$s.ensure)(e,"textDocument"),"signatureHelp");t.dynamicRegistration=!0,t.signatureInformation={documentationFormat:[gn.MarkupKind.Markdown,gn.MarkupKind.PlainText]},t.signatureInformation.parameterInformation={labelOffsetSupport:!0},t.signatureInformation.activeParameterSupport=!0,t.contextSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.signatureHelpProvider);n&&this.register({id:Uu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t={provideSignatureHelp:(n,i,r,s)=>{let c=this._client,d=(g,h,f,v)=>c.sendRequest(gn.SignatureHelpRequest.type,c.code2ProtocolConverter.asSignatureHelpParams(g,h,f),v).then(p=>v.isCancellationRequested?null:c.protocol2CodeConverter.asSignatureHelp(p,v),p=>c.handleFailedRequest(gn.SignatureHelpRequest.type,v,p,null)),l=c.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(n,i,s,r,d):d(n,i,s,r)}};return[this.registerProvider(e,t),t]}registerProvider(e,t){let n=this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector);if(e.retriggerCharacters===void 0){let i=e.triggerCharacters||[];return hc.languages.registerSignatureHelpProvider(n,t,...i)}else{let i={triggerCharacters:e.triggerCharacters||[],retriggerCharacters:e.retriggerCharacters||[]};return hc.languages.registerSignatureHelpProvider(n,t,i)}}};Di.SignatureHelpFeature=zs});var mc=F(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.DocumentHighlightFeature=void 0;var Nu=I("vscode"),Vs=L(),Bs=W(),Hu=te(),Ys=class extends Bs.TextDocumentLanguageFeature{constructor(e){super(e,Vs.DocumentHighlightRequest.type)}fillClientCapabilities(e){(0,Bs.ensure)((0,Bs.ensure)(e,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentHighlightProvider);n&&this.register({id:Hu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentHighlights:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(Vs.DocumentHighlightRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDocumentHighlights(v,f),v=>c.handleFailedRequest(Vs.DocumentHighlightRequest.type,f,v,null)),l=c.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,r,s,d):d(i,r,s)}};return[Nu.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Si.DocumentHighlightFeature=Ys});var Gs=F(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.DocumentSymbolFeature=Ye.SupportedSymbolTags=Ye.SupportedSymbolKinds=void 0;var Ku=I("vscode"),z=L(),Js=W(),ju=te();Ye.SupportedSymbolKinds=[z.SymbolKind.File,z.SymbolKind.Module,z.SymbolKind.Namespace,z.SymbolKind.Package,z.SymbolKind.Class,z.SymbolKind.Method,z.SymbolKind.Property,z.SymbolKind.Field,z.SymbolKind.Constructor,z.SymbolKind.Enum,z.SymbolKind.Interface,z.SymbolKind.Function,z.SymbolKind.Variable,z.SymbolKind.Constant,z.SymbolKind.String,z.SymbolKind.Number,z.SymbolKind.Boolean,z.SymbolKind.Array,z.SymbolKind.Object,z.SymbolKind.Key,z.SymbolKind.Null,z.SymbolKind.EnumMember,z.SymbolKind.Struct,z.SymbolKind.Event,z.SymbolKind.Operator,z.SymbolKind.TypeParameter];Ye.SupportedSymbolTags=[z.SymbolTag.Deprecated];var Qs=class extends Js.TextDocumentLanguageFeature{constructor(e){super(e,z.DocumentSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Js.ensure)((0,Js.ensure)(e,"textDocument"),"documentSymbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Ye.SupportedSymbolKinds},t.hierarchicalDocumentSymbolSupport=!0,t.tagSupport={valueSet:Ye.SupportedSymbolTags},t.labelSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentSymbolProvider);n&&this.register({id:ju.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentSymbols:(r,s)=>{let c=this._client,d=async(g,h)=>{try{let f=await c.sendRequest(z.DocumentSymbolRequest.type,c.code2ProtocolConverter.asDocumentSymbolParams(g),h);if(h.isCancellationRequested||f===void 0||f===null)return null;if(f.length===0)return[];{let v=f[0];return z.DocumentSymbol.is(v)?await c.protocol2CodeConverter.asDocumentSymbols(f,h):await c.protocol2CodeConverter.asSymbolInformations(f,h)}}catch(f){return c.handleFailedRequest(z.DocumentSymbolRequest.type,h,f,null)}},l=c.middleware;return l.provideDocumentSymbols?l.provideDocumentSymbols(r,s,d):d(r,s)}},i=e.label!==void 0?{label:e.label}:void 0;return[Ku.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,i),n]}};Ye.DocumentSymbolFeature=Qs});var yc=F(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.WorkspaceSymbolFeature=void 0;var Wu=I("vscode"),mn=L(),Zs=W(),vc=Gs(),$u=te(),Xs=class extends Zs.WorkspaceFeature{constructor(e){super(e,mn.WorkspaceSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Zs.ensure)((0,Zs.ensure)(e,"workspace"),"symbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:vc.SupportedSymbolKinds},t.tagSupport={valueSet:vc.SupportedSymbolTags},t.resolveSupport={properties:["location.range"]}}initialize(e){e.workspaceSymbolProvider&&this.register({id:$u.generateUuid(),registerOptions:e.workspaceSymbolProvider===!0?{workDoneProgress:!1}:e.workspaceSymbolProvider})}registerLanguageProvider(e){let t={provideWorkspaceSymbols:(n,i)=>{let r=this._client,s=(d,l)=>r.sendRequest(mn.WorkspaceSymbolRequest.type,{query:d},l).then(g=>l.isCancellationRequested?null:r.protocol2CodeConverter.asSymbolInformations(g,l),g=>r.handleFailedRequest(mn.WorkspaceSymbolRequest.type,l,g,null)),c=r.middleware;return c.provideWorkspaceSymbols?c.provideWorkspaceSymbols(n,i,s):s(n,i)},resolveWorkspaceSymbol:e.resolveProvider===!0?(n,i)=>{let r=this._client,s=(d,l)=>r.sendRequest(mn.WorkspaceSymbolResolveRequest.type,r.code2ProtocolConverter.asWorkspaceSymbol(d),l).then(g=>l.isCancellationRequested?null:r.protocol2CodeConverter.asSymbolInformation(g),g=>r.handleFailedRequest(mn.WorkspaceSymbolResolveRequest.type,l,g,null)),c=r.middleware;return c.resolveWorkspaceSymbol?c.resolveWorkspaceSymbol(n,i,s):s(n,i)}:void 0};return[Wu.languages.registerWorkspaceSymbolProvider(t),t]}};bi.WorkspaceSymbolFeature=Xs});var Cc=F(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.ReferencesFeature=void 0;var zu=I("vscode"),eo=L(),to=W(),Vu=te(),no=class extends to.TextDocumentLanguageFeature{constructor(e){super(e,eo.ReferencesRequest.type)}fillClientCapabilities(e){(0,to.ensure)((0,to.ensure)(e,"textDocument"),"references").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.referencesProvider);n&&this.register({id:Vu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideReferences:(i,r,s,c)=>{let d=this._client,l=(h,f,v,p)=>d.sendRequest(eo.ReferencesRequest.type,d.code2ProtocolConverter.asReferenceParams(h,f,v),p).then(y=>p.isCancellationRequested?null:d.protocol2CodeConverter.asReferences(y,p),y=>d.handleFailedRequest(eo.ReferencesRequest.type,p,y,null)),g=d.middleware;return g.provideReferences?g.provideReferences(i,r,s,c,l):l(i,r,s,c)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return zu.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};_i.ReferencesFeature=no});var wc=F(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.CodeActionFeature=void 0;var Bu=I("vscode"),xe=L(),Yu=te(),io=W(),ro=class extends io.TextDocumentLanguageFeature{constructor(e){super(e,xe.CodeActionRequest.type)}fillClientCapabilities(e){let t=(0,io.ensure)((0,io.ensure)(e,"textDocument"),"codeAction");t.dynamicRegistration=!0,t.isPreferredSupport=!0,t.disabledSupport=!0,t.dataSupport=!0,t.resolveSupport={properties:["edit"]},t.codeActionLiteralSupport={codeActionKind:{valueSet:[xe.CodeActionKind.Empty,xe.CodeActionKind.QuickFix,xe.CodeActionKind.Refactor,xe.CodeActionKind.RefactorExtract,xe.CodeActionKind.RefactorInline,xe.CodeActionKind.RefactorRewrite,xe.CodeActionKind.Source,xe.CodeActionKind.SourceOrganizeImports]}},t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.codeActionProvider);n&&this.register({id:Yu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideCodeActions:(i,r,s,c)=>{let d=this._client,l=async(h,f,v,p)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),range:d.code2ProtocolConverter.asRange(f),context:d.code2ProtocolConverter.asCodeActionContextSync(v)};return d.sendRequest(xe.CodeActionRequest.type,y,p).then(C=>p.isCancellationRequested||C===null||C===void 0?null:d.protocol2CodeConverter.asCodeActionResult(C,p),C=>d.handleFailedRequest(xe.CodeActionRequest.type,p,C,null))},g=d.middleware;return g.provideCodeActions?g.provideCodeActions(i,r,s,c,l):l(i,r,s,c)},resolveCodeAction:e.resolveProvider?(i,r)=>{let s=this._client,c=this._client.middleware,d=async(l,g)=>s.sendRequest(xe.CodeActionResolveRequest.type,s.code2ProtocolConverter.asCodeActionSync(l),g).then(h=>g.isCancellationRequested?l:s.protocol2CodeConverter.asCodeAction(h,g),h=>s.handleFailedRequest(xe.CodeActionResolveRequest.type,g,h,l));return c.resolveCodeAction?c.resolveCodeAction(i,r,d):d(i,r)}:void 0};return[Bu.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.codeActionKinds?{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(e.codeActionKinds)}:void 0),n]}};Ti.CodeActionFeature=ro});var Sc=F(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.CodeLensFeature=void 0;var Dc=I("vscode"),zt=L(),Ju=te(),vn=W(),so=class extends vn.TextDocumentLanguageFeature{constructor(e){super(e,zt.CodeLensRequest.type)}fillClientCapabilities(e){(0,vn.ensure)((0,vn.ensure)(e,"textDocument"),"codeLens").dynamicRegistration=!0,(0,vn.ensure)((0,vn.ensure)(e,"workspace"),"codeLens").refreshSupport=!0}initialize(e,t){this._client.onRequest(zt.CodeLensRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeCodeLensEmitter.fire()});let i=this.getRegistrationOptions(t,e.codeLensProvider);i&&this.register({id:Ju.generateUuid(),registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Dc.EventEmitter,i={onDidChangeCodeLenses:n.event,provideCodeLenses:(r,s)=>{let c=this._client,d=(g,h)=>c.sendRequest(zt.CodeLensRequest.type,c.code2ProtocolConverter.asCodeLensParams(g),h).then(f=>h.isCancellationRequested?null:c.protocol2CodeConverter.asCodeLenses(f,h),f=>c.handleFailedRequest(zt.CodeLensRequest.type,h,f,null)),l=c.middleware;return l.provideCodeLenses?l.provideCodeLenses(r,s,d):d(r,s)},resolveCodeLens:e.resolveProvider?(r,s)=>{let c=this._client,d=(g,h)=>c.sendRequest(zt.CodeLensResolveRequest.type,c.code2ProtocolConverter.asCodeLens(g),h).then(f=>h.isCancellationRequested?g:c.protocol2CodeConverter.asCodeLens(f),f=>c.handleFailedRequest(zt.CodeLensResolveRequest.type,h,f,g)),l=c.middleware;return l.resolveCodeLens?l.resolveCodeLens(r,s,d):d(r,s)}:void 0};return[Dc.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeCodeLensEmitter:n}]}};ki.CodeLensFeature=so});var bc=F(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.DocumentOnTypeFormattingFeature=gt.DocumentRangeFormattingFeature=gt.DocumentFormattingFeature=void 0;var Pi=I("vscode"),He=L(),uo=te(),tt=W(),Vt;(function(a){function e(t){let n=Pi.workspace.getConfiguration("files",t);return{trimTrailingWhitespace:n.get("trimTrailingWhitespace"),trimFinalNewlines:n.get("trimFinalNewlines"),insertFinalNewline:n.get("insertFinalNewline")}}a.fromConfiguration=e})(Vt||(Vt={}));var oo=class extends tt.TextDocumentLanguageFeature{constructor(e){super(e,He.DocumentFormattingRequest.type)}fillClientCapabilities(e){(0,tt.ensure)((0,tt.ensure)(e,"textDocument"),"formatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentFormattingProvider);n&&this.register({id:uo.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentFormattingEdits:(i,r,s)=>{let c=this._client,d=(g,h,f)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),options:c.code2ProtocolConverter.asFormattingOptions(h,Vt.fromConfiguration(g))};return c.sendRequest(He.DocumentFormattingRequest.type,v,f).then(p=>f.isCancellationRequested?null:c.protocol2CodeConverter.asTextEdits(p,f),p=>c.handleFailedRequest(He.DocumentFormattingRequest.type,f,p,null))},l=c.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,r,s,d):d(i,r,s)}};return[Pi.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};gt.DocumentFormattingFeature=oo;var ao=class extends tt.TextDocumentLanguageFeature{constructor(e){super(e,He.DocumentRangeFormattingRequest.type)}fillClientCapabilities(e){let t=(0,tt.ensure)((0,tt.ensure)(e,"textDocument"),"rangeFormatting");t.dynamicRegistration=!0,t.rangesSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentRangeFormattingProvider);n&&this.register({id:uo.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentRangeFormattingEdits:(i,r,s,c)=>{let d=this._client,l=(h,f,v,p)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),range:d.code2ProtocolConverter.asRange(f),options:d.code2ProtocolConverter.asFormattingOptions(v,Vt.fromConfiguration(h))};return d.sendRequest(He.DocumentRangeFormattingRequest.type,y,p).then(C=>p.isCancellationRequested?null:d.protocol2CodeConverter.asTextEdits(C,p),C=>d.handleFailedRequest(He.DocumentRangeFormattingRequest.type,p,C,null))},g=d.middleware;return g.provideDocumentRangeFormattingEdits?g.provideDocumentRangeFormattingEdits(i,r,s,c,l):l(i,r,s,c)}};return e.rangesSupport&&(n.provideDocumentRangesFormattingEdits=(i,r,s,c)=>{let d=this._client,l=(h,f,v,p)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),ranges:d.code2ProtocolConverter.asRanges(f),options:d.code2ProtocolConverter.asFormattingOptions(v,Vt.fromConfiguration(h))};return d.sendRequest(He.DocumentRangesFormattingRequest.type,y,p).then(C=>p.isCancellationRequested?null:d.protocol2CodeConverter.asTextEdits(C,p),C=>d.handleFailedRequest(He.DocumentRangesFormattingRequest.type,p,C,null))},g=d.middleware;return g.provideDocumentRangesFormattingEdits?g.provideDocumentRangesFormattingEdits(i,r,s,c,l):l(i,r,s,c)}),[Pi.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};gt.DocumentRangeFormattingFeature=ao;var co=class extends tt.TextDocumentLanguageFeature{constructor(e){super(e,He.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(e){(0,tt.ensure)((0,tt.ensure)(e,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentOnTypeFormattingProvider);n&&this.register({id:uo.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideOnTypeFormattingEdits:(r,s,c,d,l)=>{let g=this._client,h=(v,p,y,C,b)=>{let T={textDocument:g.code2ProtocolConverter.asTextDocumentIdentifier(v),position:g.code2ProtocolConverter.asPosition(p),ch:y,options:g.code2ProtocolConverter.asFormattingOptions(C,Vt.fromConfiguration(v))};return g.sendRequest(He.DocumentOnTypeFormattingRequest.type,T,b).then(P=>b.isCancellationRequested?null:g.protocol2CodeConverter.asTextEdits(P,b),P=>g.handleFailedRequest(He.DocumentOnTypeFormattingRequest.type,b,P,null))},f=g.middleware;return f.provideOnTypeFormattingEdits?f.provideOnTypeFormattingEdits(r,s,c,d,l,h):h(r,s,c,d,l)}},i=e.moreTriggerCharacter||[];return[Pi.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.firstTriggerCharacter,...i),n]}};gt.DocumentOnTypeFormattingFeature=co});var Tc=F(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.RenameFeature=void 0;var Qu=I("vscode"),Tt=L(),Gu=te(),_c=Ie(),lo=W(),po=class extends lo.TextDocumentLanguageFeature{constructor(e){super(e,Tt.RenameRequest.type)}fillClientCapabilities(e){let t=(0,lo.ensure)((0,lo.ensure)(e,"textDocument"),"rename");t.dynamicRegistration=!0,t.prepareSupport=!0,t.prepareSupportDefaultBehavior=Tt.PrepareSupportDefaultBehavior.Identifier,t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.renameProvider);n&&(_c.boolean(e.renameProvider)&&(n.prepareProvider=!1),this.register({id:Gu.generateUuid(),registerOptions:n}))}registerLanguageProvider(e){let t=e.documentSelector,n={provideRenameEdits:(i,r,s,c)=>{let d=this._client,l=(h,f,v,p)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),position:d.code2ProtocolConverter.asPosition(f),newName:v};return d.sendRequest(Tt.RenameRequest.type,y,p).then(C=>p.isCancellationRequested?null:d.protocol2CodeConverter.asWorkspaceEdit(C,p),C=>d.handleFailedRequest(Tt.RenameRequest.type,p,C,null,!1))},g=d.middleware;return g.provideRenameEdits?g.provideRenameEdits(i,r,s,c,l):l(i,r,s,c)},prepareRename:e.prepareProvider?(i,r,s)=>{let c=this._client,d=(g,h,f)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),position:c.code2ProtocolConverter.asPosition(h)};return c.sendRequest(Tt.PrepareRenameRequest.type,v,f).then(p=>f.isCancellationRequested?null:Tt.Range.is(p)?c.protocol2CodeConverter.asRange(p):this.isDefaultBehavior(p)?p.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):p&&Tt.Range.is(p.range)?{range:c.protocol2CodeConverter.asRange(p.range),placeholder:p.placeholder}:Promise.reject(new Error("The element can't be renamed.")),p=>{throw typeof p.message=="string"?new Error(p.message):new Error("The element can't be renamed.")})},l=c.middleware;return l.prepareRename?l.prepareRename(i,r,s,d):d(i,r,s)}:void 0};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Qu.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}isDefaultBehavior(e){let t=e;return t&&_c.boolean(t.defaultBehavior)}};Ri.RenameFeature=po});var kc=F(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.DocumentLinkFeature=void 0;var Zu=I("vscode"),yn=L(),fo=W(),Xu=te(),ho=class extends fo.TextDocumentLanguageFeature{constructor(e){super(e,yn.DocumentLinkRequest.type)}fillClientCapabilities(e){let t=(0,fo.ensure)((0,fo.ensure)(e,"textDocument"),"documentLink");t.dynamicRegistration=!0,t.tooltipSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentLinkProvider);n&&this.register({id:Xu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentLinks:(i,r)=>{let s=this._client,c=(l,g)=>s.sendRequest(yn.DocumentLinkRequest.type,s.code2ProtocolConverter.asDocumentLinkParams(l),g).then(h=>g.isCancellationRequested?null:s.protocol2CodeConverter.asDocumentLinks(h,g),h=>s.handleFailedRequest(yn.DocumentLinkRequest.type,g,h,null)),d=s.middleware;return d.provideDocumentLinks?d.provideDocumentLinks(i,r,c):c(i,r)},resolveDocumentLink:e.resolveProvider?(i,r)=>{let s=this._client,c=(l,g)=>s.sendRequest(yn.DocumentLinkResolveRequest.type,s.code2ProtocolConverter.asDocumentLink(l),g).then(h=>g.isCancellationRequested?l:s.protocol2CodeConverter.asDocumentLink(h),h=>s.handleFailedRequest(yn.DocumentLinkResolveRequest.type,g,h,l)),d=s.middleware;return d.resolveDocumentLink?d.resolveDocumentLink(i,r,c):c(i,r)}:void 0};return[Zu.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};xi.DocumentLinkFeature=ho});var Rc=F(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.ExecuteCommandFeature=void 0;var el=I("vscode"),go=L(),tl=te(),Pc=W(),mo=class{constructor(e){this._client=e,this._commands=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._commands.size>0}}get registrationType(){return go.ExecuteCommandRequest.type}fillClientCapabilities(e){(0,Pc.ensure)((0,Pc.ensure)(e,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(e){e.executeCommandProvider&&this.register({id:tl.generateUuid(),registerOptions:Object.assign({},e.executeCommandProvider)})}register(e){let t=this._client,n=t.middleware,i=(r,s)=>{let c={command:r,arguments:s};return t.sendRequest(go.ExecuteCommandRequest.type,c).then(void 0,d=>t.handleFailedRequest(go.ExecuteCommandRequest.type,void 0,d,void 0))};if(e.registerOptions.commands){let r=[];for(let s of e.registerOptions.commands)r.push(el.commands.registerCommand(s,(...c)=>n.executeCommand?n.executeCommand(s,c,i):i(s,c)));this._commands.set(e.id,r)}}unregister(e){let t=this._commands.get(e);t&&t.forEach(n=>n.dispose())}clear(){this._commands.forEach(e=>{e.forEach(t=>t.dispose())}),this._commands.clear()}};Fi.ExecuteCommandFeature=mo});var xc=F(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.FileSystemWatcherFeature=void 0;var nl=I("vscode"),kt=L(),qi=W(),vo=class{constructor(e,t){this._client=e,this._notifyFileEvent=t,this._watchers=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._watchers.size>0}}get registrationType(){return kt.DidChangeWatchedFilesNotification.type}fillClientCapabilities(e){(0,qi.ensure)((0,qi.ensure)(e,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,qi.ensure)((0,qi.ensure)(e,"workspace"),"didChangeWatchedFiles").relativePatternSupport=!0}initialize(e,t){}register(e){if(!Array.isArray(e.registerOptions.watchers))return;let t=[];for(let n of e.registerOptions.watchers){let i=this._client.protocol2CodeConverter.asGlobPattern(n.globPattern);if(i===void 0)continue;let r=!0,s=!0,c=!0;n.kind!==void 0&&n.kind!==null&&(r=(n.kind&kt.WatchKind.Create)!==0,s=(n.kind&kt.WatchKind.Change)!==0,c=(n.kind&kt.WatchKind.Delete)!==0);let d=nl.workspace.createFileSystemWatcher(i,!r,!s,!c);this.hookListeners(d,r,s,c,t),t.push(d)}this._watchers.set(e.id,t)}registerRaw(e,t){let n=[];for(let i of t)this.hookListeners(i,!0,!0,!0,n);this._watchers.set(e,n)}hookListeners(e,t,n,i,r){t&&e.onDidCreate(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:kt.FileChangeType.Created}),null,r),n&&e.onDidChange(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:kt.FileChangeType.Changed}),null,r),i&&e.onDidDelete(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:kt.FileChangeType.Deleted}),null,r)}unregister(e){let t=this._watchers.get(e);if(t)for(let n of t)n.dispose()}clear(){this._watchers.forEach(e=>{for(let t of e)t.dispose()}),this._watchers.clear()}};Ii.FileSystemWatcherFeature=vo});var Fc=F(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.ColorProviderFeature=void 0;var il=I("vscode"),Cn=L(),yo=W(),Co=class extends yo.TextDocumentLanguageFeature{constructor(e){super(e,Cn.DocumentColorRequest.type)}fillClientCapabilities(e){(0,yo.ensure)((0,yo.ensure)(e,"textDocument"),"colorProvider").dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.colorProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideColorPresentations:(i,r,s)=>{let c=this._client,d=(g,h,f)=>{let v={color:g,textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(h.document),range:c.code2ProtocolConverter.asRange(h.range)};return c.sendRequest(Cn.ColorPresentationRequest.type,v,f).then(p=>f.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(p,f),p=>c.handleFailedRequest(Cn.ColorPresentationRequest.type,f,p,null))},l=c.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,r,s,d):d(i,r,s)},provideDocumentColors:(i,r)=>{let s=this._client,c=(l,g)=>{let h={textDocument:s.code2ProtocolConverter.asTextDocumentIdentifier(l)};return s.sendRequest(Cn.DocumentColorRequest.type,h,g).then(f=>g.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(f,g),f=>s.handleFailedRequest(Cn.DocumentColorRequest.type,g,f,null))},d=s.middleware;return d.provideDocumentColors?d.provideDocumentColors(i,r,c):c(i,r)}};return[il.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Ei.ColorProviderFeature=Co});var qc=F(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.ImplementationFeature=void 0;var rl=I("vscode"),wo=L(),Do=W(),So=class extends Do.TextDocumentLanguageFeature{constructor(e){super(e,wo.ImplementationRequest.type)}fillClientCapabilities(e){let t=(0,Do.ensure)((0,Do.ensure)(e,"textDocument"),"implementation");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.implementationProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideImplementation:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(wo.ImplementationRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,f),v=>c.handleFailedRequest(wo.ImplementationRequest.type,f,v,null)),l=c.middleware;return l.provideImplementation?l.provideImplementation(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return rl.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Mi.ImplementationFeature=So});var Ic=F(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.TypeDefinitionFeature=void 0;var sl=I("vscode"),bo=L(),wn=W(),_o=class extends wn.TextDocumentLanguageFeature{constructor(e){super(e,bo.TypeDefinitionRequest.type)}fillClientCapabilities(e){(0,wn.ensure)((0,wn.ensure)(e,"textDocument"),"typeDefinition").dynamicRegistration=!0;let t=(0,wn.ensure)((0,wn.ensure)(e,"textDocument"),"typeDefinition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.typeDefinitionProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideTypeDefinition:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(bo.TypeDefinitionRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,f),v=>c.handleFailedRequest(bo.TypeDefinitionRequest.type,f,v,null)),l=c.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return sl.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ai.TypeDefinitionFeature=_o});var Ec=F(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.WorkspaceFoldersFeature=Bt.arrayDiff=void 0;var ol=te(),Oi=I("vscode"),Dn=L();function To(a,e){if(a!=null)return a[e]}function ko(a,e){return a.filter(t=>e.indexOf(t)<0)}Bt.arrayDiff=ko;var Po=class{constructor(e){this._client=e,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return Dn.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(e){let t=Oi.workspace.workspaceFolders;this.initializeWithFolders(t),t===void 0?e.workspaceFolders=null:e.workspaceFolders=t.map(n=>this.asProtocol(n))}initializeWithFolders(e){this._initialFolders=e}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.workspaceFolders=!0}initialize(e){let t=this._client;t.onRequest(Dn.WorkspaceFoldersRequest.type,r=>{let s=()=>{let d=Oi.workspace.workspaceFolders;return d===void 0?null:d.map(g=>this.asProtocol(g))},c=t.middleware.workspace;return c&&c.workspaceFolders?c.workspaceFolders(r,s):s(r)});let n=To(To(To(e,"workspace"),"workspaceFolders"),"changeNotifications"),i;typeof n=="string"?i=n:n===!0&&(i=ol.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(e){let t;if(this._initialFolders&&e){let n=ko(this._initialFolders,e),i=ko(e,this._initialFolders);(i.length>0||n.length>0)&&(t=this.doSendEvent(i,n))}else this._initialFolders?t=this.doSendEvent([],this._initialFolders):e&&(t=this.doSendEvent(e,[]));t!==void 0&&t.catch(n=>{this._client.error(`Sending notification ${Dn.DidChangeWorkspaceFoldersNotification.type.method} failed`,n)})}doSendEvent(e,t){let n={event:{added:e.map(i=>this.asProtocol(i)),removed:t.map(i=>this.asProtocol(i))}};return this._client.sendNotification(Dn.DidChangeWorkspaceFoldersNotification.type,n)}register(e){let t=e.id,n=this._client,i=Oi.workspace.onDidChangeWorkspaceFolders(r=>{let s=l=>this.doSendEvent(l.added,l.removed),c=n.middleware.workspace;(c&&c.didChangeWorkspaceFolders?c.didChangeWorkspaceFolders(r,s):s(r)).catch(l=>{this._client.error(`Sending notification ${Dn.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(t,i),this.sendInitialEvent(Oi.workspace.workspaceFolders)}unregister(e){let t=this._listeners.get(e);t!==void 0&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear()}asProtocol(e){return e===void 0?null:{uri:this._client.code2ProtocolConverter.asUri(e.uri),name:e.name}}};Bt.WorkspaceFoldersFeature=Po});var Ac=F(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.FoldingRangeFeature=void 0;var Mc=I("vscode"),Pt=L(),Sn=W(),Ro=class extends Sn.TextDocumentLanguageFeature{constructor(e){super(e,Pt.FoldingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Sn.ensure)((0,Sn.ensure)(e,"textDocument"),"foldingRange");t.dynamicRegistration=!0,t.rangeLimit=5e3,t.lineFoldingOnly=!0,t.foldingRangeKind={valueSet:[Pt.FoldingRangeKind.Comment,Pt.FoldingRangeKind.Imports,Pt.FoldingRangeKind.Region]},t.foldingRange={collapsedText:!1},(0,Sn.ensure)((0,Sn.ensure)(e,"workspace"),"foldingRange").refreshSupport=!0}initialize(e,t){this._client.onRequest(Pt.FoldingRangeRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeFoldingRange.fire()});let[n,i]=this.getRegistration(t,e.foldingRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Mc.EventEmitter,i={onDidChangeFoldingRanges:n.event,provideFoldingRanges:(r,s,c)=>{let d=this._client,l=(h,f,v)=>{let p={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h)};return d.sendRequest(Pt.FoldingRangeRequest.type,p,v).then(y=>v.isCancellationRequested?null:d.protocol2CodeConverter.asFoldingRanges(y,v),y=>d.handleFailedRequest(Pt.FoldingRangeRequest.type,v,y,null))},g=d.middleware;return g.provideFoldingRanges?g.provideFoldingRanges(r,s,c,l):l(r,s,c)}};return[Mc.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeFoldingRange:n}]}};Li.FoldingRangeFeature=Ro});var Oc=F(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.DeclarationFeature=void 0;var al=I("vscode"),xo=L(),Fo=W(),qo=class extends Fo.TextDocumentLanguageFeature{constructor(e){super(e,xo.DeclarationRequest.type)}fillClientCapabilities(e){let t=(0,Fo.ensure)((0,Fo.ensure)(e,"textDocument"),"declaration");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.declarationProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDeclaration:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(xo.DeclarationRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDeclarationResult(v,f),v=>c.handleFailedRequest(xo.DeclarationRequest.type,f,v,null)),l=c.middleware;return l.provideDeclaration?l.provideDeclaration(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return al.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ui.DeclarationFeature=qo});var Lc=F(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.SelectionRangeFeature=void 0;var cl=I("vscode"),Io=L(),Eo=W(),Mo=class extends Eo.TextDocumentLanguageFeature{constructor(e){super(e,Io.SelectionRangeRequest.type)}fillClientCapabilities(e){let t=(0,Eo.ensure)((0,Eo.ensure)(e,"textDocument"),"selectionRange");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.selectionRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideSelectionRanges:(i,r,s)=>{let c=this._client,d=async(g,h,f)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),positions:c.code2ProtocolConverter.asPositionsSync(h,f)};return c.sendRequest(Io.SelectionRangeRequest.type,v,f).then(p=>f.isCancellationRequested?null:c.protocol2CodeConverter.asSelectionRanges(p,f),p=>c.handleFailedRequest(Io.SelectionRangeRequest.type,f,p,null))},l=c.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return cl.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ni.SelectionRangeFeature=Mo});var Nc=F(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.ProgressFeature=void 0;var Uc=L(),dl=fs();function ul(a,e){return a[e]===void 0&&(a[e]=Object.create(null)),a[e]}var Ao=class{constructor(e){this._client=e,this.activeParts=new Set}getState(){return{kind:"window",id:Uc.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(e){ul(e,"window").workDoneProgress=!0}initialize(){let e=this._client,t=i=>{this.activeParts.delete(i)},n=i=>{this.activeParts.add(new dl.ProgressPart(this._client,i.token,t))};e.onRequest(Uc.WorkDoneProgressCreateRequest.type,n)}clear(){for(let e of this.activeParts)e.done();this.activeParts.clear()}};Hi.ProgressFeature=Ao});var Hc=F(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.CallHierarchyFeature=void 0;var ll=I("vscode"),Rt=L(),Oo=W(),Lo=class{constructor(e){this.client=e,this.middleware=e.middleware}prepareCallHierarchy(e,t,n){let i=this.client,r=this.middleware,s=(c,d,l)=>{let g=i.code2ProtocolConverter.asTextDocumentPositionParams(c,d);return i.sendRequest(Rt.CallHierarchyPrepareRequest.type,g,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(h,l),h=>i.handleFailedRequest(Rt.CallHierarchyPrepareRequest.type,l,h,null))};return r.prepareCallHierarchy?r.prepareCallHierarchy(e,t,n,s):s(e,t,n)}provideCallHierarchyIncomingCalls(e,t){let n=this.client,i=this.middleware,r=(s,c)=>{let d={item:n.code2ProtocolConverter.asCallHierarchyItem(s)};return n.sendRequest(Rt.CallHierarchyIncomingCallsRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,c),l=>n.handleFailedRequest(Rt.CallHierarchyIncomingCallsRequest.type,c,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(e,t,r):r(e,t)}provideCallHierarchyOutgoingCalls(e,t){let n=this.client,i=this.middleware,r=(s,c)=>{let d={item:n.code2ProtocolConverter.asCallHierarchyItem(s)};return n.sendRequest(Rt.CallHierarchyOutgoingCallsRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,c),l=>n.handleFailedRequest(Rt.CallHierarchyOutgoingCallsRequest.type,c,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(e,t,r):r(e,t)}},Uo=class extends Oo.TextDocumentLanguageFeature{constructor(e){super(e,Rt.CallHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=e,n=(0,Oo.ensure)((0,Oo.ensure)(t,"textDocument"),"callHierarchy");n.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.callHierarchyProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=this._client,n=new Lo(t);return[ll.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Ki.CallHierarchyFeature=Uo});var Kc=F(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.SemanticTokensFeature=void 0;var ji=I("vscode"),U=L(),bn=W(),pl=Ie(),No=class extends bn.TextDocumentLanguageFeature{constructor(e){super(e,U.SemanticTokensRegistrationType.type)}fillClientCapabilities(e){let t=(0,bn.ensure)((0,bn.ensure)(e,"textDocument"),"semanticTokens");t.dynamicRegistration=!0,t.tokenTypes=[U.SemanticTokenTypes.namespace,U.SemanticTokenTypes.type,U.SemanticTokenTypes.class,U.SemanticTokenTypes.enum,U.SemanticTokenTypes.interface,U.SemanticTokenTypes.struct,U.SemanticTokenTypes.typeParameter,U.SemanticTokenTypes.parameter,U.SemanticTokenTypes.variable,U.SemanticTokenTypes.property,U.SemanticTokenTypes.enumMember,U.SemanticTokenTypes.event,U.SemanticTokenTypes.function,U.SemanticTokenTypes.method,U.SemanticTokenTypes.macro,U.SemanticTokenTypes.keyword,U.SemanticTokenTypes.modifier,U.SemanticTokenTypes.comment,U.SemanticTokenTypes.string,U.SemanticTokenTypes.number,U.SemanticTokenTypes.regexp,U.SemanticTokenTypes.operator,U.SemanticTokenTypes.decorator],t.tokenModifiers=[U.SemanticTokenModifiers.declaration,U.SemanticTokenModifiers.definition,U.SemanticTokenModifiers.readonly,U.SemanticTokenModifiers.static,U.SemanticTokenModifiers.deprecated,U.SemanticTokenModifiers.abstract,U.SemanticTokenModifiers.async,U.SemanticTokenModifiers.modification,U.SemanticTokenModifiers.documentation,U.SemanticTokenModifiers.defaultLibrary],t.formats=[U.TokenFormat.Relative],t.requests={range:!0,full:{delta:!0}},t.multilineTokenSupport=!1,t.overlappingTokenSupport=!1,t.serverCancelSupport=!0,t.augmentsSyntaxTokens=!0,(0,bn.ensure)((0,bn.ensure)(e,"workspace"),"semanticTokens").refreshSupport=!0}initialize(e,t){this._client.onRequest(U.SemanticTokensRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeSemanticTokensEmitter.fire()});let[i,r]=this.getRegistration(t,e.semanticTokensProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(e){let t=e.documentSelector,n=pl.boolean(e.full)?e.full:e.full!==void 0,i=e.full!==void 0&&typeof e.full!="boolean"&&e.full.delta===!0,r=new ji.EventEmitter,s=n?{onDidChangeSemanticTokens:r.event,provideDocumentSemanticTokens:(v,p)=>{let y=this._client,C=y.middleware,b=(T,P)=>{let q={textDocument:y.code2ProtocolConverter.asTextDocumentIdentifier(T)};return y.sendRequest(U.SemanticTokensRequest.type,q,P).then(ce=>P.isCancellationRequested?null:y.protocol2CodeConverter.asSemanticTokens(ce,P),ce=>y.handleFailedRequest(U.SemanticTokensRequest.type,P,ce,null))};return C.provideDocumentSemanticTokens?C.provideDocumentSemanticTokens(v,p,b):b(v,p)},provideDocumentSemanticTokensEdits:i?(v,p,y)=>{let C=this._client,b=C.middleware,T=(P,q,ce)=>{let V={textDocument:C.code2ProtocolConverter.asTextDocumentIdentifier(P),previousResultId:q};return C.sendRequest(U.SemanticTokensDeltaRequest.type,V,ce).then(async X=>ce.isCancellationRequested?null:U.SemanticTokens.is(X)?await C.protocol2CodeConverter.asSemanticTokens(X,ce):await C.protocol2CodeConverter.asSemanticTokensEdits(X,ce),X=>C.handleFailedRequest(U.SemanticTokensDeltaRequest.type,ce,X,null))};return b.provideDocumentSemanticTokensEdits?b.provideDocumentSemanticTokensEdits(v,p,y,T):T(v,p,y)}:void 0}:void 0,d=e.range===!0?{provideDocumentRangeSemanticTokens:(v,p,y)=>{let C=this._client,b=C.middleware,T=(P,q,ce)=>{let V={textDocument:C.code2ProtocolConverter.asTextDocumentIdentifier(P),range:C.code2ProtocolConverter.asRange(q)};return C.sendRequest(U.SemanticTokensRangeRequest.type,V,ce).then(X=>ce.isCancellationRequested?null:C.protocol2CodeConverter.asSemanticTokens(X,ce),X=>C.handleFailedRequest(U.SemanticTokensRangeRequest.type,ce,X,null))};return b.provideDocumentRangeSemanticTokens?b.provideDocumentRangeSemanticTokens(v,p,y,T):T(v,p,y)}}:void 0,l=[],g=this._client,h=g.protocol2CodeConverter.asSemanticTokensLegend(e.legend),f=g.protocol2CodeConverter.asDocumentSelector(t);return s!==void 0&&l.push(ji.languages.registerDocumentSemanticTokensProvider(f,s,h)),d!==void 0&&l.push(ji.languages.registerDocumentRangeSemanticTokensProvider(f,d,h)),[new ji.Disposable(()=>l.forEach(v=>v.dispose())),{range:d,full:s,onDidChangeSemanticTokensEmitter:r}]}};Wi.SemanticTokensFeature=No});var $c=F(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.WillDeleteFilesFeature=_e.WillRenameFilesFeature=_e.WillCreateFilesFeature=_e.DidDeleteFilesFeature=_e.DidRenameFilesFeature=_e.DidCreateFilesFeature=void 0;var Oe=I("vscode"),fl=Dr(),nt=L(),hl=te();function jc(a,e){return a[e]===void 0&&(a[e]={}),a[e]}function gl(a,e){return a[e]}function Wc(a,e,t){a[e]=t}var _n=class a{constructor(e,t,n,i,r){this._client=e,this._event=t,this._registrationType=n,this._clientCapability=i,this._serverCapability=r,this._filters=new Map}getState(){return{kind:"workspace",id:this._registrationType.method,registrations:this._filters.size>0}}filterSize(){return this._filters.size}get registrationType(){return this._registrationType}fillClientCapabilities(e){let t=jc(jc(e,"workspace"),"fileOperations");Wc(t,"dynamicRegistration",!0),Wc(t,this._clientCapability,!0)}initialize(e){let t=e.workspace?.fileOperations,n=t!==void 0?gl(t,this._serverCapability):void 0;if(n?.filters!==void 0)try{this.register({id:hl.generateUuid(),registerOptions:{filters:n.filters}})}catch(i){this._client.warn(`Ignoring invalid glob pattern for ${this._serverCapability} registration: ${i}`)}}register(e){this._listener||(this._listener=this._event(this.send,this));let t=e.registerOptions.filters.map(n=>{let i=new fl.Minimatch(n.pattern.glob,a.asMinimatchOptions(n.pattern.options));if(!i.makeRe())throw new Error(`Invalid pattern ${n.pattern.glob}!`);return{scheme:n.scheme,matcher:i,kind:n.pattern.matches}});this._filters.set(e.id,t)}unregister(e){this._filters.delete(e),this._filters.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._filters.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getFileType(e){return a.getFileType(e)}async filter(e,t){let n=await Promise.all(e.files.map(async r=>{let s=t(r),c=s.fsPath.replace(/\\/g,"/");for(let d of this._filters.values())for(let l of d)if(!(l.scheme!==void 0&&l.scheme!==s.scheme)){if(l.matcher.match(c)){if(l.kind===void 0)return!0;let g=await this.getFileType(s);if(g===void 0)return this._client.error(`Failed to determine file type for ${s.toString()}.`),!0;if(g===Oe.FileType.File&&l.kind===nt.FileOperationPatternKind.file||g===Oe.FileType.Directory&&l.kind===nt.FileOperationPatternKind.folder)return!0}else if(l.kind===nt.FileOperationPatternKind.folder&&await a.getFileType(s)===Oe.FileType.Directory&&l.matcher.match(`${c}/`))return!0}return!1})),i=e.files.filter((r,s)=>n[s]);return{...e,files:i}}static async getFileType(e){try{return(await Oe.workspace.fs.stat(e)).type}catch{return}}static asMinimatchOptions(e){let t={dot:!0};return e?.ignoreCase===!0&&(t.nocase=!0),t}},$i=class extends _n{constructor(e,t,n,i,r,s,c){super(e,t,n,i,r),this._notificationType=n,this._accessUri=s,this._createParams=c}async send(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let n=async i=>this._client.sendNotification(this._notificationType,this._createParams(i));return this.doSend(t,n)}}},zi=class extends $i{constructor(){super(...arguments),this._fsPathFileTypes=new Map}async getFileType(e){let t=e.fsPath;if(this._fsPathFileTypes.has(t))return this._fsPathFileTypes.get(t);let n=await _n.getFileType(e);return n&&this._fsPathFileTypes.set(t,n),n}async cacheFileTypes(e,t){await this.filter(e,t)}clearFileTypeCache(){this._fsPathFileTypes.clear()}unregister(e){super.unregister(e),this.filterSize()===0&&this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}clear(){super.clear(),this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}},Ho=class extends $i{constructor(e){super(e,Oe.workspace.onDidCreateFiles,nt.DidCreateFilesNotification.type,"didCreate","didCreate",t=>t,e.code2ProtocolConverter.asDidCreateFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.didCreateFiles?n.didCreateFiles(e,t):t(e)}};_e.DidCreateFilesFeature=Ho;var Ko=class extends zi{constructor(e){super(e,Oe.workspace.onDidRenameFiles,nt.DidRenameFilesNotification.type,"didRename","didRename",t=>t.oldUri,e.code2ProtocolConverter.asDidRenameFilesParams)}register(e){this._willListener||(this._willListener=Oe.workspace.onWillRenameFiles(this.willRename,this)),super.register(e)}willRename(e){e.waitUntil(this.cacheFileTypes(e,t=>t.oldUri))}doSend(e,t){this.clearFileTypeCache();let n=this._client.middleware.workspace;return n?.didRenameFiles?n.didRenameFiles(e,t):t(e)}};_e.DidRenameFilesFeature=Ko;var jo=class extends zi{constructor(e){super(e,Oe.workspace.onDidDeleteFiles,nt.DidDeleteFilesNotification.type,"didDelete","didDelete",t=>t,e.code2ProtocolConverter.asDidDeleteFilesParams)}register(e){this._willListener||(this._willListener=Oe.workspace.onWillDeleteFiles(this.willDelete,this)),super.register(e)}willDelete(e){e.waitUntil(this.cacheFileTypes(e,t=>t))}doSend(e,t){this.clearFileTypeCache();let n=this._client.middleware.workspace;return n?.didDeleteFiles?n.didDeleteFiles(e,t):t(e)}};_e.DidDeleteFilesFeature=jo;var Tn=class extends _n{constructor(e,t,n,i,r,s,c){super(e,t,n,i,r),this._requestType=n,this._accessUri=s,this._createParams=c}async send(e){let t=this.waitUntil(e);e.waitUntil(t)}async waitUntil(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let n=i=>this._client.sendRequest(this._requestType,this._createParams(i),i.token).then(this._client.protocol2CodeConverter.asWorkspaceEdit);return this.doSend(t,n)}else return}},Wo=class extends Tn{constructor(e){super(e,Oe.workspace.onWillCreateFiles,nt.WillCreateFilesRequest.type,"willCreate","willCreate",t=>t,e.code2ProtocolConverter.asWillCreateFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willCreateFiles?n.willCreateFiles(e,t):t(e)}};_e.WillCreateFilesFeature=Wo;var $o=class extends Tn{constructor(e){super(e,Oe.workspace.onWillRenameFiles,nt.WillRenameFilesRequest.type,"willRename","willRename",t=>t.oldUri,e.code2ProtocolConverter.asWillRenameFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willRenameFiles?n.willRenameFiles(e,t):t(e)}};_e.WillRenameFilesFeature=$o;var zo=class extends Tn{constructor(e){super(e,Oe.workspace.onWillDeleteFiles,nt.WillDeleteFilesRequest.type,"willDelete","willDelete",t=>t,e.code2ProtocolConverter.asWillDeleteFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willDeleteFiles?n.willDeleteFiles(e,t):t(e)}};_e.WillDeleteFilesFeature=zo});var zc=F(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.LinkedEditingFeature=void 0;var ml=I("vscode"),Vo=L(),Bo=W(),Yo=class extends Bo.TextDocumentLanguageFeature{constructor(e){super(e,Vo.LinkedEditingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Bo.ensure)((0,Bo.ensure)(e,"textDocument"),"linkedEditingRange");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.linkedEditingRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideLinkedEditingRanges:(i,r,s)=>{let c=this._client,d=(g,h,f)=>c.sendRequest(Vo.LinkedEditingRangeRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asLinkedEditingRanges(v,f),v=>c.handleFailedRequest(Vo.LinkedEditingRangeRequest.type,f,v,null)),l=c.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,r,s,d):d(i,r,s)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return ml.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Vi.LinkedEditingFeature=Yo});var Vc=F(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.TypeHierarchyFeature=void 0;var vl=I("vscode"),xt=L(),Jo=W(),Qo=class{constructor(e){this.client=e,this.middleware=e.middleware}prepareTypeHierarchy(e,t,n){let i=this.client,r=this.middleware,s=(c,d,l)=>{let g=i.code2ProtocolConverter.asTextDocumentPositionParams(c,d);return i.sendRequest(xt.TypeHierarchyPrepareRequest.type,g,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(h,l),h=>i.handleFailedRequest(xt.TypeHierarchyPrepareRequest.type,l,h,null))};return r.prepareTypeHierarchy?r.prepareTypeHierarchy(e,t,n,s):s(e,t,n)}provideTypeHierarchySupertypes(e,t){let n=this.client,i=this.middleware,r=(s,c)=>{let d={item:n.code2ProtocolConverter.asTypeHierarchyItem(s)};return n.sendRequest(xt.TypeHierarchySupertypesRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,c),l=>n.handleFailedRequest(xt.TypeHierarchySupertypesRequest.type,c,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(e,t,r):r(e,t)}provideTypeHierarchySubtypes(e,t){let n=this.client,i=this.middleware,r=(s,c)=>{let d={item:n.code2ProtocolConverter.asTypeHierarchyItem(s)};return n.sendRequest(xt.TypeHierarchySubtypesRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,c),l=>n.handleFailedRequest(xt.TypeHierarchySubtypesRequest.type,c,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(e,t,r):r(e,t)}},Go=class extends Jo.TextDocumentLanguageFeature{constructor(e){super(e,xt.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=(0,Jo.ensure)((0,Jo.ensure)(e,"textDocument"),"typeHierarchy");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.typeHierarchyProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=this._client,n=new Qo(t);return[vl.languages.registerTypeHierarchyProvider(t.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Bi.TypeHierarchyFeature=Go});var Yc=F(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.InlineValueFeature=void 0;var Bc=I("vscode"),Yi=L(),kn=W(),Zo=class extends kn.TextDocumentLanguageFeature{constructor(e){super(e,Yi.InlineValueRequest.type)}fillClientCapabilities(e){(0,kn.ensure)((0,kn.ensure)(e,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,kn.ensure)((0,kn.ensure)(e,"workspace"),"inlineValue").refreshSupport=!0}initialize(e,t){this._client.onRequest(Yi.InlineValueRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeInlineValues.fire()});let[n,i]=this.getRegistration(t,e.inlineValueProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Bc.EventEmitter,i={onDidChangeInlineValues:n.event,provideInlineValues:(r,s,c,d)=>{let l=this._client,g=(f,v,p,y)=>{let C={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(f),range:l.code2ProtocolConverter.asRange(v),context:l.code2ProtocolConverter.asInlineValueContext(p)};return l.sendRequest(Yi.InlineValueRequest.type,C,y).then(b=>y.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(b,y),b=>l.handleFailedRequest(Yi.InlineValueRequest.type,y,b,null))},h=l.middleware;return h.provideInlineValues?h.provideInlineValues(r,s,c,d,g):g(r,s,c,d)}};return[this.registerProvider(t,i),{provider:i,onDidChangeInlineValues:n}]}registerProvider(e,t){return Bc.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ji.InlineValueFeature=Zo});var Qc=F(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.InlayHintsFeature=void 0;var Jc=I("vscode"),Yt=L(),Pn=W(),Xo=class extends Pn.TextDocumentLanguageFeature{constructor(e){super(e,Yt.InlayHintRequest.type)}fillClientCapabilities(e){let t=(0,Pn.ensure)((0,Pn.ensure)(e,"textDocument"),"inlayHint");t.dynamicRegistration=!0,t.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,Pn.ensure)((0,Pn.ensure)(e,"workspace"),"inlayHint").refreshSupport=!0}initialize(e,t){this._client.onRequest(Yt.InlayHintRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeInlayHints.fire()});let[n,i]=this.getRegistration(t,e.inlayHintProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Jc.EventEmitter,i={onDidChangeInlayHints:n.event,provideInlayHints:(r,s,c)=>{let d=this._client,l=async(h,f,v)=>{let p={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(h),range:d.code2ProtocolConverter.asRange(f)};try{let y=await d.sendRequest(Yt.InlayHintRequest.type,p,v);return v.isCancellationRequested?null:d.protocol2CodeConverter.asInlayHints(y,v)}catch(y){return d.handleFailedRequest(Yt.InlayHintRequest.type,v,y,null)}},g=d.middleware;return g.provideInlayHints?g.provideInlayHints(r,s,c,l):l(r,s,c)}};return i.resolveInlayHint=e.resolveProvider===!0?(r,s)=>{let c=this._client,d=async(g,h)=>{try{let f=await c.sendRequest(Yt.InlayHintResolveRequest.type,c.code2ProtocolConverter.asInlayHint(g),h);if(h.isCancellationRequested)return null;let v=c.protocol2CodeConverter.asInlayHint(f,h);return h.isCancellationRequested?null:v}catch(f){return c.handleFailedRequest(Yt.InlayHintResolveRequest.type,h,f,null)}},l=c.middleware;return l.resolveInlayHint?l.resolveInlayHint(r,s,d):d(r,s)}:void 0,[this.registerProvider(t,i),{provider:i,onDidChangeInlayHints:n}]}registerProvider(e,t){return Jc.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Qi.InlayHintsFeature=Xo});var Gc=F(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.InlineCompletionItemFeature=void 0;var yl=I("vscode"),ea=L(),ta=W(),Cl=te(),na=class extends ta.TextDocumentLanguageFeature{constructor(e){super(e,ea.InlineCompletionRequest.type)}fillClientCapabilities(e){let t=(0,ta.ensure)((0,ta.ensure)(e,"textDocument"),"inlineCompletion");t.dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.inlineCompletionProvider);n&&this.register({id:Cl.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideInlineCompletionItems:(i,r,s,c)=>{let d=this._client,l=this._client.middleware,g=(h,f,v,p)=>d.sendRequest(ea.InlineCompletionRequest.type,d.code2ProtocolConverter.asInlineCompletionParams(h,f,v),p).then(y=>p.isCancellationRequested?null:d.protocol2CodeConverter.asInlineCompletionResult(y,p),y=>d.handleFailedRequest(ea.InlineCompletionRequest.type,p,y,null));return l.provideInlineCompletionItems?l.provideInlineCompletionItems(i,r,s,c,g):g(i,r,s,c)}};return[yl.languages.registerInlineCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Gi.InlineCompletionItemFeature=na});var ca=F(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.ProposedFeatures=me.BaseLanguageClient=me.MessageTransports=me.SuspendMode=me.State=me.CloseAction=me.ErrorAction=me.RevealOutputChannelOn=void 0;var Y=I("vscode"),_=L(),wl=Ba(),Dl=Qa(),je=Ie(),Zi=oi(),Zc=te(),Sl=fs(),Ke=W(),bl=ks(),Xc=ac(),ed=dc(),Jt=uc(),_l=lc(),Tl=pc(),kl=fc(),Pl=gc(),Rl=mc(),xl=Gs(),Fl=yc(),ql=Cc(),Il=wc(),El=Sc(),ia=bc(),Ml=Tc(),Al=kc(),Ol=Rc(),Ll=xc(),Ul=Fc(),Nl=qc(),Hl=Ic(),Kl=Ec(),jl=Ac(),Wl=Oc(),$l=Lc(),zl=Nc(),Vl=Hc(),Bl=Kc(),Qt=$c(),Yl=zc(),Jl=Vc(),Ql=Yc(),Gl=Qc(),Zl=Gc(),Ft;(function(a){a[a.Debug=0]="Debug",a[a.Info=1]="Info",a[a.Warn=2]="Warn",a[a.Error=3]="Error",a[a.Never=4]="Never"})(Ft||(me.RevealOutputChannelOn=Ft={}));var xn;(function(a){a[a.Continue=1]="Continue",a[a.Shutdown=2]="Shutdown"})(xn||(me.ErrorAction=xn={}));var mt;(function(a){a[a.DoNotRestart=1]="DoNotRestart",a[a.Restart=2]="Restart"})(mt||(me.CloseAction=mt={}));var Rn;(function(a){a[a.Stopped=1]="Stopped",a[a.Starting=3]="Starting",a[a.Running=2]="Running"})(Rn||(me.State=Rn={}));var td;(function(a){a.off="off",a.on="on"})(td||(me.SuspendMode=td={}));var ra;(function(a){function e(t){return t==null?!1:typeof t=="boolean"||typeof t=="object"&&t!==null&&je.stringArray(t.enabledCommands)?t:!1}a.sanitizeIsTrusted=e})(ra||(ra={}));var sa=class{constructor(e,t){this.client=e,this.maxRestartCount=t,this.restarts=[]}error(e,t,n){return n&&n<=3?{action:xn.Continue}:{action:xn.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:mt.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=180*1e3?{action:mt.DoNotRestart,message:`The ${this.client.name} server crashed ${this.maxRestartCount+1} times in the last 3 minutes. The server will not be restarted. See the output for more information.`}:(this.restarts.shift(),{action:mt.Restart})}},N;(function(a){a.Initial="initial",a.Starting="starting",a.StartFailed="startFailed",a.Running="running",a.Stopping="stopping",a.Stopped="stopped"})(N||(N={}));var nd;(function(a){function e(t){return t&&_.MessageReader.is(t.reader)&&_.MessageWriter.is(t.writer)}a.is=e})(nd||(me.MessageTransports=nd={}));var Fn=class a{constructor(e,t,n){this._traceFormat=_.TraceFormat.Text,this._diagnosticQueue=new Map,this._diagnosticQueueState={state:"idle"},this._features=[],this._dynamicFeatures=new Map,this.workspaceEditLock=new Zi.Semaphore(1),this._id=e,this._name=t,n=n||{};let i={isTrusted:!1,supportHtml:!1};n.markdown!==void 0&&(i.isTrusted=ra.sanitizeIsTrusted(n.markdown.isTrusted),i.supportHtml=n.markdown.supportHtml===!0),this._clientOptions={documentSelector:n.documentSelector??[],synchronize:n.synchronize??{},diagnosticCollectionName:n.diagnosticCollectionName,outputChannelName:n.outputChannelName??this._name,revealOutputChannelOn:n.revealOutputChannelOn??Ft.Error,stdioEncoding:n.stdioEncoding??"utf8",initializationOptions:n.initializationOptions,initializationFailedHandler:n.initializationFailedHandler,progressOnInitialization:!!n.progressOnInitialization,errorHandler:n.errorHandler??this.createDefaultErrorHandler(n.connectionOptions?.maxRestartCount),middleware:n.middleware??{},uriConverters:n.uriConverters,workspaceFolder:n.workspaceFolder,connectionOptions:n.connectionOptions,markdown:i,diagnosticPullOptions:n.diagnosticPullOptions??{onChange:!0,onSave:!1},notebookDocumentOptions:n.notebookDocumentOptions??{}},this._clientOptions.synchronize=this._clientOptions.synchronize||{},this._state=N.Initial,this._ignoredRegistrations=new Set,this._listeners=[],this._notificationHandlers=new Map,this._pendingNotificationHandlers=new Map,this._notificationDisposables=new Map,this._requestHandlers=new Map,this._pendingRequestHandlers=new Map,this._requestDisposables=new Map,this._progressHandlers=new Map,this._pendingProgressHandlers=new Map,this._progressDisposables=new Map,this._connection=void 0,this._initializeResult=void 0,n.outputChannel?(this._outputChannel=n.outputChannel,this._disposeOutputChannel=!1):(this._outputChannel=void 0,this._disposeOutputChannel=!0),this._traceOutputChannel=n.traceOutputChannel,this._diagnostics=void 0,this._pendingOpenNotifications=new Set,this._pendingChangeSemaphore=new Zi.Semaphore(1),this._pendingChangeDelayer=new Zi.Delayer(250),this._fileEvents=[],this._fileEventDelayer=new Zi.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new _.Emitter,this._stateChangeEmitter=new _.Emitter,this._trace=_.Trace.Off,this._tracer={log:(r,s)=>{je.string(r)?this.logTrace(r,s):this.logObjectTrace(r)}},this._c2p=wl.createConverter(n.uriConverters?n.uriConverters.code2Protocol:void 0),this._p2c=Dl.createConverter(n.uriConverters?n.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}get name(){return this._name}get middleware(){return this._clientOptions.middleware??Object.create(null)}get clientOptions(){return this._clientOptions}get protocol2CodeConverter(){return this._p2c}get code2ProtocolConverter(){return this._c2p}get onTelemetry(){return this._telemetryEmitter.event}get onDidChangeState(){return this._stateChangeEmitter.event}get outputChannel(){return this._outputChannel||(this._outputChannel=Y.window.createOutputChannel(this._clientOptions.outputChannelName?this._clientOptions.outputChannelName:this._name)),this._outputChannel}get traceOutputChannel(){return this._traceOutputChannel?this._traceOutputChannel:this.outputChannel}get diagnostics(){return this._diagnostics}get state(){return this.getPublicState()}get $state(){return this._state}set $state(e){let t=this.getPublicState();this._state=e;let n=this.getPublicState();n!==t&&this._stateChangeEmitter.fire({oldState:t,newState:n})}getPublicState(){switch(this.$state){case N.Starting:return Rn.Starting;case N.Running:return Rn.Running;default:return Rn.Stopped}}get initializeResult(){return this._initializeResult}async sendRequest(e,...t){if(this.$state===N.StartFailed||this.$state===N.Stopping||this.$state===N.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));let n=await this.$start();this._didChangeTextDocumentFeature.syncKind===_.TextDocumentSyncKind.Full&&await this.sendPendingFullTextDocumentChanges(n);let i=this._clientOptions.middleware?.sendRequest;if(i!==void 0){let r,s;return t.length===1?_.CancellationToken.is(t[0])?s=t[0]:r=t[0]:t.length===2&&(r=t[0],s=t[1]),i(e,r,s,(c,d,l)=>{let g=[];return d!==void 0&&g.push(d),l!==void 0&&g.push(l),n.sendRequest(c,...g)})}else return n.sendRequest(e,...t)}onRequest(e,t){let n=typeof e=="string"?e:e.method;this._requestHandlers.set(n,t);let i=this.activeConnection(),r;return i!==void 0?(this._requestDisposables.set(n,i.onRequest(e,t)),r={dispose:()=>{let s=this._requestDisposables.get(n);s!==void 0&&(s.dispose(),this._requestDisposables.delete(n))}}):(this._pendingRequestHandlers.set(n,t),r={dispose:()=>{this._pendingRequestHandlers.delete(n);let s=this._requestDisposables.get(n);s!==void 0&&(s.dispose(),this._requestDisposables.delete(n))}}),{dispose:()=>{this._requestHandlers.delete(n),r.dispose()}}}async sendNotification(e,t){if(this.$state===N.StartFailed||this.$state===N.Stopping||this.$state===N.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));let n=this._didChangeTextDocumentFeature.syncKind===_.TextDocumentSyncKind.Full,i;n&&typeof e!="string"&&e.method===_.DidOpenTextDocumentNotification.method&&(i=t?.textDocument.uri,this._pendingOpenNotifications.add(i));let r=await this.$start();n&&await this.sendPendingFullTextDocumentChanges(r),i!==void 0&&this._pendingOpenNotifications.delete(i);let s=this._clientOptions.middleware?.sendNotification;return s?s(e,r.sendNotification.bind(r),t):r.sendNotification(e,t)}onNotification(e,t){let n=typeof e=="string"?e:e.method;this._notificationHandlers.set(n,t);let i=this.activeConnection(),r;return i!==void 0?(this._notificationDisposables.set(n,i.onNotification(e,t)),r={dispose:()=>{let s=this._notificationDisposables.get(n);s!==void 0&&(s.dispose(),this._notificationDisposables.delete(n))}}):(this._pendingNotificationHandlers.set(n,t),r={dispose:()=>{this._pendingNotificationHandlers.delete(n);let s=this._notificationDisposables.get(n);s!==void 0&&(s.dispose(),this._notificationDisposables.delete(n))}}),{dispose:()=>{this._notificationHandlers.delete(n),r.dispose()}}}async sendProgress(e,t,n){if(this.$state===N.StartFailed||this.$state===N.Stopping||this.$state===N.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));try{return(await this.$start()).sendProgress(e,t,n)}catch(i){throw this.error(`Sending progress for token ${t} failed.`,i),i}}onProgress(e,t,n){this._progressHandlers.set(t,{type:e,handler:n});let i=this.activeConnection(),r,s=this._clientOptions.middleware?.handleWorkDoneProgress,c=_.WorkDoneProgress.is(e)&&s!==void 0?d=>{s(t,d,()=>n(d))}:n;return i!==void 0?(this._progressDisposables.set(t,i.onProgress(e,t,c)),r={dispose:()=>{let d=this._progressDisposables.get(t);d!==void 0&&(d.dispose(),this._progressDisposables.delete(t))}}):(this._pendingProgressHandlers.set(t,{type:e,handler:n}),r={dispose:()=>{this._pendingProgressHandlers.delete(t);let d=this._progressDisposables.get(t);d!==void 0&&(d.dispose(),this._progressDisposables.delete(t))}}),{dispose:()=>{this._progressHandlers.delete(t),r.dispose()}}}createDefaultErrorHandler(e){if(e!==void 0&&e<0)throw new Error(`Invalid maxRestartCount: ${e}`);return new sa(this,e??4)}async setTrace(e){this._trace=e;let t=this.activeConnection();t!==void 0&&await t.trace(this._trace,this._tracer,{sendNotification:!1,traceFormat:this._traceFormat})}data2String(e){if(e instanceof _.ResponseError){let t=e;return` Message: ${t.message}
7
7
  Code: ${t.code} ${t.data?`
8
- `+t.data.toString():""}`}return e instanceof Error?je.string(e.stack)?e.stack:e.message:je.string(e)?e:e.toString()}debug(e,t,n=!0){this.logOutputMessage(_.MessageType.Debug,Ft.Debug,"Debug",e,t,n)}info(e,t,n=!0){this.logOutputMessage(_.MessageType.Info,Ft.Info,"Info",e,t,n)}warn(e,t,n=!0){this.logOutputMessage(_.MessageType.Warning,Ft.Warn,"Warn",e,t,n)}error(e,t,n=!0){this.logOutputMessage(_.MessageType.Error,Ft.Error,"Error",e,t,n)}logOutputMessage(e,t,n,i,r,s){this.outputChannel.appendLine(`[${n.padEnd(5)} - ${new Date().toLocaleTimeString()}] ${i}`),r!=null&&this.outputChannel.appendLine(this.data2String(r)),(s==="force"||s&&this._clientOptions.revealOutputChannelOn<=t)&&this.showNotificationMessage(e,i)}showNotificationMessage(e,t){t=t??"A request has failed. See the output for more information.",(e===_.MessageType.Error?Y.window.showErrorMessage:e===_.MessageType.Warning?Y.window.showWarningMessage:Y.window.showInformationMessage)(t,"Go to output").then(i=>{i!==void 0&&this.outputChannel.show(!0)})}logTrace(e,t){this.traceOutputChannel.appendLine(`[Trace - ${new Date().toLocaleTimeString()}] ${e}`),t&&this.traceOutputChannel.appendLine(this.data2String(t))}logObjectTrace(e){e.isLSPMessage&&e.type?this.traceOutputChannel.append(`[LSP - ${new Date().toLocaleTimeString()}] `):this.traceOutputChannel.append(`[Trace - ${new Date().toLocaleTimeString()}] `),e&&this.traceOutputChannel.appendLine(`${JSON.stringify(e)}`)}needsStart(){return this.$state===H.Initial||this.$state===H.Stopping||this.$state===H.Stopped}needsStop(){return this.$state===H.Starting||this.$state===H.Running}activeConnection(){return this.$state===H.Running&&this._connection!==void 0?this._connection:void 0}isRunning(){return this.$state===H.Running}async start(){if(this._disposed==="disposing"||this._disposed==="disposed")throw new Error("Client got disposed and can't be restarted.");if(this.$state===H.Stopping)throw new Error("Client is currently stopping. Can only restart a full stopped client");if(this._onStart!==void 0)return this._onStart;let[e,t,n]=this.createOnStartPromise();this._onStart=e,this._diagnostics===void 0&&(this._diagnostics=this._clientOptions.diagnosticCollectionName?Y.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName):Y.languages.createDiagnosticCollection());for(let[i,r]of this._notificationHandlers)this._pendingNotificationHandlers.has(i)||this._pendingNotificationHandlers.set(i,r);for(let[i,r]of this._requestHandlers)this._pendingRequestHandlers.has(i)||this._pendingRequestHandlers.set(i,r);for(let[i,r]of this._progressHandlers)this._pendingProgressHandlers.has(i)||this._pendingProgressHandlers.set(i,r);this.$state=H.Starting;try{let i=await this.createConnection();i.onNotification(_.LogMessageNotification.type,r=>{switch(r.type){case _.MessageType.Error:this.error(r.message,void 0,!1);break;case _.MessageType.Warning:this.warn(r.message,void 0,!1);break;case _.MessageType.Info:this.info(r.message,void 0,!1);break;case _.MessageType.Debug:this.debug(r.message,void 0,!1);break;default:this.outputChannel.appendLine(r.message)}}),i.onNotification(_.ShowMessageNotification.type,r=>{switch(r.type){case _.MessageType.Error:Y.window.showErrorMessage(r.message);break;case _.MessageType.Warning:Y.window.showWarningMessage(r.message);break;case _.MessageType.Info:Y.window.showInformationMessage(r.message);break;default:Y.window.showInformationMessage(r.message)}}),i.onRequest(_.ShowMessageRequest.type,r=>{let s;switch(r.type){case _.MessageType.Error:s=Y.window.showErrorMessage;break;case _.MessageType.Warning:s=Y.window.showWarningMessage;break;case _.MessageType.Info:s=Y.window.showInformationMessage;break;default:s=Y.window.showInformationMessage}let c=r.actions||[];return s(r.message,...c)}),i.onNotification(_.TelemetryEventNotification.type,r=>{this._telemetryEmitter.fire(r)}),i.onRequest(_.ShowDocumentRequest.type,async r=>{let s=async d=>{let l=this.protocol2CodeConverter.asUri(d.uri);try{if(d.external===!0)return{success:await Y.env.openExternal(l)};{let g={};return d.selection!==void 0&&(g.selection=this.protocol2CodeConverter.asRange(d.selection)),d.takeFocus===void 0||d.takeFocus===!1?g.preserveFocus=!0:d.takeFocus===!0&&(g.preserveFocus=!1),await Y.window.showTextDocument(l,g),{success:!0}}}catch{return{success:!1}}},c=this._clientOptions.middleware.window?.showDocument;return c!==void 0?c(r,s):s(r)}),i.listen(),await this.initialize(i),t()}catch(i){this.$state=H.StartFailed,this.error(`${this._name} client: couldn't create connection to server.`,i,"force"),n(i)}return this._onStart}createOnStartPromise(){let e,t;return[new Promise((i,r)=>{e=i,t=r}),e,t]}async initialize(e){this.refreshTrace(e,!1);let t=this._clientOptions.initializationOptions,[n,i]=this._clientOptions.workspaceFolder!==void 0?[this._clientOptions.workspaceFolder.uri.fsPath,[{uri:this._c2p.asUri(this._clientOptions.workspaceFolder.uri),name:this._clientOptions.workspaceFolder.name}]]:[this._clientGetRootPath(),null],r={processId:null,clientInfo:{name:Y.env.appName,version:Y.version},locale:this.getLocale(),rootPath:n||null,rootUri:n?this._c2p.asUri(Y.Uri.file(n)):null,capabilities:this.computeClientCapabilities(),initializationOptions:je.func(t)?t():t,trace:_.Trace.toString(this._trace),workspaceFolders:i};if(this.fillInitializeParams(r),this._clientOptions.progressOnInitialization){let s=Zc.generateUuid(),c=new Sl.ProgressPart(e,s);r.workDoneToken=s;try{let d=await this.doInitialize(e,r);return c.done(),d}catch(d){throw c.cancel(),d}}else return this.doInitialize(e,r)}async doInitialize(e,t){try{let n=await e.initialize(t);if(n.capabilities.positionEncoding!==void 0&&n.capabilities.positionEncoding!==_.PositionEncodingKind.UTF16)throw new Error(`Unsupported position encoding (${n.capabilities.positionEncoding}) received from server ${this.name}`);this._initializeResult=n,this.$state=H.Running;let i;je.number(n.capabilities.textDocumentSync)?n.capabilities.textDocumentSync===_.TextDocumentSyncKind.None?i={openClose:!1,change:_.TextDocumentSyncKind.None,save:void 0}:i={openClose:!0,change:n.capabilities.textDocumentSync,save:{includeText:!1}}:n.capabilities.textDocumentSync!==void 0&&n.capabilities.textDocumentSync!==null&&(i=n.capabilities.textDocumentSync),this._capabilities=Object.assign({},n.capabilities,{resolvedTextDocumentSync:i}),e.onNotification(_.PublishDiagnosticsNotification.type,r=>this.handleDiagnostics(r)),e.onRequest(_.RegistrationRequest.type,r=>this.handleRegistrationRequest(r)),e.onRequest("client/registerFeature",r=>this.handleRegistrationRequest(r)),e.onRequest(_.UnregistrationRequest.type,r=>this.handleUnregistrationRequest(r)),e.onRequest("client/unregisterFeature",r=>this.handleUnregistrationRequest(r)),e.onRequest(_.ApplyWorkspaceEditRequest.type,r=>this.handleApplyWorkspaceEdit(r));for(let[r,s]of this._pendingNotificationHandlers)this._notificationDisposables.set(r,e.onNotification(r,s));this._pendingNotificationHandlers.clear();for(let[r,s]of this._pendingRequestHandlers)this._requestDisposables.set(r,e.onRequest(r,s));this._pendingRequestHandlers.clear();for(let[r,s]of this._pendingProgressHandlers)this._progressDisposables.set(r,e.onProgress(s.type,r,s.handler));return this._pendingProgressHandlers.clear(),await e.sendNotification(_.InitializedNotification.type,{}),this.hookFileEvents(e),this.hookConfigurationChanged(e),this.initializeFeatures(e),n}catch(n){throw this._clientOptions.initializationFailedHandler?this._clientOptions.initializationFailedHandler(n)?this.initialize(e):this.stop():n instanceof _.ResponseError&&n.data&&n.data.retry?Y.window.showErrorMessage(n.message,{title:"Retry",id:"retry"}).then(i=>{i&&i.id==="retry"?this.initialize(e):this.stop()}):(n&&n.message&&Y.window.showErrorMessage(n.message),this.error("Server initialization failed.",n),this.stop()),n}}_clientGetRootPath(){let e=Y.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}stop(e=2e3){return this.shutdown("stop",e)}dispose(e=2e3){try{return this._disposed="disposing",this.stop(e)}finally{this._disposed="disposed"}}async shutdown(e,t){if(this.$state===H.Stopped||this.$state===H.Initial)return;if(this.$state===H.Stopping){if(this._onStop!==void 0)return this._onStop;throw new Error("Client is stopping but no stop promise available.")}let n=this.activeConnection();if(n===void 0||this.$state!==H.Running)throw new Error(`Client is not running and can't be stopped. It's current state is: ${this.$state}`);this._initializeResult=void 0,this.$state=H.Stopping,this.cleanUp(e);let i=new Promise(s=>{(0,_.RAL)().timer.setTimeout(s,t)}),r=(async s=>(await s.shutdown(),await s.exit(),s))(n);return this._onStop=Promise.race([i,r]).then(s=>{if(s!==void 0)s.end(),s.dispose();else throw this.error("Stopping server timed out",void 0,!1),new Error("Stopping the server timed out")},s=>{throw this.error("Stopping server failed",s,!1),s}).finally(()=>{this.$state=H.Stopped,e==="stop"&&this.cleanUpChannel(),this._onStart=void 0,this._onStop=void 0,this._connection=void 0,this._ignoredRegistrations.clear()})}cleanUp(e){this._fileEvents=[],this._fileEventDelayer.cancel();let t=this._listeners.splice(0,this._listeners.length);for(let n of t)n.dispose();this._syncedDocuments&&this._syncedDocuments.clear();for(let n of Array.from(this._features.entries()).map(i=>i[1]).reverse())n.clear();e==="stop"&&this._diagnostics!==void 0&&(this._diagnostics.dispose(),this._diagnostics=void 0),this._idleInterval!==void 0&&(this._idleInterval.dispose(),this._idleInterval=void 0)}cleanUpChannel(){this._outputChannel!==void 0&&this._disposeOutputChannel&&(this._outputChannel.dispose(),this._outputChannel=void 0)}notifyFileEvent(e){let t=this;async function n(r){return t._fileEvents.push(r),t._fileEventDelayer.trigger(async()=>{await t.sendNotification(_.DidChangeWatchedFilesNotification.type,{changes:t._fileEvents}),t._fileEvents=[]})}let i=this.clientOptions.middleware?.workspace;(i?.didChangeWatchedFile?i.didChangeWatchedFile(e,n):n(e)).catch(r=>{t.error("Notify file events failed.",r)})}async sendPendingFullTextDocumentChanges(e){return this._pendingChangeSemaphore.lock(async()=>{try{let t=this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._pendingOpenNotifications);if(t.length===0)return;for(let n of t){let i=this.code2ProtocolConverter.asChangeTextDocumentParams(n);await e.sendNotification(_.DidChangeTextDocumentNotification.type,i),this._didChangeTextDocumentFeature.notificationSent(n,_.DidChangeTextDocumentNotification.type,i)}}catch(t){throw this.error("Sending pending changes failed",t,!1),t}})}triggerPendingChangeDelivery(){this._pendingChangeDelayer.trigger(async()=>{let e=this.activeConnection();if(e===void 0){this.triggerPendingChangeDelivery();return}await this.sendPendingFullTextDocumentChanges(e)}).catch(e=>this.error("Delivering pending changes failed",e,!1))}handleDiagnostics(e){if(!this._diagnostics)return;let t=e.uri;this._diagnosticQueueState.state==="busy"&&this._diagnosticQueueState.document===t&&this._diagnosticQueueState.tokenSource.cancel(),this._diagnosticQueue.set(e.uri,e.diagnostics),this.triggerDiagnosticQueue()}triggerDiagnosticQueue(){(0,_.RAL)().timer.setImmediate(()=>{this.workDiagnosticQueue()})}workDiagnosticQueue(){if(this._diagnosticQueueState.state==="busy")return;let e=this._diagnosticQueue.entries().next();if(e.done===!0)return;let[t,n]=e.value;this._diagnosticQueue.delete(t);let i=new Y.CancellationTokenSource;this._diagnosticQueueState={state:"busy",document:t,tokenSource:i},this._p2c.asDiagnostics(n,i.token).then(r=>{if(!i.token.isCancellationRequested){let s=this._p2c.asUri(t),c=this.clientOptions.middleware;c.handleDiagnostics?c.handleDiagnostics(s,r,(d,l)=>this.setDiagnostics(d,l)):this.setDiagnostics(s,r)}}).finally(()=>{this._diagnosticQueueState={state:"idle"},this.triggerDiagnosticQueue()})}setDiagnostics(e,t){this._diagnostics&&this._diagnostics.set(e,t)}getLocale(){return Y.env.language}async $start(){if(this.$state===H.StartFailed)throw new Error("Previous start failed. Can't restart server.");await this.start();let e=this.activeConnection();if(e===void 0)throw new Error("Starting server failed");return e}async createConnection(){let e=(i,r,s)=>{this.handleConnectionError(i,r,s).catch(c=>this.error("Handling connection error failed",c))},t=()=>{this.handleConnectionClosed().catch(i=>this.error("Handling connection close failed",i))},n=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=Xl(n.reader,n.writer,e,t,this._clientOptions.connectionOptions),this._connection}async handleConnectionClosed(){if(this.$state===H.Stopped)return;try{this._connection!==void 0&&this._connection.dispose()}catch{}let e={action:mt.DoNotRestart};if(this.$state!==H.Stopping)try{e=await this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,e.action===mt.DoNotRestart?(this.error(e.message??"Connection to server got closed. Server will not be restarted.",void 0,e.handled===!0?!1:"force"),this.cleanUp("stop"),this.$state===H.Starting?this.$state=H.StartFailed:this.$state=H.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):e.action===mt.Restart&&(this.info(e.message??"Connection to server got closed. Server will restart.",!e.handled),this.cleanUp("restart"),this.$state=H.Initial,this._onStop=Promise.resolve(),this._onStart=void 0,this.start().catch(t=>this.error("Restarting server failed",t,"force")))}async handleConnectionError(e,t,n){let i=await this._clientOptions.errorHandler.error(e,t,n);i.action===xn.Shutdown?(this.error(i.message??`Client ${this._name}: connection to server is erroring.
8
+ `+t.data.toString():""}`}return e instanceof Error?je.string(e.stack)?e.stack:e.message:je.string(e)?e:e.toString()}debug(e,t,n=!0){this.logOutputMessage(_.MessageType.Debug,Ft.Debug,"Debug",e,t,n)}info(e,t,n=!0){this.logOutputMessage(_.MessageType.Info,Ft.Info,"Info",e,t,n)}warn(e,t,n=!0){this.logOutputMessage(_.MessageType.Warning,Ft.Warn,"Warn",e,t,n)}error(e,t,n=!0){this.logOutputMessage(_.MessageType.Error,Ft.Error,"Error",e,t,n)}logOutputMessage(e,t,n,i,r,s){this.outputChannel.appendLine(`[${n.padEnd(5)} - ${new Date().toLocaleTimeString()}] ${i}`),r!=null&&this.outputChannel.appendLine(this.data2String(r)),(s==="force"||s&&this._clientOptions.revealOutputChannelOn<=t)&&this.showNotificationMessage(e,i)}showNotificationMessage(e,t){t=t??"A request has failed. See the output for more information.",(e===_.MessageType.Error?Y.window.showErrorMessage:e===_.MessageType.Warning?Y.window.showWarningMessage:Y.window.showInformationMessage)(t,"Go to output").then(i=>{i!==void 0&&this.outputChannel.show(!0)})}logTrace(e,t){this.traceOutputChannel.appendLine(`[Trace - ${new Date().toLocaleTimeString()}] ${e}`),t&&this.traceOutputChannel.appendLine(this.data2String(t))}logObjectTrace(e){e.isLSPMessage&&e.type?this.traceOutputChannel.append(`[LSP - ${new Date().toLocaleTimeString()}] `):this.traceOutputChannel.append(`[Trace - ${new Date().toLocaleTimeString()}] `),e&&this.traceOutputChannel.appendLine(`${JSON.stringify(e)}`)}needsStart(){return this.$state===N.Initial||this.$state===N.Stopping||this.$state===N.Stopped}needsStop(){return this.$state===N.Starting||this.$state===N.Running}activeConnection(){return this.$state===N.Running&&this._connection!==void 0?this._connection:void 0}isRunning(){return this.$state===N.Running}async start(){if(this._disposed==="disposing"||this._disposed==="disposed")throw new Error("Client got disposed and can't be restarted.");if(this.$state===N.Stopping)throw new Error("Client is currently stopping. Can only restart a full stopped client");if(this._onStart!==void 0)return this._onStart;let[e,t,n]=this.createOnStartPromise();this._onStart=e,this._diagnostics===void 0&&(this._diagnostics=this._clientOptions.diagnosticCollectionName?Y.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName):Y.languages.createDiagnosticCollection());for(let[i,r]of this._notificationHandlers)this._pendingNotificationHandlers.has(i)||this._pendingNotificationHandlers.set(i,r);for(let[i,r]of this._requestHandlers)this._pendingRequestHandlers.has(i)||this._pendingRequestHandlers.set(i,r);for(let[i,r]of this._progressHandlers)this._pendingProgressHandlers.has(i)||this._pendingProgressHandlers.set(i,r);this.$state=N.Starting;try{let i=await this.createConnection();i.onNotification(_.LogMessageNotification.type,r=>{switch(r.type){case _.MessageType.Error:this.error(r.message,void 0,!1);break;case _.MessageType.Warning:this.warn(r.message,void 0,!1);break;case _.MessageType.Info:this.info(r.message,void 0,!1);break;case _.MessageType.Debug:this.debug(r.message,void 0,!1);break;default:this.outputChannel.appendLine(r.message)}}),i.onNotification(_.ShowMessageNotification.type,r=>{switch(r.type){case _.MessageType.Error:Y.window.showErrorMessage(r.message);break;case _.MessageType.Warning:Y.window.showWarningMessage(r.message);break;case _.MessageType.Info:Y.window.showInformationMessage(r.message);break;default:Y.window.showInformationMessage(r.message)}}),i.onRequest(_.ShowMessageRequest.type,r=>{let s;switch(r.type){case _.MessageType.Error:s=Y.window.showErrorMessage;break;case _.MessageType.Warning:s=Y.window.showWarningMessage;break;case _.MessageType.Info:s=Y.window.showInformationMessage;break;default:s=Y.window.showInformationMessage}let c=r.actions||[];return s(r.message,...c)}),i.onNotification(_.TelemetryEventNotification.type,r=>{this._telemetryEmitter.fire(r)}),i.onRequest(_.ShowDocumentRequest.type,async r=>{let s=async d=>{let l=this.protocol2CodeConverter.asUri(d.uri);try{if(d.external===!0)return{success:await Y.env.openExternal(l)};{let g={};return d.selection!==void 0&&(g.selection=this.protocol2CodeConverter.asRange(d.selection)),d.takeFocus===void 0||d.takeFocus===!1?g.preserveFocus=!0:d.takeFocus===!0&&(g.preserveFocus=!1),await Y.window.showTextDocument(l,g),{success:!0}}}catch{return{success:!1}}},c=this._clientOptions.middleware.window?.showDocument;return c!==void 0?c(r,s):s(r)}),i.listen(),await this.initialize(i),t()}catch(i){this.$state=N.StartFailed,this.error(`${this._name} client: couldn't create connection to server.`,i,"force"),n(i)}return this._onStart}createOnStartPromise(){let e,t;return[new Promise((i,r)=>{e=i,t=r}),e,t]}async initialize(e){this.refreshTrace(e,!1);let t=this._clientOptions.initializationOptions,[n,i]=this._clientOptions.workspaceFolder!==void 0?[this._clientOptions.workspaceFolder.uri.fsPath,[{uri:this._c2p.asUri(this._clientOptions.workspaceFolder.uri),name:this._clientOptions.workspaceFolder.name}]]:[this._clientGetRootPath(),null],r={processId:null,clientInfo:{name:Y.env.appName,version:Y.version},locale:this.getLocale(),rootPath:n||null,rootUri:n?this._c2p.asUri(Y.Uri.file(n)):null,capabilities:this.computeClientCapabilities(),initializationOptions:je.func(t)?t():t,trace:_.Trace.toString(this._trace),workspaceFolders:i};if(this.fillInitializeParams(r),this._clientOptions.progressOnInitialization){let s=Zc.generateUuid(),c=new Sl.ProgressPart(e,s);r.workDoneToken=s;try{let d=await this.doInitialize(e,r);return c.done(),d}catch(d){throw c.cancel(),d}}else return this.doInitialize(e,r)}async doInitialize(e,t){try{let n=await e.initialize(t);if(n.capabilities.positionEncoding!==void 0&&n.capabilities.positionEncoding!==_.PositionEncodingKind.UTF16)throw new Error(`Unsupported position encoding (${n.capabilities.positionEncoding}) received from server ${this.name}`);this._initializeResult=n,this.$state=N.Running;let i;je.number(n.capabilities.textDocumentSync)?n.capabilities.textDocumentSync===_.TextDocumentSyncKind.None?i={openClose:!1,change:_.TextDocumentSyncKind.None,save:void 0}:i={openClose:!0,change:n.capabilities.textDocumentSync,save:{includeText:!1}}:n.capabilities.textDocumentSync!==void 0&&n.capabilities.textDocumentSync!==null&&(i=n.capabilities.textDocumentSync),this._capabilities=Object.assign({},n.capabilities,{resolvedTextDocumentSync:i}),e.onNotification(_.PublishDiagnosticsNotification.type,r=>this.handleDiagnostics(r)),e.onRequest(_.RegistrationRequest.type,r=>this.handleRegistrationRequest(r)),e.onRequest("client/registerFeature",r=>this.handleRegistrationRequest(r)),e.onRequest(_.UnregistrationRequest.type,r=>this.handleUnregistrationRequest(r)),e.onRequest("client/unregisterFeature",r=>this.handleUnregistrationRequest(r)),e.onRequest(_.ApplyWorkspaceEditRequest.type,r=>this.handleApplyWorkspaceEdit(r));for(let[r,s]of this._pendingNotificationHandlers)this._notificationDisposables.set(r,e.onNotification(r,s));this._pendingNotificationHandlers.clear();for(let[r,s]of this._pendingRequestHandlers)this._requestDisposables.set(r,e.onRequest(r,s));this._pendingRequestHandlers.clear();for(let[r,s]of this._pendingProgressHandlers)this._progressDisposables.set(r,e.onProgress(s.type,r,s.handler));return this._pendingProgressHandlers.clear(),await e.sendNotification(_.InitializedNotification.type,{}),this.hookFileEvents(e),this.hookConfigurationChanged(e),this.initializeFeatures(e),n}catch(n){throw this._clientOptions.initializationFailedHandler?this._clientOptions.initializationFailedHandler(n)?this.initialize(e):this.stop():n instanceof _.ResponseError&&n.data&&n.data.retry?Y.window.showErrorMessage(n.message,{title:"Retry",id:"retry"}).then(i=>{i&&i.id==="retry"?this.initialize(e):this.stop()}):(n&&n.message&&Y.window.showErrorMessage(n.message),this.error("Server initialization failed.",n),this.stop()),n}}_clientGetRootPath(){let e=Y.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}stop(e=2e3){return this.shutdown("stop",e)}dispose(e=2e3){try{return this._disposed="disposing",this.stop(e)}finally{this._disposed="disposed"}}async shutdown(e,t){if(this.$state===N.Stopped||this.$state===N.Initial)return;if(this.$state===N.Stopping){if(this._onStop!==void 0)return this._onStop;throw new Error("Client is stopping but no stop promise available.")}let n=this.activeConnection();if(n===void 0||this.$state!==N.Running)throw new Error(`Client is not running and can't be stopped. It's current state is: ${this.$state}`);this._initializeResult=void 0,this.$state=N.Stopping,this.cleanUp(e);let i=new Promise(s=>{(0,_.RAL)().timer.setTimeout(s,t)}),r=(async s=>(await s.shutdown(),await s.exit(),s))(n);return this._onStop=Promise.race([i,r]).then(s=>{if(s!==void 0)s.end(),s.dispose();else throw this.error("Stopping server timed out",void 0,!1),new Error("Stopping the server timed out")},s=>{throw this.error("Stopping server failed",s,!1),s}).finally(()=>{this.$state=N.Stopped,e==="stop"&&this.cleanUpChannel(),this._onStart=void 0,this._onStop=void 0,this._connection=void 0,this._ignoredRegistrations.clear()})}cleanUp(e){this._fileEvents=[],this._fileEventDelayer.cancel();let t=this._listeners.splice(0,this._listeners.length);for(let n of t)n.dispose();this._syncedDocuments&&this._syncedDocuments.clear();for(let n of Array.from(this._features.entries()).map(i=>i[1]).reverse())n.clear();e==="stop"&&this._diagnostics!==void 0&&(this._diagnostics.dispose(),this._diagnostics=void 0),this._idleInterval!==void 0&&(this._idleInterval.dispose(),this._idleInterval=void 0)}cleanUpChannel(){this._outputChannel!==void 0&&this._disposeOutputChannel&&(this._outputChannel.dispose(),this._outputChannel=void 0)}notifyFileEvent(e){let t=this;async function n(r){return t._fileEvents.push(r),t._fileEventDelayer.trigger(async()=>{await t.sendNotification(_.DidChangeWatchedFilesNotification.type,{changes:t._fileEvents}),t._fileEvents=[]})}let i=this.clientOptions.middleware?.workspace;(i?.didChangeWatchedFile?i.didChangeWatchedFile(e,n):n(e)).catch(r=>{t.error("Notify file events failed.",r)})}async sendPendingFullTextDocumentChanges(e){return this._pendingChangeSemaphore.lock(async()=>{try{let t=this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._pendingOpenNotifications);if(t.length===0)return;for(let n of t){let i=this.code2ProtocolConverter.asChangeTextDocumentParams(n);await e.sendNotification(_.DidChangeTextDocumentNotification.type,i),this._didChangeTextDocumentFeature.notificationSent(n,_.DidChangeTextDocumentNotification.type,i)}}catch(t){throw this.error("Sending pending changes failed",t,!1),t}})}triggerPendingChangeDelivery(){this._pendingChangeDelayer.trigger(async()=>{let e=this.activeConnection();if(e===void 0){this.triggerPendingChangeDelivery();return}await this.sendPendingFullTextDocumentChanges(e)}).catch(e=>this.error("Delivering pending changes failed",e,!1))}handleDiagnostics(e){if(!this._diagnostics)return;let t=e.uri;this._diagnosticQueueState.state==="busy"&&this._diagnosticQueueState.document===t&&this._diagnosticQueueState.tokenSource.cancel(),this._diagnosticQueue.set(e.uri,e.diagnostics),this.triggerDiagnosticQueue()}triggerDiagnosticQueue(){(0,_.RAL)().timer.setImmediate(()=>{this.workDiagnosticQueue()})}workDiagnosticQueue(){if(this._diagnosticQueueState.state==="busy")return;let e=this._diagnosticQueue.entries().next();if(e.done===!0)return;let[t,n]=e.value;this._diagnosticQueue.delete(t);let i=new Y.CancellationTokenSource;this._diagnosticQueueState={state:"busy",document:t,tokenSource:i},this._p2c.asDiagnostics(n,i.token).then(r=>{if(!i.token.isCancellationRequested){let s=this._p2c.asUri(t),c=this.clientOptions.middleware;c.handleDiagnostics?c.handleDiagnostics(s,r,(d,l)=>this.setDiagnostics(d,l)):this.setDiagnostics(s,r)}}).finally(()=>{this._diagnosticQueueState={state:"idle"},this.triggerDiagnosticQueue()})}setDiagnostics(e,t){this._diagnostics&&this._diagnostics.set(e,t)}getLocale(){return Y.env.language}async $start(){if(this.$state===N.StartFailed)throw new Error("Previous start failed. Can't restart server.");await this.start();let e=this.activeConnection();if(e===void 0)throw new Error("Starting server failed");return e}async createConnection(){let e=(i,r,s)=>{this.handleConnectionError(i,r,s).catch(c=>this.error("Handling connection error failed",c))},t=()=>{this.handleConnectionClosed().catch(i=>this.error("Handling connection close failed",i))},n=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=Xl(n.reader,n.writer,e,t,this._clientOptions.connectionOptions),this._connection}async handleConnectionClosed(){if(this.$state===N.Stopped)return;try{this._connection!==void 0&&this._connection.dispose()}catch{}let e={action:mt.DoNotRestart};if(this.$state!==N.Stopping)try{e=await this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,e.action===mt.DoNotRestart?(this.error(e.message??"Connection to server got closed. Server will not be restarted.",void 0,e.handled===!0?!1:"force"),this.cleanUp("stop"),this.$state===N.Starting?this.$state=N.StartFailed:this.$state=N.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):e.action===mt.Restart&&(this.info(e.message??"Connection to server got closed. Server will restart.",!e.handled),this.cleanUp("restart"),this.$state=N.Initial,this._onStop=Promise.resolve(),this._onStart=void 0,this.start().catch(t=>this.error("Restarting server failed",t,"force")))}async handleConnectionError(e,t,n){let i=await this._clientOptions.errorHandler.error(e,t,n);i.action===xn.Shutdown?(this.error(i.message??`Client ${this._name}: connection to server is erroring.
9
9
  ${e.message}
10
10
  Shutting down server.`,void 0,i.handled===!0?!1:"force"),this.stop().catch(r=>{this.error("Stopping server failed",r,!1)})):this.error(i.message??`Client ${this._name}: connection to server is erroring.
11
- ${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this._listeners.push(Y.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)}))}refreshTrace(e,t=!1){let n=Y.workspace.getConfiguration(this._id),i=_.Trace.Off,r=_.TraceFormat.Text;if(n){let s=n.get("trace.server","off");typeof s=="string"?i=_.Trace.fromString(s):(i=_.Trace.fromString(n.get("trace.server.verbosity","off")),r=_.TraceFormat.fromString(n.get("trace.server.format","text")))}this._trace=i,this._traceFormat=r,e.trace(this._trace,this._tracer,{sendNotification:t,traceFormat:this._traceFormat}).catch(s=>{this.error("Updating trace failed with error",s,!1)})}hookFileEvents(e){let t=this._clientOptions.synchronize.fileEvents;if(!t)return;let n;je.array(t)?n=t:n=[t],n&&this._dynamicFeatures.get(_.DidChangeWatchedFilesNotification.type.method).registerRaw(Zc.generateUuid(),n)}registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),Ke.DynamicFeature.is(e)){let t=e.registrationType;this._dynamicFeatures.set(t.method,e)}}getFeature(e){return this._dynamicFeatures.get(e)}hasDedicatedTextSynchronizationFeature(e){let t=this.getFeature(_.NotebookDocumentSyncRegistrationType.method);return t===void 0||!(t instanceof Xc.NotebookDocumentSyncFeature)?!1:t.handles(e)}registerBuiltinFeatures(){let e=new Map;this.registerFeature(new ed.ConfigurationFeature(this)),this.registerFeature(new Jt.DidOpenTextDocumentFeature(this,this._syncedDocuments)),this._didChangeTextDocumentFeature=new Jt.DidChangeTextDocumentFeature(this,e),this._didChangeTextDocumentFeature.onPendingChangeAdded(()=>{this.triggerPendingChangeDelivery()}),this.registerFeature(this._didChangeTextDocumentFeature),this.registerFeature(new Jt.WillSaveFeature(this)),this.registerFeature(new Jt.WillSaveWaitUntilFeature(this)),this.registerFeature(new Jt.DidSaveTextDocumentFeature(this)),this.registerFeature(new Jt.DidCloseTextDocumentFeature(this,this._syncedDocuments,e)),this.registerFeature(new Ll.FileSystemWatcherFeature(this,t=>this.notifyFileEvent(t))),this.registerFeature(new _l.CompletionItemFeature(this)),this.registerFeature(new Tl.HoverFeature(this)),this.registerFeature(new Pl.SignatureHelpFeature(this)),this.registerFeature(new kl.DefinitionFeature(this)),this.registerFeature(new ql.ReferencesFeature(this)),this.registerFeature(new Rl.DocumentHighlightFeature(this)),this.registerFeature(new xl.DocumentSymbolFeature(this)),this.registerFeature(new Fl.WorkspaceSymbolFeature(this)),this.registerFeature(new Il.CodeActionFeature(this)),this.registerFeature(new El.CodeLensFeature(this)),this.registerFeature(new ia.DocumentFormattingFeature(this)),this.registerFeature(new ia.DocumentRangeFormattingFeature(this)),this.registerFeature(new ia.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new Ml.RenameFeature(this)),this.registerFeature(new Al.DocumentLinkFeature(this)),this.registerFeature(new Ol.ExecuteCommandFeature(this)),this.registerFeature(new ed.SyncConfigurationFeature(this)),this.registerFeature(new Nl.TypeDefinitionFeature(this)),this.registerFeature(new Hl.ImplementationFeature(this)),this.registerFeature(new Ul.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new Kl.WorkspaceFoldersFeature(this)),this.registerFeature(new jl.FoldingRangeFeature(this)),this.registerFeature(new Wl.DeclarationFeature(this)),this.registerFeature(new $l.SelectionRangeFeature(this)),this.registerFeature(new zl.ProgressFeature(this)),this.registerFeature(new Vl.CallHierarchyFeature(this)),this.registerFeature(new Bl.SemanticTokensFeature(this)),this.registerFeature(new Yl.LinkedEditingFeature(this)),this.registerFeature(new Qt.DidCreateFilesFeature(this)),this.registerFeature(new Qt.DidRenameFilesFeature(this)),this.registerFeature(new Qt.DidDeleteFilesFeature(this)),this.registerFeature(new Qt.WillCreateFilesFeature(this)),this.registerFeature(new Qt.WillRenameFilesFeature(this)),this.registerFeature(new Qt.WillDeleteFilesFeature(this)),this.registerFeature(new Jl.TypeHierarchyFeature(this)),this.registerFeature(new Ql.InlineValueFeature(this)),this.registerFeature(new Gl.InlayHintsFeature(this)),this.registerFeature(new bl.DiagnosticFeature(this)),this.registerFeature(new Xc.NotebookDocumentSyncFeature(this))}registerProposedFeatures(){this.registerFeatures(aa.createAll(this))}fillInitializeParams(e){for(let t of this._features)je.func(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};(0,Ke.ensure)(e,"workspace").applyEdit=!0;let t=(0,Ke.ensure)((0,Ke.ensure)(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[_.ResourceOperationKind.Create,_.ResourceOperationKind.Rename,_.ResourceOperationKind.Delete],t.failureHandling=_.FailureHandlingKind.TextOnlyTransactional,t.normalizesLineEndings=!0,t.changeAnnotationSupport={groupsOnLabel:!0};let n=(0,Ke.ensure)((0,Ke.ensure)(e,"textDocument"),"publishDiagnostics");n.relatedInformation=!0,n.versionSupport=!1,n.tagSupport={valueSet:[_.DiagnosticTag.Unnecessary,_.DiagnosticTag.Deprecated]},n.codeDescriptionSupport=!0,n.dataSupport=!0;let i=(0,Ke.ensure)(e,"window"),r=(0,Ke.ensure)(i,"showMessage");r.messageActionItem={additionalPropertiesSupport:!0};let s=(0,Ke.ensure)(i,"showDocument");s.support=!0;let c=(0,Ke.ensure)(e,"general");c.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(a.RequestsToCancelOnContentModified)},c.regularExpressions={engine:"ECMAScript",version:"ES2020"},c.markdown={parser:"marked",version:"1.1.0"},c.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(c.markdown.allowedTags=["ul","li","p","code","blockquote","ol","h1","h2","h3","h4","h5","h6","hr","em","pre","table","thead","tbody","tr","th","td","div","del","a","strong","br","img","span"]);for(let d of this._features)d.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let n of this._features)je.func(n.preInitialize)&&n.preInitialize(this._capabilities,t);for(let n of this._features)n.initialize(this._capabilities,t)}async handleRegistrationRequest(e){let t=this.clientOptions.middleware?.handleRegisterCapability;return t?t(e,n=>this.doRegisterCapability(n)):this.doRegisterCapability(e)}async doRegisterCapability(e){if(!this.isRunning()){for(let t of e.registrations)this._ignoredRegistrations.add(t.id);return}for(let t of e.registrations){let n=this._dynamicFeatures.get(t.method);if(n===void 0)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Registration failed.`));let i=t.registerOptions??{};i.documentSelector=i.documentSelector??this._clientOptions.documentSelector;let r={id:t.id,registerOptions:i};try{n.register(r)}catch(s){return Promise.reject(s)}}}async handleUnregistrationRequest(e){let t=this.clientOptions.middleware?.handleUnregisterCapability;return t?t(e,n=>this.doUnregisterCapability(n)):this.doUnregisterCapability(e)}async doUnregisterCapability(e){for(let t of e.unregisterations){if(this._ignoredRegistrations.has(t.id))continue;let n=this._dynamicFeatures.get(t.method);if(!n)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Unregistration failed.`));n.unregister(t.id)}}async handleApplyWorkspaceEdit(e){let t=e.edit,n=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(t)),i=new Map;Y.workspace.textDocuments.forEach(s=>i.set(s.uri.toString(),s));let r=!1;if(t.documentChanges){for(let s of t.documentChanges)if(_.TextDocumentEdit.is(s)&&s.textDocument.version&&s.textDocument.version>=0){let c=this._p2c.asUri(s.textDocument.uri).toString(),d=i.get(c);if(d&&d.version!==s.textDocument.version){r=!0;break}}}return r?Promise.resolve({applied:!1}):je.asPromise(Y.workspace.applyEdit(n).then(s=>({applied:s})))}handleFailedRequest(e,t,n,i,r=!0){if(n instanceof _.ResponseError){if(n.code===_.ErrorCodes.PendingResponseRejected||n.code===_.ErrorCodes.ConnectionInactive)return i;if(n.code===_.LSPErrorCodes.RequestCancelled||n.code===_.LSPErrorCodes.ServerCancelled){if(t!==void 0&&t.isCancellationRequested)return i;throw n.data!==void 0?new Ke.LSPCancellationError(n.data):new Y.CancellationError}else if(n.code===_.LSPErrorCodes.ContentModified){if(a.RequestsToCancelOnContentModified.has(e.method)||a.CancellableResolveCalls.has(e.method))throw new Y.CancellationError;return i}}throw this.error(`Request ${e.method} failed.`,n,r),n}};me.BaseLanguageClient=Fn;Fn.RequestsToCancelOnContentModified=new Set([_.SemanticTokensRequest.method,_.SemanticTokensRangeRequest.method,_.SemanticTokensDeltaRequest.method]);Fn.CancellableResolveCalls=new Set([_.CompletionResolveRequest.method,_.CodeLensResolveRequest.method,_.CodeActionResolveRequest.method,_.InlayHintResolveRequest.method,_.DocumentLinkResolveRequest.method,_.WorkspaceSymbolResolveRequest.method]);var oa=class{error(e){(0,_.RAL)().console.error(e)}warn(e){(0,_.RAL)().console.warn(e)}info(e){(0,_.RAL)().console.info(e)}log(e){(0,_.RAL)().console.log(e)}};function Xl(a,e,t,n,i){let r=new oa,s=(0,_.createProtocolConnection)(a,e,r,i);return s.onError(d=>{t(d[0],d[1],d[2])}),s.onClose(n),{listen:()=>s.listen(),sendRequest:s.sendRequest,onRequest:s.onRequest,hasPendingResponse:s.hasPendingResponse,sendNotification:s.sendNotification,onNotification:s.onNotification,onProgress:s.onProgress,sendProgress:s.sendProgress,trace:(d,l,g)=>{let h={sendNotification:!1,traceFormat:_.TraceFormat.Text};return g===void 0?s.trace(d,l,h):(je.boolean(g),s.trace(d,l,g))},initialize:d=>s.sendRequest(_.InitializeRequest.type,d),shutdown:()=>s.sendRequest(_.ShutdownRequest.type,void 0),exit:()=>s.sendNotification(_.ExitNotification.type),end:()=>s.end(),dispose:()=>s.dispose()}}var aa;(function(a){function e(t){return[new Zl.InlineCompletionItemFeature(t)]}a.createAll=e})(aa||(me.ProposedFeatures=aa={}))});var rd=F(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.terminate=void 0;var id=I("child_process"),ep=I("path"),tp=process.platform==="win32",np=process.platform==="darwin",ip=process.platform==="linux";function rp(a,e){if(tp)try{let i={stdio:["pipe","pipe","ignore"]};return e&&(i.cwd=e),id.execFileSync("taskkill",["/T","/F","/PID",a.pid.toString()],i),!0}catch{return!1}else if(ip||np)try{var t=(0,ep.join)(__dirname,"terminateProcess.sh"),n=id.spawnSync(t,[a.pid.toString()]);return!n.error}catch{return!1}else return a.kill("SIGKILL"),!0}Xi.terminate=rp});var od=F(Fe=>{"use strict";var sp=Fe&&Fe.__createBinding||(Object.create?(function(a,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(a,n,i)}):(function(a,e,t,n){n===void 0&&(n=t),a[n]=e[t]})),da=Fe&&Fe.__exportStar||function(a,e){for(var t in a)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&sp(e,a,t)};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.DiagnosticPullMode=Fe.vsdiag=void 0;da(L(),Fe);da(W(),Fe);var sd=ks();Object.defineProperty(Fe,"vsdiag",{enumerable:!0,get:function(){return sd.vsdiag}});Object.defineProperty(Fe,"DiagnosticPullMode",{enumerable:!0,get:function(){return sd.DiagnosticPullMode}});da(ca(),Fe)});var ud=F(Te=>{"use strict";var op=Te&&Te.__createBinding||(Object.create?(function(a,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(a,n,i)}):(function(a,e,t,n){n===void 0&&(n=t),a[n]=e[t]})),dd=Te&&Te.__exportStar||function(a,e){for(var t in a)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&op(e,a,t)};Object.defineProperty(Te,"__esModule",{value:!0});Te.SettingMonitor=Te.LanguageClient=Te.TransportKind=void 0;var it=I("child_process"),ua=I("fs"),la=I("path"),yt=I("vscode"),ne=Ie(),ad=ca(),ap=rd(),re=Pa(),cp=qd(),dp=Id();dd(Pa(),Te);dd(od(),Te);var cd="^1.82.0",se;(function(a){a[a.stdio=0]="stdio",a[a.ipc=1]="ipc",a[a.pipe=2]="pipe",a[a.socket=3]="socket"})(se||(Te.TransportKind=se={}));var vt;(function(a){function e(t){let n=t;return n&&n.kind===se.socket&&ne.number(n.port)}a.isSocket=e})(vt||(vt={}));var pa;(function(a){function e(t){return ne.string(t.command)}a.is=e})(pa||(pa={}));var fa;(function(a){function e(t){return ne.string(t.module)}a.is=e})(fa||(fa={}));var ha;(function(a){function e(t){let n=t;return n&&n.writer!==void 0&&n.reader!==void 0}a.is=e})(ha||(ha={}));var ga;(function(a){function e(t){let n=t;return n&&n.process!==void 0&&typeof n.detached=="boolean"}a.is=e})(ga||(ga={}));var ma=class extends ad.BaseLanguageClient{constructor(e,t,n,i,r){let s,c,d,l,g;ne.string(t)?(s=e,c=t,d=n,l=i,g=!!r):(s=e.toLowerCase(),c=e,d=t,l=n,g=i),g===void 0&&(g=!1),super(s,c,l),this._serverOptions=d,this._forceDebug=g,this._isInDebugMode=g;try{this.checkVersion()}catch(h){throw ne.string(h.message)&&this.outputChannel.appendLine(h.message),h}}checkVersion(){let e=cp(yt.version);if(!e)throw new Error(`No valid VS Code version detected. Version string is: ${yt.version}`);if(e.prerelease&&e.prerelease.length>0&&(e.prerelease=[]),!dp(e,cd))throw new Error(`The language client requires VS Code version ${cd} but received version ${yt.version}`)}get isInDebugMode(){return this._isInDebugMode}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(e=>setTimeout(e,1e3)),await this.start()):await this.start()}stop(e=2e3){return super.stop(e).finally(()=>{if(this._serverProcess){let t=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(t),this._isDetached=void 0}})}checkProcessDied(e){!e||e.pid===void 0||setTimeout(()=>{try{e.pid!==void 0&&(process.kill(e.pid,0),(0,ap.terminate)(e))}catch{}},2e3)}handleConnectionClosed(){return this._serverProcess=void 0,super.handleConnectionClosed()}fillInitializeParams(e){super.fillInitializeParams(e),e.processId===null&&(e.processId=process.pid)}createMessageTransports(e){function t(g,h){if(!g&&!h)return;let f=Object.create(null);return Object.keys(process.env).forEach(v=>f[v]=process.env[v]),h&&(f.ELECTRON_RUN_AS_NODE="1",f.ELECTRON_NO_ASAR="1"),g&&Object.keys(g).forEach(v=>f[v]=g[v]),f}let n=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],i=["--debug","--debug-brk","--inspect","--inspect-brk"];function r(){let g=process.execArgv;return g?g.some(h=>n.some(f=>h.startsWith(f))||i.some(f=>h===f)):!1}function s(g){if(g.stdin===null||g.stdout===null||g.stderr===null)throw new Error("Process created without stdio streams")}let c=this._serverOptions;if(ne.func(c))return c().then(g=>{if(ad.MessageTransports.is(g))return this._isDetached=!!g.detached,g;if(ha.is(g))return this._isDetached=!!g.detached,{reader:new re.StreamMessageReader(g.reader),writer:new re.StreamMessageWriter(g.writer)};{let h;return ga.is(g)?(h=g.process,this._isDetached=g.detached):(h=g,this._isDetached=!1),h.stderr.on("data",f=>this.outputChannel.append(ne.string(f)?f:f.toString(e))),{reader:new re.StreamMessageReader(h.stdout),writer:new re.StreamMessageWriter(h.stdin)}}});let d,l=c;return l.run||l.debug?this._forceDebug||r()?(d=l.debug,this._isInDebugMode=!0):(d=l.run,this._isInDebugMode=!1):d=c,this._getServerWorkingDir(d.options).then(g=>{if(fa.is(d)&&d.module){let h=d,f=h.transport||se.stdio;if(h.runtime){let v=[],p=h.options??Object.create(null);p.execArgv&&p.execArgv.forEach(T=>v.push(T)),v.push(h.module),h.args&&h.args.forEach(T=>v.push(T));let y=Object.create(null);y.cwd=g,y.env=t(p.env,!1);let C=this._getRuntimePath(h.runtime,g),b;if(f===se.ipc?(y.stdio=[null,null,null,"ipc"],v.push("--node-ipc")):f===se.stdio?v.push("--stdio"):f===se.pipe?(b=(0,re.generateRandomPipeName)(),v.push(`--pipe=${b}`)):vt.isSocket(f)&&v.push(`--socket=${f.port}`),v.push(`--clientProcessId=${process.pid.toString()}`),f===se.ipc||f===se.stdio){let T=it.spawn(C,v,y);return!T||!T.pid?Gt(T,`Launching server using runtime ${C} failed.`):(this._serverProcess=T,T.stderr.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),f===se.ipc?(T.stdout.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),Promise.resolve({reader:new re.IPCMessageReader(T),writer:new re.IPCMessageWriter(T)})):Promise.resolve({reader:new re.StreamMessageReader(T.stdout),writer:new re.StreamMessageWriter(T.stdin)}))}else{if(f===se.pipe)return(0,re.createClientPipeTransport)(b).then(T=>{let P=it.spawn(C,v,y);return!P||!P.pid?Gt(P,`Launching server using runtime ${C} failed.`):(this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>({reader:q[0],writer:q[1]})))});if(vt.isSocket(f))return(0,re.createClientSocketTransport)(f.port).then(T=>{let P=it.spawn(C,v,y);return!P||!P.pid?Gt(P,`Launching server using runtime ${C} failed.`):(this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>({reader:q[0],writer:q[1]})))})}}else{let v;return new Promise((p,y)=>{let C=(h.args&&h.args.slice())??[];f===se.ipc?C.push("--node-ipc"):f===se.stdio?C.push("--stdio"):f===se.pipe?(v=(0,re.generateRandomPipeName)(),C.push(`--pipe=${v}`)):vt.isSocket(f)&&C.push(`--socket=${f.port}`),C.push(`--clientProcessId=${process.pid.toString()}`);let b=h.options??Object.create(null);if(b.env=t(b.env,!0),b.execArgv=b.execArgv||[],b.cwd=g,b.silent=!0,f===se.ipc||f===se.stdio){let T=it.fork(h.module,C||[],b);s(T),this._serverProcess=T,T.stderr.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),f===se.ipc?(T.stdout.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),p({reader:new re.IPCMessageReader(this._serverProcess),writer:new re.IPCMessageWriter(this._serverProcess)})):p({reader:new re.StreamMessageReader(T.stdout),writer:new re.StreamMessageWriter(T.stdin)})}else f===se.pipe?(0,re.createClientPipeTransport)(v).then(T=>{let P=it.fork(h.module,C||[],b);s(P),this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>{p({reader:q[0],writer:q[1]})},y)},y):vt.isSocket(f)&&(0,re.createClientSocketTransport)(f.port).then(T=>{let P=it.fork(h.module,C||[],b);s(P),this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>{p({reader:q[0],writer:q[1]})},y)},y)})}}else if(pa.is(d)&&d.command){let h=d,f=d.args!==void 0?d.args.slice(0):[],v,p=d.transport;if(p===se.stdio)f.push("--stdio");else if(p===se.pipe)v=(0,re.generateRandomPipeName)(),f.push(`--pipe=${v}`);else if(vt.isSocket(p))f.push(`--socket=${p.port}`);else if(p===se.ipc)throw new Error("Transport kind ipc is not support for command executable");let y=Object.assign({},h.options);if(y.cwd=y.cwd||g,p===void 0||p===se.stdio){let C=it.spawn(h.command,f,y);return!C||!C.pid?Gt(C,`Launching server using command ${h.command} failed.`):(C.stderr.on("data",b=>this.outputChannel.append(ne.string(b)?b:b.toString(e))),this._serverProcess=C,this._isDetached=!!y.detached,Promise.resolve({reader:new re.StreamMessageReader(C.stdout),writer:new re.StreamMessageWriter(C.stdin)}))}else{if(p===se.pipe)return(0,re.createClientPipeTransport)(v).then(C=>{let b=it.spawn(h.command,f,y);return!b||!b.pid?Gt(b,`Launching server using command ${h.command} failed.`):(this._serverProcess=b,this._isDetached=!!y.detached,b.stderr.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),b.stdout.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),C.onConnected().then(T=>({reader:T[0],writer:T[1]})))});if(vt.isSocket(p))return(0,re.createClientSocketTransport)(p.port).then(C=>{let b=it.spawn(h.command,f,y);return!b||!b.pid?Gt(b,`Launching server using command ${h.command} failed.`):(this._serverProcess=b,this._isDetached=!!y.detached,b.stderr.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),b.stdout.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),C.onConnected().then(T=>({reader:T[0],writer:T[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(c,null,4)))}).finally(()=>{this._serverProcess!==void 0&&this._serverProcess.on("exit",(g,h)=>{g!==null&&this.error(`Server process exited with code ${g}.`,void 0,!1),h!==null&&this.error(`Server process exited with signal ${h}.`,void 0,!1)})})}_getRuntimePath(e,t){if(la.isAbsolute(e))return e;let n=this._mainGetRootPath();if(n!==void 0){let i=la.join(n,e);if(ua.existsSync(i))return i}if(t!==void 0){let i=la.join(t,e);if(ua.existsSync(i))return i}return e}_mainGetRootPath(){let e=yt.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}_getServerWorkingDir(e){let t=e&&e.cwd;return t||(t=this.clientOptions.workspaceFolder?this.clientOptions.workspaceFolder.uri.fsPath:this._mainGetRootPath()),t?new Promise(n=>{ua.lstat(t,(i,r)=>{n(!i&&r.isDirectory()?t:void 0)})}):Promise.resolve(void 0)}};Te.LanguageClient=ma;var va=class{constructor(e,t){this._client=e,this._setting=t,this._listeners=[]}start(){return yt.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new yt.Disposable(()=>{this._client.needsStop()&&this._client.stop()})}onDidChangeConfiguration(){let e=this._setting.indexOf("."),t=e>=0?this._setting.substr(0,e):this._setting,n=e>=0?this._setting.substr(e+1):void 0,i=n?yt.workspace.getConfiguration(t).get(n,!1):yt.workspace.getConfiguration(t);i&&this._client.needsStart()?this._client.start().catch(r=>this._client.error("Start failed after configuration change",r,"force")):!i&&this._client.needsStop()&&this._client.stop().catch(r=>this._client.error("Stop failed after configuration change",r,"force"))}};Te.SettingMonitor=va;function Gt(a,e){return a===null?Promise.reject(e):new Promise((t,n)=>{a.on("error",i=>{n(`${e} ${i}`)}),setImmediate(()=>n(e))})}});var pd=F((Of,ld)=>{"use strict";ld.exports=ud()});import*as ue from"vscode";var Pr=sn(Ed(),1);import*as S from"vscode";import*as Lt from"path";import{fork as Md}from"child_process";import*as Tr from"vscode";var Gn=class{constructor(e){this.secrets=e}secrets;async ReadyAPIKey(e){if(process.env.FACTORIO_UPLOAD_API_KEY)return{from:"env"};try{let t=await this.secrets.get("factorio-uploadmods");if(t&&(e&&(e=await Tr.window.showInformationMessage("Key already present. Replace it?",{modal:!0},"Yes","No")==="Yes"),!e))return{from:"secrets",key:t};if(t=await Tr.window.showInputBox({prompt:"Mod Portal API Key:",ignoreFocusOut:!0,password:!0}),t)return t=t.trim(),await this.secrets.store("factorio-uploadmods",t),{from:"new",key:t}}catch{}return!1}async ClearApiKey(){return this.secrets.delete("factorio-uploadmods")}};import{platform as Ad,tmpdir as Od}from"os";var j={valTypes:{none:"NONE",primitive:"PRIM",object:"OBJECT",array:"ARRAY"},getValType:function(a){return a&&typeof a=="object"||Array.isArray(a)?Array.isArray(a)?j.valTypes.array:typeof a=="object"?j.valTypes.object:void 0:j.valTypes.primitive},getPathType:function(a){var e=[];for(var t in a){var n=a[t];n?j.isNumber(n)?e.push(j.valTypes.array):e.push(j.valTypes.object):e.push(j.valTypes.none)}return e},isUndefined:function(a){return a===void 0},isNumber:function(a){return!isNaN(parseFloat(a))&&isFinite(a)&&a.indexOf(".")===-1},isEmptyObj:function(a){for(var e in a)if(Object.hasOwnProperty.call(a,e))return!1;return JSON.stringify(a)===JSON.stringify({})},isNotObject:function(a){return!a||typeof a!="object"},isEmptyArray:function(a){return Array.isArray(a)&&a.length==0},isNotArray:function(a){return Array.isArray(a)==0},removeEmptyArrayItem:function(a){return a.filter(function(e){return e!=null&&e!=""})},getFieldName:function(a,e,t,n,i){return i?(e||"")+(j.isNumber(a)?"["+a+"]":(t&&!e?"":".")+a):n?(e||"")+"["+a+"]":(e?e+".":"")+a},startsWith:function(a,e){return a.indexOf(e)==0},convert:function(a,e){var t={};return j.isNotObject(a)&&j.isNotArray(a)?e?(t[e]=a,t):a:j.isEmptyArray(a)?a:(function n(i,r,s){var c=Array.isArray(i);for(var d in i){var l=i[d];l&&typeof l=="object"?Array.isArray(l)?j.isEmptyArray(l)?t[j.getFieldName(d,r,s,!1,!0)]=l:t=n(l,j.getFieldName(d,r,s,!1,!0),c):c&&j.isEmptyObj(l)==0?t=n(l,j.getFieldName(d,r,s,!0)):j.isEmptyObj(l)==0?t=n(l,j.getFieldName(d,r,s)):j.isEmptyObj(l)&&(t[j.getFieldName(d,r,s,c)]=l):c||j.isNumber(d)?t[j.getFieldName(d,r,s,!0)]=l:t[j.getFieldName(d,r,s)]=l}return t})(a,e,!0)},backward:function(a,e){var t={},n=/\[(\d+)\]/g;if(j.isNotObject(a)&&j.isNotArray(a))return e?a[e]:a;if(j.isEmptyArray(a))return a;for(var i in a){var r=a[i];if(e){var s=new RegExp("^"+e);i=i.replace(s,"")}i=i.replace(n,".$1"),j.startsWith(i,".")&&(i=i.replace(/^\./,""));var c=i.split("."),d=j.getPathType(c);j.isUndefined(d)||d[0]!=j.valTypes.array||Array.isArray(t)!=0||(t=[]),(function l(g,h,f,v){var p=c.shift(),y=d.shift();if(p!==void 0&&p!=""){if(p=j.isNumber(p)?parseInt(p):p,c.length>0)return h[p]===void 0&&(h[p]=d[0]==j.valTypes.array?[]:{}),void l(g,h[p],p,h);y==j.valTypes.array&&f&&v?(Array.isArray(v[f])==0&&(v[f]=[]),v[f].push(g)):h[p]=g}else t=g})(r,t)}return t}};var Zn;function Ld(a){return Zn?Ad()==="win32"?`${a};${S.Uri.joinPath(Zn,"bin").fsPath}`:`${a}:${S.Uri.joinPath(Zn,"bin").fsPath}`:a}async function Ia(a){if(S.workspace.workspaceFolders){let e=new Gn(a.secrets);a.subscriptions.push(S.commands.registerCommand("factorio.clearApiKey",async()=>{await e.ClearApiKey()})),a.subscriptions.push(S.commands.registerCommand("factorio.setApiKey",async()=>{await e.ReadyAPIKey(!0)}));let t=S.extensions.getExtension("vscode.git");t&&!t.isActive&&await t.activate();let n=new xr(a,e,t?.exports.getAPI(1));a.subscriptions.push(n);let i=S.window.createTreeView("factoriomods",{treeDataProvider:n});a.subscriptions.push(i),Zn=a.extensionUri}}var Rr=class{constructor(e,t){this.context=e;this.modPackages=t}context;modPackages;provideTasks(e){let t=[],n=Ve.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())n.has(i)&&(t.push(new S.Task({label:`${i.name}.datestamp`,type:"factorio",modname:i.label,command:"datestamp"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.datestamp`,"factorio",i.DateStampTask(),[])),t.push(new S.Task({label:`${i.name}.package`,type:"factorio",modname:i.label,command:"package"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.package`,"factorio",i.PackageTask(),[])),t.push(new S.Task({label:`${i.name}.version`,type:"factorio",modname:i.label,command:"version"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.version`,"factorio",i.IncrementTask(),[])),t.push(new S.Task({label:`${i.name}.upload`,type:"factorio",modname:i.label,command:"upload"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.upload`,"factorio",i.PostToPortalTask(),[])),t.push(new S.Task({label:`${i.name}.details`,type:"factorio",modname:i.label,command:"details"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.details`,"factorio",i.DetailsTask(),[])),t.push(new S.Task({label:`${i.name}.publish`,type:"factorio",modname:i.label,command:"publish"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.publish`,"factorio",i.PublishTask(),[])));return t}resolveTaskExecution(e,t){if(e.definition.command==="adjustMods")return e.definition.adjustMods?e.definition.modsPath?this.AdjustModsTask(e.definition):this.ConfigErrorTask(e.definition,"missing `modsPath`"):this.ConfigErrorTask(e.definition,"missing `adjustMods`");if(!e.definition.modname)return this.ConfigErrorTask(e.definition,"missing `modname`");if(e.definition.command==="run"&&!e.definition.script)return this.ConfigErrorTask(e.definition,"missing `script`");let n=Ve.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(i.label===e.definition.modname&&n.has(i)){let r=i;switch(e.definition.command){case"run":return r.RunTask(e.definition.script,e.definition.scriptArgs);case"compile":return r.RunTask("compile");case"datestamp":return r.DateStampTask();case"package":return r.PackageTask();case"version":return r.IncrementTask();case"upload":return r.PostToPortalTask();case"details":return r.DetailsTask();case"publish":return r.PublishTask();default:return this.ConfigErrorTask(e.definition,`unknown \`command\` "${e.definition.command}"`)}}return this.ConfigErrorTask(e.definition,`mod "${e.definition.modname}" not found`)}resolveTask(e,t){if(e.definition.type==="factorio"){let n=this.resolveTaskExecution(e,t);return new S.Task(e.definition,e.scope||S.TaskScope.Workspace,e.name,e.source,n,[])}}ConfigErrorTask(e,t){return new S.CustomExecution(async()=>new He(n=>{n.write(t+`
12
- `),n.write(JSON.stringify(e,void 0,2)),n.close()}))}getFMTKCLIPath(){return this.context.asAbsolutePath("./dist/fmtk-cli.js")}AdjustModsTask(e){let t=["mods","--modsPath",e.modsPath,"adjust"];e.allowDisableBaseMod&&t.push("--allowDisableBase"),e.disableExtraMods&&t.push("--disableExtra");for(let n in e.adjustMods)t.push(`${n}=${e.adjustMods[n]}`);return new S.CustomExecution(async()=>new He(async n=>{await ze(n,this.getFMTKCLIPath(),t,process.cwd()),n.close()}))}},Ve=class extends S.TreeItem{constructor(t,n,i,r,s,c){super(t);this.resourceUri=t;this.modinfo=n;this.keychain=i;this.context=r;this._onDidChange=s;this.gitapi=c;this.command={title:"Open",command:"vscode.open",arguments:[t]},this.UpdateTreeItemFields()}resourceUri;modinfo;keychain;context;_onDidChange;gitapi;get name(){return this.modinfo.name}get title(){return this.modinfo.title}get version(){return this.modinfo.version}get scripts(){return this.modinfo.package?.scripts}static sort(t,n){let i=t.name.toLowerCase().localeCompare(n.name.toLowerCase());if(i!==0)return i*100;let r=Pr.compare(t.version,n.version,{loose:!0});return r!==0?-r*10:t.resourceUri<n.resourceUri?-1:t.resourceUri>n.resourceUri?1:0}static latestPackages(t){let n=new Map;for(let r of t)n.has(r.name)?n.get(r.name).push(r):n.set(r.name,[r]);let i=new Set;for(let r of n.values())i.add(r.reduce((s,c)=>Pr.compare(s.version,c.version,{loose:!0})<0?c:s));return i}async gitLabel(){let t=this.gitapi?.getRepository(this.resourceUri);if(t){let n=await t.log({}),i=0;for(;i<n.length;i++){let r=n[i];if("refNames"in r&&r.refNames.some(d=>d.match(/^tag:/)))return`+${i}`}}}async ReloadInfo(){let n=(await S.workspace.openTextDocument(this.resourceUri)).getText();this.modinfo=JSON.parse(n);let i=await this.gitLabel();this.UpdateTreeItemFields(i),this._onDidChange(this)}UpdateTreeItemFields(t){this.label=this.name,this.description=t?`${this.version} (${t})`:this.version,this.tooltip=this.title}getFMTKCLIPath(){return this.context.asAbsolutePath("./dist/fmtk-cli.js")}RunTask(t,n){return new S.CustomExecution(async()=>new He(async i=>{await ze(i,this.getFMTKCLIPath(),["run",t,...n??[]],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}DateStampTask(){return new S.CustomExecution(async()=>new He(async t=>{await ze(t,this.getFMTKCLIPath(),["datestamp"],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PackageTask(){let t=["package"];return S.workspace.getConfiguration(void 0,this.resourceUri).get("factorio.package.zipLocation","inside")==="outside"&&(t.push("--outdir"),t.push("..")),new S.CustomExecution(async()=>new He(async i=>{await ze(i,this.getFMTKCLIPath(),t,S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}IncrementTask(){return new S.CustomExecution(async()=>new He(async t=>{await ze(t,this.getFMTKCLIPath(),["version"],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PostToPortalTask(){return new S.CustomExecution(async()=>new He(async t=>{await this.ReloadInfo();let n=S.workspace.getConfiguration(void 0,this.resourceUri),i=Lt.dirname(this.resourceUri.path);n.get("factorio.package.zipLocation","inside")==="outside"&&(i=Lt.dirname(i));let r=this.resourceUri.with({path:i}),c=(await S.workspace.fs.readDirectory(r)).filter(([h,f])=>f===S.FileType.File&&h.startsWith(this.name)&&h.match(/_\d+\.\d+\.\d+\.zip$/)).map(([h,f])=>h).sort().reverse(),d=await S.window.showQuickPick(c,{placeHolder:"Select Package to upload"});if(!d){t.close();return}let l=Lt.join(r.fsPath,d),g=await this.keychain.ReadyAPIKey();g&&await ze(t,this.getFMTKCLIPath(),["upload",l,this.name],S.Uri.joinPath(this.resourceUri,"..").fsPath,g.from!=="env"?{FACTORIO_UPLOAD_API_KEY:g.key}:void 0),await this.ReloadInfo(),t.close()}))}DetailsTask(){return new S.CustomExecution(async()=>new He(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await ze(t,this.getFMTKCLIPath(),["details"],S.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}PublishTask(){return new S.CustomExecution(async()=>new He(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await ze(t,this.getFMTKCLIPath(),["publish"],S.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}},xr=class{constructor(e,t,n){this.context=e;this.keychain=t;this.gitapi=n;this.modPackages=new Map,S.workspace.findFiles("**/info.json").then(r=>{r.forEach(s=>{this.updateInfoJson(s)})});let i=S.workspace.createFileSystemWatcher("**/info.json");this.subscriptions.push(i.onDidChange(r=>this.updateInfoJson(r))),this.subscriptions.push(i.onDidCreate(r=>this.updateInfoJson(r))),this.subscriptions.push(i.onDidDelete(r=>this.removeInfoJson(r))),this.subscriptions.push(i),n&&this.subscriptions.push(n.onDidOpenRepository(async r=>{for(let s of this.modPackages.values()){let c=n.getRepository(s.resourceUri);r.rootUri.toString()===c?.rootUri?.toString()&&(await s.ReloadInfo(),this.subscriptions.push(r.onDidCommit(async()=>{await s.ReloadInfo()})),this.subscriptions.push(r.onDidCheckout(async()=>{await s.ReloadInfo()})))}})),this.subscriptions.push(S.tasks.registerTaskProvider("factorio",new Rr(this.context,this.modPackages))),this.subscriptions.push(S.commands.registerCommand("factorio.openchangelog",async r=>S.window.showTextDocument(S.Uri.joinPath(r.resourceUri,"../changelog.txt")))),this.subscriptions.push(S.commands.registerCommand("factorio.datestamp",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="datestamp"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.package",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="package"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.version",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="version"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.upload",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="upload"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.details",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="details"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.publish",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="publish"&&c.definition.modname===r.label);await S.tasks.executeTask(s)}))}context;keychain;gitapi;_onDidChangeTreeData=new S.EventEmitter;onDidChangeTreeData=this._onDidChangeTreeData.event;modPackages;subscriptions=[this._onDidChangeTreeData];dispose(){this.subscriptions.forEach(e=>e.dispose())}async updateInfoJson(e){if(e.scheme==="file"){let n=(await S.workspace.openTextDocument(e)).getText();if(n){let i=JSON.parse(n);if(i&&i.name)if(this.modPackages.has(e.toString()))await this.modPackages.get(e.toString())?.ReloadInfo();else{let r=new Ve(e,i,this.keychain,this.context,s=>{this._onDidChangeTreeData.fire(s)},this.gitapi);this.modPackages.set(e.toString(),r),await r.ReloadInfo()}else this.modPackages.delete(e.toString())}else this.modPackages.delete(e.toString())}else this.modPackages.delete(e.toString());this._onDidChangeTreeData.fire(void 0)}removeInfoJson(e){this.modPackages.delete(e.toString()),this._onDidChangeTreeData.fire(void 0)}getTreeItem(e){return e}async getChildren(e){if(e)if(e instanceof Ve){let t=[];if(this.modPackages){let n=Ve.latestPackages(this.modPackages.values());n.has(e)&&this.modPackages.forEach((i,r)=>{i.label===e.label&&!n.has(i)&&(t.push(i),i.contextValue="older")})}return t.sort(Ve.sort)}else return[];else{let t=[];if(this.modPackages){let n=Ve.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(n.has(i)){t.push(i);let r=["latest"];try{await S.workspace.fs.stat(S.Uri.joinPath(i.resourceUri,"../changelog.txt")),r.push("haschangelog")}catch{}i.contextValue=r.join(" "),i.collapsibleState=(()=>{for(let s of this.modPackages.values())if(i.label===s.label&&!n.has(s))return S.TreeItemCollapsibleState.Collapsed;return S.TreeItemCollapsibleState.None})()}}return t.sort(Ve.sort)}}},kr=S.Uri.file(Lt.join(Od(),`vscode-${process.pid}-fmtk-config.json`));async function ze(a,e,t,n,i,r){let s=S.workspace.getConfiguration("factorio");await S.workspace.fs.writeFile(kr,Buffer.from(JSON.stringify(j.convert({docs:await s.get("docs"),package:await s.get("package")}))));let c=Object.assign({},process.env,i,{FMTK_CONFIG:kr.fsPath});return c.Path=Ld(c.Path??""),new Promise((d,l)=>{let g=s.get("inspect",!1),h=Md(e,t,{cwd:n,execArgv:g?["--nolazy","--inspect-brk=34200"]:void 0,env:c,stdio:"pipe"});new _r(h.stdout,Buffer.from(`
11
+ ${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this._listeners.push(Y.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)}))}refreshTrace(e,t=!1){let n=Y.workspace.getConfiguration(this._id),i=_.Trace.Off,r=_.TraceFormat.Text;if(n){let s=n.get("trace.server","off");typeof s=="string"?i=_.Trace.fromString(s):(i=_.Trace.fromString(n.get("trace.server.verbosity","off")),r=_.TraceFormat.fromString(n.get("trace.server.format","text")))}this._trace=i,this._traceFormat=r,e.trace(this._trace,this._tracer,{sendNotification:t,traceFormat:this._traceFormat}).catch(s=>{this.error("Updating trace failed with error",s,!1)})}hookFileEvents(e){let t=this._clientOptions.synchronize.fileEvents;if(!t)return;let n;je.array(t)?n=t:n=[t],n&&this._dynamicFeatures.get(_.DidChangeWatchedFilesNotification.type.method).registerRaw(Zc.generateUuid(),n)}registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),Ke.DynamicFeature.is(e)){let t=e.registrationType;this._dynamicFeatures.set(t.method,e)}}getFeature(e){return this._dynamicFeatures.get(e)}hasDedicatedTextSynchronizationFeature(e){let t=this.getFeature(_.NotebookDocumentSyncRegistrationType.method);return t===void 0||!(t instanceof Xc.NotebookDocumentSyncFeature)?!1:t.handles(e)}registerBuiltinFeatures(){let e=new Map;this.registerFeature(new ed.ConfigurationFeature(this)),this.registerFeature(new Jt.DidOpenTextDocumentFeature(this,this._syncedDocuments)),this._didChangeTextDocumentFeature=new Jt.DidChangeTextDocumentFeature(this,e),this._didChangeTextDocumentFeature.onPendingChangeAdded(()=>{this.triggerPendingChangeDelivery()}),this.registerFeature(this._didChangeTextDocumentFeature),this.registerFeature(new Jt.WillSaveFeature(this)),this.registerFeature(new Jt.WillSaveWaitUntilFeature(this)),this.registerFeature(new Jt.DidSaveTextDocumentFeature(this)),this.registerFeature(new Jt.DidCloseTextDocumentFeature(this,this._syncedDocuments,e)),this.registerFeature(new Ll.FileSystemWatcherFeature(this,t=>this.notifyFileEvent(t))),this.registerFeature(new _l.CompletionItemFeature(this)),this.registerFeature(new Tl.HoverFeature(this)),this.registerFeature(new Pl.SignatureHelpFeature(this)),this.registerFeature(new kl.DefinitionFeature(this)),this.registerFeature(new ql.ReferencesFeature(this)),this.registerFeature(new Rl.DocumentHighlightFeature(this)),this.registerFeature(new xl.DocumentSymbolFeature(this)),this.registerFeature(new Fl.WorkspaceSymbolFeature(this)),this.registerFeature(new Il.CodeActionFeature(this)),this.registerFeature(new El.CodeLensFeature(this)),this.registerFeature(new ia.DocumentFormattingFeature(this)),this.registerFeature(new ia.DocumentRangeFormattingFeature(this)),this.registerFeature(new ia.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new Ml.RenameFeature(this)),this.registerFeature(new Al.DocumentLinkFeature(this)),this.registerFeature(new Ol.ExecuteCommandFeature(this)),this.registerFeature(new ed.SyncConfigurationFeature(this)),this.registerFeature(new Hl.TypeDefinitionFeature(this)),this.registerFeature(new Nl.ImplementationFeature(this)),this.registerFeature(new Ul.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new Kl.WorkspaceFoldersFeature(this)),this.registerFeature(new jl.FoldingRangeFeature(this)),this.registerFeature(new Wl.DeclarationFeature(this)),this.registerFeature(new $l.SelectionRangeFeature(this)),this.registerFeature(new zl.ProgressFeature(this)),this.registerFeature(new Vl.CallHierarchyFeature(this)),this.registerFeature(new Bl.SemanticTokensFeature(this)),this.registerFeature(new Yl.LinkedEditingFeature(this)),this.registerFeature(new Qt.DidCreateFilesFeature(this)),this.registerFeature(new Qt.DidRenameFilesFeature(this)),this.registerFeature(new Qt.DidDeleteFilesFeature(this)),this.registerFeature(new Qt.WillCreateFilesFeature(this)),this.registerFeature(new Qt.WillRenameFilesFeature(this)),this.registerFeature(new Qt.WillDeleteFilesFeature(this)),this.registerFeature(new Jl.TypeHierarchyFeature(this)),this.registerFeature(new Ql.InlineValueFeature(this)),this.registerFeature(new Gl.InlayHintsFeature(this)),this.registerFeature(new bl.DiagnosticFeature(this)),this.registerFeature(new Xc.NotebookDocumentSyncFeature(this))}registerProposedFeatures(){this.registerFeatures(aa.createAll(this))}fillInitializeParams(e){for(let t of this._features)je.func(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};(0,Ke.ensure)(e,"workspace").applyEdit=!0;let t=(0,Ke.ensure)((0,Ke.ensure)(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[_.ResourceOperationKind.Create,_.ResourceOperationKind.Rename,_.ResourceOperationKind.Delete],t.failureHandling=_.FailureHandlingKind.TextOnlyTransactional,t.normalizesLineEndings=!0,t.changeAnnotationSupport={groupsOnLabel:!0};let n=(0,Ke.ensure)((0,Ke.ensure)(e,"textDocument"),"publishDiagnostics");n.relatedInformation=!0,n.versionSupport=!1,n.tagSupport={valueSet:[_.DiagnosticTag.Unnecessary,_.DiagnosticTag.Deprecated]},n.codeDescriptionSupport=!0,n.dataSupport=!0;let i=(0,Ke.ensure)(e,"window"),r=(0,Ke.ensure)(i,"showMessage");r.messageActionItem={additionalPropertiesSupport:!0};let s=(0,Ke.ensure)(i,"showDocument");s.support=!0;let c=(0,Ke.ensure)(e,"general");c.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(a.RequestsToCancelOnContentModified)},c.regularExpressions={engine:"ECMAScript",version:"ES2020"},c.markdown={parser:"marked",version:"1.1.0"},c.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(c.markdown.allowedTags=["ul","li","p","code","blockquote","ol","h1","h2","h3","h4","h5","h6","hr","em","pre","table","thead","tbody","tr","th","td","div","del","a","strong","br","img","span"]);for(let d of this._features)d.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let n of this._features)je.func(n.preInitialize)&&n.preInitialize(this._capabilities,t);for(let n of this._features)n.initialize(this._capabilities,t)}async handleRegistrationRequest(e){let t=this.clientOptions.middleware?.handleRegisterCapability;return t?t(e,n=>this.doRegisterCapability(n)):this.doRegisterCapability(e)}async doRegisterCapability(e){if(!this.isRunning()){for(let t of e.registrations)this._ignoredRegistrations.add(t.id);return}for(let t of e.registrations){let n=this._dynamicFeatures.get(t.method);if(n===void 0)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Registration failed.`));let i=t.registerOptions??{};i.documentSelector=i.documentSelector??this._clientOptions.documentSelector;let r={id:t.id,registerOptions:i};try{n.register(r)}catch(s){return Promise.reject(s)}}}async handleUnregistrationRequest(e){let t=this.clientOptions.middleware?.handleUnregisterCapability;return t?t(e,n=>this.doUnregisterCapability(n)):this.doUnregisterCapability(e)}async doUnregisterCapability(e){for(let t of e.unregisterations){if(this._ignoredRegistrations.has(t.id))continue;let n=this._dynamicFeatures.get(t.method);if(!n)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Unregistration failed.`));n.unregister(t.id)}}async handleApplyWorkspaceEdit(e){let t=e.edit,n=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(t)),i=new Map;Y.workspace.textDocuments.forEach(s=>i.set(s.uri.toString(),s));let r=!1;if(t.documentChanges){for(let s of t.documentChanges)if(_.TextDocumentEdit.is(s)&&s.textDocument.version&&s.textDocument.version>=0){let c=this._p2c.asUri(s.textDocument.uri).toString(),d=i.get(c);if(d&&d.version!==s.textDocument.version){r=!0;break}}}return r?Promise.resolve({applied:!1}):je.asPromise(Y.workspace.applyEdit(n).then(s=>({applied:s})))}handleFailedRequest(e,t,n,i,r=!0){if(n instanceof _.ResponseError){if(n.code===_.ErrorCodes.PendingResponseRejected||n.code===_.ErrorCodes.ConnectionInactive)return i;if(n.code===_.LSPErrorCodes.RequestCancelled||n.code===_.LSPErrorCodes.ServerCancelled){if(t!==void 0&&t.isCancellationRequested)return i;throw n.data!==void 0?new Ke.LSPCancellationError(n.data):new Y.CancellationError}else if(n.code===_.LSPErrorCodes.ContentModified){if(a.RequestsToCancelOnContentModified.has(e.method)||a.CancellableResolveCalls.has(e.method))throw new Y.CancellationError;return i}}throw this.error(`Request ${e.method} failed.`,n,r),n}};me.BaseLanguageClient=Fn;Fn.RequestsToCancelOnContentModified=new Set([_.SemanticTokensRequest.method,_.SemanticTokensRangeRequest.method,_.SemanticTokensDeltaRequest.method]);Fn.CancellableResolveCalls=new Set([_.CompletionResolveRequest.method,_.CodeLensResolveRequest.method,_.CodeActionResolveRequest.method,_.InlayHintResolveRequest.method,_.DocumentLinkResolveRequest.method,_.WorkspaceSymbolResolveRequest.method]);var oa=class{error(e){(0,_.RAL)().console.error(e)}warn(e){(0,_.RAL)().console.warn(e)}info(e){(0,_.RAL)().console.info(e)}log(e){(0,_.RAL)().console.log(e)}};function Xl(a,e,t,n,i){let r=new oa,s=(0,_.createProtocolConnection)(a,e,r,i);return s.onError(d=>{t(d[0],d[1],d[2])}),s.onClose(n),{listen:()=>s.listen(),sendRequest:s.sendRequest,onRequest:s.onRequest,hasPendingResponse:s.hasPendingResponse,sendNotification:s.sendNotification,onNotification:s.onNotification,onProgress:s.onProgress,sendProgress:s.sendProgress,trace:(d,l,g)=>{let h={sendNotification:!1,traceFormat:_.TraceFormat.Text};return g===void 0?s.trace(d,l,h):(je.boolean(g),s.trace(d,l,g))},initialize:d=>s.sendRequest(_.InitializeRequest.type,d),shutdown:()=>s.sendRequest(_.ShutdownRequest.type,void 0),exit:()=>s.sendNotification(_.ExitNotification.type),end:()=>s.end(),dispose:()=>s.dispose()}}var aa;(function(a){function e(t){return[new Zl.InlineCompletionItemFeature(t)]}a.createAll=e})(aa||(me.ProposedFeatures=aa={}))});var rd=F(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.terminate=void 0;var id=I("child_process"),ep=I("path"),tp=process.platform==="win32",np=process.platform==="darwin",ip=process.platform==="linux";function rp(a,e){if(tp)try{let i={stdio:["pipe","pipe","ignore"]};return e&&(i.cwd=e),id.execFileSync("taskkill",["/T","/F","/PID",a.pid.toString()],i),!0}catch{return!1}else if(ip||np)try{var t=(0,ep.join)(__dirname,"terminateProcess.sh"),n=id.spawnSync(t,[a.pid.toString()]);return!n.error}catch{return!1}else return a.kill("SIGKILL"),!0}Xi.terminate=rp});var od=F(Fe=>{"use strict";var sp=Fe&&Fe.__createBinding||(Object.create?(function(a,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(a,n,i)}):(function(a,e,t,n){n===void 0&&(n=t),a[n]=e[t]})),da=Fe&&Fe.__exportStar||function(a,e){for(var t in a)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&sp(e,a,t)};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.DiagnosticPullMode=Fe.vsdiag=void 0;da(L(),Fe);da(W(),Fe);var sd=ks();Object.defineProperty(Fe,"vsdiag",{enumerable:!0,get:function(){return sd.vsdiag}});Object.defineProperty(Fe,"DiagnosticPullMode",{enumerable:!0,get:function(){return sd.DiagnosticPullMode}});da(ca(),Fe)});var ud=F(Te=>{"use strict";var op=Te&&Te.__createBinding||(Object.create?(function(a,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(a,n,i)}):(function(a,e,t,n){n===void 0&&(n=t),a[n]=e[t]})),dd=Te&&Te.__exportStar||function(a,e){for(var t in a)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&op(e,a,t)};Object.defineProperty(Te,"__esModule",{value:!0});Te.SettingMonitor=Te.LanguageClient=Te.TransportKind=void 0;var it=I("child_process"),ua=I("fs"),la=I("path"),yt=I("vscode"),ne=Ie(),ad=ca(),ap=rd(),re=Pa(),cp=qd(),dp=Id();dd(Pa(),Te);dd(od(),Te);var cd="^1.82.0",se;(function(a){a[a.stdio=0]="stdio",a[a.ipc=1]="ipc",a[a.pipe=2]="pipe",a[a.socket=3]="socket"})(se||(Te.TransportKind=se={}));var vt;(function(a){function e(t){let n=t;return n&&n.kind===se.socket&&ne.number(n.port)}a.isSocket=e})(vt||(vt={}));var pa;(function(a){function e(t){return ne.string(t.command)}a.is=e})(pa||(pa={}));var fa;(function(a){function e(t){return ne.string(t.module)}a.is=e})(fa||(fa={}));var ha;(function(a){function e(t){let n=t;return n&&n.writer!==void 0&&n.reader!==void 0}a.is=e})(ha||(ha={}));var ga;(function(a){function e(t){let n=t;return n&&n.process!==void 0&&typeof n.detached=="boolean"}a.is=e})(ga||(ga={}));var ma=class extends ad.BaseLanguageClient{constructor(e,t,n,i,r){let s,c,d,l,g;ne.string(t)?(s=e,c=t,d=n,l=i,g=!!r):(s=e.toLowerCase(),c=e,d=t,l=n,g=i),g===void 0&&(g=!1),super(s,c,l),this._serverOptions=d,this._forceDebug=g,this._isInDebugMode=g;try{this.checkVersion()}catch(h){throw ne.string(h.message)&&this.outputChannel.appendLine(h.message),h}}checkVersion(){let e=cp(yt.version);if(!e)throw new Error(`No valid VS Code version detected. Version string is: ${yt.version}`);if(e.prerelease&&e.prerelease.length>0&&(e.prerelease=[]),!dp(e,cd))throw new Error(`The language client requires VS Code version ${cd} but received version ${yt.version}`)}get isInDebugMode(){return this._isInDebugMode}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(e=>setTimeout(e,1e3)),await this.start()):await this.start()}stop(e=2e3){return super.stop(e).finally(()=>{if(this._serverProcess){let t=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(t),this._isDetached=void 0}})}checkProcessDied(e){!e||e.pid===void 0||setTimeout(()=>{try{e.pid!==void 0&&(process.kill(e.pid,0),(0,ap.terminate)(e))}catch{}},2e3)}handleConnectionClosed(){return this._serverProcess=void 0,super.handleConnectionClosed()}fillInitializeParams(e){super.fillInitializeParams(e),e.processId===null&&(e.processId=process.pid)}createMessageTransports(e){function t(g,h){if(!g&&!h)return;let f=Object.create(null);return Object.keys(process.env).forEach(v=>f[v]=process.env[v]),h&&(f.ELECTRON_RUN_AS_NODE="1",f.ELECTRON_NO_ASAR="1"),g&&Object.keys(g).forEach(v=>f[v]=g[v]),f}let n=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],i=["--debug","--debug-brk","--inspect","--inspect-brk"];function r(){let g=process.execArgv;return g?g.some(h=>n.some(f=>h.startsWith(f))||i.some(f=>h===f)):!1}function s(g){if(g.stdin===null||g.stdout===null||g.stderr===null)throw new Error("Process created without stdio streams")}let c=this._serverOptions;if(ne.func(c))return c().then(g=>{if(ad.MessageTransports.is(g))return this._isDetached=!!g.detached,g;if(ha.is(g))return this._isDetached=!!g.detached,{reader:new re.StreamMessageReader(g.reader),writer:new re.StreamMessageWriter(g.writer)};{let h;return ga.is(g)?(h=g.process,this._isDetached=g.detached):(h=g,this._isDetached=!1),h.stderr.on("data",f=>this.outputChannel.append(ne.string(f)?f:f.toString(e))),{reader:new re.StreamMessageReader(h.stdout),writer:new re.StreamMessageWriter(h.stdin)}}});let d,l=c;return l.run||l.debug?this._forceDebug||r()?(d=l.debug,this._isInDebugMode=!0):(d=l.run,this._isInDebugMode=!1):d=c,this._getServerWorkingDir(d.options).then(g=>{if(fa.is(d)&&d.module){let h=d,f=h.transport||se.stdio;if(h.runtime){let v=[],p=h.options??Object.create(null);p.execArgv&&p.execArgv.forEach(T=>v.push(T)),v.push(h.module),h.args&&h.args.forEach(T=>v.push(T));let y=Object.create(null);y.cwd=g,y.env=t(p.env,!1);let C=this._getRuntimePath(h.runtime,g),b;if(f===se.ipc?(y.stdio=[null,null,null,"ipc"],v.push("--node-ipc")):f===se.stdio?v.push("--stdio"):f===se.pipe?(b=(0,re.generateRandomPipeName)(),v.push(`--pipe=${b}`)):vt.isSocket(f)&&v.push(`--socket=${f.port}`),v.push(`--clientProcessId=${process.pid.toString()}`),f===se.ipc||f===se.stdio){let T=it.spawn(C,v,y);return!T||!T.pid?Gt(T,`Launching server using runtime ${C} failed.`):(this._serverProcess=T,T.stderr.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),f===se.ipc?(T.stdout.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),Promise.resolve({reader:new re.IPCMessageReader(T),writer:new re.IPCMessageWriter(T)})):Promise.resolve({reader:new re.StreamMessageReader(T.stdout),writer:new re.StreamMessageWriter(T.stdin)}))}else{if(f===se.pipe)return(0,re.createClientPipeTransport)(b).then(T=>{let P=it.spawn(C,v,y);return!P||!P.pid?Gt(P,`Launching server using runtime ${C} failed.`):(this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>({reader:q[0],writer:q[1]})))});if(vt.isSocket(f))return(0,re.createClientSocketTransport)(f.port).then(T=>{let P=it.spawn(C,v,y);return!P||!P.pid?Gt(P,`Launching server using runtime ${C} failed.`):(this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>({reader:q[0],writer:q[1]})))})}}else{let v;return new Promise((p,y)=>{let C=(h.args&&h.args.slice())??[];f===se.ipc?C.push("--node-ipc"):f===se.stdio?C.push("--stdio"):f===se.pipe?(v=(0,re.generateRandomPipeName)(),C.push(`--pipe=${v}`)):vt.isSocket(f)&&C.push(`--socket=${f.port}`),C.push(`--clientProcessId=${process.pid.toString()}`);let b=h.options??Object.create(null);if(b.env=t(b.env,!0),b.execArgv=b.execArgv||[],b.cwd=g,b.silent=!0,f===se.ipc||f===se.stdio){let T=it.fork(h.module,C||[],b);s(T),this._serverProcess=T,T.stderr.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),f===se.ipc?(T.stdout.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),p({reader:new re.IPCMessageReader(this._serverProcess),writer:new re.IPCMessageWriter(this._serverProcess)})):p({reader:new re.StreamMessageReader(T.stdout),writer:new re.StreamMessageWriter(T.stdin)})}else f===se.pipe?(0,re.createClientPipeTransport)(v).then(T=>{let P=it.fork(h.module,C||[],b);s(P),this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>{p({reader:q[0],writer:q[1]})},y)},y):vt.isSocket(f)&&(0,re.createClientSocketTransport)(f.port).then(T=>{let P=it.fork(h.module,C||[],b);s(P),this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>{p({reader:q[0],writer:q[1]})},y)},y)})}}else if(pa.is(d)&&d.command){let h=d,f=d.args!==void 0?d.args.slice(0):[],v,p=d.transport;if(p===se.stdio)f.push("--stdio");else if(p===se.pipe)v=(0,re.generateRandomPipeName)(),f.push(`--pipe=${v}`);else if(vt.isSocket(p))f.push(`--socket=${p.port}`);else if(p===se.ipc)throw new Error("Transport kind ipc is not support for command executable");let y=Object.assign({},h.options);if(y.cwd=y.cwd||g,p===void 0||p===se.stdio){let C=it.spawn(h.command,f,y);return!C||!C.pid?Gt(C,`Launching server using command ${h.command} failed.`):(C.stderr.on("data",b=>this.outputChannel.append(ne.string(b)?b:b.toString(e))),this._serverProcess=C,this._isDetached=!!y.detached,Promise.resolve({reader:new re.StreamMessageReader(C.stdout),writer:new re.StreamMessageWriter(C.stdin)}))}else{if(p===se.pipe)return(0,re.createClientPipeTransport)(v).then(C=>{let b=it.spawn(h.command,f,y);return!b||!b.pid?Gt(b,`Launching server using command ${h.command} failed.`):(this._serverProcess=b,this._isDetached=!!y.detached,b.stderr.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),b.stdout.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),C.onConnected().then(T=>({reader:T[0],writer:T[1]})))});if(vt.isSocket(p))return(0,re.createClientSocketTransport)(p.port).then(C=>{let b=it.spawn(h.command,f,y);return!b||!b.pid?Gt(b,`Launching server using command ${h.command} failed.`):(this._serverProcess=b,this._isDetached=!!y.detached,b.stderr.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),b.stdout.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),C.onConnected().then(T=>({reader:T[0],writer:T[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(c,null,4)))}).finally(()=>{this._serverProcess!==void 0&&this._serverProcess.on("exit",(g,h)=>{g!==null&&this.error(`Server process exited with code ${g}.`,void 0,!1),h!==null&&this.error(`Server process exited with signal ${h}.`,void 0,!1)})})}_getRuntimePath(e,t){if(la.isAbsolute(e))return e;let n=this._mainGetRootPath();if(n!==void 0){let i=la.join(n,e);if(ua.existsSync(i))return i}if(t!==void 0){let i=la.join(t,e);if(ua.existsSync(i))return i}return e}_mainGetRootPath(){let e=yt.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}_getServerWorkingDir(e){let t=e&&e.cwd;return t||(t=this.clientOptions.workspaceFolder?this.clientOptions.workspaceFolder.uri.fsPath:this._mainGetRootPath()),t?new Promise(n=>{ua.lstat(t,(i,r)=>{n(!i&&r.isDirectory()?t:void 0)})}):Promise.resolve(void 0)}};Te.LanguageClient=ma;var va=class{constructor(e,t){this._client=e,this._setting=t,this._listeners=[]}start(){return yt.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new yt.Disposable(()=>{this._client.needsStop()&&this._client.stop()})}onDidChangeConfiguration(){let e=this._setting.indexOf("."),t=e>=0?this._setting.substr(0,e):this._setting,n=e>=0?this._setting.substr(e+1):void 0,i=n?yt.workspace.getConfiguration(t).get(n,!1):yt.workspace.getConfiguration(t);i&&this._client.needsStart()?this._client.start().catch(r=>this._client.error("Start failed after configuration change",r,"force")):!i&&this._client.needsStop()&&this._client.stop().catch(r=>this._client.error("Stop failed after configuration change",r,"force"))}};Te.SettingMonitor=va;function Gt(a,e){return a===null?Promise.reject(e):new Promise((t,n)=>{a.on("error",i=>{n(`${e} ${i}`)}),setImmediate(()=>n(e))})}});var pd=F((Of,ld)=>{"use strict";ld.exports=ud()});import*as ue from"vscode";var Pr=sn(Ed(),1);import*as S from"vscode";import*as Lt from"path";import{fork as Md}from"child_process";import*as Tr from"vscode";var Gn=class{constructor(e){this.secrets=e}secrets;async ReadyAPIKey(e){if(process.env.FACTORIO_UPLOAD_API_KEY)return{from:"env"};try{let t=await this.secrets.get("factorio-uploadmods");if(t&&(e&&(e=await Tr.window.showInformationMessage("Key already present. Replace it?",{modal:!0},"Yes","No")==="Yes"),!e))return{from:"secrets",key:t};if(t=await Tr.window.showInputBox({prompt:"Mod Portal API Key:",ignoreFocusOut:!0,password:!0}),t)return t=t.trim(),await this.secrets.store("factorio-uploadmods",t),{from:"new",key:t}}catch{}return!1}async ClearApiKey(){return this.secrets.delete("factorio-uploadmods")}};import{platform as Ad,tmpdir as Od}from"os";var j={valTypes:{none:"NONE",primitive:"PRIM",object:"OBJECT",array:"ARRAY"},getValType:function(a){return a&&typeof a=="object"||Array.isArray(a)?Array.isArray(a)?j.valTypes.array:typeof a=="object"?j.valTypes.object:void 0:j.valTypes.primitive},getPathType:function(a){var e=[];for(var t in a){var n=a[t];n?j.isNumber(n)?e.push(j.valTypes.array):e.push(j.valTypes.object):e.push(j.valTypes.none)}return e},isUndefined:function(a){return a===void 0},isNumber:function(a){return!isNaN(parseFloat(a))&&isFinite(a)&&a.indexOf(".")===-1},isEmptyObj:function(a){for(var e in a)if(Object.hasOwnProperty.call(a,e))return!1;return JSON.stringify(a)===JSON.stringify({})},isNotObject:function(a){return!a||typeof a!="object"},isEmptyArray:function(a){return Array.isArray(a)&&a.length==0},isNotArray:function(a){return Array.isArray(a)==0},removeEmptyArrayItem:function(a){return a.filter(function(e){return e!=null&&e!=""})},getFieldName:function(a,e,t,n,i){return i?(e||"")+(j.isNumber(a)?"["+a+"]":(t&&!e?"":".")+a):n?(e||"")+"["+a+"]":(e?e+".":"")+a},startsWith:function(a,e){return a.indexOf(e)==0},convert:function(a,e){var t={};return j.isNotObject(a)&&j.isNotArray(a)?e?(t[e]=a,t):a:j.isEmptyArray(a)?a:(function n(i,r,s){var c=Array.isArray(i);for(var d in i){var l=i[d];l&&typeof l=="object"?Array.isArray(l)?j.isEmptyArray(l)?t[j.getFieldName(d,r,s,!1,!0)]=l:t=n(l,j.getFieldName(d,r,s,!1,!0),c):c&&j.isEmptyObj(l)==0?t=n(l,j.getFieldName(d,r,s,!0)):j.isEmptyObj(l)==0?t=n(l,j.getFieldName(d,r,s)):j.isEmptyObj(l)&&(t[j.getFieldName(d,r,s,c)]=l):c||j.isNumber(d)?t[j.getFieldName(d,r,s,!0)]=l:t[j.getFieldName(d,r,s)]=l}return t})(a,e,!0)},backward:function(a,e){var t={},n=/\[(\d+)\]/g;if(j.isNotObject(a)&&j.isNotArray(a))return e?a[e]:a;if(j.isEmptyArray(a))return a;for(var i in a){var r=a[i];if(e){var s=new RegExp("^"+e);i=i.replace(s,"")}i=i.replace(n,".$1"),j.startsWith(i,".")&&(i=i.replace(/^\./,""));var c=i.split("."),d=j.getPathType(c);j.isUndefined(d)||d[0]!=j.valTypes.array||Array.isArray(t)!=0||(t=[]),(function l(g,h,f,v){var p=c.shift(),y=d.shift();if(p!==void 0&&p!=""){if(p=j.isNumber(p)?parseInt(p):p,c.length>0)return h[p]===void 0&&(h[p]=d[0]==j.valTypes.array?[]:{}),void l(g,h[p],p,h);y==j.valTypes.array&&f&&v?(Array.isArray(v[f])==0&&(v[f]=[]),v[f].push(g)):h[p]=g}else t=g})(r,t)}return t}};var Zn;function Ld(a){return Zn?Ad()==="win32"?`${a};${S.Uri.joinPath(Zn,"bin").fsPath}`:`${a}:${S.Uri.joinPath(Zn,"bin").fsPath}`:a}async function Ia(a){if(S.workspace.workspaceFolders){let e=new Gn(a.secrets);a.subscriptions.push(S.commands.registerCommand("factorio.clearApiKey",async()=>{await e.ClearApiKey()})),a.subscriptions.push(S.commands.registerCommand("factorio.setApiKey",async()=>{await e.ReadyAPIKey(!0)}));let t=S.extensions.getExtension("vscode.git");t&&!t.isActive&&await t.activate();let n=new xr(a,e,t?.exports.getAPI(1));a.subscriptions.push(n);let i=S.window.createTreeView("factoriomods",{treeDataProvider:n});a.subscriptions.push(i),Zn=a.extensionUri}}var Rr=class{constructor(e,t){this.context=e;this.modPackages=t}context;modPackages;provideTasks(e){let t=[],n=Ve.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())n.has(i)&&(t.push(new S.Task({label:`${i.name}.datestamp`,type:"factorio",modname:i.label,command:"datestamp"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.datestamp`,"factorio",i.DateStampTask(),[])),t.push(new S.Task({label:`${i.name}.package`,type:"factorio",modname:i.label,command:"package"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.package`,"factorio",i.PackageTask(),[])),t.push(new S.Task({label:`${i.name}.version`,type:"factorio",modname:i.label,command:"version"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.version`,"factorio",i.IncrementTask(),[])),t.push(new S.Task({label:`${i.name}.upload`,type:"factorio",modname:i.label,command:"upload"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.upload`,"factorio",i.PostToPortalTask(),[])),t.push(new S.Task({label:`${i.name}.details`,type:"factorio",modname:i.label,command:"details"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.details`,"factorio",i.DetailsTask(),[])),t.push(new S.Task({label:`${i.name}.publish`,type:"factorio",modname:i.label,command:"publish"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.name}.publish`,"factorio",i.PublishTask(),[])));return t}resolveTaskExecution(e,t){if(e.definition.command==="adjustMods")return e.definition.adjustMods?e.definition.modsPath?this.AdjustModsTask(e.definition):this.ConfigErrorTask(e.definition,"missing `modsPath`"):this.ConfigErrorTask(e.definition,"missing `adjustMods`");if(!e.definition.modname)return this.ConfigErrorTask(e.definition,"missing `modname`");if(e.definition.command==="run"&&!e.definition.script)return this.ConfigErrorTask(e.definition,"missing `script`");let n=Ve.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(i.label===e.definition.modname&&n.has(i)){let r=i;switch(e.definition.command){case"run":return r.RunTask(e.definition.script,e.definition.scriptArgs);case"compile":return r.RunTask("compile");case"datestamp":return r.DateStampTask();case"package":return r.PackageTask();case"version":return r.IncrementTask();case"upload":return r.PostToPortalTask();case"details":return r.DetailsTask();case"publish":return r.PublishTask();default:return this.ConfigErrorTask(e.definition,`unknown \`command\` "${e.definition.command}"`)}}return this.ConfigErrorTask(e.definition,`mod "${e.definition.modname}" not found`)}resolveTask(e,t){if(e.definition.type==="factorio"){let n=this.resolveTaskExecution(e,t);return new S.Task(e.definition,e.scope||S.TaskScope.Workspace,e.name,e.source,n,[])}}ConfigErrorTask(e,t){return new S.CustomExecution(async()=>new Ne(n=>{n.write(t+`
12
+ `),n.write(JSON.stringify(e,void 0,2)),n.close()}))}getFMTKCLIPath(){return this.context.asAbsolutePath("./dist/fmtk-cli.js")}AdjustModsTask(e){let t=["mods","--modsPath",e.modsPath,"adjust"];e.allowDisableBaseMod&&t.push("--allowDisableBase"),e.disableExtraMods&&t.push("--disableExtra");for(let n in e.adjustMods)t.push(`${n}=${e.adjustMods[n]}`);return new S.CustomExecution(async()=>new Ne(async n=>{await ze(n,this.getFMTKCLIPath(),t,process.cwd()),n.close()}))}},Ve=class extends S.TreeItem{constructor(t,n,i,r,s,c){super(t);this.resourceUri=t;this.modinfo=n;this.keychain=i;this.context=r;this._onDidChange=s;this.gitapi=c;this.command={title:"Open",command:"vscode.open",arguments:[t]},this.UpdateTreeItemFields()}resourceUri;modinfo;keychain;context;_onDidChange;gitapi;get name(){return this.modinfo.name}get title(){return this.modinfo.title}get version(){return this.modinfo.version}get scripts(){return this.modinfo.package?.scripts}static sort(t,n){let i=t.name.toLowerCase().localeCompare(n.name.toLowerCase());if(i!==0)return i*100;let r=Pr.compare(t.version,n.version,{loose:!0});return r!==0?-r*10:t.resourceUri<n.resourceUri?-1:t.resourceUri>n.resourceUri?1:0}static latestPackages(t){let n=new Map;for(let r of t)n.has(r.name)?n.get(r.name).push(r):n.set(r.name,[r]);let i=new Set;for(let r of n.values())i.add(r.reduce((s,c)=>Pr.compare(s.version,c.version,{loose:!0})<0?c:s));return i}async gitLabel(){let t=this.gitapi?.getRepository(this.resourceUri);if(t){let n=await t.log({}),i=0;for(;i<n.length;i++){let r=n[i];if("refNames"in r&&r.refNames.some(d=>d.match(/^tag:/)))return`+${i}`}}}async ReloadInfo(){let n=(await S.workspace.openTextDocument(this.resourceUri)).getText();this.modinfo=JSON.parse(n);let i=await this.gitLabel();this.UpdateTreeItemFields(i),this._onDidChange(this)}UpdateTreeItemFields(t){this.label=this.name,this.description=t?`${this.version} (${t})`:this.version,this.tooltip=this.title}getFMTKCLIPath(){return this.context.asAbsolutePath("./dist/fmtk-cli.js")}RunTask(t,n){return new S.CustomExecution(async()=>new Ne(async i=>{await ze(i,this.getFMTKCLIPath(),["run",t,...n??[]],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}DateStampTask(){return new S.CustomExecution(async()=>new Ne(async t=>{await ze(t,this.getFMTKCLIPath(),["datestamp"],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PackageTask(){let t=["package"];return S.workspace.getConfiguration(void 0,this.resourceUri).get("factorio.package.zipLocation","inside")==="outside"&&(t.push("--outdir"),t.push("..")),new S.CustomExecution(async()=>new Ne(async i=>{await ze(i,this.getFMTKCLIPath(),t,S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}IncrementTask(){return new S.CustomExecution(async()=>new Ne(async t=>{await ze(t,this.getFMTKCLIPath(),["version"],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PostToPortalTask(){return new S.CustomExecution(async()=>new Ne(async t=>{await this.ReloadInfo();let n=S.workspace.getConfiguration(void 0,this.resourceUri),i=Lt.dirname(this.resourceUri.path);n.get("factorio.package.zipLocation","inside")==="outside"&&(i=Lt.dirname(i));let r=this.resourceUri.with({path:i}),c=(await S.workspace.fs.readDirectory(r)).filter(([h,f])=>f===S.FileType.File&&h.startsWith(this.name)&&h.match(/_\d+\.\d+\.\d+\.zip$/)).map(([h,f])=>h).sort().reverse(),d=await S.window.showQuickPick(c,{placeHolder:"Select Package to upload"});if(!d){t.close();return}let l=Lt.join(r.fsPath,d),g=await this.keychain.ReadyAPIKey();g&&await ze(t,this.getFMTKCLIPath(),["upload",l,this.name],S.Uri.joinPath(this.resourceUri,"..").fsPath,g.from!=="env"?{FACTORIO_UPLOAD_API_KEY:g.key}:void 0),await this.ReloadInfo(),t.close()}))}DetailsTask(){return new S.CustomExecution(async()=>new Ne(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await ze(t,this.getFMTKCLIPath(),["details"],S.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}PublishTask(){return new S.CustomExecution(async()=>new Ne(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await ze(t,this.getFMTKCLIPath(),["publish"],S.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}},xr=class{constructor(e,t,n){this.context=e;this.keychain=t;this.gitapi=n;this.modPackages=new Map,S.workspace.findFiles("**/info.json").then(r=>{r.forEach(s=>{this.updateInfoJson(s)})});let i=S.workspace.createFileSystemWatcher("**/info.json");this.subscriptions.push(i.onDidChange(r=>this.updateInfoJson(r))),this.subscriptions.push(i.onDidCreate(r=>this.updateInfoJson(r))),this.subscriptions.push(i.onDidDelete(r=>this.removeInfoJson(r))),this.subscriptions.push(i),n&&this.subscriptions.push(n.onDidOpenRepository(async r=>{for(let s of this.modPackages.values()){let c=n.getRepository(s.resourceUri);r.rootUri.toString()===c?.rootUri?.toString()&&(await s.ReloadInfo(),this.subscriptions.push(r.onDidCommit(async()=>{await s.ReloadInfo()})),this.subscriptions.push(r.onDidCheckout(async()=>{await s.ReloadInfo()})))}})),this.subscriptions.push(S.tasks.registerTaskProvider("factorio",new Rr(this.context,this.modPackages))),this.subscriptions.push(S.commands.registerCommand("factorio.openchangelog",async r=>S.window.showTextDocument(S.Uri.joinPath(r.resourceUri,"../changelog.txt")))),this.subscriptions.push(S.commands.registerCommand("factorio.datestamp",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="datestamp"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.package",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="package"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.version",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="version"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.upload",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="upload"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.details",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="details"&&c.definition.modname===r.label);await S.tasks.executeTask(s)})),this.subscriptions.push(S.commands.registerCommand("factorio.publish",async r=>{let s=(await S.tasks.fetchTasks({type:"factorio"})).find(c=>c.definition.command==="publish"&&c.definition.modname===r.label);await S.tasks.executeTask(s)}))}context;keychain;gitapi;_onDidChangeTreeData=new S.EventEmitter;onDidChangeTreeData=this._onDidChangeTreeData.event;modPackages;subscriptions=[this._onDidChangeTreeData];dispose(){this.subscriptions.forEach(e=>e.dispose())}async updateInfoJson(e){if(e.scheme==="file"){let n=(await S.workspace.openTextDocument(e)).getText();if(n){let i=JSON.parse(n);if(i&&i.name)if(this.modPackages.has(e.toString()))await this.modPackages.get(e.toString())?.ReloadInfo();else{let r=new Ve(e,i,this.keychain,this.context,s=>{this._onDidChangeTreeData.fire(s)},this.gitapi);this.modPackages.set(e.toString(),r),await r.ReloadInfo()}else this.modPackages.delete(e.toString())}else this.modPackages.delete(e.toString())}else this.modPackages.delete(e.toString());this._onDidChangeTreeData.fire(void 0)}removeInfoJson(e){this.modPackages.delete(e.toString()),this._onDidChangeTreeData.fire(void 0)}getTreeItem(e){return e}async getChildren(e){if(e)if(e instanceof Ve){let t=[];if(this.modPackages){let n=Ve.latestPackages(this.modPackages.values());n.has(e)&&this.modPackages.forEach((i,r)=>{i.label===e.label&&!n.has(i)&&(t.push(i),i.contextValue="older")})}return t.sort(Ve.sort)}else return[];else{let t=[];if(this.modPackages){let n=Ve.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(n.has(i)){t.push(i);let r=["latest"];try{await S.workspace.fs.stat(S.Uri.joinPath(i.resourceUri,"../changelog.txt")),r.push("haschangelog")}catch{}i.contextValue=r.join(" "),i.collapsibleState=(()=>{for(let s of this.modPackages.values())if(i.label===s.label&&!n.has(s))return S.TreeItemCollapsibleState.Collapsed;return S.TreeItemCollapsibleState.None})()}}return t.sort(Ve.sort)}}},kr=S.Uri.file(Lt.join(Od(),`vscode-${process.pid}-fmtk-config.json`));async function ze(a,e,t,n,i,r){let s=S.workspace.getConfiguration("factorio");await S.workspace.fs.writeFile(kr,Buffer.from(JSON.stringify(j.convert({docs:await s.get("docs"),package:await s.get("package")}))));let c=Object.assign({},process.env,i,{FMTK_CONFIG:kr.fsPath}),d=process.execArgv;for(let l of s.get("tasks.execArgvOptions",[]))switch(l){case"clear":d=[];break;case"stripjsflags":d=d.filter(g=>!g.match(/^--js-flags/));break;case"stripinspect":d=d.filter(g=>!g.match(/^--inspect/));break}return d=[...d,...s.get("tasks.execArgvExtra",[])],c.Path=Ld(c.Path??""),new Promise((l,g)=>{let h=Md(e,t,{cwd:n,execArgv:d,env:c,stdio:"pipe"});new _r(h.stdout,Buffer.from(`
13
13
  `)).on("segment",p=>{a.write(p.toString()+`\r
14
14
  `)}),new _r(h.stderr,Buffer.from(`
15
15
  `)).on("segment",p=>{p.toString().match(/^Debugger listening/)&&console.log(p.toString()),a.write(p.toString()+`\r
16
16
  `)}),h.on("error",p=>{a.write(`${p.message}\r
17
- `)}),h.on("exit",(p,y)=>{S.workspace.fs.delete(kr),d(p??-1)}),r&&h.stdin.write(r),h.stdin.end()})}var He=class{constructor(e){this.runner=e}runner;writeEmitter=new S.EventEmitter;onDidWrite=this.writeEmitter.event;closeEmitter=new S.EventEmitter;onDidClose=this.closeEmitter.event;tokensource=new S.CancellationTokenSource;open(e){let t=this.writeEmitter,n=this.closeEmitter,i=this.runner({write:r=>t.fire(r.replace(/\r?\n/g,`\r
18
- `)),close:()=>n.fire()},this.tokensource.token);i?i.finally(()=>{n.fire()}):n.fire()}close(){this.tokensource.cancel()}};import*as E from"vscode";import*as Ir from"os";import*as Ea from"path";var Be=E.workspace.fs,Ud=[{name:"Steam",factorioPath:"C:\\Program Files (x86)\\Steam\\steamapps\\common\\Factorio\\bin\\x64\\factorio.exe"},{name:"System",factorioPath:"C:\\Program Files\\Factorio\\bin\\x64\\factorio.exe"},{name:"Steam",factorioPath:"~/Library/Application Support/Steam/steamapps/common/Factorio/factorio.app/Contents/MacOS/factorio"},{name:"System",factorioPath:"/Applications/factorio.app/Contents/MacOS/factorio"},{name:"Steam",factorioPath:"~/.local/share/Steam/steamapps/common/Factorio/bin/x64/factorio"},{name:"Home",factorioPath:"~/.factorio/bin/x64/factorio"}],Fr={name:"Online Latest",onlineDocs:!0},qr={name:"Online Stable",onlineDocs:"stable"},Xn=class{constructor(e,t,n){this.context=e;this.output=t;this.fsprovider=n;this.bar=E.window.createStatusBarItem("factorio-version",E.StatusBarAlignment.Left,10),this.bar.name="Factorio Version Selector",this.bar.text="Factorio (unselected)",this.bar.command="factorio.selectVersion",this.bar.show(),e.subscriptions.push(this.bar),e.subscriptions.push(E.commands.registerCommand("factorio.selectVersion",()=>this.selectVersionCommand())),e.subscriptions.push(E.commands.registerCommand("factorio.checkConfig",()=>this.checkConfigCommand())),e.subscriptions.push(E.commands.registerCommand("factorio.disablePrototypeCache",()=>this.disablePrototypeCacheCommand())),e.subscriptions.push(E.commands.registerCommand("factorio.disableMouseAutoCapture",()=>this.disableMouseAutoCaptureCommand())),this.migrateActiveVersion().then(()=>this.loadActiveVersion())}context;output;fsprovider;bar;async migrateActiveVersion(){if(this.context.workspaceState.get("active_version"))return;let e=E.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.find(i=>i.active);n&&(t.forEach(i=>delete i.active),await this.context.workspaceState.update("active_version",n),await e.update("versions",t))}async loadActiveVersion(){let e=this.context.workspaceState.get("active_version");if(!e)return;let t=await this.tryJsonDocs(e).catch(()=>{});if(!t){await this.context.workspaceState.update("active_version",void 0);return}this.bar.text=`Factorio ${t.application_version} (${e.name})`,this._active_version=new br(E.workspace.fs,e,t,E.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${e.name} (${t.application_version})`),await this.checkDocs()}async checkConfigCommand(){this.output.info("Check Config:"),this.output.show();let e=await this.getActiveVersion();if(!e){this.output.error("No Active Factorio Version");return}this.output.info("Active Factorio Version:"),e.onlineOnly?this.output.info("Online Only"):this.output.info(`Binary: ${await e.getBinaryVersion().catch(f=>f.toString())}`),this.output.info(`Runtime JSON: ${e.docs.application_version}`),e.onlineOnly||(await e.isPrototypeCacheEnabled()&&this.output.warn("Prototype Cache is enabled!"),await e.isMouseAutoCaptureDisabled()&&this.output.info("Mouse Auto Capture is disabled")),this.output.info(`Workspace Trusted: ${E.workspace.isTrusted}`),E.workspace.workspaceFolders?.forEach(f=>this.output.info(`Workspace folder: ${f.uri.toString()}`));let t=this.context.storageUri;if(!t){this.output.error("No Workspace");return}try{let f=(await Be.readFile(Pe.joinPath(t,"sumneko-3rd/factorio/config.json"))).toString(),v=JSON.parse(f);this.output.info(`Library bundle found in ${t.fsPath}, generated from Factorio ${v.factorioVersion} with FMTK ${v.bundleVersion}`);for(let p of xa())try{(await Be.readFile(Pe.joinPath(t,"sumneko-3rd",p.name))).toString()!==p.content&&this.output.info(`file ${p.name} content mismatch!`)}catch(y){this.output.error(`file ${p.name} ${y}`)}}catch(f){this.output.error(`Missing or damaged library bundle info ${f}`)}let n=E.extensions.getExtension("sumneko.lua");if(!n){this.output.warn("LuaLS (sumneko.lua) not present!");return}this.output.info(`LuaLS ${n.packageJSON.version} ${n.isActive?"Activated":"Not Yet Activated"}`);let i=E.workspace.getConfiguration("Lua"),r=E.workspace.getConfiguration("factorio"),s=i.get("workspace.userThirdParty");if(!s)this.output.warn("Lua.workspace.userThirdParty not present!");else{let f=Pe.joinPath(t,"sumneko-3rd").fsPath;s.includes(f)?this.output.info(`Lua.workspace.userThirdParty: workspace link OK (${f})`):this.output.warn(`Lua.workspace.userThirdParty: workspace link missing! (${f})`);let v=s.filter(p=>p!==f);for(let p of v)p.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd$/)?this.output.warn(`Lua.workspace.userThirdParty: stale workspace link? (${p})`):this.output.info(`Lua.workspace.userThirdParty: other library (${p})`)}let c=i.get("workspace.checkThirdParty"),d=c==="ApplyInMemory";c===!1||c==="Disable"?this.output.warn(`Lua.workspace.checkThirdParty = ${c}`):this.output.info(`Lua.workspace.checkThirdParty = ${c}`);let l=r.get("workspace.manageLibraryDataLinks",!1),g=i.get("workspace.library");if(!g)this.output.warn("Lua.workspace.library not present!");else{let f=[];if(!e.onlineOnly){let C=lt.file(await e.dataPath()).fsPath;f.push(C),g.includes(C)?this.output.info(`Lua.workspace.library: /data link OK (${C})`):l&&this.output.warn(`Lua.workspace.library: /data link missing! (${C})`)}let v=Pe.joinPath(t,"sumneko-3rd/factorio/library").fsPath,p=g.find(C=>lt.file(C).fsPath===v);p?(f.push(p),d?this.output.warn(`Lua.workspace.library: redundant workspace library link (${p})`):this.output.info(`Lua.workspace.library: workspace library link OK (${p})`)):d||this.output.warn(`Lua.workspace.library: workspace library link missing! (${v})`);let y=g.filter(C=>!f.includes(C));for(let C of y)C.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd[\\\/]factorio[\\\/]library$/)?this.output.warn(`Lua.workspace.library: stale workspace link? (${C})`):C.endsWith("data")?this.output.warn(`Lua.workspace.library: stale data link? (${C})`):this.output.info(`Lua.workspace.library: other library (${C})`)}let h=i.get("runtime.plugin");if(!h)d||this.output.warn("Lua.runtime.plugin not present!");else{let f=Pe.joinPath(t,"sumneko-3rd/factorio/plugin.lua").fsPath.replace(/[\\]/g,"/");h===f?d?this.output.warn(`Lua.runtime.plugin: redundant workspace link (${h})`):this.output.info(`Lua.runtime.plugin: OK (${h})`):this.output.warn(`Lua.runtime.plugin: wrong plugin? (${h})`)}}async disablePrototypeCacheCommand(){let e=await this.getActiveVersion();if(e?.onlineOnly)throw new Error("Select a local Factorio install to edit config");return e?.disablePrototypeCache()}async disableMouseAutoCaptureCommand(){let e=await this.getActiveVersion();if(e?.onlineOnly)throw new Error("Select a local Factorio install to edit config");return e?.disableMouseAutoCapture()}async selectVersionCommand(){if(E.debug.activeDebugSession?.type==="factoriomod"){E.window.showErrorMessage("Cannot select Factorio version while debugging.");return}let e=E.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.map(h=>h.factorioPath),i=(await Promise.all(Ud.filter(h=>!n.includes(h.factorioPath)).map(async h=>{try{return(await Be.stat(lt.file(an(h.factorioPath,E.workspace.workspaceFolders)))).type&E.FileType.File?h:void 0}catch{return}}))).filter(h=>!!h),r=async h=>h.onlineDocs===!0?"latest":h.onlineDocs?h.onlineDocs:(await this.tryJsonDocs(h).catch(()=>{}))?.application_version??"unknown",s=await E.window.showQuickPick([{kind:E.QuickPickItemKind.Separator,label:"settings"},...await Promise.all(t.map(async h=>({fv:h,label:h.name,description:await r(h),detail:h.factorioPath}))),{kind:E.QuickPickItemKind.Separator,label:"autodetected"},...await Promise.all(i.map(async h=>({fv:h,label:h.name,description:await r(h),detail:h.factorioPath}))),{fv:Fr,label:Fr.name,description:await r(Fr)},{fv:qr,label:qr.name,description:await r(qr)},{kind:E.QuickPickItemKind.Separator,label:""},{fv:void 0,label:"Select another install locaton...",picked:!1}],{title:"Select Factorio Version"});if(!s)return;let c=s.fv;if(c?.factorioPath){let h=!1;try{(await Be.stat(lt.file(an(c.factorioPath,E.workspace.workspaceFolders)))).type&E.FileType.File&&(h=!0)}catch{}if(!h)if(await E.window.showErrorMessage("The selected factorio version is no longer present at the specified location","Remove from settings","Cancel")==="Remove from settings"){e.update("versions",t.filter(v=>v!==c));return}else return}let d=!1;if(!c){let h=await E.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Factorio binary",filters:Ir.platform()==="win32"?{"":["exe"]}:void 0});if(!h)return;let f=await E.window.showInputBox({prompt:"Display Name for this version",placeHolder:"Enter a display name to be used in the Version Selector for this version",ignoreFocusOut:!0});if(!f)return;c={name:f,factorioPath:h[0].fsPath},d=!0}let l;try{l=await this.tryJsonDocs(c)}catch(h){if(!c.factorioPath){E.window.showErrorMessage(`Unable to read online docs: ${h}`);return}if(await E.window.showErrorMessage(`Unable to read JSON docs: ${h}`,"Select alternate location","Cancel")!=="Select alternate location")return;let f=await E.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Runtime JSON Docs",title:"Select Runtime JSON Docs",filters:{"JSON Docs":["json"]}});if(!f)return;c.docsPath=Ea.relative(an(c.factorioPath,E.workspace.workspaceFolders),f[0].fsPath);try{l=await this.tryJsonDocs(c)}catch(v){E.window.showErrorMessage(`Unable to read JSON docs: ${v}`);return}}await this.context.workspaceState.update("active_version",c),d&&(t.push(c),e.update("versions",t)),this.bar.text=`Factorio ${l.application_version} (${c.name})`;let g=this._active_version;this._active_version=new br(E.workspace.fs,c,l,E.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${c.name} (${l.application_version})`),await this.generateDocs(g)}_active_version;async getActiveVersion(){return this._active_version||await this.selectVersionCommand(),this._active_version}async tryJsonDocs(e){let t;if(e.onlineDocs){let i=`https://lua-api.factorio.com/${e.onlineDocs===!0||e.onlineDocs==="throw"?"latest":e.onlineDocs}/runtime-api.json`,r=await fetch(i);if(!r.ok)throw new Error(`Error fetching ${i} : ${r.statusText}`);t=await r.text()}else{if(!e.factorioPath)throw new Error(`Invalid Config: requires at least one of factorioPath or onlineDocs in ${e.name}`);let n=Pe.joinPath(lt.file(an(e.factorioPath,E.workspace.workspaceFolders)),e.docsPath?e.docsPath:Ir.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json");t=(await Be.readFile(n)).toString()}return new Ra(t)}async checkDocs(){let e=await this.getActiveVersion();if(!e)return;let t=this.context.storageUri;if(t)try{let n=(await Be.readFile(Pe.joinPath(t,"sumneko-3rd/factorio/config.json"))).toString(),i=JSON.parse(n);if(i.factorioVersion!==e.docs.application_version||i.bundleVersion!==Qn)return this.generateDocs()}catch{return this.generateDocs()}}async generateDocs(e){if(!E.workspace.getConfiguration("factorio").get("docs.generateDocs",!0))return;let t=await this.getActiveVersion();if(!t)return;let n=this.context.storageUri;if(!n){E.window.showErrorMessage("Unable to generate docs: no open workspace");return}let i=Pe.joinPath(n,"sumneko-3rd");await Be.createDirectory(i);try{await Promise.allSettled([Be.delete(Pe.joinPath(i,"factorio","library"),{recursive:!0}),Be.delete(Pe.joinPath(i,"factorio","factorio-plugin"),{recursive:!0})])}catch{}let r=this.output,s=await ze({close(){},write(y){r.info(`docgen: ${y.trimEnd()}`)}},this.context.asAbsolutePath("./dist/fmtk-cli.js"),await t.docArgs(E.workspace.getConfiguration("factorio").get("docs.usePrototypeDumps",!1)),i.fsPath);if(s!==0){this.output.warn(`docgen return code ${s}`),await E.window.showErrorMessage("Error while generating docs","Show Output")==="Show Output"&&this.output.show();return}let c=E.workspace.getConfiguration("Lua"),d=c.get("workspace.library",[]),l=(y,...C)=>{if(y){let b=Pe.joinPath(y,...C),T=d.indexOf(b.fsPath);T!==-1&&d.splice(T,1)}},g=async(y,...C)=>{try{let b=Pe.joinPath(y,...C);!d.includes(b.fsPath)&&(await Be.stat(b)).type&E.FileType.Directory&&d.push(b.fsPath)}catch{}},h=E.workspace.getConfiguration("factorio");if(e&&!e.onlineOnly){let y=lt.file(await e.dataPath());l(y)}if(d.length===0?await c.update("workspace.library",void 0):await c.update("workspace.library",d),h.get("workspace.manageLibraryDataLinks",!1)){let y=lt.file(await t.dataPath());await g(y)}d.length===0?await c.update("workspace.library",void 0):await c.update("workspace.library",d);let f=c.get("workspace.userThirdParty",[]);f=f.filter(y=>!y.includes("justarandomgeek.factoriomod-debug")),await c.update("workspace.userThirdParty",f),f.push(i.fsPath),await c.update("workspace.userThirdParty",f);let v=c.get("workspace.checkThirdParty");v&&["Ask","Apply","ApplyInMemory"].includes(v)||await c.update("workspace.checkThirdParty","ApplyInMemory");let p=E.extensions.getExtension("sumneko.lua");p&&(p.isActive||await p.activate())}};import*as pt from"path";import*as ee from"vscode";var ei=class{type;ctime;mtime;size;name;data;constructor(e){this.type=ee.FileType.File,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e}},Dt=class{type;ctime;mtime;size;name;entries;constructor(e){this.type=ee.FileType.Directory,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e,this.entries=new Map}},ti=class{root=new Dt("");stat(e){return this._lookup(e,!1)}readDirectory(e){let t=this._lookupAsDirectory(e,!1),n=[];for(let[i,r]of t.entries)n.push([i,r.type]);return n}readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw ee.FileSystemError.FileNotFound()}writeFile(e,t,n){let i=pt.posix.basename(e.path),r=this._lookupParentDirectory(e),s=r.entries.get(i);if(s instanceof Dt)throw ee.FileSystemError.FileIsADirectory(e);if(!s&&!n.create)throw ee.FileSystemError.FileNotFound(e);if(s&&n.create&&!n.overwrite)throw ee.FileSystemError.FileExists(e);s||(s=new ei(i),r.entries.set(i,s),this._fireSoon({type:ee.FileChangeType.Created,uri:e})),s.mtime=Date.now(),s.size=t.byteLength,s.data=t,this._fireSoon({type:ee.FileChangeType.Changed,uri:e})}rename(e,t,n){if(!n.overwrite&&this._lookup(t,!0))throw ee.FileSystemError.FileExists(t);let i=this._lookup(e,!1),r=this._lookupParentDirectory(e),s=this._lookupParentDirectory(t),c=pt.posix.basename(t.path);r.entries.delete(i.name),i.name=c,s.entries.set(c,i),this._fireSoon({type:ee.FileChangeType.Deleted,uri:e},{type:ee.FileChangeType.Created,uri:t})}delete(e,t){let n=e.with({path:pt.posix.dirname(e.path)}),i=pt.posix.basename(e.path),r=this._lookupAsDirectory(n,t?.silent??!1);if(!r||!r.entries.has(i)){if(t?.silent)return;throw ee.FileSystemError.FileNotFound(e)}r.entries.delete(i),r.mtime=Date.now(),r.size-=1,this._fireSoon({type:ee.FileChangeType.Changed,uri:n},{uri:e,type:ee.FileChangeType.Deleted})}createDirectory(e){let t=pt.posix.basename(e.path),n=e.with({path:pt.posix.dirname(e.path)}),i=this._lookupAsDirectory(n,!1),r=new Dt(t);i.entries.set(r.name,r),i.mtime=Date.now(),i.size+=1,this._fireSoon({type:ee.FileChangeType.Changed,uri:n},{type:ee.FileChangeType.Created,uri:e})}_lookup(e,t){let n=e.path.split("/"),i=this.root;for(let r of n){if(!r)continue;let s;if(i instanceof Dt&&(s=i.entries.get(r)),!s){if(t)return;throw ee.FileSystemError.FileNotFound(e)}i=s}return i}_lookupAsDirectory(e,t){let n=this._lookup(e,t);if(n instanceof Dt)return n;throw ee.FileSystemError.FileNotADirectory(e)}_lookupAsFile(e,t){let n=this._lookup(e,t);if(n instanceof ei)return n;throw ee.FileSystemError.FileIsADirectory(e)}_lookupParentDirectory(e){let t=e.with({path:pt.posix.dirname(e.path)});return this._lookupAsDirectory(t,!1)}_emitter=new ee.EventEmitter;_bufferedEvents=[];_fireSoonHandle;onDidChangeFile=this._emitter.event;watch(e){return new ee.Disposable(()=>{})}_fireSoon(...e){this._bufferedEvents.push(...e),this._fireSoonHandle&&clearTimeout(this._fireSoonHandle),this._fireSoonHandle=setTimeout(()=>{this._emitter.fire(this._bufferedEvents),this._bufferedEvents.length=0},5)}};import*as La from"vscode";import*as A from"vscode";import{assert as Oa}from"console";var Ma=sn(Sr()),Aa=(0,Ma.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwHAEtqAaxQAnZjiYBnDAE8czOV2YZGKJQAdmTDMwAeGAPQBjOXK1ppAMyYASAGJUszWpMo60AOktyjuzEwKZcvBzAAEYA9jyKAsA8wgBuKMI8TOZolJKaeKHJKYly5pLCOhjainpMWHEAripacpLmTq6U7p7efgBWgeyhpeWVkaax8eNk+EA=");function Ut(a,e){return isNaN(a)?e:isNaN(e)?a:Math.max(a,e)}var Ht=class a{constructor(e=0,t=0){this.timer=e;this.count=t}timer;count;add(e){return e?new a(this.timer+e.timer,this.count+e.count):this}avg(){return this.timer/this.count}},ni=class{functions=new Map;lines=new Map;add(e){e.functions.forEach((t,n)=>{this.functions.set(n,t.add(this.functions.get(n)))}),e.lines.forEach((t,n)=>{this.lines.set(n,t.add(this.lines.get(n)))})}max(){let e={func:{timer:0,count:0,average:0},line:{timer:0,count:0,average:0}};return this.functions.forEach(t=>{e.func.timer=Ut(e.func.timer,t.timer),e.func.count=Ut(e.func.count,t.count),e.func.average=Ut(e.func.average,t.avg())}),this.lines.forEach(t=>{e.line.timer=Ut(e.line.timer,t.timer),e.line.count=Ut(e.line.count,t.count),e.line.average=Ut(e.line.average,t.avg())}),e}},Er=class{totalTime=0;file=new Map},ii=class a{constructor(e,t,n,i){this.name=e;this.value=t;this.filename=n;this.line=i}name;value;filename;line;children=[];ToStringInner(e){return`${e}${this.name} : ${this.value}
17
+ `)}),h.on("exit",(p,y)=>{S.workspace.fs.delete(kr),l(p??-1)}),r&&h.stdin.write(r),h.stdin.end()})}var Ne=class{constructor(e){this.runner=e}runner;writeEmitter=new S.EventEmitter;onDidWrite=this.writeEmitter.event;closeEmitter=new S.EventEmitter;onDidClose=this.closeEmitter.event;tokensource=new S.CancellationTokenSource;open(e){let t=this.writeEmitter,n=this.closeEmitter,i=this.runner({write:r=>t.fire(r.replace(/\r?\n/g,`\r
18
+ `)),close:()=>n.fire()},this.tokensource.token);i?i.finally(()=>{n.fire()}):n.fire()}close(){this.tokensource.cancel()}};import*as E from"vscode";import*as Ir from"os";import*as Ea from"path";var Be=E.workspace.fs,Ud=[{name:"Steam",factorioPath:"C:\\Program Files (x86)\\Steam\\steamapps\\common\\Factorio\\bin\\x64\\factorio.exe"},{name:"System",factorioPath:"C:\\Program Files\\Factorio\\bin\\x64\\factorio.exe"},{name:"Steam",factorioPath:"~/Library/Application Support/Steam/steamapps/common/Factorio/factorio.app/Contents/MacOS/factorio"},{name:"System",factorioPath:"/Applications/factorio.app/Contents/MacOS/factorio"},{name:"Steam",factorioPath:"~/.local/share/Steam/steamapps/common/Factorio/bin/x64/factorio"},{name:"Home",factorioPath:"~/.factorio/bin/x64/factorio"}],Fr={name:"Online Latest",onlineDocs:!0},qr={name:"Online Stable",onlineDocs:"stable"},Xn=class{constructor(e,t,n){this.context=e;this.output=t;this.fsprovider=n;this.bar=E.window.createStatusBarItem("factorio-version",E.StatusBarAlignment.Left,10),this.bar.name="Factorio Version Selector",this.bar.text="Factorio (unselected)",this.bar.command="factorio.selectVersion",this.bar.show(),e.subscriptions.push(this.bar),e.subscriptions.push(E.commands.registerCommand("factorio.selectVersion",()=>this.selectVersionCommand())),e.subscriptions.push(E.commands.registerCommand("factorio.checkConfig",()=>this.checkConfigCommand())),e.subscriptions.push(E.commands.registerCommand("factorio.disablePrototypeCache",()=>this.disablePrototypeCacheCommand())),e.subscriptions.push(E.commands.registerCommand("factorio.disableMouseAutoCapture",()=>this.disableMouseAutoCaptureCommand())),this.migrateActiveVersion().then(()=>this.loadActiveVersion())}context;output;fsprovider;bar;async migrateActiveVersion(){if(this.context.workspaceState.get("active_version"))return;let e=E.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.find(i=>i.active);n&&(t.forEach(i=>delete i.active),await this.context.workspaceState.update("active_version",n),await e.update("versions",t))}async loadActiveVersion(){let e=this.context.workspaceState.get("active_version");if(!e)return;let t=await this.tryJsonDocs(e).catch(()=>{});if(!t){await this.context.workspaceState.update("active_version",void 0);return}this.bar.text=`Factorio ${t.application_version} (${e.name})`,this._active_version=new br(E.workspace.fs,e,t,E.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${e.name} (${t.application_version})`),await this.checkDocs()}async checkConfigCommand(){this.output.info("Check Config:"),this.output.show();let e=await this.getActiveVersion();if(!e){this.output.error("No Active Factorio Version");return}this.output.info("Active Factorio Version:"),e.onlineOnly?this.output.info("Online Only"):this.output.info(`Binary: ${await e.getBinaryVersion().catch(f=>f.toString())}`),this.output.info(`Runtime JSON: ${e.docs.application_version}`),e.onlineOnly||(await e.isPrototypeCacheEnabled()&&this.output.warn("Prototype Cache is enabled!"),await e.isMouseAutoCaptureDisabled()&&this.output.info("Mouse Auto Capture is disabled")),this.output.info(`Workspace Trusted: ${E.workspace.isTrusted}`),E.workspace.workspaceFolders?.forEach(f=>this.output.info(`Workspace folder: ${f.uri.toString()}`));let t=this.context.storageUri;if(!t){this.output.error("No Workspace");return}let n=E.workspace.getConfiguration("Lua"),i=E.workspace.getConfiguration("factorio");this.output.info(`execArgv: ${JSON.stringify(process.execArgv)}`),this.output.info(`execArgvOptions: ${JSON.stringify(i.get("tasks.execArgvOptions",[]))}`),this.output.info(`execArgvExtras: ${JSON.stringify(i.get("tasks.execArgvExtras",[]))}`);try{let f=(await Be.readFile(Pe.joinPath(t,"sumneko-3rd/factorio/config.json"))).toString(),v=JSON.parse(f);this.output.info(`Library bundle found in ${t.fsPath}, generated from Factorio ${v.factorioVersion} with FMTK ${v.bundleVersion}`);for(let p of xa())try{(await Be.readFile(Pe.joinPath(t,"sumneko-3rd",p.name))).toString()!==p.content&&this.output.info(`file ${p.name} content mismatch!`)}catch(y){this.output.error(`file ${p.name} ${y}`)}}catch(f){this.output.error(`Missing or damaged library bundle info ${f}`)}let r=E.extensions.getExtension("sumneko.lua");if(!r){this.output.warn("LuaLS (sumneko.lua) not present!");return}this.output.info(`LuaLS ${r.packageJSON.version} ${r.isActive?"Activated":"Not Yet Activated"}`);let s=n.get("workspace.userThirdParty");if(!s)this.output.warn("Lua.workspace.userThirdParty not present!");else{let f=Pe.joinPath(t,"sumneko-3rd").fsPath;s.includes(f)?this.output.info(`Lua.workspace.userThirdParty: workspace link OK (${f})`):this.output.warn(`Lua.workspace.userThirdParty: workspace link missing! (${f})`);let v=s.filter(p=>p!==f);for(let p of v)p.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd$/)?this.output.warn(`Lua.workspace.userThirdParty: stale workspace link? (${p})`):this.output.info(`Lua.workspace.userThirdParty: other library (${p})`)}let c=n.get("workspace.checkThirdParty"),d=c==="ApplyInMemory";c===!1||c==="Disable"?this.output.warn(`Lua.workspace.checkThirdParty = ${c}`):this.output.info(`Lua.workspace.checkThirdParty = ${c}`);let l=i.get("workspace.manageLibraryDataLinks",!1),g=n.get("workspace.library");if(!g)this.output.warn("Lua.workspace.library not present!");else{let f=[];if(!e.onlineOnly){let C=lt.file(await e.dataPath()).fsPath;f.push(C),g.includes(C)?this.output.info(`Lua.workspace.library: /data link OK (${C})`):l&&this.output.warn(`Lua.workspace.library: /data link missing! (${C})`)}let v=Pe.joinPath(t,"sumneko-3rd/factorio/library").fsPath,p=g.find(C=>lt.file(C).fsPath===v);p?(f.push(p),d?this.output.warn(`Lua.workspace.library: redundant workspace library link (${p})`):this.output.info(`Lua.workspace.library: workspace library link OK (${p})`)):d||this.output.warn(`Lua.workspace.library: workspace library link missing! (${v})`);let y=g.filter(C=>!f.includes(C));for(let C of y)C.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd[\\\/]factorio[\\\/]library$/)?this.output.warn(`Lua.workspace.library: stale workspace link? (${C})`):C.endsWith("data")?this.output.warn(`Lua.workspace.library: stale data link? (${C})`):this.output.info(`Lua.workspace.library: other library (${C})`)}let h=n.get("runtime.plugin");if(!h)d||this.output.warn("Lua.runtime.plugin not present!");else{let f=Pe.joinPath(t,"sumneko-3rd/factorio/plugin.lua").fsPath.replace(/[\\]/g,"/");h===f?d?this.output.warn(`Lua.runtime.plugin: redundant workspace link (${h})`):this.output.info(`Lua.runtime.plugin: OK (${h})`):this.output.warn(`Lua.runtime.plugin: wrong plugin? (${h})`)}}async disablePrototypeCacheCommand(){let e=await this.getActiveVersion();if(e?.onlineOnly)throw new Error("Select a local Factorio install to edit config");return e?.disablePrototypeCache()}async disableMouseAutoCaptureCommand(){let e=await this.getActiveVersion();if(e?.onlineOnly)throw new Error("Select a local Factorio install to edit config");return e?.disableMouseAutoCapture()}async selectVersionCommand(){if(E.debug.activeDebugSession?.type==="factoriomod"){E.window.showErrorMessage("Cannot select Factorio version while debugging.");return}let e=E.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.map(h=>h.factorioPath),i=(await Promise.all(Ud.filter(h=>!n.includes(h.factorioPath)).map(async h=>{try{return(await Be.stat(lt.file(an(h.factorioPath,E.workspace.workspaceFolders)))).type&E.FileType.File?h:void 0}catch{return}}))).filter(h=>!!h),r=async h=>h.onlineDocs===!0?"latest":h.onlineDocs?h.onlineDocs:(await this.tryJsonDocs(h).catch(()=>{}))?.application_version??"unknown",s=await E.window.showQuickPick([{kind:E.QuickPickItemKind.Separator,label:"settings"},...await Promise.all(t.map(async h=>({fv:h,label:h.name,description:await r(h),detail:h.factorioPath}))),{kind:E.QuickPickItemKind.Separator,label:"autodetected"},...await Promise.all(i.map(async h=>({fv:h,label:h.name,description:await r(h),detail:h.factorioPath}))),{fv:Fr,label:Fr.name,description:await r(Fr)},{fv:qr,label:qr.name,description:await r(qr)},{kind:E.QuickPickItemKind.Separator,label:""},{fv:void 0,label:"Select another install locaton...",picked:!1}],{title:"Select Factorio Version"});if(!s)return;let c=s.fv;if(c?.factorioPath){let h=!1;try{(await Be.stat(lt.file(an(c.factorioPath,E.workspace.workspaceFolders)))).type&E.FileType.File&&(h=!0)}catch{}if(!h)if(await E.window.showErrorMessage("The selected factorio version is no longer present at the specified location","Remove from settings","Cancel")==="Remove from settings"){e.update("versions",t.filter(v=>v!==c));return}else return}let d=!1;if(!c){let h=await E.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Factorio binary",filters:Ir.platform()==="win32"?{"":["exe"]}:void 0});if(!h)return;let f=await E.window.showInputBox({prompt:"Display Name for this version",placeHolder:"Enter a display name to be used in the Version Selector for this version",ignoreFocusOut:!0});if(!f)return;c={name:f,factorioPath:h[0].fsPath},d=!0}let l;try{l=await this.tryJsonDocs(c)}catch(h){if(!c.factorioPath){E.window.showErrorMessage(`Unable to read online docs: ${h}`);return}if(await E.window.showErrorMessage(`Unable to read JSON docs: ${h}`,"Select alternate location","Cancel")!=="Select alternate location")return;let f=await E.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Runtime JSON Docs",title:"Select Runtime JSON Docs",filters:{"JSON Docs":["json"]}});if(!f)return;c.docsPath=Ea.relative(an(c.factorioPath,E.workspace.workspaceFolders),f[0].fsPath);try{l=await this.tryJsonDocs(c)}catch(v){E.window.showErrorMessage(`Unable to read JSON docs: ${v}`);return}}await this.context.workspaceState.update("active_version",c),d&&(t.push(c),e.update("versions",t)),this.bar.text=`Factorio ${l.application_version} (${c.name})`;let g=this._active_version;this._active_version=new br(E.workspace.fs,c,l,E.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${c.name} (${l.application_version})`),await this.generateDocs(g)}_active_version;async getActiveVersion(){return this._active_version||await this.selectVersionCommand(),this._active_version}async tryJsonDocs(e){let t;if(e.onlineDocs){let i=`https://lua-api.factorio.com/${e.onlineDocs===!0||e.onlineDocs==="throw"?"latest":e.onlineDocs}/runtime-api.json`,r=await fetch(i);if(!r.ok)throw new Error(`Error fetching ${i} : ${r.statusText}`);t=await r.text()}else{if(!e.factorioPath)throw new Error(`Invalid Config: requires at least one of factorioPath or onlineDocs in ${e.name}`);let n=Pe.joinPath(lt.file(an(e.factorioPath,E.workspace.workspaceFolders)),e.docsPath?e.docsPath:Ir.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json");t=(await Be.readFile(n)).toString()}return new Ra(t)}async checkDocs(){let e=await this.getActiveVersion();if(!e)return;let t=this.context.storageUri;if(t)try{let n=(await Be.readFile(Pe.joinPath(t,"sumneko-3rd/factorio/config.json"))).toString(),i=JSON.parse(n);if(i.factorioVersion!==e.docs.application_version||i.bundleVersion!==Qn)return this.generateDocs()}catch{return this.generateDocs()}}async generateDocs(e){if(!E.workspace.getConfiguration("factorio").get("docs.generateDocs",!0))return;let t=await this.getActiveVersion();if(!t)return;let n=this.context.storageUri;if(!n){E.window.showErrorMessage("Unable to generate docs: no open workspace");return}let i=Pe.joinPath(n,"sumneko-3rd");await Be.createDirectory(i);try{await Promise.allSettled([Be.delete(Pe.joinPath(i,"factorio","library"),{recursive:!0}),Be.delete(Pe.joinPath(i,"factorio","factorio-plugin"),{recursive:!0})])}catch{}let r=this.output,s=await ze({close(){},write(y){r.info(`docgen: ${y.trimEnd()}`)}},this.context.asAbsolutePath("./dist/fmtk-cli.js"),await t.docArgs(E.workspace.getConfiguration("factorio").get("docs.usePrototypeDumps",!1)),i.fsPath);if(s!==0){this.output.warn(`docgen return code ${s}`),await E.window.showErrorMessage("Error while generating docs","Show Output")==="Show Output"&&this.output.show();return}let c=E.workspace.getConfiguration("Lua"),d=c.get("workspace.library",[]),l=(y,...C)=>{if(y){let b=Pe.joinPath(y,...C),T=d.indexOf(b.fsPath);T!==-1&&d.splice(T,1)}},g=async(y,...C)=>{try{let b=Pe.joinPath(y,...C);!d.includes(b.fsPath)&&(await Be.stat(b)).type&E.FileType.Directory&&d.push(b.fsPath)}catch{}},h=E.workspace.getConfiguration("factorio");if(e&&!e.onlineOnly){let y=lt.file(await e.dataPath());l(y)}if(d.length===0?await c.update("workspace.library",void 0):await c.update("workspace.library",d),h.get("workspace.manageLibraryDataLinks",!1)){let y=lt.file(await t.dataPath());await g(y)}d.length===0?await c.update("workspace.library",void 0):await c.update("workspace.library",d);let f=c.get("workspace.userThirdParty",[]);f=f.filter(y=>!y.includes("justarandomgeek.factoriomod-debug")),await c.update("workspace.userThirdParty",f),f.push(i.fsPath),await c.update("workspace.userThirdParty",f);let v=c.get("workspace.checkThirdParty");v&&["Ask","Apply","ApplyInMemory"].includes(v)||await c.update("workspace.checkThirdParty","ApplyInMemory");let p=E.extensions.getExtension("sumneko.lua");p&&(p.isActive||await p.activate())}};import*as pt from"path";import*as ee from"vscode";var ei=class{type;ctime;mtime;size;name;data;constructor(e){this.type=ee.FileType.File,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e}},Dt=class{type;ctime;mtime;size;name;entries;constructor(e){this.type=ee.FileType.Directory,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e,this.entries=new Map}},ti=class{root=new Dt("");stat(e){return this._lookup(e,!1)}readDirectory(e){let t=this._lookupAsDirectory(e,!1),n=[];for(let[i,r]of t.entries)n.push([i,r.type]);return n}readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw ee.FileSystemError.FileNotFound()}writeFile(e,t,n){let i=pt.posix.basename(e.path),r=this._lookupParentDirectory(e),s=r.entries.get(i);if(s instanceof Dt)throw ee.FileSystemError.FileIsADirectory(e);if(!s&&!n.create)throw ee.FileSystemError.FileNotFound(e);if(s&&n.create&&!n.overwrite)throw ee.FileSystemError.FileExists(e);s||(s=new ei(i),r.entries.set(i,s),this._fireSoon({type:ee.FileChangeType.Created,uri:e})),s.mtime=Date.now(),s.size=t.byteLength,s.data=t,this._fireSoon({type:ee.FileChangeType.Changed,uri:e})}rename(e,t,n){if(!n.overwrite&&this._lookup(t,!0))throw ee.FileSystemError.FileExists(t);let i=this._lookup(e,!1),r=this._lookupParentDirectory(e),s=this._lookupParentDirectory(t),c=pt.posix.basename(t.path);r.entries.delete(i.name),i.name=c,s.entries.set(c,i),this._fireSoon({type:ee.FileChangeType.Deleted,uri:e},{type:ee.FileChangeType.Created,uri:t})}delete(e,t){let n=e.with({path:pt.posix.dirname(e.path)}),i=pt.posix.basename(e.path),r=this._lookupAsDirectory(n,t?.silent??!1);if(!r||!r.entries.has(i)){if(t?.silent)return;throw ee.FileSystemError.FileNotFound(e)}r.entries.delete(i),r.mtime=Date.now(),r.size-=1,this._fireSoon({type:ee.FileChangeType.Changed,uri:n},{uri:e,type:ee.FileChangeType.Deleted})}createDirectory(e){let t=pt.posix.basename(e.path),n=e.with({path:pt.posix.dirname(e.path)}),i=this._lookupAsDirectory(n,!1),r=new Dt(t);i.entries.set(r.name,r),i.mtime=Date.now(),i.size+=1,this._fireSoon({type:ee.FileChangeType.Changed,uri:n},{type:ee.FileChangeType.Created,uri:e})}_lookup(e,t){let n=e.path.split("/"),i=this.root;for(let r of n){if(!r)continue;let s;if(i instanceof Dt&&(s=i.entries.get(r)),!s){if(t)return;throw ee.FileSystemError.FileNotFound(e)}i=s}return i}_lookupAsDirectory(e,t){let n=this._lookup(e,t);if(n instanceof Dt)return n;throw ee.FileSystemError.FileNotADirectory(e)}_lookupAsFile(e,t){let n=this._lookup(e,t);if(n instanceof ei)return n;throw ee.FileSystemError.FileIsADirectory(e)}_lookupParentDirectory(e){let t=e.with({path:pt.posix.dirname(e.path)});return this._lookupAsDirectory(t,!1)}_emitter=new ee.EventEmitter;_bufferedEvents=[];_fireSoonHandle;onDidChangeFile=this._emitter.event;watch(e){return new ee.Disposable(()=>{})}_fireSoon(...e){this._bufferedEvents.push(...e),this._fireSoonHandle&&clearTimeout(this._fireSoonHandle),this._fireSoonHandle=setTimeout(()=>{this._emitter.fire(this._bufferedEvents),this._bufferedEvents.length=0},5)}};import*as La from"vscode";import*as A from"vscode";import{assert as Oa}from"console";var Ma=sn(Sr()),Aa=(0,Ma.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwHAEtqAaxQAnZjiYBnDAE8czOV2YZGKJQAdmTDMwAeGAPQBjOXK1ppAMyYASAGJUszWpMo60AOktyjuzEwKZcvBzAAEYA9jyKAsA8wgBuKMI8TOZolJKaeKHJKYly5pLCOhjainpMWHEAripacpLmTq6U7p7efgBWgeyhpeWVkaax8eNk+EA=");function Ut(a,e){return isNaN(a)?e:isNaN(e)?a:Math.max(a,e)}var Nt=class a{constructor(e=0,t=0){this.timer=e;this.count=t}timer;count;add(e){return e?new a(this.timer+e.timer,this.count+e.count):this}avg(){return this.timer/this.count}},ni=class{functions=new Map;lines=new Map;add(e){e.functions.forEach((t,n)=>{this.functions.set(n,t.add(this.functions.get(n)))}),e.lines.forEach((t,n)=>{this.lines.set(n,t.add(this.lines.get(n)))})}max(){let e={func:{timer:0,count:0,average:0},line:{timer:0,count:0,average:0}};return this.functions.forEach(t=>{e.func.timer=Ut(e.func.timer,t.timer),e.func.count=Ut(e.func.count,t.count),e.func.average=Ut(e.func.average,t.avg())}),this.lines.forEach(t=>{e.line.timer=Ut(e.line.timer,t.timer),e.line.count=Ut(e.line.count,t.count),e.line.average=Ut(e.line.average,t.avg())}),e}},Er=class{totalTime=0;file=new Map},ii=class a{constructor(e,t,n,i){this.name=e;this.value=t;this.filename=n;this.line=i}name;value;filename;line;children=[];ToStringInner(e){return`${e}${this.name} : ${this.value}
19
19
  ${this.children.map(t=>t.ToStringInner(e+" ")).join(`
20
- `)}`}ToString(){return this.ToStringInner("")}AddToChild(e,t,n,i){let r=this.children.find(s=>s.name===e);return r?r.value+=t:(r=new a(e,t,n,i),this.children.push(r)),r}Merge(e){this.value+=e.value,e.children.forEach(t=>{let n=this.children.find(i=>i.name===t.name);n?n.Merge(t):this.children.push(t)})}},Mr=class{totalTime=0;mod=new Map;getMod(e){let t=this.mod.get(e);return t||(t=new Er,this.mod.set(e,t)),t}getFile(e,t){let n=this.getMod(e),i=n.file.get(t);return i||(i=new ni,n.file.set(t,i)),i}AddModTime(e,t){this.totalTime+=t,this.getMod(e).totalTime+=t}AddLineTime(e,t,n,i,r){let s=this.getFile(e,t),c=new Ht(i,r),d=s.lines.get(n);s.lines.set(n,c.add(d))}AddFuncTime(e,t,n,i,r){let s=this.getFile(e,t),c=new Ht(i,r),d=s.functions.get(n);s.functions.set(n,c.add(d))}Report(e){let t=new ni;return this.mod.forEach(n=>{let i=n.file.get(e);i&&t.add(i)}),{totalTime:this.totalTime,fileData:t}}},ri=class{constructor(e,t,n){this.context=t;this.debug=n;this._disposables.push(A.debug.onDidReceiveDebugSessionCustomEvent(r=>this.onCustomEvent(r),this)),this._disposables.push(A.debug.onDidTerminateDebugSession(r=>this.onTerminate(r),this)),this.timeDecorationType=A.window.createTextEditorDecorationType({before:{contentText:"",color:new A.ThemeColor("factorio.ProfileTimerForeground")}}),this.funcDecorationType=A.window.createTextEditorDecorationType({after:{contentText:"",color:new A.ThemeColor("factorio.ProfileFunctionTimerForeground"),borderColor:new A.ThemeColor("factorio.ProfileFunctionTimerForeground"),border:"1px solid",margin:"0 0 0 3ch"}});let i=A.workspace.getConfiguration().get("factorio.profile.rulers",[]);this.rulerDecorationTypes=i.filter(r=>r.color||r.themeColor).map(r=>{let s=A.OverviewRulerLane.Right;switch(r.lane){case"Right":s=A.OverviewRulerLane.Right;break;case"Center":s=A.OverviewRulerLane.Center;break;case"Left":s=A.OverviewRulerLane.Left;break;case"Full":s=A.OverviewRulerLane.Full;break;default:break}return{type:A.window.createTextEditorDecorationType({overviewRulerColor:r.color??new A.ThemeColor(r.themeColor),overviewRulerLane:s}),threshold:r.threshold}}),this.statusBar=A.window.createStatusBarItem(),this._disposables.push(A.window.onDidChangeActiveTextEditor(r=>{r&&r.document.uri.scheme==="file"&&this.render(r)})),e&&this.createFlamePanel()}context;debug;profileData=new Mr;profileTreeRoot=new ii("root",0);profileOverhead=new Ht(0,0);timeDecorationType;funcDecorationType;rulerDecorationTypes;statusBar;flamePanel;_disposables=[];onTerminate(e){e===this.debug&&this.dispose()}dispose(){this._disposables.forEach(e=>e.dispose()),this.timeDecorationType.dispose(),this.funcDecorationType.dispose(),this.rulerDecorationTypes.forEach(e=>{e.type.dispose()}),this.statusBar.dispose(),this.flamePanel&&this.flamePanel.dispose()}async onCustomEvent(e){if(e.session===this.debug&&e.event==="x-Factorio-Profile"){await this.parse(e.body);let t=A.window.activeTextEditor;t&&t.document.uri.scheme==="file"&&this.render(t)}}createFlamePanel(){if(this.flamePanel)return;this.flamePanel=A.window.createWebviewPanel("factorioProfile","Factorio Profile",A.ViewColumn.Two,{enableScripts:!0,localResourceRoots:[this.context.extensionUri]});let e=this.flamePanel.webview;e.html=Aa.replace("$Flamegraph.css$",e.asWebviewUri(A.Uri.joinPath(this.context.extensionUri,"/dist/Flamegraph.css")).toString()).replace("$Flamegraph.js$",e.asWebviewUri(A.Uri.joinPath(this.context.extensionUri,"/dist/Flamegraph.js")).toString()),e.onDidReceiveMessage(t=>{switch(t.command){case"init":e.postMessage({command:"update",data:this.profileTreeRoot});break;case"click":t.line&&t.line>0&&t.filename&&t.line&&A.window.showTextDocument(A.Uri.parse(t.filename),{selection:new A.Range(t.line,0,t.line,0),viewColumn:A.ViewColumn.One});break;default:break}}),this.flamePanel.onDidDispose(()=>this.flamePanel=void 0)}async parse(e){let t=e.split(`
21
- `),n,i,r=[new ii("root",0)],s;for(let c of t){let d=c.split(":");switch(d[0]){case"PROFILE":break;case"PMN":{n=d[1].replace(/[\r\n]*/g,"");let l=parseFloat(d[3]);this.profileData.AddModTime(n,l)}break;case"PFN":n&&(i=await this.debug.customRequest("x-Factorio-ConvertPath",{path:d[1].replace(/[\r\n]*/g,"")}));break;case"PLN":if(n&&i){let l=parseInt(d[1]),g=parseFloat(d[3]),h=parseInt(d[4]);this.profileData.AddLineTime(n,i,l,g,h)}break;case"PFT":if(n&&i){let l=parseInt(d[1]),g=parseFloat(d[3]),h=parseInt(d[4]);this.profileData.AddFuncTime(n,i,l,g,h)}break;case"POV":{let l=parseFloat(d[2]);this.profileOverhead=this.profileOverhead.add(new Ht(l,1))}break;case"PROOT":n&&(Oa(r.length===1),s=r[0].AddToChild(n,0));break;case"PTREE":if(s){let l=d[1],g=await this.debug.customRequest("x-Factorio-ConvertPath",{path:d[2]}),h=d[3],f=l+":"+g+":"+h,v=parseFloat(d[5]);r.push(s),s=s.AddToChild(f,v,g,parseInt(h))}break;case"PTEND":s&&(r.length===1?s=void 0:s=r.pop());break}}Oa(r.length===1),this.flamePanel&&this.flamePanel.visible&&this.flamePanel.webview.postMessage({command:"merge",data:r[0]}),this.profileTreeRoot.Merge(r[0])}render(e){let t=this.profileData.Report(e.document.uri.fsPath),n=t.fileData.max(),i=n.line.timer,r=n.line.average,s=n.line.count,c=new Array,d=new Array,l=this.rulerDecorationTypes.map((V,X)=>({type:V.type,threshold:V.threshold,decs:new Array})),g=A.workspace.getConfiguration().get("factorio.profile.displayAverageTime"),h=A.workspace.getConfiguration().get("factorio.profile.colorBy","totaltime"),f=A.workspace.getConfiguration().get("factorio.profile.timerHighlightColor"),v={count:s,totaltime:i,averagetime:r}[h],p=Math.max(Number.MIN_VALUE,A.workspace.getConfiguration().get("factorio.profile.colorScaleFactor",1)),y={boost:V=>Math.log1p(V*p)/Math.log1p(v*p),linear:V=>V/v,mute:V=>(Math.pow(1+v,V*p/v)-1)/(v*p)}[A.workspace.getConfiguration().get("factorio.profile.colorScaleMode","boost")],C=s.toFixed(0).length+1,b=g?6:3,T=i.toFixed(b).length+1,P=C+T+3,q=t.fileData.lines.size>0,ce=t.fileData.functions.size>0;for(let V=1;V<=e.document.lineCount;V++){if(q){let X=t.fileData.lines.get(V);if(X){let Je=X.timer,rt=X.count,Qe=g?X.avg():Je,st=y({count:rt,totaltime:Je,averagetime:X.avg()}[h]),It=e.document.validateRange(new A.Range(V-1,0,V-1,1/0));c.push({range:It,hoverMessage:g?`total: ${Je}`:`avg: ${X.avg()}`,renderOptions:{before:{backgroundColor:`${f}${Math.floor(255*st).toString(16)}`,contentText:`${rt.toFixed(0).padStart(C,"\xA0")}${Qe.toFixed(b).padStart(T,"\xA0")}\xA0ms`,width:`${P+1}ch`}}});let Et=l.find(ot=>st>=ot.threshold);Et&&Et.decs.push({range:It})}else c.push({range:e.document.validateRange(new A.Range(V-1,0,V-1,1/0)),renderOptions:{before:{width:`${P+1}ch`}}})}if(ce){let X=t.fileData.functions.get(V);if(X){let Je=X.timer,rt=X.count,Qe=g?X.avg():Je,st=e.document.validateRange(new A.Range(V-1,0,V-1,1/0));d.push({range:st,renderOptions:{after:{contentText:`\xA0${rt.toFixed(0)}\xA0|\xA0${Qe.toFixed(b)}\xA0ms\xA0`,color:new A.ThemeColor("factorio.ProfileFunctionTimerForeground"),borderColor:new A.ThemeColor("factorio.ProfileFunctionTimerForeground"),margin:"0 0 0 3ch"}}})}}}e.setDecorations(this.timeDecorationType,c),e.setDecorations(this.funcDecorationType,d),l.forEach(V=>{e.setDecorations(V.type,V.decs)}),this.statusBar.text=`Profile Dump Avg ${this.profileOverhead.avg().toFixed(3)} ms`,this.statusBar.show()}clear(){A.window.visibleTextEditors.forEach(e=>{e.setDecorations(this.timeDecorationType,[]),e.setDecorations(this.funcDecorationType,[]),this.rulerDecorationTypes.forEach(t=>{e.setDecorations(t.type,[])})}),this.statusBar.hide()}};var si=class{constructor(e){this.context=e;e.subscriptions.push(La.debug.onDidStartDebugSession(t=>this.onDidStartDebugSession(t),this))}context;onDidStartDebugSession(e){e.type==="factoriomod"&&e.configuration.hookMode==="profile"&&new ri(e.configuration.profileTree??!0,this.context,e)}};var qn=sn(pd(),1);import*as hd from"path";import{workspace as fd}from"vscode";function gd(a){let e=a.asAbsolutePath(hd.join("dist","fmtk-cli.js")),t={execArgv:["--nolazy","--inspect-brk=34199"]},n={run:{module:e,transport:qn.TransportKind.ipc,args:["lsp"]},debug:{module:e,transport:qn.TransportKind.ipc,args:["lsp"],options:t}},i={documentSelector:[{language:"factorio-locale"},{language:"factorio-changelog"},{language:"lua"}],synchronize:{fileEvents:[fd.createFileSystemWatcher("**/locale/*/*.cfg"),fd.createFileSystemWatcher("**/changelog.txt")]}},r=new qn.LanguageClient("factorioLanguageServer","Factorio Language Server",n,i);r.start(),a.subscriptions.push({dispose(){return r.stop()}})}import*as ve from"vscode";function md(a){return a.type==="int"?{type:"int",value:lp("",a.value)}:a}function ya(a,e){return typeof e=="bigint"?`jsonbigint ${e}n`:e}function lp(a,e){if(typeof e=="string"){let t=e.match(/^jsonbigint\x01\x02 (\d+)n$/);if(t)return BigInt(t[1])}return e}function er(){let a="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<32;t++)a+=e.charAt(Math.floor(Math.random()*e.length));return a}var vd=sn(Sr()),yd=(0,vd.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfEAWTMPA++XitFkAHVmAAjNUa/ZE2T4oFtHBMamuWmyLgiIEAehOGBctLwkYGMardFkwDLVYwNeILa4vA4wGTUdcJzsVYsAkEaHdeAAasw5I1qF3JzpBC0FokeKrZw0LOwW6uTmXh/OODpgAtZOZwWoPDRmDh0jJHWoqMm70wG3HZL7BOfL3Sb6iOBqKIybrkwIFqO67BvKI2r2B4La/lG/63kBIFjmeF7IdeqHAZQoHGuB+FqAATOwABK9iWEkywAOIRMmYSIVhV4AXeeHJhhSGsbhIFgYwEEAMwUVRVbCCgCCzigRizsxf44YBHFcSxKGKWm0SEYw6mQd+gggR2cr8EZwAYP2PDuJp1IyBg8G7q2ZmDsugitvhBnGWW3Gqex6nKfJbFAep/HaWRY56a5zChXpDn8dIok0WotAMWEdmmQOoUtvpEXLnJ2H+WoPnZZ5CneeqGkblppVqMJ6WZZFJnRZpsXUcI16zmo9jyNIKUOelLnJm5zlFXlBVyjlPGAbIJ6jVYWAeFQVj8fIsZ0LiGDOHQ34mdINUDOIVCyLI+YiI2OLUMqzApXwTkmVdhnGUVVi1Gomx3rt+2HYwS0nflYT2BdeBjXSj2vC9OC3UZzkYODxlQxI71HctOJ6mt3hfnVRXJvY+RNHtlAHQj33grSVhApQHhrDINB7Ewvg7iYziUM++FvowYB3iI/1OcZxI0HDeMfZetPUMCLR6sB0h42gdk89QdUeSpaiY9jsvXa20MZdtp6tsws3zVlRCnjNc2UAtlnHXGajUPYWCvl1GFrTtfP4595srWdwiXTt6MK8Dz3qmDTsfV9FsLL9F0oG4axMFbNuznZD01CD/vQ5DKc3YHBMW8j2T3rpP4K0rATC7jzvBytRMc6T5PcBL1DU4wQukwzTOvnmrPsyTkWCDLGeMILeoi0L4uS9LAFyxjWNF71UMYa2mujdrusm/rhs68bpvlWXOL9t4m0O9dsMl0HrunednsHyn+fyZI7QBv21S91vP04H98cKzf4h32Y1TT2nh/wy7RGahs6ozzpheShccYAKfhXEmJhq6Uzrm6Bueom5PhfCzNmxNOZ3W5gBXu/ccZRiHmtEeANDxjy5oDRWk9RyqxntlOeB4jZ6ymnpNeetFon2Ad4Yoe954Q3TkfTObsz7kIYXdG6dUMH4CeBEaQAAuFsMi6rxA8FjCOrgo5914V1R+3DQ4v2WE/cw8jn6vwrFQlRABBHAHgpBKLLCoqhCcnqgzevzEROJDF/VsNwxmPjw6R2QTHW2b95K+3cb/R2wjAHfRAbnb2EDaHF2gdw2B4cyYU1rvXRu9N0HMzblgyuXdgA91iYQ4uxCxakOLKPGg48C4pOiYw/eC8WHLzYSZDhy8uFAN4DwfhXsXE+0Tn7V6+j+k8B4JbMR1DInJxaZIiREMr7YR4NkDwPAoipM8XEi2AzgJaJwastZV4zBTGPNSdatBqEXJHCrXBZy6T3OPDvHAdzLl0KeeA7CrzRyhNkvLeS/zHmnN+ecr5ws0DGnBLLeIGBPkPNKUVUFeBTHFCRceKhwL1mbO2ZEMF7kVkww8aXbhCS0YjOScrSZ30BnJgwGweB2SqbILyY+RmMimDWOmXnbu+CKnVKIaLCwagBn1KJe5CeyslnEoERlHpVgukXkmDYYJTAsBRmhOHKUYYpTZlsPCMMdYPxNiTKmUq+wABWWYgTggyLOCsLZVVCgwL2MsPVOxljIPgIAA===");var tr=class{constructor(e){this.context=e;this.context.subscriptions.push(ve.window.registerCustomEditorProvider("fmtk.modsettings",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new ve.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async saveCustomDocument(e,t){return e.save(t)}async saveCustomDocumentAs(e,t,n){return e.saveAs(t,n)}async revertCustomDocument(e,t){return e.revert(t)}async backupCustomDocument(e,t,n){return e.backup(t.destination,n)}async openCustomDocument(e,t,n){let i=await Ca.create(e,t.backupId),r=[];return r.push(i.onDidChange(s=>{this._onDidChangeCustomDocument.fire({document:i,...s})})),r.push(i.onDidChangeContent(s=>{let c=this.webviews.get(i.uri.toString());c&&this.postMessage(c,"init",{version:i.version,saves_ints:i.saves_ints,settings:JSON.stringify(i.settings,ya),editable:ve.workspace.fs.isWritableFileSystem(i.uri.scheme)!==!1})})),i.onDidDispose(()=>r.forEach(s=>s.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=yd.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,er()).replace(/\$ModSettingsWebview\.css\$/g,i.asWebviewUri(ve.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.css")).toString()).replace(/\$ModSettingsWebview\.js\$/g,i.asWebviewUri(ve.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.js")).toString()),t.webview.onDidReceiveMessage(r=>this.onMessage(e,r)),t.webview.onDidReceiveMessage(r=>{r.type==="ready"&&this.postMessage(t,"init",{version:e.version,saves_ints:e.saves_ints,settings:JSON.stringify(e.settings,ya),editable:ve.workspace.fs.isWritableFileSystem(e.uri.scheme)!==!1})})}postMessage(e,t,n){e.webview.postMessage({type:t,body:n})}onMessage(e,t){if(t.type==="edit"){e.edit(t.body);return}}},Ca=class a{constructor(e,t){this.uri=e;this._settings=new wr(new on(t))}uri;static async create(e,t){let n=typeof t=="string"?ve.Uri.parse(t):e,i=await ve.workspace.fs.readFile(n);return new a(e,i)}_settings;get version(){return this._settings.version.format()}get saves_ints(){return this._settings.version.isBeyond(1,2)}get settings(){return this._settings.settings}async save(e){return this.saveAs(this.uri,e)}async saveAs(e,t){return ve.workspace.fs.writeFile(e,this._settings.save())}async revert(e){this._settings=new wr(new on(await ve.workspace.fs.readFile(this.uri))),this._onDidChangeDocument.fire({})}async backup(e,t){return await this.saveAs(e,t),{id:e.toString(),delete:()=>{ve.workspace.fs.delete(e)}}}edit(e){e.value.type==="none"?this._settings.set(e.scope,e.name,void 0):this._settings.set(e.scope,e.name,md(e.value)),this._onDidChange.fire({})}_onDidDispose=new ve.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new ve.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new ve.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};import*as qt from"vscode";function In(a){switch(a.type){case"Table":case"TableWithMeta":return Object.assign({},a,{values:void 0,values_count:a.values.length});default:return a}}var Cd=sn(Sr()),wd=(0,Cd.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfFvQVTMCUDAAdWYACM1Rr9kTZPigW0cExqa5abIuCIgQB6E4YFy0vARyYYfbRjDAYvljCV4iNri8DjABNmHiuE52csWASCNDuvAANWYcka1Hb450ghaC0SPFV04aFnYjeXJ2Lg9nHB0wAPw8XpHH9co85HwGXq6Y2TMOtvxd3x/37SH1CPcpPkZsNw1iYLBe2hZggSlMMpQzWx4TDashQwet4yTdVIn2AArdMgXBDJp1LRtZAArtix7PtSLIfAgA===");import*as Ct from"vscode";var nr=class a{constructor(e,t){this.uri=e;this._data=new qa(new on(t))}uri;static async create(e,t){let n=typeof t=="string"?Ct.Uri.parse(t):e,i=await Ct.workspace.fs.readFile(n);return new a(e,i)}_data;get version(){return this._data.version.format()}get rootdata(){let e={};for(let t in this._data.data)e[t]=In(this._data.data[t]);return e}find(e,t){return this._data.find(e,t)}_onDidDispose=new Ct.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new Ct.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new Ct.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};var ir=class{constructor(e){this.context=e;this.context.subscriptions.push(qt.window.registerCustomEditorProvider("fmtk.scriptdat",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new qt.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async openCustomDocument(e,t,n){let i=await nr.create(e,t.backupId),r=[];return r.push(i.onDidChange(s=>{this._onDidChangeCustomDocument.fire({document:i,...s})})),r.push(i.onDidChangeContent(s=>{let c=this.webviews.get(i.uri.toString());c&&this.postMessage(c,"init",{version:i.version,data:i.rootdata})})),i.onDidDispose(()=>r.forEach(s=>s.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=wd.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,er()).replace(/\$ScriptDatWebview\.css\$/g,i.asWebviewUri(qt.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.css")).toString()).replace(/\$ScriptDatWebview\.js\$/g,i.asWebviewUri(qt.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.js")).toString()),t.webview.onDidReceiveMessage(r=>this.onMessage(e,r)),t.webview.onDidReceiveMessage(r=>{r.type==="ready"&&this.postMessage(t,"init",{version:e.version,data:e.rootdata})})}postMessage(e,t,n){e.webview.postMessage({type:t,body:n})}onMessage(e,t){if(t.type==="fetch"){let n=t.body,i=e.find(n.modname,n.gcid),r;n.index!==void 0&&n.count!==void 0?r=i.values.slice(n.index,n.index+n.count):r=i.values,this.postMessage(this.webviews.get(e.uri.toString()),"values",{...n,values:r.map(s=>({key:In(s.key),value:In(s.value)}))})}}};async function ph(a){let e=ue.window.createOutputChannel("FMTK",{log:!0});e.info(`FMTK ${Qn}`);try{e.info("Registering FS Provider...");let t=new ti;a.subscriptions.push(ue.workspace.registerFileSystemProvider("fmtk",t,{isCaseSensitive:!0})),e.info("Registering Version Selector...");let n=new Xn(a,e,t);e.info("Registering Debug Provider...");let i=new wa(n);a.subscriptions.push(ue.debug.registerDebugConfigurationProvider("factoriomod",i));let r=new Da(n);a.subscriptions.push(ue.debug.registerDebugAdapterDescriptorFactory("factoriomod",r)),a.subscriptions.push(r),e.info("Registering Language Client..."),gd(a),e.info("Registering Mod Package Provider..."),await Ia(a),e.info("Registering Profile Renderer..."),new si(a),e.info("Registering Custom Editors..."),new tr(a),new ir(a),e.info("Activate Complete")}catch(t){e.error(`Error while activating: ${t}`)}}var wa=class{constructor(e){this.versionSelector=e}versionSelector;async resolveDebugConfigurationWithSubstitutedVariables(e,t,n){let i=await this.versionSelector.getActiveVersion();if(!i)return;if(await i.isPrototypeCacheEnabled()){let s=await ue.window.showWarningMessage("Prototype Caching is enabled, which usually conflicts with the final portion of debugger initialization (which occurs in settings stage).",{modal:!0},"Disable in config.ini","Continue anyway");if(s==="Disable in config.ini")await i.disablePrototypeCache();else if(s===void 0)return}let r=ue.workspace.getConfiguration("factorio.debug").get("env",{});return Object.keys(r).length>0&&(t.env=Object.assign({},r,t.env)),t}},Da=class{constructor(e){this.versionSelector=e}versionSelector;async createDebugAdapterDescriptor(e,t){let n=await this.versionSelector.getActiveVersion();if(!n)return;if(n.onlineOnly)throw new Error("Select a local Factorio install to debug");if(n.nativeDAP)return new ue.DebugAdapterExecutable(n.factorioPath,["--dap"]);let i=ue.workspace.getConfiguration("factorio");switch(i.get("debug.runMode","inline")){case"inline":default:return new ue.DebugAdapterInlineImplementation(new Fa(n,ue.workspace.fs,{findWorkspaceFiles:ue.workspace.findFiles,getExtension:ue.extensions.getExtension,executeCommand:ue.commands.executeCommand}));case"external":return i.get("inspect",!1)&&t.args.unshift("--nolazy","--inspect-brk=34198"),t.args.push(...await n.debugLaunchArgs()),t}}dispose(){}};export{ph as activate};
20
+ `)}`}ToString(){return this.ToStringInner("")}AddToChild(e,t,n,i){let r=this.children.find(s=>s.name===e);return r?r.value+=t:(r=new a(e,t,n,i),this.children.push(r)),r}Merge(e){this.value+=e.value,e.children.forEach(t=>{let n=this.children.find(i=>i.name===t.name);n?n.Merge(t):this.children.push(t)})}},Mr=class{totalTime=0;mod=new Map;getMod(e){let t=this.mod.get(e);return t||(t=new Er,this.mod.set(e,t)),t}getFile(e,t){let n=this.getMod(e),i=n.file.get(t);return i||(i=new ni,n.file.set(t,i)),i}AddModTime(e,t){this.totalTime+=t,this.getMod(e).totalTime+=t}AddLineTime(e,t,n,i,r){let s=this.getFile(e,t),c=new Nt(i,r),d=s.lines.get(n);s.lines.set(n,c.add(d))}AddFuncTime(e,t,n,i,r){let s=this.getFile(e,t),c=new Nt(i,r),d=s.functions.get(n);s.functions.set(n,c.add(d))}Report(e){let t=new ni;return this.mod.forEach(n=>{let i=n.file.get(e);i&&t.add(i)}),{totalTime:this.totalTime,fileData:t}}},ri=class{constructor(e,t,n){this.context=t;this.debug=n;this._disposables.push(A.debug.onDidReceiveDebugSessionCustomEvent(r=>this.onCustomEvent(r),this)),this._disposables.push(A.debug.onDidTerminateDebugSession(r=>this.onTerminate(r),this)),this.timeDecorationType=A.window.createTextEditorDecorationType({before:{contentText:"",color:new A.ThemeColor("factorio.ProfileTimerForeground")}}),this.funcDecorationType=A.window.createTextEditorDecorationType({after:{contentText:"",color:new A.ThemeColor("factorio.ProfileFunctionTimerForeground"),borderColor:new A.ThemeColor("factorio.ProfileFunctionTimerForeground"),border:"1px solid",margin:"0 0 0 3ch"}});let i=A.workspace.getConfiguration().get("factorio.profile.rulers",[]);this.rulerDecorationTypes=i.filter(r=>r.color||r.themeColor).map(r=>{let s=A.OverviewRulerLane.Right;switch(r.lane){case"Right":s=A.OverviewRulerLane.Right;break;case"Center":s=A.OverviewRulerLane.Center;break;case"Left":s=A.OverviewRulerLane.Left;break;case"Full":s=A.OverviewRulerLane.Full;break;default:break}return{type:A.window.createTextEditorDecorationType({overviewRulerColor:r.color??new A.ThemeColor(r.themeColor),overviewRulerLane:s}),threshold:r.threshold}}),this.statusBar=A.window.createStatusBarItem(),this._disposables.push(A.window.onDidChangeActiveTextEditor(r=>{r&&r.document.uri.scheme==="file"&&this.render(r)})),e&&this.createFlamePanel()}context;debug;profileData=new Mr;profileTreeRoot=new ii("root",0);profileOverhead=new Nt(0,0);timeDecorationType;funcDecorationType;rulerDecorationTypes;statusBar;flamePanel;_disposables=[];onTerminate(e){e===this.debug&&this.dispose()}dispose(){this._disposables.forEach(e=>e.dispose()),this.timeDecorationType.dispose(),this.funcDecorationType.dispose(),this.rulerDecorationTypes.forEach(e=>{e.type.dispose()}),this.statusBar.dispose(),this.flamePanel&&this.flamePanel.dispose()}async onCustomEvent(e){if(e.session===this.debug&&e.event==="x-Factorio-Profile"){await this.parse(e.body);let t=A.window.activeTextEditor;t&&t.document.uri.scheme==="file"&&this.render(t)}}createFlamePanel(){if(this.flamePanel)return;this.flamePanel=A.window.createWebviewPanel("factorioProfile","Factorio Profile",A.ViewColumn.Two,{enableScripts:!0,localResourceRoots:[this.context.extensionUri]});let e=this.flamePanel.webview;e.html=Aa.replace("$Flamegraph.css$",e.asWebviewUri(A.Uri.joinPath(this.context.extensionUri,"/dist/Flamegraph.css")).toString()).replace("$Flamegraph.js$",e.asWebviewUri(A.Uri.joinPath(this.context.extensionUri,"/dist/Flamegraph.js")).toString()),e.onDidReceiveMessage(t=>{switch(t.command){case"init":e.postMessage({command:"update",data:this.profileTreeRoot});break;case"click":t.line&&t.line>0&&t.filename&&t.line&&A.window.showTextDocument(A.Uri.parse(t.filename),{selection:new A.Range(t.line,0,t.line,0),viewColumn:A.ViewColumn.One});break;default:break}}),this.flamePanel.onDidDispose(()=>this.flamePanel=void 0)}async parse(e){let t=e.split(`
21
+ `),n,i,r=[new ii("root",0)],s;for(let c of t){let d=c.split(":");switch(d[0]){case"PROFILE":break;case"PMN":{n=d[1].replace(/[\r\n]*/g,"");let l=parseFloat(d[3]);this.profileData.AddModTime(n,l)}break;case"PFN":n&&(i=await this.debug.customRequest("x-Factorio-ConvertPath",{path:d[1].replace(/[\r\n]*/g,"")}));break;case"PLN":if(n&&i){let l=parseInt(d[1]),g=parseFloat(d[3]),h=parseInt(d[4]);this.profileData.AddLineTime(n,i,l,g,h)}break;case"PFT":if(n&&i){let l=parseInt(d[1]),g=parseFloat(d[3]),h=parseInt(d[4]);this.profileData.AddFuncTime(n,i,l,g,h)}break;case"POV":{let l=parseFloat(d[2]);this.profileOverhead=this.profileOverhead.add(new Nt(l,1))}break;case"PROOT":n&&(Oa(r.length===1),s=r[0].AddToChild(n,0));break;case"PTREE":if(s){let l=d[1],g=await this.debug.customRequest("x-Factorio-ConvertPath",{path:d[2]}),h=d[3],f=l+":"+g+":"+h,v=parseFloat(d[5]);r.push(s),s=s.AddToChild(f,v,g,parseInt(h))}break;case"PTEND":s&&(r.length===1?s=void 0:s=r.pop());break}}Oa(r.length===1),this.flamePanel&&this.flamePanel.visible&&this.flamePanel.webview.postMessage({command:"merge",data:r[0]}),this.profileTreeRoot.Merge(r[0])}render(e){let t=this.profileData.Report(e.document.uri.fsPath),n=t.fileData.max(),i=n.line.timer,r=n.line.average,s=n.line.count,c=new Array,d=new Array,l=this.rulerDecorationTypes.map((V,X)=>({type:V.type,threshold:V.threshold,decs:new Array})),g=A.workspace.getConfiguration().get("factorio.profile.displayAverageTime"),h=A.workspace.getConfiguration().get("factorio.profile.colorBy","totaltime"),f=A.workspace.getConfiguration().get("factorio.profile.timerHighlightColor"),v={count:s,totaltime:i,averagetime:r}[h],p=Math.max(Number.MIN_VALUE,A.workspace.getConfiguration().get("factorio.profile.colorScaleFactor",1)),y={boost:V=>Math.log1p(V*p)/Math.log1p(v*p),linear:V=>V/v,mute:V=>(Math.pow(1+v,V*p/v)-1)/(v*p)}[A.workspace.getConfiguration().get("factorio.profile.colorScaleMode","boost")],C=s.toFixed(0).length+1,b=g?6:3,T=i.toFixed(b).length+1,P=C+T+3,q=t.fileData.lines.size>0,ce=t.fileData.functions.size>0;for(let V=1;V<=e.document.lineCount;V++){if(q){let X=t.fileData.lines.get(V);if(X){let Je=X.timer,rt=X.count,Qe=g?X.avg():Je,st=y({count:rt,totaltime:Je,averagetime:X.avg()}[h]),It=e.document.validateRange(new A.Range(V-1,0,V-1,1/0));c.push({range:It,hoverMessage:g?`total: ${Je}`:`avg: ${X.avg()}`,renderOptions:{before:{backgroundColor:`${f}${Math.floor(255*st).toString(16)}`,contentText:`${rt.toFixed(0).padStart(C,"\xA0")}${Qe.toFixed(b).padStart(T,"\xA0")}\xA0ms`,width:`${P+1}ch`}}});let Et=l.find(ot=>st>=ot.threshold);Et&&Et.decs.push({range:It})}else c.push({range:e.document.validateRange(new A.Range(V-1,0,V-1,1/0)),renderOptions:{before:{width:`${P+1}ch`}}})}if(ce){let X=t.fileData.functions.get(V);if(X){let Je=X.timer,rt=X.count,Qe=g?X.avg():Je,st=e.document.validateRange(new A.Range(V-1,0,V-1,1/0));d.push({range:st,renderOptions:{after:{contentText:`\xA0${rt.toFixed(0)}\xA0|\xA0${Qe.toFixed(b)}\xA0ms\xA0`,color:new A.ThemeColor("factorio.ProfileFunctionTimerForeground"),borderColor:new A.ThemeColor("factorio.ProfileFunctionTimerForeground"),margin:"0 0 0 3ch"}}})}}}e.setDecorations(this.timeDecorationType,c),e.setDecorations(this.funcDecorationType,d),l.forEach(V=>{e.setDecorations(V.type,V.decs)}),this.statusBar.text=`Profile Dump Avg ${this.profileOverhead.avg().toFixed(3)} ms`,this.statusBar.show()}clear(){A.window.visibleTextEditors.forEach(e=>{e.setDecorations(this.timeDecorationType,[]),e.setDecorations(this.funcDecorationType,[]),this.rulerDecorationTypes.forEach(t=>{e.setDecorations(t.type,[])})}),this.statusBar.hide()}};var si=class{constructor(e){this.context=e;e.subscriptions.push(La.debug.onDidStartDebugSession(t=>this.onDidStartDebugSession(t),this))}context;onDidStartDebugSession(e){e.type==="factoriomod"&&e.configuration.hookMode==="profile"&&new ri(e.configuration.profileTree??!0,this.context,e)}};var qn=sn(pd(),1);import*as hd from"path";import{workspace as fd}from"vscode";function gd(a){let e=a.asAbsolutePath(hd.join("dist","fmtk-cli.js")),t={execArgv:["--nolazy","--inspect-brk=34199"]},n={run:{module:e,transport:qn.TransportKind.ipc,args:["lsp"]},debug:{module:e,transport:qn.TransportKind.ipc,args:["lsp"],options:t}},i={documentSelector:[{language:"factorio-locale"},{language:"factorio-changelog"},{language:"lua"}],synchronize:{fileEvents:[fd.createFileSystemWatcher("**/locale/*/*.cfg"),fd.createFileSystemWatcher("**/changelog.txt")]}},r=new qn.LanguageClient("factorioLanguageServer","Factorio Language Server",n,i);r.start(),a.subscriptions.push({dispose(){return r.stop()}})}import*as ve from"vscode";function md(a){return a.type==="int"?{type:"int",value:lp("",a.value)}:a}function ya(a,e){return typeof e=="bigint"?`jsonbigint ${e}n`:e}function lp(a,e){if(typeof e=="string"){let t=e.match(/^jsonbigint\x01\x02 (\d+)n$/);if(t)return BigInt(t[1])}return e}function er(){let a="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<32;t++)a+=e.charAt(Math.floor(Math.random()*e.length));return a}var vd=sn(Sr()),yd=(0,vd.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfEAWTMPA++XitFkAHVmAAjNUa/ZE2T4oFtHBMamuWmyLgiIEAehOGBctLwkYGMardFkwDLVYwNeILa4vA4wGTUdcJzsVYsAkEaHdeAAasw5I1qF3JzpBC0FokeKrZw0LOwW6uTmXh/OODpgAtZOZwWoPDRmDh0jJHWoqMm70wG3HZL7BOfL3Sb6iOBqKIybrkwIFqO67BvKI2r2B4La/lG/63kBIFjmeF7IdeqHAZQoHGuB+FqAATOwABK9iWEkywAOIRMmYSIVhV4AXeeHJhhSGsbhIFgYwEEAMwUVRVbCCgCCzigRizsxf44YBHFcSxKGKWm0SEYw6mQd+gggR2cr8EZwAYP2PDuJp1IyBg8G7q2ZmDsugitvhBnGWW3Gqex6nKfJbFAep/HaWRY56a5zChXpDn8dIok0WotAMWEdmmQOoUtvpEXLnJ2H+WoPnZZ5CneeqGkblppVqMJ6WZZFJnRZpsXUcI16zmo9jyNIKUOelLnJm5zlFXlBVyjlPGAbIJ6jVYWAeFQVj8fIsZ0LiGDOHQ34mdINUDOIVCyLI+YiI2OLUMqzApXwTkmVdhnGUVVi1Gomx3rt+2HYwS0nflYT2BdeBjXSj2vC9OC3UZzkYODxlQxI71HctOJ6mt3hfnVRXJvY+RNHtlAHQj33grSVhApQHhrDINB7Ewvg7iYziUM++FvowYB3iI/1OcZxI0HDeMfZetPUMCLR6sB0h42gdk89QdUeSpaiY9jsvXa20MZdtp6tsws3zVlRCnjNc2UAtlnHXGajUPYWCvl1GFrTtfP4595srWdwiXTt6MK8Dz3qmDTsfV9FsLL9F0oG4axMFbNuznZD01CD/vQ5DKc3YHBMW8j2T3rpP4K0rATC7jzvBytRMc6T5PcBL1DU4wQukwzTOvnmrPsyTkWCDLGeMILeoi0L4uS9LAFyxjWNF71UMYa2mujdrusm/rhs68bpvlWXOL9t4m0O9dsMl0HrunednsHyn+fyZI7QBv21S91vP04H98cKzf4h32Y1TT2nh/wy7RGahs6ozzpheShccYAKfhXEmJhq6Uzrm6Bueom5PhfCzNmxNOZ3W5gBXu/ccZRiHmtEeANDxjy5oDRWk9RyqxntlOeB4jZ6ymnpNeetFon2Ad4Yoe954Q3TkfTObsz7kIYXdG6dUMH4CeBEaQAAuFsMi6rxA8FjCOrgo5914V1R+3DQ4v2WE/cw8jn6vwrFQlRABBHAHgpBKLLCoqhCcnqgzevzEROJDF/VsNwxmPjw6R2QTHW2b95K+3cb/R2wjAHfRAbnb2EDaHF2gdw2B4cyYU1rvXRu9N0HMzblgyuXdgA91iYQ4uxCxakOLKPGg48C4pOiYw/eC8WHLzYSZDhy8uFAN4DwfhXsXE+0Tn7V6+j+k8B4JbMR1DInJxaZIiREMr7YR4NkDwPAoipM8XEi2AzgJaJwastZV4zBTGPNSdatBqEXJHCrXBZy6T3OPDvHAdzLl0KeeA7CrzRyhNkvLeS/zHmnN+ecr5ws0DGnBLLeIGBPkPNKUVUFeBTHFCRceKhwL1mbO2ZEMF7kVkww8aXbhCS0YjOScrSZ30BnJgwGweB2SqbILyY+RmMimDWOmXnbu+CKnVKIaLCwagBn1KJe5CeyslnEoERlHpVgukXkmDYYJTAsBRmhOHKUYYpTZlsPCMMdYPxNiTKmUq+wABWWYgTggyLOCsLZVVCgwL2MsPVOxljIPgIAA===");var tr=class{constructor(e){this.context=e;this.context.subscriptions.push(ve.window.registerCustomEditorProvider("fmtk.modsettings",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new ve.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async saveCustomDocument(e,t){return e.save(t)}async saveCustomDocumentAs(e,t,n){return e.saveAs(t,n)}async revertCustomDocument(e,t){return e.revert(t)}async backupCustomDocument(e,t,n){return e.backup(t.destination,n)}async openCustomDocument(e,t,n){let i=await Ca.create(e,t.backupId),r=[];return r.push(i.onDidChange(s=>{this._onDidChangeCustomDocument.fire({document:i,...s})})),r.push(i.onDidChangeContent(s=>{let c=this.webviews.get(i.uri.toString());c&&this.postMessage(c,"init",{version:i.version,saves_ints:i.saves_ints,settings:JSON.stringify(i.settings,ya),editable:ve.workspace.fs.isWritableFileSystem(i.uri.scheme)!==!1})})),i.onDidDispose(()=>r.forEach(s=>s.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=yd.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,er()).replace(/\$ModSettingsWebview\.css\$/g,i.asWebviewUri(ve.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.css")).toString()).replace(/\$ModSettingsWebview\.js\$/g,i.asWebviewUri(ve.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.js")).toString()),t.webview.onDidReceiveMessage(r=>this.onMessage(e,r)),t.webview.onDidReceiveMessage(r=>{r.type==="ready"&&this.postMessage(t,"init",{version:e.version,saves_ints:e.saves_ints,settings:JSON.stringify(e.settings,ya),editable:ve.workspace.fs.isWritableFileSystem(e.uri.scheme)!==!1})})}postMessage(e,t,n){e.webview.postMessage({type:t,body:n})}onMessage(e,t){if(t.type==="edit"){e.edit(t.body);return}}},Ca=class a{constructor(e,t){this.uri=e;this._settings=new wr(new on(t))}uri;static async create(e,t){let n=typeof t=="string"?ve.Uri.parse(t):e,i=await ve.workspace.fs.readFile(n);return new a(e,i)}_settings;get version(){return this._settings.version.format()}get saves_ints(){return this._settings.version.isBeyond(1,2)}get settings(){return this._settings.settings}async save(e){return this.saveAs(this.uri,e)}async saveAs(e,t){return ve.workspace.fs.writeFile(e,this._settings.save())}async revert(e){this._settings=new wr(new on(await ve.workspace.fs.readFile(this.uri))),this._onDidChangeDocument.fire({})}async backup(e,t){return await this.saveAs(e,t),{id:e.toString(),delete:()=>{ve.workspace.fs.delete(e)}}}edit(e){e.value.type==="none"?this._settings.set(e.scope,e.name,void 0):this._settings.set(e.scope,e.name,md(e.value)),this._onDidChange.fire({})}_onDidDispose=new ve.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new ve.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new ve.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};import*as qt from"vscode";function In(a){switch(a.type){case"Table":case"TableWithMeta":return Object.assign({},a,{values:void 0,values_count:a.values.length});default:return a}}var Cd=sn(Sr()),wd=(0,Cd.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfFvQVTMCUDAAdWYACM1Rr9kTZPigW0cExqa5abIuCIgQB6E4YFy0vARyYYfbRjDAYvljCV4iNri8DjABNmHiuE52csWASCNDuvAANWYcka1Hb450ghaC0SPFV04aFnYjeXJ2Lg9nHB0wAPw8XpHH9co85HwGXq6Y2TMOtvxd3x/37SH1CPcpPkZsNw1iYLBe2hZggSlMMpQzWx4TDashQwet4yTdVIn2AArdMgXBDJp1LRtZAArtix7PtSLIfAgA===");import*as Ct from"vscode";var nr=class a{constructor(e,t){this.uri=e;this._data=new qa(new on(t))}uri;static async create(e,t){let n=typeof t=="string"?Ct.Uri.parse(t):e,i=await Ct.workspace.fs.readFile(n);return new a(e,i)}_data;get version(){return this._data.version.format()}get rootdata(){let e={};for(let t in this._data.data)e[t]=In(this._data.data[t]);return e}find(e,t){return this._data.find(e,t)}_onDidDispose=new Ct.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new Ct.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new Ct.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};var ir=class{constructor(e){this.context=e;this.context.subscriptions.push(qt.window.registerCustomEditorProvider("fmtk.scriptdat",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new qt.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async openCustomDocument(e,t,n){let i=await nr.create(e,t.backupId),r=[];return r.push(i.onDidChange(s=>{this._onDidChangeCustomDocument.fire({document:i,...s})})),r.push(i.onDidChangeContent(s=>{let c=this.webviews.get(i.uri.toString());c&&this.postMessage(c,"init",{version:i.version,data:i.rootdata})})),i.onDidDispose(()=>r.forEach(s=>s.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=wd.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,er()).replace(/\$ScriptDatWebview\.css\$/g,i.asWebviewUri(qt.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.css")).toString()).replace(/\$ScriptDatWebview\.js\$/g,i.asWebviewUri(qt.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.js")).toString()),t.webview.onDidReceiveMessage(r=>this.onMessage(e,r)),t.webview.onDidReceiveMessage(r=>{r.type==="ready"&&this.postMessage(t,"init",{version:e.version,data:e.rootdata})})}postMessage(e,t,n){e.webview.postMessage({type:t,body:n})}onMessage(e,t){if(t.type==="fetch"){let n=t.body,i=e.find(n.modname,n.gcid),r;n.index!==void 0&&n.count!==void 0?r=i.values.slice(n.index,n.index+n.count):r=i.values,this.postMessage(this.webviews.get(e.uri.toString()),"values",{...n,values:r.map(s=>({key:In(s.key),value:In(s.value)}))})}}};async function ph(a){let e=ue.window.createOutputChannel("FMTK",{log:!0});e.info(`FMTK ${Qn}`);try{e.info("Registering FS Provider...");let t=new ti;a.subscriptions.push(ue.workspace.registerFileSystemProvider("fmtk",t,{isCaseSensitive:!0})),e.info("Registering Version Selector...");let n=new Xn(a,e,t);e.info("Registering Debug Provider...");let i=new wa(n);a.subscriptions.push(ue.debug.registerDebugConfigurationProvider("factoriomod",i));let r=new Da(n);a.subscriptions.push(ue.debug.registerDebugAdapterDescriptorFactory("factoriomod",r)),a.subscriptions.push(r),e.info("Registering Language Client..."),gd(a),e.info("Registering Mod Package Provider..."),await Ia(a),e.info("Registering Profile Renderer..."),new si(a),e.info("Registering Custom Editors..."),new tr(a),new ir(a),e.info("Activate Complete")}catch(t){e.error(`Error while activating: ${t}`)}}var wa=class{constructor(e){this.versionSelector=e}versionSelector;async resolveDebugConfigurationWithSubstitutedVariables(e,t,n){let i=await this.versionSelector.getActiveVersion();if(!i)return;if(await i.isPrototypeCacheEnabled()){let s=await ue.window.showWarningMessage("Prototype Caching is enabled, which usually conflicts with the final portion of debugger initialization (which occurs in settings stage).",{modal:!0},"Disable in config.ini","Continue anyway");if(s==="Disable in config.ini")await i.disablePrototypeCache();else if(s===void 0)return}let r=ue.workspace.getConfiguration("factorio.debug").get("env",{});return Object.keys(r).length>0&&(t.env=Object.assign({},r,t.env)),t}},Da=class{constructor(e){this.versionSelector=e}versionSelector;async createDebugAdapterDescriptor(e,t){let n=await this.versionSelector.getActiveVersion();if(!n)return;if(n.onlineOnly)throw new Error("Select a local Factorio install to debug");if(n.nativeDAP)return new ue.DebugAdapterExecutable(n.factorioPath,["--dap"]);let i=ue.workspace.getConfiguration("factorio");switch(i.get("debug.runMode","inline")){case"inline":default:return new ue.DebugAdapterInlineImplementation(new Fa(n,ue.workspace.fs,{findWorkspaceFiles:ue.workspace.findFiles,getExtension:ue.extensions.getExtension,executeCommand:ue.commands.executeCommand}));case"external":return i.get("inspect",!1)&&t.args.unshift("--nolazy","--inspect-brk=34198"),t.args.push(...await n.debugLaunchArgs()),t}}dispose(){}};export{ph as activate};
22
22
  //# sourceMappingURL=fmtk-vscode.js.map