factoriomod-debug 2.1.4 → 2.1.5

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,17 +2,17 @@
2
2
  import {createRequire} from 'module'
3
3
  const require = createRequire(import.meta.url)
4
4
 
5
- import{F as Oc,G as Rc,H as gs,J as Fc,K as xc,a as I,b as dd,c as M,d as fd,e as Qn,f as hd,h as Bi,i as Oe,j as _e,k as Zn,l as ps,m as N,n as Sn,o as Dn,p as pd,q as gd,r as md}from"./chunk-GAQQYZ45.js";var Ac=M((kv,Ic)=>{"use strict";var{hasOwnProperty:Cs}=Object.prototype,bs=(r,e={})=>{typeof e=="string"&&(e={section:e}),e.align=e.align===!0,e.newline=e.newline===!0,e.sort=e.sort===!0,e.whitespace=e.whitespace===!0||e.align===!0,e.platform=e.platform||typeof process<"u"&&process.platform,e.bracketedArray=e.bracketedArray!==!1;let t=e.platform==="win32"?`\r
5
+ import{F as Rc,G as Fc,H as ms,J as xc,K as Mc,a as I,b as hd,c as M,d as pd,e as Qn,f as gd,h as zi,i as Re,j as _e,k as Zn,l as gs,m as N,n as sn,o as on,p as md,q as vd,r as yd}from"./chunk-KPUB7KA2.js";var jc=M((qv,Ac)=>{"use strict";var{hasOwnProperty:bs}=Object.prototype,Ss=(r,e={})=>{typeof e=="string"&&(e={section:e}),e.align=e.align===!0,e.newline=e.newline===!0,e.sort=e.sort===!0,e.whitespace=e.whitespace===!0||e.align===!0,e.platform=e.platform||typeof process<"u"&&process.platform,e.bracketedArray=e.bracketedArray!==!1;let t=e.platform==="win32"?`\r
6
6
  `:`
7
- `,n=e.whitespace?" = ":"=",i=[],s=e.sort?Object.keys(r).sort():Object.keys(r),o=0;e.align&&(o=Pt(s.filter(l=>r[l]===null||Array.isArray(r[l])||typeof r[l]!="object").map(l=>Array.isArray(r[l])?`${l}[]`:l).concat([""]).reduce((l,h)=>Pt(l).length>=Pt(h).length?l:h)).length);let a="",u=e.bracketedArray?"[]":"";for(let l of s){let h=r[l];if(h&&Array.isArray(h))for(let p of h)a+=Pt(`${l}${u}`).padEnd(o," ")+n+Pt(p)+t;else h&&typeof h=="object"?i.push(l):a+=Pt(l).padEnd(o," ")+n+Pt(h)+t}e.section&&a.length&&(a="["+Pt(e.section)+"]"+(e.newline?t+t:t)+a);for(let l of i){let h=Ec(l,".").join("\\."),p=(e.section?e.section+".":"")+h,f=bs(r[l],{...e,section:p});a.length&&f.length&&(a+=t),a+=f}return a};function Ec(r,e){var t=0,n=0,i=0,s=[];do if(i=r.indexOf(e,t),i!==-1){if(t=i+e.length,i>0&&r[i-1]==="\\")continue;s.push(r.slice(n,i)),n=i+e.length}while(i!==-1);return s.push(r.slice(n)),s}var kc=(r,e={})=>{e.bracketedArray=e.bracketedArray!==!1;let t=Object.create(null),n=t,i=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=r.split(/[\r\n]+/g),a={};for(let l of o){if(!l||l.match(/^\s*[;#]/)||l.match(/^\s*$/))continue;let h=l.match(s);if(!h)continue;if(h[1]!==void 0){if(i=Gi(h[1]),i==="__proto__"){n=Object.create(null);continue}n=t[i]=t[i]||Object.create(null);continue}let p=Gi(h[2]),f;e.bracketedArray?f=p.length>2&&p.slice(-2)==="[]":(a[p]=(a?.[p]||0)+1,f=a[p]>1);let m=f&&p.endsWith("[]")?p.slice(0,-2):p;if(m==="__proto__")continue;let g=h[3]?Gi(h[4]):!0,v=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;f&&(Cs.call(n,m)?Array.isArray(n[m])||(n[m]=[n[m]]):n[m]=[]),Array.isArray(n[m])?n[m].push(v):n[m]=v}let u=[];for(let l of Object.keys(t)){if(!Cs.call(t,l)||typeof t[l]!="object"||Array.isArray(t[l]))continue;let h=Ec(l,".");n=t;let p=h.pop(),f=p.replace(/\\\./g,".");for(let m of h)m!=="__proto__"&&((!Cs.call(n,m)||typeof n[m]!="object")&&(n[m]=Object.create(null)),n=n[m]);n===t&&f===p||(n[f]=t[l],u.push(l))}for(let l of u)delete t[l];return t},qc=r=>r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"),Pt=r=>typeof r!="string"||r.match(/[=\r\n]/)||r.match(/^\[/)||r.length>1&&qc(r)||r!==r.trim()?JSON.stringify(r):r.split(";").join("\\;").split("#").join("\\#"),Gi=r=>{if(r=(r||"").trim(),qc(r)){r.charAt(0)==="'"&&(r=r.slice(1,-1));try{r=JSON.parse(r)}catch{}}else{let e=!1,t="";for(let n=0,i=r.length;n<i;n++){let s=r.charAt(n);if(e)"\\;#".indexOf(s)!==-1?t+=s:t+="\\"+s,e=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?e=!0:t+=s}}return e&&(t+="\\"),t.trim()}return r};Ic.exports={parse:kc,decode:kc,stringify:bs,encode:bs,safe:Pt,unsafe:Gi}});var He=M(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.boolean=Dd;Ke.string=Lc;Ke.number=Pd;Ke.error=Td;Ke.func=Nc;Ke.array=Uc;Ke.stringArray=Od;Ke.typedArray=Rd;Ke.thenable=Kc;Ke.asPromise=Fd;function Dd(r){return r===!0||r===!1}function Lc(r){return typeof r=="string"||r instanceof String}function Pd(r){return typeof r=="number"||r instanceof Number}function Td(r){return r instanceof Error}function Nc(r){return typeof r=="function"}function Uc(r){return Array.isArray(r)}function Od(r){return Uc(r)&&r.every(e=>Lc(e))}function Rd(r,e){return Array.isArray(r)&&r.every(e)}function Kc(r){return r&&Nc(r.then)}function Fd(r){return r instanceof Promise?r:Kc(r)?new Promise((e,t)=>{r.then(n=>e(n),n=>t(n))}):Promise.resolve(r)}});var Zi=M(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.Semaphore=Je.Delayer=void 0;Je.setTestMode=xd;Je.clearTestMode=Md;Je.map=kd;Je.mapAsync=Ed;Je.forEach=qd;var ii=N(),Os=class{defaultDelay;timeout;completionPromise;onSuccess;task;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;let n=this.task();return this.task=void 0,n})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,ii.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)}};Je.Delayer=Os;var Rs=class{_capacity;_active;_waiting;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,ii.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()}}};Je.Semaphore=Rs;var Fs=!1;function xd(){Fs=!0}function Md(){Fs=!1}var Hc=15,ni=class{yieldAfter;startTime;counter;total;counterInterval;constructor(e=Hc){this.yieldAfter=Fs===!0?Math.max(e,2):Math.max(e,Hc),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 kd(r,e,t,n){if(r.length===0)return[];let i=new Array(r.length),s=new ni(n?.yieldAfter);function o(u){s.start();for(let l=u;l<r.length;l++)if(i[l]=e(r[l]),s.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let a=o(0);for(;a!==-1&&!(t!==void 0&&t.isCancellationRequested);)a=await new Promise(u=>{(0,ii.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function Ed(r,e,t,n){if(r.length===0)return[];let i=new Array(r.length),s=new ni(n?.yieldAfter);async function o(u){s.start();for(let l=u;l<r.length;l++)if(i[l]=await e(r[l],t),s.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let a=await o(0);for(;a!==-1&&!(t!==void 0&&t.isCancellationRequested);)a=await new Promise(u=>{(0,ii.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function qd(r,e,t,n){if(r.length===0)return;let i=new ni(n?.yieldAfter);function s(a){i.start();for(let u=a;u<r.length;u++)if(e(r[u]),i.shouldYield())return n?.yieldCallback&&n.yieldCallback(),u+1;return-1}let o=s(0);for(;o!==-1&&!(t!==void 0&&t.isCancellationRequested);)o=await new Promise(a=>{(0,ii.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?a(-1):a(s(o))})})}});var Ms=M(Tt=>{"use strict";var Id=Tt&&Tt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ad=Tt&&Tt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),jd=Tt&&Tt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Id(t,e,n[i]);return Ad(t,e),t}})();Object.defineProperty(Tt,"__esModule",{value:!0});var Ld=jd(I("vscode")),xs=class extends Ld.CompletionItem{data;fromEdit;documentationFormat;originalItemKind;deprecated;insertTextMode;constructor(e){super(e)}};Tt.default=xs});var Es=M(Ot=>{"use strict";var Nd=Ot&&Ot.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ud=Ot&&Ot.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Kd=Ot&&Ot.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Nd(t,e,n[i]);return Ud(t,e),t}})();Object.defineProperty(Ot,"__esModule",{value:!0});var Hd=Kd(I("vscode")),ks=class extends Hd.CodeLens{data;constructor(e){super(e)}};Ot.default=ks});var Is=M(Rt=>{"use strict";var Wd=Rt&&Rt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),$d=Rt&&Rt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Bd=Rt&&Rt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Wd(t,e,n[i]);return $d(t,e),t}})();Object.defineProperty(Rt,"__esModule",{value:!0});var zd=Bd(I("vscode")),qs=class extends zd.DocumentLink{data;constructor(e,t){super(e,t)}};Rt.default=qs});var js=M(Ft=>{"use strict";var Vd=Ft&&Ft.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Gd=Ft&&Ft.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Jd=Ft&&Ft.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Vd(t,e,n[i]);return Gd(t,e),t}})();Object.defineProperty(Ft,"__esModule",{value:!0});var Yd=Jd(I("vscode")),As=class extends Yd.CodeAction{data;constructor(e,t){super(e),this.data=t}};Ft.default=As});var Us=M(We=>{"use strict";var Qd=We&&We.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Zd=We&&We.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),$c=We&&We.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Qd(t,e,n[i]);return Zd(t,e),t}})();Object.defineProperty(We,"__esModule",{value:!0});We.ProtocolDiagnostic=We.DiagnosticCode=void 0;var Xd=$c(I("vscode")),Ls=$c(He()),Wc;(function(r){function e(t){let n=t;return n!=null&&(Ls.number(n.value)||Ls.string(n.value))&&Ls.string(n.target)}r.is=e})(Wc||(We.DiagnosticCode=Wc={}));var Ns=class extends Xd.Diagnostic{data;hasDiagnosticCode;constructor(e,t,n,i){super(e,t,n),this.data=i,this.hasDiagnosticCode=!1}};We.ProtocolDiagnostic=Ns});var Hs=M(xt=>{"use strict";var ef=xt&&xt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),tf=xt&&xt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),nf=xt&&xt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&ef(t,e,n[i]);return tf(t,e),t}})();Object.defineProperty(xt,"__esModule",{value:!0});var rf=nf(I("vscode")),Ks=class extends rf.CallHierarchyItem{data;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,o),a!==void 0&&(this.data=a)}};xt.default=Ks});var $s=M(Mt=>{"use strict";var sf=Mt&&Mt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),of=Mt&&Mt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),af=Mt&&Mt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&sf(t,e,n[i]);return of(t,e),t}})();Object.defineProperty(Mt,"__esModule",{value:!0});var cf=af(I("vscode")),Ws=class extends cf.TypeHierarchyItem{data;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,o),a!==void 0&&(this.data=a)}};Mt.default=Ws});var zs=M(kt=>{"use strict";var uf=kt&&kt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),lf=kt&&kt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),df=kt&&kt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&uf(t,e,n[i]);return lf(t,e),t}})();Object.defineProperty(kt,"__esModule",{value:!0});var Xi=df(I("vscode")),Bs=class extends Xi.SymbolInformation{data;hasRange;constructor(e,t,n,i,s){let o=!(i instanceof Xi.Uri);super(e,t,n,o?i:new Xi.Location(i,new Xi.Range(0,0,0,0))),this.hasRange=o,s!==void 0&&(this.data=s)}};kt.default=Bs});var Gs=M(Et=>{"use strict";var ff=Et&&Et.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),hf=Et&&Et.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),pf=Et&&Et.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&ff(t,e,n[i]);return hf(t,e),t}})();Object.defineProperty(Et,"__esModule",{value:!0});var gf=pf(I("vscode")),Vs=class extends gf.InlayHint{data;constructor(e,t,n){super(e,t,n)}};Et.default=Vs});var Gc=M(Ye=>{"use strict";var mf=Ye&&Ye.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),vf=Ye&&Ye.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),er=Ye&&Ye.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&mf(t,e,n[i]);return vf(t,e),t}})(),Vt=Ye&&Ye.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.createConverter=Pf;var de=er(I("vscode")),L=er(N()),an=er(He()),Bc=er(Zi()),yf=Vt(Ms()),_f=Vt(Es()),wf=Vt(Is()),zc=Vt(js()),Vc=Us(),Cf=Vt(Hs()),bf=Vt($s()),Sf=Vt(zs()),Df=Vt(Gs()),Js;(function(r){function e(t){let n=t;return n&&!!n.inserting&&!!n.replacing}r.is=e})(Js||(Js={}));function Pf(r){let t=r||(d=>d.toString());function n(d){return t(d)}function i(d){return{uri:t(d.uri)}}function s(d){return{uri:t(d.uri),languageId:d.languageId,version:d.version,text:d.getText()}}function o(d){return{uri:t(d.uri),version:d.version}}function a(d){return{textDocument:s(d)}}function u(d){let w=d;return!!w.document&&!!w.contentChanges}function l(d){let w=d;return!!w.uri&&!!w.version}function h(d,w,x){if(l(d))return{textDocument:{uri:t(d.uri),version:d.version},contentChanges:[{text:d.getText()}]};if(u(d)){let Z=w,V=x;return{textDocument:{uri:t(Z),version:V},contentChanges:d.contentChanges.map(ke=>{let St=ke.range;return{range:{start:{line:St.start.line,character:St.start.character},end:{line:St.end.line,character:St.end.character}},rangeLength:ke.rangeLength,text:ke.text}})}}else throw Error("Unsupported text document change parameter")}function p(d){return{textDocument:i(d)}}function f(d,w=!1){let x={textDocument:i(d)};return w&&(x.text=d.getText()),x}function m(d){switch(d){case de.TextDocumentSaveReason.Manual:return L.TextDocumentSaveReason.Manual;case de.TextDocumentSaveReason.AfterDelay:return L.TextDocumentSaveReason.AfterDelay;case de.TextDocumentSaveReason.FocusOut:return L.TextDocumentSaveReason.FocusOut}return L.TextDocumentSaveReason.Manual}function g(d){return{textDocument:i(d.document),reason:m(d.reason)}}function v(d){return{files:d.files.map(w=>({uri:t(w)}))}}function _(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function T(d){return{files:d.files.map(w=>({uri:t(w)}))}}function C(d){return{files:d.files.map(w=>({uri:t(w)}))}}function D(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function F(d){return{files:d.files.map(w=>({uri:t(w)}))}}function E(d,w){return{textDocument:i(d),position:rn(w)}}function Q(d){switch(d){case de.CompletionTriggerKind.TriggerCharacter:return L.CompletionTriggerKind.TriggerCharacter;case de.CompletionTriggerKind.TriggerForIncompleteCompletions:return L.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return L.CompletionTriggerKind.Invoked}}function we(d,w,x){return{textDocument:i(d),position:rn(w),context:{triggerKind:Q(x.triggerKind),triggerCharacter:x.triggerCharacter}}}function xe(d){switch(d){case de.SignatureHelpTriggerKind.Invoke:return L.SignatureHelpTriggerKind.Invoked;case de.SignatureHelpTriggerKind.TriggerCharacter:return L.SignatureHelpTriggerKind.TriggerCharacter;case de.SignatureHelpTriggerKind.ContentChange:return L.SignatureHelpTriggerKind.ContentChange}}function Kn(d){return{label:d.label}}function Vr(d){return d.map(Kn)}function Hn(d){return{label:d.label,parameters:Vr(d.parameters)}}function Gr(d){return d.map(Hn)}function Jr(d){return d===void 0?d:{signatures:Gr(d.signatures),activeSignature:d.activeSignature,activeParameter:d.activeParameter}}function Yr(d,w,x){return{textDocument:i(d),position:rn(w),context:{isRetrigger:x.isRetrigger,triggerCharacter:x.triggerCharacter,triggerKind:xe(x.triggerKind),activeSignatureHelp:Jr(x.activeSignatureHelp)}}}function rn(d){return{line:d.line,character:d.character}}function Ct(d){return d==null?d:{line:d.line>L.uinteger.MAX_VALUE?L.uinteger.MAX_VALUE:d.line,character:d.character>L.uinteger.MAX_VALUE?L.uinteger.MAX_VALUE:d.character}}function yn(d,w){return Bc.map(d,Ct,w)}function Ri(d){return d.map(Ct)}function he(d){return d==null?d:{start:Ct(d.start),end:Ct(d.end)}}function Qr(d){return d.map(he)}function Kt(d){return d==null?d:L.Location.create(n(d.uri),he(d.range))}function Wn(d){switch(d){case de.DiagnosticSeverity.Error:return L.DiagnosticSeverity.Error;case de.DiagnosticSeverity.Warning:return L.DiagnosticSeverity.Warning;case de.DiagnosticSeverity.Information:return L.DiagnosticSeverity.Information;case de.DiagnosticSeverity.Hint:return L.DiagnosticSeverity.Hint}}function Fi(d){if(!d)return;let w=[];for(let x of d){let Z=$n(x);Z!==void 0&&w.push(Z)}return w.length>0?w:void 0}function $n(d){switch(d){case de.DiagnosticTag.Unnecessary:return L.DiagnosticTag.Unnecessary;case de.DiagnosticTag.Deprecated:return L.DiagnosticTag.Deprecated;default:return}}function Ht(d){return{message:d.message,location:Kt(d.location)}}function Zr(d){return d.map(Ht)}function Xr(d){if(d!=null)return an.number(d)||an.string(d)?d:{value:d.value,target:n(d.target)}}function _n(d){let w=L.Diagnostic.create(he(d.range),d.message),x=d instanceof Vc.ProtocolDiagnostic?d:void 0;x!==void 0&&x.data!==void 0&&(w.data=x.data);let Z=Xr(d.code);return Vc.DiagnosticCode.is(Z)?x!==void 0&&x.hasDiagnosticCode?w.code=Z:(w.code=Z.value,w.codeDescription={href:Z.target}):w.code=Z,an.number(d.severity)&&(w.severity=Wn(d.severity)),Array.isArray(d.tags)&&(w.tags=Fi(d.tags)),d.relatedInformation&&(w.relatedInformation=Zr(d.relatedInformation)),d.source&&(w.source=d.source),w}function wn(d,w){return d==null?d:Bc.map(d,_n,w)}function Bn(d){return d==null?d:d.map(_n)}function es(d,w){switch(d){case"$string":return w;case L.MarkupKind.PlainText:return{kind:d,value:w};case L.MarkupKind.Markdown:return{kind:d,value:w.value};default:return`Unsupported Markup content received. Kind is: ${d}`}}function xi(d){if(d===de.CompletionItemTag.Deprecated)return L.CompletionItemTag.Deprecated}function Mi(d){if(d===void 0)return d;let w=[];for(let x of d){let Z=xi(x);Z!==void 0&&w.push(Z)}return w}function ts(d,w){return w!==void 0?w:d+1}function Wt(d,w=!1){let x,Z;an.string(d.label)?x=d.label:(x=d.label.label,w&&(d.label.detail!==void 0||d.label.description!==void 0)&&(Z={detail:d.label.detail,description:d.label.description}));let V={label:x};Z!==void 0&&(V.labelDetails=Z);let De=d instanceof yf.default?d:void 0;d.detail&&(V.detail=d.detail),d.documentation&&(!De||De.documentationFormat==="$string"?V.documentation=d.documentation:V.documentation=es(De.documentationFormat,d.documentation)),d.filterText&&(V.filterText=d.filterText),ki(V,d),an.number(d.kind)&&(V.kind=ts(d.kind,De&&De.originalItemKind)),d.sortText&&(V.sortText=d.sortText),d.additionalTextEdits&&(V.additionalTextEdits=Ei(d.additionalTextEdits)),d.commitCharacters&&(V.commitCharacters=d.commitCharacters.slice()),d.command&&(V.command=$t(d.command)),(d.preselect===!0||d.preselect===!1)&&(V.preselect=d.preselect);let ke=Mi(d.tags);if(De){if(De.data!==void 0&&(V.data=De.data),De.deprecated===!0||De.deprecated===!1){if(De.deprecated===!0&&ke!==void 0&&ke.length>0){let St=ke.indexOf(de.CompletionItemTag.Deprecated);St!==-1&&ke.splice(St,1)}V.deprecated=De.deprecated}De.insertTextMode!==void 0&&(V.insertTextMode=De.insertTextMode)}return ke!==void 0&&ke.length>0&&(V.tags=ke),V.insertTextMode===void 0&&d.keepWhitespace===!0&&(V.insertTextMode=L.InsertTextMode.adjustIndentation),V}function ki(d,w){let x=L.InsertTextFormat.PlainText,Z,V;w.textEdit?(Z=w.textEdit.newText,V=w.textEdit.range):w.insertText instanceof de.SnippetString?(x=L.InsertTextFormat.Snippet,Z=w.insertText.value):Z=w.insertText,w.range&&(V=w.range),d.insertTextFormat=x,w.fromEdit&&Z!==void 0&&V!==void 0?d.textEdit=Cn(Z,V):d.insertText=Z}function Cn(d,w){return Js.is(w)?L.InsertReplaceEdit.create(d,he(w.inserting),he(w.replacing)):{newText:d,range:he(w)}}function zn(d){return{range:he(d.range),newText:d.newText}}function Ei(d){return d==null?d:d.map(zn)}function bt(d){return d<=de.SymbolKind.TypeParameter?d+1:L.SymbolKind.Property}function Vn(d){return d}function Me(d){return d.map(Vn)}function ns(d,w,x){return{textDocument:i(d),position:rn(w),context:{includeDeclaration:x.includeDeclaration}}}async function Ve(d,w){let x=L.CodeAction.create(d.title);if(d instanceof zc.default&&d.data!==void 0&&(x.data=d.data),d.kind!==void 0&&(x.kind=qi(d.kind)),d.diagnostics!==void 0&&(x.diagnostics=await wn(d.diagnostics,w)),d.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return d.command!==void 0&&(x.command=$t(d.command)),d.isPreferred!==void 0&&(x.isPreferred=d.isPreferred),d.disabled!==void 0&&(x.disabled={reason:d.disabled.reason}),d.isAI&&(x.tags??=[],x.tags.push(L.CodeActionTag.LLMGenerated)),x}function bn(d){let w=L.CodeAction.create(d.title);if(d instanceof zc.default&&d.data!==void 0&&(w.data=d.data),d.kind!==void 0&&(w.kind=qi(d.kind)),d.diagnostics!==void 0&&(w.diagnostics=Bn(d.diagnostics)),d.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return d.command!==void 0&&(w.command=$t(d.command)),d.isPreferred!==void 0&&(w.isPreferred=d.isPreferred),d.disabled!==void 0&&(w.disabled={reason:d.disabled.reason}),d.isAI&&(w.tags??=[],w.tags.push(L.CodeActionTag.LLMGenerated)),w}async function is(d,w){if(d==null)return d;let x;return d.only&&an.string(d.only.value)&&(x=[d.only.value]),L.CodeActionContext.create(await wn(d.diagnostics,w),x,Gn(d.triggerKind))}function rs(d){if(d==null)return d;let w;return d.only&&an.string(d.only.value)&&(w=[d.only.value]),L.CodeActionContext.create(Bn(d.diagnostics),w,Gn(d.triggerKind))}function Gn(d){switch(d){case de.CodeActionTriggerKind.Invoke:return L.CodeActionTriggerKind.Invoked;case de.CodeActionTriggerKind.Automatic:return L.CodeActionTriggerKind.Automatic;default:return}}function qi(d){if(d!=null)return d.value}function Ii(d){return L.InlineValueContext.create(d.frameId,he(d.stoppedLocation))}function ss(d,w,x){return{textDocument:i(d),position:Ct(w),context:Jn(x)}}function Jn(d){return{triggerKind:os(d.triggerKind),selectedCompletionInfo:Ai(d.selectedCompletionInfo)}}function os(d){switch(d){case de.InlineCompletionTriggerKind.Invoke:return L.InlineCompletionTriggerKind.Invoked;case de.InlineCompletionTriggerKind.Automatic:return L.InlineCompletionTriggerKind.Automatic}}function Ai(d){if(d!=null)return{range:he(d.range),text:d.text}}function $t(d){let w=L.Command.create(d.title,d.command);return d.tooltip&&(w.tooltip=d.tooltip),d.arguments&&(w.arguments=d.arguments),w}function ji(d){let w=L.CodeLens.create(he(d.range));return d.command&&(w.command=$t(d.command)),d instanceof _f.default&&d.data&&(w.data=d.data),w}function Li(d,w){let x={tabSize:d.tabSize,insertSpaces:d.insertSpaces};return w.trimTrailingWhitespace&&(x.trimTrailingWhitespace=!0),w.trimFinalNewlines&&(x.trimFinalNewlines=!0),w.insertFinalNewline&&(x.insertFinalNewline=!0),x}function as(d){return{textDocument:i(d)}}function Ni(d){return{textDocument:i(d)}}function cs(d){let w=L.DocumentLink.create(he(d.range));d.target&&(w.target=n(d.target)),d.tooltip!==void 0&&(w.tooltip=d.tooltip);let x=d instanceof wf.default?d:void 0;return x&&x.data&&(w.data=x.data),w}function Ui(d){return{textDocument:i(d)}}function Ki(d){let w={name:d.name,kind:bt(d.kind),uri:n(d.uri),range:he(d.range),selectionRange:he(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=Me(d.tags)),d instanceof Cf.default&&d.data!==void 0&&(w.data=d.data),w}function us(d){let w={name:d.name,kind:bt(d.kind),uri:n(d.uri),range:he(d.range),selectionRange:he(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=Me(d.tags)),d instanceof bf.default&&d.data!==void 0&&(w.data=d.data),w}function Yn(d){let w=d instanceof Sf.default?{name:d.name,kind:bt(d.kind),location:d.hasRange?Kt(d.location):{uri:t(d.location.uri)},data:d.data}:{name:d.name,kind:bt(d.kind),location:Kt(d.location)};return d.tags!==void 0&&(w.tags=Me(d.tags)),d.containerName!==""&&(w.containerName=d.containerName),w}function ls(d){let w=typeof d.label=="string"?d.label:d.label.map(Hi),x=L.InlayHint.create(Ct(d.position),w);return d.kind!==void 0&&(x.kind=d.kind),d.textEdits!==void 0&&(x.textEdits=Ei(d.textEdits)),d.tooltip!==void 0&&(x.tooltip=Wi(d.tooltip)),d.paddingLeft!==void 0&&(x.paddingLeft=d.paddingLeft),d.paddingRight!==void 0&&(x.paddingRight=d.paddingRight),d instanceof Df.default&&d.data!==void 0&&(x.data=d.data),x}function Hi(d){let w=L.InlayHintLabelPart.create(d.value);return d.location!==void 0&&(w.location=Kt(d.location)),d.command!==void 0&&(w.command=$t(d.command)),d.tooltip!==void 0&&(w.tooltip=Wi(d.tooltip)),w}function Wi(d){return typeof d=="string"?d:{kind:L.MarkupKind.Markdown,value:d.value}}return{asUri:n,asTextDocumentIdentifier:i,asTextDocumentItem:s,asVersionedTextDocumentIdentifier:o,asOpenTextDocumentParams:a,asChangeTextDocumentParams:h,asCloseTextDocumentParams:p,asSaveTextDocumentParams:f,asWillSaveTextDocumentParams:g,asDidCreateFilesParams:v,asDidRenameFilesParams:_,asDidDeleteFilesParams:T,asWillCreateFilesParams:C,asWillRenameFilesParams:D,asWillDeleteFilesParams:F,asTextDocumentPositionParams:E,asCompletionParams:we,asSignatureHelpParams:Yr,asWorkerPosition:rn,asRange:he,asRanges:Qr,asPosition:Ct,asPositions:yn,asPositionsSync:Ri,asLocation:Kt,asDiagnosticSeverity:Wn,asDiagnosticTag:$n,asDiagnostic:_n,asDiagnostics:wn,asDiagnosticsSync:Bn,asCompletionItem:Wt,asTextEdit:zn,asSymbolKind:bt,asSymbolTag:Vn,asSymbolTags:Me,asReferenceParams:ns,asCodeAction:Ve,asCodeActionSync:bn,asCodeActionContext:is,asCodeActionContextSync:rs,asInlineValueContext:Ii,asCommand:$t,asCodeLens:ji,asFormattingOptions:Li,asDocumentSymbolParams:as,asCodeLensParams:Ni,asDocumentLink:cs,asDocumentLinkParams:Ui,asCallHierarchyItem:Ki,asTypeHierarchyItem:us,asInlayHint:ls,asWorkspaceSymbol:Yn,asInlineCompletionParams:ss,asInlineCompletionContext:Jn}}});var Qc=M(Qe=>{"use strict";var Tf=Qe&&Qe.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Of=Qe&&Qe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),nr=Qe&&Qe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Tf(t,e,n[i]);return Of(t,e),t}})(),Gt=Qe&&Qe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createConverter=Af;var O=nr(I("vscode")),A=nr(N()),Ae=nr(He()),z=nr(Zi()),Rf=Gt(Ms()),Ff=Gt(Es()),xf=Gt(Is()),Mf=Gt(js()),Jc=Us(),kf=Gt(Hs()),Ef=Gt($s()),qf=Gt(zs()),If=Gt(Gs()),Yc=N(),tr;(function(r){function e(t){let n=t;return n&&Ae.string(n.language)&&Ae.string(n.value)}r.is=e})(tr||(tr={}));function Af(r,e,t,n){let s=r||(c=>O.Uri.parse(c));function o(c){return s(c)}function a(c){let y=[];for(let b of c)if(typeof b=="string")y.push(b);else if(Yc.NotebookCellTextDocumentFilter.is(b))if(typeof b.notebook=="string")y.push({notebookType:b.notebook,language:b.language});else{let R=b.notebook.notebookType??"*";y.push({notebookType:R,scheme:b.notebook.scheme,pattern:ds(b.notebook.pattern),language:b.language})}else Yc.TextDocumentFilter.is(b)&&y.push({language:b.language,scheme:b.scheme,pattern:ds(b.pattern)});return y}async function u(c,y){return z.map(c,h,y)}function l(c){let y=new Array(c.length);for(let b=0;b<c.length;b++)y[b]=h(c[b]);return y}function h(c){let y=typeof c.message=="string"?c.message:c.message.kind==="plaintext"?c.message.value:"Received a markup diagnostic message but the client does not support it.",b=new Jc.ProtocolDiagnostic(v(c.range),y,T(c.severity),c.data);if(c.code!==void 0){if(typeof c.code=="string"||typeof c.code=="number")A.CodeDescription.is(c.codeDescription)?b.code={value:c.code,target:o(c.codeDescription.href)}:b.code=c.code;else if(Jc.DiagnosticCode.is(c.code)){b.hasDiagnosticCode=!0;let R=c.code;b.code={value:R.value,target:o(R.target)}}}return c.source&&(b.source=c.source),c.relatedInformation&&(b.relatedInformation=p(c.relatedInformation)),Array.isArray(c.tags)&&(b.tags=f(c.tags)),b}function p(c){let y=new Array(c.length);for(let b=0;b<c.length;b++){let R=c[b];y[b]=new O.DiagnosticRelatedInformation(Ht(R.location),R.message)}return y}function f(c){if(!c)return;let y=[];for(let b of c){let R=m(b);R!==void 0&&y.push(R)}return y.length>0?y:void 0}function m(c){switch(c){case A.DiagnosticTag.Unnecessary:return O.DiagnosticTag.Unnecessary;case A.DiagnosticTag.Deprecated:return O.DiagnosticTag.Deprecated;default:return}}function g(c){return c?new O.Position(c.line,c.character):void 0}function v(c){return c?new O.Range(c.start.line,c.start.character,c.end.line,c.end.character):void 0}async function _(c,y){return z.map(c,b=>new O.Range(b.start.line,b.start.character,b.end.line,b.end.character),y)}function T(c){if(c==null)return O.DiagnosticSeverity.Error;switch(c){case A.DiagnosticSeverity.Error:return O.DiagnosticSeverity.Error;case A.DiagnosticSeverity.Warning:return O.DiagnosticSeverity.Warning;case A.DiagnosticSeverity.Information:return O.DiagnosticSeverity.Information;case A.DiagnosticSeverity.Hint:return O.DiagnosticSeverity.Hint}return O.DiagnosticSeverity.Error}function C(c){if(Ae.string(c))return F(c);if(tr.is(c))return F().appendCodeblock(c.value,c.language);if(Array.isArray(c)){let y=[];for(let b of c){let R=F();tr.is(b)?R.appendCodeblock(b.value,b.language):R.appendMarkdown(b),y.push(R)}return y}else return F(c)}function D(c){if(Ae.string(c))return c;switch(c.kind){case A.MarkupKind.Markdown:return F(c.value);case A.MarkupKind.PlainText:return c.value;default:return`Unsupported Markup content received. Kind is: ${c.kind}`}}function F(c){let y;if(c===void 0||typeof c=="string")y=new O.MarkdownString(c);else switch(c.kind){case A.MarkupKind.Markdown:y=new O.MarkdownString(c.value);break;case A.MarkupKind.PlainText:y=new O.MarkdownString,y.appendText(c.value);break;default:y=new O.MarkdownString,y.appendText(`Unsupported Markup content received. Kind is: ${c.kind}`);break}return y.isTrusted=e,y.supportHtml=t,y.supportThemeIcons=n,y}function E(c){if(c)return new O.Hover(C(c.contents),v(c.range))}async function Q(c,y,b){if(!c)return;if(Array.isArray(c))return z.map(c,Dt=>Hn(Dt,y),b);let R=c,{defaultRange:oe,commitCharacters:fe}=we(R,y),X=await z.map(R.items,Dt=>Hn(Dt,fe,R.applyKind?.commitCharacters,oe,R.itemDefaults?.insertTextMode,R.itemDefaults?.insertTextFormat,R.itemDefaults?.data,R.applyKind?.data),b);return new O.CompletionList(X,R.isIncomplete)}function we(c,y){let b=c.itemDefaults?.editRange,R=c.itemDefaults?.commitCharacters??y;return A.Range.is(b)?{defaultRange:v(b),commitCharacters:R}:b!==void 0?{defaultRange:{inserting:v(b.insert),replacing:v(b.replace)},commitCharacters:R}:{defaultRange:void 0,commitCharacters:R}}function xe(c){return A.CompletionItemKind.Text<=c&&c<=A.CompletionItemKind.TypeParameter?[c-1,void 0]:[O.CompletionItemKind.Text,c]}function Kn(c){if(c===A.CompletionItemTag.Deprecated)return O.CompletionItemTag.Deprecated}function Vr(c){if(c==null)return[];let y=[];for(let b of c){let R=Kn(b);R!==void 0&&y.push(R)}return y}function Hn(c,y,b,R,oe,fe,X,Dt){let Bt=Vr(c.tags),Ue=Yr(c),pe=new Rf.default(Ue);c.detail&&(pe.detail=c.detail),c.documentation&&(pe.documentation=D(c.documentation),pe.documentationFormat=Ae.string(c.documentation)?"$string":c.documentation.kind),c.filterText&&(pe.filterText=c.filterText);let $i=rn(c,R,fe);if($i&&(pe.insertText=$i.text,pe.range=$i.range,pe.fromEdit=$i.fromEdit),Ae.number(c.kind)){let[ld,Tc]=xe(c.kind);pe.kind=ld,Tc&&(pe.originalItemKind=Tc)}c.sortText&&(pe.sortText=c.sortText),c.additionalTextEdits&&(pe.additionalTextEdits=he(c.additionalTextEdits));let Dc=Gr(c,y,b);Dc&&(pe.commitCharacters=Dc.slice()),c.command&&(pe.command=Me(c.command)),(c.deprecated===!0||c.deprecated===!1)&&(pe.deprecated=c.deprecated,c.deprecated===!0&&Bt.push(O.CompletionItemTag.Deprecated)),(c.preselect===!0||c.preselect===!1)&&(pe.preselect=c.preselect);let Pc=Jr(c,X,Dt);Pc!==void 0&&(pe.data=Pc),Bt.length>0&&(pe.tags=Bt);let hs=c.insertTextMode??oe;return hs!==void 0&&(pe.insertTextMode=hs,hs===A.InsertTextMode.asIs&&(pe.keepWhitespace=!0)),pe}function Gr(c,y,b){if(b===A.ApplyKind.Merge){if(!y&&!c.commitCharacters)return;let R=new Set;if(y)for(let oe of y)R.add(oe);if(Ae.stringArray(c.commitCharacters))for(let oe of c.commitCharacters)R.add(oe);return Array.from(R)}return c.commitCharacters!==void 0?Ae.stringArray(c.commitCharacters)?c.commitCharacters:void 0:y}function Jr(c,y,b){if(b===A.ApplyKind.Merge){let R={...y};return c.data&&Object.entries(c.data).forEach(([oe,fe])=>{fe!=null&&(R[oe]=fe)}),R}return c.data??y}function Yr(c){return A.CompletionItemLabelDetails.is(c.labelDetails)?{label:c.label,detail:c.labelDetails.detail,description:c.labelDetails.description}:c.label}function rn(c,y,b){let R=c.insertTextFormat??b;if(c.textEdit!==void 0||y!==void 0){let[oe,fe]=c.textEdit!==void 0?Ct(c.textEdit):[y,c.textEditText??c.label];return R===A.InsertTextFormat.Snippet?{text:new O.SnippetString(fe),range:oe,fromEdit:!0}:{text:fe,range:oe,fromEdit:!0}}else return c.insertText?R===A.InsertTextFormat.Snippet?{text:new O.SnippetString(c.insertText),fromEdit:!1}:{text:c.insertText,fromEdit:!1}:void 0}function Ct(c){return A.InsertReplaceEdit.is(c)?[{inserting:v(c.insert),replacing:v(c.replace)},c.newText]:[v(c.range),c.newText]}function yn(c){if(c)return new O.TextEdit(v(c.range),c.newText)}async function Ri(c,y){if(c)return z.map(c,yn,y)}function he(c){if(!c)return;let y=new Array(c.length);for(let b=0;b<c.length;b++)y[b]=yn(c[b]);return y}async function Qr(c,y){if(!c)return;let b=new O.SignatureHelp;return Ae.number(c.activeSignature)?b.activeSignature=c.activeSignature:b.activeSignature=0,Ae.number(c.activeParameter)?b.activeParameter=c.activeParameter:c.activeParameter===null?b.activeParameter=-1:b.activeParameter=0,c.signatures&&(b.signatures=await Kt(c.signatures,y)),b}async function Kt(c,y){return z.mapAsync(c,Wn,y)}async function Wn(c,y){let b=new O.SignatureInformation(c.label);return c.documentation!==void 0&&(b.documentation=D(c.documentation)),c.parameters!==void 0&&(b.parameters=await Fi(c.parameters,y)),c.activeParameter!==void 0&&(b.activeParameter=c.activeParameter??-1),b}function Fi(c,y){return z.map(c,$n,y)}function $n(c){let y=new O.ParameterInformation(c.label);return c.documentation&&(y.documentation=D(c.documentation)),y}function Ht(c){return c?new O.Location(s(c.uri),v(c.range)):void 0}async function Zr(c,y){if(c)return wn(c,y)}async function Xr(c,y){if(c)return wn(c,y)}function _n(c){if(!c)return;let y={targetUri:s(c.targetUri),targetRange:v(c.targetRange),originSelectionRange:v(c.originSelectionRange),targetSelectionRange:v(c.targetSelectionRange)};if(!y.targetSelectionRange)throw new Error("targetSelectionRange must not be undefined or null");return y}async function wn(c,y){if(c)if(Ae.array(c)){if(c.length===0)return[];if(A.LocationLink.is(c[0])){let b=c;return z.map(b,_n,y)}else{let b=c;return z.map(b,Ht,y)}}else return A.LocationLink.is(c)?[_n(c)]:Ht(c)}async function Bn(c,y){if(c)return z.map(c,Ht,y)}async function es(c,y){if(c)return z.map(c,xi,y)}function xi(c){let y=new O.DocumentHighlight(v(c.range));return Ae.number(c.kind)&&(y.kind=Mi(c.kind)),y}function Mi(c){switch(c){case A.DocumentHighlightKind.Text:return O.DocumentHighlightKind.Text;case A.DocumentHighlightKind.Read:return O.DocumentHighlightKind.Read;case A.DocumentHighlightKind.Write:return O.DocumentHighlightKind.Write}return O.DocumentHighlightKind.Text}async function ts(c,y){if(c)return z.map(c,zn,y)}function Wt(c){return c<=A.SymbolKind.TypeParameter?c-1:O.SymbolKind.Property}function ki(c){if(c===A.SymbolTag.Deprecated)return O.SymbolTag.Deprecated}function Cn(c){if(c==null)return;let y=[];for(let b of c){let R=ki(b);R!==void 0&&y.push(R)}return y.length===0?void 0:y}function zn(c){let y=c.data,b=c.location,R=b.range===void 0||y!==void 0?new qf.default(c.name,Wt(c.kind),c.containerName??"",b.range===void 0?s(b.uri):new O.Location(s(c.location.uri),v(b.range)),y):new O.SymbolInformation(c.name,Wt(c.kind),c.containerName??"",new O.Location(s(c.location.uri),v(b.range)));return Vn(R,c),R}async function Ei(c,y){if(c!=null)return z.map(c,bt,y)}function bt(c){let y=new O.DocumentSymbol(c.name,c.detail||"",Wt(c.kind),v(c.range),v(c.selectionRange));if(Vn(y,c),c.children!==void 0&&c.children.length>0){let b=[];for(let R of c.children)b.push(bt(R));y.children=b}return y}function Vn(c,y){c.tags=Cn(y.tags),y.deprecated&&(c.tags?c.tags.includes(O.SymbolTag.Deprecated)||(c.tags=c.tags.concat(O.SymbolTag.Deprecated)):c.tags=[O.SymbolTag.Deprecated])}function Me(c){let y={title:c.title,command:c.command};return c.tooltip&&(y.tooltip=c.tooltip),c.arguments&&(y.arguments=c.arguments),y}async function ns(c,y){if(c)return z.map(c,Me,y)}let Ve=new Map;Ve.set(A.CodeActionKind.Empty,O.CodeActionKind.Empty),Ve.set(A.CodeActionKind.QuickFix,O.CodeActionKind.QuickFix),Ve.set(A.CodeActionKind.Refactor,O.CodeActionKind.Refactor),Ve.set(A.CodeActionKind.RefactorExtract,O.CodeActionKind.RefactorExtract),Ve.set(A.CodeActionKind.RefactorInline,O.CodeActionKind.RefactorInline),Ve.set(A.CodeActionKind.RefactorRewrite,O.CodeActionKind.RefactorRewrite),Ve.set(A.CodeActionKind.Source,O.CodeActionKind.Source),Ve.set(A.CodeActionKind.SourceOrganizeImports,O.CodeActionKind.SourceOrganizeImports);function bn(c){if(c==null)return;let y=Ve.get(c);if(y)return y;let b=c.split(".");y=O.CodeActionKind.Empty;for(let R of b)y=y.append(R);return y}function is(c){if(c!=null)return c.map(y=>bn(y))}function rs(c){if(c!=null)return c.map(y=>({kind:bn(y.kind),command:Me(y.command)}))}async function Gn(c,y){if(c==null)return;let b=new Mf.default(c.title,c.data);return c.kind!==void 0&&(b.kind=bn(c.kind)),c.diagnostics!==void 0&&(b.diagnostics=l(c.diagnostics)),c.edit!==void 0&&(b.edit=await Jn(c.edit,y)),c.command!==void 0&&(b.command=Me(c.command)),c.isPreferred!==void 0&&(b.isPreferred=c.isPreferred),c.disabled!==void 0&&(b.disabled={reason:c.disabled.reason}),c.tags?.includes(A.CodeActionTag.LLMGenerated)&&(b.isAI=!0),b}function qi(c,y){return z.mapAsync(c,async b=>A.Command.is(b)?Me(b):Gn(b,y),y)}function Ii(c){if(!c)return;let y=new Ff.default(v(c.range));return c.command&&(y.command=Me(c.command)),c.data!==void 0&&c.data!==null&&(y.data=c.data),y}async function ss(c,y){if(c)return z.map(c,Ii,y)}async function Jn(c,y){if(!c)return;let b=new Map;if(c.changeAnnotations!==void 0){let fe=c.changeAnnotations;await z.forEach(Object.keys(fe),X=>{let Dt=os(fe[X]);b.set(X,Dt)},y)}let R=fe=>{if(fe!==void 0)return b.get(fe)},oe=new O.WorkspaceEdit;if(c.documentChanges){let fe=c.documentChanges;await z.forEach(fe,X=>{if(A.CreateFile.is(X))oe.createFile(s(X.uri),X.options,R(X.annotationId));else if(A.RenameFile.is(X))oe.renameFile(s(X.oldUri),s(X.newUri),X.options,R(X.annotationId));else if(A.DeleteFile.is(X))oe.deleteFile(s(X.uri),X.options,R(X.annotationId));else if(A.TextDocumentEdit.is(X)){let Dt=s(X.textDocument.uri),Bt=[];for(let Ue of X.edits)A.AnnotatedTextEdit.is(Ue)?Bt.push([new O.TextEdit(v(Ue.range),Ue.newText),R(Ue.annotationId)]):A.SnippetTextEdit.is(Ue)?Bt.push([new O.SnippetTextEdit(v(Ue.range),new O.SnippetString(Ue.snippet.value)),R(Ue.annotationId)]):Bt.push([new O.TextEdit(v(Ue.range),Ue.newText),void 0]);oe.set(Dt,Bt)}else throw new Error(`Unknown workspace edit change received:
8
- ${JSON.stringify(X,void 0,4)}`)},y)}else if(c.changes){let fe=c.changes;await z.forEach(Object.keys(fe),X=>{oe.set(s(X),he(fe[X]))},y)}return oe}function os(c){if(c!==void 0)return{label:c.label,needsConfirmation:!!c.needsConfirmation,description:c.description}}function Ai(c){let y=v(c.range),b=c.target?o(c.target):void 0,R=new xf.default(y,b);return c.tooltip!==void 0&&(R.tooltip=c.tooltip),c.data!==void 0&&c.data!==null&&(R.data=c.data),R}async function $t(c,y){if(c)return z.map(c,Ai,y)}function ji(c){return new O.Color(c.red,c.green,c.blue,c.alpha)}function Li(c){return new O.ColorInformation(v(c.range),ji(c.color))}async function as(c,y){if(c)return z.map(c,Li,y)}function Ni(c){let y=new O.ColorPresentation(c.label);return y.additionalTextEdits=he(c.additionalTextEdits),c.textEdit&&(y.textEdit=yn(c.textEdit)),y}async function cs(c,y){if(c)return z.map(c,Ni,y)}function Ui(c){if(c)switch(c){case A.FoldingRangeKind.Comment:return O.FoldingRangeKind.Comment;case A.FoldingRangeKind.Imports:return O.FoldingRangeKind.Imports;case A.FoldingRangeKind.Region:return O.FoldingRangeKind.Region}}function Ki(c){return new O.FoldingRange(c.startLine,c.endLine,Ui(c.kind))}async function us(c,y){if(c)return z.map(c,Ki,y)}function Yn(c){return new O.SelectionRange(v(c.range),c.parent?Yn(c.parent):void 0)}async function ls(c,y){return Array.isArray(c)?z.map(c,Yn,y):[]}function Hi(c){return A.InlineValueText.is(c)?new O.InlineValueText(v(c.range),c.text):A.InlineValueVariableLookup.is(c)?new O.InlineValueVariableLookup(v(c.range),c.variableName,c.caseSensitiveLookup):new O.InlineValueEvaluatableExpression(v(c.range),c.expression)}async function Wi(c,y){return Array.isArray(c)?z.map(c,Hi,y):[]}async function d(c,y){let b=typeof c.label=="string"?c.label:await z.map(c.label,w,y),R=new If.default(g(c.position),b);return c.kind!==void 0&&(R.kind=c.kind),c.textEdits!==void 0&&(R.textEdits=await Ri(c.textEdits,y)),c.tooltip!==void 0&&(R.tooltip=x(c.tooltip)),c.paddingLeft!==void 0&&(R.paddingLeft=c.paddingLeft),c.paddingRight!==void 0&&(R.paddingRight=c.paddingRight),c.data!==void 0&&(R.data=c.data),R}function w(c){let y=new O.InlayHintLabelPart(c.value);return c.location!==void 0&&(y.location=Ht(c.location)),c.tooltip!==void 0&&(y.tooltip=x(c.tooltip)),c.command!==void 0&&(y.command=Me(c.command)),y}function x(c){return typeof c=="string"?c:F(c)}async function Z(c,y){if(Array.isArray(c))return z.mapAsync(c,d,y)}function V(c){if(c===null)return;let y=new kf.default(Wt(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(y.tags=Cn(c.tags)),y}async function De(c,y){if(c!==null)return z.map(c,V,y)}async function ke(c,y){return new O.CallHierarchyIncomingCall(V(c.from),await _(c.fromRanges,y))}async function St(c,y){if(c!==null)return z.mapAsync(c,ke,y)}async function Cc(c,y){return new O.CallHierarchyOutgoingCall(V(c.to),await _(c.fromRanges,y))}async function nd(c,y){if(c!==null)return z.mapAsync(c,Cc,y)}async function id(c,y){if(c!=null)return new O.SemanticTokens(new Uint32Array(c.data),c.resultId)}function bc(c){return new O.SemanticTokensEdit(c.start,c.deleteCount,c.data!==void 0?new Uint32Array(c.data):void 0)}async function rd(c,y){if(c!=null)return new O.SemanticTokensEdits(c.edits.map(bc),c.resultId)}function sd(c){return c}async function od(c,y){if(c!=null)return new O.LinkedEditingRanges(await _(c.ranges,y),ad(c.wordPattern))}function ad(c){if(c!=null)return new RegExp(c)}function Sc(c){if(c===null)return;let y=new Ef.default(Wt(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(y.tags=Cn(c.tags)),y}async function cd(c,y){if(c!==null)return z.map(c,Sc,y)}function ds(c){if(Ae.string(c))return c;if(A.RelativePattern.is(c)){if(A.URI.is(c.baseUri))return new O.RelativePattern(o(c.baseUri),c.pattern);if(A.WorkspaceFolder.is(c.baseUri)){let y=O.workspace.getWorkspaceFolder(o(c.baseUri.uri));return y!==void 0?new O.RelativePattern(y,c.pattern):void 0}}}async function ud(c,y){if(!c)return;if(Array.isArray(c))return z.map(c,oe=>fs(oe),y);let b=c,R=await z.map(b.items,oe=>fs(oe),y);return new O.InlineCompletionList(R)}function fs(c){let y;typeof c.insertText=="string"?y=c.insertText:y=new O.SnippetString(c.insertText.value);let b;c.command&&(b=Me(c.command));let R=new O.InlineCompletionItem(y,v(c.range),b);return c.filterText&&(R.filterText=c.filterText),R}return{asUri:o,asDocumentSelector:a,asDiagnostics:u,asDiagnostic:h,asRange:v,asRanges:_,asPosition:g,asDiagnosticSeverity:T,asDiagnosticTag:m,asHover:E,asCompletionResult:Q,asCompletionItem:Hn,asTextEdit:yn,asTextEdits:Ri,asSignatureHelp:Qr,asSignatureInformations:Kt,asSignatureInformation:Wn,asParameterInformations:Fi,asParameterInformation:$n,asDeclarationResult:Zr,asDefinitionResult:Xr,asLocation:Ht,asReferences:Bn,asDocumentHighlights:es,asDocumentHighlight:xi,asDocumentHighlightKind:Mi,asSymbolKind:Wt,asSymbolTag:ki,asSymbolTags:Cn,asSymbolInformations:ts,asSymbolInformation:zn,asDocumentSymbols:Ei,asDocumentSymbol:bt,asCommand:Me,asCommands:ns,asCodeAction:Gn,asCodeActionKind:bn,asCodeActionKinds:is,asCodeActionDocumentations:rs,asCodeActionResult:qi,asCodeLens:Ii,asCodeLenses:ss,asWorkspaceEdit:Jn,asDocumentLink:Ai,asDocumentLinks:$t,asFoldingRangeKind:Ui,asFoldingRange:Ki,asFoldingRanges:us,asColor:ji,asColorInformation:Li,asColorInformations:as,asColorPresentation:Ni,asColorPresentations:cs,asSelectionRange:Yn,asSelectionRanges:ls,asInlineValue:Hi,asInlineValues:Wi,asInlayHint:d,asInlayHints:Z,asSemanticTokensLegend:sd,asSemanticTokens:id,asSemanticTokensEdit:bc,asSemanticTokensEdits:rd,asCallHierarchyItem:V,asCallHierarchyItems:De,asCallHierarchyIncomingCall:ke,asCallHierarchyIncomingCalls:St,asCallHierarchyOutgoingCall:Cc,asCallHierarchyOutgoingCalls:nd,asLinkedEditingRanges:od,asTypeHierarchyItem:Sc,asTypeHierarchyItems:cd,asGlobPattern:ds,asInlineCompletionResult:ud,asInlineCompletionItem:fs}}});var ne=M(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.empty=void 0;Jt.v4=Zc;Jt.isUUID=Xc;Jt.parse=Lf;Jt.generateUuid=Nf;var ri=class{_value;constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Ys=class r extends ri{static _chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];static _timeHighBits=["8","9","a","b"];static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return r._oneOf(r._chars)}constructor(){super([r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-","4",r._randomHex(),r._randomHex(),r._randomHex(),"-",r._oneOf(r._timeHighBits),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex()].join(""))}};Jt.empty=new ri("00000000-0000-0000-0000-000000000000");function Zc(){return new Ys}var jf=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Xc(r){return jf.test(r)}function Lf(r){if(!Xc(r))throw new Error("invalid uuid");return new ri(r)}function Nf(){return Zc().asHex()}});var Zs=M(it=>{"use strict";var Uf=it&&it.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Kf=it&&it.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Hf=it&&it.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Uf(t,e,n[i]);return Kf(t,e),t}})();Object.defineProperty(it,"__esModule",{value:!0});it.ProgressPart=void 0;var eu=I("vscode"),tu=N(),nu=Hf(He()),Qs=class{_client;_token;_infinite;_reported;_lspProgressDisposable;_progress;_cancellationToken;_tokenDisposable;_resolve;_reject;constructor(e,t,n){this._client=e,this._token=t,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(tu.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&&eu.window.withProgress({location:eu.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(tu.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(e),new Promise((i,s)=>{this._resolve=i,this._reject=s})})}report(e){if(this._infinite&&nu.string(e.message))this._progress!==void 0&&this._progress.report({message:e.message});else if(nu.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}};it.ProgressPart=Qs});var B=M(ae=>{"use strict";var Wf=ae&&ae.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),$f=ae&&ae.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ou=ae&&ae.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Wf(t,e,n[i]);return $f(t,e),t}})();Object.defineProperty(ae,"__esModule",{value:!0});ae.WorkspaceFeature=ae.TextDocumentLanguageFeature=ae.TextDocumentEventFeature=ae.DynamicDocumentFeature=ae.DynamicFeature=ae.StaticFeature=ae.LSPCancellationError=void 0;ae.ensure=Bf;var Yt=I("vscode"),Xs=N(),Fe=ou(He()),iu=ou(ne()),eo=class extends Yt.CancellationError{data;constructor(e){super(),this.data=e}};ae.LSPCancellationError=eo;function Bf(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var ru;(function(r){function e(t){let n=t;return n!=null&&Fe.func(n.fillClientCapabilities)&&Fe.func(n.initialize)&&Fe.func(n.getState)&&Fe.func(n.clear)&&(n.fillInitializeParams===void 0||Fe.func(n.fillInitializeParams))}r.is=e})(ru||(ae.StaticFeature=ru={}));var su;(function(r){function e(t){let n=t;return n!=null&&Fe.func(n.fillClientCapabilities)&&Fe.func(n.initialize)&&Fe.func(n.getState)&&Fe.func(n.clear)&&(n.fillInitializeParams===void 0||Fe.func(n.fillInitializeParams))&&Fe.func(n.register)&&Fe.func(n.unregister)&&n.registrationType!==void 0}r.is=e})(su||(ae.DynamicFeature=su={}));var si=class{_client;constructor(e){this._client=e}getState(){let e=this.getDocumentSelectors(),t=0;for(let i of e){t++;for(let s of Yt.workspace.textDocuments)if(Yt.languages.match(i,s)>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}}};ae.DynamicDocumentFeature=si;var to=class extends si{_event;_type;_middleware;_createParams;_textDocument;_selectorFilter;_listener;_selectors;_onNotificationSent;static textDocumentFilter(e,t){for(let n of e)if(Yt.languages.match(n,t)>0)return!0;return!1}constructor(e,t,n,i,s,o,a){super(e),this._event=t,this._type=n,this._middleware=i,this._createParams=s,this._textDocument=o,this._selectorFilter=a,this._selectors=new Map,this._onNotificationSent=new Yt.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._onNotificationSent=new Yt.EventEmitter,this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(e){for(let t of this._selectors.values())if(Yt.languages.match(t,e)>0)return{send:n=>this.callback(n)}}};ae.TextDocumentEventFeature=to;var no=class extends si{_registrationType;_registrations;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&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getRegistration(e,t){if(t){if(Xs.TextDocumentRegistrationOptions.is(t)){let n=Xs.StaticRegistrationOptions.hasId(t)?t.id:iu.generateUuid(),i=t.documentSelector??e;if(i)return[n,Object.assign({},t,{documentSelector:i})]}else if(Fe.boolean(t)&&t===!0||Xs.WorkDoneProgressOptions.is(t)){if(!e)return[void 0,void 0];let n=Fe.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e});return[iu.generateUuid(),n]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(e,t){if(!(!e||!t))return Fe.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&&Yt.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}};ae.TextDocumentLanguageFeature=no;var io=class{_client;_registrationType;_registrations;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&&(this._registrations.delete(e),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}};ae.WorkspaceFeature=io});var cu=M(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.range=cn.balanced=void 0;var zf=(r,e,t)=>{let n=r instanceof RegExp?au(r,t):r,i=e instanceof RegExp?au(e,t):e,s=n!==null&&i!=null&&(0,cn.range)(n,i,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+n.length,s[1]),post:t.slice(s[1]+i.length)}};cn.balanced=zf;var au=(r,e)=>{let t=e.match(r);return t?t[0]:null},Vf=(r,e,t)=>{let n,i,s,o,a,u=t.indexOf(r),l=t.indexOf(e,u+1),h=u;if(u>=0&&l>0){if(r===e)return[u,l];for(n=[],s=t.length;h>=0&&!a;){if(h===u)n.push(h),u=t.indexOf(r,h+1);else if(n.length===1){let p=n.pop();p!==void 0&&(a=[p,l])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=l),l=t.indexOf(e,h+1);h=u<l&&u>=0?u:l}n.length&&o!==void 0&&(a=[s,o])}return a};cn.range=Vf});var gu=M(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.EXPANSION_MAX=void 0;Tn.expand=oh;var uu=cu(),lu="\0SLASH"+Math.random()+"\0",du="\0OPEN"+Math.random()+"\0",so="\0CLOSE"+Math.random()+"\0",fu="\0COMMA"+Math.random()+"\0",hu="\0PERIOD"+Math.random()+"\0",Gf=new RegExp(lu,"g"),Jf=new RegExp(du,"g"),Yf=new RegExp(so,"g"),Qf=new RegExp(fu,"g"),Zf=new RegExp(hu,"g"),Xf=/\\\\/g,eh=/\\{/g,th=/\\}/g,nh=/\\,/g,ih=/\\\./g;Tn.EXPANSION_MAX=1e5;function ro(r){return isNaN(r)?r.charCodeAt(0):parseInt(r,10)}function rh(r){return r.replace(Xf,lu).replace(eh,du).replace(th,so).replace(nh,fu).replace(ih,hu)}function sh(r){return r.replace(Gf,"\\").replace(Jf,"{").replace(Yf,"}").replace(Qf,",").replace(Zf,".")}function pu(r){if(!r)return[""];let e=[],t=(0,uu.balanced)("{","}",r);if(!t)return r.split(",");let{pre:n,body:i,post:s}=t,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=pu(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function oh(r,e={}){if(!r)return[];let{max:t=Tn.EXPANSION_MAX}=e;return r.slice(0,2)==="{}"&&(r="\\{\\}"+r.slice(2)),oi(rh(r),t,!0).map(sh)}function ah(r){return"{"+r+"}"}function ch(r){return/^-?0\d/.test(r)}function uh(r,e){return r<=e}function lh(r,e){return r>=e}function oi(r,e,t){let n=[],i=(0,uu.balanced)("{","}",r);if(!i)return[r];let s=i.pre,o=i.post.length?oi(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let u=s+"{"+i.body+"}"+o[a];n.push(u)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=a||u,h=i.body.indexOf(",")>=0;if(!l&&!h)return i.post.match(/,(?!,).*\}/)?(r=i.pre+"{"+i.body+so+i.post,oi(r,e,!0)):[r];let p;if(l)p=i.body.split(/\.\./);else if(p=pu(i.body),p.length===1&&p[0]!==void 0&&(p=oi(p[0],e,!1).map(ah),p.length===1))return o.map(m=>i.pre+p[0]+m);let f;if(l&&p[0]!==void 0&&p[1]!==void 0){let m=ro(p[0]),g=ro(p[1]),v=Math.max(p[0].length,p[1].length),_=p.length===3&&p[2]!==void 0?Math.max(Math.abs(ro(p[2])),1):1,T=uh;g<m&&(_*=-1,T=lh);let D=p.some(ch);f=[];for(let F=m;T(F,g)&&f.length<e;F+=_){let E;if(u)E=String.fromCharCode(F),E==="\\"&&(E="");else if(E=String(F),D){let Q=v-E.length;if(Q>0){let we=new Array(Q+1).join("0");F<0?E="-"+we+E.slice(1):E=we+E}}f.push(E)}}else{f=[];for(let m=0;m<p.length;m++)f.push.apply(f,oi(p[m],e,!1))}for(let m=0;m<f.length;m++)for(let g=0;g<o.length&&n.length<e;g++){let v=s+f[m]+o[g];(!t||l||v)&&n.push(v)}}return n}});var mu=M(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.assertValidPattern=void 0;var dh=1024*64,fh=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>dh)throw new TypeError("pattern is too long")};ir.assertValidPattern=fh});var yu=M(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.parseClass=void 0;var hh={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},ai=r=>r.replace(/[[\]\\-]/g,"\\$&"),ph=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),vu=r=>r.join(""),gh=(r,e)=>{let t=e;if(r.charAt(t)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=t+1,o=!1,a=!1,u=!1,l=!1,h=t,p="";e:for(;s<r.length;){let v=r.charAt(s);if((v==="!"||v==="^")&&s===t+1){l=!0,s++;continue}if(v==="]"&&o&&!u){h=s+1;break}if(o=!0,v==="\\"&&!u){u=!0,s++;continue}if(v==="["&&!u){for(let[_,[T,C,D]]of Object.entries(hh))if(r.startsWith(_,s)){if(p)return["$.",!1,r.length-t,!0];s+=_.length,D?i.push(T):n.push(T),a=a||C;continue e}}if(u=!1,p){v>p?n.push(ai(p)+"-"+ai(v)):v===p&&n.push(ai(v)),p="",s++;continue}if(r.startsWith("-]",s+1)){n.push(ai(v+"-")),s+=2;continue}if(r.startsWith("-",s+1)){p=v,s+=2;continue}n.push(ai(v)),s++}if(h<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,r.length-t,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let v=n[0].length===2?n[0].slice(-1):n[0];return[ph(v),!1,h-t,!1]}let f="["+(l?"^":"")+vu(n)+"]",m="["+(l?"":"^")+vu(i)+"]";return[n.length&&i.length?"("+f+"|"+m+")":n.length?f:m,a,h-t,!0]};rr.parseClass=gh});var or=M(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.unescape=void 0;var mh=(r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?r.replace(/\[([^/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?r.replace(/\[([^/\\{}])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");sr.unescape=mh});var co=M(lr=>{"use strict";var Ee;Object.defineProperty(lr,"__esModule",{value:!0});lr.AST=void 0;var vh=yu(),ar=or(),yh=new Set(["!","?","+","*","@"]),oo=r=>yh.has(r),_u=r=>oo(r.type),_h=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),wh=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Ch=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),wu=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),bh="(?!(?:^|/)\\.\\.?(?:$|/))",cr="(?!\\.)",Sh=new Set(["[","."]),Dh=new Set(["..","."]),Ph=new Set("().*{}+?[]^$\\!"),Th=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ao="[^/]",Cu=ao+"*?",bu=ao+"+?",Oh=0,ur=class{type;#n;#i;#r=!1;#e=[];#t;#a;#u;#c=!1;#s;#o;#l=!1;id=++Oh;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,t,n={}){this.type=e,e&&(this.#i=!0),this.#t=t,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?n:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#o=this.#e.map(e=>String(e)).join("")}#v(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let t=e,n=t.#t;for(;n;){for(let i=t.#a+1;!n.type&&i<n.#e.length;i++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#e[i])}t=n,n=t.#t}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Ee&&t.#t===this))throw new Error("invalid part: "+t);this.#e.push(t)}}toJSON(){let e=this.type===null?this.#e.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#e.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let t=0;t<this.#a;t++){let n=e.#e[t];if(!(n instanceof Ee&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Ee(this.type,e);for(let n of this.#e)t.copyIn(n);return t}static#d(e,t,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,u=!1,l=-1,h=!1;if(t.type===null){let v=n,_="";for(;v<e.length;){let T=e.charAt(v++);if(a||T==="\\"){a=!a,_+=T;continue}if(u){v===l+1?(T==="^"||T==="!")&&(h=!0):T==="]"&&!(v===l+2&&h)&&(u=!1),_+=T;continue}else if(T==="["){u=!0,l=v,h=!1,_+=T;continue}if(!i.noext&&oo(T)&&e.charAt(v)==="("&&s<=o){t.push(_),_="";let D=new Ee(T,t);v=Ee.#d(e,D,v,i,s+1),t.push(D);continue}_+=T}return t.push(_),v}let p=n+1,f=new Ee(null,t),m=[],g="";for(;p<e.length;){let v=e.charAt(p++);if(a||v==="\\"){a=!a,g+=v;continue}if(u){p===l+1?(v==="^"||v==="!")&&(h=!0):v==="]"&&!(p===l+2&&h)&&(u=!1),g+=v;continue}else if(v==="["){u=!0,l=p,h=!1,g+=v;continue}if(!i.noext&&oo(v)&&e.charAt(p)==="("&&(s<=o||t&&t.#f(v))){let T=t&&t.#f(v)?0:1;f.push(g),g="";let C=new Ee(v,f);f.push(C),p=Ee.#d(e,C,p,i,s+T);continue}if(v==="|"){f.push(g),g="",m.push(f),f=new Ee(null,t);continue}if(v===")")return g===""&&t.#e.length===0&&(t.#l=!0),f.push(g),g="",t.push(...m,f),p;g+=v}return t.type=null,t.#i=void 0,t.#e=[e.substring(n-1)],p}#y(e){return this.#p(e,wh)}#p(e,t=_h){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#f(n.type,t)}#f(e,t=Ch){return!!t.get(this.type)?.includes(e)}#_(e,t){let n=e.#e[0],i=new Ee(null,n,this.options);i.#e.push(""),n.push(i),this.#g(e,t)}#g(e,t){let n=e.#e[0];this.#e.splice(t,1,...n.#e);for(let i of n.#e)typeof i=="object"&&(i.#t=this);this.#o=void 0}#w(e){return!!wu.get(this.type)?.has(e)}#C(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let t=e.#e[0];return!t||typeof t!="object"||t.type===null?!1:this.#w(t.type)}#b(e){let t=wu.get(this.type),n=e.#e[0],i=t?.get(n.type);if(!i)return!1;this.#e=n.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=i,this.#o=void 0,this.#l=!1}static fromGlob(e,t={}){let n=new Ee(null,void 0,t);return Ee.#d(e,n,0,t,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[t,n,i,s]=this.toRegExpSource();if(!(i||this.#i||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#n===this&&(this.#h(),this.#v()),!_u(this)){let u=this.isStart()&&this.isEnd()&&!this.#e.some(m=>typeof m!="string"),l=this.#e.map(m=>{let[g,v,_,T]=typeof m=="string"?Ee.#S(m,this.#i,u):m.toRegExpSource(e);return this.#i=this.#i||_,this.#r=this.#r||T,g}).join(""),h="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&Dh.has(this.#e[0]))){let g=Sh,v=t&&g.has(l.charAt(0))||l.startsWith("\\.")&&g.has(l.charAt(2))||l.startsWith("\\.\\.")&&g.has(l.charAt(4)),_=!t&&!e&&g.has(l.charAt(0));h=v?bh:_?cr:""}let p="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(p="(?:$|\\/)"),[h+l+p,(0,ar.unescape)(l),this.#i=!!this.#i,this.#r]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#m(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let u=this.toString(),l=this;return l.#e=[u],l.type=null,l.#i=void 0,[u,(0,ar.unescape)(this.toString()),!1,!1]}let o=!n||e||t||!cr?"":this.#m(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!t?cr:"")+bu;else{let u=this.type==="!"?"))"+(this.isStart()&&!t&&!e?cr:"")+Cu+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+u}return[a,(0,ar.unescape)(s),this.#i=!!this.#i,this.#r]}#h(){if(_u(this)){let e=0,t=!1;do{t=!0;for(let n=0;n<this.#e.length;n++){let i=this.#e[n];typeof i=="object"&&(i.#h(),this.#p(i)?(t=!1,this.#g(i,n)):this.#y(i)?(t=!1,this.#_(i,n)):this.#C(i)&&(t=!1,this.#b(i)))}}while(!t&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#h();this.#o=void 0}#m(e){return this.#e.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=t.toRegExpSource(e);return this.#r=this.#r||o,n}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#S(e,t,n=!1){let i=!1,s="",o=!1,a=!1;for(let u=0;u<e.length;u++){let l=e.charAt(u);if(i){i=!1,s+=(Ph.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(e)?bu:Cu,t=!0;continue}else a=!1;if(l==="\\"){u===e.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[h,p,f,m]=(0,vh.parseClass)(e,u);if(f){s+=h,o=o||p,u+=f-1,t=t||m;continue}}if(l==="?"){s+=ao,t=!0;continue}s+=Th(l)}return[s,(0,ar.unescape)(e),!!t,o]}};lr.AST=ur;Ee=ur});var uo=M(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.escape=void 0;var Rh=(r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?r.replace(/[?*()[\]{}]/g,"[$&]"):r.replace(/[?*()[\]\\{}]/g,"\\$&"):e?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&");dr.escape=Rh});var lo=M(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var Fh=gu(),fr=mu(),Pu=co(),xh=uo(),Mh=or(),kh=(r,e,t={})=>((0,fr.assertValidPattern)(e),!t.nocomment&&e.charAt(0)==="#"?!1:new un(e,t).match(r));k.minimatch=kh;var Eh=/^\*+([^+@!?*[(]*)$/,qh=r=>e=>!e.startsWith(".")&&e.endsWith(r),Ih=r=>e=>e.endsWith(r),Ah=r=>(r=r.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(r)),jh=r=>(r=r.toLowerCase(),e=>e.toLowerCase().endsWith(r)),Lh=/^\*+\.\*+$/,Nh=r=>!r.startsWith(".")&&r.includes("."),Uh=r=>r!=="."&&r!==".."&&r.includes("."),Kh=/^\.\*+$/,Hh=r=>r!=="."&&r!==".."&&r.startsWith("."),Wh=/^\*+$/,$h=r=>r.length!==0&&!r.startsWith("."),Bh=r=>r.length!==0&&r!=="."&&r!=="..",zh=/^\?+([^+@!?*[(]*)?$/,Vh=([r,e=""])=>{let t=Tu([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Gh=([r,e=""])=>{let t=Ou([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Jh=([r,e=""])=>{let t=Ou([r]);return e?n=>t(n)&&n.endsWith(e):t},Yh=([r,e=""])=>{let t=Tu([r]);return e?n=>t(n)&&n.endsWith(e):t},Tu=([r])=>{let e=r.length;return t=>t.length===e&&!t.startsWith(".")},Ou=([r])=>{let e=r.length;return t=>t.length===e&&t!=="."&&t!==".."},Ru=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Su={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=Ru==="win32"?Su.win32.sep:Su.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var Qh="[^/]",Zh=Qh+"*?",Xh="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ep="(?:(?!(?:\\/|^)\\.).)*?",tp=(r,e={})=>t=>(0,k.minimatch)(t,r,e);k.filter=tp;k.minimatch.filter=k.filter;var $e=(r,e={})=>Object.assign({},r,e),np=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return k.minimatch;let e=k.minimatch;return Object.assign((n,i,s={})=>e(n,i,$e(r,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,$e(r,s))}static defaults(i){return e.defaults($e(r,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,$e(r,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,$e(r,s))}},unescape:(n,i={})=>e.unescape(n,$e(r,i)),escape:(n,i={})=>e.escape(n,$e(r,i)),filter:(n,i={})=>e.filter(n,$e(r,i)),defaults:n=>e.defaults($e(r,n)),makeRe:(n,i={})=>e.makeRe(n,$e(r,i)),braceExpand:(n,i={})=>e.braceExpand(n,$e(r,i)),match:(n,i,s={})=>e.match(n,i,$e(r,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=np;k.minimatch.defaults=k.defaults;var ip=(r,e={})=>((0,fr.assertValidPattern)(r),e.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,Fh.expand)(r,{max:e.braceExpandMax}));k.braceExpand=ip;k.minimatch.braceExpand=k.braceExpand;var rp=(r,e={})=>new un(r,e).makeRe();k.makeRe=rp;k.minimatch.makeRe=k.makeRe;var sp=(r,e,t={})=>{let n=new un(e,t);return r=r.filter(i=>n.match(i)),n.options.nonull&&!r.length&&r.push(e),r};k.match=sp;k.minimatch.match=k.match;var Du=/[?*]|[+@!]\(.*?\)|\[|\]/,op=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),un=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){(0,fr.assertValidPattern)(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Ru,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let u=s[0]===""&&s[1]===""&&(s[2]==="?"||!Du.test(s[2]))&&!Du.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(u)return[...s.slice(0,4),...s.slice(4).map(h=>this.parse(h))];if(l)return[s[0],...s.slice(1).map(h=>this.parse(h))]}return s.map(u=>this.parse(u))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n of e)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let n=-1;for(;(n=t.indexOf("**",n+1))!==-1;){let i=n;for(;t[i+1]==="**";)i++;i!==n&&t.splice(n,i-n)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],u=n[i+2],l=n[i+3];if(a!==".."||!u||u==="."||u===".."||!l||l==="."||l==="..")continue;t=!0,n.splice(i,1);let h=n.slice(0);h[i]="**",e.push(h),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(t=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(t=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let u=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...u),n.length===0&&n.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let i=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(i){e[t]=[],e[n]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(a==="b"?t[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(n&&t[s]==="**"&&e[i]===t[s+1])o.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),u=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),h=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),p=u?3:a?0:void 0,f=h?3:l?0:void 0;if(typeof p=="number"&&typeof f=="number"){let[m,g]=[e[p],t[f]];m.toLowerCase()===g.toLowerCase()&&(t[f]=m,s=f,i=p)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(k.GLOBSTAR)?this.#n(e,t,n,i,s):this.#r(e,t,n,i,s)}#n(e,t,n,i,s){let o=t.indexOf(k.GLOBSTAR,s),a=t.lastIndexOf(k.GLOBSTAR),[u,l,h]=n?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,a),t.slice(a+1)];if(u.length){let C=e.slice(i,i+u.length);if(!this.#r(C,u,n,0,0))return!1;i+=u.length,s+=u.length}let p=0;if(h.length){if(h.length+i>e.length)return!1;let C=e.length-h.length;if(this.#r(e,h,n,C,0))p=h.length;else{if(e[e.length-1]!==""||i+h.length===e.length||(C--,!this.#r(e,h,n,C,0)))return!1;p=h.length+1}}if(!l.length){let C=!!p;for(let D=i;D<e.length-p;D++){let F=String(e[D]);if(C=!0,F==="."||F===".."||!this.options.dot&&F.startsWith("."))return!1}return n||C}let f=[[[],0]],m=f[0],g=0,v=[0];for(let C of l)C===k.GLOBSTAR?(v.push(g),m=[[],0],f.push(m)):(m[0].push(C),g++);let _=f.length-1,T=e.length-p;for(let C of f)C[1]=T-(v[_--]+C[0].length);return!!this.#i(e,f,i,0,n,0,!!p)}#i(e,t,n,i,s,o,a){let u=t[i];if(!u){for(let p=n;p<e.length;p++){a=!0;let f=e[p];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[l,h]=u;for(;n<=h;){if(this.#r(e.slice(0,n+l.length),l,s,n,0)&&o<this.maxGlobstarRecursion){let m=this.#i(e,t,n+l.length,i+1,s,o+1,a);if(m!==!1)return m}let f=e[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return s||null}#r(e,t,n,i,s){let o,a,u,l;for(o=i,a=s,l=e.length,u=t.length;o<l&&a<u;o++,a++){this.debug("matchOne loop");let h=t[a],p=e[o];if(this.debug(t,h,p),h===!1||h===k.GLOBSTAR)return!1;let f;if(typeof h=="string"?(f=p===h,this.debug("string match",h,p,f)):(f=h.test(p),this.debug("pattern match",h,p,f)),!f)return!1}if(o===l&&a===u)return!0;if(o===l)return n;if(a===u)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,fr.assertValidPattern)(e);let t=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let n,i=null;(n=e.match(Wh))?i=t.dot?Bh:$h:(n=e.match(Eh))?i=(t.nocase?t.dot?jh:Ah:t.dot?Ih:qh)(n[1]):(n=e.match(zh))?i=(t.nocase?t.dot?Gh:Vh:t.dot?Jh:Yh)(n):(n=e.match(Lh))?i=t.dot?Uh:Nh:(n=e.match(Kh))&&(i=Hh);let s=Pu.AST.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?Zh:t.dot?Xh:ep,i=new Set(t.nocase?["i"]:[]),s=e.map(u=>{let l=u.map(p=>{if(p instanceof RegExp)for(let f of p.flags.split(""))i.add(f);return typeof p=="string"?op(p):p===k.GLOBSTAR?k.GLOBSTAR:p._src});l.forEach((p,f)=>{let m=l[f+1],g=l[f-1];p!==k.GLOBSTAR||g===k.GLOBSTAR||(g===void 0?m!==void 0&&m!==k.GLOBSTAR?l[f+1]="(?:\\/|"+n+"\\/)?"+m:l[f]=n:m===void 0?l[f-1]=g+"(?:\\/|\\/"+n+")?":m!==k.GLOBSTAR&&(l[f-1]=g+"(?:\\/|\\/"+n+"\\/)"+m,l[f+1]=k.GLOBSTAR))});let h=l.filter(p=>p!==k.GLOBSTAR);if(this.partial&&h.length>=1){let p=[];for(let f=1;f<=h.length;f++)p.push(h.slice(0,f).join("/"));return"(?:"+p.join("|")+")"}return h.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let u=i;if(n.matchBase&&a.length===1&&(u=[o]),this.matchOne(u,a,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=un;var ap=co();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return ap.AST}});var cp=uo();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return cp.escape}});var up=or();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return up.unescape}});k.minimatch.AST=Pu.AST;k.minimatch.Minimatch=un;k.minimatch.escape=xh.escape;k.minimatch.unescape=Mh.unescape});var fo=M(qt=>{"use strict";var lp=qt&&qt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),dp=qt&&qt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),fp=qt&&qt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&lp(t,e,n[i]);return dp(t,e),t}})();Object.defineProperty(qt,"__esModule",{value:!0});qt.matchGlobPattern=gp;var hp=fp(lo()),pp=I("vscode");function gp(r,e){let t;if(typeof r=="string")t=r.replace(/\\/g,"/");else try{let i=pp.Uri.parse(typeof r.baseUri=="string"?r.baseUri:r.baseUri.uri);t=i.with({path:i.path+"/"+r.pattern}).fsPath.replace(/\\/g,"/")}catch{return!1}let n=new hp.Minimatch(t,{noext:!0});return n.makeRe()?n.match(e.fsPath):!1}});var _o=M(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.DiagnosticFeature=Qt.DiagnosticPullMode=Qt.vsdiag=void 0;var re=I("vscode"),ie=N(),mp=ne(),vp=fo(),ho=B();function hr(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var Be;(function(r){let e;(function(t){t.full="full",t.unChanged="unChanged"})(e=r.DocumentDiagnosticReportKind||(r.DocumentDiagnosticReportKind={}))})(Be||(Qt.vsdiag=Be={}));var ci;(function(r){r.onType="onType",r.onSave="onSave",r.onFocus="onFocus"})(ci||(Qt.DiagnosticPullMode=ci={}));var Ce;(function(r){r.active="open",r.reschedule="reschedule",r.outDated="drop"})(Ce||(Ce={}));var ge;(function(r){r[r.document=1]="document",r[r.workspace=2]="workspace"})(ge||(ge={}));var It;(function(r){function e(t){return t instanceof re.Uri?t.toString():t.uri.toString()}r.asKey=e})(It||(It={}));var po=class{documentPullStates;workspacePullStates;constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(e,t,n){let i=e===ge.document?this.documentPullStates:this.workspacePullStates,[s,o,a]=t instanceof re.Uri?[t.toString(),t,n]:[t.uri.toString(),t.uri,t.version],u=i.get(s);return u===void 0&&(u={document:o,pulledVersion:a,resultId:void 0},i.set(s,u)),u}update(e,t,n,i){let s=e===ge.document?this.documentPullStates:this.workspacePullStates,[o,a,u,l]=t instanceof re.Uri?[t.toString(),t,n,i]:[t.uri.toString(),t.uri,t.version,n],h=s.get(o);h===void 0?(h={document:a,pulledVersion:u,resultId:l},s.set(o,h)):(h.pulledVersion=u,h.resultId=l)}unTrack(e,t){let n=It.asKey(t);(e===ge.document?this.documentPullStates:this.workspacePullStates).delete(n)}tracks(e,t){let n=It.asKey(t);return(e===ge.document?this.documentPullStates:this.workspacePullStates).has(n)}tracksSameVersion(e,t){let n=t.uri.toString(),s=(e===ge.document?this.documentPullStates:this.workspacePullStates).get(n);return s!==void 0&&s.pulledVersion===t.version}getResultId(e,t){let n=It.asKey(t);return(e===ge.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}},go=class{isDisposed;client;visibleDocuments;options;onDidChangeDiagnosticsEmitter;provider;diagnostics;openRequests;documentStates;workspaceErrorCounter;workspaceCancellation;workspaceTimeout;constructor(e,t,n){this.client=e,this.visibleDocuments=t,this.options=n,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new re.EventEmitter,this.provider=this.createProvider(),this.diagnostics=re.languages.createDiagnosticCollection(n.identifier),this.openRequests=new Map,this.documentStates=new po,this.workspaceErrorCounter=0}knows(e,t){let n=t instanceof re.Uri?t:t.uri;return this.documentStates.tracks(e,t)||this.openRequests.has(n.toString())}knowsSameVersion(e,t){let n=this.openRequests.get(t.uri.toString());return n===void 0?this.documentStates.tracksSameVersion(e,t):n.state===Ce.reschedule?!0:n.state===Ce.outDated?!1:n.version===t.version}forget(e,t){this.documentStates.unTrack(e,t)}pull(e,t){if(this.isDisposed)return;let n=e instanceof re.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 re.Uri,i=n?e:e.uri,s=i.toString();t=n?t:e.version;let o=this.openRequests.get(s),a=n?this.documentStates.track(ge.document,e,t):this.documentStates.track(ge.document,e);if(o===void 0){let u=new re.CancellationTokenSource;this.openRequests.set(s,{state:Ce.active,document:e,version:t,tokenSource:u});let l,h;try{l=await this.provider.provideDiagnostics(e,a.resultId,u.token)??{kind:Be.DocumentDiagnosticReportKind.full,items:[]}}catch(p){if(p instanceof ho.LSPCancellationError&&ie.DiagnosticServerCancellationData.is(p.data)&&p.data.retriggerRequest===!1&&(h={state:Ce.outDated,document:e}),h===void 0&&p instanceof re.CancellationError)h={state:Ce.reschedule,document:e};else throw p}if(h=h??this.openRequests.get(s),h===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${s}`),this.diagnostics.delete(i);return}if(this.openRequests.delete(s),!this.visibleDocuments.isVisible(e)){this.documentStates.unTrack(ge.document,e);return}if(h.state===Ce.outDated)return;l!==void 0&&(l.kind===Be.DocumentDiagnosticReportKind.full&&this.diagnostics.set(i,l.items),a.pulledVersion=t,a.resultId=l.resultId),h.state===Ce.reschedule&&this.pull(e)}else o.state===Ce.active?(o.tokenSource.cancel(),this.openRequests.set(s,{state:Ce.reschedule,document:o.document})):o.state===Ce.outDated&&this.openRequests.set(s,{state:Ce.reschedule,document:o.document})}forgetDocument(e){if(this.isDisposed)return;let t=e instanceof re.Uri?e:e.uri,n=t.toString(),i=this.openRequests.get(n);this.options.workspaceDiagnostics&&t.scheme!=="untitled"?(i!==void 0?this.openRequests.set(n,{state:Ce.reschedule,document:e}):this.pull(e,()=>{this.forget(ge.document,e)}),this.forget(ge.workspace,e)):(i!==void 0&&(i.state===Ce.active&&i.tokenSource.cancel(),this.openRequests.set(n,{state:Ce.outDated,document:e})),this.diagnostics.delete(t),this.forget(ge.document,e))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,ie.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},e=>{!(e instanceof ho.LSPCancellationError)&&!ie.DiagnosticServerCancellationData.is(e.data)&&(this.client.error("Workspace diagnostic pull failed.",e,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,ie.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 re.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===Be.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(ge.document,n.uri)||this.diagnostics.set(n.uri,n.items)),this.documentStates.update(ge.workspace,n.uri,n.version??void 0,n.resultId)})}createProvider(){let e={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(t,n,i)=>{let s=(a,u,l)=>{let h={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(a instanceof re.Uri?a:a.uri)},previousResultId:u};return this.isDisposed===!0||!this.client.isRunning()?{kind:Be.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(ie.DocumentDiagnosticRequest.type,h,l).then(async p=>p==null||this.isDisposed||l.isCancellationRequested?{kind:Be.DocumentDiagnosticReportKind.full,items:[]}:p.kind===ie.DocumentDiagnosticReportKind.Full?{kind:Be.DocumentDiagnosticReportKind.full,resultId:p.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(p.items,l)}:{kind:Be.DocumentDiagnosticReportKind.unChanged,resultId:p.resultId},p=>this.client.handleFailedRequest(ie.DocumentDiagnosticRequest.type,l,p,{kind:Be.DocumentDiagnosticReportKind.full,items:[]},!0,!0))},o=this.client.middleware;return o.provideDiagnostics?o.provideDiagnostics(t,n,i,s):s(t,n,i)}};return this.options.workspaceDiagnostics&&(e.provideWorkspaceDiagnostics=(t,n,i)=>{let s=async l=>l.kind===ie.DocumentDiagnosticReportKind.Full?{kind:Be.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:Be.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version},o=l=>{let h=[];for(let p of l)h.push({uri:this.client.code2ProtocolConverter.asUri(p.uri),value:p.value});return h},a=(l,h,p)=>{let f=(0,mp.generateUuid)(),m=this.client.onProgress(ie.WorkspaceDiagnosticRequest.partialResult,f,async v=>{if(v==null){p(null);return}let _={items:[]};for(let T of v.items)try{_.items.push(await s(T))}catch(C){this.client.error("Converting workspace diagnostics failed.",C)}p(_)}),g={identifier:this.options.identifier,previousResultIds:o(l),partialResultToken:f};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(ie.WorkspaceDiagnosticRequest.type,g,h).then(async v=>{if(h.isCancellationRequested)return{items:[]};let _={items:[]};for(let T of v.items)_.items.push(await s(T));return m.dispose(),p(_),{items:[]}},v=>(m.dispose(),this.client.handleFailedRequest(ie.DocumentDiagnosticRequest.type,h,v,{items:[]})))},u=this.client.middleware;return u.provideWorkspaceDiagnostics?u.provideWorkspaceDiagnostics(t,n,i,a):a(t,n,i)}),e}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(let[e,t]of this.openRequests)t.state===Ce.active&&t.tokenSource.cancel(),this.openRequests.set(e,{state:Ce.outDated,document:t.document});this.diagnostics.dispose()}},mo=class{client;diagnosticRequestor;lastDocumentToPull;documents;timeoutHandle;isDisposed;constructor(e,t){this.client=e,this.diagnosticRequestor=t,this.documents=new ie.LinkedMap,this.isDisposed=!1}add(e){if(this.isDisposed===!0)return;let t=It.asKey(e);this.documents.has(t)||(this.documents.set(t,e,ie.Touch.Last),this.lastDocumentToPull=e)}remove(e){let t=It.asKey(e);if(this.documents.delete(t),this.documents.size===0){this.stop();return}else if(t===this.lastDocumentToPullKey()){let n=this.documents.before(t);n===void 0?this.stop():this.lastDocumentToPull=n}}trigger(){this.lastDocumentToPull=this.documents.last,this.runLoop()}runLoop(){if(this.isDisposed!==!0){if(this.documents.size===0){this.stop();return}this.lastDocumentToPull!==void 0&&this.timeoutHandle===void 0&&(this.timeoutHandle=(0,ie.RAL)().timer.setTimeout(()=>{let e=this.documents.first;if(e===void 0)return;let t=It.asKey(e);this.diagnosticRequestor.pullAsync(e).catch(n=>{this.client.error(`Document pull failed for text document ${t}`,n,!1)}).finally(()=>{this.timeoutHandle=void 0,this.documents.set(t,e,ie.Touch.Last),t!==this.lastDocumentToPullKey()&&this.runLoop()})},500))}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear(),this.lastDocumentToPull=void 0}stop(){this.timeoutHandle?.dispose(),this.timeoutHandle=void 0,this.lastDocumentToPull=void 0}lastDocumentToPullKey(){return this.lastDocumentToPull!==void 0?It.asKey(this.lastDocumentToPull):void 0}},vo=class{disposable;diagnosticRequestor;activeTextDocument;backgroundScheduler;constructor(e,t,n){let i=Object.assign({onChange:!1,onSave:!1,onFocus:!1},e.clientOptions.diagnosticPullOptions),s=e.protocol2CodeConverter.asDocumentSelector(n.documentSelector),o=[],a=(C,D)=>!(typeof C=="string"||C.language!==void 0&&C.language!=="*"||C.scheme!==void 0&&C.scheme!=="*"&&C.scheme!==D.scheme||C.pattern!==void 0&&!(0,vp.matchGlobPattern)(C.pattern,D)),u=C=>{let D=n.documentSelector;if(i.match!==void 0)return i.match(D,C);for(let F of D)if(ie.TextDocumentFilter.is(F)&&a(F,C))return!0;return!1},l=C=>C instanceof re.Uri?u(C):re.languages.match(s,C)>0&&t.isVisible(C),h=C=>re.languages.match(s,C.document)>0&&t.isVisible(C.notebook.uri),p=C=>C instanceof re.Uri?this.activeTextDocument?.uri.toString()===C.toString():this.activeTextDocument===C;this.diagnosticRequestor=new go(e,t,n),this.backgroundScheduler=new mo(e,this.diagnosticRequestor);let f=C=>{!l(C)||!n.interFileDependencies||p(C)||i.onChange===!1||this.backgroundScheduler.add(C)},m=(C,D)=>(i.filter===void 0||!i.filter(C,D))&&this.diagnosticRequestor.knows(ge.document,C);this.activeTextDocument=re.window.activeTextEditor?.document,o.push(re.window.onDidChangeActiveTextEditor(C=>{let D=this.activeTextDocument;this.activeTextDocument=C?.document,D!==void 0&&f(D),this.activeTextDocument!==void 0&&(this.backgroundScheduler.remove(this.activeTextDocument),i.onFocus===!0&&l(this.activeTextDocument)&&m(this.activeTextDocument,ci.onFocus)&&this.diagnosticRequestor.pull(this.activeTextDocument))}));let g=e.getFeature(ie.DidOpenTextDocumentNotification.method);o.push(g.onNotificationSent(C=>{let D=C.textDocument;this.diagnosticRequestor.knowsSameVersion(ge.document,D)||l(D)&&this.diagnosticRequestor.pull(D,()=>{f(D)})}));let v=e.getFeature(ie.NotebookDocumentSyncRegistrationType.method);o.push(v.onOpenNotificationSent(C=>{for(let D of C.getCells())h(D)&&this.diagnosticRequestor.pull(D.document,()=>{f(D.document)})})),o.push(t.onOpen(C=>{for(let D of C){if(this.diagnosticRequestor.knows(ge.document,D))continue;let F=D.toString(),E;for(let Q of re.workspace.textDocuments)if(F===Q.uri.toString()){E=Q;break}E!==void 0&&l(E)&&this.diagnosticRequestor.pull(E,()=>{f(E)})}}));let _=new Set;for(let C of re.workspace.textDocuments)l(C)&&(this.diagnosticRequestor.pull(C,()=>{f(C)}),_.add(C.uri.toString()));for(let C of re.workspace.notebookDocuments)for(let D of C.getCells())h(D)&&(this.diagnosticRequestor.pull(D.document,()=>{f(D.document)}),_.add(D.document.uri.toString()));if(i.onTabs===!0)for(let C of t.getResources())!_.has(C.toString())&&l(C)&&this.diagnosticRequestor.pull(C,()=>{f(C)});if(i.onChange===!0){let C=e.getFeature(ie.DidChangeTextDocumentNotification.method);o.push(C.onNotificationSent(async D=>{let F=D.textDocument;m(F,ci.onType)&&this.diagnosticRequestor.pull(F,()=>{this.backgroundScheduler.trigger()})})),o.push(v.onChangeNotificationSent(async D=>{let E=(D.cells?.textContent||[]).map(xe=>D.notebook.getCells().find(Kn=>Kn.document.uri.toString()===xe.document.uri.toString()));for(let xe of E)xe&&h(xe)&&this.diagnosticRequestor.pull(xe.document,()=>{this.backgroundScheduler.trigger()});let Q=D.cells?.structure?.didClose||[];for(let xe of Q)this.diagnosticRequestor.forgetDocument(xe.document);let we=D.cells?.structure?.didOpen||[];for(let xe of we)h(xe)&&this.diagnosticRequestor.pull(xe.document,()=>{this.backgroundScheduler.trigger()})}))}if(i.onSave===!0){let C=e.getFeature(ie.DidSaveTextDocumentNotification.method);o.push(C.onNotificationSent(D=>{let F=D.textDocument;m(F,ci.onSave)&&this.diagnosticRequestor.pull(D.textDocument)})),o.push(v.onSaveNotificationSent(D=>{for(let F of D.getCells())h(F)&&this.diagnosticRequestor.pull(F.document)}))}let T=e.getFeature(ie.DidCloseTextDocumentNotification.method);o.push(T.onNotificationSent(C=>{this.cleanUpDocument(C.textDocument)})),o.push(v.onCloseNotificationSent(C=>{for(let D of C.getCells())this.cleanUpDocument(D.document)})),o.push(t.onClose(C=>{for(let D of C)this.cleanUpDocument(D)})),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(let C of re.workspace.textDocuments)l(C)&&this.diagnosticRequestor.pull(C)}),n.workspaceDiagnostics===!0&&n.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=re.Disposable.from(...o,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}forget(e){this.cleanUpDocument(e)}cleanUpDocument(e){this.backgroundScheduler.remove(e),this.diagnosticRequestor.knows(ge.document,e)&&this.diagnosticRequestor.forgetDocument(e)}},yo=class extends ho.TextDocumentLanguageFeature{constructor(e){super(e,ie.DocumentDiagnosticRequest.type)}fillClientCapabilities(e){let t=hr(hr(e,"textDocument"),"diagnostic");t.relatedInformation=!0,t.tagSupport={valueSet:[ie.DiagnosticTag.Unnecessary,ie.DiagnosticTag.Deprecated]},t.codeDescriptionSupport=!0,t.dataSupport=!0,t.dynamicRegistration=!0,t.relatedDocumentSupport=!1,t.markupMessageSupport=!1,hr(hr(e,"workspace"),"diagnostics").refreshSupport=!0}initialize(e,t){this._client.onRequest(ie.DiagnosticRefreshRequest.type,async()=>{for(let o of this.getAllProviders())o.onDidChangeDiagnosticsEmitter.fire()});let[i,s]=this.getRegistration(t,e.diagnosticProvider);!i||!s||this.register({id:i,registerOptions:s})}clear(){super.clear()}refresh(){for(let e of this.getAllProviders())e.onDidChangeDiagnosticsEmitter.fire()}registerLanguageProvider(e){let t=new vo(this._client,this._client.visibleDocuments,e);return[t.disposable,t]}};Qt.DiagnosticFeature=yo});var Mu=M(rt=>{"use strict";var yp=rt&&rt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),_p=rt&&rt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),vr=rt&&rt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&yp(t,e,n[i]);return _p(t,e),t}})();Object.defineProperty(rt,"__esModule",{value:!0});rt.NotebookDocumentSyncFeature=void 0;var se=vr(I("vscode")),At=vr(N()),wp=vr(ne()),Fu=vr(He()),Cp=fo();function xu(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var On;(function(r){let e;(function(t){function n(f,m){return{version:f.version,uri:m.asUri(f.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function i(f,m,g){let v=At.NotebookDocument.create(g.asUri(f.uri),f.notebookType,f.version,s(m,g));return Object.keys(f.metadata).length>0&&(v.metadata=o(f.metadata)),v}t.asNotebookDocument=i;function s(f,m){return f.map(g=>a(g,m))}t.asNotebookCells=s;function o(f){return l(new Set,f)}t.asMetadata=o;function a(f,m){let g=At.NotebookCell.create(u(f.kind),m.asUri(f.document.uri));return Object.keys(f.metadata).length>0&&(g.metadata=o(f.metadata)),f.executionSummary!==void 0&&Fu.number(f.executionSummary.executionOrder)&&Fu.boolean(f.executionSummary.success)&&(g.executionSummary={executionOrder:f.executionSummary.executionOrder,success:f.executionSummary.success}),g}t.asNotebookCell=a;function u(f){switch(f){case se.NotebookCellKind.Markup:return At.NotebookCellKind.Markup;case se.NotebookCellKind.Code:return At.NotebookCellKind.Code}}function l(f,m){if(f.has(m))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(m)){let g=[];for(let v of m)if(v!==null&&typeof v=="object"||Array.isArray(v))g.push(l(f,v));else{if(v instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");g.push(v)}return g}else{let g=Object.keys(m),v=Object.create(null);for(let _ of g){let T=m[_];if(T!==null&&typeof T=="object"||Array.isArray(T))v[_]=l(f,T);else{if(T instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");v[_]=T}}return v}}function h(f,m){let g=m.asChangeTextDocumentParams(f,f.document.uri,f.document.version);return{document:g.textDocument,changes:g.contentChanges}}t.asTextContentChange=h;function p(f,m){let g=Object.create(null);if(f.metadata&&(g.metadata=r.c2p.asMetadata(f.metadata)),f.cells!==void 0){let v=Object.create(null),_=f.cells;_.structure&&(v.structure={array:{start:_.structure.array.start,deleteCount:_.structure.array.deleteCount,cells:_.structure.array.cells!==void 0?_.structure.array.cells.map(T=>r.c2p.asNotebookCell(T,m)):void 0},didOpen:_.structure.didOpen!==void 0?_.structure.didOpen.map(T=>m.asOpenTextDocumentParams(T.document).textDocument):void 0,didClose:_.structure.didClose!==void 0?_.structure.didClose.map(T=>m.asCloseTextDocumentParams(T.document).textDocument):void 0}),_.data!==void 0&&(v.data=_.data.map(T=>r.c2p.asNotebookCell(T,m))),_.textContent!==void 0&&(v.textContent=_.textContent.map(T=>r.c2p.asTextContentChange(T,m))),Object.keys(v).length>0&&(g.cells=v)}return g}t.asNotebookDocumentChangeEvent=p})(e=r.c2p||(r.c2p={}))})(On||(On={}));var wo;(function(r){function e(a,u,l){let h=a.length,p=u.length,f=0;for(;f<p&&f<h&&t(a[f],u[f],l);)f++;if(f<p&&f<h){let m=h-1,g=p-1;for(;m>=0&&g>=0&&t(a[m],u[g],l);)m--,g--;let v=m+1-f,_=f===g+1?void 0:u.slice(f,g+1);return _!==void 0?{start:f,deleteCount:v,cells:_}:{start:f,deleteCount:v}}else return f<p?{start:f,deleteCount:0,cells:u.slice(f)}:f<h?{start:f,deleteCount:h-f}:void 0}r.computeDiff=e;function t(a,u,l=!0){return a.kind!==u.kind||a.document.uri.toString()!==u.document.uri.toString()||a.document.languageId!==u.document.languageId||!n(a.executionSummary,u.executionSummary)?!1:!l||l&&s(a.metadata,u.metadata)}function n(a,u){return a===u?!0:a===void 0||u===void 0?!1:a.executionOrder===u.executionOrder&&a.success===u.success&&i(a.timing,u.timing)}function i(a,u){return a===u?!0:a===void 0||u===void 0?!1:a.startTime===u.startTime&&a.endTime===u.endTime}function s(a,u){if(a===u)return!0;if(a==null||u===null||u===void 0||typeof a!=typeof u||typeof a!="object")return!1;let l=Array.isArray(a),h=Array.isArray(u);if(l!==h)return!1;if(l&&h){if(a.length!==u.length)return!1;for(let p=0;p<a.length;p++)if(!s(a[p],u[p]))return!1}if(o(a)&&o(u)){let p=Object.keys(a),f=Object.keys(u);if(p.length!==f.length||(p.sort(),f.sort(),!s(p,f)))return!1;for(let m=0;m<p.length;m++){let g=p[m];if(!s(a[g],u[g]))return!1}return!0}return!1}function o(a){return a!==null&&typeof a=="object"}r.isObjectLiteral=o})(wo||(wo={}));var pr;(function(r){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;return!(t.scheme!==void 0&&t.scheme!=="*"&&i.scheme!==t.scheme||t.pattern!==void 0&&!(0,Cp.matchGlobPattern)(t.pattern,i))}r.matchNotebook=e})(pr||(pr={}));var gr;(function(r){function e(n){let i=n.notebookSelector,s=[];for(let o of i){let a=(typeof o.notebook=="string"?o.notebook:o.notebook?.notebookType)??"*",u=typeof o.notebook=="string"?void 0:o.notebook?.scheme,l=typeof o.notebook=="string"?void 0:o.notebook?.pattern;if(o.cells!==void 0)for(let h of o.cells)s.push(t(a,u,l,h.language));else s.push(t(a,u,l,void 0))}return s}r.asDocumentSelector=e;function t(n,i,s,o){return i===void 0&&s===void 0?{notebook:n,language:o}:{notebook:{notebookType:n,scheme:i,pattern:s},language:o}}})(gr||(gr={}));var mr;(function(r){function e(t){return{cells:t,uris:new Set(t.map(n=>n.document.uri.toString()))}}r.create=e})(mr||(mr={}));var Rn=class{client;options;notebookSyncInfo;notebookDidOpen;disposables;selector;onChangeNotificationSent;onOpenNotificationSent;onCloseNotificationSent;onSaveNotificationSent;constructor(e,t,n,i,s,o){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(gr.asDocumentSelector(t)),this.onChangeNotificationSent=n,this.onOpenNotificationSent=i,this.onCloseNotificationSent=s,this.onSaveNotificationSent=o,se.workspace.onDidOpenNotebookDocument(a=>{this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a)},void 0,this.disposables);for(let a of se.workspace.notebookDocuments)this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a);se.workspace.onDidChangeNotebookDocument(a=>this.didChangeNotebookDocument(a),void 0,this.disposables),this.options.save===!0&&se.workspace.onDidSaveNotebookDocument(a=>this.didSave(a),void 0,this.disposables),se.workspace.onDidCloseNotebookDocument(a=>{this.didClose(a),this.notebookDidOpen.delete(a.uri.toString())},void 0,this.disposables)}getState(){for(let e of se.workspace.notebookDocuments)if(this.getMatchingCellsConsideringSyncInfo(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){if(se.languages.match(this.selector,e)>0)return!0;let t=e.uri.toString();for(let n of this.notebookSyncInfo.values())if(n.uris.has(t))return!0;return!1}didOpenNotebookCellTextDocument(e,t){if(se.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let n=this.getSyncInfo(e),i=this.cellMatches(e,t);if(n!==void 0){let s=n.uris.has(t.document.uri.toString());if(i&&s||!i&&!s)return;if(i){let o=this.mergeCells(e,n,[t]);if(o!==void 0){let a=this.asNotebookDocumentChangeEvent(e,void 0,n,o);a!==void 0&&this.doSendChange(a,o).catch(()=>{})}}}else i&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t,n){if(se.languages.match(this.selector,n.document)===0)return;let i=this.getSyncInfo(e);i===void 0||!i.uris.has(t.document.uri.toString())||this.doSendChange({notebook:e,cells:{textContent:[n]}},i.cells).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let n=this.getSyncInfo(e);if(n===void 0)return;let i=t.document.uri,s=n.cells.findIndex(o=>o.document.uri.toString()===i.toString());if(s!==-1)if(s===0&&n.cells.length===1)this.doSendClose(e,n.cells).catch(()=>{});else{let o=n.cells.slice(),a=o.splice(s,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:s,deleteCount:1},didClose:a}}},o).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t,n=this.getSyncInfo(e)){if(n!==void 0)if(t===void 0&&(t=n.cells.slice()),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=this.getMatchingCells(e),t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,n=this.getSyncInfo(t);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.getMatchingCellsFromEvent(t,n,e);if(i===void 0){this.didClose(t,n);return}let s=this.asNotebookDocumentChangeEvent(e.notebook,e,n,i);s!==void 0&&this.doSendChange(s,i).catch(()=>{})}}didSave(e){this.getSyncInfo(e)!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.getSyncInfo(e)){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){if(this.getSyncInfo(e)!==void 0)throw new Error(`Notebook document ${e.uri.toString()} is already open`);let n=this.getMatchingCells(e);if(n!==void 0)return this.doSendOpen(e,n)}async doSendOpen(e,t){let n=async(s,o)=>{let a=o.map(u=>this.client.code2ProtocolConverter.asTextDocumentItem(u.document));try{await this.client.sendNotification(At.DidOpenNotebookDocumentNotification.type,{notebookDocument:On.c2p.asNotebookDocument(s,o,this.client.code2ProtocolConverter),cellTextDocuments:a}),this.onOpenNotificationSent.fire(s)}catch(u){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",u),u}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),mr.create(t)),i?.didOpen!==void 0?i.didOpen(e,t,n):n(e,t)}async sendDidChangeNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e.notebook);if(t===void 0)throw new Error(`Received changed event for un-synced notebook ${e.notebook.uri.toString()}`);return this.doSendChange(e,t)}async doSendChange(e,t){let n=async s=>{try{await this.client.sendNotification(At.DidChangeNotebookDocumentNotification.type,{notebookDocument:On.c2p.asVersionedNotebookDocumentIdentifier(s.notebook,this.client.code2ProtocolConverter),change:On.c2p.asNotebookDocumentChangeEvent(s,this.client.code2ProtocolConverter)}),this.onChangeNotificationSent.fire(s)}catch(o){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",o),o}},i=this.client.middleware?.notebooks;return e.cells?.structure!==void 0&&this.notebookSyncInfo.set(e.notebook.uri.toString(),mr.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(At.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}}),this.onSaveNotificationSent.fire(i)}catch(s){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",s),s}},n=this.client.middleware?.notebooks;return n?.didSave!==void 0?n.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e);if(t===void 0)throw new Error(`Received close event for un-synced notebook ${e.uri.toString()}`);return this.doSendClose(e,t)}async doSendClose(e,t){let n=async(s,o)=>{try{await this.client.sendNotification(At.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(s.uri)},cellTextDocuments:o.map(a=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(a.document))}),this.onCloseNotificationSent.fire(s)}catch(a){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",a),a}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),i?.didClose!==void 0?i.didClose(e,t,n):n(e,t)}getSynchronizedCells(e){return this.getSyncInfo(e)?.cells}asNotebookDocumentChangeEvent(e,t,n,i){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let s={notebook:e};t?.metadata!==void 0&&(s.metadata=On.c2p.asMetadata(t.metadata));let o;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let a=[];o=new Set(i.map(u=>u.document.uri.toString()));for(let u of t.cellChanges)o.has(u.cell.document.uri.toString())&&(u.executionSummary!==void 0||u.metadata!==void 0)&&a.push(u.cell);a.length>0&&(s.cells=s.cells??{},s.cells.data=a)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&n!==void 0&&i!==void 0){let a=n.cells,u=i,l=wo.computeDiff(a,u,!1),h,p;if(l!==void 0){h=l.cells===void 0?new Map:new Map(l.cells.map(g=>[g.document.uri.toString(),g])),p=l.deleteCount===0?new Map:new Map(a.slice(l.start,l.start+l.deleteCount).map(g=>[g.document.uri.toString(),g]));for(let g of Array.from(p.keys()))h.has(g)&&(p.delete(g),h.delete(g));s.cells=s.cells??{};let f=[],m=[];if(h.size>0||p.size>0){for(let g of h.values())f.push(g);for(let g of p.values())m.push(g)}s.cells.structure={array:l,didOpen:f,didClose:m}}}return Object.keys(s).length>1?s: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||pr.matchNotebook(n.notebook,e)){let i=this.filterCells(e,t,n.cells);return i.length===0?void 0:i}}}getMatchingCellsFromEvent(e,t,n){if(this.options.notebookSelector===void 0)return;let i;for(let u of this.options.notebookSelector)if(u.notebook===void 0||pr.matchNotebook(u.notebook,e)){i=u;break}if(i===void 0)return;if((n.cellChanges===void 0||n.cellChanges.length===0)&&(n.contentChanges===void 0||n.contentChanges.length===0))return t.cells;let s;if(n.cellChanges!==void 0&&n.cellChanges.length>0){let u=n.cellChanges.map(h=>h.cell),l=this.filterCells(e,u,i.cells);if(l.length!==u.length){s=new Set(t.uris);for(let h of u)s.delete(h.document.uri.toString());for(let h of l)s.add(h.document.uri.toString())}}if(n.contentChanges!==void 0&&n.contentChanges.length>0){s===void 0&&(s=new Set(t.uris));for(let u of n.contentChanges){for(let h of u.removedCells)s.delete(h.document.uri.toString());let l=this.filterCells(e,new Array(...u.addedCells),i.cells);for(let h of l)s.add(h.document.uri.toString())}}if(s===void 0)return t.cells;let o=[],a=e.getCells();for(let u of a)s.has(u.document.uri.toString())&&o.push(u);return o}getMatchingCellsFromSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:void 0}getMatchingCellsConsideringSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:this.getMatchingCells(e)}mergeCells(e,t,n){let i=[],s=new Set(t.uris);for(let o of n)s.add(o.document.uri.toString());for(let o of e.getCells())s.has(o.document.uri.toString())&&i.push(o);return 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(s=>{let o=s.document.languageId;return n.some((a=>a.language==="*"||o===a.language))}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,i):i}getSyncInfo(e){return this.notebookSyncInfo.get(e.uri.toString())}},Co=class r{static CellScheme="vscode-notebook-cell";client;registrations;dedicatedChannel;_onChangeNotificationSent;_onOpenNotificationSent;_onCloseNotificationSent;_onSaveNotificationSent;constructor(e){this.client=e,this.registrations=new Map,this.registrationType=At.NotebookDocumentSyncRegistrationType.type,this._onChangeNotificationSent=new se.EventEmitter,this._onOpenNotificationSent=new se.EventEmitter,this._onCloseNotificationSent=new se.EventEmitter,this._onSaveNotificationSent=new se.EventEmitter,se.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==r.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let s of this.registrations.values())s instanceof Rn&&s.didOpenNotebookCellTextDocument(n,i)}),se.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let n=t.document;if(n.uri.scheme!==r.CellScheme)return;let[i,s]=this.findNotebookDocumentAndCell(n);if(!(i===void 0||s===void 0))for(let o of this.registrations.values())o instanceof Rn&&o.didChangeNotebookCellTextDocument(i,s,t)}),se.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==r.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let s of this.registrations.values())s instanceof Rn&&s.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}}registrationType;get onOpenNotificationSent(){return this._onOpenNotificationSent.event}get onChangeNotificationSent(){return this._onChangeNotificationSent.event}get onCloseNotificationSent(){return this._onCloseNotificationSent.event}get onSaveNotificationSent(){return this._onSaveNotificationSent.event}fillClientCapabilities(e){let t=xu(xu(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(gr.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let n=t.id??wp.generateUuid();this.register({id:n,registerOptions:t})}register(e){let t=new Rn(this.client,e.registerOptions,this._onChangeNotificationSent,this._onOpenNotificationSent,this._onCloseNotificationSent,this._onSaveNotificationSent);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t!==void 0&&(this.registrations.delete(e),t.dispose())}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear(),this._onChangeNotificationSent.dispose(),this._onChangeNotificationSent=new se.EventEmitter,this._onOpenNotificationSent.dispose(),this._onOpenNotificationSent=new se.EventEmitter,this._onCloseNotificationSent.dispose(),this._onCloseNotificationSent=new se.EventEmitter,this._onSaveNotificationSent.dispose(),this._onSaveNotificationSent=new se.EventEmitter}handles(e){if(e.uri.scheme!==r.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&se.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 se.workspace.notebookDocuments)for(let i of n.getCells())if(i.document.uri.toString()===t)return[n,i];return[void 0,void 0]}};rt.NotebookDocumentSyncFeature=Co});var qu=M(je=>{"use strict";var bp=je&&je.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Sp=je&&je.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Eu=je&&je.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&bp(t,e,n[i]);return Sp(t,e),t}})();Object.defineProperty(je,"__esModule",{value:!0});je.SyncConfigurationFeature=je.ConfigurationFeature=void 0;je.toJSONObject=ln;var Fn=I("vscode"),ui=N(),Dp=Eu(He()),Pp=Eu(ne()),ku=B(),bo=class{_client;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(ui.ConfigurationRequest.type,(t,n)=>{let i=o=>{let a=[];for(let u of o.items){let l=u.scopeUri!==void 0&&u.scopeUri!==null?this._client.protocol2CodeConverter.asUri(u.scopeUri):void 0;a.push(this.getConfiguration(l,u.section!==null?u.section:void 0))}return a},s=e.middleware.workspace;return s&&s.configuration?s.configuration(t,n,i):i(t,n)})}getConfiguration(e,t){let n=null;if(t){let i=t.lastIndexOf(".");if(i===-1)n=ln(Fn.workspace.getConfiguration(void 0,e).get(t));else{let s=Fn.workspace.getConfiguration(t.substr(0,i),e);s&&(n=ln(s.get(t.substr(i+1))))}}else{let i=Fn.workspace.getConfiguration(void 0,e);n={};for(let s of Object.keys(i))i.has(s)&&(n[s]=ln(i.get(s)))}return n===void 0&&(n=null),n}clear(){}};je.ConfigurationFeature=bo;function ln(r){if(r){if(Array.isArray(r))return r.map(ln);if(typeof r=="object"){let e=Object.create(null);for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=ln(r[t]));return e}}return r}var So=class{_client;isCleared;_listeners;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 ui.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,ku.ensure)((0,ku.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:Pp.generateUuid(),registerOptions:{section:e}})}register(e){let t=Fn.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(Dp.string(e)?n=[e]:n=e,n!==void 0&&t!==void 0&&!n.some(a=>t.affectsConfiguration(a)))return;let i=async o=>o===void 0?this._client.sendNotification(ui.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(ui.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(o)}),s=this._client.middleware.workspace?.didChangeConfiguration;(s?s(n,i):i(n)).catch(o=>{this._client.error(`Sending notification ${ui.DidChangeConfigurationNotification.type.method} failed`,o)})}extractSettingsInformation(e){function t(s,o){let a=s;for(let u=0;u<o.length-1;u++){let l=a[o[u]];l||(l=Object.create(null),a[o[u]]=l),a=l}return a}let n=this._client.clientOptions.workspaceFolder?this._client.clientOptions.workspaceFolder.uri:void 0,i=Object.create(null);for(let s=0;s<e.length;s++){let o=e[s],a=o.indexOf("."),u=null;if(a>=0?u=Fn.workspace.getConfiguration(o.substr(0,a),n).get(o.substr(a+1)):u=Fn.workspace.getConfiguration(void 0,n).get(o),u){let l=e[s].split(".");t(i,l)[l[l.length-1]]=ln(u)}}return i}};je.SyncConfigurationFeature=So});var Lu={};fd(Lu,{TextDocument:()=>Do});function Po(r,e){if(r.length<=1)return r;let t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);Po(n,e),Po(i,e);let s=0,o=0,a=0;for(;s<n.length&&o<i.length;)e(n[s],i[o])<=0?r[a++]=n[s++]:r[a++]=i[o++];for(;s<n.length;)r[a++]=n[s++];for(;o<i.length;)r[a++]=i[o++];return r}function Iu(r,e,t=0){let n=e?[t]:[];for(let i=0;i<r.length;i++){let s=r.charCodeAt(i);Au(s)&&(s===13&&i+1<r.length&&r.charCodeAt(i+1)===10&&i++,n.push(t+i+1))}return n}function Au(r){return r===13||r===10}function ju(r){let e=r.start,t=r.end;return e.line>t.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:r}function Tp(r){let e=ju(r.range);return e!==r.range?{newText:r.newText,range:e}:r}var yr,Do,Nu=dd(()=>{"use strict";yr=class r{constructor(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){for(let n of e)if(r.isIncremental(n)){let i=ju(n.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(o,this._content.length);let a=Math.max(i.start.line,0),u=Math.max(i.end.line,0),l=this._lineOffsets,h=Iu(n.text,!1,s);if(u-a===h.length)for(let f=0,m=h.length;f<m;f++)l[f+a+1]=h[f];else h.length<1e4?l.splice(a+1,u-a,...h):this._lineOffsets=l=l.slice(0,a+1).concat(h,l.slice(u+1));let p=n.text.length-(o-s);if(p!==0)for(let f=a+1+h.length,m=l.length;f<m;f++)l[f]=l[f]+p}else if(r.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=t}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Iu(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,i=t.length;if(i===0)return{line:0,character:e};for(;n<i;){let o=Math.floor((n+i)/2);t[o]>e?i=o:n=o+1}let s=n-1;return e=this.ensureBeforeEOL(e,t[s]),{line:s,character:e-t[s]}}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line];if(e.character<=0)return n;let i=e.line+1<t.length?t[e.line+1]:this._content.length,s=Math.min(n+e.character,i);return this.ensureBeforeEOL(s,n)}getLineRange(e){let t=this.getLineOffsets();if(e>=t.length){let o=t.length-1;return{start:{line:o,character:0},end:{line:o,character:this._content.length-t[o]}}}else if(e<0)return{start:{line:0,character:0},end:{line:0,character:0}};let n=t[e],i=e+1<t.length?t[e+1]:this._content.length,s=this.ensureBeforeEOL(i,n);return{start:{line:e,character:0},end:{line:e,character:s-n}}}getEOLCharacters(e){let t=this.getLineOffsets();if(e>=t.length)return"";if(e<0)return"";let n=e+1<t.length?t[e+1]:this._content.length,i=this.ensureBeforeEOL(n,t[e]);return this._content.substring(i,n)}ensureBeforeEOL(e,t){for(;e>t&&Au(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let t=e;return t!=null&&typeof t.text=="string"&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength=="number")}static isFull(e){let t=e;return t!=null&&typeof t.text=="string"&&t.range===void 0&&t.rangeLength===void 0}};(function(r){function e(i,s,o,a){return new yr(i,s,o,a)}r.create=e;function t(i,s,o){if(i instanceof yr)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}r.update=t;function n(i,s){let o=i.getText(),a=Po(s.map(Tp),(h,p)=>{let f=h.range.start.line-p.range.start.line;return f===0?h.range.start.character-p.range.start.character:f}),u=0,l=[];for(let h of a){let p=i.offsetAt(h.range.start);if(p<u)throw new Error("Overlapping edit");p>u&&l.push(o.substring(u,p)),h.newText.length&&l.push(h.newText),u=i.offsetAt(h.range.end)}return l.push(o.substr(u)),l.join("")}r.applyEdits=n})(Do||(Do={}))});var Uu=M(ve=>{"use strict";var Op=ve&&ve.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Rp=ve&&ve.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Fp=ve&&ve.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Op(t,e,n[i]);return Rp(t,e),t}})();Object.defineProperty(ve,"__esModule",{value:!0});ve.DidSaveTextDocumentFeature=ve.WillSaveWaitUntilFeature=ve.WillSaveFeature=ve.DidChangeTextDocumentFeature=ve.DidCloseTextDocumentFeature=ve.DidOpenTextDocumentFeature=void 0;var me=I("vscode"),ee=N(),ce=B(),xn=Fp(ne()),xp=(Nu(),hd(Lu)),To=class extends ce.TextDocumentEventFeature{_syncedDocuments;_pendingOpenNotifications;_delayOpen;_pendingOpenListeners;constructor(e,t){super(e,me.workspace.onDidOpenTextDocument,ee.DidOpenTextDocumentNotification.type,()=>e.middleware.didOpen,n=>e.code2ProtocolConverter.asOpenTextDocumentParams(n),n=>n,ce.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingOpenNotifications=new Map,this._delayOpen=e.clientOptions.textSynchronization?.delayOpenNotifications??!1}async callback(e){if(this._delayOpen){if(!this.matches(e))return;if(this._client.visibleDocuments.isVisible(e))return super.callback(e);{let n=new ko(e);this._pendingOpenNotifications.set(n.uri.toString(),n)}}else return super.callback(e)}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}get registrationType(){return ee.DidOpenTextDocumentNotification.type}register(e){if(super.register(e),!e.registerOptions.documentSelector)return;let t=this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector);if(me.workspace.textDocuments.forEach(n=>{let i=n.uri.toString();if(!this._syncedDocuments.has(i)&&me.languages.match(t,n)>0&&!this._client.hasDedicatedTextSynchronizationFeature(n))if(this._client.visibleDocuments.isVisible(n)){let o=this._client.middleware,a=u=>this._client.sendNotification(this._type,this._createParams(u));(o.didOpen?o.didOpen(n,a):a(n)).catch(u=>{this._client.error(`Sending document notification ${this._type.method} failed`,u)}),this._syncedDocuments.set(i,n)}else this._pendingOpenNotifications.set(i,n)}),this._delayOpen&&this._pendingOpenListeners===void 0){this._pendingOpenListeners=[];let n=this._client.visibleDocuments;this._pendingOpenListeners.push(n.onClose(i=>{for(let s of i)this._pendingOpenNotifications.delete(s.toString())})),this._pendingOpenListeners.push(n.onOpen(i=>{for(let s of i){let o=this._pendingOpenNotifications.get(s.toString());o!==void 0&&(super.callback(o).catch((a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})),this._pendingOpenNotifications.delete(s.toString()))}})),this._pendingOpenListeners.push(me.workspace.onDidCloseTextDocument(i=>{this._pendingOpenNotifications.delete(i.uri.toString())}))}}async sendPendingOpenNotifications(e){let t=Array.from(this._pendingOpenNotifications.values());this._pendingOpenNotifications.clear();let n=!1;for(let i of t){if(e!==void 0&&i.uri.toString()===e){n=!0;continue}await super.callback(i)}return n}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.set(e.uri.toString(),e),super.notificationSent(e,t,n)}clear(){if(this._pendingOpenNotifications.clear(),this._pendingOpenListeners!==void 0){for(let e of this._pendingOpenListeners)e.dispose();this._pendingOpenListeners=void 0}super.clear()}};ve.DidOpenTextDocumentFeature=To;var Oo=class extends ce.TextDocumentEventFeature{_syncedDocuments;_pendingTextDocumentChanges;constructor(e,t,n){super(e,me.workspace.onDidCloseTextDocument,ee.DidCloseTextDocumentNotification.type,()=>e.middleware.didClose,i=>e.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,ce.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingTextDocumentChanges=n}get registrationType(){return ee.DidCloseTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:xn.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);if(t===void 0)return;super.unregister(e);let n=this._selectors.values();this._syncedDocuments.forEach(i=>{if(me.languages.match(t,i)>0&&!this._selectorFilter(n,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let s=this._client.middleware,o=a=>this._client.sendNotification(this._type,this._createParams(a));this._syncedDocuments.delete(i.uri.toString()),(s.didClose?s.didClose(i,o):o(i)).catch(a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})}})}};ve.DidCloseTextDocumentFeature=Oo;var Ro=class extends ce.DynamicDocumentFeature{_listener;_changeData;_onNotificationSent;_onPendingChangeAdded;_pendingTextDocumentChanges;_syncKind;constructor(e,t){super(e),this._changeData=new Map,this._onNotificationSent=new me.EventEmitter,this._onPendingChangeAdded=new me.EventEmitter,this._pendingTextDocumentChanges=t,this._syncKind=ee.TextDocumentSyncKind.None}get onNotificationSent(){return this._onNotificationSent.event}get onPendingChangeAdded(){return this._onPendingChangeAdded.event}get syncKind(){return this._syncKind}get registrationType(){return ee.DidChangeTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.change!==void 0&&n.change!==ee.TextDocumentSyncKind.None&&this.register({id:xn.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},{syncKind:n.change})})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=me.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 s of this._changeData.values())if(me.languages.match(s.documentSelector,e.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let o=this._client.middleware;if(s.syncKind===ee.TextDocumentSyncKind.Incremental){let a=async u=>{let l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(u,t,n);await this._client.sendNotification(ee.DidChangeTextDocumentNotification.type,l),this.notificationSent(u.document,ee.DidChangeTextDocumentNotification.type,l)};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}else if(s.syncKind===ee.TextDocumentSyncKind.Full){let a=async u=>{let l=u.document.uri.toString();this._pendingTextDocumentChanges.set(l,u.document),this._onPendingChangeAdded.fire()};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}}return Promise.all(i).then(void 0,s=>{throw this._client.error(`Sending document notification ${ee.DidChangeTextDocumentNotification.type.method} failed`,s),s})}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=ee.TextDocumentSyncKind.None;else{this._syncKind=ee.TextDocumentSyncKind.None;for(let t of this._changeData.values())if(this.updateSyncKind(t.syncKind),this._syncKind===ee.TextDocumentSyncKind.Full)break}}clear(){this._pendingTextDocumentChanges.clear(),this._changeData.clear(),this._syncKind=ee.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(me.languages.match(t.documentSelector,e)>0)return{send:n=>this.callback(n)}}updateSyncKind(e){if(this._syncKind!==ee.TextDocumentSyncKind.Full)switch(e){case ee.TextDocumentSyncKind.Full:this._syncKind=e;break;case ee.TextDocumentSyncKind.Incremental:this._syncKind===ee.TextDocumentSyncKind.None&&(this._syncKind=ee.TextDocumentSyncKind.Incremental);break}}};ve.DidChangeTextDocumentFeature=Ro;var Fo=class extends ce.TextDocumentEventFeature{constructor(e){super(e,me.workspace.onWillSaveTextDocument,ee.WillSaveTextDocumentNotification.type,()=>e.middleware.willSave,t=>e.code2ProtocolConverter.asWillSaveTextDocumentParams(t),t=>t.document,(t,n)=>ce.TextDocumentEventFeature.textDocumentFilter(t,n.document))}get registrationType(){return ee.WillSaveTextDocumentNotification.type}fillClientCapabilities(e){let t=(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization");t.willSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSave&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}getTextDocument(e){return e.document}};ve.WillSaveFeature=Fo;var xo=class extends ce.DynamicDocumentFeature{_listener;_selectors;constructor(e){super(e),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return ee.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(e){let t=(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization");t.willSaveWaitUntil=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSaveWaitUntil&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=me.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}callback(e){if(ce.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),e.document)&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let t=this._client.middleware,n=i=>this._client.sendRequest(ee.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async s=>{let o=await this._client.protocol2CodeConverter.asTextEdits(s);return o===void 0?[]:o});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)}};ve.WillSaveWaitUntilFeature=xo;var Mo=class extends ce.TextDocumentEventFeature{_includeText;constructor(e){super(e,me.workspace.onDidSaveTextDocument,ee.DidSaveTextDocumentNotification.type,()=>e.middleware.didSave,t=>e.code2ProtocolConverter.asSaveTextDocumentParams(t,this._includeText),t=>t,ce.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return ee.DidSaveTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.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:xn.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},i)})}}register(e){this._includeText=!!e.registerOptions.includeText,super.register(e)}getTextDocument(e){return e}};ve.DidSaveTextDocumentFeature=Mo;var Mp="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function kp(r=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(let t of Mp)r.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}var Ep=kp(),ko=class r{_extTextDocument;_capturedTextDocument;_content;_uri;_fileName;_languageId;_version;_eol;_isUntitled;_encoding;_isDirty;_isClosed;constructor(e){this._extTextDocument=e,this._content=e.getText(),this._uri=e.uri,this._fileName=e.fileName,this._languageId=e.languageId,this._version=e.version,this._eol=e.eol,this._isUntitled=e.isUntitled,this._encoding=e.encoding,this._isDirty=e.isDirty,this._isClosed=e.isClosed,this._capturedTextDocument=xp.TextDocument.create(this._uri.toString(),this._languageId,this._version,this._content)}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}get eol(){return this._eol}get isUntitled(){return this._isUntitled}get encoding(){return this._encoding}get fileName(){return this._fileName}get isDirty(){return this._isDirty}get isClosed(){return this._isClosed}save(){return this.version===this._extTextDocument.version?this._extTextDocument.save():Promise.resolve(!1)}get lineCount(){return this._capturedTextDocument.lineCount}offsetAt(e){return this._capturedTextDocument.offsetAt(e)}positionAt(e){let t=this._capturedTextDocument.positionAt(e);return new me.Position(t.line,t.character)}getText(e){return this._capturedTextDocument.getText(e)}lineAt(e){let t=typeof e=="number"?e:this.validatePosition(e).line;if(t<0||t>=this.lineCount)throw new RangeError(`Illegal value for line: ${t}`);let n=this._capturedTextDocument.getLineRange(t),i=this._capturedTextDocument.getText(n),s=i.search(/\S/),o=new me.Range(n.start.line,n.start.character,n.end.line,n.end.character),a=t+1<this.lineCount?new me.Range(o.start.line,o.start.character,t+1,0):o;return{lineNumber:t,text:i,range:o,rangeIncludingLineBreak:a,firstNonWhitespaceCharacterIndex:s===-1?i.length:s,isEmptyOrWhitespace:s===-1}}getWordRangeAtPosition(e,t){let n=this.validatePosition(e).line,i=this.lineAt(n).text,s=r.getWordRegExp(t),o;for(s.lastIndex=0;(o=s.exec(i))!==null;)if(o.index<=e.character&&s.lastIndex>=e.character)return new me.Range(n,o.index,n,s.lastIndex)}validateRange(e){let t=this.validatePosition(e.start),n=this.validatePosition(e.end);return t===e.start&&n===e.end?e:new me.Range(t.line,t.character,n.line,n.character)}validatePosition(e){let t=Math.min(Math.max(e.line,0),this.lineCount-1),n=this._capturedTextDocument.getLineRange(t),i=Math.min(Math.max(e.character,0),n.end.character);return t===e.line&&i===e.character?e:new me.Position(t,i)}static getWordRegExp(e){let t=e??Ep;if(t.flags.includes("g"))return t;let n=`${t.flags}g`;return new RegExp(t.source,n)}}});var Ku=M(st=>{"use strict";var qp=st&&st.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ip=st&&st.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ap=st&&st.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&qp(t,e,n[i]);return Ip(t,e),t}})();Object.defineProperty(st,"__esModule",{value:!0});st.CompletionItemFeature=void 0;var jp=I("vscode"),W=N(),Eo=B(),Lp=Ap(ne()),Np=[W.CompletionItemKind.Text,W.CompletionItemKind.Method,W.CompletionItemKind.Function,W.CompletionItemKind.Constructor,W.CompletionItemKind.Field,W.CompletionItemKind.Variable,W.CompletionItemKind.Class,W.CompletionItemKind.Interface,W.CompletionItemKind.Module,W.CompletionItemKind.Property,W.CompletionItemKind.Unit,W.CompletionItemKind.Value,W.CompletionItemKind.Enum,W.CompletionItemKind.Keyword,W.CompletionItemKind.Snippet,W.CompletionItemKind.Color,W.CompletionItemKind.File,W.CompletionItemKind.Reference,W.CompletionItemKind.Folder,W.CompletionItemKind.EnumMember,W.CompletionItemKind.Constant,W.CompletionItemKind.Struct,W.CompletionItemKind.Event,W.CompletionItemKind.Operator,W.CompletionItemKind.TypeParameter],qo=class extends Eo.TextDocumentLanguageFeature{labelDetailsSupport;constructor(e){super(e,W.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(e){let t=(0,Eo.ensure)((0,Eo.ensure)(e,"textDocument"),"completion");t.dynamicRegistration=!0,t.contextSupport=!0,t.completionItem={snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[W.MarkupKind.Markdown,W.MarkupKind.PlainText],deprecatedSupport:!0,preselectSupport:!0,tagSupport:{valueSet:[W.CompletionItemTag.Deprecated]},insertReplaceSupport:!0,resolveSupport:{properties:["documentation","detail","additionalTextEdits"]},insertTextModeSupport:{valueSet:[W.InsertTextMode.asIs,W.InsertTextMode.adjustIndentation]},labelDetailsSupport:!0},t.insertTextMode=W.InsertTextMode.adjustIndentation,t.completionItemKind={valueSet:Np},t.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode","data"],applyKindSupport:!0}}initialize(e,t){let n=this.getRegistrationOptions(t,e.completionProvider);n&&this.register({id:Lp.generateUuid(),registerOptions:n})}registerLanguageProvider(e,t){this.labelDetailsSupport.set(t,!!e.completionItem?.labelDetailsSupport);let n=e.triggerCharacters??[],i=e.allCommitCharacters,s=e.documentSelector,o={provideCompletionItems:(a,u,l,h)=>{let p=this._client,f=this._client.middleware,m=(g,v,_,T)=>p.sendRequest(W.CompletionRequest.type,p.code2ProtocolConverter.asCompletionParams(g,v,_),T).then(C=>T.isCancellationRequested?null:p.protocol2CodeConverter.asCompletionResult(C,i,T),C=>p.handleFailedRequest(W.CompletionRequest.type,T,C,null));return f.provideCompletionItem?f.provideCompletionItem(a,u,h,l,m):m(a,u,h,l)},resolveCompletionItem:e.resolveProvider?(a,u)=>{let l=this._client,h=this._client.middleware,p=(f,m)=>l.sendRequest(W.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(f,!!this.labelDetailsSupport.get(t)),m).then(g=>m.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(g),g=>l.handleFailedRequest(W.CompletionResolveRequest.type,m,g,f));return h.resolveCompletionItem?h.resolveCompletionItem(a,u,p):p(a,u)}:void 0};return[jp.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(s),o,...n),o]}};st.CompletionItemFeature=qo});var Hu=M(ot=>{"use strict";var Up=ot&&ot.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Kp=ot&&ot.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Hp=ot&&ot.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Up(t,e,n[i]);return Kp(t,e),t}})();Object.defineProperty(ot,"__esModule",{value:!0});ot.HoverFeature=void 0;var Wp=I("vscode"),li=N(),Io=B(),$p=Hp(ne()),Ao=class extends Io.TextDocumentLanguageFeature{constructor(e){super(e,li.HoverRequest.type)}fillClientCapabilities(e){let t=(0,Io.ensure)((0,Io.ensure)(e,"textDocument"),"hover");t.dynamicRegistration=!0,t.contentFormat=[li.MarkupKind.Markdown,li.MarkupKind.PlainText]}initialize(e,t){let n=this.getRegistrationOptions(t,e.hoverProvider);n&&this.register({id:$p.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideHover:(i,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(li.HoverRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asHover(m),m=>a.handleFailedRequest(li.HoverRequest.type,f,m,null)),l=a.middleware;return l.provideHover?l.provideHover(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Wp.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};ot.HoverFeature=Ao});var Wu=M(at=>{"use strict";var Bp=at&&at.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),zp=at&&at.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Vp=at&&at.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Bp(t,e,n[i]);return zp(t,e),t}})();Object.defineProperty(at,"__esModule",{value:!0});at.DefinitionFeature=void 0;var Gp=I("vscode"),jo=N(),Lo=B(),Jp=Vp(ne()),No=class extends Lo.TextDocumentLanguageFeature{constructor(e){super(e,jo.DefinitionRequest.type)}fillClientCapabilities(e){let t=(0,Lo.ensure)((0,Lo.ensure)(e,"textDocument"),"definition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.definitionProvider);n&&this.register({id:Jp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDefinition:(i,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(jo.DefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(jo.DefinitionRequest.type,f,m,null)),l=a.middleware;return l.provideDefinition?l.provideDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Gp.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};at.DefinitionFeature=No});var Bu=M(ct=>{"use strict";var Yp=ct&&ct.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Qp=ct&&ct.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Zp=ct&&ct.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Yp(t,e,n[i]);return Qp(t,e),t}})();Object.defineProperty(ct,"__esModule",{value:!0});ct.SignatureHelpFeature=void 0;var $u=I("vscode"),di=N(),Uo=B(),Xp=Zp(ne()),Ko=class extends Uo.TextDocumentLanguageFeature{constructor(e){super(e,di.SignatureHelpRequest.type)}fillClientCapabilities(e){let t=(0,Uo.ensure)((0,Uo.ensure)(e,"textDocument"),"signatureHelp");t.dynamicRegistration=!0,t.signatureInformation={documentationFormat:[di.MarkupKind.Markdown,di.MarkupKind.PlainText]},t.signatureInformation.parameterInformation={labelOffsetSupport:!0},t.signatureInformation.activeParameterSupport=!0,t.signatureInformation.noActiveParameterSupport=!0,t.contextSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.signatureHelpProvider);n&&this.register({id:Xp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t={provideSignatureHelp:(n,i,s,o)=>{let a=this._client,u=(h,p,f,m)=>a.sendRequest(di.SignatureHelpRequest.type,a.code2ProtocolConverter.asSignatureHelpParams(h,p,f),m).then(g=>m.isCancellationRequested?null:a.protocol2CodeConverter.asSignatureHelp(g,m),g=>a.handleFailedRequest(di.SignatureHelpRequest.type,m,g,null)),l=a.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(n,i,o,s,u):u(n,i,o,s)}};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 $u.languages.registerSignatureHelpProvider(n,t,...i)}else{let i={triggerCharacters:e.triggerCharacters||[],retriggerCharacters:e.retriggerCharacters||[]};return $u.languages.registerSignatureHelpProvider(n,t,i)}}};ct.SignatureHelpFeature=Ko});var zu=M(ut=>{"use strict";var eg=ut&&ut.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),tg=ut&&ut.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ng=ut&&ut.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&eg(t,e,n[i]);return tg(t,e),t}})();Object.defineProperty(ut,"__esModule",{value:!0});ut.DocumentHighlightFeature=void 0;var ig=I("vscode"),Ho=N(),Wo=B(),rg=ng(ne()),$o=class extends Wo.TextDocumentLanguageFeature{constructor(e){super(e,Ho.DocumentHighlightRequest.type)}fillClientCapabilities(e){(0,Wo.ensure)((0,Wo.ensure)(e,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentHighlightProvider);n&&this.register({id:rg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentHighlights:(i,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(Ho.DocumentHighlightRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDocumentHighlights(m,f),m=>a.handleFailedRequest(Ho.DocumentHighlightRequest.type,f,m,null)),l=a.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,s,o,u):u(i,s,o)}};return[ig.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};ut.DocumentHighlightFeature=$o});var Vo=M(Pe=>{"use strict";var sg=Pe&&Pe.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),og=Pe&&Pe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ag=Pe&&Pe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&sg(t,e,n[i]);return og(t,e),t}})();Object.defineProperty(Pe,"__esModule",{value:!0});Pe.DocumentSymbolFeature=Pe.SupportedSymbolTags=Pe.SupportedSymbolKinds=void 0;var cg=I("vscode"),J=N(),Bo=B(),ug=ag(ne());Pe.SupportedSymbolKinds=[J.SymbolKind.File,J.SymbolKind.Module,J.SymbolKind.Namespace,J.SymbolKind.Package,J.SymbolKind.Class,J.SymbolKind.Method,J.SymbolKind.Property,J.SymbolKind.Field,J.SymbolKind.Constructor,J.SymbolKind.Enum,J.SymbolKind.Interface,J.SymbolKind.Function,J.SymbolKind.Variable,J.SymbolKind.Constant,J.SymbolKind.String,J.SymbolKind.Number,J.SymbolKind.Boolean,J.SymbolKind.Array,J.SymbolKind.Object,J.SymbolKind.Key,J.SymbolKind.Null,J.SymbolKind.EnumMember,J.SymbolKind.Struct,J.SymbolKind.Event,J.SymbolKind.Operator,J.SymbolKind.TypeParameter];Pe.SupportedSymbolTags=[J.SymbolTag.Deprecated];var zo=class extends Bo.TextDocumentLanguageFeature{constructor(e){super(e,J.DocumentSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Bo.ensure)((0,Bo.ensure)(e,"textDocument"),"documentSymbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Pe.SupportedSymbolKinds},t.hierarchicalDocumentSymbolSupport=!0,t.tagSupport={valueSet:Pe.SupportedSymbolTags},t.labelSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentSymbolProvider);n&&this.register({id:ug.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentSymbols:(s,o)=>{let a=this._client,u=async(h,p)=>{try{let f=await a.sendRequest(J.DocumentSymbolRequest.type,a.code2ProtocolConverter.asDocumentSymbolParams(h),p);if(p.isCancellationRequested||f===void 0||f===null)return null;if(f.length===0)return[];{let m=f[0];return J.DocumentSymbol.is(m)?await a.protocol2CodeConverter.asDocumentSymbols(f,p):await a.protocol2CodeConverter.asSymbolInformations(f,p)}}catch(f){return a.handleFailedRequest(J.DocumentSymbolRequest.type,p,f,null)}},l=a.middleware;return l.provideDocumentSymbols?l.provideDocumentSymbols(s,o,u):u(s,o)}},i=e.label!==void 0?{label:e.label}:void 0;return[cg.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,i),n]}};Pe.DocumentSymbolFeature=zo});var Gu=M(lt=>{"use strict";var lg=lt&&lt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),dg=lt&&lt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),fg=lt&&lt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&lg(t,e,n[i]);return dg(t,e),t}})();Object.defineProperty(lt,"__esModule",{value:!0});lt.WorkspaceSymbolFeature=void 0;var hg=I("vscode"),fi=N(),Go=B(),Vu=Vo(),pg=fg(ne()),Jo=class extends Go.WorkspaceFeature{constructor(e){super(e,fi.WorkspaceSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Go.ensure)((0,Go.ensure)(e,"workspace"),"symbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Vu.SupportedSymbolKinds},t.tagSupport={valueSet:Vu.SupportedSymbolTags},t.resolveSupport={properties:["location.range"]}}initialize(e){e.workspaceSymbolProvider&&this.register({id:pg.generateUuid(),registerOptions:e.workspaceSymbolProvider===!0?{workDoneProgress:!1}:e.workspaceSymbolProvider})}registerLanguageProvider(e){let t={provideWorkspaceSymbols:(n,i)=>{let s=this._client,o=(u,l)=>s.sendRequest(fi.WorkspaceSymbolRequest.type,{query:u},l).then(h=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformations(h,l),h=>s.handleFailedRequest(fi.WorkspaceSymbolRequest.type,l,h,null)),a=s.middleware;return a.provideWorkspaceSymbols?a.provideWorkspaceSymbols(n,i,o):o(n,i)},resolveWorkspaceSymbol:e.resolveProvider===!0?(n,i)=>{let s=this._client,o=(u,l)=>s.sendRequest(fi.WorkspaceSymbolResolveRequest.type,s.code2ProtocolConverter.asWorkspaceSymbol(u),l).then(h=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformation(h),h=>s.handleFailedRequest(fi.WorkspaceSymbolResolveRequest.type,l,h,null)),a=s.middleware;return a.resolveWorkspaceSymbol?a.resolveWorkspaceSymbol(n,i,o):o(n,i)}:void 0};return[hg.languages.registerWorkspaceSymbolProvider(t),t]}};lt.WorkspaceSymbolFeature=Jo});var Ju=M(dt=>{"use strict";var gg=dt&&dt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),mg=dt&&dt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),vg=dt&&dt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&gg(t,e,n[i]);return mg(t,e),t}})();Object.defineProperty(dt,"__esModule",{value:!0});dt.ReferencesFeature=void 0;var yg=I("vscode"),Yo=N(),Qo=B(),_g=vg(ne()),Zo=class extends Qo.TextDocumentLanguageFeature{constructor(e){super(e,Yo.ReferencesRequest.type)}fillClientCapabilities(e){(0,Qo.ensure)((0,Qo.ensure)(e,"textDocument"),"references").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.referencesProvider);n&&this.register({id:_g.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideReferences:(i,s,o,a)=>{let u=this._client,l=(p,f,m,g)=>u.sendRequest(Yo.ReferencesRequest.type,u.code2ProtocolConverter.asReferenceParams(p,f,m),g).then(v=>g.isCancellationRequested?null:u.protocol2CodeConverter.asReferences(v,g),v=>u.handleFailedRequest(Yo.ReferencesRequest.type,g,v,null)),h=u.middleware;return h.provideReferences?h.provideReferences(i,s,o,a,l):l(i,s,o,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return yg.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};dt.ReferencesFeature=Zo});var Yu=M(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.TypeDefinitionFeature=void 0;var wg=I("vscode"),Xo=N(),hi=B(),ea=class extends hi.TextDocumentLanguageFeature{constructor(e){super(e,Xo.TypeDefinitionRequest.type)}fillClientCapabilities(e){(0,hi.ensure)((0,hi.ensure)(e,"textDocument"),"typeDefinition").dynamicRegistration=!0;let t=(0,hi.ensure)((0,hi.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,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(Xo.TypeDefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(Xo.TypeDefinitionRequest.type,f,m,null)),l=a.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return wg.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};_r.TypeDefinitionFeature=ea});var Qu=M(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.ImplementationFeature=void 0;var Cg=I("vscode"),ta=N(),na=B(),ia=class extends na.TextDocumentLanguageFeature{constructor(e){super(e,ta.ImplementationRequest.type)}fillClientCapabilities(e){let t=(0,na.ensure)((0,na.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,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(ta.ImplementationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(ta.ImplementationRequest.type,f,m,null)),l=a.middleware;return l.provideImplementation?l.provideImplementation(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Cg.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};wr.ImplementationFeature=ia});var Zu=M(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.ColorProviderFeature=void 0;var bg=I("vscode"),pi=N(),ra=B(),sa=class extends ra.TextDocumentLanguageFeature{constructor(e){super(e,pi.DocumentColorRequest.type)}fillClientCapabilities(e){(0,ra.ensure)((0,ra.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,s,o)=>{let a=this._client,u=(h,p,f)=>{let m={color:h,textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(p.document),range:a.code2ProtocolConverter.asRange(p.range)};return a.sendRequest(pi.ColorPresentationRequest.type,m,f).then(g=>f.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(g,f),g=>a.handleFailedRequest(pi.ColorPresentationRequest.type,f,g,null))},l=a.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,s,o,u):u(i,s,o)},provideDocumentColors:(i,s)=>{let o=this._client,a=(l,h)=>{let p={textDocument:o.code2ProtocolConverter.asTextDocumentIdentifier(l)};return o.sendRequest(pi.DocumentColorRequest.type,p,h).then(f=>h.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(f,h),f=>o.handleFailedRequest(pi.DocumentColorRequest.type,h,f,null))},u=o.middleware;return u.provideDocumentColors?u.provideDocumentColors(i,s,a):a(i,s)}};return[bg.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Cr.ColorProviderFeature=sa});var Xu=M(ft=>{"use strict";var Sg=ft&&ft.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Dg=ft&&ft.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Pg=ft&&ft.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Sg(t,e,n[i]);return Dg(t,e),t}})();Object.defineProperty(ft,"__esModule",{value:!0});ft.CodeActionFeature=void 0;var Tg=I("vscode"),Te=N(),Og=Pg(ne()),oa=B(),aa=class extends oa.TextDocumentLanguageFeature{constructor(e){super(e,Te.CodeActionRequest.type)}fillClientCapabilities(e){let t=(0,oa.ensure)((0,oa.ensure)(e,"textDocument"),"codeAction");t.dynamicRegistration=!0,t.isPreferredSupport=!0,t.disabledSupport=!0,t.dataSupport=!0,t.resolveSupport={properties:["edit","command"]},t.codeActionLiteralSupport={codeActionKind:{valueSet:[Te.CodeActionKind.Empty,Te.CodeActionKind.QuickFix,Te.CodeActionKind.Refactor,Te.CodeActionKind.RefactorExtract,Te.CodeActionKind.RefactorInline,Te.CodeActionKind.RefactorMove,Te.CodeActionKind.RefactorRewrite,Te.CodeActionKind.Source,Te.CodeActionKind.SourceOrganizeImports,Te.CodeActionKind.Notebook]}},t.honorsChangeAnnotations=!0,t.documentationSupport=!0,t.tagSupport={valueSet:[Te.CodeActionTag.LLMGenerated]}}initialize(e,t){let n=this.getRegistrationOptions(t,e.codeActionProvider);n&&this.register({id:Og.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideCodeActions:(i,s,o,a)=>{let u=this._client,l=async(p,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),range:u.code2ProtocolConverter.asRange(f),context:u.code2ProtocolConverter.asCodeActionContextSync(m)};return u.sendRequest(Te.CodeActionRequest.type,v,g).then(_=>g.isCancellationRequested||_===null||_===void 0?null:u.protocol2CodeConverter.asCodeActionResult(_,g),_=>u.handleFailedRequest(Te.CodeActionRequest.type,g,_,null))},h=u.middleware;return h.provideCodeActions?h.provideCodeActions(i,s,o,a,l):l(i,s,o,a)},resolveCodeAction:e.resolveProvider?(i,s)=>{let o=this._client,a=this._client.middleware,u=async(l,h)=>o.sendRequest(Te.CodeActionResolveRequest.type,o.code2ProtocolConverter.asCodeActionSync(l),h).then(p=>h.isCancellationRequested?l:o.protocol2CodeConverter.asCodeAction(p,h),p=>o.handleFailedRequest(Te.CodeActionResolveRequest.type,h,p,l));return a.resolveCodeAction?a.resolveCodeAction(i,s,u):u(i,s)}:void 0};return[Tg.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,this.getMetadata(e)),n]}getMetadata(e){if(!(e.codeActionKinds===void 0&&e.documentation===void 0))return{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(e.codeActionKinds),documentation:this._client.protocol2CodeConverter.asCodeActionDocumentations(e.documentation)}}};ft.CodeActionFeature=aa});var tl=M(ht=>{"use strict";var Rg=ht&&ht.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Fg=ht&&ht.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),xg=ht&&ht.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Rg(t,e,n[i]);return Fg(t,e),t}})();Object.defineProperty(ht,"__esModule",{value:!0});ht.CodeLensFeature=void 0;var el=I("vscode"),Mn=N(),Mg=xg(ne()),gi=B(),ca=class extends gi.TextDocumentLanguageFeature{constructor(e){super(e,Mn.CodeLensRequest.type)}fillClientCapabilities(e){let t=(0,gi.ensure)((0,gi.ensure)(e,"textDocument"),"codeLens");t.dynamicRegistration=!0,t.resolveSupport={properties:["command"]},(0,gi.ensure)((0,gi.ensure)(e,"workspace"),"codeLens").refreshSupport=!0}initialize(e,t){this._client.onRequest(Mn.CodeLensRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeCodeLensEmitter.fire()});let i=this.getRegistrationOptions(t,e.codeLensProvider);i&&this.register({id:Mg.generateUuid(),registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new el.EventEmitter,i={onDidChangeCodeLenses:n.event,provideCodeLenses:(s,o)=>{let a=this._client,u=(h,p)=>a.sendRequest(Mn.CodeLensRequest.type,a.code2ProtocolConverter.asCodeLensParams(h),p).then(f=>p.isCancellationRequested?null:a.protocol2CodeConverter.asCodeLenses(f,p),f=>a.handleFailedRequest(Mn.CodeLensRequest.type,p,f,null)),l=a.middleware;return l.provideCodeLenses?l.provideCodeLenses(s,o,u):u(s,o)},resolveCodeLens:e.resolveProvider?(s,o)=>{let a=this._client,u=(h,p)=>a.sendRequest(Mn.CodeLensResolveRequest.type,a.code2ProtocolConverter.asCodeLens(h),p).then(f=>p.isCancellationRequested?h:a.protocol2CodeConverter.asCodeLens(f),f=>a.handleFailedRequest(Mn.CodeLensResolveRequest.type,p,f,h)),l=a.middleware;return l.resolveCodeLens?l.resolveCodeLens(s,o,u):u(s,o)}:void 0};return[el.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeCodeLensEmitter:n}]}};ht.CodeLensFeature=ca});var nl=M(qe=>{"use strict";var kg=qe&&qe.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Eg=qe&&qe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),qg=qe&&qe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&kg(t,e,n[i]);return Eg(t,e),t}})();Object.defineProperty(qe,"__esModule",{value:!0});qe.DocumentOnTypeFormattingFeature=qe.DocumentRangeFormattingFeature=qe.DocumentFormattingFeature=void 0;var br=I("vscode"),Ze=N(),fa=qg(ne()),jt=B(),kn;(function(r){function e(t){let n=br.workspace.getConfiguration("files",t);return{trimTrailingWhitespace:n.get("trimTrailingWhitespace"),trimFinalNewlines:n.get("trimFinalNewlines"),insertFinalNewline:n.get("insertFinalNewline")}}r.fromConfiguration=e})(kn||(kn={}));var ua=class extends jt.TextDocumentLanguageFeature{constructor(e){super(e,Ze.DocumentFormattingRequest.type)}fillClientCapabilities(e){(0,jt.ensure)((0,jt.ensure)(e,"textDocument"),"formatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentFormattingProvider);n&&this.register({id:fa.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentFormattingEdits:(i,s,o)=>{let a=this._client,u=(h,p,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(h),options:a.code2ProtocolConverter.asFormattingOptions(p,kn.fromConfiguration(h))};return a.sendRequest(Ze.DocumentFormattingRequest.type,m,f).then(g=>f.isCancellationRequested?null:a.protocol2CodeConverter.asTextEdits(g,f),g=>a.handleFailedRequest(Ze.DocumentFormattingRequest.type,f,g,null))},l=a.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,s,o,u):u(i,s,o)}};return[br.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};qe.DocumentFormattingFeature=ua;var la=class extends jt.TextDocumentLanguageFeature{constructor(e){super(e,Ze.DocumentRangeFormattingRequest.type)}fillClientCapabilities(e){let t=(0,jt.ensure)((0,jt.ensure)(e,"textDocument"),"rangeFormatting");t.dynamicRegistration=!0,t.rangesSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentRangeFormattingProvider);n&&this.register({id:fa.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentRangeFormattingEdits:(i,s,o,a)=>{let u=this._client,l=(p,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),range:u.code2ProtocolConverter.asRange(f),options:u.code2ProtocolConverter.asFormattingOptions(m,kn.fromConfiguration(p))};return u.sendRequest(Ze.DocumentRangeFormattingRequest.type,v,g).then(_=>g.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(_,g),_=>u.handleFailedRequest(Ze.DocumentRangeFormattingRequest.type,g,_,null))},h=u.middleware;return h.provideDocumentRangeFormattingEdits?h.provideDocumentRangeFormattingEdits(i,s,o,a,l):l(i,s,o,a)}};return e.rangesSupport&&(n.provideDocumentRangesFormattingEdits=(i,s,o,a)=>{let u=this._client,l=(p,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),ranges:u.code2ProtocolConverter.asRanges(f),options:u.code2ProtocolConverter.asFormattingOptions(m,kn.fromConfiguration(p))};return u.sendRequest(Ze.DocumentRangesFormattingRequest.type,v,g).then(_=>g.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(_,g),_=>u.handleFailedRequest(Ze.DocumentRangesFormattingRequest.type,g,_,null))},h=u.middleware;return h.provideDocumentRangesFormattingEdits?h.provideDocumentRangesFormattingEdits(i,s,o,a,l):l(i,s,o,a)}),[br.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};qe.DocumentRangeFormattingFeature=la;var da=class extends jt.TextDocumentLanguageFeature{constructor(e){super(e,Ze.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(e){(0,jt.ensure)((0,jt.ensure)(e,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentOnTypeFormattingProvider);n&&this.register({id:fa.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideOnTypeFormattingEdits:(s,o,a,u,l)=>{let h=this._client,p=(m,g,v,_,T)=>{let C={textDocument:h.code2ProtocolConverter.asTextDocumentIdentifier(m),position:h.code2ProtocolConverter.asPosition(g),ch:v,options:h.code2ProtocolConverter.asFormattingOptions(_,kn.fromConfiguration(m))};return h.sendRequest(Ze.DocumentOnTypeFormattingRequest.type,C,T).then(D=>T.isCancellationRequested?null:h.protocol2CodeConverter.asTextEdits(D,T),D=>h.handleFailedRequest(Ze.DocumentOnTypeFormattingRequest.type,T,D,null))},f=h.middleware;return f.provideOnTypeFormattingEdits?f.provideOnTypeFormattingEdits(s,o,a,u,l,p):p(s,o,a,u,l)}},i=e.moreTriggerCharacter||[];return[br.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.firstTriggerCharacter,...i),n]}};qe.DocumentOnTypeFormattingFeature=da});var sl=M(pt=>{"use strict";var Ig=pt&&pt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ag=pt&&pt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),rl=pt&&pt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Ig(t,e,n[i]);return Ag(t,e),t}})();Object.defineProperty(pt,"__esModule",{value:!0});pt.RenameFeature=void 0;var jg=I("vscode"),dn=N(),Lg=rl(ne()),il=rl(He()),ha=B(),pa=class extends ha.TextDocumentLanguageFeature{constructor(e){super(e,dn.RenameRequest.type)}fillClientCapabilities(e){let t=(0,ha.ensure)((0,ha.ensure)(e,"textDocument"),"rename");t.dynamicRegistration=!0,t.prepareSupport=!0,t.prepareSupportDefaultBehavior=dn.PrepareSupportDefaultBehavior.Identifier,t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.renameProvider);n&&(il.boolean(e.renameProvider)&&(n.prepareProvider=!1),this.register({id:Lg.generateUuid(),registerOptions:n}))}registerLanguageProvider(e){let t=e.documentSelector,n={provideRenameEdits:(i,s,o,a)=>{let u=this._client,l=async(p,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),position:u.code2ProtocolConverter.asPosition(f),newName:m},_=null;try{_=await u.sendRequest(dn.RenameRequest.type,v,g)}catch(C){return u.handleFailedRequest(dn.RenameRequest.type,g,C,null,!1)}if(g.isCancellationRequested||_===null)return null;let T=await u.protocol2CodeConverter.asWorkspaceEdit(_,g);if(g.isCancellationRequested)return null;if(!u.validateWorkspaceEdit(_))throw new Error("The rename edit returned from the server is not valid anymore and cannot be applied.");return T},h=u.middleware;return h.provideRenameEdits?h.provideRenameEdits(i,s,o,a,l):l(i,s,o,a)},prepareRename:e.prepareProvider?(i,s,o)=>{let a=this._client,u=(h,p,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(h),position:a.code2ProtocolConverter.asPosition(p)};return a.sendRequest(dn.PrepareRenameRequest.type,m,f).then(g=>f.isCancellationRequested?null:dn.Range.is(g)?a.protocol2CodeConverter.asRange(g):this.isDefaultBehavior(g)?g.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):g&&dn.Range.is(g.range)?{range:a.protocol2CodeConverter.asRange(g.range),placeholder:g.placeholder}:Promise.reject(new Error("The element can't be renamed.")),g=>{throw typeof g.message=="string"?new Error(g.message):new Error("The element can't be renamed.")})},l=a.middleware;return l.prepareRename?l.prepareRename(i,s,o,u):u(i,s,o)}:void 0};return[this.registerProvider(t,n),n]}registerProvider(e,t){return jg.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}isDefaultBehavior(e){let t=e;return t&&il.boolean(t.defaultBehavior)}};pt.RenameFeature=pa});var ol=M(gt=>{"use strict";var Ng=gt&&gt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ug=gt&&gt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Kg=gt&&gt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Ng(t,e,n[i]);return Ug(t,e),t}})();Object.defineProperty(gt,"__esModule",{value:!0});gt.DocumentLinkFeature=void 0;var Hg=I("vscode"),mi=N(),ga=B(),Wg=Kg(ne()),ma=class extends ga.TextDocumentLanguageFeature{constructor(e){super(e,mi.DocumentLinkRequest.type)}fillClientCapabilities(e){let t=(0,ga.ensure)((0,ga.ensure)(e,"textDocument"),"documentLink");t.dynamicRegistration=!0,t.tooltipSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentLinkProvider);n&&this.register({id:Wg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentLinks:(i,s)=>{let o=this._client,a=(l,h)=>o.sendRequest(mi.DocumentLinkRequest.type,o.code2ProtocolConverter.asDocumentLinkParams(l),h).then(p=>h.isCancellationRequested?null:o.protocol2CodeConverter.asDocumentLinks(p,h),p=>o.handleFailedRequest(mi.DocumentLinkRequest.type,h,p,null)),u=o.middleware;return u.provideDocumentLinks?u.provideDocumentLinks(i,s,a):a(i,s)},resolveDocumentLink:e.resolveProvider?(i,s)=>{let o=this._client,a=(l,h)=>o.sendRequest(mi.DocumentLinkResolveRequest.type,o.code2ProtocolConverter.asDocumentLink(l),h).then(p=>h.isCancellationRequested?l:o.protocol2CodeConverter.asDocumentLink(p),p=>o.handleFailedRequest(mi.DocumentLinkResolveRequest.type,h,p,l)),u=o.middleware;return u.resolveDocumentLink?u.resolveDocumentLink(i,s,a):a(i,s)}:void 0};return[Hg.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};gt.DocumentLinkFeature=ma});var cl=M(mt=>{"use strict";var $g=mt&&mt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Bg=mt&&mt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),zg=mt&&mt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&$g(t,e,n[i]);return Bg(t,e),t}})();Object.defineProperty(mt,"__esModule",{value:!0});mt.ExecuteCommandFeature=void 0;var Vg=I("vscode"),va=N(),Gg=zg(ne()),al=B(),ya=class{_client;_commands;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 va.ExecuteCommandRequest.type}fillClientCapabilities(e){(0,al.ensure)((0,al.ensure)(e,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(e){e.executeCommandProvider&&this.register({id:Gg.generateUuid(),registerOptions:Object.assign({},e.executeCommandProvider)})}register(e){let t=this._client,n=t.middleware,i=(s,o)=>{let a={command:s,arguments:o};return t.sendRequest(va.ExecuteCommandRequest.type,a).then(void 0,u=>t.handleFailedRequest(va.ExecuteCommandRequest.type,void 0,u,void 0))};if(e.registerOptions.commands){let s=[];for(let o of e.registerOptions.commands)s.push(Vg.commands.registerCommand(o,(...a)=>n.executeCommand?n.executeCommand(o,a,i):i(o,a)));this._commands.set(e.id,s)}}unregister(e){let t=this._commands.get(e);t&&(this._commands.delete(e),t.forEach(n=>n.dispose()))}clear(){this._commands.forEach(e=>{e.forEach(t=>t.dispose())}),this._commands.clear()}};mt.ExecuteCommandFeature=ya});var ll=M(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.FoldingRangeFeature=void 0;var ul=I("vscode"),fn=N(),vi=B(),_a=class extends vi.TextDocumentLanguageFeature{constructor(e){super(e,fn.FoldingRangeRequest.type)}fillClientCapabilities(e){let t=(0,vi.ensure)((0,vi.ensure)(e,"textDocument"),"foldingRange");t.dynamicRegistration=!0,t.rangeLimit=5e3,t.lineFoldingOnly=!0,t.foldingRangeKind={valueSet:[fn.FoldingRangeKind.Comment,fn.FoldingRangeKind.Imports,fn.FoldingRangeKind.Region]},t.foldingRange={collapsedText:!1},(0,vi.ensure)((0,vi.ensure)(e,"workspace"),"foldingRange").refreshSupport=!0}initialize(e,t){this._client.onRequest(fn.FoldingRangeRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 ul.EventEmitter,i={onDidChangeFoldingRanges:n.event,provideFoldingRanges:(s,o,a)=>{let u=this._client,l=(p,f,m)=>{let g={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p)};return u.sendRequest(fn.FoldingRangeRequest.type,g,m).then(v=>m.isCancellationRequested?null:u.protocol2CodeConverter.asFoldingRanges(v,m),v=>u.handleFailedRequest(fn.FoldingRangeRequest.type,m,v,null))},h=u.middleware;return h.provideFoldingRanges?h.provideFoldingRanges(s,o,a,l):l(s,o,a)}};return[ul.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeFoldingRange:n}]}};Sr.FoldingRangeFeature=_a});var dl=M(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.DeclarationFeature=void 0;var Jg=I("vscode"),wa=N(),Ca=B(),ba=class extends Ca.TextDocumentLanguageFeature{constructor(e){super(e,wa.DeclarationRequest.type)}fillClientCapabilities(e){let t=(0,Ca.ensure)((0,Ca.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,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(wa.DeclarationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDeclarationResult(m,f),m=>a.handleFailedRequest(wa.DeclarationRequest.type,f,m,null)),l=a.middleware;return l.provideDeclaration?l.provideDeclaration(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Jg.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Dr.DeclarationFeature=ba});var fl=M(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.SelectionRangeFeature=void 0;var Yg=I("vscode"),Sa=N(),Da=B(),Pa=class extends Da.TextDocumentLanguageFeature{constructor(e){super(e,Sa.SelectionRangeRequest.type)}fillClientCapabilities(e){let t=(0,Da.ensure)((0,Da.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,s,o)=>{let a=this._client,u=async(h,p,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(h),positions:a.code2ProtocolConverter.asPositionsSync(p,f)};return a.sendRequest(Sa.SelectionRangeRequest.type,m,f).then(g=>f.isCancellationRequested?null:a.protocol2CodeConverter.asSelectionRanges(g,f),g=>a.handleFailedRequest(Sa.SelectionRangeRequest.type,f,g,null))},l=a.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Yg.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Pr.SelectionRangeFeature=Pa});var hl=M(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.CallHierarchyFeature=void 0;var Qg=I("vscode"),hn=N(),Ta=B(),Oa=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareCallHierarchy(e,t,n){let i=this.client,s=this.middleware,o=(a,u,l)=>{let h=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(hn.CallHierarchyPrepareRequest.type,h,l).then(p=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(p,l),p=>i.handleFailedRequest(hn.CallHierarchyPrepareRequest.type,l,p,null))};return s.prepareCallHierarchy?s.prepareCallHierarchy(e,t,n,o):o(e,t,n)}provideCallHierarchyIncomingCalls(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(hn.CallHierarchyIncomingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,a),l=>n.handleFailedRequest(hn.CallHierarchyIncomingCallsRequest.type,a,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(e,t,s):s(e,t)}provideCallHierarchyOutgoingCalls(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(hn.CallHierarchyOutgoingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,a),l=>n.handleFailedRequest(hn.CallHierarchyOutgoingCallsRequest.type,a,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(e,t,s):s(e,t)}},Ra=class extends Ta.TextDocumentLanguageFeature{constructor(e){super(e,hn.CallHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=e,n=(0,Ta.ensure)((0,Ta.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 Oa(t);return[Qg.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Tr.CallHierarchyFeature=Ra});var gl=M(vt=>{"use strict";var Zg=vt&&vt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Xg=vt&&vt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),pl=vt&&vt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Zg(t,e,n[i]);return Xg(t,e),t}})();Object.defineProperty(vt,"__esModule",{value:!0});vt.SemanticTokensFeature=void 0;var Or=pl(I("vscode")),U=N(),yi=B(),em=pl(He()),Fa=class extends yi.TextDocumentLanguageFeature{constructor(e){super(e,U.SemanticTokensRegistrationType.type)}fillClientCapabilities(e){let t=(0,yi.ensure)((0,yi.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.comment,U.SemanticTokenTypes.string,U.SemanticTokenTypes.number,U.SemanticTokenTypes.regexp,U.SemanticTokenTypes.operator,U.SemanticTokenTypes.decorator,U.SemanticTokenTypes.label],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,yi.ensure)((0,yi.ensure)(e,"workspace"),"semanticTokens").refreshSupport=!0}initialize(e,t){this._client.onRequest(U.SemanticTokensRefreshRequest.type,async()=>{for(let o of this.getAllProviders())o.onDidChangeSemanticTokensEmitter.fire()});let[i,s]=this.getRegistration(t,e.semanticTokensProvider);!i||!s||this.register({id:i,registerOptions:s})}registerLanguageProvider(e){let t=e.documentSelector,n=em.boolean(e.full)?e.full:e.full!==void 0,i=e.full!==void 0&&typeof e.full!="boolean"&&e.full.delta===!0,s=new Or.EventEmitter,o=n?{onDidChangeSemanticTokens:s.event,provideDocumentSemanticTokens:(m,g)=>{let v=this._client,_=v.middleware,T=(C,D)=>{let F={textDocument:v.code2ProtocolConverter.asTextDocumentIdentifier(C)};return v.sendRequest(U.SemanticTokensRequest.type,F,D).then(E=>D.isCancellationRequested?null:v.protocol2CodeConverter.asSemanticTokens(E,D),E=>v.handleFailedRequest(U.SemanticTokensRequest.type,D,E,null))};return _.provideDocumentSemanticTokens?_.provideDocumentSemanticTokens(m,g,T):T(m,g)},provideDocumentSemanticTokensEdits:i?(m,g,v)=>{let _=this._client,T=_.middleware,C=(D,F,E)=>{let Q={textDocument:_.code2ProtocolConverter.asTextDocumentIdentifier(D),previousResultId:F};return _.sendRequest(U.SemanticTokensDeltaRequest.type,Q,E).then(async we=>E.isCancellationRequested?null:U.SemanticTokens.is(we)?await _.protocol2CodeConverter.asSemanticTokens(we,E):await _.protocol2CodeConverter.asSemanticTokensEdits(we,E),we=>_.handleFailedRequest(U.SemanticTokensDeltaRequest.type,E,we,null))};return T.provideDocumentSemanticTokensEdits?T.provideDocumentSemanticTokensEdits(m,g,v,C):C(m,g,v)}:void 0}:void 0,u=e.range===!0?{onDidChangeSemanticTokens:s.event,provideDocumentRangeSemanticTokens:(m,g,v)=>{let _=this._client,T=_.middleware,C=(D,F,E)=>{let Q={textDocument:_.code2ProtocolConverter.asTextDocumentIdentifier(D),range:_.code2ProtocolConverter.asRange(F)};return _.sendRequest(U.SemanticTokensRangeRequest.type,Q,E).then(we=>E.isCancellationRequested?null:_.protocol2CodeConverter.asSemanticTokens(we,E),we=>_.handleFailedRequest(U.SemanticTokensRangeRequest.type,E,we,null))};return T.provideDocumentRangeSemanticTokens?T.provideDocumentRangeSemanticTokens(m,g,v,C):C(m,g,v)}}:void 0,l=[],h=this._client,p=h.protocol2CodeConverter.asSemanticTokensLegend(e.legend),f=h.protocol2CodeConverter.asDocumentSelector(t);return o!==void 0&&l.push(Or.languages.registerDocumentSemanticTokensProvider(f,o,p)),u!==void 0&&l.push(Or.languages.registerDocumentRangeSemanticTokensProvider(f,u,p)),[new Or.Disposable(()=>l.forEach(m=>m.dispose())),{range:u,full:o,onDidChangeSemanticTokensEmitter:s}]}};vt.SemanticTokensFeature=Fa});var vl=M(yt=>{"use strict";var tm=yt&&yt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),nm=yt&&yt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ml=yt&&yt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&tm(t,e,n[i]);return nm(t,e),t}})();Object.defineProperty(yt,"__esModule",{value:!0});yt.LinkedEditingFeature=void 0;var im=ml(I("vscode")),xa=ml(N()),Ma=B(),ka=class extends Ma.TextDocumentLanguageFeature{constructor(e){super(e,xa.LinkedEditingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Ma.ensure)((0,Ma.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,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(xa.LinkedEditingRangeRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asLinkedEditingRanges(m,f),m=>a.handleFailedRequest(xa.LinkedEditingRangeRequest.type,f,m,null)),l=a.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return im.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};yt.LinkedEditingFeature=ka});var yl=M(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.TypeHierarchyFeature=void 0;var rm=I("vscode"),pn=N(),Ea=B(),qa=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareTypeHierarchy(e,t,n){let i=this.client,s=this.middleware,o=(a,u,l)=>{let h=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(pn.TypeHierarchyPrepareRequest.type,h,l).then(p=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(p,l),p=>i.handleFailedRequest(pn.TypeHierarchyPrepareRequest.type,l,p,null))};return s.prepareTypeHierarchy?s.prepareTypeHierarchy(e,t,n,o):o(e,t,n)}provideTypeHierarchySupertypes(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(pn.TypeHierarchySupertypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>n.handleFailedRequest(pn.TypeHierarchySupertypesRequest.type,a,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(e,t,s):s(e,t)}provideTypeHierarchySubtypes(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(pn.TypeHierarchySubtypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>n.handleFailedRequest(pn.TypeHierarchySubtypesRequest.type,a,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(e,t,s):s(e,t)}},Ia=class extends Ea.TextDocumentLanguageFeature{constructor(e){super(e,pn.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=(0,Ea.ensure)((0,Ea.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 qa(t);return[rm.languages.registerTypeHierarchyProvider(t.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Rr.TypeHierarchyFeature=Ia});var wl=M(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.InlineValueFeature=void 0;var _l=I("vscode"),Fr=N(),_i=B(),Aa=class extends _i.TextDocumentLanguageFeature{constructor(e){super(e,Fr.InlineValueRequest.type)}fillClientCapabilities(e){(0,_i.ensure)((0,_i.ensure)(e,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,_i.ensure)((0,_i.ensure)(e,"workspace"),"inlineValue").refreshSupport=!0}initialize(e,t){this._client.onRequest(Fr.InlineValueRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 _l.EventEmitter,i={onDidChangeInlineValues:n.event,provideInlineValues:(s,o,a,u)=>{let l=this._client,h=(f,m,g,v)=>{let _={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(f),range:l.code2ProtocolConverter.asRange(m),context:l.code2ProtocolConverter.asInlineValueContext(g)};return l.sendRequest(Fr.InlineValueRequest.type,_,v).then(T=>v.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(T,v),T=>l.handleFailedRequest(Fr.InlineValueRequest.type,v,T,null))},p=l.middleware;return p.provideInlineValues?p.provideInlineValues(s,o,a,u,h):h(s,o,a,u)}};return[this.registerProvider(t,i),{provider:i,onDidChangeInlineValues:n}]}registerProvider(e,t){return _l.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};xr.InlineValueFeature=Aa});var bl=M(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.InlayHintsFeature=void 0;var Cl=I("vscode"),En=N(),wi=B(),ja=class extends wi.TextDocumentLanguageFeature{constructor(e){super(e,En.InlayHintRequest.type)}fillClientCapabilities(e){let t=(0,wi.ensure)((0,wi.ensure)(e,"textDocument"),"inlayHint");t.dynamicRegistration=!0,t.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,wi.ensure)((0,wi.ensure)(e,"workspace"),"inlayHint").refreshSupport=!0}initialize(e,t){this._client.onRequest(En.InlayHintRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 Cl.EventEmitter,i={onDidChangeInlayHints:n.event,provideInlayHints:(s,o,a)=>{let u=this._client,l=async(p,f,m)=>{let g={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),range:u.code2ProtocolConverter.asRange(f)};try{let v=await u.sendRequest(En.InlayHintRequest.type,g,m);return m.isCancellationRequested?null:u.protocol2CodeConverter.asInlayHints(v,m)}catch(v){return u.handleFailedRequest(En.InlayHintRequest.type,m,v,null)}},h=u.middleware;return h.provideInlayHints?h.provideInlayHints(s,o,a,l):l(s,o,a)}};return i.resolveInlayHint=e.resolveProvider===!0?(s,o)=>{let a=this._client,u=async(h,p)=>{try{let f=await a.sendRequest(En.InlayHintResolveRequest.type,a.code2ProtocolConverter.asInlayHint(h),p);if(p.isCancellationRequested)return null;let m=a.protocol2CodeConverter.asInlayHint(f,p);return p.isCancellationRequested?null:m}catch(f){return a.handleFailedRequest(En.InlayHintResolveRequest.type,p,f,null)}},l=a.middleware;return l.resolveInlayHint?l.resolveInlayHint(s,o,u):u(s,o)}:void 0,[this.registerProvider(t,i),{provider:i,onDidChangeInlayHints:n}]}registerProvider(e,t){return Cl.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Mr.InlayHintsFeature=ja});var Sl=M(Xe=>{"use strict";var sm=Xe&&Xe.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),om=Xe&&Xe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),am=Xe&&Xe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&sm(t,e,n[i]);return om(t,e),t}})();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.WorkspaceFoldersFeature=void 0;Xe.arrayDiff=Na;var cm=am(ne()),kr=I("vscode"),Ci=N();function La(r,e){if(r!=null)return r[e]}function Na(r,e){return r.filter(t=>e.indexOf(t)<0)}var Ua=class{_client;_listeners;_initialFolders;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 Ci.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(e){let t=kr.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(Ci.WorkspaceFoldersRequest.type,s=>{let o=()=>{let u=kr.workspace.workspaceFolders;return u===void 0?null:u.map(h=>this.asProtocol(h))},a=t.middleware.workspace;return a&&a.workspaceFolders?a.workspaceFolders(s,o):o(s)});let n=La(La(La(e,"workspace"),"workspaceFolders"),"changeNotifications"),i;typeof n=="string"?i=n:n===!0&&(i=cm.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(e){let t;if(this._initialFolders&&e){let n=Na(this._initialFolders,e),i=Na(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 ${Ci.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(Ci.DidChangeWorkspaceFoldersNotification.type,n)}register(e){let t=e.id,n=this._client,i=kr.workspace.onDidChangeWorkspaceFolders(s=>{let o=l=>this.doSendEvent(l.added,l.removed),a=n.middleware.workspace;(a&&a.didChangeWorkspaceFolders?a.didChangeWorkspaceFolders(s,o):o(s)).catch(l=>{this._client.error(`Sending notification ${Ci.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(t,i),this.sendInitialEvent(kr.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}}};Xe.WorkspaceFoldersFeature=Ua});var Tl=M(ye=>{"use strict";var um=ye&&ye.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),lm=ye&&ye.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ir=ye&&ye.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&um(t,e,n[i]);return lm(t,e),t}})();Object.defineProperty(ye,"__esModule",{value:!0});ye.WillDeleteFilesFeature=ye.WillRenameFilesFeature=ye.WillCreateFilesFeature=ye.DidDeleteFilesFeature=ye.DidRenameFilesFeature=ye.DidCreateFilesFeature=void 0;var ze=Ir(I("vscode")),dm=Ir(lo()),Lt=Ir(N()),fm=Ir(ne());function Dl(r,e){return r[e]===void 0&&(r[e]={}),r[e]}function hm(r,e){return r[e]}function Pl(r,e,t){r[e]=t}var bi=class r{_client;_event;_registrationType;_clientCapability;_serverCapability;_listener;_filters;constructor(e,t,n,i,s){this._client=e,this._event=t,this._registrationType=n,this._clientCapability=i,this._serverCapability=s,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=Dl(Dl(e,"workspace"),"fileOperations");Pl(t,"dynamicRegistration",!0),Pl(t,this._clientCapability,!0)}initialize(e){let t=e.workspace?.fileOperations,n=t!==void 0?hm(t,this._serverCapability):void 0;if(n?.filters!==void 0)try{this.register({id:fm.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 dm.Minimatch(n.pattern.glob,r.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 r.getFileType(e)}async filter(e,t){let n=await Promise.all(e.files.map(async s=>{let o=t(s),a=o.fsPath.replace(/\\/g,"/");for(let u of this._filters.values())for(let l of u)if(!(l.scheme!==void 0&&l.scheme!==o.scheme)){if(l.matcher.match(a)){if(l.kind===void 0)return!0;let h=await this.getFileType(o);if(h===void 0)return this._client.info(`Unable to determine file type for ${o.toString()}. Treating as a match.`),!0;if(h===ze.FileType.File&&l.kind===Lt.FileOperationPatternKind.file||h===ze.FileType.Directory&&l.kind===Lt.FileOperationPatternKind.folder)return!0}else if(l.kind===Lt.FileOperationPatternKind.folder&&await r.getFileType(o)===ze.FileType.Directory&&l.matcher.match(`${a}/`))return!0}return!1})),i=e.files.filter((s,o)=>n[o]);return{...e,files:i}}static async getFileType(e){try{return(await ze.workspace.fs.stat(e)).type}catch{return}}static asMinimatchOptions(e){let t={dot:!0};return e?.ignoreCase===!0&&(t.nocase=!0),t}},Er=class extends bi{_notificationType;_accessUri;_createParams;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s),this._notificationType=n,this._accessUri=o,this._createParams=a}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)}}},qr=class extends Er{_willListener;_fsPathFileTypes=new Map;async getFileType(e){let t=e.fsPath;if(this._fsPathFileTypes.has(t))return this._fsPathFileTypes.get(t);let n=await bi.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)}},Ka=class extends Er{constructor(e){super(e,ze.workspace.onDidCreateFiles,Lt.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)}};ye.DidCreateFilesFeature=Ka;var Ha=class extends qr{constructor(e){super(e,ze.workspace.onDidRenameFiles,Lt.DidRenameFilesNotification.type,"didRename","didRename",t=>t.oldUri,e.code2ProtocolConverter.asDidRenameFilesParams)}register(e){this._willListener||(this._willListener=ze.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)}};ye.DidRenameFilesFeature=Ha;var Wa=class extends qr{constructor(e){super(e,ze.workspace.onDidDeleteFiles,Lt.DidDeleteFilesNotification.type,"didDelete","didDelete",t=>t,e.code2ProtocolConverter.asDidDeleteFilesParams)}register(e){this._willListener||(this._willListener=ze.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)}};ye.DidDeleteFilesFeature=Wa;var Si=class extends bi{_requestType;_accessUri;_createParams;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s),this._requestType=n,this._accessUri=o,this._createParams=a}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}},$a=class extends Si{constructor(e){super(e,ze.workspace.onWillCreateFiles,Lt.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)}};ye.WillCreateFilesFeature=$a;var Ba=class extends Si{constructor(e){super(e,ze.workspace.onWillRenameFiles,Lt.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)}};ye.WillRenameFilesFeature=Ba;var za=class extends Si{constructor(e){super(e,ze.workspace.onWillDeleteFiles,Lt.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)}};ye.WillDeleteFilesFeature=za});var Ol=M(_t=>{"use strict";var pm=_t&&_t.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),gm=_t&&_t.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),mm=_t&&_t.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&pm(t,e,n[i]);return gm(t,e),t}})();Object.defineProperty(_t,"__esModule",{value:!0});_t.InlineCompletionItemFeature=void 0;var vm=I("vscode"),Va=N(),Ga=B(),ym=mm(ne()),Ja=class extends Ga.TextDocumentLanguageFeature{constructor(e){super(e,Va.InlineCompletionRequest.type)}fillClientCapabilities(e){let t=(0,Ga.ensure)((0,Ga.ensure)(e,"textDocument"),"inlineCompletion");t.dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.inlineCompletionProvider);n&&this.register({id:ym.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideInlineCompletionItems:(i,s,o,a)=>{let u=this._client,l=this._client.middleware,h=(p,f,m,g)=>u.sendRequest(Va.InlineCompletionRequest.type,u.code2ProtocolConverter.asInlineCompletionParams(p,f,m),g).then(v=>g.isCancellationRequested?null:u.protocol2CodeConverter.asInlineCompletionResult(v,g),v=>u.handleFailedRequest(Va.InlineCompletionRequest.type,g,v,null));return l.provideInlineCompletionItems?l.provideInlineCompletionItems(i,s,o,a,h):h(i,s,o,a)}};return[vm.languages.registerInlineCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};_t.InlineCompletionItemFeature=Ja});var xl=M(wt=>{"use strict";var _m=wt&&wt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),wm=wt&&wt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Fl=wt&&wt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&_m(t,e,n[i]);return wm(t,e),t}})();Object.defineProperty(wt,"__esModule",{value:!0});wt.TextDocumentContentFeature=void 0;var Ya=Fl(I("vscode")),qn=N(),Rl=B(),Cm=Fl(ne()),Qa=class{_client;_registrations=new Map;constructor(e){this._client=e}getState(){let e=this._registrations.size>0;return{kind:"workspace",id:qn.TextDocumentContentRequest.method,registrations:e}}get registrationType(){return qn.TextDocumentContentRequest.type}getProviders(){let e=[];for(let t of this._registrations.values())e.push(...t.providers);return e}fillClientCapabilities(e){let t=(0,Rl.ensure)((0,Rl.ensure)(e,"workspace"),"textDocumentContent");t.dynamicRegistration=!0}initialize(e){let t=this._client;if(t.onRequest(qn.TextDocumentContentRefreshRequest.type,async s=>{let o=t.protocol2CodeConverter.asUri(s.uri);for(let a of this._registrations.values())for(let u of a.providers)u.scheme===o.scheme&&u.onDidChangeEmitter.fire(o)}),!e?.workspace?.textDocumentContent)return;let n=e.workspace.textDocumentContent,i=qn.StaticRegistrationOptions.hasId(n)?n.id:Cm.generateUuid();this.register({id:i,registerOptions:n})}register(e){let t=[],n=[];for(let i of e.registerOptions.schemes){let[s,o]=this.registerTextDocumentContentProvider(i);t.push(o),n.push(s)}this._registrations.set(e.id,{disposable:Ya.Disposable.from(...n),providers:t})}registerTextDocumentContentProvider(e){let t=new Ya.EventEmitter,n={onDidChange:t.event,provideTextDocumentContent:(i,s)=>{let o=this._client,a=(l,h)=>{let p={uri:o.code2ProtocolConverter.asUri(l)};return o.sendRequest(qn.TextDocumentContentRequest.type,p,h).then(f=>h.isCancellationRequested?null:f.text,f=>o.handleFailedRequest(qn.TextDocumentContentRequest.type,h,f,null))},u=o.middleware;return u.provideTextDocumentContent?u.provideTextDocumentContent(i,s,a):a(i,s)}};return[Ya.workspace.registerTextDocumentContentProvider(e,n),{scheme:e,onDidChangeEmitter:t,provider:n}]}unregister(e){let t=this._registrations.get(e);t!==void 0&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}};wt.TextDocumentContentFeature=Qa});var Ml=M(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.FileSystemWatcherFeature=void 0;var bm=I("vscode"),gn=N(),Ar=B(),Za=class{_client;_notifyFileEvent;_watchers;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 gn.DidChangeWatchedFilesNotification.type}fillClientCapabilities(e){(0,Ar.ensure)((0,Ar.ensure)(e,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,Ar.ensure)((0,Ar.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 s=!0,o=!0,a=!0;n.kind!==void 0&&n.kind!==null&&(s=(n.kind&gn.WatchKind.Create)!==0,o=(n.kind&gn.WatchKind.Change)!==0,a=(n.kind&gn.WatchKind.Delete)!==0);let u=bm.workspace.createFileSystemWatcher(i,!s,!o,!a);this.hookListeners(u,s,o,a,t),t.push(u)}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,s){t&&e.onDidCreate(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:gn.FileChangeType.Created}),null,s),n&&e.onDidChange(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:gn.FileChangeType.Changed}),null,s),i&&e.onDidDelete(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:gn.FileChangeType.Deleted}),null,s)}unregister(e){let t=this._watchers.get(e);if(t){this._watchers.delete(e);for(let n of t)n.dispose()}}clear(){this._watchers.forEach(e=>{for(let t of e)t.dispose()}),this._watchers.clear()}};jr.FileSystemWatcherFeature=Za});var El=M(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.ProgressFeature=void 0;var kl=N(),Sm=Zs();function Dm(r,e){return r[e]===void 0&&(r[e]=Object.create(null)),r[e]}var Xa=class{_client;activeParts;constructor(e){this._client=e,this.activeParts=new Set}getState(){return{kind:"window",id:kl.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(e){Dm(e,"window").workDoneProgress=!0}initialize(){let e=this._client,t=i=>{this.activeParts.delete(i)},n=i=>{this.activeParts.add(new Sm.ProgressPart(this._client,i.token,t))};e.onRequest(kl.WorkDoneProgressCreateRequest.type,n)}clear(){for(let e of this.activeParts)e.done();this.activeParts.clear()}};Lr.ProgressFeature=Xa});var cc=M(Y=>{"use strict";var Pm=Y&&Y.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Tm=Y&&Y.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Kr=Y&&Y.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Pm(t,e,n[i]);return Tm(t,e),t}})();Object.defineProperty(Y,"__esModule",{value:!0});Y.ProposedFeatures=Y.LanguageClient=Y.BaseLanguageClient=Y.ShutdownMode=Y.MessageTransports=Y.SuspendMode=Y.State=Y.CloseAction=Y.ErrorAction=Y.RevealOutputChannelOn=void 0;var j=I("vscode"),S=N(),Om=Kr(Gc()),Rm=Kr(Qc()),et=Kr(He()),Nr=Zi(),ql=Kr(ne()),Fm=Zs(),Le=B(),xm=_o(),tc=Mu(),Il=qu(),In=Uu(),Mm=Ku(),km=Hu(),Em=Wu(),qm=Bu(),Im=zu(),Am=Vo(),jm=Gu(),Lm=Ju(),Nm=Yu(),Um=Qu(),Km=Zu(),Hm=Xu(),Wm=tl(),ec=nl(),$m=sl(),Bm=ol(),zm=cl(),Vm=ll(),Gm=dl(),Jm=fl(),Ym=hl(),Qm=gl(),Zm=vl(),Xm=yl(),ev=wl(),tv=bl(),nv=Sl(),An=Tl(),iv=Ol(),rv=xl(),sv=Ml(),ov=El(),mn;(function(r){r[r.Debug=0]="Debug",r[r.Info=1]="Info",r[r.Warn=2]="Warn",r[r.Error=3]="Error",r[r.Never=4]="Never"})(mn||(Y.RevealOutputChannelOn=mn={}));var Di;(function(r){r[r.Continue=1]="Continue",r[r.Shutdown=2]="Shutdown"})(Di||(Y.ErrorAction=Di={}));var Xt;(function(r){r[r.DoNotRestart=1]="DoNotRestart",r[r.Restart=2]="Restart"})(Xt||(Y.CloseAction=Xt={}));var jn;(function(r){r[r.Stopped=1]="Stopped",r[r.Starting=3]="Starting",r[r.StartFailed=4]="StartFailed",r[r.Running=2]="Running"})(jn||(Y.State=jn={}));var Al;(function(r){r.off="off",r.on="on"})(Al||(Y.SuspendMode=Al={}));var nc;(function(r){function e(t){return t==null?!1:typeof t=="boolean"||typeof t=="object"&&t!==null&&et.stringArray(t.enabledCommands)?t:!1}r.sanitizeIsTrusted=e})(nc||(nc={}));var ic=class{client;maxRestartCount;restarts;constructor(e,t){this.client=e,this.maxRestartCount=t,this.restarts=[]}error(e,t,n){return n&&n<=3?{action:Di.Continue}:{action:Di.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:Xt.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=180*1e3?{action:Xt.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:Xt.Restart})}},K;(function(r){r.Initial="initial",r.Starting="starting",r.StartFailed="startFailed",r.Running="running",r.Stopping="stopping",r.Stopped="stopped"})(K||(K={}));var jl;(function(r){function e(t){return t&&S.MessageReader.is(t.reader)&&S.MessageWriter.is(t.writer)}r.is=e})(jl||(Y.MessageTransports=jl={}));var Zt;(function(r){r.Restart="restart",r.Stop="stop"})(Zt||(Y.ShutdownMode=Zt={}));var rc=class r{open;_onOpen;_onClose;disposables;constructor(){this.disposables=[],this.open=new Set,this._onOpen=new j.EventEmitter,this._onClose=new j.EventEmitter,r.fillVisibleResources(this.open);let e=()=>{let t=this.open,n=new Set;r.fillVisibleResources(n);let i=new Set,s=new Set(n);for(let o of t.values())n.has(o)?s.delete(o):i.add(o);if(this.open=n,i.size>0){let o=new Set;for(let a of i)o.add(j.Uri.parse(a));this._onClose.fire(o)}if(s.size>0){let o=new Set;for(let a of s)o.add(j.Uri.parse(a));this._onOpen.fire(o)}};this.disposables.push(j.window.tabGroups.onDidChangeTabs(t=>{t.closed.length===0&&t.opened.length===0||e()})),this.disposables.push(j.window.onDidChangeVisibleTextEditors(t=>{e()}))}get onClose(){return this._onClose.event}get onOpen(){return this._onOpen.event}dispose(){this.disposables.forEach(e=>e.dispose())}isActive(e){return e instanceof j.Uri?j.window.activeTextEditor?.document.uri===e:j.window.activeTextEditor?.document===e}isVisible(e){let t=e instanceof j.Uri?e:e.uri;return t.scheme===tc.NotebookDocumentSyncFeature.CellScheme?j.workspace.notebookDocuments.some(n=>this.open.has(n.uri.toString())?n.getCells().find(s=>s.document.uri.toString()===t.toString())!==void 0:!1):this.open.has(t.toString())}getResources(){let e=new Set;return r.fillVisibleResources(new Set,e),e}static fillVisibleResources(e,t){let n=e??new Set;for(let i of j.window.tabGroups.all)for(let s of i.tabs){let o=s.input,a;o instanceof j.TabInputText?a=o.uri:o instanceof j.TabInputTextDiff?a=o.modified:(o instanceof j.TabInputCustom||o instanceof j.TabInputNotebook)&&(a=o.uri),a!==void 0&&!n.has(a.toString())&&(n.add(a.toString()),t!==void 0&&t.add(a))}for(let i of j.window.visibleTextEditors){let s=i.document.uri;n.has(s.toString())||(n.add(s.toString()),t!==void 0&&t.add(s))}}},Ur=class r{_id;_name;_clientOptions;_state;_onStart;_onStop;_connection;_idleInterval;_ignoredRegistrations;_listeners;_disposed;_notificationHandlers;_notificationDisposables;_pendingNotificationHandlers;_requestHandlers;_requestDisposables;_pendingRequestHandlers;_progressHandlers;_pendingProgressHandlers;_progressDisposables;_initializeResult;_outputChannel;_disposeOutputChannel;_traceOutputChannel;_traceLogLevel;_capabilities;_diagnostics;_syncedDocuments;_didChangeTextDocumentFeature;_inFlightOpenNotifications;_pendingChangeSemaphore;_pendingChangeDelayer;_didOpenTextDocumentFeature;_fileEvents;_fileEventDelayer;_telemetryEmitter;_stateChangeEmitter;_trace;_traceFormat=S.TraceFormat.Text;_tracer;_c2p;_p2c;_visibleDocuments;constructor(e,t,n){this._id=e,this._name=t,n=n||{};let i={isTrusted:!1,supportHtml:!1,supportThemeIcons:!1};n.markdown!==void 0&&(i.isTrusted=nc.sanitizeIsTrusted(n.markdown.isTrusted),i.supportHtml=n.markdown.supportHtml===!0,i.supportThemeIcons=n.markdown.supportThemeIcons===!0),this._clientOptions={documentSelector:n.documentSelector??[],synchronize:n.synchronize??{},diagnosticCollectionName:n.diagnosticCollectionName,outputChannelName:n.outputChannelName??this._name,revealOutputChannelOn:n.revealOutputChannelOn??mn.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??{},textSynchronization:this.createTextSynchronizationOptions(n.textSynchronization)},this._clientOptions.synchronize=this._clientOptions.synchronize||{},this._state=K.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._traceLogLevel=this._outputChannel.logLevel):(this._outputChannel=void 0,this._disposeOutputChannel=!0,this._traceLogLevel=j.LogLevel.Info),this._traceOutputChannel=n.traceOutputChannel,this._traceOutputChannel!==void 0&&(this._traceLogLevel=this._traceOutputChannel.logLevel),this._diagnostics=void 0,this._inFlightOpenNotifications=new Set,this._pendingChangeSemaphore=new Nr.Semaphore(1),this._pendingChangeDelayer=new Nr.Delayer(250),this._fileEvents=[],this._fileEventDelayer=new Nr.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new S.Emitter,this._stateChangeEmitter=new S.Emitter,this._trace=S.Trace.Off,this._tracer={log:(s,o)=>{et.string(s)?this.trace(s,o):this.traceObject(s)}},this._c2p=Om.createConverter(n.uriConverters?n.uriConverters.code2Protocol:void 0),this._p2c=Rm.createConverter(n.uriConverters?n.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml,this._clientOptions.markdown.supportThemeIcons),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}createTextSynchronizationOptions(e){return e?typeof e.delayOpenNotifications=="boolean"?{delayOpenNotifications:e.delayOpenNotifications}:{delayOpenNotifications:!1}:{delayOpenNotifications:!1}}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 visibleDocuments(){return this._visibleDocuments===void 0&&(this._visibleDocuments=new rc),this._visibleDocuments}get onTelemetry(){return this._telemetryEmitter.event}get onDidChangeState(){return this._stateChangeEmitter.event}get outputChannel(){return this._outputChannel||(this._outputChannel=j.window.createOutputChannel(this._clientOptions.outputChannelName?this._clientOptions.outputChannelName:this._name,{log:!0}),this._traceOutputChannel===void 0&&(this._traceLogLevel=this._outputChannel.logLevel)),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 K.Starting:return jn.Starting;case K.Running:return jn.Running;case K.StartFailed:return jn.StartFailed;default:return jn.Stopped}}get initializeResult(){return this._initializeResult}async sendRequest(e,...t){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.ErrorCodes.ConnectionInactive,"Client is not running"));let n=await this.$start();await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(),this._didChangeTextDocumentFeature.syncKind===S.TextDocumentSyncKind.Full&&await this.sendPendingFullTextDocumentChanges(n);let i,s;if(t.length===1?S.CancellationToken.is(t[0])?s=t[0]:i=t[0]:t.length===2&&(i=t[0],s=t[1]),s!==void 0&&s.isCancellationRequested)return Promise.reject(new S.ResponseError(S.LSPErrorCodes.RequestCancelled,"Request got cancelled"));let o=this._clientOptions.middleware?.sendRequest;return o!==void 0?o(e,i,s,(a,u,l)=>{let h=[];return u!==void 0&&h.push(u),l!==void 0&&h.push(l),n.sendRequest(a,...h)}):n.sendRequest(e,...t)}onRequest(e,t){let n=typeof e=="string"?e:e.method;this._requestHandlers.set(n,t);let i=this.activeConnection(),s;return i!==void 0?(this._requestDisposables.set(n,i.onRequest(e,t)),s={dispose:()=>{let o=this._requestDisposables.get(n);o!==void 0&&(o.dispose(),this._requestDisposables.delete(n))}}):(this._pendingRequestHandlers.set(n,t),s={dispose:()=>{this._pendingRequestHandlers.delete(n);let o=this._requestDisposables.get(n);o!==void 0&&(o.dispose(),this._requestDisposables.delete(n))}}),{dispose:()=>{this._requestHandlers.delete(n),s.dispose()}}}async sendNotification(e,t){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.ErrorCodes.ConnectionInactive,"Client is not running"));let n=this._didChangeTextDocumentFeature.syncKind===S.TextDocumentSyncKind.Full,i;n&&typeof e!="string"&&e.method===S.DidOpenTextDocumentNotification.method&&(i=t?.textDocument.uri,this._inFlightOpenNotifications.add(i));let s;typeof e!="string"&&e.method===S.DidCloseTextDocumentNotification.method&&(s=t.textDocument.uri);let o=await this.$start();if(await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(s))return;n&&await this.sendPendingFullTextDocumentChanges(o),i!==void 0&&this._inFlightOpenNotifications.delete(i);let u=this._clientOptions.middleware?.sendNotification;return u?u(e,o.sendNotification.bind(o),t):o.sendNotification(e,t)}onNotification(e,t){let n=typeof e=="string"?e:e.method;this._notificationHandlers.set(n,t);let i=this.activeConnection(),s;return i!==void 0?(this._notificationDisposables.set(n,i.onNotification(e,t)),s={dispose:()=>{let o=this._notificationDisposables.get(n);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(n))}}):(this._pendingNotificationHandlers.set(n,t),s={dispose:()=>{this._pendingNotificationHandlers.delete(n);let o=this._notificationDisposables.get(n);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(n))}}),{dispose:()=>{this._notificationHandlers.delete(n),s.dispose()}}}async sendProgress(e,t,n){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.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(),s,o=this._clientOptions.middleware?.handleWorkDoneProgress,a=S.WorkDoneProgress.is(e)&&o!==void 0?u=>{o(t,u,()=>n(u))}:n;return i!==void 0?(this._progressDisposables.set(t,i.onProgress(e,t,a)),s={dispose:()=>{let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}):(this._pendingProgressHandlers.set(t,{type:e,handler:n}),s={dispose:()=>{this._pendingProgressHandlers.delete(t);let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}),{dispose:()=>{this._progressHandlers.delete(t),s.dispose()}}}createDefaultErrorHandler(e){if(e!==void 0&&e<0)throw new Error(`Invalid maxRestartCount: ${e}`);return new ic(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 S.ResponseError){let t=e;return` Message: ${t.message}
7
+ `,n=e.whitespace?" = ":"=",i=[],s=e.sort?Object.keys(r).sort():Object.keys(r),o=0;e.align&&(o=Tt(s.filter(l=>r[l]===null||Array.isArray(r[l])||typeof r[l]!="object").map(l=>Array.isArray(r[l])?`${l}[]`:l).concat([""]).reduce((l,h)=>Tt(l).length>=Tt(h).length?l:h)).length);let a="",u=e.bracketedArray?"[]":"";for(let l of s){let h=r[l];if(h&&Array.isArray(h))for(let p of h)a+=Tt(`${l}${u}`).padEnd(o," ")+n+Tt(p)+t;else h&&typeof h=="object"?i.push(l):a+=Tt(l).padEnd(o," ")+n+Tt(h)+t}e.section&&a.length&&(a="["+Tt(e.section)+"]"+(e.newline?t+t:t)+a);for(let l of i){let h=qc(l,".").join("\\."),p=(e.section?e.section+".":"")+h,f=Ss(r[l],{...e,section:p});a.length&&f.length&&(a+=t),a+=f}return a};function qc(r,e){var t=0,n=0,i=0,s=[];do if(i=r.indexOf(e,t),i!==-1){if(t=i+e.length,i>0&&r[i-1]==="\\")continue;s.push(r.slice(n,i)),n=i+e.length}while(i!==-1);return s.push(r.slice(n)),s}var Ec=(r,e={})=>{e.bracketedArray=e.bracketedArray!==!1;let t=Object.create(null),n=t,i=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=r.split(/[\r\n]+/g),a={};for(let l of o){if(!l||l.match(/^\s*[;#]/)||l.match(/^\s*$/))continue;let h=l.match(s);if(!h)continue;if(h[1]!==void 0){if(i=Ji(h[1]),i==="__proto__"){n=Object.create(null);continue}n=t[i]=t[i]||Object.create(null);continue}let p=Ji(h[2]),f;e.bracketedArray?f=p.length>2&&p.slice(-2)==="[]":(a[p]=(a?.[p]||0)+1,f=a[p]>1);let m=f&&p.endsWith("[]")?p.slice(0,-2):p;if(m==="__proto__")continue;let g=h[3]?Ji(h[4]):!0,v=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;f&&(bs.call(n,m)?Array.isArray(n[m])||(n[m]=[n[m]]):n[m]=[]),Array.isArray(n[m])?n[m].push(v):n[m]=v}let u=[];for(let l of Object.keys(t)){if(!bs.call(t,l)||typeof t[l]!="object"||Array.isArray(t[l]))continue;let h=qc(l,".");n=t;let p=h.pop(),f=p.replace(/\\\./g,".");for(let m of h)m!=="__proto__"&&((!bs.call(n,m)||typeof n[m]!="object")&&(n[m]=Object.create(null)),n=n[m]);n===t&&f===p||(n[f]=t[l],u.push(l))}for(let l of u)delete t[l];return t},Ic=r=>r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"),Tt=r=>typeof r!="string"||r.match(/[=\r\n]/)||r.match(/^\[/)||r.length>1&&Ic(r)||r!==r.trim()?JSON.stringify(r):r.split(";").join("\\;").split("#").join("\\#"),Ji=r=>{if(r=(r||"").trim(),Ic(r)){r.charAt(0)==="'"&&(r=r.slice(1,-1));try{r=JSON.parse(r)}catch{}}else{let e=!1,t="";for(let n=0,i=r.length;n<i;n++){let s=r.charAt(n);if(e)"\\;#".indexOf(s)!==-1?t+=s:t+="\\"+s,e=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?e=!0:t+=s}}return e&&(t+="\\"),t.trim()}return r};Ac.exports={parse:Ec,decode:Ec,stringify:Ss,encode:Ss,safe:Tt,unsafe:Ji}});var We=M(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.boolean=Td;He.string=Nc;He.number=Od;He.error=Rd;He.func=Uc;He.array=Kc;He.stringArray=Fd;He.typedArray=xd;He.thenable=Hc;He.asPromise=Md;function Td(r){return r===!0||r===!1}function Nc(r){return typeof r=="string"||r instanceof String}function Od(r){return typeof r=="number"||r instanceof Number}function Rd(r){return r instanceof Error}function Uc(r){return typeof r=="function"}function Kc(r){return Array.isArray(r)}function Fd(r){return Kc(r)&&r.every(e=>Nc(e))}function xd(r,e){return Array.isArray(r)&&r.every(e)}function Hc(r){return r&&Uc(r.then)}function Md(r){return r instanceof Promise?r:Hc(r)?new Promise((e,t)=>{r.then(n=>e(n),n=>t(n))}):Promise.resolve(r)}});var Xi=M(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.Semaphore=Je.Delayer=void 0;Je.setTestMode=kd;Je.clearTestMode=Ed;Je.map=qd;Je.mapAsync=Id;Je.forEach=Ad;var ii=N(),Rs=class{defaultDelay;timeout;completionPromise;onSuccess;task;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;let n=this.task();return this.task=void 0,n})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,ii.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)}};Je.Delayer=Rs;var Fs=class{_capacity;_active;_waiting;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,ii.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()}}};Je.Semaphore=Fs;var xs=!1;function kd(){xs=!0}function Ed(){xs=!1}var Wc=15,ni=class{yieldAfter;startTime;counter;total;counterInterval;constructor(e=Wc){this.yieldAfter=xs===!0?Math.max(e,2):Math.max(e,Wc),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 qd(r,e,t,n){if(r.length===0)return[];let i=new Array(r.length),s=new ni(n?.yieldAfter);function o(u){s.start();for(let l=u;l<r.length;l++)if(i[l]=e(r[l]),s.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let a=o(0);for(;a!==-1&&!(t!==void 0&&t.isCancellationRequested);)a=await new Promise(u=>{(0,ii.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function Id(r,e,t,n){if(r.length===0)return[];let i=new Array(r.length),s=new ni(n?.yieldAfter);async function o(u){s.start();for(let l=u;l<r.length;l++)if(i[l]=await e(r[l],t),s.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let a=await o(0);for(;a!==-1&&!(t!==void 0&&t.isCancellationRequested);)a=await new Promise(u=>{(0,ii.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function Ad(r,e,t,n){if(r.length===0)return;let i=new ni(n?.yieldAfter);function s(a){i.start();for(let u=a;u<r.length;u++)if(e(r[u]),i.shouldYield())return n?.yieldCallback&&n.yieldCallback(),u+1;return-1}let o=s(0);for(;o!==-1&&!(t!==void 0&&t.isCancellationRequested);)o=await new Promise(a=>{(0,ii.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?a(-1):a(s(o))})})}});var ks=M(Ot=>{"use strict";var jd=Ot&&Ot.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ld=Ot&&Ot.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Nd=Ot&&Ot.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&jd(t,e,n[i]);return Ld(t,e),t}})();Object.defineProperty(Ot,"__esModule",{value:!0});var Ud=Nd(I("vscode")),Ms=class extends Ud.CompletionItem{data;fromEdit;documentationFormat;originalItemKind;deprecated;insertTextMode;constructor(e){super(e)}};Ot.default=Ms});var qs=M(Rt=>{"use strict";var Kd=Rt&&Rt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Hd=Rt&&Rt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Wd=Rt&&Rt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Kd(t,e,n[i]);return Hd(t,e),t}})();Object.defineProperty(Rt,"__esModule",{value:!0});var $d=Wd(I("vscode")),Es=class extends $d.CodeLens{data;constructor(e){super(e)}};Rt.default=Es});var As=M(Ft=>{"use strict";var Bd=Ft&&Ft.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),zd=Ft&&Ft.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Vd=Ft&&Ft.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Bd(t,e,n[i]);return zd(t,e),t}})();Object.defineProperty(Ft,"__esModule",{value:!0});var Gd=Vd(I("vscode")),Is=class extends Gd.DocumentLink{data;constructor(e,t){super(e,t)}};Ft.default=Is});var Ls=M(xt=>{"use strict";var Jd=xt&&xt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Yd=xt&&xt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Qd=xt&&xt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Jd(t,e,n[i]);return Yd(t,e),t}})();Object.defineProperty(xt,"__esModule",{value:!0});var Zd=Qd(I("vscode")),js=class extends Zd.CodeAction{data;constructor(e,t){super(e),this.data=t}};xt.default=js});var Ks=M($e=>{"use strict";var Xd=$e&&$e.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),ef=$e&&$e.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Bc=$e&&$e.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Xd(t,e,n[i]);return ef(t,e),t}})();Object.defineProperty($e,"__esModule",{value:!0});$e.ProtocolDiagnostic=$e.DiagnosticCode=void 0;var tf=Bc(I("vscode")),Ns=Bc(We()),$c;(function(r){function e(t){let n=t;return n!=null&&(Ns.number(n.value)||Ns.string(n.value))&&Ns.string(n.target)}r.is=e})($c||($e.DiagnosticCode=$c={}));var Us=class extends tf.Diagnostic{data;hasDiagnosticCode;constructor(e,t,n,i){super(e,t,n),this.data=i,this.hasDiagnosticCode=!1}};$e.ProtocolDiagnostic=Us});var Ws=M(Mt=>{"use strict";var nf=Mt&&Mt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),rf=Mt&&Mt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),sf=Mt&&Mt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&nf(t,e,n[i]);return rf(t,e),t}})();Object.defineProperty(Mt,"__esModule",{value:!0});var of=sf(I("vscode")),Hs=class extends of.CallHierarchyItem{data;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,o),a!==void 0&&(this.data=a)}};Mt.default=Hs});var Bs=M(kt=>{"use strict";var af=kt&&kt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),cf=kt&&kt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),uf=kt&&kt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&af(t,e,n[i]);return cf(t,e),t}})();Object.defineProperty(kt,"__esModule",{value:!0});var lf=uf(I("vscode")),$s=class extends lf.TypeHierarchyItem{data;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,o),a!==void 0&&(this.data=a)}};kt.default=$s});var Vs=M(Et=>{"use strict";var df=Et&&Et.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),ff=Et&&Et.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),hf=Et&&Et.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&df(t,e,n[i]);return ff(t,e),t}})();Object.defineProperty(Et,"__esModule",{value:!0});var er=hf(I("vscode")),zs=class extends er.SymbolInformation{data;hasRange;constructor(e,t,n,i,s){let o=!(i instanceof er.Uri);super(e,t,n,o?i:new er.Location(i,new er.Range(0,0,0,0))),this.hasRange=o,s!==void 0&&(this.data=s)}};Et.default=zs});var Js=M(qt=>{"use strict";var pf=qt&&qt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),gf=qt&&qt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),mf=qt&&qt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&pf(t,e,n[i]);return gf(t,e),t}})();Object.defineProperty(qt,"__esModule",{value:!0});var vf=mf(I("vscode")),Gs=class extends vf.InlayHint{data;constructor(e,t,n){super(e,t,n)}};qt.default=Gs});var Jc=M(Ye=>{"use strict";var yf=Ye&&Ye.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),_f=Ye&&Ye.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),tr=Ye&&Ye.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&yf(t,e,n[i]);return _f(t,e),t}})(),Gt=Ye&&Ye.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.createConverter=Of;var de=tr(I("vscode")),j=tr(N()),un=tr(We()),zc=tr(Xi()),wf=Gt(ks()),Cf=Gt(qs()),bf=Gt(As()),Vc=Gt(Ls()),Gc=Ks(),Sf=Gt(Ws()),Df=Gt(Bs()),Pf=Gt(Vs()),Tf=Gt(Js()),Ys;(function(r){function e(t){let n=t;return n&&!!n.inserting&&!!n.replacing}r.is=e})(Ys||(Ys={}));function Of(r){let t=r||(d=>d.toString());function n(d){return t(d)}function i(d){return{uri:t(d.uri)}}function s(d){return{uri:t(d.uri),languageId:d.languageId,version:d.version,text:d.getText()}}function o(d){return{uri:t(d.uri),version:d.version}}function a(d){return{textDocument:s(d)}}function u(d){let w=d;return!!w.document&&!!w.contentChanges}function l(d){let w=d;return!!w.uri&&!!w.version}function h(d,w,x){if(l(d))return{textDocument:{uri:t(d.uri),version:d.version},contentChanges:[{text:d.getText()}]};if(u(d)){let X=w,V=x;return{textDocument:{uri:t(X),version:V},contentChanges:d.contentChanges.map(Ee=>{let Dt=Ee.range;return{range:{start:{line:Dt.start.line,character:Dt.start.character},end:{line:Dt.end.line,character:Dt.end.character}},rangeLength:Ee.rangeLength,text:Ee.text}})}}else throw Error("Unsupported text document change parameter")}function p(d){return{textDocument:i(d)}}function f(d,w=!1){let x={textDocument:i(d)};return w&&(x.text=d.getText()),x}function m(d){switch(d){case de.TextDocumentSaveReason.Manual:return j.TextDocumentSaveReason.Manual;case de.TextDocumentSaveReason.AfterDelay:return j.TextDocumentSaveReason.AfterDelay;case de.TextDocumentSaveReason.FocusOut:return j.TextDocumentSaveReason.FocusOut}return j.TextDocumentSaveReason.Manual}function g(d){return{textDocument:i(d.document),reason:m(d.reason)}}function v(d){return{files:d.files.map(w=>({uri:t(w)}))}}function _(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function T(d){return{files:d.files.map(w=>({uri:t(w)}))}}function C(d){return{files:d.files.map(w=>({uri:t(w)}))}}function D(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function F(d){return{files:d.files.map(w=>({uri:t(w)}))}}function E(d,w){return{textDocument:i(d),position:rn(w)}}function Z(d){switch(d){case de.CompletionTriggerKind.TriggerCharacter:return j.CompletionTriggerKind.TriggerCharacter;case de.CompletionTriggerKind.TriggerForIncompleteCompletions:return j.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return j.CompletionTriggerKind.Invoked}}function we(d,w,x){return{textDocument:i(d),position:rn(w),context:{triggerKind:Z(x.triggerKind),triggerCharacter:x.triggerCharacter}}}function Me(d){switch(d){case de.SignatureHelpTriggerKind.Invoke:return j.SignatureHelpTriggerKind.Invoked;case de.SignatureHelpTriggerKind.TriggerCharacter:return j.SignatureHelpTriggerKind.TriggerCharacter;case de.SignatureHelpTriggerKind.ContentChange:return j.SignatureHelpTriggerKind.ContentChange}}function Kn(d){return{label:d.label}}function Gr(d){return d.map(Kn)}function Hn(d){return{label:d.label,parameters:Gr(d.parameters)}}function Jr(d){return d.map(Hn)}function Yr(d){return d===void 0?d:{signatures:Jr(d.signatures),activeSignature:d.activeSignature,activeParameter:d.activeParameter}}function Qr(d,w,x){return{textDocument:i(d),position:rn(w),context:{isRetrigger:x.isRetrigger,triggerCharacter:x.triggerCharacter,triggerKind:Me(x.triggerKind),activeSignatureHelp:Yr(x.activeSignatureHelp)}}}function rn(d){return{line:d.line,character:d.character}}function bt(d){return d==null?d:{line:d.line>j.uinteger.MAX_VALUE?j.uinteger.MAX_VALUE:d.line,character:d.character>j.uinteger.MAX_VALUE?j.uinteger.MAX_VALUE:d.character}}function wn(d,w){return zc.map(d,bt,w)}function Fi(d){return d.map(bt)}function pe(d){return d==null?d:{start:bt(d.start),end:bt(d.end)}}function Zr(d){return d.map(pe)}function Ht(d){return d==null?d:j.Location.create(n(d.uri),pe(d.range))}function Wn(d){switch(d){case de.DiagnosticSeverity.Error:return j.DiagnosticSeverity.Error;case de.DiagnosticSeverity.Warning:return j.DiagnosticSeverity.Warning;case de.DiagnosticSeverity.Information:return j.DiagnosticSeverity.Information;case de.DiagnosticSeverity.Hint:return j.DiagnosticSeverity.Hint}}function xi(d){if(!d)return;let w=[];for(let x of d){let X=$n(x);X!==void 0&&w.push(X)}return w.length>0?w:void 0}function $n(d){switch(d){case de.DiagnosticTag.Unnecessary:return j.DiagnosticTag.Unnecessary;case de.DiagnosticTag.Deprecated:return j.DiagnosticTag.Deprecated;default:return}}function Wt(d){return{message:d.message,location:Ht(d.location)}}function Xr(d){return d.map(Wt)}function es(d){if(d!=null)return un.number(d)||un.string(d)?d:{value:d.value,target:n(d.target)}}function Cn(d){let w=j.Diagnostic.create(pe(d.range),d.message),x=d instanceof Gc.ProtocolDiagnostic?d:void 0;x!==void 0&&x.data!==void 0&&(w.data=x.data);let X=es(d.code);return Gc.DiagnosticCode.is(X)?x!==void 0&&x.hasDiagnosticCode?w.code=X:(w.code=X.value,w.codeDescription={href:X.target}):w.code=X,un.number(d.severity)&&(w.severity=Wn(d.severity)),Array.isArray(d.tags)&&(w.tags=xi(d.tags)),d.relatedInformation&&(w.relatedInformation=Xr(d.relatedInformation)),d.source&&(w.source=d.source),w}function bn(d,w){return d==null?d:zc.map(d,Cn,w)}function Bn(d){return d==null?d:d.map(Cn)}function ts(d,w){switch(d){case"$string":return w;case j.MarkupKind.PlainText:return{kind:d,value:w};case j.MarkupKind.Markdown:return{kind:d,value:w.value};default:return`Unsupported Markup content received. Kind is: ${d}`}}function Mi(d){if(d===de.CompletionItemTag.Deprecated)return j.CompletionItemTag.Deprecated}function ki(d){if(d===void 0)return d;let w=[];for(let x of d){let X=Mi(x);X!==void 0&&w.push(X)}return w}function ns(d,w){return w!==void 0?w:d+1}function $t(d,w=!1){let x,X;un.string(d.label)?x=d.label:(x=d.label.label,w&&(d.label.detail!==void 0||d.label.description!==void 0)&&(X={detail:d.label.detail,description:d.label.description}));let V={label:x};X!==void 0&&(V.labelDetails=X);let De=d instanceof wf.default?d:void 0;d.detail&&(V.detail=d.detail),d.documentation&&(!De||De.documentationFormat==="$string"?V.documentation=d.documentation:V.documentation=ts(De.documentationFormat,d.documentation)),d.filterText&&(V.filterText=d.filterText),Ei(V,d),un.number(d.kind)&&(V.kind=ns(d.kind,De&&De.originalItemKind)),d.sortText&&(V.sortText=d.sortText),d.additionalTextEdits&&(V.additionalTextEdits=qi(d.additionalTextEdits)),d.commitCharacters&&(V.commitCharacters=d.commitCharacters.slice()),d.command&&(V.command=Bt(d.command)),(d.preselect===!0||d.preselect===!1)&&(V.preselect=d.preselect);let Ee=ki(d.tags);if(De){if(De.data!==void 0&&(V.data=De.data),De.deprecated===!0||De.deprecated===!1){if(De.deprecated===!0&&Ee!==void 0&&Ee.length>0){let Dt=Ee.indexOf(de.CompletionItemTag.Deprecated);Dt!==-1&&Ee.splice(Dt,1)}V.deprecated=De.deprecated}De.insertTextMode!==void 0&&(V.insertTextMode=De.insertTextMode)}return Ee!==void 0&&Ee.length>0&&(V.tags=Ee),V.insertTextMode===void 0&&d.keepWhitespace===!0&&(V.insertTextMode=j.InsertTextMode.adjustIndentation),V}function Ei(d,w){let x=j.InsertTextFormat.PlainText,X,V;w.textEdit?(X=w.textEdit.newText,V=w.textEdit.range):w.insertText instanceof de.SnippetString?(x=j.InsertTextFormat.Snippet,X=w.insertText.value):X=w.insertText,w.range&&(V=w.range),d.insertTextFormat=x,w.fromEdit&&X!==void 0&&V!==void 0?d.textEdit=Sn(X,V):d.insertText=X}function Sn(d,w){return Ys.is(w)?j.InsertReplaceEdit.create(d,pe(w.inserting),pe(w.replacing)):{newText:d,range:pe(w)}}function zn(d){return{range:pe(d.range),newText:d.newText}}function qi(d){return d==null?d:d.map(zn)}function St(d){return d<=de.SymbolKind.TypeParameter?d+1:j.SymbolKind.Property}function Vn(d){return d}function ke(d){return d.map(Vn)}function is(d,w,x){return{textDocument:i(d),position:rn(w),context:{includeDeclaration:x.includeDeclaration}}}async function Ve(d,w){let x=j.CodeAction.create(d.title);if(d instanceof Vc.default&&d.data!==void 0&&(x.data=d.data),d.kind!==void 0&&(x.kind=Ii(d.kind)),d.diagnostics!==void 0&&(x.diagnostics=await bn(d.diagnostics,w)),d.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return d.command!==void 0&&(x.command=Bt(d.command)),d.isPreferred!==void 0&&(x.isPreferred=d.isPreferred),d.disabled!==void 0&&(x.disabled={reason:d.disabled.reason}),d.isAI&&(x.tags??=[],x.tags.push(j.CodeActionTag.LLMGenerated)),x}function Dn(d){let w=j.CodeAction.create(d.title);if(d instanceof Vc.default&&d.data!==void 0&&(w.data=d.data),d.kind!==void 0&&(w.kind=Ii(d.kind)),d.diagnostics!==void 0&&(w.diagnostics=Bn(d.diagnostics)),d.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return d.command!==void 0&&(w.command=Bt(d.command)),d.isPreferred!==void 0&&(w.isPreferred=d.isPreferred),d.disabled!==void 0&&(w.disabled={reason:d.disabled.reason}),d.isAI&&(w.tags??=[],w.tags.push(j.CodeActionTag.LLMGenerated)),w}async function rs(d,w){if(d==null)return d;let x;return d.only&&un.string(d.only.value)&&(x=[d.only.value]),j.CodeActionContext.create(await bn(d.diagnostics,w),x,Gn(d.triggerKind))}function ss(d){if(d==null)return d;let w;return d.only&&un.string(d.only.value)&&(w=[d.only.value]),j.CodeActionContext.create(Bn(d.diagnostics),w,Gn(d.triggerKind))}function Gn(d){switch(d){case de.CodeActionTriggerKind.Invoke:return j.CodeActionTriggerKind.Invoked;case de.CodeActionTriggerKind.Automatic:return j.CodeActionTriggerKind.Automatic;default:return}}function Ii(d){if(d!=null)return d.value}function Ai(d){return j.InlineValueContext.create(d.frameId,pe(d.stoppedLocation))}function os(d,w,x){return{textDocument:i(d),position:bt(w),context:Jn(x)}}function Jn(d){return{triggerKind:as(d.triggerKind),selectedCompletionInfo:ji(d.selectedCompletionInfo)}}function as(d){switch(d){case de.InlineCompletionTriggerKind.Invoke:return j.InlineCompletionTriggerKind.Invoked;case de.InlineCompletionTriggerKind.Automatic:return j.InlineCompletionTriggerKind.Automatic}}function ji(d){if(d!=null)return{range:pe(d.range),text:d.text}}function Bt(d){let w=j.Command.create(d.title,d.command);return d.tooltip&&(w.tooltip=d.tooltip),d.arguments&&(w.arguments=d.arguments),w}function Li(d){let w=j.CodeLens.create(pe(d.range));return d.command&&(w.command=Bt(d.command)),d instanceof Cf.default&&d.data&&(w.data=d.data),w}function Ni(d,w){let x={tabSize:d.tabSize,insertSpaces:d.insertSpaces};return w.trimTrailingWhitespace&&(x.trimTrailingWhitespace=!0),w.trimFinalNewlines&&(x.trimFinalNewlines=!0),w.insertFinalNewline&&(x.insertFinalNewline=!0),x}function cs(d){return{textDocument:i(d)}}function Ui(d){return{textDocument:i(d)}}function us(d){let w=j.DocumentLink.create(pe(d.range));d.target&&(w.target=n(d.target)),d.tooltip!==void 0&&(w.tooltip=d.tooltip);let x=d instanceof bf.default?d:void 0;return x&&x.data&&(w.data=x.data),w}function Ki(d){return{textDocument:i(d)}}function Hi(d){let w={name:d.name,kind:St(d.kind),uri:n(d.uri),range:pe(d.range),selectionRange:pe(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=ke(d.tags)),d instanceof Sf.default&&d.data!==void 0&&(w.data=d.data),w}function ls(d){let w={name:d.name,kind:St(d.kind),uri:n(d.uri),range:pe(d.range),selectionRange:pe(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=ke(d.tags)),d instanceof Df.default&&d.data!==void 0&&(w.data=d.data),w}function Yn(d){let w=d instanceof Pf.default?{name:d.name,kind:St(d.kind),location:d.hasRange?Ht(d.location):{uri:t(d.location.uri)},data:d.data}:{name:d.name,kind:St(d.kind),location:Ht(d.location)};return d.tags!==void 0&&(w.tags=ke(d.tags)),d.containerName!==""&&(w.containerName=d.containerName),w}function ds(d){let w=typeof d.label=="string"?d.label:d.label.map(Wi),x=j.InlayHint.create(bt(d.position),w);return d.kind!==void 0&&(x.kind=d.kind),d.textEdits!==void 0&&(x.textEdits=qi(d.textEdits)),d.tooltip!==void 0&&(x.tooltip=$i(d.tooltip)),d.paddingLeft!==void 0&&(x.paddingLeft=d.paddingLeft),d.paddingRight!==void 0&&(x.paddingRight=d.paddingRight),d instanceof Tf.default&&d.data!==void 0&&(x.data=d.data),x}function Wi(d){let w=j.InlayHintLabelPart.create(d.value);return d.location!==void 0&&(w.location=Ht(d.location)),d.command!==void 0&&(w.command=Bt(d.command)),d.tooltip!==void 0&&(w.tooltip=$i(d.tooltip)),w}function $i(d){return typeof d=="string"?d:{kind:j.MarkupKind.Markdown,value:d.value}}return{asUri:n,asTextDocumentIdentifier:i,asTextDocumentItem:s,asVersionedTextDocumentIdentifier:o,asOpenTextDocumentParams:a,asChangeTextDocumentParams:h,asCloseTextDocumentParams:p,asSaveTextDocumentParams:f,asWillSaveTextDocumentParams:g,asDidCreateFilesParams:v,asDidRenameFilesParams:_,asDidDeleteFilesParams:T,asWillCreateFilesParams:C,asWillRenameFilesParams:D,asWillDeleteFilesParams:F,asTextDocumentPositionParams:E,asCompletionParams:we,asSignatureHelpParams:Qr,asWorkerPosition:rn,asRange:pe,asRanges:Zr,asPosition:bt,asPositions:wn,asPositionsSync:Fi,asLocation:Ht,asDiagnosticSeverity:Wn,asDiagnosticTag:$n,asDiagnostic:Cn,asDiagnostics:bn,asDiagnosticsSync:Bn,asCompletionItem:$t,asTextEdit:zn,asSymbolKind:St,asSymbolTag:Vn,asSymbolTags:ke,asReferenceParams:is,asCodeAction:Ve,asCodeActionSync:Dn,asCodeActionContext:rs,asCodeActionContextSync:ss,asInlineValueContext:Ai,asCommand:Bt,asCodeLens:Li,asFormattingOptions:Ni,asDocumentSymbolParams:cs,asCodeLensParams:Ui,asDocumentLink:us,asDocumentLinkParams:Ki,asCallHierarchyItem:Hi,asTypeHierarchyItem:ls,asInlayHint:ds,asWorkspaceSymbol:Yn,asInlineCompletionParams:os,asInlineCompletionContext:Jn}}});var Zc=M(Qe=>{"use strict";var Rf=Qe&&Qe.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ff=Qe&&Qe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ir=Qe&&Qe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Rf(t,e,n[i]);return Ff(t,e),t}})(),Jt=Qe&&Qe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createConverter=Lf;var O=ir(I("vscode")),A=ir(N()),je=ir(We()),z=ir(Xi()),xf=Jt(ks()),Mf=Jt(qs()),kf=Jt(As()),Ef=Jt(Ls()),Yc=Ks(),qf=Jt(Ws()),If=Jt(Bs()),Af=Jt(Vs()),jf=Jt(Js()),Qc=N(),nr;(function(r){function e(t){let n=t;return n&&je.string(n.language)&&je.string(n.value)}r.is=e})(nr||(nr={}));function Lf(r,e,t,n){let s=r||(c=>O.Uri.parse(c));function o(c){return s(c)}function a(c){let y=[];for(let b of c)if(typeof b=="string")y.push(b);else if(Qc.NotebookCellTextDocumentFilter.is(b))if(typeof b.notebook=="string")y.push({notebookType:b.notebook,language:b.language});else{let R=b.notebook.notebookType??"*";y.push({notebookType:R,scheme:b.notebook.scheme,pattern:fs(b.notebook.pattern),language:b.language})}else Qc.TextDocumentFilter.is(b)&&y.push({language:b.language,scheme:b.scheme,pattern:fs(b.pattern)});return y}async function u(c,y){return z.map(c,h,y)}function l(c){let y=new Array(c.length);for(let b=0;b<c.length;b++)y[b]=h(c[b]);return y}function h(c){let y=typeof c.message=="string"?c.message:c.message.kind==="plaintext"?c.message.value:"Received a markup diagnostic message but the client does not support it.",b=new Yc.ProtocolDiagnostic(v(c.range),y,T(c.severity),c.data);if(c.code!==void 0){if(typeof c.code=="string"||typeof c.code=="number")A.CodeDescription.is(c.codeDescription)?b.code={value:c.code,target:o(c.codeDescription.href)}:b.code=c.code;else if(Yc.DiagnosticCode.is(c.code)){b.hasDiagnosticCode=!0;let R=c.code;b.code={value:R.value,target:o(R.target)}}}return c.source&&(b.source=c.source),c.relatedInformation&&(b.relatedInformation=p(c.relatedInformation)),Array.isArray(c.tags)&&(b.tags=f(c.tags)),b}function p(c){let y=new Array(c.length);for(let b=0;b<c.length;b++){let R=c[b];y[b]=new O.DiagnosticRelatedInformation(Wt(R.location),R.message)}return y}function f(c){if(!c)return;let y=[];for(let b of c){let R=m(b);R!==void 0&&y.push(R)}return y.length>0?y:void 0}function m(c){switch(c){case A.DiagnosticTag.Unnecessary:return O.DiagnosticTag.Unnecessary;case A.DiagnosticTag.Deprecated:return O.DiagnosticTag.Deprecated;default:return}}function g(c){return c?new O.Position(c.line,c.character):void 0}function v(c){return c?new O.Range(c.start.line,c.start.character,c.end.line,c.end.character):void 0}async function _(c,y){return z.map(c,b=>new O.Range(b.start.line,b.start.character,b.end.line,b.end.character),y)}function T(c){if(c==null)return O.DiagnosticSeverity.Error;switch(c){case A.DiagnosticSeverity.Error:return O.DiagnosticSeverity.Error;case A.DiagnosticSeverity.Warning:return O.DiagnosticSeverity.Warning;case A.DiagnosticSeverity.Information:return O.DiagnosticSeverity.Information;case A.DiagnosticSeverity.Hint:return O.DiagnosticSeverity.Hint}return O.DiagnosticSeverity.Error}function C(c){if(je.string(c))return F(c);if(nr.is(c))return F().appendCodeblock(c.value,c.language);if(Array.isArray(c)){let y=[];for(let b of c){let R=F();nr.is(b)?R.appendCodeblock(b.value,b.language):R.appendMarkdown(b),y.push(R)}return y}else return F(c)}function D(c){if(je.string(c))return c;switch(c.kind){case A.MarkupKind.Markdown:return F(c.value);case A.MarkupKind.PlainText:return c.value;default:return`Unsupported Markup content received. Kind is: ${c.kind}`}}function F(c){let y;if(c===void 0||typeof c=="string")y=new O.MarkdownString(c);else switch(c.kind){case A.MarkupKind.Markdown:y=new O.MarkdownString(c.value);break;case A.MarkupKind.PlainText:y=new O.MarkdownString,y.appendText(c.value);break;default:y=new O.MarkdownString,y.appendText(`Unsupported Markup content received. Kind is: ${c.kind}`);break}return y.isTrusted=e,y.supportHtml=t,y.supportThemeIcons=n,y}function E(c){if(c)return new O.Hover(C(c.contents),v(c.range))}async function Z(c,y,b){if(!c)return;if(Array.isArray(c))return z.map(c,Pt=>Hn(Pt,y),b);let R=c,{defaultRange:ae,commitCharacters:fe}=we(R,y),ee=await z.map(R.items,Pt=>Hn(Pt,fe,R.applyKind?.commitCharacters,ae,R.itemDefaults?.insertTextMode,R.itemDefaults?.insertTextFormat,R.itemDefaults?.data,R.applyKind?.data),b);return new O.CompletionList(ee,R.isIncomplete)}function we(c,y){let b=c.itemDefaults?.editRange,R=c.itemDefaults?.commitCharacters??y;return A.Range.is(b)?{defaultRange:v(b),commitCharacters:R}:b!==void 0?{defaultRange:{inserting:v(b.insert),replacing:v(b.replace)},commitCharacters:R}:{defaultRange:void 0,commitCharacters:R}}function Me(c){return A.CompletionItemKind.Text<=c&&c<=A.CompletionItemKind.TypeParameter?[c-1,void 0]:[O.CompletionItemKind.Text,c]}function Kn(c){if(c===A.CompletionItemTag.Deprecated)return O.CompletionItemTag.Deprecated}function Gr(c){if(c==null)return[];let y=[];for(let b of c){let R=Kn(b);R!==void 0&&y.push(R)}return y}function Hn(c,y,b,R,ae,fe,ee,Pt){let zt=Gr(c.tags),Ke=Qr(c),ge=new xf.default(Ke);c.detail&&(ge.detail=c.detail),c.documentation&&(ge.documentation=D(c.documentation),ge.documentationFormat=je.string(c.documentation)?"$string":c.documentation.kind),c.filterText&&(ge.filterText=c.filterText);let Bi=rn(c,R,fe);if(Bi&&(ge.insertText=Bi.text,ge.range=Bi.range,ge.fromEdit=Bi.fromEdit),je.number(c.kind)){let[fd,Oc]=Me(c.kind);ge.kind=fd,Oc&&(ge.originalItemKind=Oc)}c.sortText&&(ge.sortText=c.sortText),c.additionalTextEdits&&(ge.additionalTextEdits=pe(c.additionalTextEdits));let Pc=Jr(c,y,b);Pc&&(ge.commitCharacters=Pc.slice()),c.command&&(ge.command=ke(c.command)),(c.deprecated===!0||c.deprecated===!1)&&(ge.deprecated=c.deprecated,c.deprecated===!0&&zt.push(O.CompletionItemTag.Deprecated)),(c.preselect===!0||c.preselect===!1)&&(ge.preselect=c.preselect);let Tc=Yr(c,ee,Pt);Tc!==void 0&&(ge.data=Tc),zt.length>0&&(ge.tags=zt);let ps=c.insertTextMode??ae;return ps!==void 0&&(ge.insertTextMode=ps,ps===A.InsertTextMode.asIs&&(ge.keepWhitespace=!0)),ge}function Jr(c,y,b){if(b===A.ApplyKind.Merge){if(!y&&!c.commitCharacters)return;let R=new Set;if(y)for(let ae of y)R.add(ae);if(je.stringArray(c.commitCharacters))for(let ae of c.commitCharacters)R.add(ae);return Array.from(R)}return c.commitCharacters!==void 0?je.stringArray(c.commitCharacters)?c.commitCharacters:void 0:y}function Yr(c,y,b){if(b===A.ApplyKind.Merge){let R={...y};return c.data&&Object.entries(c.data).forEach(([ae,fe])=>{fe!=null&&(R[ae]=fe)}),R}return c.data??y}function Qr(c){return A.CompletionItemLabelDetails.is(c.labelDetails)?{label:c.label,detail:c.labelDetails.detail,description:c.labelDetails.description}:c.label}function rn(c,y,b){let R=c.insertTextFormat??b;if(c.textEdit!==void 0||y!==void 0){let[ae,fe]=c.textEdit!==void 0?bt(c.textEdit):[y,c.textEditText??c.label];return R===A.InsertTextFormat.Snippet?{text:new O.SnippetString(fe),range:ae,fromEdit:!0}:{text:fe,range:ae,fromEdit:!0}}else return c.insertText?R===A.InsertTextFormat.Snippet?{text:new O.SnippetString(c.insertText),fromEdit:!1}:{text:c.insertText,fromEdit:!1}:void 0}function bt(c){return A.InsertReplaceEdit.is(c)?[{inserting:v(c.insert),replacing:v(c.replace)},c.newText]:[v(c.range),c.newText]}function wn(c){if(c)return new O.TextEdit(v(c.range),c.newText)}async function Fi(c,y){if(c)return z.map(c,wn,y)}function pe(c){if(!c)return;let y=new Array(c.length);for(let b=0;b<c.length;b++)y[b]=wn(c[b]);return y}async function Zr(c,y){if(!c)return;let b=new O.SignatureHelp;return je.number(c.activeSignature)?b.activeSignature=c.activeSignature:b.activeSignature=0,je.number(c.activeParameter)?b.activeParameter=c.activeParameter:c.activeParameter===null?b.activeParameter=-1:b.activeParameter=0,c.signatures&&(b.signatures=await Ht(c.signatures,y)),b}async function Ht(c,y){return z.mapAsync(c,Wn,y)}async function Wn(c,y){let b=new O.SignatureInformation(c.label);return c.documentation!==void 0&&(b.documentation=D(c.documentation)),c.parameters!==void 0&&(b.parameters=await xi(c.parameters,y)),c.activeParameter!==void 0&&(b.activeParameter=c.activeParameter??-1),b}function xi(c,y){return z.map(c,$n,y)}function $n(c){let y=new O.ParameterInformation(c.label);return c.documentation&&(y.documentation=D(c.documentation)),y}function Wt(c){return c?new O.Location(s(c.uri),v(c.range)):void 0}async function Xr(c,y){if(c)return bn(c,y)}async function es(c,y){if(c)return bn(c,y)}function Cn(c){if(!c)return;let y={targetUri:s(c.targetUri),targetRange:v(c.targetRange),originSelectionRange:v(c.originSelectionRange),targetSelectionRange:v(c.targetSelectionRange)};if(!y.targetSelectionRange)throw new Error("targetSelectionRange must not be undefined or null");return y}async function bn(c,y){if(c)if(je.array(c)){if(c.length===0)return[];if(A.LocationLink.is(c[0])){let b=c;return z.map(b,Cn,y)}else{let b=c;return z.map(b,Wt,y)}}else return A.LocationLink.is(c)?[Cn(c)]:Wt(c)}async function Bn(c,y){if(c)return z.map(c,Wt,y)}async function ts(c,y){if(c)return z.map(c,Mi,y)}function Mi(c){let y=new O.DocumentHighlight(v(c.range));return je.number(c.kind)&&(y.kind=ki(c.kind)),y}function ki(c){switch(c){case A.DocumentHighlightKind.Text:return O.DocumentHighlightKind.Text;case A.DocumentHighlightKind.Read:return O.DocumentHighlightKind.Read;case A.DocumentHighlightKind.Write:return O.DocumentHighlightKind.Write}return O.DocumentHighlightKind.Text}async function ns(c,y){if(c)return z.map(c,zn,y)}function $t(c){return c<=A.SymbolKind.TypeParameter?c-1:O.SymbolKind.Property}function Ei(c){if(c===A.SymbolTag.Deprecated)return O.SymbolTag.Deprecated}function Sn(c){if(c==null)return;let y=[];for(let b of c){let R=Ei(b);R!==void 0&&y.push(R)}return y.length===0?void 0:y}function zn(c){let y=c.data,b=c.location,R=b.range===void 0||y!==void 0?new Af.default(c.name,$t(c.kind),c.containerName??"",b.range===void 0?s(b.uri):new O.Location(s(c.location.uri),v(b.range)),y):new O.SymbolInformation(c.name,$t(c.kind),c.containerName??"",new O.Location(s(c.location.uri),v(b.range)));return Vn(R,c),R}async function qi(c,y){if(c!=null)return z.map(c,St,y)}function St(c){let y=new O.DocumentSymbol(c.name,c.detail||"",$t(c.kind),v(c.range),v(c.selectionRange));if(Vn(y,c),c.children!==void 0&&c.children.length>0){let b=[];for(let R of c.children)b.push(St(R));y.children=b}return y}function Vn(c,y){c.tags=Sn(y.tags),y.deprecated&&(c.tags?c.tags.includes(O.SymbolTag.Deprecated)||(c.tags=c.tags.concat(O.SymbolTag.Deprecated)):c.tags=[O.SymbolTag.Deprecated])}function ke(c){let y={title:c.title,command:c.command};return c.tooltip&&(y.tooltip=c.tooltip),c.arguments&&(y.arguments=c.arguments),y}async function is(c,y){if(c)return z.map(c,ke,y)}let Ve=new Map;Ve.set(A.CodeActionKind.Empty,O.CodeActionKind.Empty),Ve.set(A.CodeActionKind.QuickFix,O.CodeActionKind.QuickFix),Ve.set(A.CodeActionKind.Refactor,O.CodeActionKind.Refactor),Ve.set(A.CodeActionKind.RefactorExtract,O.CodeActionKind.RefactorExtract),Ve.set(A.CodeActionKind.RefactorInline,O.CodeActionKind.RefactorInline),Ve.set(A.CodeActionKind.RefactorRewrite,O.CodeActionKind.RefactorRewrite),Ve.set(A.CodeActionKind.Source,O.CodeActionKind.Source),Ve.set(A.CodeActionKind.SourceOrganizeImports,O.CodeActionKind.SourceOrganizeImports);function Dn(c){if(c==null)return;let y=Ve.get(c);if(y)return y;let b=c.split(".");y=O.CodeActionKind.Empty;for(let R of b)y=y.append(R);return y}function rs(c){if(c!=null)return c.map(y=>Dn(y))}function ss(c){if(c!=null)return c.map(y=>({kind:Dn(y.kind),command:ke(y.command)}))}async function Gn(c,y){if(c==null)return;let b=new Ef.default(c.title,c.data);return c.kind!==void 0&&(b.kind=Dn(c.kind)),c.diagnostics!==void 0&&(b.diagnostics=l(c.diagnostics)),c.edit!==void 0&&(b.edit=await Jn(c.edit,y)),c.command!==void 0&&(b.command=ke(c.command)),c.isPreferred!==void 0&&(b.isPreferred=c.isPreferred),c.disabled!==void 0&&(b.disabled={reason:c.disabled.reason}),c.tags?.includes(A.CodeActionTag.LLMGenerated)&&(b.isAI=!0),b}function Ii(c,y){return z.mapAsync(c,async b=>A.Command.is(b)?ke(b):Gn(b,y),y)}function Ai(c){if(!c)return;let y=new Mf.default(v(c.range));return c.command&&(y.command=ke(c.command)),c.data!==void 0&&c.data!==null&&(y.data=c.data),y}async function os(c,y){if(c)return z.map(c,Ai,y)}async function Jn(c,y){if(!c)return;let b=new Map;if(c.changeAnnotations!==void 0){let fe=c.changeAnnotations;await z.forEach(Object.keys(fe),ee=>{let Pt=as(fe[ee]);b.set(ee,Pt)},y)}let R=fe=>{if(fe!==void 0)return b.get(fe)},ae=new O.WorkspaceEdit;if(c.documentChanges){let fe=c.documentChanges;await z.forEach(fe,ee=>{if(A.CreateFile.is(ee))ae.createFile(s(ee.uri),ee.options,R(ee.annotationId));else if(A.RenameFile.is(ee))ae.renameFile(s(ee.oldUri),s(ee.newUri),ee.options,R(ee.annotationId));else if(A.DeleteFile.is(ee))ae.deleteFile(s(ee.uri),ee.options,R(ee.annotationId));else if(A.TextDocumentEdit.is(ee)){let Pt=s(ee.textDocument.uri),zt=[];for(let Ke of ee.edits)A.AnnotatedTextEdit.is(Ke)?zt.push([new O.TextEdit(v(Ke.range),Ke.newText),R(Ke.annotationId)]):A.SnippetTextEdit.is(Ke)?zt.push([new O.SnippetTextEdit(v(Ke.range),new O.SnippetString(Ke.snippet.value)),R(Ke.annotationId)]):zt.push([new O.TextEdit(v(Ke.range),Ke.newText),void 0]);ae.set(Pt,zt)}else throw new Error(`Unknown workspace edit change received:
8
+ ${JSON.stringify(ee,void 0,4)}`)},y)}else if(c.changes){let fe=c.changes;await z.forEach(Object.keys(fe),ee=>{ae.set(s(ee),pe(fe[ee]))},y)}return ae}function as(c){if(c!==void 0)return{label:c.label,needsConfirmation:!!c.needsConfirmation,description:c.description}}function ji(c){let y=v(c.range),b=c.target?o(c.target):void 0,R=new kf.default(y,b);return c.tooltip!==void 0&&(R.tooltip=c.tooltip),c.data!==void 0&&c.data!==null&&(R.data=c.data),R}async function Bt(c,y){if(c)return z.map(c,ji,y)}function Li(c){return new O.Color(c.red,c.green,c.blue,c.alpha)}function Ni(c){return new O.ColorInformation(v(c.range),Li(c.color))}async function cs(c,y){if(c)return z.map(c,Ni,y)}function Ui(c){let y=new O.ColorPresentation(c.label);return y.additionalTextEdits=pe(c.additionalTextEdits),c.textEdit&&(y.textEdit=wn(c.textEdit)),y}async function us(c,y){if(c)return z.map(c,Ui,y)}function Ki(c){if(c)switch(c){case A.FoldingRangeKind.Comment:return O.FoldingRangeKind.Comment;case A.FoldingRangeKind.Imports:return O.FoldingRangeKind.Imports;case A.FoldingRangeKind.Region:return O.FoldingRangeKind.Region}}function Hi(c){return new O.FoldingRange(c.startLine,c.endLine,Ki(c.kind))}async function ls(c,y){if(c)return z.map(c,Hi,y)}function Yn(c){return new O.SelectionRange(v(c.range),c.parent?Yn(c.parent):void 0)}async function ds(c,y){return Array.isArray(c)?z.map(c,Yn,y):[]}function Wi(c){return A.InlineValueText.is(c)?new O.InlineValueText(v(c.range),c.text):A.InlineValueVariableLookup.is(c)?new O.InlineValueVariableLookup(v(c.range),c.variableName,c.caseSensitiveLookup):new O.InlineValueEvaluatableExpression(v(c.range),c.expression)}async function $i(c,y){return Array.isArray(c)?z.map(c,Wi,y):[]}async function d(c,y){let b=typeof c.label=="string"?c.label:await z.map(c.label,w,y),R=new jf.default(g(c.position),b);return c.kind!==void 0&&(R.kind=c.kind),c.textEdits!==void 0&&(R.textEdits=await Fi(c.textEdits,y)),c.tooltip!==void 0&&(R.tooltip=x(c.tooltip)),c.paddingLeft!==void 0&&(R.paddingLeft=c.paddingLeft),c.paddingRight!==void 0&&(R.paddingRight=c.paddingRight),c.data!==void 0&&(R.data=c.data),R}function w(c){let y=new O.InlayHintLabelPart(c.value);return c.location!==void 0&&(y.location=Wt(c.location)),c.tooltip!==void 0&&(y.tooltip=x(c.tooltip)),c.command!==void 0&&(y.command=ke(c.command)),y}function x(c){return typeof c=="string"?c:F(c)}async function X(c,y){if(Array.isArray(c))return z.mapAsync(c,d,y)}function V(c){if(c===null)return;let y=new qf.default($t(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(y.tags=Sn(c.tags)),y}async function De(c,y){if(c!==null)return z.map(c,V,y)}async function Ee(c,y){return new O.CallHierarchyIncomingCall(V(c.from),await _(c.fromRanges,y))}async function Dt(c,y){if(c!==null)return z.mapAsync(c,Ee,y)}async function bc(c,y){return new O.CallHierarchyOutgoingCall(V(c.to),await _(c.fromRanges,y))}async function rd(c,y){if(c!==null)return z.mapAsync(c,bc,y)}async function sd(c,y){if(c!=null)return new O.SemanticTokens(new Uint32Array(c.data),c.resultId)}function Sc(c){return new O.SemanticTokensEdit(c.start,c.deleteCount,c.data!==void 0?new Uint32Array(c.data):void 0)}async function od(c,y){if(c!=null)return new O.SemanticTokensEdits(c.edits.map(Sc),c.resultId)}function ad(c){return c}async function cd(c,y){if(c!=null)return new O.LinkedEditingRanges(await _(c.ranges,y),ud(c.wordPattern))}function ud(c){if(c!=null)return new RegExp(c)}function Dc(c){if(c===null)return;let y=new If.default($t(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(y.tags=Sn(c.tags)),y}async function ld(c,y){if(c!==null)return z.map(c,Dc,y)}function fs(c){if(je.string(c))return c;if(A.RelativePattern.is(c)){if(A.URI.is(c.baseUri))return new O.RelativePattern(o(c.baseUri),c.pattern);if(A.WorkspaceFolder.is(c.baseUri)){let y=O.workspace.getWorkspaceFolder(o(c.baseUri.uri));return y!==void 0?new O.RelativePattern(y,c.pattern):void 0}}}async function dd(c,y){if(!c)return;if(Array.isArray(c))return z.map(c,ae=>hs(ae),y);let b=c,R=await z.map(b.items,ae=>hs(ae),y);return new O.InlineCompletionList(R)}function hs(c){let y;typeof c.insertText=="string"?y=c.insertText:y=new O.SnippetString(c.insertText.value);let b;c.command&&(b=ke(c.command));let R=new O.InlineCompletionItem(y,v(c.range),b);return c.filterText&&(R.filterText=c.filterText),R}return{asUri:o,asDocumentSelector:a,asDiagnostics:u,asDiagnostic:h,asRange:v,asRanges:_,asPosition:g,asDiagnosticSeverity:T,asDiagnosticTag:m,asHover:E,asCompletionResult:Z,asCompletionItem:Hn,asTextEdit:wn,asTextEdits:Fi,asSignatureHelp:Zr,asSignatureInformations:Ht,asSignatureInformation:Wn,asParameterInformations:xi,asParameterInformation:$n,asDeclarationResult:Xr,asDefinitionResult:es,asLocation:Wt,asReferences:Bn,asDocumentHighlights:ts,asDocumentHighlight:Mi,asDocumentHighlightKind:ki,asSymbolKind:$t,asSymbolTag:Ei,asSymbolTags:Sn,asSymbolInformations:ns,asSymbolInformation:zn,asDocumentSymbols:qi,asDocumentSymbol:St,asCommand:ke,asCommands:is,asCodeAction:Gn,asCodeActionKind:Dn,asCodeActionKinds:rs,asCodeActionDocumentations:ss,asCodeActionResult:Ii,asCodeLens:Ai,asCodeLenses:os,asWorkspaceEdit:Jn,asDocumentLink:ji,asDocumentLinks:Bt,asFoldingRangeKind:Ki,asFoldingRange:Hi,asFoldingRanges:ls,asColor:Li,asColorInformation:Ni,asColorInformations:cs,asColorPresentation:Ui,asColorPresentations:us,asSelectionRange:Yn,asSelectionRanges:ds,asInlineValue:Wi,asInlineValues:$i,asInlayHint:d,asInlayHints:X,asSemanticTokensLegend:ad,asSemanticTokens:sd,asSemanticTokensEdit:Sc,asSemanticTokensEdits:od,asCallHierarchyItem:V,asCallHierarchyItems:De,asCallHierarchyIncomingCall:Ee,asCallHierarchyIncomingCalls:Dt,asCallHierarchyOutgoingCall:bc,asCallHierarchyOutgoingCalls:rd,asLinkedEditingRanges:cd,asTypeHierarchyItem:Dc,asTypeHierarchyItems:ld,asGlobPattern:fs,asInlineCompletionResult:dd,asInlineCompletionItem:hs}}});var ie=M(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.empty=void 0;Yt.v4=Xc;Yt.isUUID=eu;Yt.parse=Uf;Yt.generateUuid=Kf;var ri=class{_value;constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Qs=class r extends ri{static _chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];static _timeHighBits=["8","9","a","b"];static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return r._oneOf(r._chars)}constructor(){super([r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-","4",r._randomHex(),r._randomHex(),r._randomHex(),"-",r._oneOf(r._timeHighBits),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex()].join(""))}};Yt.empty=new ri("00000000-0000-0000-0000-000000000000");function Xc(){return new Qs}var Nf=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function eu(r){return Nf.test(r)}function Uf(r){if(!eu(r))throw new Error("invalid uuid");return new ri(r)}function Kf(){return Xc().asHex()}});var Xs=M(rt=>{"use strict";var Hf=rt&&rt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Wf=rt&&rt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),$f=rt&&rt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Hf(t,e,n[i]);return Wf(t,e),t}})();Object.defineProperty(rt,"__esModule",{value:!0});rt.ProgressPart=void 0;var tu=I("vscode"),nu=N(),iu=$f(We()),Zs=class{_client;_token;_infinite;_reported;_lspProgressDisposable;_progress;_cancellationToken;_tokenDisposable;_resolve;_reject;constructor(e,t,n){this._client=e,this._token=t,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(nu.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&&tu.window.withProgress({location:tu.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(nu.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(e),new Promise((i,s)=>{this._resolve=i,this._reject=s})})}report(e){if(this._infinite&&iu.string(e.message))this._progress!==void 0&&this._progress.report({message:e.message});else if(iu.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}};rt.ProgressPart=Zs});var B=M(te=>{"use strict";var Bf=te&&te.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),zf=te&&te.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),cu=te&&te.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Bf(t,e,n[i]);return zf(t,e),t}})();Object.defineProperty(te,"__esModule",{value:!0});te.DefaultDiagnosticCollectionProvider=te.DiagnosticCollectionSource=te.WorkspaceFeature=te.TextDocumentLanguageFeature=te.TextDocumentEventFeature=te.DynamicDocumentFeature=te.DynamicFeature=te.StaticFeature=te.LSPCancellationError=void 0;te.ensure=Vf;var Ze=I("vscode"),eo=N(),xe=cu(We()),ru=cu(ie()),to=class extends Ze.CancellationError{data;constructor(e){super(),this.data=e}};te.LSPCancellationError=to;function Vf(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var su;(function(r){function e(t){let n=t;return n!=null&&xe.func(n.fillClientCapabilities)&&xe.func(n.initialize)&&xe.func(n.getState)&&xe.func(n.clear)&&(n.fillInitializeParams===void 0||xe.func(n.fillInitializeParams))}r.is=e})(su||(te.StaticFeature=su={}));var ou;(function(r){function e(t){let n=t;return n!=null&&xe.func(n.fillClientCapabilities)&&xe.func(n.initialize)&&xe.func(n.getState)&&xe.func(n.clear)&&(n.fillInitializeParams===void 0||xe.func(n.fillInitializeParams))&&xe.func(n.register)&&xe.func(n.unregister)&&n.registrationType!==void 0}r.is=e})(ou||(te.DynamicFeature=ou={}));var si=class{_client;constructor(e){this._client=e}getState(){let e=this.getDocumentSelectors(),t=0;for(let i of e){t++;for(let s of Ze.workspace.textDocuments)if(Ze.languages.match(i,s)>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}}};te.DynamicDocumentFeature=si;var no=class extends si{_event;_type;_middleware;_createParams;_textDocument;_selectorFilter;_listener;_selectors;_onAboutToSendNotification;_onNotificationSent;static textDocumentFilter(e,t){for(let n of e)if(Ze.languages.match(n,t)>0)return!0;return!1}constructor(e,t,n,i,s,o,a){super(e),this._event=t,this._type=n,this._middleware=i,this._createParams=s,this._textDocument=o,this._selectorFilter=a,this._selectors=new Map,this._onAboutToSendNotification=new Ze.EventEmitter,this._onNotificationSent=new Ze.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.getTextDocument(n),s=this._createParams(n);this.aboutToSendNotification(i,this._type,s),await this._client.sendNotification(this._type,s),this.notificationSent(i,this._type,s)};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 onAboutToSendNotification(){return this._onAboutToSendNotification.event}aboutToSendNotification(e,t,n){this._onAboutToSendNotification.fire({textDocument:e,type:t,params:n})}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._onNotificationSent=new Ze.EventEmitter,this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(e){for(let t of this._selectors.values())if(Ze.languages.match(t,e)>0)return{send:n=>this.callback(n)}}};te.TextDocumentEventFeature=no;var io=class extends si{_registrationType;_registrations;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&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getRegistration(e,t){if(t){if(eo.TextDocumentRegistrationOptions.is(t)){let n=eo.StaticRegistrationOptions.hasId(t)?t.id:ru.generateUuid(),i=t.documentSelector??e;if(i)return[n,Object.assign({},t,{documentSelector:i})]}else if(xe.boolean(t)&&t===!0||eo.WorkDoneProgressOptions.is(t)){if(!e)return[void 0,void 0];let n=xe.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e});return[ru.generateUuid(),n]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(e,t){if(!(!e||!t))return xe.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&&Ze.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}};te.TextDocumentLanguageFeature=io;var ro=class{_client;_registrationType;_registrations;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&&(this._registrations.delete(e),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}};te.WorkspaceFeature=ro;var au;(function(r){r.push="push",r.pull="pull"})(au||(te.DiagnosticCollectionSource=au={}));var so=class{create(e,t){return e!==void 0?Ze.languages.createDiagnosticCollection(e):Ze.languages.createDiagnosticCollection()}dispose(e,t){e.dispose()}};te.DefaultDiagnosticCollectionProvider=so});var lu=M(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.range=ln.balanced=void 0;var Gf=(r,e,t)=>{let n=r instanceof RegExp?uu(r,t):r,i=e instanceof RegExp?uu(e,t):e,s=n!==null&&i!=null&&(0,ln.range)(n,i,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+n.length,s[1]),post:t.slice(s[1]+i.length)}};ln.balanced=Gf;var uu=(r,e)=>{let t=e.match(r);return t?t[0]:null},Jf=(r,e,t)=>{let n,i,s,o,a,u=t.indexOf(r),l=t.indexOf(e,u+1),h=u;if(u>=0&&l>0){if(r===e)return[u,l];for(n=[],s=t.length;h>=0&&!a;){if(h===u)n.push(h),u=t.indexOf(r,h+1);else if(n.length===1){let p=n.pop();p!==void 0&&(a=[p,l])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=l),l=t.indexOf(e,h+1);h=u<l&&u>=0?u:l}n.length&&o!==void 0&&(a=[s,o])}return a};ln.range=Jf});var vu=M(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.EXPANSION_MAX=void 0;Tn.expand=ch;var du=lu(),fu="\0SLASH"+Math.random()+"\0",hu="\0OPEN"+Math.random()+"\0",ao="\0CLOSE"+Math.random()+"\0",pu="\0COMMA"+Math.random()+"\0",gu="\0PERIOD"+Math.random()+"\0",Yf=new RegExp(fu,"g"),Qf=new RegExp(hu,"g"),Zf=new RegExp(ao,"g"),Xf=new RegExp(pu,"g"),eh=new RegExp(gu,"g"),th=/\\\\/g,nh=/\\{/g,ih=/\\}/g,rh=/\\,/g,sh=/\\\./g;Tn.EXPANSION_MAX=1e5;function oo(r){return isNaN(r)?r.charCodeAt(0):parseInt(r,10)}function oh(r){return r.replace(th,fu).replace(nh,hu).replace(ih,ao).replace(rh,pu).replace(sh,gu)}function ah(r){return r.replace(Yf,"\\").replace(Qf,"{").replace(Zf,"}").replace(Xf,",").replace(eh,".")}function mu(r){if(!r)return[""];let e=[],t=(0,du.balanced)("{","}",r);if(!t)return r.split(",");let{pre:n,body:i,post:s}=t,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=mu(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function ch(r,e={}){if(!r)return[];let{max:t=Tn.EXPANSION_MAX}=e;return r.slice(0,2)==="{}"&&(r="\\{\\}"+r.slice(2)),oi(oh(r),t,!0).map(ah)}function uh(r){return"{"+r+"}"}function lh(r){return/^-?0\d/.test(r)}function dh(r,e){return r<=e}function fh(r,e){return r>=e}function oi(r,e,t){let n=[],i=(0,du.balanced)("{","}",r);if(!i)return[r];let s=i.pre,o=i.post.length?oi(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let u=s+"{"+i.body+"}"+o[a];n.push(u)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=a||u,h=i.body.indexOf(",")>=0;if(!l&&!h)return i.post.match(/,(?!,).*\}/)?(r=i.pre+"{"+i.body+ao+i.post,oi(r,e,!0)):[r];let p;if(l)p=i.body.split(/\.\./);else if(p=mu(i.body),p.length===1&&p[0]!==void 0&&(p=oi(p[0],e,!1).map(uh),p.length===1))return o.map(m=>i.pre+p[0]+m);let f;if(l&&p[0]!==void 0&&p[1]!==void 0){let m=oo(p[0]),g=oo(p[1]),v=Math.max(p[0].length,p[1].length),_=p.length===3&&p[2]!==void 0?Math.max(Math.abs(oo(p[2])),1):1,T=dh;g<m&&(_*=-1,T=fh);let D=p.some(lh);f=[];for(let F=m;T(F,g)&&f.length<e;F+=_){let E;if(u)E=String.fromCharCode(F),E==="\\"&&(E="");else if(E=String(F),D){let Z=v-E.length;if(Z>0){let we=new Array(Z+1).join("0");F<0?E="-"+we+E.slice(1):E=we+E}}f.push(E)}}else{f=[];for(let m=0;m<p.length;m++)f.push.apply(f,oi(p[m],e,!1))}for(let m=0;m<f.length;m++)for(let g=0;g<o.length&&n.length<e;g++){let v=s+f[m]+o[g];(!t||l||v)&&n.push(v)}}return n}});var yu=M(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.assertValidPattern=void 0;var hh=1024*64,ph=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>hh)throw new TypeError("pattern is too long")};rr.assertValidPattern=ph});var wu=M(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.parseClass=void 0;var gh={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},ai=r=>r.replace(/[[\]\\-]/g,"\\$&"),mh=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_u=r=>r.join(""),vh=(r,e)=>{let t=e;if(r.charAt(t)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=t+1,o=!1,a=!1,u=!1,l=!1,h=t,p="";e:for(;s<r.length;){let v=r.charAt(s);if((v==="!"||v==="^")&&s===t+1){l=!0,s++;continue}if(v==="]"&&o&&!u){h=s+1;break}if(o=!0,v==="\\"&&!u){u=!0,s++;continue}if(v==="["&&!u){for(let[_,[T,C,D]]of Object.entries(gh))if(r.startsWith(_,s)){if(p)return["$.",!1,r.length-t,!0];s+=_.length,D?i.push(T):n.push(T),a=a||C;continue e}}if(u=!1,p){v>p?n.push(ai(p)+"-"+ai(v)):v===p&&n.push(ai(v)),p="",s++;continue}if(r.startsWith("-]",s+1)){n.push(ai(v+"-")),s+=2;continue}if(r.startsWith("-",s+1)){p=v,s+=2;continue}n.push(ai(v)),s++}if(h<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,r.length-t,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let v=n[0].length===2?n[0].slice(-1):n[0];return[mh(v),!1,h-t,!1]}let f="["+(l?"^":"")+_u(n)+"]",m="["+(l?"":"^")+_u(i)+"]";return[n.length&&i.length?"("+f+"|"+m+")":n.length?f:m,a,h-t,!0]};sr.parseClass=vh});var ar=M(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.unescape=void 0;var yh=(r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?r.replace(/\[([^/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?r.replace(/\[([^/\\{}])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");or.unescape=yh});var lo=M(dr=>{"use strict";var qe;Object.defineProperty(dr,"__esModule",{value:!0});dr.AST=void 0;var _h=wu(),cr=ar(),wh=new Set(["!","?","+","*","@"]),co=r=>wh.has(r),Cu=r=>co(r.type),Ch=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),bh=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Sh=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),bu=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Dh="(?!(?:^|/)\\.\\.?(?:$|/))",ur="(?!\\.)",Ph=new Set(["[","."]),Th=new Set(["..","."]),Oh=new Set("().*{}+?[]^$\\!"),Rh=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),uo="[^/]",Su=uo+"*?",Du=uo+"+?",Fh=0,lr=class{type;#n;#i;#r=!1;#e=[];#t;#a;#u;#c=!1;#s;#o;#l=!1;id=++Fh;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,t,n={}){this.type=e,e&&(this.#i=!0),this.#t=t,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?n:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#o=this.#e.map(e=>String(e)).join("")}#v(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let t=e,n=t.#t;for(;n;){for(let i=t.#a+1;!n.type&&i<n.#e.length;i++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#e[i])}t=n,n=t.#t}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof qe&&t.#t===this))throw new Error("invalid part: "+t);this.#e.push(t)}}toJSON(){let e=this.type===null?this.#e.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#e.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let t=0;t<this.#a;t++){let n=e.#e[t];if(!(n instanceof qe&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new qe(this.type,e);for(let n of this.#e)t.copyIn(n);return t}static#d(e,t,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,u=!1,l=-1,h=!1;if(t.type===null){let v=n,_="";for(;v<e.length;){let T=e.charAt(v++);if(a||T==="\\"){a=!a,_+=T;continue}if(u){v===l+1?(T==="^"||T==="!")&&(h=!0):T==="]"&&!(v===l+2&&h)&&(u=!1),_+=T;continue}else if(T==="["){u=!0,l=v,h=!1,_+=T;continue}if(!i.noext&&co(T)&&e.charAt(v)==="("&&s<=o){t.push(_),_="";let D=new qe(T,t);v=qe.#d(e,D,v,i,s+1),t.push(D);continue}_+=T}return t.push(_),v}let p=n+1,f=new qe(null,t),m=[],g="";for(;p<e.length;){let v=e.charAt(p++);if(a||v==="\\"){a=!a,g+=v;continue}if(u){p===l+1?(v==="^"||v==="!")&&(h=!0):v==="]"&&!(p===l+2&&h)&&(u=!1),g+=v;continue}else if(v==="["){u=!0,l=p,h=!1,g+=v;continue}if(!i.noext&&co(v)&&e.charAt(p)==="("&&(s<=o||t&&t.#f(v))){let T=t&&t.#f(v)?0:1;f.push(g),g="";let C=new qe(v,f);f.push(C),p=qe.#d(e,C,p,i,s+T);continue}if(v==="|"){f.push(g),g="",m.push(f),f=new qe(null,t);continue}if(v===")")return g===""&&t.#e.length===0&&(t.#l=!0),f.push(g),g="",t.push(...m,f),p;g+=v}return t.type=null,t.#i=void 0,t.#e=[e.substring(n-1)],p}#y(e){return this.#p(e,bh)}#p(e,t=Ch){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#f(n.type,t)}#f(e,t=Sh){return!!t.get(this.type)?.includes(e)}#_(e,t){let n=e.#e[0],i=new qe(null,n,this.options);i.#e.push(""),n.push(i),this.#g(e,t)}#g(e,t){let n=e.#e[0];this.#e.splice(t,1,...n.#e);for(let i of n.#e)typeof i=="object"&&(i.#t=this);this.#o=void 0}#w(e){return!!bu.get(this.type)?.has(e)}#C(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let t=e.#e[0];return!t||typeof t!="object"||t.type===null?!1:this.#w(t.type)}#b(e){let t=bu.get(this.type),n=e.#e[0],i=t?.get(n.type);if(!i)return!1;this.#e=n.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=i,this.#o=void 0,this.#l=!1}static fromGlob(e,t={}){let n=new qe(null,void 0,t);return qe.#d(e,n,0,t,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[t,n,i,s]=this.toRegExpSource();if(!(i||this.#i||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#n===this&&(this.#h(),this.#v()),!Cu(this)){let u=this.isStart()&&this.isEnd()&&!this.#e.some(m=>typeof m!="string"),l=this.#e.map(m=>{let[g,v,_,T]=typeof m=="string"?qe.#S(m,this.#i,u):m.toRegExpSource(e);return this.#i=this.#i||_,this.#r=this.#r||T,g}).join(""),h="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&Th.has(this.#e[0]))){let g=Ph,v=t&&g.has(l.charAt(0))||l.startsWith("\\.")&&g.has(l.charAt(2))||l.startsWith("\\.\\.")&&g.has(l.charAt(4)),_=!t&&!e&&g.has(l.charAt(0));h=v?Dh:_?ur:""}let p="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(p="(?:$|\\/)"),[h+l+p,(0,cr.unescape)(l),this.#i=!!this.#i,this.#r]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#m(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let u=this.toString(),l=this;return l.#e=[u],l.type=null,l.#i=void 0,[u,(0,cr.unescape)(this.toString()),!1,!1]}let o=!n||e||t||!ur?"":this.#m(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!t?ur:"")+Du;else{let u=this.type==="!"?"))"+(this.isStart()&&!t&&!e?ur:"")+Su+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+u}return[a,(0,cr.unescape)(s),this.#i=!!this.#i,this.#r]}#h(){if(Cu(this)){let e=0,t=!1;do{t=!0;for(let n=0;n<this.#e.length;n++){let i=this.#e[n];typeof i=="object"&&(i.#h(),this.#p(i)?(t=!1,this.#g(i,n)):this.#y(i)?(t=!1,this.#_(i,n)):this.#C(i)&&(t=!1,this.#b(i)))}}while(!t&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#h();this.#o=void 0}#m(e){return this.#e.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=t.toRegExpSource(e);return this.#r=this.#r||o,n}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#S(e,t,n=!1){let i=!1,s="",o=!1,a=!1;for(let u=0;u<e.length;u++){let l=e.charAt(u);if(i){i=!1,s+=(Oh.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(e)?Du:Su,t=!0;continue}else a=!1;if(l==="\\"){u===e.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[h,p,f,m]=(0,_h.parseClass)(e,u);if(f){s+=h,o=o||p,u+=f-1,t=t||m;continue}}if(l==="?"){s+=uo,t=!0;continue}s+=Rh(l)}return[s,(0,cr.unescape)(e),!!t,o]}};dr.AST=lr;qe=lr});var fo=M(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.escape=void 0;var xh=(r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?r.replace(/[?*()[\]{}]/g,"[$&]"):r.replace(/[?*()[\]\\{}]/g,"\\$&"):e?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&");fr.escape=xh});var ho=M(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var Mh=vu(),hr=yu(),Ou=lo(),kh=fo(),Eh=ar(),qh=(r,e,t={})=>((0,hr.assertValidPattern)(e),!t.nocomment&&e.charAt(0)==="#"?!1:new dn(e,t).match(r));k.minimatch=qh;var Ih=/^\*+([^+@!?*[(]*)$/,Ah=r=>e=>!e.startsWith(".")&&e.endsWith(r),jh=r=>e=>e.endsWith(r),Lh=r=>(r=r.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(r)),Nh=r=>(r=r.toLowerCase(),e=>e.toLowerCase().endsWith(r)),Uh=/^\*+\.\*+$/,Kh=r=>!r.startsWith(".")&&r.includes("."),Hh=r=>r!=="."&&r!==".."&&r.includes("."),Wh=/^\.\*+$/,$h=r=>r!=="."&&r!==".."&&r.startsWith("."),Bh=/^\*+$/,zh=r=>r.length!==0&&!r.startsWith("."),Vh=r=>r.length!==0&&r!=="."&&r!=="..",Gh=/^\?+([^+@!?*[(]*)?$/,Jh=([r,e=""])=>{let t=Ru([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Yh=([r,e=""])=>{let t=Fu([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Qh=([r,e=""])=>{let t=Fu([r]);return e?n=>t(n)&&n.endsWith(e):t},Zh=([r,e=""])=>{let t=Ru([r]);return e?n=>t(n)&&n.endsWith(e):t},Ru=([r])=>{let e=r.length;return t=>t.length===e&&!t.startsWith(".")},Fu=([r])=>{let e=r.length;return t=>t.length===e&&t!=="."&&t!==".."},xu=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Pu={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=xu==="win32"?Pu.win32.sep:Pu.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var Xh="[^/]",ep=Xh+"*?",tp="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",np="(?:(?!(?:\\/|^)\\.).)*?",ip=(r,e={})=>t=>(0,k.minimatch)(t,r,e);k.filter=ip;k.minimatch.filter=k.filter;var Be=(r,e={})=>Object.assign({},r,e),rp=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return k.minimatch;let e=k.minimatch;return Object.assign((n,i,s={})=>e(n,i,Be(r,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,Be(r,s))}static defaults(i){return e.defaults(Be(r,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,Be(r,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Be(r,s))}},unescape:(n,i={})=>e.unescape(n,Be(r,i)),escape:(n,i={})=>e.escape(n,Be(r,i)),filter:(n,i={})=>e.filter(n,Be(r,i)),defaults:n=>e.defaults(Be(r,n)),makeRe:(n,i={})=>e.makeRe(n,Be(r,i)),braceExpand:(n,i={})=>e.braceExpand(n,Be(r,i)),match:(n,i,s={})=>e.match(n,i,Be(r,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=rp;k.minimatch.defaults=k.defaults;var sp=(r,e={})=>((0,hr.assertValidPattern)(r),e.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,Mh.expand)(r,{max:e.braceExpandMax}));k.braceExpand=sp;k.minimatch.braceExpand=k.braceExpand;var op=(r,e={})=>new dn(r,e).makeRe();k.makeRe=op;k.minimatch.makeRe=k.makeRe;var ap=(r,e,t={})=>{let n=new dn(e,t);return r=r.filter(i=>n.match(i)),n.options.nonull&&!r.length&&r.push(e),r};k.match=ap;k.minimatch.match=k.match;var Tu=/[?*]|[+@!]\(.*?\)|\[|\]/,cp=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),dn=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){(0,hr.assertValidPattern)(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||xu,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let u=s[0]===""&&s[1]===""&&(s[2]==="?"||!Tu.test(s[2]))&&!Tu.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(u)return[...s.slice(0,4),...s.slice(4).map(h=>this.parse(h))];if(l)return[s[0],...s.slice(1).map(h=>this.parse(h))]}return s.map(u=>this.parse(u))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n of e)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let n=-1;for(;(n=t.indexOf("**",n+1))!==-1;){let i=n;for(;t[i+1]==="**";)i++;i!==n&&t.splice(n,i-n)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],u=n[i+2],l=n[i+3];if(a!==".."||!u||u==="."||u===".."||!l||l==="."||l==="..")continue;t=!0,n.splice(i,1);let h=n.slice(0);h[i]="**",e.push(h),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(t=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(t=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let u=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...u),n.length===0&&n.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let i=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(i){e[t]=[],e[n]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(a==="b"?t[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(n&&t[s]==="**"&&e[i]===t[s+1])o.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),u=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),h=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),p=u?3:a?0:void 0,f=h?3:l?0:void 0;if(typeof p=="number"&&typeof f=="number"){let[m,g]=[e[p],t[f]];m.toLowerCase()===g.toLowerCase()&&(t[f]=m,s=f,i=p)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(k.GLOBSTAR)?this.#n(e,t,n,i,s):this.#r(e,t,n,i,s)}#n(e,t,n,i,s){let o=t.indexOf(k.GLOBSTAR,s),a=t.lastIndexOf(k.GLOBSTAR),[u,l,h]=n?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,a),t.slice(a+1)];if(u.length){let C=e.slice(i,i+u.length);if(!this.#r(C,u,n,0,0))return!1;i+=u.length,s+=u.length}let p=0;if(h.length){if(h.length+i>e.length)return!1;let C=e.length-h.length;if(this.#r(e,h,n,C,0))p=h.length;else{if(e[e.length-1]!==""||i+h.length===e.length||(C--,!this.#r(e,h,n,C,0)))return!1;p=h.length+1}}if(!l.length){let C=!!p;for(let D=i;D<e.length-p;D++){let F=String(e[D]);if(C=!0,F==="."||F===".."||!this.options.dot&&F.startsWith("."))return!1}return n||C}let f=[[[],0]],m=f[0],g=0,v=[0];for(let C of l)C===k.GLOBSTAR?(v.push(g),m=[[],0],f.push(m)):(m[0].push(C),g++);let _=f.length-1,T=e.length-p;for(let C of f)C[1]=T-(v[_--]+C[0].length);return!!this.#i(e,f,i,0,n,0,!!p)}#i(e,t,n,i,s,o,a){let u=t[i];if(!u){for(let p=n;p<e.length;p++){a=!0;let f=e[p];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[l,h]=u;for(;n<=h;){if(this.#r(e.slice(0,n+l.length),l,s,n,0)&&o<this.maxGlobstarRecursion){let m=this.#i(e,t,n+l.length,i+1,s,o+1,a);if(m!==!1)return m}let f=e[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return s||null}#r(e,t,n,i,s){let o,a,u,l;for(o=i,a=s,l=e.length,u=t.length;o<l&&a<u;o++,a++){this.debug("matchOne loop");let h=t[a],p=e[o];if(this.debug(t,h,p),h===!1||h===k.GLOBSTAR)return!1;let f;if(typeof h=="string"?(f=p===h,this.debug("string match",h,p,f)):(f=h.test(p),this.debug("pattern match",h,p,f)),!f)return!1}if(o===l&&a===u)return!0;if(o===l)return n;if(a===u)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,hr.assertValidPattern)(e);let t=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let n,i=null;(n=e.match(Bh))?i=t.dot?Vh:zh:(n=e.match(Ih))?i=(t.nocase?t.dot?Nh:Lh:t.dot?jh:Ah)(n[1]):(n=e.match(Gh))?i=(t.nocase?t.dot?Yh:Jh:t.dot?Qh:Zh)(n):(n=e.match(Uh))?i=t.dot?Hh:Kh:(n=e.match(Wh))&&(i=$h);let s=Ou.AST.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?ep:t.dot?tp:np,i=new Set(t.nocase?["i"]:[]),s=e.map(u=>{let l=u.map(p=>{if(p instanceof RegExp)for(let f of p.flags.split(""))i.add(f);return typeof p=="string"?cp(p):p===k.GLOBSTAR?k.GLOBSTAR:p._src});l.forEach((p,f)=>{let m=l[f+1],g=l[f-1];p!==k.GLOBSTAR||g===k.GLOBSTAR||(g===void 0?m!==void 0&&m!==k.GLOBSTAR?l[f+1]="(?:\\/|"+n+"\\/)?"+m:l[f]=n:m===void 0?l[f-1]=g+"(?:\\/|\\/"+n+")?":m!==k.GLOBSTAR&&(l[f-1]=g+"(?:\\/|\\/"+n+"\\/)"+m,l[f+1]=k.GLOBSTAR))});let h=l.filter(p=>p!==k.GLOBSTAR);if(this.partial&&h.length>=1){let p=[];for(let f=1;f<=h.length;f++)p.push(h.slice(0,f).join("/"));return"(?:"+p.join("|")+")"}return h.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let u=i;if(n.matchBase&&a.length===1&&(u=[o]),this.matchOne(u,a,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=dn;var up=lo();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return up.AST}});var lp=fo();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return lp.escape}});var dp=ar();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return dp.unescape}});k.minimatch.AST=Ou.AST;k.minimatch.Minimatch=dn;k.minimatch.escape=kh.escape;k.minimatch.unescape=Eh.unescape});var po=M(It=>{"use strict";var fp=It&&It.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),hp=It&&It.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),pp=It&&It.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&fp(t,e,n[i]);return hp(t,e),t}})();Object.defineProperty(It,"__esModule",{value:!0});It.matchGlobPattern=vp;var gp=pp(ho()),mp=I("vscode");function vp(r,e){let t;if(typeof r=="string")t=r.replace(/\\/g,"/");else try{let i=mp.Uri.parse(typeof r.baseUri=="string"?r.baseUri:r.baseUri.uri);t=i.with({path:i.path+"/"+r.pattern}).fsPath.replace(/\\/g,"/")}catch{return!1}let n=new gp.Minimatch(t,{noext:!0});return n.makeRe()?n.match(e.fsPath):!1}});var wo=M(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.DiagnosticFeature=Qt.DiagnosticPullMode=Qt.vsdiag=void 0;var re=I("vscode"),se=N(),yp=ie(),_p=po(),ci=B();function pr(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var Le;(function(r){let e;(function(t){t.full="full",t.unChanged="unChanged"})(e=r.DocumentDiagnosticReportKind||(r.DocumentDiagnosticReportKind={}))})(Le||(Qt.vsdiag=Le={}));var ui;(function(r){r.onType="onType",r.onSave="onSave",r.onFocus="onFocus"})(ui||(Qt.DiagnosticPullMode=ui={}));var Ce;(function(r){r.active="open",r.reschedule="reschedule",r.outDated="drop"})(Ce||(Ce={}));var me;(function(r){r[r.document=1]="document",r[r.workspace=2]="workspace"})(me||(me={}));var At;(function(r){function e(t){return t instanceof re.Uri?t.toString():t.uri.toString()}r.asKey=e})(At||(At={}));var go=class{documentPullStates;workspacePullStates;constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(e,t,n){let i=e===me.document?this.documentPullStates:this.workspacePullStates,[s,o,a]=t instanceof re.Uri?[t.toString(),t,n]:[t.uri.toString(),t.uri,t.version],u=i.get(s);return u===void 0&&(u={document:o,pulledVersion:a,resultId:void 0},i.set(s,u)),u}update(e,t,n,i){let s=e===me.document?this.documentPullStates:this.workspacePullStates,[o,a,u,l]=t instanceof re.Uri?[t.toString(),t,n,i]:[t.uri.toString(),t.uri,t.version,n],h=s.get(o);h===void 0?(h={document:a,pulledVersion:u,resultId:l},s.set(o,h)):(h.pulledVersion=u,h.resultId=l)}unTrack(e,t){let n=At.asKey(t);(e===me.document?this.documentPullStates:this.workspacePullStates).delete(n)}tracks(e,t){let n=At.asKey(t);return(e===me.document?this.documentPullStates:this.workspacePullStates).has(n)}tracksSameVersion(e,t){let n=t.uri.toString(),s=(e===me.document?this.documentPullStates:this.workspacePullStates).get(n);return s!==void 0&&s.pulledVersion===t.version}getResultId(e,t){let n=At.asKey(t);return(e===me.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}},mo=class{isDisposed;client;visibleDocuments;options;onDidChangeDiagnosticsEmitter;provider;diagnostics;openRequests;documentStates;workspaceErrorCounter;workspaceCancellation;workspaceTimeout;constructor(e,t,n){this.client=e,this.visibleDocuments=t,this.options=n,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new re.EventEmitter,this.provider=this.createProvider(),this.diagnostics=this.createDiagnosticCollection(),this.openRequests=new Map,this.documentStates=new go,this.workspaceErrorCounter=0}createDiagnosticCollection(){return this.client.clientOptions.diagnosticCollectionProvider===void 0?re.languages.createDiagnosticCollection(this.options.identifier):this.client.clientOptions.diagnosticCollectionProvider.create(this.options.identifier,ci.DiagnosticCollectionSource.pull)}knows(e,t){let n=t instanceof re.Uri?t:t.uri;return this.documentStates.tracks(e,t)||this.openRequests.has(n.toString())}knowsSameVersion(e,t){let n=this.openRequests.get(t.uri.toString());return n===void 0?this.documentStates.tracksSameVersion(e,t):n.state===Ce.reschedule?!0:n.state===Ce.outDated?!1:n.version===t.version}forget(e,t){this.documentStates.unTrack(e,t)}pull(e,t){if(this.isDisposed)return;let n=e instanceof re.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 re.Uri,i=n?e:e.uri,s=i.toString();t=n?t:e.version;let o=this.openRequests.get(s),a=n?this.documentStates.track(me.document,e,t):this.documentStates.track(me.document,e);if(o===void 0){let u=new re.CancellationTokenSource;this.openRequests.set(s,{state:Ce.active,document:e,version:t,tokenSource:u});let l,h;try{l=await this.provider.provideDiagnostics(e,a.resultId,u.token)??{kind:Le.DocumentDiagnosticReportKind.full,items:[]}}catch(p){if(p instanceof ci.LSPCancellationError&&se.DiagnosticServerCancellationData.is(p.data)&&p.data.retriggerRequest===!1&&(h={state:Ce.outDated,document:e}),h===void 0&&p instanceof re.CancellationError)h={state:Ce.reschedule,document:e};else throw p}if(h=h??this.openRequests.get(s),h===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${s}`),this.diagnostics.delete(i);return}if(this.openRequests.delete(s),!this.visibleDocuments.isVisible(e)){this.documentStates.unTrack(me.document,e);return}if(h.state===Ce.outDated)return;l!==void 0&&(l.kind===Le.DocumentDiagnosticReportKind.full&&this.diagnostics.set(i,l.items),a.pulledVersion=t,a.resultId=l.resultId),h.state===Ce.reschedule&&this.pull(e)}else o.state===Ce.active?(o.tokenSource.cancel(),this.openRequests.set(s,{state:Ce.reschedule,document:o.document})):o.state===Ce.outDated&&this.openRequests.set(s,{state:Ce.reschedule,document:o.document})}forgetDocument(e){if(this.isDisposed)return;let t=e instanceof re.Uri?e:e.uri,n=t.toString(),i=this.openRequests.get(n);this.options.workspaceDiagnostics&&t.scheme!=="untitled"?(i!==void 0?this.openRequests.set(n,{state:Ce.reschedule,document:e}):this.pull(e,()=>{this.forget(me.document,e)}),this.forget(me.workspace,e)):(i!==void 0&&(i.state===Ce.active&&i.tokenSource.cancel(),this.openRequests.set(n,{state:Ce.outDated,document:e})),this.diagnostics.delete(t),this.forget(me.document,e))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,se.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},e=>{!(e instanceof ci.LSPCancellationError)&&!se.DiagnosticServerCancellationData.is(e.data)&&(this.client.error("Workspace diagnostic pull failed.",e,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,se.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 re.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===Le.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(me.document,n.uri)||this.diagnostics.set(n.uri,n.items)),this.documentStates.update(me.workspace,n.uri,n.version??void 0,n.resultId)})}createProvider(){let e={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(t,n,i)=>{let s=(a,u,l)=>{let h={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(a instanceof re.Uri?a:a.uri)},previousResultId:u};return this.isDisposed===!0||!this.client.isRunning()?{kind:Le.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(se.DocumentDiagnosticRequest.type,h,l).then(async p=>{if(this.isDisposed)return{kind:Le.DocumentDiagnosticReportKind.full,items:[]};if(l.isCancellationRequested)throw new re.CancellationError;return p==null?{kind:Le.DocumentDiagnosticReportKind.full,items:[]}:p.kind===se.DocumentDiagnosticReportKind.Full?{kind:Le.DocumentDiagnosticReportKind.full,resultId:p.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(p.items,l)}:{kind:Le.DocumentDiagnosticReportKind.unChanged,resultId:p.resultId}},p=>this.client.handleFailedRequest(se.DocumentDiagnosticRequest.type,l,p,{kind:Le.DocumentDiagnosticReportKind.full,items:[]},!0,!0))},o=this.client.middleware;return o.provideDiagnostics?o.provideDiagnostics(t,n,i,s):s(t,n,i)}};return this.options.workspaceDiagnostics&&(e.provideWorkspaceDiagnostics=(t,n,i)=>{let s=async l=>l.kind===se.DocumentDiagnosticReportKind.Full?{kind:Le.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:Le.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version},o=l=>{let h=[];for(let p of l)h.push({uri:this.client.code2ProtocolConverter.asUri(p.uri),value:p.value});return h},a=(l,h,p)=>{let f=(0,yp.generateUuid)(),m=this.client.onProgress(se.WorkspaceDiagnosticRequest.partialResult,f,async v=>{if(v==null){p(null);return}let _={items:[]};for(let T of v.items)try{_.items.push(await s(T))}catch(C){this.client.error("Converting workspace diagnostics failed.",C)}p(_)}),g={identifier:this.options.identifier,previousResultIds:o(l),partialResultToken:f};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(se.WorkspaceDiagnosticRequest.type,g,h).then(async v=>{if(h.isCancellationRequested)return{items:[]};let _={items:[]};for(let T of v.items)_.items.push(await s(T));return m.dispose(),p(_),{items:[]}},v=>(m.dispose(),this.client.handleFailedRequest(se.DocumentDiagnosticRequest.type,h,v,{items:[]})))},u=this.client.middleware;return u.provideWorkspaceDiagnostics?u.provideWorkspaceDiagnostics(t,n,i,a):a(t,n,i)}),e}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(let[e,t]of this.openRequests)t.state===Ce.active&&t.tokenSource.cancel(),this.openRequests.set(e,{state:Ce.outDated,document:t.document});this.client.clientOptions.diagnosticCollectionProvider!==void 0?this.client.clientOptions.diagnosticCollectionProvider.dispose(this.diagnostics,ci.DiagnosticCollectionSource.pull):this.diagnostics.dispose()}},vo=class{client;diagnosticRequestor;lastDocumentToPull;documents;timeoutHandle;isDisposed;constructor(e,t){this.client=e,this.diagnosticRequestor=t,this.documents=new se.LinkedMap,this.isDisposed=!1}add(e){if(this.isDisposed===!0)return;let t=At.asKey(e);this.documents.has(t)||(this.documents.set(t,e,se.Touch.Last),this.lastDocumentToPull=e)}remove(e){let t=At.asKey(e);if(this.documents.delete(t),this.documents.size===0){this.stop();return}else if(t===this.lastDocumentToPullKey()){let n=this.documents.before(t);n===void 0?this.stop():this.lastDocumentToPull=n}}trigger(){this.lastDocumentToPull=this.documents.last,this.runLoop()}runLoop(){if(this.isDisposed!==!0){if(this.documents.size===0){this.stop();return}this.lastDocumentToPull!==void 0&&this.timeoutHandle===void 0&&(this.timeoutHandle=(0,se.RAL)().timer.setTimeout(()=>{let e=this.documents.first;if(e===void 0)return;let t=At.asKey(e);this.diagnosticRequestor.pullAsync(e).catch(n=>{this.client.error(`Document pull failed for text document ${t}`,n,!1)}).finally(()=>{this.timeoutHandle=void 0,this.documents.set(t,e,se.Touch.Last),t!==this.lastDocumentToPullKey()&&this.runLoop()})},500))}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear(),this.lastDocumentToPull=void 0}stop(){this.timeoutHandle?.dispose(),this.timeoutHandle=void 0,this.lastDocumentToPull=void 0}lastDocumentToPullKey(){return this.lastDocumentToPull!==void 0?At.asKey(this.lastDocumentToPull):void 0}},yo=class{disposable;diagnosticRequestor;activeTextDocument;backgroundScheduler;constructor(e,t,n){let i=Object.assign({onChange:!1,onSave:!1,onFocus:!1},e.clientOptions.diagnosticPullOptions),s=e.protocol2CodeConverter.asDocumentSelector(n.documentSelector),o=[],a=(C,D)=>!(typeof C=="string"||C.language!==void 0&&C.language!=="*"||C.scheme!==void 0&&C.scheme!=="*"&&C.scheme!==D.scheme||C.pattern!==void 0&&!(0,_p.matchGlobPattern)(C.pattern,D)),u=C=>{let D=n.documentSelector;if(i.match!==void 0)return i.match(D,C);for(let F of D)if(se.TextDocumentFilter.is(F)&&a(F,C))return!0;return!1},l=C=>C instanceof re.Uri?u(C):re.languages.match(s,C)>0&&t.isVisible(C),h=C=>re.languages.match(s,C.document)>0&&t.isVisible(C.notebook.uri),p=C=>C instanceof re.Uri?this.activeTextDocument?.uri.toString()===C.toString():this.activeTextDocument===C;this.diagnosticRequestor=new mo(e,t,n),this.backgroundScheduler=new vo(e,this.diagnosticRequestor);let f=C=>{!l(C)||!n.interFileDependencies||p(C)||i.onChange===!1||this.backgroundScheduler.add(C)},m=(C,D)=>(i.filter===void 0||!i.filter(C,D))&&this.diagnosticRequestor.knows(me.document,C);this.activeTextDocument=re.window.activeTextEditor?.document,o.push(re.window.onDidChangeActiveTextEditor(C=>{let D=this.activeTextDocument;this.activeTextDocument=C?.document,D!==void 0&&f(D),this.activeTextDocument!==void 0&&(this.backgroundScheduler.remove(this.activeTextDocument),i.onFocus===!0&&l(this.activeTextDocument)&&m(this.activeTextDocument,ui.onFocus)&&this.diagnosticRequestor.pull(this.activeTextDocument))}));let g=e.getFeature(se.DidOpenTextDocumentNotification.method);o.push(g.onNotificationSent(C=>{let D=C.textDocument;this.diagnosticRequestor.knowsSameVersion(me.document,D)||l(D)&&this.diagnosticRequestor.pull(D,()=>{f(D)})}));let v=e.getFeature(se.NotebookDocumentSyncRegistrationType.method);o.push(v.onOpenNotificationSent(C=>{for(let D of C.getCells())h(D)&&this.diagnosticRequestor.pull(D.document,()=>{f(D.document)})})),o.push(t.onOpen(C=>{for(let D of C){if(this.diagnosticRequestor.knows(me.document,D))continue;let F=D.toString(),E;for(let Z of re.workspace.textDocuments)if(F===Z.uri.toString()){E=Z;break}E!==void 0&&l(E)&&this.diagnosticRequestor.pull(E,()=>{f(E)})}}));let _=new Set;for(let C of re.workspace.textDocuments)l(C)&&(this.diagnosticRequestor.pull(C,()=>{f(C)}),_.add(C.uri.toString()));for(let C of re.workspace.notebookDocuments)for(let D of C.getCells())h(D)&&(this.diagnosticRequestor.pull(D.document,()=>{f(D.document)}),_.add(D.document.uri.toString()));if(i.onTabs===!0)for(let C of t.getResources())!_.has(C.toString())&&l(C)&&this.diagnosticRequestor.pull(C,()=>{f(C)});if(i.onChange===!0){let C=e.getFeature(se.DidChangeTextDocumentNotification.method);o.push(C.onNotificationSent(async D=>{let F=D.textDocument;m(F,ui.onType)&&this.diagnosticRequestor.pull(F,()=>{this.backgroundScheduler.trigger()})})),o.push(v.onChangeNotificationSent(async D=>{let E=(D.cells?.textContent||[]).map(Me=>D.notebook.getCells().find(Kn=>Kn.document.uri.toString()===Me.document.uri.toString()));for(let Me of E)Me&&h(Me)&&this.diagnosticRequestor.pull(Me.document,()=>{this.backgroundScheduler.trigger()});let Z=D.cells?.structure?.didClose||[];for(let Me of Z)this.diagnosticRequestor.forgetDocument(Me.document);let we=D.cells?.structure?.didOpen||[];for(let Me of we)h(Me)&&this.diagnosticRequestor.pull(Me.document,()=>{this.backgroundScheduler.trigger()})}))}if(i.onSave===!0){let C=e.getFeature(se.DidSaveTextDocumentNotification.method);o.push(C.onNotificationSent(D=>{let F=D.textDocument;m(F,ui.onSave)&&this.diagnosticRequestor.pull(D.textDocument)})),o.push(v.onSaveNotificationSent(D=>{for(let F of D.getCells())h(F)&&this.diagnosticRequestor.pull(F.document)}))}let T=e.getFeature(se.DidCloseTextDocumentNotification.method);o.push(T.onAboutToSendNotification(C=>{this.cleanUpDocument(C.textDocument)})),o.push(v.onCloseNotificationSent(C=>{for(let D of C.getCells())this.cleanUpDocument(D.document)})),o.push(t.onClose(C=>{for(let D of C)this.cleanUpDocument(D)})),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(let C of re.workspace.textDocuments)l(C)&&this.diagnosticRequestor.pull(C)}),n.workspaceDiagnostics===!0&&n.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=re.Disposable.from(...o,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}forget(e){this.cleanUpDocument(e)}cleanUpDocument(e){this.backgroundScheduler.remove(e),this.diagnosticRequestor.knows(me.document,e)&&this.diagnosticRequestor.forgetDocument(e)}},_o=class extends ci.TextDocumentLanguageFeature{constructor(e){super(e,se.DocumentDiagnosticRequest.type)}fillClientCapabilities(e){let t=pr(pr(e,"textDocument"),"diagnostic");t.relatedInformation=!0,t.tagSupport={valueSet:[se.DiagnosticTag.Unnecessary,se.DiagnosticTag.Deprecated]},t.codeDescriptionSupport=!0,t.dataSupport=!0,t.dynamicRegistration=!0,t.relatedDocumentSupport=!1,t.markupMessageSupport=!1,pr(pr(e,"workspace"),"diagnostics").refreshSupport=!0}initialize(e,t){this._client.onRequest(se.DiagnosticRefreshRequest.type,async()=>{for(let o of this.getAllProviders())o.onDidChangeDiagnosticsEmitter.fire()});let[i,s]=this.getRegistration(t,e.diagnosticProvider);!i||!s||this.register({id:i,registerOptions:s})}clear(){super.clear()}refresh(){for(let e of this.getAllProviders())e.onDidChangeDiagnosticsEmitter.fire()}registerLanguageProvider(e){let t=new yo(this._client,this._client.visibleDocuments,e);return[t.disposable,t]}};Qt.DiagnosticFeature=_o});var Eu=M(st=>{"use strict";var wp=st&&st.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Cp=st&&st.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),yr=st&&st.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&wp(t,e,n[i]);return Cp(t,e),t}})();Object.defineProperty(st,"__esModule",{value:!0});st.NotebookDocumentSyncFeature=void 0;var oe=yr(I("vscode")),jt=yr(N()),bp=yr(ie()),Mu=yr(We()),Sp=po();function ku(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var On;(function(r){let e;(function(t){function n(f,m){return{version:f.version,uri:m.asUri(f.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function i(f,m,g){let v=jt.NotebookDocument.create(g.asUri(f.uri),f.notebookType,f.version,s(m,g));return Object.keys(f.metadata).length>0&&(v.metadata=o(f.metadata)),v}t.asNotebookDocument=i;function s(f,m){return f.map(g=>a(g,m))}t.asNotebookCells=s;function o(f){return l(new Set,f)}t.asMetadata=o;function a(f,m){let g=jt.NotebookCell.create(u(f.kind),m.asUri(f.document.uri));return Object.keys(f.metadata).length>0&&(g.metadata=o(f.metadata)),f.executionSummary!==void 0&&Mu.number(f.executionSummary.executionOrder)&&Mu.boolean(f.executionSummary.success)&&(g.executionSummary={executionOrder:f.executionSummary.executionOrder,success:f.executionSummary.success}),g}t.asNotebookCell=a;function u(f){switch(f){case oe.NotebookCellKind.Markup:return jt.NotebookCellKind.Markup;case oe.NotebookCellKind.Code:return jt.NotebookCellKind.Code}}function l(f,m){if(f.has(m))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(m)){let g=[];for(let v of m)if(v!==null&&typeof v=="object"||Array.isArray(v))g.push(l(f,v));else{if(v instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");g.push(v)}return g}else{let g=Object.keys(m),v=Object.create(null);for(let _ of g){let T=m[_];if(T!==null&&typeof T=="object"||Array.isArray(T))v[_]=l(f,T);else{if(T instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");v[_]=T}}return v}}function h(f,m){let g=m.asChangeTextDocumentParams(f,f.document.uri,f.document.version);return{document:g.textDocument,changes:g.contentChanges}}t.asTextContentChange=h;function p(f,m){let g=Object.create(null);if(f.metadata&&(g.metadata=r.c2p.asMetadata(f.metadata)),f.cells!==void 0){let v=Object.create(null),_=f.cells;_.structure&&(v.structure={array:{start:_.structure.array.start,deleteCount:_.structure.array.deleteCount,cells:_.structure.array.cells!==void 0?_.structure.array.cells.map(T=>r.c2p.asNotebookCell(T,m)):void 0},didOpen:_.structure.didOpen!==void 0?_.structure.didOpen.map(T=>m.asOpenTextDocumentParams(T.document).textDocument):void 0,didClose:_.structure.didClose!==void 0?_.structure.didClose.map(T=>m.asCloseTextDocumentParams(T.document).textDocument):void 0}),_.data!==void 0&&(v.data=_.data.map(T=>r.c2p.asNotebookCell(T,m))),_.textContent!==void 0&&(v.textContent=_.textContent.map(T=>r.c2p.asTextContentChange(T,m))),Object.keys(v).length>0&&(g.cells=v)}return g}t.asNotebookDocumentChangeEvent=p})(e=r.c2p||(r.c2p={}))})(On||(On={}));var Co;(function(r){function e(a,u,l){let h=a.length,p=u.length,f=0;for(;f<p&&f<h&&t(a[f],u[f],l);)f++;if(f<p&&f<h){let m=h-1,g=p-1;for(;m>=0&&g>=0&&t(a[m],u[g],l);)m--,g--;let v=m+1-f,_=f===g+1?void 0:u.slice(f,g+1);return _!==void 0?{start:f,deleteCount:v,cells:_}:{start:f,deleteCount:v}}else return f<p?{start:f,deleteCount:0,cells:u.slice(f)}:f<h?{start:f,deleteCount:h-f}:void 0}r.computeDiff=e;function t(a,u,l=!0){return a.kind!==u.kind||a.document.uri.toString()!==u.document.uri.toString()||a.document.languageId!==u.document.languageId||!n(a.executionSummary,u.executionSummary)?!1:!l||l&&s(a.metadata,u.metadata)}function n(a,u){return a===u?!0:a===void 0||u===void 0?!1:a.executionOrder===u.executionOrder&&a.success===u.success&&i(a.timing,u.timing)}function i(a,u){return a===u?!0:a===void 0||u===void 0?!1:a.startTime===u.startTime&&a.endTime===u.endTime}function s(a,u){if(a===u)return!0;if(a==null||u===null||u===void 0||typeof a!=typeof u||typeof a!="object")return!1;let l=Array.isArray(a),h=Array.isArray(u);if(l!==h)return!1;if(l&&h){if(a.length!==u.length)return!1;for(let p=0;p<a.length;p++)if(!s(a[p],u[p]))return!1}if(o(a)&&o(u)){let p=Object.keys(a),f=Object.keys(u);if(p.length!==f.length||(p.sort(),f.sort(),!s(p,f)))return!1;for(let m=0;m<p.length;m++){let g=p[m];if(!s(a[g],u[g]))return!1}return!0}return!1}function o(a){return a!==null&&typeof a=="object"}r.isObjectLiteral=o})(Co||(Co={}));var gr;(function(r){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;return!(t.scheme!==void 0&&t.scheme!=="*"&&i.scheme!==t.scheme||t.pattern!==void 0&&!(0,Sp.matchGlobPattern)(t.pattern,i))}r.matchNotebook=e})(gr||(gr={}));var mr;(function(r){function e(n){let i=n.notebookSelector,s=[];for(let o of i){let a=(typeof o.notebook=="string"?o.notebook:o.notebook?.notebookType)??"*",u=typeof o.notebook=="string"?void 0:o.notebook?.scheme,l=typeof o.notebook=="string"?void 0:o.notebook?.pattern;if(o.cells!==void 0)for(let h of o.cells)s.push(t(a,u,l,h.language));else s.push(t(a,u,l,void 0))}return s}r.asDocumentSelector=e;function t(n,i,s,o){return i===void 0&&s===void 0?{notebook:n,language:o}:{notebook:{notebookType:n,scheme:i,pattern:s},language:o}}})(mr||(mr={}));var vr;(function(r){function e(t){return{cells:t,uris:new Set(t.map(n=>n.document.uri.toString()))}}r.create=e})(vr||(vr={}));var Rn=class{client;options;notebookSyncInfo;notebookDidOpen;disposables;selector;onChangeNotificationSent;onOpenNotificationSent;onCloseNotificationSent;onSaveNotificationSent;constructor(e,t,n,i,s,o){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(mr.asDocumentSelector(t)),this.onChangeNotificationSent=n,this.onOpenNotificationSent=i,this.onCloseNotificationSent=s,this.onSaveNotificationSent=o,oe.workspace.onDidOpenNotebookDocument(a=>{this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a)},void 0,this.disposables);for(let a of oe.workspace.notebookDocuments)this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a);oe.workspace.onDidChangeNotebookDocument(a=>this.didChangeNotebookDocument(a),void 0,this.disposables),this.options.save===!0&&oe.workspace.onDidSaveNotebookDocument(a=>this.didSave(a),void 0,this.disposables),oe.workspace.onDidCloseNotebookDocument(a=>{this.didClose(a),this.notebookDidOpen.delete(a.uri.toString())},void 0,this.disposables)}getState(){for(let e of oe.workspace.notebookDocuments)if(this.getMatchingCellsConsideringSyncInfo(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){if(oe.languages.match(this.selector,e)>0)return!0;let t=e.uri.toString();for(let n of this.notebookSyncInfo.values())if(n.uris.has(t))return!0;return!1}didOpenNotebookCellTextDocument(e,t){if(oe.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let n=this.getSyncInfo(e),i=this.cellMatches(e,t);if(n!==void 0){let s=n.uris.has(t.document.uri.toString());if(i&&s||!i&&!s)return;if(i){let o=this.mergeCells(e,n,[t]);if(o!==void 0){let a=this.asNotebookDocumentChangeEvent(e,void 0,n,o);a!==void 0&&this.doSendChange(a,o).catch(()=>{})}}}else i&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t,n){if(oe.languages.match(this.selector,n.document)===0)return;let i=this.getSyncInfo(e);i===void 0||!i.uris.has(t.document.uri.toString())||this.doSendChange({notebook:e,cells:{textContent:[n]}},i.cells).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let n=this.getSyncInfo(e);if(n===void 0)return;let i=t.document.uri,s=n.cells.findIndex(o=>o.document.uri.toString()===i.toString());if(s!==-1)if(s===0&&n.cells.length===1)this.doSendClose(e,n.cells).catch(()=>{});else{let o=n.cells.slice(),a=o.splice(s,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:s,deleteCount:1},didClose:a}}},o).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t,n=this.getSyncInfo(e)){if(n!==void 0)if(t===void 0&&(t=n.cells.slice()),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=this.getMatchingCells(e),t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,n=this.getSyncInfo(t);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.getMatchingCellsFromEvent(t,n,e);if(i===void 0){this.didClose(t,n);return}let s=this.asNotebookDocumentChangeEvent(e.notebook,e,n,i);s!==void 0&&this.doSendChange(s,i).catch(()=>{})}}didSave(e){this.getSyncInfo(e)!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.getSyncInfo(e)){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){if(this.getSyncInfo(e)!==void 0)throw new Error(`Notebook document ${e.uri.toString()} is already open`);let n=this.getMatchingCells(e);if(n!==void 0)return this.doSendOpen(e,n)}async doSendOpen(e,t){let n=async(s,o)=>{let a=o.map(u=>this.client.code2ProtocolConverter.asTextDocumentItem(u.document));try{await this.client.sendNotification(jt.DidOpenNotebookDocumentNotification.type,{notebookDocument:On.c2p.asNotebookDocument(s,o,this.client.code2ProtocolConverter),cellTextDocuments:a}),this.onOpenNotificationSent.fire(s)}catch(u){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",u),u}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),vr.create(t)),i?.didOpen!==void 0?i.didOpen(e,t,n):n(e,t)}async sendDidChangeNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e.notebook);if(t===void 0)throw new Error(`Received changed event for un-synced notebook ${e.notebook.uri.toString()}`);return this.doSendChange(e,t)}async doSendChange(e,t){let n=async s=>{try{await this.client.sendNotification(jt.DidChangeNotebookDocumentNotification.type,{notebookDocument:On.c2p.asVersionedNotebookDocumentIdentifier(s.notebook,this.client.code2ProtocolConverter),change:On.c2p.asNotebookDocumentChangeEvent(s,this.client.code2ProtocolConverter)}),this.onChangeNotificationSent.fire(s)}catch(o){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",o),o}},i=this.client.middleware?.notebooks;return e.cells?.structure!==void 0&&this.notebookSyncInfo.set(e.notebook.uri.toString(),vr.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(jt.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}}),this.onSaveNotificationSent.fire(i)}catch(s){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",s),s}},n=this.client.middleware?.notebooks;return n?.didSave!==void 0?n.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e);if(t===void 0)throw new Error(`Received close event for un-synced notebook ${e.uri.toString()}`);return this.doSendClose(e,t)}async doSendClose(e,t){let n=async(s,o)=>{try{await this.client.sendNotification(jt.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(s.uri)},cellTextDocuments:o.map(a=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(a.document))}),this.onCloseNotificationSent.fire(s)}catch(a){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",a),a}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),i?.didClose!==void 0?i.didClose(e,t,n):n(e,t)}getSynchronizedCells(e){return this.getSyncInfo(e)?.cells}asNotebookDocumentChangeEvent(e,t,n,i){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let s={notebook:e};t?.metadata!==void 0&&(s.metadata=On.c2p.asMetadata(t.metadata));let o;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let a=[];o=new Set(i.map(u=>u.document.uri.toString()));for(let u of t.cellChanges)o.has(u.cell.document.uri.toString())&&(u.executionSummary!==void 0||u.metadata!==void 0)&&a.push(u.cell);a.length>0&&(s.cells=s.cells??{},s.cells.data=a)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&n!==void 0&&i!==void 0){let a=n.cells,u=i,l=Co.computeDiff(a,u,!1),h,p;if(l!==void 0){h=l.cells===void 0?new Map:new Map(l.cells.map(g=>[g.document.uri.toString(),g])),p=l.deleteCount===0?new Map:new Map(a.slice(l.start,l.start+l.deleteCount).map(g=>[g.document.uri.toString(),g]));for(let g of Array.from(p.keys()))h.has(g)&&(p.delete(g),h.delete(g));s.cells=s.cells??{};let f=[],m=[];if(h.size>0||p.size>0){for(let g of h.values())f.push(g);for(let g of p.values())m.push(g)}s.cells.structure={array:l,didOpen:f,didClose:m}}}return Object.keys(s).length>1?s: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||gr.matchNotebook(n.notebook,e)){let i=this.filterCells(e,t,n.cells);return i.length===0?void 0:i}}}getMatchingCellsFromEvent(e,t,n){if(this.options.notebookSelector===void 0)return;let i;for(let u of this.options.notebookSelector)if(u.notebook===void 0||gr.matchNotebook(u.notebook,e)){i=u;break}if(i===void 0)return;if((n.cellChanges===void 0||n.cellChanges.length===0)&&(n.contentChanges===void 0||n.contentChanges.length===0))return t.cells;let s;if(n.cellChanges!==void 0&&n.cellChanges.length>0){let u=n.cellChanges.map(h=>h.cell),l=this.filterCells(e,u,i.cells);if(l.length!==u.length){s=new Set(t.uris);for(let h of u)s.delete(h.document.uri.toString());for(let h of l)s.add(h.document.uri.toString())}}if(n.contentChanges!==void 0&&n.contentChanges.length>0){s===void 0&&(s=new Set(t.uris));for(let u of n.contentChanges){for(let h of u.removedCells)s.delete(h.document.uri.toString());let l=this.filterCells(e,new Array(...u.addedCells),i.cells);for(let h of l)s.add(h.document.uri.toString())}}if(s===void 0)return t.cells;let o=[],a=e.getCells();for(let u of a)s.has(u.document.uri.toString())&&o.push(u);return o}getMatchingCellsFromSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:void 0}getMatchingCellsConsideringSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:this.getMatchingCells(e)}mergeCells(e,t,n){let i=[],s=new Set(t.uris);for(let o of n)s.add(o.document.uri.toString());for(let o of e.getCells())s.has(o.document.uri.toString())&&i.push(o);return 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(s=>{let o=s.document.languageId;return n.some((a=>a.language==="*"||o===a.language))}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,i):i}getSyncInfo(e){return this.notebookSyncInfo.get(e.uri.toString())}},bo=class r{static CellScheme="vscode-notebook-cell";client;registrations;dedicatedChannel;_onChangeNotificationSent;_onOpenNotificationSent;_onCloseNotificationSent;_onSaveNotificationSent;constructor(e){this.client=e,this.registrations=new Map,this.registrationType=jt.NotebookDocumentSyncRegistrationType.type,this._onChangeNotificationSent=new oe.EventEmitter,this._onOpenNotificationSent=new oe.EventEmitter,this._onCloseNotificationSent=new oe.EventEmitter,this._onSaveNotificationSent=new oe.EventEmitter,oe.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==r.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let s of this.registrations.values())s instanceof Rn&&s.didOpenNotebookCellTextDocument(n,i)}),oe.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let n=t.document;if(n.uri.scheme!==r.CellScheme)return;let[i,s]=this.findNotebookDocumentAndCell(n);if(!(i===void 0||s===void 0))for(let o of this.registrations.values())o instanceof Rn&&o.didChangeNotebookCellTextDocument(i,s,t)}),oe.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==r.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let s of this.registrations.values())s instanceof Rn&&s.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}}registrationType;get onOpenNotificationSent(){return this._onOpenNotificationSent.event}get onChangeNotificationSent(){return this._onChangeNotificationSent.event}get onCloseNotificationSent(){return this._onCloseNotificationSent.event}get onSaveNotificationSent(){return this._onSaveNotificationSent.event}fillClientCapabilities(e){let t=ku(ku(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(mr.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let n=t.id??bp.generateUuid();this.register({id:n,registerOptions:t})}register(e){let t=new Rn(this.client,e.registerOptions,this._onChangeNotificationSent,this._onOpenNotificationSent,this._onCloseNotificationSent,this._onSaveNotificationSent);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t!==void 0&&(this.registrations.delete(e),t.dispose())}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear(),this._onChangeNotificationSent.dispose(),this._onChangeNotificationSent=new oe.EventEmitter,this._onOpenNotificationSent.dispose(),this._onOpenNotificationSent=new oe.EventEmitter,this._onCloseNotificationSent.dispose(),this._onCloseNotificationSent=new oe.EventEmitter,this._onSaveNotificationSent.dispose(),this._onSaveNotificationSent=new oe.EventEmitter}handles(e){if(e.uri.scheme!==r.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&oe.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 oe.workspace.notebookDocuments)for(let i of n.getCells())if(i.document.uri.toString()===t)return[n,i];return[void 0,void 0]}};st.NotebookDocumentSyncFeature=bo});var Au=M(Ne=>{"use strict";var Dp=Ne&&Ne.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Pp=Ne&&Ne.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Iu=Ne&&Ne.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Dp(t,e,n[i]);return Pp(t,e),t}})();Object.defineProperty(Ne,"__esModule",{value:!0});Ne.SyncConfigurationFeature=Ne.ConfigurationFeature=void 0;Ne.toJSONObject=fn;var Fn=I("vscode"),li=N(),Tp=Iu(We()),Op=Iu(ie()),qu=B(),So=class{_client;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(li.ConfigurationRequest.type,(t,n)=>{let i=o=>{let a=[];for(let u of o.items){let l=u.scopeUri!==void 0&&u.scopeUri!==null?this._client.protocol2CodeConverter.asUri(u.scopeUri):void 0;a.push(this.getConfiguration(l,u.section!==null?u.section:void 0))}return a},s=e.middleware.workspace;return s&&s.configuration?s.configuration(t,n,i):i(t,n)})}getConfiguration(e,t){let n=null;if(t){let i=t.lastIndexOf(".");if(i===-1)n=fn(Fn.workspace.getConfiguration(void 0,e).get(t));else{let s=Fn.workspace.getConfiguration(t.substr(0,i),e);s&&(n=fn(s.get(t.substr(i+1))))}}else{let i=Fn.workspace.getConfiguration(void 0,e);n={};for(let s of Object.keys(i))i.has(s)&&(n[s]=fn(i.get(s)))}return n===void 0&&(n=null),n}clear(){}};Ne.ConfigurationFeature=So;function fn(r){if(r){if(Array.isArray(r))return r.map(fn);if(typeof r=="object"){let e=Object.create(null);for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=fn(r[t]));return e}}return r}var Do=class{_client;isCleared;_listeners;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 li.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,qu.ensure)((0,qu.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:Op.generateUuid(),registerOptions:{section:e}})}register(e){let t=Fn.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(Tp.string(e)?n=[e]:n=e,n!==void 0&&t!==void 0&&!n.some(a=>t.affectsConfiguration(a)))return;let i=async o=>o===void 0?this._client.sendNotification(li.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(li.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(o)}),s=this._client.middleware.workspace?.didChangeConfiguration;(s?s(n,i):i(n)).catch(o=>{this._client.error(`Sending notification ${li.DidChangeConfigurationNotification.type.method} failed`,o)})}extractSettingsInformation(e){function t(s,o){let a=s;for(let u=0;u<o.length-1;u++){let l=a[o[u]];l||(l=Object.create(null),a[o[u]]=l),a=l}return a}let n=this._client.clientOptions.workspaceFolder?this._client.clientOptions.workspaceFolder.uri:void 0,i=Object.create(null);for(let s=0;s<e.length;s++){let o=e[s],a=o.indexOf("."),u=null;if(a>=0?u=Fn.workspace.getConfiguration(o.substr(0,a),n).get(o.substr(a+1)):u=Fn.workspace.getConfiguration(void 0,n).get(o),u){let l=e[s].split(".");t(i,l)[l[l.length-1]]=fn(u)}}return i}};Ne.SyncConfigurationFeature=Do});var Uu={};pd(Uu,{TextDocument:()=>Po});function To(r,e){if(r.length<=1)return r;let t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);To(n,e),To(i,e);let s=0,o=0,a=0;for(;s<n.length&&o<i.length;)e(n[s],i[o])<=0?r[a++]=n[s++]:r[a++]=i[o++];for(;s<n.length;)r[a++]=n[s++];for(;o<i.length;)r[a++]=i[o++];return r}function ju(r,e,t=0){let n=e?[t]:[];for(let i=0;i<r.length;i++){let s=r.charCodeAt(i);Lu(s)&&(s===13&&i+1<r.length&&r.charCodeAt(i+1)===10&&i++,n.push(t+i+1))}return n}function Lu(r){return r===13||r===10}function Nu(r){let e=r.start,t=r.end;return e.line>t.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:r}function Rp(r){let e=Nu(r.range);return e!==r.range?{newText:r.newText,range:e}:r}var _r,Po,Ku=hd(()=>{"use strict";_r=class r{constructor(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){for(let n of e)if(r.isIncremental(n)){let i=Nu(n.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(o,this._content.length);let a=Math.max(i.start.line,0),u=Math.max(i.end.line,0),l=this._lineOffsets,h=ju(n.text,!1,s);if(u-a===h.length)for(let f=0,m=h.length;f<m;f++)l[f+a+1]=h[f];else h.length<1e4?l.splice(a+1,u-a,...h):this._lineOffsets=l=l.slice(0,a+1).concat(h,l.slice(u+1));let p=n.text.length-(o-s);if(p!==0)for(let f=a+1+h.length,m=l.length;f<m;f++)l[f]=l[f]+p}else if(r.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=t}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=ju(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,i=t.length;if(i===0)return{line:0,character:e};for(;n<i;){let o=Math.floor((n+i)/2);t[o]>e?i=o:n=o+1}let s=n-1;return e=this.ensureBeforeEOL(e,t[s]),{line:s,character:e-t[s]}}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line];if(e.character<=0)return n;let i=e.line+1<t.length?t[e.line+1]:this._content.length,s=Math.min(n+e.character,i);return this.ensureBeforeEOL(s,n)}getLineRange(e){let t=this.getLineOffsets();if(e>=t.length){let o=t.length-1;return{start:{line:o,character:0},end:{line:o,character:this._content.length-t[o]}}}else if(e<0)return{start:{line:0,character:0},end:{line:0,character:0}};let n=t[e],i=e+1<t.length?t[e+1]:this._content.length,s=this.ensureBeforeEOL(i,n);return{start:{line:e,character:0},end:{line:e,character:s-n}}}getEOLCharacters(e){let t=this.getLineOffsets();if(e>=t.length)return"";if(e<0)return"";let n=e+1<t.length?t[e+1]:this._content.length,i=this.ensureBeforeEOL(n,t[e]);return this._content.substring(i,n)}ensureBeforeEOL(e,t){for(;e>t&&Lu(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let t=e;return t!=null&&typeof t.text=="string"&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength=="number")}static isFull(e){let t=e;return t!=null&&typeof t.text=="string"&&t.range===void 0&&t.rangeLength===void 0}};(function(r){function e(i,s,o,a){return new _r(i,s,o,a)}r.create=e;function t(i,s,o){if(i instanceof _r)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}r.update=t;function n(i,s){let o=i.getText(),a=To(s.map(Rp),(h,p)=>{let f=h.range.start.line-p.range.start.line;return f===0?h.range.start.character-p.range.start.character:f}),u=0,l=[];for(let h of a){let p=i.offsetAt(h.range.start);if(p<u)throw new Error("Overlapping edit");p>u&&l.push(o.substring(u,p)),h.newText.length&&l.push(h.newText),u=i.offsetAt(h.range.end)}return l.push(o.substr(u)),l.join("")}r.applyEdits=n})(Po||(Po={}))});var Hu=M(ve=>{"use strict";var Fp=ve&&ve.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),xp=ve&&ve.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Mp=ve&&ve.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Fp(t,e,n[i]);return xp(t,e),t}})();Object.defineProperty(ve,"__esModule",{value:!0});ve.DidSaveTextDocumentFeature=ve.WillSaveWaitUntilFeature=ve.WillSaveFeature=ve.DidChangeTextDocumentFeature=ve.DidCloseTextDocumentFeature=ve.DidOpenTextDocumentFeature=void 0;var he=I("vscode"),Y=N(),ce=B(),xn=Mp(ie()),kp=(Ku(),gd(Uu)),Oo=class extends ce.TextDocumentEventFeature{_syncedDocuments;_pendingOpenNotifications;_delayOpen;_pendingOpenListeners;constructor(e,t){super(e,he.workspace.onDidOpenTextDocument,Y.DidOpenTextDocumentNotification.type,()=>e.middleware.didOpen,n=>e.code2ProtocolConverter.asOpenTextDocumentParams(n),n=>n,ce.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingOpenNotifications=new Map,this._delayOpen=e.clientOptions.textSynchronization?.delayOpenNotifications??!1}async callback(e){if(this._delayOpen){if(!this.matches(e))return;if(this._client.visibleDocuments.isVisible(e))return super.callback(e);{let n=new Eo(e);this._pendingOpenNotifications.set(n.uri.toString(),n)}}else return super.callback(e)}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}get registrationType(){return Y.DidOpenTextDocumentNotification.type}register(e){if(super.register(e),!e.registerOptions.documentSelector)return;let t=this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector);if(he.workspace.textDocuments.forEach(n=>{let i=n.uri.toString();if(!this._syncedDocuments.has(i)&&he.languages.match(t,n)>0&&!this._client.hasDedicatedTextSynchronizationFeature(n))if(this._client.visibleDocuments.isVisible(n)){let o=this._client.middleware,a=u=>this._client.sendNotification(this._type,this._createParams(u));(o.didOpen?o.didOpen(n,a):a(n)).catch(u=>{this._client.error(`Sending document notification ${this._type.method} failed`,u)}),this._syncedDocuments.set(i,n)}else this._pendingOpenNotifications.set(i,n)}),this._delayOpen&&this._pendingOpenListeners===void 0){this._pendingOpenListeners=[];let n=this._client.visibleDocuments;this._pendingOpenListeners.push(n.onClose(i=>{for(let s of i)this._pendingOpenNotifications.delete(s.toString())})),this._pendingOpenListeners.push(n.onOpen(i=>{for(let s of i){let o=this._pendingOpenNotifications.get(s.toString());o!==void 0&&(super.callback(o).catch((a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})),this._pendingOpenNotifications.delete(s.toString()))}})),this._pendingOpenListeners.push(he.workspace.onDidCloseTextDocument(i=>{this._pendingOpenNotifications.delete(i.uri.toString())}))}}async sendPendingOpenNotifications(e){let t=Array.from(this._pendingOpenNotifications.values());this._pendingOpenNotifications.clear();let n=!1;for(let i of t){if(e!==void 0&&i.uri.toString()===e){n=!0;continue}await super.callback(i)}return n}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.set(e.uri.toString(),e),super.notificationSent(e,t,n)}clear(){if(this._pendingOpenNotifications.clear(),this._pendingOpenListeners!==void 0){for(let e of this._pendingOpenListeners)e.dispose();this._pendingOpenListeners=void 0}super.clear()}};ve.DidOpenTextDocumentFeature=Oo;var Ro=class extends ce.TextDocumentEventFeature{_syncedDocuments;_pendingTextDocumentChanges;constructor(e,t,n){super(e,he.workspace.onDidCloseTextDocument,Y.DidCloseTextDocumentNotification.type,()=>e.middleware.didClose,i=>e.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,ce.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingTextDocumentChanges=n}get registrationType(){return Y.DidCloseTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:xn.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);if(t===void 0)return;super.unregister(e);let n=this._selectors.values();this._syncedDocuments.forEach(i=>{if(he.languages.match(t,i)>0&&!this._selectorFilter(n,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let s=this._client.middleware,o=a=>this._client.sendNotification(this._type,this._createParams(a));this._syncedDocuments.delete(i.uri.toString()),(s.didClose?s.didClose(i,o):o(i)).catch(a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})}})}};ve.DidCloseTextDocumentFeature=Ro;var Fo=class extends ce.DynamicDocumentFeature{_listener;_changeData;_onAboutToSendNotification;_onNotificationSent;_onPendingChangeAdded;_pendingTextDocumentChanges;_syncKind;constructor(e,t){super(e),this._changeData=new Map,this._onAboutToSendNotification=new he.EventEmitter,this._onNotificationSent=new he.EventEmitter,this._onPendingChangeAdded=new he.EventEmitter,this._pendingTextDocumentChanges=t,this._syncKind=Y.TextDocumentSyncKind.None}get onAboutToSendNotification(){return this._onAboutToSendNotification.event}get onNotificationSent(){return this._onNotificationSent.event}get onPendingChangeAdded(){return this._onPendingChangeAdded.event}get syncKind(){return this._syncKind}get registrationType(){return Y.DidChangeTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.change!==void 0&&n.change!==Y.TextDocumentSyncKind.None&&this.register({id:xn.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},{syncKind:n.change})})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=he.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 s of this._changeData.values())if(he.languages.match(s.documentSelector,e.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let o=this._client.middleware;if(s.syncKind===Y.TextDocumentSyncKind.Incremental){let a=async u=>{let l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(u,t,n);this.aboutToSendNotification(u.document,Y.DidChangeTextDocumentNotification.type,l),await this._client.sendNotification(Y.DidChangeTextDocumentNotification.type,l),this.notificationSent(u.document,Y.DidChangeTextDocumentNotification.type,l)};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}else if(s.syncKind===Y.TextDocumentSyncKind.Full){let a=async u=>{let l=u.document.uri.toString();this._pendingTextDocumentChanges.set(l,u.document),this._onPendingChangeAdded.fire()};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}}return Promise.all(i).then(void 0,s=>{throw this._client.error(`Sending document notification ${Y.DidChangeTextDocumentNotification.type.method} failed`,s),s})}aboutToSendNotification(e,t,n){this._onAboutToSendNotification.fire({textDocument:e,type:t,params:n})}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=Y.TextDocumentSyncKind.None;else{this._syncKind=Y.TextDocumentSyncKind.None;for(let t of this._changeData.values())if(this.updateSyncKind(t.syncKind),this._syncKind===Y.TextDocumentSyncKind.Full)break}}clear(){this._pendingTextDocumentChanges.clear(),this._changeData.clear(),this._syncKind=Y.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(he.languages.match(t.documentSelector,e)>0)return{send:n=>this.callback(n)}}updateSyncKind(e){if(this._syncKind!==Y.TextDocumentSyncKind.Full)switch(e){case Y.TextDocumentSyncKind.Full:this._syncKind=e;break;case Y.TextDocumentSyncKind.Incremental:this._syncKind===Y.TextDocumentSyncKind.None&&(this._syncKind=Y.TextDocumentSyncKind.Incremental);break}}};ve.DidChangeTextDocumentFeature=Fo;var xo=class extends ce.TextDocumentEventFeature{constructor(e){super(e,he.workspace.onWillSaveTextDocument,Y.WillSaveTextDocumentNotification.type,()=>e.middleware.willSave,t=>e.code2ProtocolConverter.asWillSaveTextDocumentParams(t),t=>t.document,(t,n)=>ce.TextDocumentEventFeature.textDocumentFilter(t,n.document))}get registrationType(){return Y.WillSaveTextDocumentNotification.type}fillClientCapabilities(e){let t=(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization");t.willSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSave&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}getTextDocument(e){return e.document}};ve.WillSaveFeature=xo;var Mo=class extends ce.DynamicDocumentFeature{_listener;_selectors;constructor(e){super(e),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return Y.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(e){let t=(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization");t.willSaveWaitUntil=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSaveWaitUntil&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=he.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}callback(e){if(ce.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),e.document)&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let t=this._client.middleware,n=i=>this._client.sendRequest(Y.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async s=>{let o=await this._client.protocol2CodeConverter.asTextEdits(s);return o===void 0?[]:o});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)}};ve.WillSaveWaitUntilFeature=Mo;var ko=class extends ce.TextDocumentEventFeature{_includeText;constructor(e){super(e,he.workspace.onDidSaveTextDocument,Y.DidSaveTextDocumentNotification.type,()=>e.middleware.didSave,t=>e.code2ProtocolConverter.asSaveTextDocumentParams(t,this._includeText),t=>t,ce.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return Y.DidSaveTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.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:xn.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},i)})}}register(e){this._includeText=!!e.registerOptions.includeText,super.register(e)}getTextDocument(e){return e}};ve.DidSaveTextDocumentFeature=ko;var Ep="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function qp(r=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(let t of Ep)r.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}var Ip=qp(),Eo=class r{_extTextDocument;_capturedTextDocument;_content;_uri;_fileName;_languageId;_version;_eol;_isUntitled;_encoding;_isDirty;_isClosed;constructor(e){this._extTextDocument=e,this._content=e.getText(),this._uri=e.uri,this._fileName=e.fileName,this._languageId=e.languageId,this._version=e.version,this._eol=e.eol,this._isUntitled=e.isUntitled,this._encoding=e.encoding,this._isDirty=e.isDirty,this._isClosed=e.isClosed,this._capturedTextDocument=kp.TextDocument.create(this._uri.toString(),this._languageId,this._version,this._content)}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}get eol(){return this._eol}get isUntitled(){return this._isUntitled}get encoding(){return this._encoding}get fileName(){return this._fileName}get isDirty(){return this._isDirty}get isClosed(){return this._isClosed}save(){return this.version===this._extTextDocument.version?this._extTextDocument.save():Promise.resolve(!1)}get lineCount(){return this._capturedTextDocument.lineCount}offsetAt(e){return this._capturedTextDocument.offsetAt(e)}positionAt(e){let t=this._capturedTextDocument.positionAt(e);return new he.Position(t.line,t.character)}getText(e){return this._capturedTextDocument.getText(e)}lineAt(e){let t=typeof e=="number"?e:this.validatePosition(e).line;if(t<0||t>=this.lineCount)throw new RangeError(`Illegal value for line: ${t}`);let n=this._capturedTextDocument.getLineRange(t),i=this._capturedTextDocument.getText(n),s=i.search(/\S/),o=new he.Range(n.start.line,n.start.character,n.end.line,n.end.character),a=t+1<this.lineCount?new he.Range(o.start.line,o.start.character,t+1,0):o;return{lineNumber:t,text:i,range:o,rangeIncludingLineBreak:a,firstNonWhitespaceCharacterIndex:s===-1?i.length:s,isEmptyOrWhitespace:s===-1}}getWordRangeAtPosition(e,t){let n=this.validatePosition(e).line,i=this.lineAt(n).text,s=r.getWordRegExp(t),o;for(s.lastIndex=0;(o=s.exec(i))!==null;)if(o.index<=e.character&&s.lastIndex>=e.character)return new he.Range(n,o.index,n,s.lastIndex)}validateRange(e){let t=this.validatePosition(e.start),n=this.validatePosition(e.end);return t===e.start&&n===e.end?e:new he.Range(t.line,t.character,n.line,n.character)}validatePosition(e){let t=Math.min(Math.max(e.line,0),this.lineCount-1),n=this._capturedTextDocument.getLineRange(t),i=Math.min(Math.max(e.character,0),n.end.character);return t===e.line&&i===e.character?e:new he.Position(t,i)}static getWordRegExp(e){let t=e??Ip;if(t.flags.includes("g"))return t;let n=`${t.flags}g`;return new RegExp(t.source,n)}}});var Wu=M(ot=>{"use strict";var Ap=ot&&ot.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),jp=ot&&ot.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Lp=ot&&ot.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Ap(t,e,n[i]);return jp(t,e),t}})();Object.defineProperty(ot,"__esModule",{value:!0});ot.CompletionItemFeature=void 0;var Np=I("vscode"),W=N(),qo=B(),Up=Lp(ie()),Kp=[W.CompletionItemKind.Text,W.CompletionItemKind.Method,W.CompletionItemKind.Function,W.CompletionItemKind.Constructor,W.CompletionItemKind.Field,W.CompletionItemKind.Variable,W.CompletionItemKind.Class,W.CompletionItemKind.Interface,W.CompletionItemKind.Module,W.CompletionItemKind.Property,W.CompletionItemKind.Unit,W.CompletionItemKind.Value,W.CompletionItemKind.Enum,W.CompletionItemKind.Keyword,W.CompletionItemKind.Snippet,W.CompletionItemKind.Color,W.CompletionItemKind.File,W.CompletionItemKind.Reference,W.CompletionItemKind.Folder,W.CompletionItemKind.EnumMember,W.CompletionItemKind.Constant,W.CompletionItemKind.Struct,W.CompletionItemKind.Event,W.CompletionItemKind.Operator,W.CompletionItemKind.TypeParameter],Io=class extends qo.TextDocumentLanguageFeature{labelDetailsSupport;constructor(e){super(e,W.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(e){let t=(0,qo.ensure)((0,qo.ensure)(e,"textDocument"),"completion");t.dynamicRegistration=!0,t.contextSupport=!0,t.completionItem={snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[W.MarkupKind.Markdown,W.MarkupKind.PlainText],deprecatedSupport:!0,preselectSupport:!0,tagSupport:{valueSet:[W.CompletionItemTag.Deprecated]},insertReplaceSupport:!0,resolveSupport:{properties:["documentation","detail","additionalTextEdits"]},insertTextModeSupport:{valueSet:[W.InsertTextMode.asIs,W.InsertTextMode.adjustIndentation]},labelDetailsSupport:!0},t.insertTextMode=W.InsertTextMode.adjustIndentation,t.completionItemKind={valueSet:Kp},t.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode","data"],applyKindSupport:!0}}initialize(e,t){let n=this.getRegistrationOptions(t,e.completionProvider);n&&this.register({id:Up.generateUuid(),registerOptions:n})}registerLanguageProvider(e,t){this.labelDetailsSupport.set(t,!!e.completionItem?.labelDetailsSupport);let n=e.triggerCharacters??[],i=e.allCommitCharacters,s=e.documentSelector,o={provideCompletionItems:(a,u,l,h)=>{let p=this._client,f=this._client.middleware,m=(g,v,_,T)=>p.sendRequest(W.CompletionRequest.type,p.code2ProtocolConverter.asCompletionParams(g,v,_),T).then(C=>T.isCancellationRequested?null:p.protocol2CodeConverter.asCompletionResult(C,i,T),C=>p.handleFailedRequest(W.CompletionRequest.type,T,C,null));return f.provideCompletionItem?f.provideCompletionItem(a,u,h,l,m):m(a,u,h,l)},resolveCompletionItem:e.resolveProvider?(a,u)=>{let l=this._client,h=this._client.middleware,p=(f,m)=>l.sendRequest(W.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(f,!!this.labelDetailsSupport.get(t)),m).then(g=>m.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(g),g=>l.handleFailedRequest(W.CompletionResolveRequest.type,m,g,f));return h.resolveCompletionItem?h.resolveCompletionItem(a,u,p):p(a,u)}:void 0};return[Np.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(s),o,...n),o]}};ot.CompletionItemFeature=Io});var $u=M(at=>{"use strict";var Hp=at&&at.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Wp=at&&at.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),$p=at&&at.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Hp(t,e,n[i]);return Wp(t,e),t}})();Object.defineProperty(at,"__esModule",{value:!0});at.HoverFeature=void 0;var Bp=I("vscode"),di=N(),Ao=B(),zp=$p(ie()),jo=class extends Ao.TextDocumentLanguageFeature{constructor(e){super(e,di.HoverRequest.type)}fillClientCapabilities(e){let t=(0,Ao.ensure)((0,Ao.ensure)(e,"textDocument"),"hover");t.dynamicRegistration=!0,t.contentFormat=[di.MarkupKind.Markdown,di.MarkupKind.PlainText]}initialize(e,t){let n=this.getRegistrationOptions(t,e.hoverProvider);n&&this.register({id:zp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideHover:(i,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(di.HoverRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asHover(m),m=>a.handleFailedRequest(di.HoverRequest.type,f,m,null)),l=a.middleware;return l.provideHover?l.provideHover(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Bp.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};at.HoverFeature=jo});var Bu=M(ct=>{"use strict";var Vp=ct&&ct.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Gp=ct&&ct.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Jp=ct&&ct.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Vp(t,e,n[i]);return Gp(t,e),t}})();Object.defineProperty(ct,"__esModule",{value:!0});ct.DefinitionFeature=void 0;var Yp=I("vscode"),Lo=N(),No=B(),Qp=Jp(ie()),Uo=class extends No.TextDocumentLanguageFeature{constructor(e){super(e,Lo.DefinitionRequest.type)}fillClientCapabilities(e){let t=(0,No.ensure)((0,No.ensure)(e,"textDocument"),"definition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.definitionProvider);n&&this.register({id:Qp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDefinition:(i,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(Lo.DefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(Lo.DefinitionRequest.type,f,m,null)),l=a.middleware;return l.provideDefinition?l.provideDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Yp.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};ct.DefinitionFeature=Uo});var Vu=M(ut=>{"use strict";var Zp=ut&&ut.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Xp=ut&&ut.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),eg=ut&&ut.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Zp(t,e,n[i]);return Xp(t,e),t}})();Object.defineProperty(ut,"__esModule",{value:!0});ut.SignatureHelpFeature=void 0;var zu=I("vscode"),fi=N(),Ko=B(),tg=eg(ie()),Ho=class extends Ko.TextDocumentLanguageFeature{constructor(e){super(e,fi.SignatureHelpRequest.type)}fillClientCapabilities(e){let t=(0,Ko.ensure)((0,Ko.ensure)(e,"textDocument"),"signatureHelp");t.dynamicRegistration=!0,t.signatureInformation={documentationFormat:[fi.MarkupKind.Markdown,fi.MarkupKind.PlainText]},t.signatureInformation.parameterInformation={labelOffsetSupport:!0},t.signatureInformation.activeParameterSupport=!0,t.signatureInformation.noActiveParameterSupport=!0,t.contextSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.signatureHelpProvider);n&&this.register({id:tg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t={provideSignatureHelp:(n,i,s,o)=>{let a=this._client,u=(h,p,f,m)=>a.sendRequest(fi.SignatureHelpRequest.type,a.code2ProtocolConverter.asSignatureHelpParams(h,p,f),m).then(g=>m.isCancellationRequested?null:a.protocol2CodeConverter.asSignatureHelp(g,m),g=>a.handleFailedRequest(fi.SignatureHelpRequest.type,m,g,null)),l=a.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(n,i,o,s,u):u(n,i,o,s)}};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 zu.languages.registerSignatureHelpProvider(n,t,...i)}else{let i={triggerCharacters:e.triggerCharacters||[],retriggerCharacters:e.retriggerCharacters||[]};return zu.languages.registerSignatureHelpProvider(n,t,i)}}};ut.SignatureHelpFeature=Ho});var Gu=M(lt=>{"use strict";var ng=lt&&lt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),ig=lt&&lt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),rg=lt&&lt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&ng(t,e,n[i]);return ig(t,e),t}})();Object.defineProperty(lt,"__esModule",{value:!0});lt.DocumentHighlightFeature=void 0;var sg=I("vscode"),Wo=N(),$o=B(),og=rg(ie()),Bo=class extends $o.TextDocumentLanguageFeature{constructor(e){super(e,Wo.DocumentHighlightRequest.type)}fillClientCapabilities(e){(0,$o.ensure)((0,$o.ensure)(e,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentHighlightProvider);n&&this.register({id:og.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentHighlights:(i,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(Wo.DocumentHighlightRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDocumentHighlights(m,f),m=>a.handleFailedRequest(Wo.DocumentHighlightRequest.type,f,m,null)),l=a.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,s,o,u):u(i,s,o)}};return[sg.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};lt.DocumentHighlightFeature=Bo});var Go=M(Pe=>{"use strict";var ag=Pe&&Pe.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),cg=Pe&&Pe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ug=Pe&&Pe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&ag(t,e,n[i]);return cg(t,e),t}})();Object.defineProperty(Pe,"__esModule",{value:!0});Pe.DocumentSymbolFeature=Pe.SupportedSymbolTags=Pe.SupportedSymbolKinds=void 0;var lg=I("vscode"),J=N(),zo=B(),dg=ug(ie());Pe.SupportedSymbolKinds=[J.SymbolKind.File,J.SymbolKind.Module,J.SymbolKind.Namespace,J.SymbolKind.Package,J.SymbolKind.Class,J.SymbolKind.Method,J.SymbolKind.Property,J.SymbolKind.Field,J.SymbolKind.Constructor,J.SymbolKind.Enum,J.SymbolKind.Interface,J.SymbolKind.Function,J.SymbolKind.Variable,J.SymbolKind.Constant,J.SymbolKind.String,J.SymbolKind.Number,J.SymbolKind.Boolean,J.SymbolKind.Array,J.SymbolKind.Object,J.SymbolKind.Key,J.SymbolKind.Null,J.SymbolKind.EnumMember,J.SymbolKind.Struct,J.SymbolKind.Event,J.SymbolKind.Operator,J.SymbolKind.TypeParameter];Pe.SupportedSymbolTags=[J.SymbolTag.Deprecated];var Vo=class extends zo.TextDocumentLanguageFeature{constructor(e){super(e,J.DocumentSymbolRequest.type)}fillClientCapabilities(e){let t=(0,zo.ensure)((0,zo.ensure)(e,"textDocument"),"documentSymbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Pe.SupportedSymbolKinds},t.hierarchicalDocumentSymbolSupport=!0,t.tagSupport={valueSet:Pe.SupportedSymbolTags},t.labelSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentSymbolProvider);n&&this.register({id:dg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentSymbols:(s,o)=>{let a=this._client,u=async(h,p)=>{try{let f=await a.sendRequest(J.DocumentSymbolRequest.type,a.code2ProtocolConverter.asDocumentSymbolParams(h),p);if(p.isCancellationRequested||f===void 0||f===null)return null;if(f.length===0)return[];{let m=f[0];return J.DocumentSymbol.is(m)?await a.protocol2CodeConverter.asDocumentSymbols(f,p):await a.protocol2CodeConverter.asSymbolInformations(f,p)}}catch(f){return a.handleFailedRequest(J.DocumentSymbolRequest.type,p,f,null)}},l=a.middleware;return l.provideDocumentSymbols?l.provideDocumentSymbols(s,o,u):u(s,o)}},i=e.label!==void 0?{label:e.label}:void 0;return[lg.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,i),n]}};Pe.DocumentSymbolFeature=Vo});var Yu=M(dt=>{"use strict";var fg=dt&&dt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),hg=dt&&dt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),pg=dt&&dt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&fg(t,e,n[i]);return hg(t,e),t}})();Object.defineProperty(dt,"__esModule",{value:!0});dt.WorkspaceSymbolFeature=void 0;var gg=I("vscode"),hi=N(),Jo=B(),Ju=Go(),mg=pg(ie()),Yo=class extends Jo.WorkspaceFeature{constructor(e){super(e,hi.WorkspaceSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Jo.ensure)((0,Jo.ensure)(e,"workspace"),"symbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Ju.SupportedSymbolKinds},t.tagSupport={valueSet:Ju.SupportedSymbolTags},t.resolveSupport={properties:["location.range"]}}initialize(e){e.workspaceSymbolProvider&&this.register({id:mg.generateUuid(),registerOptions:e.workspaceSymbolProvider===!0?{workDoneProgress:!1}:e.workspaceSymbolProvider})}registerLanguageProvider(e){let t={provideWorkspaceSymbols:(n,i)=>{let s=this._client,o=(u,l)=>s.sendRequest(hi.WorkspaceSymbolRequest.type,{query:u},l).then(h=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformations(h,l),h=>s.handleFailedRequest(hi.WorkspaceSymbolRequest.type,l,h,null)),a=s.middleware;return a.provideWorkspaceSymbols?a.provideWorkspaceSymbols(n,i,o):o(n,i)},resolveWorkspaceSymbol:e.resolveProvider===!0?(n,i)=>{let s=this._client,o=(u,l)=>s.sendRequest(hi.WorkspaceSymbolResolveRequest.type,s.code2ProtocolConverter.asWorkspaceSymbol(u),l).then(h=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformation(h),h=>s.handleFailedRequest(hi.WorkspaceSymbolResolveRequest.type,l,h,null)),a=s.middleware;return a.resolveWorkspaceSymbol?a.resolveWorkspaceSymbol(n,i,o):o(n,i)}:void 0};return[gg.languages.registerWorkspaceSymbolProvider(t),t]}};dt.WorkspaceSymbolFeature=Yo});var Qu=M(ft=>{"use strict";var vg=ft&&ft.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),yg=ft&&ft.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),_g=ft&&ft.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&vg(t,e,n[i]);return yg(t,e),t}})();Object.defineProperty(ft,"__esModule",{value:!0});ft.ReferencesFeature=void 0;var wg=I("vscode"),Qo=N(),Zo=B(),Cg=_g(ie()),Xo=class extends Zo.TextDocumentLanguageFeature{constructor(e){super(e,Qo.ReferencesRequest.type)}fillClientCapabilities(e){(0,Zo.ensure)((0,Zo.ensure)(e,"textDocument"),"references").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.referencesProvider);n&&this.register({id:Cg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideReferences:(i,s,o,a)=>{let u=this._client,l=(p,f,m,g)=>u.sendRequest(Qo.ReferencesRequest.type,u.code2ProtocolConverter.asReferenceParams(p,f,m),g).then(v=>g.isCancellationRequested?null:u.protocol2CodeConverter.asReferences(v,g),v=>u.handleFailedRequest(Qo.ReferencesRequest.type,g,v,null)),h=u.middleware;return h.provideReferences?h.provideReferences(i,s,o,a,l):l(i,s,o,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return wg.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};ft.ReferencesFeature=Xo});var Zu=M(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.TypeDefinitionFeature=void 0;var bg=I("vscode"),ea=N(),pi=B(),ta=class extends pi.TextDocumentLanguageFeature{constructor(e){super(e,ea.TypeDefinitionRequest.type)}fillClientCapabilities(e){(0,pi.ensure)((0,pi.ensure)(e,"textDocument"),"typeDefinition").dynamicRegistration=!0;let t=(0,pi.ensure)((0,pi.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,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(ea.TypeDefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(ea.TypeDefinitionRequest.type,f,m,null)),l=a.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return bg.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};wr.TypeDefinitionFeature=ta});var Xu=M(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.ImplementationFeature=void 0;var Sg=I("vscode"),na=N(),ia=B(),ra=class extends ia.TextDocumentLanguageFeature{constructor(e){super(e,na.ImplementationRequest.type)}fillClientCapabilities(e){let t=(0,ia.ensure)((0,ia.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,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(na.ImplementationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(na.ImplementationRequest.type,f,m,null)),l=a.middleware;return l.provideImplementation?l.provideImplementation(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Sg.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Cr.ImplementationFeature=ra});var el=M(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.ColorProviderFeature=void 0;var Dg=I("vscode"),gi=N(),sa=B(),oa=class extends sa.TextDocumentLanguageFeature{constructor(e){super(e,gi.DocumentColorRequest.type)}fillClientCapabilities(e){(0,sa.ensure)((0,sa.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,s,o)=>{let a=this._client,u=(h,p,f)=>{let m={color:h,textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(p.document),range:a.code2ProtocolConverter.asRange(p.range)};return a.sendRequest(gi.ColorPresentationRequest.type,m,f).then(g=>f.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(g,f),g=>a.handleFailedRequest(gi.ColorPresentationRequest.type,f,g,null))},l=a.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,s,o,u):u(i,s,o)},provideDocumentColors:(i,s)=>{let o=this._client,a=(l,h)=>{let p={textDocument:o.code2ProtocolConverter.asTextDocumentIdentifier(l)};return o.sendRequest(gi.DocumentColorRequest.type,p,h).then(f=>h.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(f,h),f=>o.handleFailedRequest(gi.DocumentColorRequest.type,h,f,null))},u=o.middleware;return u.provideDocumentColors?u.provideDocumentColors(i,s,a):a(i,s)}};return[Dg.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};br.ColorProviderFeature=oa});var tl=M(ht=>{"use strict";var Pg=ht&&ht.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Tg=ht&&ht.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Og=ht&&ht.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Pg(t,e,n[i]);return Tg(t,e),t}})();Object.defineProperty(ht,"__esModule",{value:!0});ht.CodeActionFeature=void 0;var Rg=I("vscode"),Te=N(),Fg=Og(ie()),aa=B(),ca=class extends aa.TextDocumentLanguageFeature{constructor(e){super(e,Te.CodeActionRequest.type)}fillClientCapabilities(e){let t=(0,aa.ensure)((0,aa.ensure)(e,"textDocument"),"codeAction");t.dynamicRegistration=!0,t.isPreferredSupport=!0,t.disabledSupport=!0,t.dataSupport=!0,t.resolveSupport={properties:["edit","command"]},t.codeActionLiteralSupport={codeActionKind:{valueSet:[Te.CodeActionKind.Empty,Te.CodeActionKind.QuickFix,Te.CodeActionKind.Refactor,Te.CodeActionKind.RefactorExtract,Te.CodeActionKind.RefactorInline,Te.CodeActionKind.RefactorMove,Te.CodeActionKind.RefactorRewrite,Te.CodeActionKind.Source,Te.CodeActionKind.SourceOrganizeImports,Te.CodeActionKind.Notebook]}},t.honorsChangeAnnotations=!0,t.documentationSupport=!0,t.tagSupport={valueSet:[Te.CodeActionTag.LLMGenerated]}}initialize(e,t){let n=this.getRegistrationOptions(t,e.codeActionProvider);n&&this.register({id:Fg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideCodeActions:(i,s,o,a)=>{let u=this._client,l=async(p,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),range:u.code2ProtocolConverter.asRange(f),context:u.code2ProtocolConverter.asCodeActionContextSync(m)};return u.sendRequest(Te.CodeActionRequest.type,v,g).then(_=>g.isCancellationRequested||_===null||_===void 0?null:u.protocol2CodeConverter.asCodeActionResult(_,g),_=>u.handleFailedRequest(Te.CodeActionRequest.type,g,_,null))},h=u.middleware;return h.provideCodeActions?h.provideCodeActions(i,s,o,a,l):l(i,s,o,a)},resolveCodeAction:e.resolveProvider?(i,s)=>{let o=this._client,a=this._client.middleware,u=async(l,h)=>o.sendRequest(Te.CodeActionResolveRequest.type,o.code2ProtocolConverter.asCodeActionSync(l),h).then(p=>h.isCancellationRequested?l:o.protocol2CodeConverter.asCodeAction(p,h),p=>o.handleFailedRequest(Te.CodeActionResolveRequest.type,h,p,l));return a.resolveCodeAction?a.resolveCodeAction(i,s,u):u(i,s)}:void 0};return[Rg.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,this.getMetadata(e)),n]}getMetadata(e){if(!(e.codeActionKinds===void 0&&e.documentation===void 0))return{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(e.codeActionKinds),documentation:this._client.protocol2CodeConverter.asCodeActionDocumentations(e.documentation)}}};ht.CodeActionFeature=ca});var il=M(pt=>{"use strict";var xg=pt&&pt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Mg=pt&&pt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),kg=pt&&pt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&xg(t,e,n[i]);return Mg(t,e),t}})();Object.defineProperty(pt,"__esModule",{value:!0});pt.CodeLensFeature=void 0;var nl=I("vscode"),Mn=N(),Eg=kg(ie()),mi=B(),ua=class extends mi.TextDocumentLanguageFeature{constructor(e){super(e,Mn.CodeLensRequest.type)}fillClientCapabilities(e){let t=(0,mi.ensure)((0,mi.ensure)(e,"textDocument"),"codeLens");t.dynamicRegistration=!0,t.resolveSupport={properties:["command"]},(0,mi.ensure)((0,mi.ensure)(e,"workspace"),"codeLens").refreshSupport=!0}initialize(e,t){this._client.onRequest(Mn.CodeLensRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeCodeLensEmitter.fire()});let i=this.getRegistrationOptions(t,e.codeLensProvider);i&&this.register({id:Eg.generateUuid(),registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new nl.EventEmitter,i={onDidChangeCodeLenses:n.event,provideCodeLenses:(s,o)=>{let a=this._client,u=(h,p)=>a.sendRequest(Mn.CodeLensRequest.type,a.code2ProtocolConverter.asCodeLensParams(h),p).then(f=>p.isCancellationRequested?null:a.protocol2CodeConverter.asCodeLenses(f,p),f=>a.handleFailedRequest(Mn.CodeLensRequest.type,p,f,null)),l=a.middleware;return l.provideCodeLenses?l.provideCodeLenses(s,o,u):u(s,o)},resolveCodeLens:e.resolveProvider?(s,o)=>{let a=this._client,u=(h,p)=>a.sendRequest(Mn.CodeLensResolveRequest.type,a.code2ProtocolConverter.asCodeLens(h),p).then(f=>p.isCancellationRequested?h:a.protocol2CodeConverter.asCodeLens(f),f=>a.handleFailedRequest(Mn.CodeLensResolveRequest.type,p,f,h)),l=a.middleware;return l.resolveCodeLens?l.resolveCodeLens(s,o,u):u(s,o)}:void 0};return[nl.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeCodeLensEmitter:n}]}};pt.CodeLensFeature=ua});var rl=M(Ie=>{"use strict";var qg=Ie&&Ie.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ig=Ie&&Ie.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ag=Ie&&Ie.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&qg(t,e,n[i]);return Ig(t,e),t}})();Object.defineProperty(Ie,"__esModule",{value:!0});Ie.DocumentOnTypeFormattingFeature=Ie.DocumentRangeFormattingFeature=Ie.DocumentFormattingFeature=void 0;var Sr=I("vscode"),Xe=N(),ha=Ag(ie()),Lt=B(),kn;(function(r){function e(t){let n=Sr.workspace.getConfiguration("files",t);return{trimTrailingWhitespace:n.get("trimTrailingWhitespace"),trimFinalNewlines:n.get("trimFinalNewlines"),insertFinalNewline:n.get("insertFinalNewline")}}r.fromConfiguration=e})(kn||(kn={}));var la=class extends Lt.TextDocumentLanguageFeature{constructor(e){super(e,Xe.DocumentFormattingRequest.type)}fillClientCapabilities(e){(0,Lt.ensure)((0,Lt.ensure)(e,"textDocument"),"formatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentFormattingProvider);n&&this.register({id:ha.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentFormattingEdits:(i,s,o)=>{let a=this._client,u=(h,p,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(h),options:a.code2ProtocolConverter.asFormattingOptions(p,kn.fromConfiguration(h))};return a.sendRequest(Xe.DocumentFormattingRequest.type,m,f).then(g=>f.isCancellationRequested?null:a.protocol2CodeConverter.asTextEdits(g,f),g=>a.handleFailedRequest(Xe.DocumentFormattingRequest.type,f,g,null))},l=a.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,s,o,u):u(i,s,o)}};return[Sr.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Ie.DocumentFormattingFeature=la;var da=class extends Lt.TextDocumentLanguageFeature{constructor(e){super(e,Xe.DocumentRangeFormattingRequest.type)}fillClientCapabilities(e){let t=(0,Lt.ensure)((0,Lt.ensure)(e,"textDocument"),"rangeFormatting");t.dynamicRegistration=!0,t.rangesSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentRangeFormattingProvider);n&&this.register({id:ha.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentRangeFormattingEdits:(i,s,o,a)=>{let u=this._client,l=(p,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),range:u.code2ProtocolConverter.asRange(f),options:u.code2ProtocolConverter.asFormattingOptions(m,kn.fromConfiguration(p))};return u.sendRequest(Xe.DocumentRangeFormattingRequest.type,v,g).then(_=>g.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(_,g),_=>u.handleFailedRequest(Xe.DocumentRangeFormattingRequest.type,g,_,null))},h=u.middleware;return h.provideDocumentRangeFormattingEdits?h.provideDocumentRangeFormattingEdits(i,s,o,a,l):l(i,s,o,a)}};return e.rangesSupport&&(n.provideDocumentRangesFormattingEdits=(i,s,o,a)=>{let u=this._client,l=(p,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),ranges:u.code2ProtocolConverter.asRanges(f),options:u.code2ProtocolConverter.asFormattingOptions(m,kn.fromConfiguration(p))};return u.sendRequest(Xe.DocumentRangesFormattingRequest.type,v,g).then(_=>g.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(_,g),_=>u.handleFailedRequest(Xe.DocumentRangesFormattingRequest.type,g,_,null))},h=u.middleware;return h.provideDocumentRangesFormattingEdits?h.provideDocumentRangesFormattingEdits(i,s,o,a,l):l(i,s,o,a)}),[Sr.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Ie.DocumentRangeFormattingFeature=da;var fa=class extends Lt.TextDocumentLanguageFeature{constructor(e){super(e,Xe.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(e){(0,Lt.ensure)((0,Lt.ensure)(e,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentOnTypeFormattingProvider);n&&this.register({id:ha.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideOnTypeFormattingEdits:(s,o,a,u,l)=>{let h=this._client,p=(m,g,v,_,T)=>{let C={textDocument:h.code2ProtocolConverter.asTextDocumentIdentifier(m),position:h.code2ProtocolConverter.asPosition(g),ch:v,options:h.code2ProtocolConverter.asFormattingOptions(_,kn.fromConfiguration(m))};return h.sendRequest(Xe.DocumentOnTypeFormattingRequest.type,C,T).then(D=>T.isCancellationRequested?null:h.protocol2CodeConverter.asTextEdits(D,T),D=>h.handleFailedRequest(Xe.DocumentOnTypeFormattingRequest.type,T,D,null))},f=h.middleware;return f.provideOnTypeFormattingEdits?f.provideOnTypeFormattingEdits(s,o,a,u,l,p):p(s,o,a,u,l)}},i=e.moreTriggerCharacter||[];return[Sr.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.firstTriggerCharacter,...i),n]}};Ie.DocumentOnTypeFormattingFeature=fa});var al=M(gt=>{"use strict";var jg=gt&&gt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Lg=gt&&gt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ol=gt&&gt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&jg(t,e,n[i]);return Lg(t,e),t}})();Object.defineProperty(gt,"__esModule",{value:!0});gt.RenameFeature=void 0;var Ng=I("vscode"),hn=N(),Ug=ol(ie()),sl=ol(We()),pa=B(),ga=class extends pa.TextDocumentLanguageFeature{constructor(e){super(e,hn.RenameRequest.type)}fillClientCapabilities(e){let t=(0,pa.ensure)((0,pa.ensure)(e,"textDocument"),"rename");t.dynamicRegistration=!0,t.prepareSupport=!0,t.prepareSupportDefaultBehavior=hn.PrepareSupportDefaultBehavior.Identifier,t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.renameProvider);n&&(sl.boolean(e.renameProvider)&&(n.prepareProvider=!1),this.register({id:Ug.generateUuid(),registerOptions:n}))}registerLanguageProvider(e){let t=e.documentSelector,n={provideRenameEdits:(i,s,o,a)=>{let u=this._client,l=async(p,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),position:u.code2ProtocolConverter.asPosition(f),newName:m},_=null;try{_=await u.sendRequest(hn.RenameRequest.type,v,g)}catch(C){return u.handleFailedRequest(hn.RenameRequest.type,g,C,null,!1)}if(g.isCancellationRequested||_===null)return null;let T=await u.protocol2CodeConverter.asWorkspaceEdit(_,g);if(g.isCancellationRequested)return null;if(!u.validateWorkspaceEdit(_))throw new Error("The rename edit returned from the server is not valid anymore and cannot be applied.");return T},h=u.middleware;return h.provideRenameEdits?h.provideRenameEdits(i,s,o,a,l):l(i,s,o,a)},prepareRename:e.prepareProvider?(i,s,o)=>{let a=this._client,u=(h,p,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(h),position:a.code2ProtocolConverter.asPosition(p)};return a.sendRequest(hn.PrepareRenameRequest.type,m,f).then(g=>f.isCancellationRequested?null:hn.Range.is(g)?a.protocol2CodeConverter.asRange(g):this.isDefaultBehavior(g)?g.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):g&&hn.Range.is(g.range)?{range:a.protocol2CodeConverter.asRange(g.range),placeholder:g.placeholder}:Promise.reject(new Error("The element can't be renamed.")),g=>{throw typeof g.message=="string"?new Error(g.message):new Error("The element can't be renamed.")})},l=a.middleware;return l.prepareRename?l.prepareRename(i,s,o,u):u(i,s,o)}:void 0};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Ng.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}isDefaultBehavior(e){let t=e;return t&&sl.boolean(t.defaultBehavior)}};gt.RenameFeature=ga});var cl=M(mt=>{"use strict";var Kg=mt&&mt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Hg=mt&&mt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Wg=mt&&mt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Kg(t,e,n[i]);return Hg(t,e),t}})();Object.defineProperty(mt,"__esModule",{value:!0});mt.DocumentLinkFeature=void 0;var $g=I("vscode"),vi=N(),ma=B(),Bg=Wg(ie()),va=class extends ma.TextDocumentLanguageFeature{constructor(e){super(e,vi.DocumentLinkRequest.type)}fillClientCapabilities(e){let t=(0,ma.ensure)((0,ma.ensure)(e,"textDocument"),"documentLink");t.dynamicRegistration=!0,t.tooltipSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentLinkProvider);n&&this.register({id:Bg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentLinks:(i,s)=>{let o=this._client,a=(l,h)=>o.sendRequest(vi.DocumentLinkRequest.type,o.code2ProtocolConverter.asDocumentLinkParams(l),h).then(p=>h.isCancellationRequested?null:o.protocol2CodeConverter.asDocumentLinks(p,h),p=>o.handleFailedRequest(vi.DocumentLinkRequest.type,h,p,null)),u=o.middleware;return u.provideDocumentLinks?u.provideDocumentLinks(i,s,a):a(i,s)},resolveDocumentLink:e.resolveProvider?(i,s)=>{let o=this._client,a=(l,h)=>o.sendRequest(vi.DocumentLinkResolveRequest.type,o.code2ProtocolConverter.asDocumentLink(l),h).then(p=>h.isCancellationRequested?l:o.protocol2CodeConverter.asDocumentLink(p),p=>o.handleFailedRequest(vi.DocumentLinkResolveRequest.type,h,p,l)),u=o.middleware;return u.resolveDocumentLink?u.resolveDocumentLink(i,s,a):a(i,s)}:void 0};return[$g.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};mt.DocumentLinkFeature=va});var ll=M(vt=>{"use strict";var zg=vt&&vt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Vg=vt&&vt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Gg=vt&&vt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&zg(t,e,n[i]);return Vg(t,e),t}})();Object.defineProperty(vt,"__esModule",{value:!0});vt.ExecuteCommandFeature=void 0;var Jg=I("vscode"),ya=N(),Yg=Gg(ie()),ul=B(),_a=class{_client;_commands;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 ya.ExecuteCommandRequest.type}fillClientCapabilities(e){(0,ul.ensure)((0,ul.ensure)(e,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(e){e.executeCommandProvider&&this.register({id:Yg.generateUuid(),registerOptions:Object.assign({},e.executeCommandProvider)})}register(e){let t=this._client,n=t.middleware,i=(s,o)=>{let a={command:s,arguments:o};return t.sendRequest(ya.ExecuteCommandRequest.type,a).then(void 0,u=>t.handleFailedRequest(ya.ExecuteCommandRequest.type,void 0,u,void 0))};if(e.registerOptions.commands){let s=[];for(let o of e.registerOptions.commands)s.push(Jg.commands.registerCommand(o,(...a)=>n.executeCommand?n.executeCommand(o,a,i):i(o,a)));this._commands.set(e.id,s)}}unregister(e){let t=this._commands.get(e);t&&(this._commands.delete(e),t.forEach(n=>n.dispose()))}clear(){this._commands.forEach(e=>{e.forEach(t=>t.dispose())}),this._commands.clear()}};vt.ExecuteCommandFeature=_a});var fl=M(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.FoldingRangeFeature=void 0;var dl=I("vscode"),pn=N(),yi=B(),wa=class extends yi.TextDocumentLanguageFeature{constructor(e){super(e,pn.FoldingRangeRequest.type)}fillClientCapabilities(e){let t=(0,yi.ensure)((0,yi.ensure)(e,"textDocument"),"foldingRange");t.dynamicRegistration=!0,t.rangeLimit=5e3,t.lineFoldingOnly=!0,t.foldingRangeKind={valueSet:[pn.FoldingRangeKind.Comment,pn.FoldingRangeKind.Imports,pn.FoldingRangeKind.Region]},t.foldingRange={collapsedText:!1},(0,yi.ensure)((0,yi.ensure)(e,"workspace"),"foldingRange").refreshSupport=!0}initialize(e,t){this._client.onRequest(pn.FoldingRangeRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 dl.EventEmitter,i={onDidChangeFoldingRanges:n.event,provideFoldingRanges:(s,o,a)=>{let u=this._client,l=(p,f,m)=>{let g={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p)};return u.sendRequest(pn.FoldingRangeRequest.type,g,m).then(v=>m.isCancellationRequested?null:u.protocol2CodeConverter.asFoldingRanges(v,m),v=>u.handleFailedRequest(pn.FoldingRangeRequest.type,m,v,null))},h=u.middleware;return h.provideFoldingRanges?h.provideFoldingRanges(s,o,a,l):l(s,o,a)}};return[dl.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeFoldingRange:n}]}};Dr.FoldingRangeFeature=wa});var hl=M(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.DeclarationFeature=void 0;var Qg=I("vscode"),Ca=N(),ba=B(),Sa=class extends ba.TextDocumentLanguageFeature{constructor(e){super(e,Ca.DeclarationRequest.type)}fillClientCapabilities(e){let t=(0,ba.ensure)((0,ba.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,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(Ca.DeclarationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDeclarationResult(m,f),m=>a.handleFailedRequest(Ca.DeclarationRequest.type,f,m,null)),l=a.middleware;return l.provideDeclaration?l.provideDeclaration(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Qg.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Pr.DeclarationFeature=Sa});var pl=M(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.SelectionRangeFeature=void 0;var Zg=I("vscode"),Da=N(),Pa=B(),Ta=class extends Pa.TextDocumentLanguageFeature{constructor(e){super(e,Da.SelectionRangeRequest.type)}fillClientCapabilities(e){let t=(0,Pa.ensure)((0,Pa.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,s,o)=>{let a=this._client,u=async(h,p,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(h),positions:a.code2ProtocolConverter.asPositionsSync(p,f)};return a.sendRequest(Da.SelectionRangeRequest.type,m,f).then(g=>f.isCancellationRequested?null:a.protocol2CodeConverter.asSelectionRanges(g,f),g=>a.handleFailedRequest(Da.SelectionRangeRequest.type,f,g,null))},l=a.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Zg.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Tr.SelectionRangeFeature=Ta});var gl=M(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.CallHierarchyFeature=void 0;var Xg=I("vscode"),gn=N(),Oa=B(),Ra=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareCallHierarchy(e,t,n){let i=this.client,s=this.middleware,o=(a,u,l)=>{let h=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(gn.CallHierarchyPrepareRequest.type,h,l).then(p=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(p,l),p=>i.handleFailedRequest(gn.CallHierarchyPrepareRequest.type,l,p,null))};return s.prepareCallHierarchy?s.prepareCallHierarchy(e,t,n,o):o(e,t,n)}provideCallHierarchyIncomingCalls(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(gn.CallHierarchyIncomingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,a),l=>n.handleFailedRequest(gn.CallHierarchyIncomingCallsRequest.type,a,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(e,t,s):s(e,t)}provideCallHierarchyOutgoingCalls(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(gn.CallHierarchyOutgoingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,a),l=>n.handleFailedRequest(gn.CallHierarchyOutgoingCallsRequest.type,a,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(e,t,s):s(e,t)}},Fa=class extends Oa.TextDocumentLanguageFeature{constructor(e){super(e,gn.CallHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=e,n=(0,Oa.ensure)((0,Oa.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 Ra(t);return[Xg.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Or.CallHierarchyFeature=Fa});var vl=M(yt=>{"use strict";var em=yt&&yt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),tm=yt&&yt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ml=yt&&yt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&em(t,e,n[i]);return tm(t,e),t}})();Object.defineProperty(yt,"__esModule",{value:!0});yt.SemanticTokensFeature=void 0;var Rr=ml(I("vscode")),U=N(),_i=B(),nm=ml(We()),xa=class extends _i.TextDocumentLanguageFeature{constructor(e){super(e,U.SemanticTokensRegistrationType.type)}fillClientCapabilities(e){let t=(0,_i.ensure)((0,_i.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.comment,U.SemanticTokenTypes.string,U.SemanticTokenTypes.number,U.SemanticTokenTypes.regexp,U.SemanticTokenTypes.operator,U.SemanticTokenTypes.decorator,U.SemanticTokenTypes.label],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,_i.ensure)((0,_i.ensure)(e,"workspace"),"semanticTokens").refreshSupport=!0}initialize(e,t){this._client.onRequest(U.SemanticTokensRefreshRequest.type,async()=>{for(let o of this.getAllProviders())o.onDidChangeSemanticTokensEmitter.fire()});let[i,s]=this.getRegistration(t,e.semanticTokensProvider);!i||!s||this.register({id:i,registerOptions:s})}registerLanguageProvider(e){let t=e.documentSelector,n=nm.boolean(e.full)?e.full:e.full!==void 0,i=e.full!==void 0&&typeof e.full!="boolean"&&e.full.delta===!0,s=new Rr.EventEmitter,o=n?{onDidChangeSemanticTokens:s.event,provideDocumentSemanticTokens:(m,g)=>{let v=this._client,_=v.middleware,T=(C,D)=>{let F={textDocument:v.code2ProtocolConverter.asTextDocumentIdentifier(C)};return v.sendRequest(U.SemanticTokensRequest.type,F,D).then(E=>D.isCancellationRequested?null:v.protocol2CodeConverter.asSemanticTokens(E,D),E=>v.handleFailedRequest(U.SemanticTokensRequest.type,D,E,null))};return _.provideDocumentSemanticTokens?_.provideDocumentSemanticTokens(m,g,T):T(m,g)},provideDocumentSemanticTokensEdits:i?(m,g,v)=>{let _=this._client,T=_.middleware,C=(D,F,E)=>{let Z={textDocument:_.code2ProtocolConverter.asTextDocumentIdentifier(D),previousResultId:F};return _.sendRequest(U.SemanticTokensDeltaRequest.type,Z,E).then(async we=>E.isCancellationRequested?null:U.SemanticTokens.is(we)?await _.protocol2CodeConverter.asSemanticTokens(we,E):await _.protocol2CodeConverter.asSemanticTokensEdits(we,E),we=>_.handleFailedRequest(U.SemanticTokensDeltaRequest.type,E,we,null))};return T.provideDocumentSemanticTokensEdits?T.provideDocumentSemanticTokensEdits(m,g,v,C):C(m,g,v)}:void 0}:void 0,u=e.range===!0?{onDidChangeSemanticTokens:s.event,provideDocumentRangeSemanticTokens:(m,g,v)=>{let _=this._client,T=_.middleware,C=(D,F,E)=>{let Z={textDocument:_.code2ProtocolConverter.asTextDocumentIdentifier(D),range:_.code2ProtocolConverter.asRange(F)};return _.sendRequest(U.SemanticTokensRangeRequest.type,Z,E).then(we=>E.isCancellationRequested?null:_.protocol2CodeConverter.asSemanticTokens(we,E),we=>_.handleFailedRequest(U.SemanticTokensRangeRequest.type,E,we,null))};return T.provideDocumentRangeSemanticTokens?T.provideDocumentRangeSemanticTokens(m,g,v,C):C(m,g,v)}}:void 0,l=[],h=this._client,p=h.protocol2CodeConverter.asSemanticTokensLegend(e.legend),f=h.protocol2CodeConverter.asDocumentSelector(t);return o!==void 0&&l.push(Rr.languages.registerDocumentSemanticTokensProvider(f,o,p)),u!==void 0&&l.push(Rr.languages.registerDocumentRangeSemanticTokensProvider(f,u,p)),[new Rr.Disposable(()=>l.forEach(m=>m.dispose())),{range:u,full:o,onDidChangeSemanticTokensEmitter:s}]}};yt.SemanticTokensFeature=xa});var _l=M(_t=>{"use strict";var im=_t&&_t.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),rm=_t&&_t.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),yl=_t&&_t.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&im(t,e,n[i]);return rm(t,e),t}})();Object.defineProperty(_t,"__esModule",{value:!0});_t.LinkedEditingFeature=void 0;var sm=yl(I("vscode")),Ma=yl(N()),ka=B(),Ea=class extends ka.TextDocumentLanguageFeature{constructor(e){super(e,Ma.LinkedEditingRangeRequest.type)}fillClientCapabilities(e){let t=(0,ka.ensure)((0,ka.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,s,o)=>{let a=this._client,u=(h,p,f)=>a.sendRequest(Ma.LinkedEditingRangeRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(h,p),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asLinkedEditingRanges(m,f),m=>a.handleFailedRequest(Ma.LinkedEditingRangeRequest.type,f,m,null)),l=a.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return sm.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};_t.LinkedEditingFeature=Ea});var wl=M(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TypeHierarchyFeature=void 0;var om=I("vscode"),mn=N(),qa=B(),Ia=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareTypeHierarchy(e,t,n){let i=this.client,s=this.middleware,o=(a,u,l)=>{let h=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(mn.TypeHierarchyPrepareRequest.type,h,l).then(p=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(p,l),p=>i.handleFailedRequest(mn.TypeHierarchyPrepareRequest.type,l,p,null))};return s.prepareTypeHierarchy?s.prepareTypeHierarchy(e,t,n,o):o(e,t,n)}provideTypeHierarchySupertypes(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(mn.TypeHierarchySupertypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>n.handleFailedRequest(mn.TypeHierarchySupertypesRequest.type,a,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(e,t,s):s(e,t)}provideTypeHierarchySubtypes(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(mn.TypeHierarchySubtypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>n.handleFailedRequest(mn.TypeHierarchySubtypesRequest.type,a,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(e,t,s):s(e,t)}},Aa=class extends qa.TextDocumentLanguageFeature{constructor(e){super(e,mn.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=(0,qa.ensure)((0,qa.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 Ia(t);return[om.languages.registerTypeHierarchyProvider(t.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Fr.TypeHierarchyFeature=Aa});var bl=M(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.InlineValueFeature=void 0;var Cl=I("vscode"),xr=N(),wi=B(),ja=class extends wi.TextDocumentLanguageFeature{constructor(e){super(e,xr.InlineValueRequest.type)}fillClientCapabilities(e){(0,wi.ensure)((0,wi.ensure)(e,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,wi.ensure)((0,wi.ensure)(e,"workspace"),"inlineValue").refreshSupport=!0}initialize(e,t){this._client.onRequest(xr.InlineValueRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 Cl.EventEmitter,i={onDidChangeInlineValues:n.event,provideInlineValues:(s,o,a,u)=>{let l=this._client,h=(f,m,g,v)=>{let _={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(f),range:l.code2ProtocolConverter.asRange(m),context:l.code2ProtocolConverter.asInlineValueContext(g)};return l.sendRequest(xr.InlineValueRequest.type,_,v).then(T=>v.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(T,v),T=>l.handleFailedRequest(xr.InlineValueRequest.type,v,T,null))},p=l.middleware;return p.provideInlineValues?p.provideInlineValues(s,o,a,u,h):h(s,o,a,u)}};return[this.registerProvider(t,i),{provider:i,onDidChangeInlineValues:n}]}registerProvider(e,t){return Cl.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Mr.InlineValueFeature=ja});var Dl=M(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.InlayHintsFeature=void 0;var Sl=I("vscode"),En=N(),Ci=B(),La=class extends Ci.TextDocumentLanguageFeature{constructor(e){super(e,En.InlayHintRequest.type)}fillClientCapabilities(e){let t=(0,Ci.ensure)((0,Ci.ensure)(e,"textDocument"),"inlayHint");t.dynamicRegistration=!0,t.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,Ci.ensure)((0,Ci.ensure)(e,"workspace"),"inlayHint").refreshSupport=!0}initialize(e,t){this._client.onRequest(En.InlayHintRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 Sl.EventEmitter,i={onDidChangeInlayHints:n.event,provideInlayHints:(s,o,a)=>{let u=this._client,l=async(p,f,m)=>{let g={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),range:u.code2ProtocolConverter.asRange(f)};try{let v=await u.sendRequest(En.InlayHintRequest.type,g,m);return m.isCancellationRequested?null:u.protocol2CodeConverter.asInlayHints(v,m)}catch(v){return u.handleFailedRequest(En.InlayHintRequest.type,m,v,null)}},h=u.middleware;return h.provideInlayHints?h.provideInlayHints(s,o,a,l):l(s,o,a)}};return i.resolveInlayHint=e.resolveProvider===!0?(s,o)=>{let a=this._client,u=async(h,p)=>{try{let f=await a.sendRequest(En.InlayHintResolveRequest.type,a.code2ProtocolConverter.asInlayHint(h),p);if(p.isCancellationRequested)return null;let m=a.protocol2CodeConverter.asInlayHint(f,p);return p.isCancellationRequested?null:m}catch(f){return a.handleFailedRequest(En.InlayHintResolveRequest.type,p,f,null)}},l=a.middleware;return l.resolveInlayHint?l.resolveInlayHint(s,o,u):u(s,o)}:void 0,[this.registerProvider(t,i),{provider:i,onDidChangeInlayHints:n}]}registerProvider(e,t){return Sl.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};kr.InlayHintsFeature=La});var Pl=M(et=>{"use strict";var am=et&&et.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),cm=et&&et.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),um=et&&et.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&am(t,e,n[i]);return cm(t,e),t}})();Object.defineProperty(et,"__esModule",{value:!0});et.WorkspaceFoldersFeature=void 0;et.arrayDiff=Ua;var lm=um(ie()),Er=I("vscode"),bi=N();function Na(r,e){if(r!=null)return r[e]}function Ua(r,e){return r.filter(t=>e.indexOf(t)<0)}var Ka=class{_client;_listeners;_initialFolders;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 bi.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(e){let t=Er.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(bi.WorkspaceFoldersRequest.type,s=>{let o=()=>{let u=Er.workspace.workspaceFolders;return u===void 0?null:u.map(h=>this.asProtocol(h))},a=t.middleware.workspace;return a&&a.workspaceFolders?a.workspaceFolders(s,o):o(s)});let n=Na(Na(Na(e,"workspace"),"workspaceFolders"),"changeNotifications"),i;typeof n=="string"?i=n:n===!0&&(i=lm.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(e){let t;if(this._initialFolders&&e){let n=Ua(this._initialFolders,e),i=Ua(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 ${bi.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(bi.DidChangeWorkspaceFoldersNotification.type,n)}register(e){let t=e.id,n=this._client,i=Er.workspace.onDidChangeWorkspaceFolders(s=>{let o=l=>this.doSendEvent(l.added,l.removed),a=n.middleware.workspace;(a&&a.didChangeWorkspaceFolders?a.didChangeWorkspaceFolders(s,o):o(s)).catch(l=>{this._client.error(`Sending notification ${bi.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(t,i),this.sendInitialEvent(Er.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}}};et.WorkspaceFoldersFeature=Ka});var Rl=M(ye=>{"use strict";var dm=ye&&ye.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),fm=ye&&ye.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ar=ye&&ye.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&dm(t,e,n[i]);return fm(t,e),t}})();Object.defineProperty(ye,"__esModule",{value:!0});ye.WillDeleteFilesFeature=ye.WillRenameFilesFeature=ye.WillCreateFilesFeature=ye.DidDeleteFilesFeature=ye.DidRenameFilesFeature=ye.DidCreateFilesFeature=void 0;var ze=Ar(I("vscode")),hm=Ar(ho()),Nt=Ar(N()),pm=Ar(ie());function Tl(r,e){return r[e]===void 0&&(r[e]={}),r[e]}function gm(r,e){return r[e]}function Ol(r,e,t){r[e]=t}var Si=class r{_client;_event;_registrationType;_clientCapability;_serverCapability;_listener;_filters;constructor(e,t,n,i,s){this._client=e,this._event=t,this._registrationType=n,this._clientCapability=i,this._serverCapability=s,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=Tl(Tl(e,"workspace"),"fileOperations");Ol(t,"dynamicRegistration",!0),Ol(t,this._clientCapability,!0)}initialize(e){let t=e.workspace?.fileOperations,n=t!==void 0?gm(t,this._serverCapability):void 0;if(n?.filters!==void 0)try{this.register({id:pm.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 hm.Minimatch(n.pattern.glob,r.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 r.getFileType(e)}async filter(e,t){let n=await Promise.all(e.files.map(async s=>{let o=t(s),a=o.fsPath.replace(/\\/g,"/");for(let u of this._filters.values())for(let l of u)if(!(l.scheme!==void 0&&l.scheme!==o.scheme)){if(l.matcher.match(a)){if(l.kind===void 0)return!0;let h=await this.getFileType(o);if(h===void 0)return this._client.info(`Unable to determine file type for ${o.toString()}. Treating as a match.`),!0;if(h===ze.FileType.File&&l.kind===Nt.FileOperationPatternKind.file||h===ze.FileType.Directory&&l.kind===Nt.FileOperationPatternKind.folder)return!0}else if(l.kind===Nt.FileOperationPatternKind.folder&&await r.getFileType(o)===ze.FileType.Directory&&l.matcher.match(`${a}/`))return!0}return!1})),i=e.files.filter((s,o)=>n[o]);return{...e,files:i}}static async getFileType(e){try{return(await ze.workspace.fs.stat(e)).type}catch{return}}static asMinimatchOptions(e){let t={dot:!0};return e?.ignoreCase===!0&&(t.nocase=!0),t}},qr=class extends Si{_notificationType;_accessUri;_createParams;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s),this._notificationType=n,this._accessUri=o,this._createParams=a}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)}}},Ir=class extends qr{_willListener;_fsPathFileTypes=new Map;async getFileType(e){let t=e.fsPath;if(this._fsPathFileTypes.has(t))return this._fsPathFileTypes.get(t);let n=await Si.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)}},Ha=class extends qr{constructor(e){super(e,ze.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)}};ye.DidCreateFilesFeature=Ha;var Wa=class extends Ir{constructor(e){super(e,ze.workspace.onDidRenameFiles,Nt.DidRenameFilesNotification.type,"didRename","didRename",t=>t.oldUri,e.code2ProtocolConverter.asDidRenameFilesParams)}register(e){this._willListener||(this._willListener=ze.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)}};ye.DidRenameFilesFeature=Wa;var $a=class extends Ir{constructor(e){super(e,ze.workspace.onDidDeleteFiles,Nt.DidDeleteFilesNotification.type,"didDelete","didDelete",t=>t,e.code2ProtocolConverter.asDidDeleteFilesParams)}register(e){this._willListener||(this._willListener=ze.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)}};ye.DidDeleteFilesFeature=$a;var Di=class extends Si{_requestType;_accessUri;_createParams;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s),this._requestType=n,this._accessUri=o,this._createParams=a}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}},Ba=class extends Di{constructor(e){super(e,ze.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)}};ye.WillCreateFilesFeature=Ba;var za=class extends Di{constructor(e){super(e,ze.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)}};ye.WillRenameFilesFeature=za;var Va=class extends Di{constructor(e){super(e,ze.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)}};ye.WillDeleteFilesFeature=Va});var Fl=M(wt=>{"use strict";var mm=wt&&wt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),vm=wt&&wt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ym=wt&&wt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&mm(t,e,n[i]);return vm(t,e),t}})();Object.defineProperty(wt,"__esModule",{value:!0});wt.InlineCompletionItemFeature=void 0;var _m=I("vscode"),Ga=N(),Ja=B(),wm=ym(ie()),Ya=class extends Ja.TextDocumentLanguageFeature{constructor(e){super(e,Ga.InlineCompletionRequest.type)}fillClientCapabilities(e){let t=(0,Ja.ensure)((0,Ja.ensure)(e,"textDocument"),"inlineCompletion");t.dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.inlineCompletionProvider);n&&this.register({id:wm.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideInlineCompletionItems:(i,s,o,a)=>{let u=this._client,l=this._client.middleware,h=(p,f,m,g)=>u.sendRequest(Ga.InlineCompletionRequest.type,u.code2ProtocolConverter.asInlineCompletionParams(p,f,m),g).then(v=>g.isCancellationRequested?null:u.protocol2CodeConverter.asInlineCompletionResult(v,g),v=>u.handleFailedRequest(Ga.InlineCompletionRequest.type,g,v,null));return l.provideInlineCompletionItems?l.provideInlineCompletionItems(i,s,o,a,h):h(i,s,o,a)}};return[_m.languages.registerInlineCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};wt.InlineCompletionItemFeature=Ya});var kl=M(Ct=>{"use strict";var Cm=Ct&&Ct.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),bm=Ct&&Ct.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ml=Ct&&Ct.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Cm(t,e,n[i]);return bm(t,e),t}})();Object.defineProperty(Ct,"__esModule",{value:!0});Ct.TextDocumentContentFeature=void 0;var Qa=Ml(I("vscode")),qn=N(),xl=B(),Sm=Ml(ie()),Za=class{_client;_registrations=new Map;constructor(e){this._client=e}getState(){let e=this._registrations.size>0;return{kind:"workspace",id:qn.TextDocumentContentRequest.method,registrations:e}}get registrationType(){return qn.TextDocumentContentRequest.type}getProviders(){let e=[];for(let t of this._registrations.values())e.push(...t.providers);return e}fillClientCapabilities(e){let t=(0,xl.ensure)((0,xl.ensure)(e,"workspace"),"textDocumentContent");t.dynamicRegistration=!0}initialize(e){let t=this._client;if(t.onRequest(qn.TextDocumentContentRefreshRequest.type,async s=>{let o=t.protocol2CodeConverter.asUri(s.uri);for(let a of this._registrations.values())for(let u of a.providers)u.scheme===o.scheme&&u.onDidChangeEmitter.fire(o)}),!e?.workspace?.textDocumentContent)return;let n=e.workspace.textDocumentContent,i=qn.StaticRegistrationOptions.hasId(n)?n.id:Sm.generateUuid();this.register({id:i,registerOptions:n})}register(e){let t=[],n=[];for(let i of e.registerOptions.schemes){let[s,o]=this.registerTextDocumentContentProvider(i);t.push(o),n.push(s)}this._registrations.set(e.id,{disposable:Qa.Disposable.from(...n),providers:t})}registerTextDocumentContentProvider(e){let t=new Qa.EventEmitter,n={onDidChange:t.event,provideTextDocumentContent:(i,s)=>{let o=this._client,a=(l,h)=>{let p={uri:o.code2ProtocolConverter.asUri(l)};return o.sendRequest(qn.TextDocumentContentRequest.type,p,h).then(f=>h.isCancellationRequested?null:f.text,f=>o.handleFailedRequest(qn.TextDocumentContentRequest.type,h,f,null))},u=o.middleware;return u.provideTextDocumentContent?u.provideTextDocumentContent(i,s,a):a(i,s)}};return[Qa.workspace.registerTextDocumentContentProvider(e,n),{scheme:e,onDidChangeEmitter:t,provider:n}]}unregister(e){let t=this._registrations.get(e);t!==void 0&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}};Ct.TextDocumentContentFeature=Za});var El=M(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.FileSystemWatcherFeature=void 0;var Dm=I("vscode"),vn=N(),jr=B(),Xa=class{_client;_notifyFileEvent;_watchers;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 vn.DidChangeWatchedFilesNotification.type}fillClientCapabilities(e){(0,jr.ensure)((0,jr.ensure)(e,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,jr.ensure)((0,jr.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 s=!0,o=!0,a=!0;n.kind!==void 0&&n.kind!==null&&(s=(n.kind&vn.WatchKind.Create)!==0,o=(n.kind&vn.WatchKind.Change)!==0,a=(n.kind&vn.WatchKind.Delete)!==0);let u=Dm.workspace.createFileSystemWatcher(i,!s,!o,!a);this.hookListeners(u,s,o,a,t),t.push(u)}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,s){t&&e.onDidCreate(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:vn.FileChangeType.Created}),null,s),n&&e.onDidChange(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:vn.FileChangeType.Changed}),null,s),i&&e.onDidDelete(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:vn.FileChangeType.Deleted}),null,s)}unregister(e){let t=this._watchers.get(e);if(t){this._watchers.delete(e);for(let n of t)n.dispose()}}clear(){this._watchers.forEach(e=>{for(let t of e)t.dispose()}),this._watchers.clear()}};Lr.FileSystemWatcherFeature=Xa});var Il=M(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.ProgressFeature=void 0;var ql=N(),Pm=Xs();function Tm(r,e){return r[e]===void 0&&(r[e]=Object.create(null)),r[e]}var ec=class{_client;activeParts;constructor(e){this._client=e,this.activeParts=new Set}getState(){return{kind:"window",id:ql.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(e){Tm(e,"window").workDoneProgress=!0}initialize(){let e=this._client,t=i=>{this.activeParts.delete(i)},n=i=>{this.activeParts.add(new Pm.ProgressPart(this._client,i.token,t))};e.onRequest(ql.WorkDoneProgressCreateRequest.type,n)}clear(){for(let e of this.activeParts)e.done();this.activeParts.clear()}};Nr.ProgressFeature=ec});var uc=M(Q=>{"use strict";var Om=Q&&Q.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Rm=Q&&Q.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Hr=Q&&Q.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Om(t,e,n[i]);return Rm(t,e),t}})();Object.defineProperty(Q,"__esModule",{value:!0});Q.ProposedFeatures=Q.LanguageClient=Q.BaseLanguageClient=Q.ShutdownMode=Q.MessageTransports=Q.SuspendMode=Q.State=Q.CloseAction=Q.ErrorAction=Q.RevealOutputChannelOn=void 0;var L=I("vscode"),S=N(),Fm=Hr(Jc()),xm=Hr(Zc()),tt=Hr(We()),Ur=Xi(),Al=Hr(ie()),Mm=Xs(),Oe=B(),km=wo(),nc=Eu(),jl=Au(),In=Hu(),Em=Wu(),qm=$u(),Im=Bu(),Am=Vu(),jm=Gu(),Lm=Go(),Nm=Yu(),Um=Qu(),Km=Zu(),Hm=Xu(),Wm=el(),$m=tl(),Bm=il(),tc=rl(),zm=al(),Vm=cl(),Gm=ll(),Jm=fl(),Ym=hl(),Qm=pl(),Zm=gl(),Xm=vl(),ev=_l(),tv=wl(),nv=bl(),iv=Dl(),rv=Pl(),An=Rl(),sv=Fl(),ov=kl(),av=El(),cv=Il(),yn;(function(r){r[r.Debug=0]="Debug",r[r.Info=1]="Info",r[r.Warn=2]="Warn",r[r.Error=3]="Error",r[r.Never=4]="Never"})(yn||(Q.RevealOutputChannelOn=yn={}));var Pi;(function(r){r[r.Continue=1]="Continue",r[r.Shutdown=2]="Shutdown"})(Pi||(Q.ErrorAction=Pi={}));var Xt;(function(r){r[r.DoNotRestart=1]="DoNotRestart",r[r.Restart=2]="Restart"})(Xt||(Q.CloseAction=Xt={}));var jn;(function(r){r[r.Stopped=1]="Stopped",r[r.Starting=3]="Starting",r[r.StartFailed=4]="StartFailed",r[r.Running=2]="Running"})(jn||(Q.State=jn={}));var Ll;(function(r){r.off="off",r.on="on"})(Ll||(Q.SuspendMode=Ll={}));var ic;(function(r){function e(t){return t==null?!1:typeof t=="boolean"||typeof t=="object"&&t!==null&&tt.stringArray(t.enabledCommands)?t:!1}r.sanitizeIsTrusted=e})(ic||(ic={}));var rc=class{client;maxRestartCount;restarts;constructor(e,t){this.client=e,this.maxRestartCount=t,this.restarts=[]}error(e,t,n){return n&&n<=3?{action:Pi.Continue}:{action:Pi.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:Xt.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=180*1e3?{action:Xt.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:Xt.Restart})}},K;(function(r){r.Initial="initial",r.Starting="starting",r.StartFailed="startFailed",r.Running="running",r.Stopping="stopping",r.Stopped="stopped"})(K||(K={}));var Nl;(function(r){function e(t){return t&&S.MessageReader.is(t.reader)&&S.MessageWriter.is(t.writer)}r.is=e})(Nl||(Q.MessageTransports=Nl={}));var Zt;(function(r){r.Restart="restart",r.Stop="stop"})(Zt||(Q.ShutdownMode=Zt={}));var sc=class r{open;_onOpen;_onClose;disposables;constructor(){this.disposables=[],this.open=new Set,this._onOpen=new L.EventEmitter,this._onClose=new L.EventEmitter,r.fillVisibleResources(this.open);let e=()=>{let t=this.open,n=new Set;r.fillVisibleResources(n);let i=new Set,s=new Set(n);for(let o of t.values())n.has(o)?s.delete(o):i.add(o);if(this.open=n,i.size>0){let o=new Set;for(let a of i)o.add(L.Uri.parse(a));this._onClose.fire(o)}if(s.size>0){let o=new Set;for(let a of s)o.add(L.Uri.parse(a));this._onOpen.fire(o)}};this.disposables.push(L.window.tabGroups.onDidChangeTabs(t=>{t.closed.length===0&&t.opened.length===0||e()})),this.disposables.push(L.window.onDidChangeVisibleTextEditors(t=>{e()}))}get onClose(){return this._onClose.event}get onOpen(){return this._onOpen.event}dispose(){this.disposables.forEach(e=>e.dispose())}isActive(e){return e instanceof L.Uri?L.window.activeTextEditor?.document.uri===e:L.window.activeTextEditor?.document===e}isVisible(e){let t=e instanceof L.Uri?e:e.uri;return t.scheme===nc.NotebookDocumentSyncFeature.CellScheme?L.workspace.notebookDocuments.some(n=>this.open.has(n.uri.toString())?n.getCells().find(s=>s.document.uri.toString()===t.toString())!==void 0:!1):this.open.has(t.toString())}getResources(){let e=new Set;return r.fillVisibleResources(new Set,e),e}static fillVisibleResources(e,t){let n=e??new Set;for(let i of L.window.tabGroups.all)for(let s of i.tabs){let o=s.input,a;o instanceof L.TabInputText?a=o.uri:o instanceof L.TabInputTextDiff?a=o.modified:(o instanceof L.TabInputCustom||o instanceof L.TabInputNotebook)&&(a=o.uri),a!==void 0&&!n.has(a.toString())&&(n.add(a.toString()),t!==void 0&&t.add(a))}for(let i of L.window.visibleTextEditors){let s=i.document.uri;n.has(s.toString())||(n.add(s.toString()),t!==void 0&&t.add(s))}}},Kr=class r{_id;_name;_clientOptions;_state;_onStart;_onStop;_connection;_idleInterval;_ignoredRegistrations;_listeners;_disposed;_notificationHandlers;_notificationDisposables;_pendingNotificationHandlers;_requestHandlers;_requestDisposables;_pendingRequestHandlers;_progressHandlers;_pendingProgressHandlers;_progressDisposables;_initializeResult;_outputChannel;_disposeOutputChannel;_traceOutputChannel;_traceLogLevel;_capabilities;_diagnostics;_syncedDocuments;_didChangeTextDocumentFeature;_inFlightOpenNotifications;_pendingChangeSemaphore;_pendingChangeDelayer;_didOpenTextDocumentFeature;_fileEvents;_fileEventDelayer;_telemetryEmitter;_stateChangeEmitter;_trace;_traceFormat=S.TraceFormat.Text;_tracer;_c2p;_p2c;_visibleDocuments;constructor(e,t,n){this._id=e,this._name=t,n=n||{};let i={isTrusted:!1,supportHtml:!1,supportThemeIcons:!1};n.markdown!==void 0&&(i.isTrusted=ic.sanitizeIsTrusted(n.markdown.isTrusted),i.supportHtml=n.markdown.supportHtml===!0,i.supportThemeIcons=n.markdown.supportThemeIcons===!0),this._clientOptions={documentSelector:n.documentSelector??[],synchronize:n.synchronize??{},diagnosticCollectionName:n.diagnosticCollectionName,outputChannelName:n.outputChannelName??this._name,revealOutputChannelOn:n.revealOutputChannelOn??yn.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},diagnosticCollectionProvider:n.diagnosticCollectionProvider??new Oe.DefaultDiagnosticCollectionProvider,notebookDocumentOptions:n.notebookDocumentOptions??{},textSynchronization:this.createTextSynchronizationOptions(n.textSynchronization)},this._clientOptions.synchronize=this._clientOptions.synchronize||{},this._state=K.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._traceLogLevel=this._outputChannel.logLevel):(this._outputChannel=void 0,this._disposeOutputChannel=!0,this._traceLogLevel=L.LogLevel.Info),this._traceOutputChannel=n.traceOutputChannel,this._traceOutputChannel!==void 0&&(this._traceLogLevel=this._traceOutputChannel.logLevel),this._diagnostics=void 0,this._inFlightOpenNotifications=new Set,this._pendingChangeSemaphore=new Ur.Semaphore(1),this._pendingChangeDelayer=new Ur.Delayer(250),this._fileEvents=[],this._fileEventDelayer=new Ur.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new S.Emitter,this._stateChangeEmitter=new S.Emitter,this._trace=S.Trace.Off,this._tracer={log:(s,o)=>{tt.string(s)?this.trace(s,o):this.traceObject(s)}},this._c2p=Fm.createConverter(n.uriConverters?n.uriConverters.code2Protocol:void 0),this._p2c=xm.createConverter(n.uriConverters?n.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml,this._clientOptions.markdown.supportThemeIcons),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}createTextSynchronizationOptions(e){return e?typeof e.delayOpenNotifications=="boolean"?{delayOpenNotifications:e.delayOpenNotifications}:{delayOpenNotifications:!1}:{delayOpenNotifications:!1}}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 visibleDocuments(){return this._visibleDocuments===void 0&&(this._visibleDocuments=new sc),this._visibleDocuments}get onTelemetry(){return this._telemetryEmitter.event}get onDidChangeState(){return this._stateChangeEmitter.event}get outputChannel(){return this._outputChannel||(this._outputChannel=L.window.createOutputChannel(this._clientOptions.outputChannelName?this._clientOptions.outputChannelName:this._name,{log:!0}),this._traceOutputChannel===void 0&&(this._traceLogLevel=this._outputChannel.logLevel)),this._outputChannel}get traceOutputChannel(){return this._traceOutputChannel?this._traceOutputChannel:this.outputChannel}get diagnostics(){if(this._diagnostics!==null)return this._diagnostics===void 0&&(this._diagnostics=this._clientOptions.diagnosticCollectionProvider.create(this._clientOptions.diagnosticCollectionName??this._id,Oe.DiagnosticCollectionSource.push)),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 K.Starting:return jn.Starting;case K.Running:return jn.Running;case K.StartFailed:return jn.StartFailed;default:return jn.Stopped}}get initializeResult(){return this._initializeResult}async sendRequest(e,...t){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.ErrorCodes.ConnectionInactive,"Client is not running"));let n=await this.$start();await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(),this._didChangeTextDocumentFeature.syncKind===S.TextDocumentSyncKind.Full&&await this.sendPendingFullTextDocumentChanges(n);let i,s;if(t.length===1?S.CancellationToken.is(t[0])?s=t[0]:i=t[0]:t.length===2&&(i=t[0],s=t[1]),s!==void 0&&s.isCancellationRequested)return Promise.reject(new S.ResponseError(S.LSPErrorCodes.RequestCancelled,"Request got cancelled"));let o=this._clientOptions.middleware?.sendRequest;return o!==void 0?o(e,i,s,(a,u,l)=>{let h=[];return u!==void 0&&h.push(u),l!==void 0&&h.push(l),n.sendRequest(a,...h)}):n.sendRequest(e,...t)}onRequest(e,t){let n=typeof e=="string"?e:e.method;this._requestHandlers.set(n,t);let i=this.activeConnection(),s;return i!==void 0?(this._requestDisposables.set(n,i.onRequest(e,t)),s={dispose:()=>{let o=this._requestDisposables.get(n);o!==void 0&&(o.dispose(),this._requestDisposables.delete(n))}}):(this._pendingRequestHandlers.set(n,t),s={dispose:()=>{this._pendingRequestHandlers.delete(n);let o=this._requestDisposables.get(n);o!==void 0&&(o.dispose(),this._requestDisposables.delete(n))}}),{dispose:()=>{this._requestHandlers.delete(n),s.dispose()}}}async sendNotification(e,t){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.ErrorCodes.ConnectionInactive,"Client is not running"));let n=this._didChangeTextDocumentFeature.syncKind===S.TextDocumentSyncKind.Full,i;n&&typeof e!="string"&&e.method===S.DidOpenTextDocumentNotification.method&&(i=t?.textDocument.uri,this._inFlightOpenNotifications.add(i));let s;typeof e!="string"&&e.method===S.DidCloseTextDocumentNotification.method&&(s=t.textDocument.uri);let o=await this.$start();if(await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(s))return;n&&await this.sendPendingFullTextDocumentChanges(o),i!==void 0&&this._inFlightOpenNotifications.delete(i);let u=this._clientOptions.middleware?.sendNotification;return u?u(e,o.sendNotification.bind(o),t):o.sendNotification(e,t)}onNotification(e,t){let n=typeof e=="string"?e:e.method;this._notificationHandlers.set(n,t);let i=this.activeConnection(),s;return i!==void 0?(this._notificationDisposables.set(n,i.onNotification(e,t)),s={dispose:()=>{let o=this._notificationDisposables.get(n);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(n))}}):(this._pendingNotificationHandlers.set(n,t),s={dispose:()=>{this._pendingNotificationHandlers.delete(n);let o=this._notificationDisposables.get(n);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(n))}}),{dispose:()=>{this._notificationHandlers.delete(n),s.dispose()}}}async sendProgress(e,t,n){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.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(),s,o=this._clientOptions.middleware?.handleWorkDoneProgress,a=S.WorkDoneProgress.is(e)&&o!==void 0?u=>{o(t,u,()=>n(u))}:n;return i!==void 0?(this._progressDisposables.set(t,i.onProgress(e,t,a)),s={dispose:()=>{let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}):(this._pendingProgressHandlers.set(t,{type:e,handler:n}),s={dispose:()=>{this._pendingProgressHandlers.delete(t);let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}),{dispose:()=>{this._progressHandlers.delete(t),s.dispose()}}}createDefaultErrorHandler(e){if(e!==void 0&&e<0)throw new Error(`Invalid maxRestartCount: ${e}`);return new rc(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 S.ResponseError){let t=e;return` Message: ${t.message}
9
9
  Code: ${t.code} ${t.data?`
10
- `+t.data.toString():""}`}return e instanceof Error?et.string(e.stack)?e.stack:e.message:et.string(e)?e:e.toString()}shouldLogToOutputChannel(){return this.$state!==K.Stopped?!0:this._outputChannel!==void 0}error(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.error(this.getLogMessage(e,t)),(n==="force"||n&&this._clientOptions.revealOutputChannelOn<=mn.Error)&&this.showNotificationMessage(S.MessageType.Error,e,t)}warn(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.warn(this.getLogMessage(e,t)),n&&this._clientOptions.revealOutputChannelOn<=mn.Warn&&this.showNotificationMessage(S.MessageType.Warning,e,t)}info(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.info(this.getLogMessage(e,t)),n&&this._clientOptions.revealOutputChannelOn<=mn.Info&&this.showNotificationMessage(S.MessageType.Info,e,t)}debug(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.debug(this.getLogMessage(e,t)),n&&this._clientOptions.revealOutputChannelOn<=mn.Debug&&this.showNotificationMessage(S.MessageType.Debug,e,t)}trace(e,t){this.traceOutputChannel.trace(this.getLogMessage(e,t))}traceObject(e){this.traceOutputChannel.trace(JSON.stringify(e))}showNotificationMessage(e,t,n){t=t??"A request has failed. See the output for more information.",n&&(t+=`
11
- `+this.data2String(n)),(e===S.MessageType.Error?j.window.showErrorMessage:e===S.MessageType.Warning?j.window.showWarningMessage:j.window.showInformationMessage)(t,"Go to output").then(s=>{s!==void 0&&this.outputChannel.show(!0)})}getLogMessage(e,t){return t!=null?`${e}
12
- ${this.data2String(t)}`:e}needsStart(){return this.$state===K.Initial||this.$state===K.Stopping||this.$state===K.Stopped}needsStop(){return this.$state===K.Starting||this.$state===K.Running}activeConnection(){return this.$state===K.Running&&this._connection!==void 0?this._connection:void 0}isRunning(){return this.$state===K.Running}async start(){if(this._disposed==="disposing"||this._disposed==="disposed")throw new Error("Client got disposed and can't be restarted.");if(this.$state===K.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=j.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName??this._id));for(let[i,s]of this._notificationHandlers)this._pendingNotificationHandlers.has(i)||this._pendingNotificationHandlers.set(i,s);for(let[i,s]of this._requestHandlers)this._pendingRequestHandlers.has(i)||this._pendingRequestHandlers.set(i,s);for(let[i,s]of this._progressHandlers)this._pendingProgressHandlers.has(i)||this._pendingProgressHandlers.set(i,s);this.$state=K.Starting;try{let i=await this.createConnection();i.onNotification(S.LogMessageNotification.type,s=>{switch(s.type){case S.MessageType.Error:this.error(s.message,void 0,!1);break;case S.MessageType.Warning:this.warn(s.message,void 0,!1);break;case S.MessageType.Info:this.info(s.message,void 0,!1);break;case S.MessageType.Debug:this.debug(s.message,void 0,!1);break;default:this.outputChannel.appendLine(s.message)}}),i.onNotification(S.ShowMessageNotification.type,s=>{switch(s.type){case S.MessageType.Error:j.window.showErrorMessage(s.message);break;case S.MessageType.Warning:j.window.showWarningMessage(s.message);break;case S.MessageType.Info:j.window.showInformationMessage(s.message);break;default:j.window.showInformationMessage(s.message)}}),i.onRequest(S.ShowMessageRequest.type,s=>{let o;switch(s.type){case S.MessageType.Error:o=j.window.showErrorMessage;break;case S.MessageType.Warning:o=j.window.showWarningMessage;break;case S.MessageType.Info:o=j.window.showInformationMessage;break;default:o=j.window.showInformationMessage}let a=s.actions||[];return o(s.message,...a)}),i.onNotification(S.TelemetryEventNotification.type,s=>{this._telemetryEmitter.fire(s)}),i.onRequest(S.ShowDocumentRequest.type,async(s,o)=>{let a=async l=>{let h=this.protocol2CodeConverter.asUri(l.uri);try{if(l.external===!0)return{success:await j.env.openExternal(h)};{let p={};return l.selection!==void 0&&(p.selection=this.protocol2CodeConverter.asRange(l.selection)),l.takeFocus===void 0||l.takeFocus===!1?p.preserveFocus=!0:l.takeFocus===!0&&(p.preserveFocus=!1),await j.window.showTextDocument(h,p),{success:!0}}}catch{return{success:!1}}},u=this._clientOptions.middleware.window?.showDocument;return u!==void 0?u(s,o,a):a(s)}),i.listen(),await this.initialize(i),t()}catch(i){this.$state=K.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,s)=>{e=i,t=s}),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],s={processId:null,clientInfo:{name:j.env.appName,version:j.version},locale:this.getLocale(),rootPath:n||null,rootUri:n?this._c2p.asUri(j.Uri.file(n)):null,capabilities:this.computeClientCapabilities(),initializationOptions:et.func(t)?t():t,trace:S.Trace.toString(this._trace),workspaceFolders:i};if(this.fillInitializeParams(s),this._clientOptions.progressOnInitialization){let o=ql.generateUuid(),a=new Fm.ProgressPart(e,o);s.workDoneToken=o;try{let u=await this.doInitialize(e,s);return a.done(),u}catch(u){throw a.cancel(),u}}else return this.doInitialize(e,s)}async doInitialize(e,t){try{let n=await e.initialize(t);if(n.capabilities.positionEncoding!==void 0&&n.capabilities.positionEncoding!==S.PositionEncodingKind.UTF16)throw new Error(`Unsupported position encoding (${n.capabilities.positionEncoding}) received from server ${this.name}`);this._initializeResult=n,this.$state=K.Running;let i;et.number(n.capabilities.textDocumentSync)?n.capabilities.textDocumentSync===S.TextDocumentSyncKind.None?i={openClose:!1,change:S.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(S.PublishDiagnosticsNotification.type,s=>this.handleDiagnostics(s)),e.onRequest(S.RegistrationRequest.type,s=>this.handleRegistrationRequest(s)),e.onRequest("client/registerFeature",s=>this.handleRegistrationRequest(s)),e.onRequest(S.UnregistrationRequest.type,s=>this.handleUnregistrationRequest(s)),e.onRequest("client/unregisterFeature",s=>this.handleUnregistrationRequest(s)),e.onRequest(S.ApplyWorkspaceEditRequest.type,s=>this.handleApplyWorkspaceEdit(s));for(let[s,o]of this._pendingNotificationHandlers)this._notificationDisposables.set(s,e.onNotification(s,o));this._pendingNotificationHandlers.clear();for(let[s,o]of this._pendingRequestHandlers)this._requestDisposables.set(s,e.onRequest(s,o));this._pendingRequestHandlers.clear();for(let[s,o]of this._pendingProgressHandlers)this._progressDisposables.set(s,e.onProgress(o.type,s,o.handler));return this._pendingProgressHandlers.clear(),await e.sendNotification(S.InitializedNotification.type,{}),this.hookFileEvents(e),this.hookLogLevelChanged(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 S.ResponseError&&n.data&&n.data.retry?j.window.showErrorMessage(n.message,{title:"Retry",id:"retry"}).then(i=>{i&&i.id==="retry"?this.initialize(e):this.stop()}):(n&&n.message&&j.window.showErrorMessage(n.message),this.error("Server initialization failed.",n),this.stop()),n}}_clientGetRootPath(){let e=j.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(Zt.Stop,e)}dispose(e=2e3){try{return this._disposed="disposing",this.stop(e)}finally{this._disposed="disposed"}}async shutdown(e,t=2e3){if(this.$state===K.Stopped||this.$state===K.Initial)return;if(this.$state===K.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!==K.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=K.Stopping,this.cleanUp(e);let i=new Promise(o=>{(0,S.RAL)().timer.setTimeout(o,t)}),s=(async o=>(await o.shutdown(),await o.exit(),o))(n);return this._onStop=Promise.race([i,s]).then(o=>{if(o!==void 0)o.end(),o.dispose();else throw this.error("Stopping server timed out",void 0,!1),new Error("Stopping the server timed out")},o=>{throw this.error("Stopping server failed",o,!1),o}).finally(()=>{this.$state=K.Stopped,e===Zt.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===Zt.Stop||e===Zt.Restart)&&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(s){return t._fileEvents.push(s),t._fileEventDelayer.trigger(async()=>{let o=t._fileEvents;t._fileEvents=[];try{await t.sendNotification(S.DidChangeWatchedFilesNotification.type,{changes:o})}catch(a){throw t._fileEvents.push(...o),a}})}let i=this.clientOptions.middleware?.workspace;(i?.didChangeWatchedFile?i.didChangeWatchedFile(e,n):n(e)).catch(s=>{t.error("Notifying file events failed.",s)})}async sendPendingFullTextDocumentChanges(e){return this._pendingChangeSemaphore.lock(async()=>{try{let t=this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._inFlightOpenNotifications);if(t.length===0)return;for(let n of t){let i=this.code2ProtocolConverter.asChangeTextDocumentParams(n);await e.sendNotification(S.DidChangeTextDocumentNotification.type,i),this._didChangeTextDocumentFeature.notificationSent(n,S.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))}_diagnosticQueue=new Map;_diagnosticQueueState={state:"idle"};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,S.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 j.CancellationTokenSource;this._diagnosticQueueState={state:"busy",document:t,tokenSource:i},this._p2c.asDiagnostics(n,i.token).then(s=>{if(!i.token.isCancellationRequested){let o=this._p2c.asUri(t),a=this.clientOptions.middleware;a.handleDiagnostics?a.handleDiagnostics(o,s,(u,l)=>this.setDiagnostics(u,l)):this.setDiagnostics(o,s)}}).catch(s=>{this.error("Processing diagnostic queue failed.",s)}).finally(()=>{this._diagnosticQueueState={state:"idle"},this.triggerDiagnosticQueue()})}setDiagnostics(e,t){this._diagnostics&&this._diagnostics.set(e,t)}getLocale(){return j.env.language}async $start(){if(this.$state===K.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,s,o)=>{this.handleConnectionError(i,s,o).catch(a=>this.error("Handling connection error failed",a))},t=()=>{this.handleConnectionClosed().catch(i=>this.error("Handling connection close failed",i))},n=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=av(n.reader,n.writer,e,t,this._clientOptions.connectionOptions),this._connection}async handleConnectionClosed(){if(this.$state===K.Stopped)return;try{this._connection!==void 0&&this._connection.dispose()}catch{}let e={action:Xt.DoNotRestart};if(this.$state!==K.Stopping)try{e=await this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,e.action===Xt.DoNotRestart?(this.error(e.message??"Connection to server got closed. Server will not be restarted.",void 0,e.handled===!0?!1:"force"),this.cleanUp(Zt.Stop),this.$state===K.Starting?this.$state=K.StartFailed:this.$state=K.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):e.action===Xt.Restart&&(this.info(e.message??"Connection to server got closed. Server will restart.",void 0,!e.handled),this.cleanUp(Zt.Restart),this.$state=K.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===Di.Shutdown?(this.error(i.message??`Client ${this._name}: connection to server is erroring.
10
+ `+t.data.toString():""}`}return e instanceof Error?tt.string(e.stack)?e.stack:e.message:tt.string(e)?e:e.toString()}shouldLogToOutputChannel(){return this.$state!==K.Stopped?!0:this._outputChannel!==void 0}error(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.error(this.getLogMessage(e,t)),(n==="force"||n&&this._clientOptions.revealOutputChannelOn<=yn.Error)&&this.showNotificationMessage(S.MessageType.Error,e,t)}warn(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.warn(this.getLogMessage(e,t)),n&&this._clientOptions.revealOutputChannelOn<=yn.Warn&&this.showNotificationMessage(S.MessageType.Warning,e,t)}info(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.info(this.getLogMessage(e,t)),n&&this._clientOptions.revealOutputChannelOn<=yn.Info&&this.showNotificationMessage(S.MessageType.Info,e,t)}debug(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.debug(this.getLogMessage(e,t)),n&&this._clientOptions.revealOutputChannelOn<=yn.Debug&&this.showNotificationMessage(S.MessageType.Debug,e,t)}trace(e,t){this.traceOutputChannel.trace(this.getLogMessage(e,t))}traceObject(e){this.traceOutputChannel.trace(JSON.stringify(e))}showNotificationMessage(e,t,n){t=t??"A request has failed. See the output for more information.",n&&(t+=`
11
+ `+this.data2String(n)),(e===S.MessageType.Error?L.window.showErrorMessage:e===S.MessageType.Warning?L.window.showWarningMessage:L.window.showInformationMessage)(t,"Go to output").then(s=>{s!==void 0&&this.outputChannel.show(!0)})}getLogMessage(e,t){return t!=null?`${e}
12
+ ${this.data2String(t)}`:e}needsStart(){return this.$state===K.Initial||this.$state===K.Stopping||this.$state===K.Stopped}needsStop(){return this.$state===K.Starting||this.$state===K.Running}activeConnection(){return this.$state===K.Running&&this._connection!==void 0?this._connection:void 0}isRunning(){return this.$state===K.Running}async start(){if(this._disposed==="disposing"||this._disposed==="disposed")throw new Error("Client got disposed and can't be restarted.");if(this.$state===K.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;for(let[i,s]of this._notificationHandlers)this._pendingNotificationHandlers.has(i)||this._pendingNotificationHandlers.set(i,s);for(let[i,s]of this._requestHandlers)this._pendingRequestHandlers.has(i)||this._pendingRequestHandlers.set(i,s);for(let[i,s]of this._progressHandlers)this._pendingProgressHandlers.has(i)||this._pendingProgressHandlers.set(i,s);this.$state=K.Starting;try{let i=await this.createConnection();i.onNotification(S.LogMessageNotification.type,s=>{switch(s.type){case S.MessageType.Error:this.error(s.message,void 0,!1);break;case S.MessageType.Warning:this.warn(s.message,void 0,!1);break;case S.MessageType.Info:this.info(s.message,void 0,!1);break;case S.MessageType.Debug:this.debug(s.message,void 0,!1);break;default:this.outputChannel.appendLine(s.message)}}),i.onNotification(S.ShowMessageNotification.type,s=>{switch(s.type){case S.MessageType.Error:L.window.showErrorMessage(s.message);break;case S.MessageType.Warning:L.window.showWarningMessage(s.message);break;case S.MessageType.Info:L.window.showInformationMessage(s.message);break;default:L.window.showInformationMessage(s.message)}}),i.onRequest(S.ShowMessageRequest.type,s=>{let o;switch(s.type){case S.MessageType.Error:o=L.window.showErrorMessage;break;case S.MessageType.Warning:o=L.window.showWarningMessage;break;case S.MessageType.Info:o=L.window.showInformationMessage;break;default:o=L.window.showInformationMessage}let a=s.actions||[];return o(s.message,...a)}),i.onNotification(S.TelemetryEventNotification.type,s=>{this._telemetryEmitter.fire(s)}),i.onRequest(S.ShowDocumentRequest.type,async(s,o)=>{let a=async l=>{let h=this.protocol2CodeConverter.asUri(l.uri);try{if(l.external===!0)return{success:await L.env.openExternal(h)};{let p={};return l.selection!==void 0&&(p.selection=this.protocol2CodeConverter.asRange(l.selection)),l.takeFocus===void 0||l.takeFocus===!1?p.preserveFocus=!0:l.takeFocus===!0&&(p.preserveFocus=!1),await L.window.showTextDocument(h,p),{success:!0}}}catch{return{success:!1}}},u=this._clientOptions.middleware.window?.showDocument;return u!==void 0?u(s,o,a):a(s)}),i.listen(),await this.initialize(i),t()}catch(i){this.$state=K.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,s)=>{e=i,t=s}),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],s={processId:null,clientInfo:{name:L.env.appName,version:L.version},locale:this.getLocale(),rootPath:n||null,rootUri:n?this._c2p.asUri(L.Uri.file(n)):null,capabilities:this.computeClientCapabilities(),initializationOptions:tt.func(t)?t():t,trace:S.Trace.toString(this._trace),workspaceFolders:i};if(this.fillInitializeParams(s),this._clientOptions.progressOnInitialization){let o=Al.generateUuid(),a=new Mm.ProgressPart(e,o);s.workDoneToken=o;try{let u=await this.doInitialize(e,s);return a.done(),u}catch(u){throw a.cancel(),u}}else return this.doInitialize(e,s)}async doInitialize(e,t){try{let n=await e.initialize(t);if(n.capabilities.positionEncoding!==void 0&&n.capabilities.positionEncoding!==S.PositionEncodingKind.UTF16)throw new Error(`Unsupported position encoding (${n.capabilities.positionEncoding}) received from server ${this.name}`);this._initializeResult=n,this.$state=K.Running;let i;tt.number(n.capabilities.textDocumentSync)?n.capabilities.textDocumentSync===S.TextDocumentSyncKind.None?i={openClose:!1,change:S.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(S.PublishDiagnosticsNotification.type,s=>this.handleDiagnostics(s)),e.onRequest(S.RegistrationRequest.type,s=>this.handleRegistrationRequest(s)),e.onRequest("client/registerFeature",s=>this.handleRegistrationRequest(s)),e.onRequest(S.UnregistrationRequest.type,s=>this.handleUnregistrationRequest(s)),e.onRequest("client/unregisterFeature",s=>this.handleUnregistrationRequest(s)),e.onRequest(S.ApplyWorkspaceEditRequest.type,s=>this.handleApplyWorkspaceEdit(s));for(let[s,o]of this._pendingNotificationHandlers)this._notificationDisposables.set(s,e.onNotification(s,o));this._pendingNotificationHandlers.clear();for(let[s,o]of this._pendingRequestHandlers)this._requestDisposables.set(s,e.onRequest(s,o));this._pendingRequestHandlers.clear();for(let[s,o]of this._pendingProgressHandlers)this._progressDisposables.set(s,e.onProgress(o.type,s,o.handler));return this._pendingProgressHandlers.clear(),await e.sendNotification(S.InitializedNotification.type,{}),this.hookFileEvents(e),this.hookLogLevelChanged(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 S.ResponseError&&n.data&&n.data.retry?L.window.showErrorMessage(n.message,{title:"Retry",id:"retry"}).then(i=>{i&&i.id==="retry"?this.initialize(e):this.stop()}):(n&&n.message&&L.window.showErrorMessage(n.message),this.error("Server initialization failed.",n),this.stop()),n}}_clientGetRootPath(){let e=L.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(Zt.Stop,e)}dispose(e=2e3){try{return this._disposed="disposing",this.stop(e)}finally{this._disposed="disposed"}}async shutdown(e,t=2e3){if(this.$state===K.Stopped||this.$state===K.Initial)return;if(this.$state===K.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!==K.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=K.Stopping,this.cleanUp(e);let i=new Promise(o=>{(0,S.RAL)().timer.setTimeout(o,t)}),s=(async o=>(await o.shutdown(),await o.exit(),o))(n);return this._onStop=Promise.race([i,s]).then(o=>{if(o!==void 0)o.end(),o.dispose();else throw this.error("Stopping server timed out",void 0,!1),new Error("Stopping the server timed out")},o=>{throw this.error("Stopping server failed",o,!1),o}).finally(()=>{this.$state=K.Stopped,e===Zt.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===Zt.Stop||e===Zt.Restart)&&(this._diagnostics===void 0&&(this._diagnostics=null),this._diagnostics!==null&&(this._clientOptions.diagnosticCollectionProvider.dispose(this._diagnostics,Oe.DiagnosticCollectionSource.push),this._diagnostics=null)),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(s){return t._fileEvents.push(s),t._fileEventDelayer.trigger(async()=>{let o=t._fileEvents;t._fileEvents=[];try{await t.sendNotification(S.DidChangeWatchedFilesNotification.type,{changes:o})}catch(a){throw t._fileEvents.push(...o),a}})}let i=this.clientOptions.middleware?.workspace;(i?.didChangeWatchedFile?i.didChangeWatchedFile(e,n):n(e)).catch(s=>{t.error("Notifying file events failed.",s)})}async sendPendingFullTextDocumentChanges(e){return this._pendingChangeSemaphore.lock(async()=>{try{let t=this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._inFlightOpenNotifications);if(t.length===0)return;for(let n of t){let i=this.code2ProtocolConverter.asChangeTextDocumentParams(n);this._didChangeTextDocumentFeature.aboutToSendNotification(n,S.DidChangeTextDocumentNotification.type,i),await e.sendNotification(S.DidChangeTextDocumentNotification.type,i),this._didChangeTextDocumentFeature.notificationSent(n,S.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))}_diagnosticQueue=new Map;_diagnosticQueueState={state:"idle"};handleDiagnostics(e){if(this._diagnostics===null)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,S.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 L.CancellationTokenSource;this._diagnosticQueueState={state:"busy",document:t,tokenSource:i},this._p2c.asDiagnostics(n,i.token).then(s=>{if(!i.token.isCancellationRequested){let o=this._p2c.asUri(t),a=this.clientOptions.middleware;a.handleDiagnostics?a.handleDiagnostics(o,s,(u,l)=>this.setDiagnostics(u,l)):this.setDiagnostics(o,s)}}).catch(s=>{this.error("Processing diagnostic queue failed.",s)}).finally(()=>{this._diagnosticQueueState={state:"idle"},this.triggerDiagnosticQueue()})}setDiagnostics(e,t){if(this._diagnostics===null)return;let n=this.diagnostics;n!==void 0&&n.set(e,t)}getLocale(){return L.env.language}async $start(){if(this.$state===K.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,s,o)=>{this.handleConnectionError(i,s,o).catch(a=>this.error("Handling connection error failed",a))},t=()=>{this.handleConnectionClosed().catch(i=>this.error("Handling connection close failed",i))},n=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=uv(n.reader,n.writer,e,t,this._clientOptions.connectionOptions),this._connection}async handleConnectionClosed(){if(this.$state===K.Stopped)return;try{this._connection!==void 0&&this._connection.dispose()}catch{}let e={action:Xt.DoNotRestart};if(this.$state!==K.Stopping)try{e=await this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,e.action===Xt.DoNotRestart?(this.error(e.message??"Connection to server got closed. Server will not be restarted.",void 0,e.handled===!0?!1:"force"),this.cleanUp(Zt.Stop),this.$state===K.Starting?this.$state=K.StartFailed:this.$state=K.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):e.action===Xt.Restart&&(this.info(e.message??"Connection to server got closed. Server will restart.",void 0,!e.handled),this.cleanUp(Zt.Restart),this.$state=K.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===Pi.Shutdown?(this.error(i.message??`Client ${this._name}: connection to server is erroring.
13
13
  ${e.message}
14
14
  Shutting down server.`,void 0,i.handled===!0?!1:"force"),this.stop().catch(s=>{this.error("Stopping server failed",s,!1)})):this.error(i.message??`Client ${this._name}: connection to server is erroring.
15
- ${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this._listeners.push(j.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)}))}hookLogLevelChanged(e){this._listeners.push(this.traceOutputChannel.onDidChangeLogLevel(t=>{this._traceLogLevel=t,this.refreshTrace(e,!0)}))}refreshTrace(e,t=!1){let n=j.workspace.getConfiguration(this._id),i=this._traceLogLevel!==j.LogLevel.Trace?S.Trace.Off:S.Trace.Messages,s=S.TraceFormat.Text;if(n&&i!==S.Trace.Off){let o=n.get("trace.server","messages");typeof o=="string"?(i=S.Trace.fromString(o),i===S.Trace.Off&&(i=S.Trace.Messages)):(i=S.Trace.fromString(n.get("trace.server.verbosity","messages")),i===S.Trace.Off&&(i=S.Trace.Messages),s=S.TraceFormat.fromString(n.get("trace.server.format","text")))}this._trace=i,this._traceFormat=s,e.trace(this._trace,this._tracer,{sendNotification:t,traceFormat:this._traceFormat}).catch(o=>{this.error("Updating trace failed with error",o,!1)})}hookFileEvents(e){let t=this._clientOptions.synchronize.fileEvents;if(!t)return;let n;et.array(t)?n=t:n=[t],n&&this._dynamicFeatures.get(S.DidChangeWatchedFilesNotification.type.method).registerRaw(ql.generateUuid(),n)}_features=[];_dynamicFeatures=new Map;registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),Le.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(S.NotebookDocumentSyncRegistrationType.method);return t===void 0||!(t instanceof tc.NotebookDocumentSyncFeature)?!1:t.handles(e)}registerBuiltinFeatures(){let e=new Map;this.registerFeature(new Il.ConfigurationFeature(this)),this._didOpenTextDocumentFeature=new In.DidOpenTextDocumentFeature(this,this._syncedDocuments),this.registerFeature(this._didOpenTextDocumentFeature),this._didChangeTextDocumentFeature=new In.DidChangeTextDocumentFeature(this,e),this._didChangeTextDocumentFeature.onPendingChangeAdded(()=>{this.triggerPendingChangeDelivery()}),this.registerFeature(this._didChangeTextDocumentFeature),this.registerFeature(new In.WillSaveFeature(this)),this.registerFeature(new In.WillSaveWaitUntilFeature(this)),this.registerFeature(new In.DidSaveTextDocumentFeature(this)),this.registerFeature(new In.DidCloseTextDocumentFeature(this,this._syncedDocuments,e)),this.registerFeature(new sv.FileSystemWatcherFeature(this,t=>this.notifyFileEvent(t))),this.registerFeature(new Mm.CompletionItemFeature(this)),this.registerFeature(new km.HoverFeature(this)),this.registerFeature(new qm.SignatureHelpFeature(this)),this.registerFeature(new Em.DefinitionFeature(this)),this.registerFeature(new Lm.ReferencesFeature(this)),this.registerFeature(new Im.DocumentHighlightFeature(this)),this.registerFeature(new Am.DocumentSymbolFeature(this)),this.registerFeature(new jm.WorkspaceSymbolFeature(this)),this.registerFeature(new Hm.CodeActionFeature(this)),this.registerFeature(new Wm.CodeLensFeature(this)),this.registerFeature(new ec.DocumentFormattingFeature(this)),this.registerFeature(new ec.DocumentRangeFormattingFeature(this)),this.registerFeature(new ec.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new $m.RenameFeature(this)),this.registerFeature(new Bm.DocumentLinkFeature(this)),this.registerFeature(new zm.ExecuteCommandFeature(this)),this.registerFeature(new Il.SyncConfigurationFeature(this)),this.registerFeature(new Nm.TypeDefinitionFeature(this)),this.registerFeature(new Um.ImplementationFeature(this)),this.registerFeature(new Km.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new nv.WorkspaceFoldersFeature(this)),this.registerFeature(new Vm.FoldingRangeFeature(this)),this.registerFeature(new Gm.DeclarationFeature(this)),this.registerFeature(new Jm.SelectionRangeFeature(this)),this.registerFeature(new ov.ProgressFeature(this)),this.registerFeature(new Ym.CallHierarchyFeature(this)),this.registerFeature(new Qm.SemanticTokensFeature(this)),this.registerFeature(new Zm.LinkedEditingFeature(this)),this.registerFeature(new An.DidCreateFilesFeature(this)),this.registerFeature(new An.DidRenameFilesFeature(this)),this.registerFeature(new An.DidDeleteFilesFeature(this)),this.registerFeature(new An.WillCreateFilesFeature(this)),this.registerFeature(new An.WillRenameFilesFeature(this)),this.registerFeature(new An.WillDeleteFilesFeature(this)),this.registerFeature(new Xm.TypeHierarchyFeature(this)),this.registerFeature(new ev.InlineValueFeature(this)),this.registerFeature(new tv.InlayHintsFeature(this)),this.registerFeature(new xm.DiagnosticFeature(this)),this.registerFeature(new tc.NotebookDocumentSyncFeature(this)),this.registerFeature(new iv.InlineCompletionItemFeature(this)),this.registerFeature(new rv.TextDocumentContentFeature(this))}registerProposedFeatures(){this.registerFeatures(ac.createAll(this))}fillInitializeParams(e){for(let t of this._features)et.func(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};(0,Le.ensure)(e,"workspace").applyEdit=!0;let t=(0,Le.ensure)((0,Le.ensure)(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[S.ResourceOperationKind.Create,S.ResourceOperationKind.Rename,S.ResourceOperationKind.Delete],t.failureHandling=S.FailureHandlingKind.TextOnlyTransactional,t.normalizesLineEndings=!0,t.changeAnnotationSupport={groupsOnLabel:!0},t.metadataSupport=!0,t.snippetEditSupport=!0;let n=(0,Le.ensure)((0,Le.ensure)(e,"textDocument"),"publishDiagnostics");n.relatedInformation=!0,n.versionSupport=!1,n.tagSupport={valueSet:[S.DiagnosticTag.Unnecessary,S.DiagnosticTag.Deprecated]},n.codeDescriptionSupport=!0,n.dataSupport=!0;let i=(0,Le.ensure)((0,Le.ensure)(e,"textDocument"),"filters");i.relativePatternSupport=!0;let s=(0,Le.ensure)(e,"window"),o=(0,Le.ensure)(s,"showMessage");o.messageActionItem={additionalPropertiesSupport:!0};let a=(0,Le.ensure)(s,"showDocument");a.support=!0;let u=(0,Le.ensure)(e,"general");u.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(r.RequestsToCancelOnContentModified)},u.regularExpressions={engine:"ECMAScript",version:"ES2020"},u.markdown={parser:"marked",version:"1.1.0"},u.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(u.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 l of this._features)l.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let n of this._features)et.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 s={id:t.id,registerOptions:i};try{n.register(s)}catch(o){return Promise.reject(o)}}}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=this.clientOptions.middleware?.workspace?.handleApplyEdit;if(t){let n=await t(e,i=>this.doHandleApplyWorkspaceEdit(i));return n instanceof S.ResponseError?Promise.reject(n):n}else return this.doHandleApplyWorkspaceEdit(e)}workspaceEditLock=new Nr.Semaphore(1);async doHandleApplyWorkspaceEdit(e){let t=e.edit,n=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(t));return this.validateWorkspaceEdit(t)?et.asPromise(j.workspace.applyEdit(n,{isRefactoring:e.metadata?.isRefactoring}).then(s=>({applied:s}))):Promise.resolve({applied:!1})}validateWorkspaceEdit(e){let t=new Map;if(j.workspace.textDocuments.forEach(n=>t.set(n.uri.toString(),n)),e.documentChanges){for(let n of e.documentChanges)if(S.TextDocumentEdit.is(n)&&n.textDocument.version!==null&&n.textDocument.version>=0){let i=this._p2c.asUri(n.textDocument.uri).toString(),s=t.get(i);if(s&&s.version!==n.textDocument.version)return!1}}return!0}static RequestsToCancelOnContentModified=new Set([S.SemanticTokensRequest.method,S.SemanticTokensRangeRequest.method,S.SemanticTokensDeltaRequest.method]);static CancellableResolveCalls=new Set([S.CompletionResolveRequest.method,S.CodeLensResolveRequest.method,S.CodeActionResolveRequest.method,S.InlayHintResolveRequest.method,S.DocumentLinkResolveRequest.method,S.WorkspaceSymbolResolveRequest.method]);handleFailedRequest(e,t,n,i,s=!0,o=!1){if(n instanceof S.ResponseError){if(n.code===S.ErrorCodes.PendingResponseRejected||n.code===S.ErrorCodes.ConnectionInactive)return i;if(n.code===S.LSPErrorCodes.RequestCancelled||n.code===S.LSPErrorCodes.ServerCancelled){if(t!==void 0&&t.isCancellationRequested&&!o)return i;throw n.data!==void 0?new Le.LSPCancellationError(n.data):new j.CancellationError}else if(n.code===S.LSPErrorCodes.ContentModified){if(r.RequestsToCancelOnContentModified.has(e.method)||r.CancellableResolveCalls.has(e.method))throw new j.CancellationError;return i}}throw this.error(`Request ${e.method} failed.`,n,s),n}};Y.BaseLanguageClient=Ur;var sc=class extends Ur{serverOptions;constructor(e,t,n,i){super(e,t,i),this.serverOptions=n}async createMessageTransports(e){return this.serverOptions()}};Y.LanguageClient=sc;var oc=class{error(e){(0,S.RAL)().console.error(e)}warn(e){(0,S.RAL)().console.warn(e)}info(e){(0,S.RAL)().console.info(e)}log(e){(0,S.RAL)().console.log(e)}};function av(r,e,t,n,i){let s=new oc,o=(0,S.createProtocolConnection)(r,e,s,i);return o.onError(u=>{t(u[0],u[1],u[2])}),o.onClose(n),{listen:()=>o.listen(),sendRequest:o.sendRequest,onRequest:o.onRequest,hasPendingResponse:o.hasPendingResponse,sendNotification:o.sendNotification,onNotification:o.onNotification,onProgress:o.onProgress,sendProgress:o.sendProgress,trace:(u,l,h)=>{let p={sendNotification:!1,traceFormat:S.TraceFormat.Text};return h===void 0?o.trace(u,l,p):(et.boolean(h),o.trace(u,l,h))},initialize:u=>o.sendRequest(S.InitializeRequest.type,u),shutdown:()=>o.sendRequest(S.ShutdownRequest.type,void 0),exit:()=>o.sendNotification(S.ExitNotification.type),end:()=>o.end(),dispose:()=>o.dispose()}}var ac;(function(r){function e(t){return[]}r.createAll=e})(ac||(Y.ProposedFeatures=ac={}))});var Nl=M(Nt=>{"use strict";var cv=Nt&&Nt.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),uv=Nt&&Nt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),lv=Nt&&Nt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&cv(t,e,n[i]);return uv(t,e),t}})();Object.defineProperty(Nt,"__esModule",{value:!0});Nt.terminate=pv;var Ll=lv(I("child_process")),dv=process.platform==="win32",fv=process.platform==="darwin",hv=process.platform==="linux";function pv(r,e){if(dv)try{let t={stdio:["pipe","pipe","ignore"]};return e&&(t.cwd=e),Ll.execFileSync("taskkill",["/T","/F","/PID",r.pid.toString()],t),!0}catch{return!1}else if(hv||fv)try{let t=r.pid.toString();if(!/^\d+$/.test(t))return!1;let n=`
15
+ ${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this._listeners.push(L.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)}))}hookLogLevelChanged(e){this._listeners.push(this.traceOutputChannel.onDidChangeLogLevel(t=>{this._traceLogLevel=t,this.refreshTrace(e,!0)}))}refreshTrace(e,t=!1){let n=L.workspace.getConfiguration(this._id),i=this._traceLogLevel!==L.LogLevel.Trace?S.Trace.Off:S.Trace.Messages,s=S.TraceFormat.Text;if(n&&i!==S.Trace.Off){let o=n.get("trace.server","messages");typeof o=="string"?(i=S.Trace.fromString(o),i===S.Trace.Off&&(i=S.Trace.Messages)):(i=S.Trace.fromString(n.get("trace.server.verbosity","messages")),i===S.Trace.Off&&(i=S.Trace.Messages),s=S.TraceFormat.fromString(n.get("trace.server.format","text")))}this._trace=i,this._traceFormat=s,e.trace(this._trace,this._tracer,{sendNotification:t,traceFormat:this._traceFormat}).catch(o=>{this.error("Updating trace failed with error",o,!1)})}hookFileEvents(e){let t=this._clientOptions.synchronize.fileEvents;if(!t)return;let n;tt.array(t)?n=t:n=[t],n&&this._dynamicFeatures.get(S.DidChangeWatchedFilesNotification.type.method).registerRaw(Al.generateUuid(),n)}_features=[];_dynamicFeatures=new Map;registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),Oe.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(S.NotebookDocumentSyncRegistrationType.method);return t===void 0||!(t instanceof nc.NotebookDocumentSyncFeature)?!1:t.handles(e)}registerBuiltinFeatures(){let e=new Map;this.registerFeature(new jl.ConfigurationFeature(this)),this._didOpenTextDocumentFeature=new In.DidOpenTextDocumentFeature(this,this._syncedDocuments),this.registerFeature(this._didOpenTextDocumentFeature),this._didChangeTextDocumentFeature=new In.DidChangeTextDocumentFeature(this,e),this._didChangeTextDocumentFeature.onPendingChangeAdded(()=>{this.triggerPendingChangeDelivery()}),this.registerFeature(this._didChangeTextDocumentFeature),this.registerFeature(new In.WillSaveFeature(this)),this.registerFeature(new In.WillSaveWaitUntilFeature(this)),this.registerFeature(new In.DidSaveTextDocumentFeature(this)),this.registerFeature(new In.DidCloseTextDocumentFeature(this,this._syncedDocuments,e)),this.registerFeature(new av.FileSystemWatcherFeature(this,t=>this.notifyFileEvent(t))),this.registerFeature(new Em.CompletionItemFeature(this)),this.registerFeature(new qm.HoverFeature(this)),this.registerFeature(new Am.SignatureHelpFeature(this)),this.registerFeature(new Im.DefinitionFeature(this)),this.registerFeature(new Um.ReferencesFeature(this)),this.registerFeature(new jm.DocumentHighlightFeature(this)),this.registerFeature(new Lm.DocumentSymbolFeature(this)),this.registerFeature(new Nm.WorkspaceSymbolFeature(this)),this.registerFeature(new $m.CodeActionFeature(this)),this.registerFeature(new Bm.CodeLensFeature(this)),this.registerFeature(new tc.DocumentFormattingFeature(this)),this.registerFeature(new tc.DocumentRangeFormattingFeature(this)),this.registerFeature(new tc.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new zm.RenameFeature(this)),this.registerFeature(new Vm.DocumentLinkFeature(this)),this.registerFeature(new Gm.ExecuteCommandFeature(this)),this.registerFeature(new jl.SyncConfigurationFeature(this)),this.registerFeature(new Km.TypeDefinitionFeature(this)),this.registerFeature(new Hm.ImplementationFeature(this)),this.registerFeature(new Wm.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new rv.WorkspaceFoldersFeature(this)),this.registerFeature(new Jm.FoldingRangeFeature(this)),this.registerFeature(new Ym.DeclarationFeature(this)),this.registerFeature(new Qm.SelectionRangeFeature(this)),this.registerFeature(new cv.ProgressFeature(this)),this.registerFeature(new Zm.CallHierarchyFeature(this)),this.registerFeature(new Xm.SemanticTokensFeature(this)),this.registerFeature(new ev.LinkedEditingFeature(this)),this.registerFeature(new An.DidCreateFilesFeature(this)),this.registerFeature(new An.DidRenameFilesFeature(this)),this.registerFeature(new An.DidDeleteFilesFeature(this)),this.registerFeature(new An.WillCreateFilesFeature(this)),this.registerFeature(new An.WillRenameFilesFeature(this)),this.registerFeature(new An.WillDeleteFilesFeature(this)),this.registerFeature(new tv.TypeHierarchyFeature(this)),this.registerFeature(new nv.InlineValueFeature(this)),this.registerFeature(new iv.InlayHintsFeature(this)),this.registerFeature(new km.DiagnosticFeature(this)),this.registerFeature(new nc.NotebookDocumentSyncFeature(this)),this.registerFeature(new sv.InlineCompletionItemFeature(this)),this.registerFeature(new ov.TextDocumentContentFeature(this))}registerProposedFeatures(){this.registerFeatures(cc.createAll(this))}fillInitializeParams(e){for(let t of this._features)tt.func(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};(0,Oe.ensure)(e,"workspace").applyEdit=!0;let t=(0,Oe.ensure)((0,Oe.ensure)(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[S.ResourceOperationKind.Create,S.ResourceOperationKind.Rename,S.ResourceOperationKind.Delete],t.failureHandling=S.FailureHandlingKind.TextOnlyTransactional,t.normalizesLineEndings=!0,t.changeAnnotationSupport={groupsOnLabel:!0},t.metadataSupport=!0,t.snippetEditSupport=!0;let n=(0,Oe.ensure)((0,Oe.ensure)(e,"textDocument"),"publishDiagnostics");n.relatedInformation=!0,n.versionSupport=!1,n.tagSupport={valueSet:[S.DiagnosticTag.Unnecessary,S.DiagnosticTag.Deprecated]},n.codeDescriptionSupport=!0,n.dataSupport=!0;let i=(0,Oe.ensure)((0,Oe.ensure)(e,"textDocument"),"filters");i.relativePatternSupport=!0;let s=(0,Oe.ensure)(e,"window"),o=(0,Oe.ensure)(s,"showMessage");o.messageActionItem={additionalPropertiesSupport:!0};let a=(0,Oe.ensure)(s,"showDocument");a.support=!0;let u=(0,Oe.ensure)(e,"general");u.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(r.RequestsToCancelOnContentModified)},u.regularExpressions={engine:"ECMAScript",version:"ES2020"},u.markdown={parser:"marked",version:"1.1.0"},u.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(u.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 l of this._features)l.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let n of this._features)tt.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 s={id:t.id,registerOptions:i};try{n.register(s)}catch(o){return Promise.reject(o)}}}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=this.clientOptions.middleware?.workspace?.handleApplyEdit;if(t){let n=await t(e,i=>this.doHandleApplyWorkspaceEdit(i));return n instanceof S.ResponseError?Promise.reject(n):n}else return this.doHandleApplyWorkspaceEdit(e)}workspaceEditLock=new Ur.Semaphore(1);async doHandleApplyWorkspaceEdit(e){let t=e.edit,n=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(t));return this.validateWorkspaceEdit(t)?tt.asPromise(L.workspace.applyEdit(n,{isRefactoring:e.metadata?.isRefactoring}).then(s=>({applied:s}))):Promise.resolve({applied:!1})}validateWorkspaceEdit(e){let t=new Map;if(L.workspace.textDocuments.forEach(n=>t.set(n.uri.toString(),n)),e.documentChanges){for(let n of e.documentChanges)if(S.TextDocumentEdit.is(n)&&n.textDocument.version!==null&&n.textDocument.version>=0){let i=this._p2c.asUri(n.textDocument.uri).toString(),s=t.get(i);if(s&&s.version!==n.textDocument.version)return!1}}return!0}static RequestsToCancelOnContentModified=new Set([S.SemanticTokensRequest.method,S.SemanticTokensRangeRequest.method,S.SemanticTokensDeltaRequest.method]);static CancellableResolveCalls=new Set([S.CompletionResolveRequest.method,S.CodeLensResolveRequest.method,S.CodeActionResolveRequest.method,S.InlayHintResolveRequest.method,S.DocumentLinkResolveRequest.method,S.WorkspaceSymbolResolveRequest.method]);handleFailedRequest(e,t,n,i,s=!0,o=!1){if(n instanceof S.ResponseError){if(n.code===S.ErrorCodes.PendingResponseRejected||n.code===S.ErrorCodes.ConnectionInactive)return i;if(n.code===S.LSPErrorCodes.RequestCancelled||n.code===S.LSPErrorCodes.ServerCancelled){if(t!==void 0&&t.isCancellationRequested&&!o)return i;throw n.data!==void 0?new Oe.LSPCancellationError(n.data):new L.CancellationError}else if(n.code===S.LSPErrorCodes.ContentModified){if(r.RequestsToCancelOnContentModified.has(e.method)||r.CancellableResolveCalls.has(e.method))throw new L.CancellationError;return i}}throw this.error(`Request ${e.method} failed.`,n,s),n}};Q.BaseLanguageClient=Kr;var oc=class extends Kr{serverOptions;constructor(e,t,n,i){super(e,t,i),this.serverOptions=n}async createMessageTransports(e){return this.serverOptions()}};Q.LanguageClient=oc;var ac=class{error(e){(0,S.RAL)().console.error(e)}warn(e){(0,S.RAL)().console.warn(e)}info(e){(0,S.RAL)().console.info(e)}log(e){(0,S.RAL)().console.log(e)}};function uv(r,e,t,n,i){let s=new ac,o=(0,S.createProtocolConnection)(r,e,s,i);return o.onError(u=>{t(u[0],u[1],u[2])}),o.onClose(n),{listen:()=>o.listen(),sendRequest:o.sendRequest,onRequest:o.onRequest,hasPendingResponse:o.hasPendingResponse,sendNotification:o.sendNotification,onNotification:o.onNotification,onProgress:o.onProgress,sendProgress:o.sendProgress,trace:(u,l,h)=>{let p={sendNotification:!1,traceFormat:S.TraceFormat.Text};return h===void 0?o.trace(u,l,p):(tt.boolean(h),o.trace(u,l,h))},initialize:u=>o.sendRequest(S.InitializeRequest.type,u),shutdown:()=>o.sendRequest(S.ShutdownRequest.type,void 0),exit:()=>o.sendNotification(S.ExitNotification.type),end:()=>o.end(),dispose:()=>o.dispose()}}var cc;(function(r){function e(t){return[]}r.createAll=e})(cc||(Q.ProposedFeatures=cc={}))});var Kl=M(Ut=>{"use strict";var lv=Ut&&Ut.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),dv=Ut&&Ut.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),fv=Ut&&Ut.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&lv(t,e,n[i]);return dv(t,e),t}})();Object.defineProperty(Ut,"__esModule",{value:!0});Ut.terminate=mv;var Ul=fv(I("child_process")),hv=process.platform==="win32",pv=process.platform==="darwin",gv=process.platform==="linux";function mv(r,e){if(hv)try{let t={stdio:["pipe","pipe","ignore"]};return e&&(t.cwd=e),Ul.execFileSync("taskkill",["/T","/F","/PID",r.pid.toString()],t),!0}catch{return!1}else if(gv||pv)try{let t=r.pid.toString();if(!/^\d+$/.test(t))return!1;let n=`
16
16
  terminateTree() {
17
17
  for cpid in $(pgrep -P "$1"); do
18
18
  terminateTree "$cpid"
@@ -21,18 +21,18 @@ terminateTree() {
21
21
  }
22
22
 
23
23
  terminateTree "${t}"
24
- `;return!Ll.spawnSync("/bin/sh",[],{input:n,stdio:["pipe","inherit","inherit"]}).error}catch{return!1}else return r.kill("SIGKILL"),!0}});var Kl=M(Ne=>{"use strict";var gv=Ne&&Ne.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),uc=Ne&&Ne.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&gv(e,r,t)};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.DiagnosticPullMode=Ne.vsdiag=void 0;uc(N(),Ne);uc(B(),Ne);var Ul=_o();Object.defineProperty(Ne,"vsdiag",{enumerable:!0,get:function(){return Ul.vsdiag}});Object.defineProperty(Ne,"DiagnosticPullMode",{enumerable:!0,get:function(){return Ul.DiagnosticPullMode}});uc(cc(),Ne)});var Vl=M(be=>{"use strict";var Bl=be&&be.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),mv=be&&be.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Pi=be&&be.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Bl(t,e,n[i]);return mv(t,e),t}})(),zl=be&&be.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Bl(e,r,t)};Object.defineProperty(be,"__esModule",{value:!0});be.SettingMonitor=be.LanguageClient=be.TransportKind=void 0;var Ut=Pi(I("child_process")),lc=Pi(I("fs")),dc=Pi(I("path")),Hl=Pi(I("readline")),tn=I("vscode"),Nn=Pi(He()),Wl=cc(),vv=Nl(),ue=Fc(),yv=pd(),_v=gd();zl(Fc(),be);zl(Kl(),be);var $l="^1.91.0",le;(function(r){r[r.stdio=0]="stdio",r[r.ipc=1]="ipc",r[r.pipe=2]="pipe",r[r.socket=3]="socket"})(le||(be.TransportKind=le={}));var en;(function(r){function e(t){let n=t;return n&&n.kind===le.socket&&Nn.number(n.port)}r.isSocket=e})(en||(en={}));var fc;(function(r){function e(t){return Nn.string(t.command)}r.is=e})(fc||(fc={}));var hc;(function(r){function e(t){return Nn.string(t.module)}r.is=e})(hc||(hc={}));var pc;(function(r){function e(t){let n=t;return n&&n.writer!==void 0&&n.reader!==void 0}r.is=e})(pc||(pc={}));var gc;(function(r){function e(t){let n=t;return n&&n.process!==void 0&&typeof n.detached=="boolean"}r.is=e})(gc||(gc={}));var mc=class extends Wl.BaseLanguageClient{_serverOptions;_forceDebug;_serverProcess;_isDetached;_isInDebugMode;constructor(e,t,n,i,s){let o,a,u,l,h;Nn.string(t)?(o=e,a=t,u=n,l=i,h=!!s):(o=e.toLowerCase(),a=e,u=t,l=n,h=i),h===void 0&&(h=!1),super(o,a,l),this._serverOptions=u,this._forceDebug=h,this._isInDebugMode=h;try{this.checkVersion()}catch(p){throw Nn.string(p.message)&&this.outputChannel.appendLine(p.message),p}}checkVersion(){let e=yv(tn.version);if(!e)throw new Error(`No valid VS Code version detected. Version string is: ${tn.version}`);if(e.prerelease&&e.prerelease.length>0&&(e.prerelease=[]),!_v(e,$l))throw new Error(`The language client requires VS Code version ${$l} but received version ${tn.version}`)}get isInDebugMode(){return this._isInDebugMode}get serverProcess(){return this._serverProcess}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(e=>setTimeout(e,1e3)),await this.start()):await this.start()}shutdown(e,t=2e3){return super.shutdown(e,t).finally(()=>{if(this._serverProcess){let n=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(n),this._isDetached=void 0}})}checkProcessDied(e){!e||e.pid===void 0||setTimeout(()=>{try{e.pid!==void 0&&(process.kill(e.pid,0),(0,vv.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(f,m){if(!f&&!m)return;let g=Object.create(null);return Object.keys(process.env).forEach(v=>g[v]=process.env[v]),m&&(g.ELECTRON_RUN_AS_NODE="1",g.ELECTRON_NO_ASAR="1"),f&&Object.keys(f).forEach(v=>g[v]=f[v]),g}let n=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],i=["--debug","--debug-brk","--inspect","--inspect-brk"];function s(){let f=process.execArgv;return f?f.some(m=>n.some(g=>m.startsWith(g))||i.some(g=>m===g)):!1}function o(f){if(f.stdin===null||f.stdout===null||f.stderr===null)throw new Error("Process created without stdio streams")}function a(f,m){Hl.createInterface({input:f,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",g=>m.info(g))}function u(f,m){Hl.createInterface({input:f,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",g=>m.error(g))}let l=this._serverOptions;if(Nn.func(l))return l().then(f=>{if(Wl.MessageTransports.is(f))return this._isDetached=!!f.detached,f;if(pc.is(f))return this._isDetached=!!f.detached,{reader:new ue.StreamMessageReader(f.reader),writer:new ue.StreamMessageWriter(f.writer)};{let m;return gc.is(f)?(m=f.process,this._isDetached=f.detached):(m=f,this._isDetached=!1),u(m.stderr,this.outputChannel),{reader:new ue.StreamMessageReader(m.stdout),writer:new ue.StreamMessageWriter(m.stdin)}}});let h,p=l;return p.run||p.debug?this._forceDebug||s()?(h=p.debug,this._isInDebugMode=!0):(h=p.run,this._isInDebugMode=!1):h=l,this._getServerWorkingDir(h.options).then(f=>{if(hc.is(h)&&h.module){let m=h,g=m.transport||le.stdio;if(m.runtime){let v=[],_=m.options??Object.create(null);_.execArgv&&_.execArgv.forEach(F=>v.push(F)),v.push(m.module),m.args&&m.args.forEach(F=>v.push(F));let T=Object.create(null);T.cwd=f,T.env=t(_.env,!1);let C=this._getRuntimePath(m.runtime,f),D;if(g===le.ipc?(T.stdio=[null,null,null,"ipc"],v.push("--node-ipc")):g===le.stdio?v.push("--stdio"):g===le.pipe?(D=(0,ue.generateRandomPipeName)(),v.push(`--pipe=${D}`)):en.isSocket(g)&&v.push(`--socket=${g.port}`),v.push(`--clientProcessId=${process.pid.toString()}`),g===le.ipc||g===le.stdio){let F=Ut.spawn(C,v,T);return!F||!F.pid?Ln(F,`Launching server using runtime ${C} failed.`):(this._serverProcess=F,u(F.stderr,this.outputChannel),g===le.ipc?(a(F.stdout,this.outputChannel),Promise.resolve({reader:new ue.IPCMessageReader(F),writer:new ue.IPCMessageWriter(F)})):Promise.resolve({reader:new ue.StreamMessageReader(F.stdout),writer:new ue.StreamMessageWriter(F.stdin)}))}else{if(g===le.pipe)return(0,ue.createClientPipeTransport)(D).then(F=>{let E=Ut.spawn(C,v,T);return!E||!E.pid?Ln(E,`Launching server using runtime ${C} failed.`):(this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>({reader:Q[0],writer:Q[1]})))});if(en.isSocket(g))return(0,ue.createClientSocketTransport)(g.port).then(F=>{let E=Ut.spawn(C,v,T);return!E||!E.pid?Ln(E,`Launching server using runtime ${C} failed.`):(this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>({reader:Q[0],writer:Q[1]})))})}}else{let v;return new Promise((_,T)=>{let C=(m.args&&m.args.slice())??[];g===le.ipc?C.push("--node-ipc"):g===le.stdio?C.push("--stdio"):g===le.pipe?(v=(0,ue.generateRandomPipeName)(),C.push(`--pipe=${v}`)):en.isSocket(g)&&C.push(`--socket=${g.port}`),C.push(`--clientProcessId=${process.pid.toString()}`);let D=m.options?{...m.options}:Object.create(null);if(D.env=t(D.env,!0),D.execArgv=D.execArgv||[],D.cwd=f,D.silent=!0,g===le.ipc||g===le.stdio){let F=Ut.fork(m.module,C||[],D);o(F),this._serverProcess=F,u(F.stderr,this.outputChannel),g===le.ipc?(a(F.stdout,this.outputChannel),_({reader:new ue.IPCMessageReader(this._serverProcess),writer:new ue.IPCMessageWriter(this._serverProcess)})):_({reader:new ue.StreamMessageReader(F.stdout),writer:new ue.StreamMessageWriter(F.stdin)})}else g===le.pipe?(0,ue.createClientPipeTransport)(v).then(F=>{let E=Ut.fork(m.module,C||[],D);o(E),this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>{_({reader:Q[0],writer:Q[1]})},T)},T):en.isSocket(g)&&(0,ue.createClientSocketTransport)(g.port).then(F=>{let E=Ut.fork(m.module,C||[],D);o(E),this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>{_({reader:Q[0],writer:Q[1]})},T)},T)})}}else if(fc.is(h)&&h.command){let m=h,g=h.args!==void 0?h.args.slice(0):[],v,_=h.transport;if(_===le.stdio)g.push("--stdio");else if(_===le.pipe)v=(0,ue.generateRandomPipeName)(),g.push(`--pipe=${v}`);else if(en.isSocket(_))g.push(`--socket=${_.port}`);else if(_===le.ipc)throw new Error("Transport kind ipc is not support for command executable");let T=Object.assign({},m.options);if(T.cwd=T.cwd||f,_===void 0||_===le.stdio){let C=Ut.spawn(m.command,g,T);return!C||!C.pid?Ln(C,`Launching server using command ${m.command} failed.`):(u(C.stderr,this.outputChannel),this._serverProcess=C,this._isDetached=!!T.detached,Promise.resolve({reader:new ue.StreamMessageReader(C.stdout),writer:new ue.StreamMessageWriter(C.stdin)}))}else{if(_===le.pipe)return(0,ue.createClientPipeTransport)(v).then(C=>{let D=Ut.spawn(m.command,g,T);return!D||!D.pid?Ln(D,`Launching server using command ${m.command} failed.`):(this._serverProcess=D,this._isDetached=!!T.detached,u(D.stderr,this.outputChannel),a(D.stdout,this.outputChannel),C.onConnected().then(F=>({reader:F[0],writer:F[1]})))});if(en.isSocket(_))return(0,ue.createClientSocketTransport)(_.port).then(C=>{let D=Ut.spawn(m.command,g,T);return!D||!D.pid?Ln(D,`Launching server using command ${m.command} failed.`):(this._serverProcess=D,this._isDetached=!!T.detached,u(D.stderr,this.outputChannel),a(D.stdout,this.outputChannel),C.onConnected().then(F=>({reader:F[0],writer:F[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(l,null,4)))}).finally(()=>{this._serverProcess!==void 0&&this._serverProcess.on("exit",(f,m)=>{f===0?this.info("Server process exited successfully",void 0,!1):f!==null&&this.error(`Server process exited with code ${f}.`,void 0,!1),m!==null&&this.error(`Server process exited with signal ${m}.`,void 0,!1)})})}_getRuntimePath(e,t){if(dc.isAbsolute(e))return e;let n=this._mainGetRootPath();if(n!==void 0){let i=dc.join(n,e);if(lc.existsSync(i))return i}if(t!==void 0){let i=dc.join(t,e);if(lc.existsSync(i))return i}return e}_mainGetRootPath(){let e=tn.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=>{lc.lstat(t,(i,s)=>{n(!i&&s.isDirectory()?t:void 0)})}):Promise.resolve(void 0)}};be.LanguageClient=mc;var vc=class{_client;_setting;_listeners;constructor(e,t){this._client=e,this._setting=t,this._listeners=[]}start(){return tn.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new tn.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?tn.workspace.getConfiguration(t).get(n,!1):tn.workspace.getConfiguration(t);i&&this._client.needsStart()?this._client.start().catch(s=>this._client.error("Start failed after configuration change",s,"force")):!i&&this._client.needsStop()&&this._client.stop().catch(s=>this._client.error("Stop failed after configuration change",s,"force"))}};be.SettingMonitor=vc;function Ln(r,e){return r===null?Promise.reject(e):new Promise((t,n)=>{r.on("error",i=>{n(`${e} ${i}`)}),setImmediate(()=>n(e))})}});import*as H from"vscode";import*as Un from"path";import*as zr from"fs";var ys=Qn(md(),1);import*as P from"vscode";import*as Pn from"path";import{fork as yd}from"child_process";import{EventEmitter as vd}from"events";var Xn=class extends vd{buf;matchers;constructor(e,t){super(),this.buf=Buffer.alloc(0),this.matchers=t instanceof Buffer?[t]:t,e.on("close",()=>{this.emit("close")}),e.on("end",()=>{this.emit("end")}),e.on("data",n=>{for(this.buf=Buffer.concat([this.buf,n]);this.buf.length>0;){let i=this.matchers.map(o=>this.buf.indexOf(o instanceof Buffer?o:o.start)),s=i.reduce((o,a)=>o===-1?a:a===-1?o:Math.min(o,a));if(s!==-1){let o=this.matchers[i.indexOf(s)];if(o instanceof Buffer)s>0&&this.emit("segment",this.buf.subarray(0,s)),this.buf=this.buf.subarray(s+o.length);else{let a=o;s>0&&(this.emit("segment",this.buf.subarray(0,s)),this.buf=this.buf.subarray(s));let u=this.buf.indexOf(a.end,a.start.length);if(u!==-1)this.emit("segment",this.buf.subarray(a.start.length,u)),this.buf=this.buf.subarray(u+a.end.length);else return}}else return}})}};import*as ms from"vscode";var zi=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 ms.window.showInformationMessage("Key already present. Replace it?",{modal:!0},"Yes","No")==="Yes"),!e))return{from:"secrets",key:t};if(t=await ms.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 _d,tmpdir as wd}from"os";var $={valTypes:{none:"NONE",primitive:"PRIM",object:"OBJECT",array:"ARRAY"},getValType:function(r){return r&&typeof r=="object"||Array.isArray(r)?Array.isArray(r)?$.valTypes.array:typeof r=="object"?$.valTypes.object:void 0:$.valTypes.primitive},getPathType:function(r){var e=[];for(var t in r){var n=r[t];n?$.isNumber(n)?e.push($.valTypes.array):e.push($.valTypes.object):e.push($.valTypes.none)}return e},isUndefined:function(r){return r===void 0},isNumber:function(r){return!isNaN(parseFloat(r))&&isFinite(r)&&r.indexOf(".")===-1},isEmptyObj:function(r){for(var e in r)if(Object.hasOwnProperty.call(r,e))return!1;return JSON.stringify(r)===JSON.stringify({})},isNotObject:function(r){return!r||typeof r!="object"},isEmptyArray:function(r){return Array.isArray(r)&&r.length==0},isNotArray:function(r){return Array.isArray(r)==0},removeEmptyArrayItem:function(r){return r.filter(function(e){return e!=null&&e!=""})},getFieldName:function(r,e,t,n,i){return i?(e||"")+($.isNumber(r)?"["+r+"]":(t&&!e?"":".")+r):n?(e||"")+"["+r+"]":(e?e+".":"")+r},startsWith:function(r,e){return r.indexOf(e)==0},convert:function(r,e){var t={};return $.isNotObject(r)&&$.isNotArray(r)?e?(t[e]=r,t):r:$.isEmptyArray(r)?r:(function n(i,s,o){var a=Array.isArray(i);for(var u in i){var l=i[u];l&&typeof l=="object"?Array.isArray(l)?$.isEmptyArray(l)?t[$.getFieldName(u,s,o,!1,!0)]=l:t=n(l,$.getFieldName(u,s,o,!1,!0),a):a&&$.isEmptyObj(l)==0?t=n(l,$.getFieldName(u,s,o,!0)):$.isEmptyObj(l)==0?t=n(l,$.getFieldName(u,s,o)):$.isEmptyObj(l)&&(t[$.getFieldName(u,s,o,a)]=l):a||$.isNumber(u)?t[$.getFieldName(u,s,o,!0)]=l:t[$.getFieldName(u,s,o)]=l}return t})(r,e,!0)},backward:function(r,e){var t={},n=/\[(\d+)\]/g;if($.isNotObject(r)&&$.isNotArray(r))return e?r[e]:r;if($.isEmptyArray(r))return r;for(var i in r){var s=r[i];if(e){var o=new RegExp("^"+e);i=i.replace(o,"")}i=i.replace(n,".$1"),$.startsWith(i,".")&&(i=i.replace(/^\./,""));var a=i.split("."),u=$.getPathType(a);$.isUndefined(u)||u[0]!=$.valTypes.array||Array.isArray(t)!=0||(t=[]),(function l(h,p,f,m){var g=a.shift(),v=u.shift();if(g!==void 0&&g!=""){if(g=$.isNumber(g)?parseInt(g):g,a.length>0)return p[g]===void 0&&(p[g]=u[0]==$.valTypes.array?[]:{}),void l(h,p[g],g,p);v==$.valTypes.array&&f&&m?(Array.isArray(m[f])==0&&(m[f]=[]),m[f].push(h)):p[g]=h}else t=h})(s,t)}return t}};var Vi;function Cd(r){return Vi?_d()==="win32"?`${r};${P.Uri.joinPath(Vi,"bin").fsPath}`:`${r}:${P.Uri.joinPath(Vi,"bin").fsPath}`:r}async function Mc(r){if(P.workspace.workspaceFolders){let e=new zi(r.secrets);r.subscriptions.push(P.commands.registerCommand("factorio.clearApiKey",async()=>{await e.ClearApiKey()})),r.subscriptions.push(P.commands.registerCommand("factorio.setApiKey",async()=>{await e.ReadyAPIKey(!0)}));let t=P.extensions.getExtension("vscode.git");t&&!t.isActive&&await t.activate();let n=new ws(r,e,t?.exports.getAPI(1));r.subscriptions.push(n);let i=P.window.createTreeView("factoriomods",{treeDataProvider:n});r.subscriptions.push(i),Vi=r.extensionUri}}var _s=class{constructor(e,t){this.context=e;this.modPackages=t}context;modPackages;provideTasks(e){let t=[],n=nt.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())n.has(i)&&(t.push(new P.Task({label:`${i.name}.datestamp`,type:"factorio",modname:i.label,command:"datestamp"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.datestamp`,"factorio",i.DateStampTask(),[])),t.push(new P.Task({label:`${i.name}.package`,type:"factorio",modname:i.label,command:"package"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.package`,"factorio",i.PackageTask(),[])),t.push(new P.Task({label:`${i.name}.version`,type:"factorio",modname:i.label,command:"version"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.version`,"factorio",i.IncrementTask(),[])),t.push(new P.Task({label:`${i.name}.upload`,type:"factorio",modname:i.label,command:"upload"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.upload`,"factorio",i.PostToPortalTask(),[])),t.push(new P.Task({label:`${i.name}.details`,type:"factorio",modname:i.label,command:"details"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.details`,"factorio",i.DetailsTask(),[])),t.push(new P.Task({label:`${i.name}.publish`,type:"factorio",modname:i.label,command:"publish"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.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=nt.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(i.label===e.definition.modname&&n.has(i)){let s=i;switch(e.definition.command){case"run":return s.RunTask(e.definition.script,e.definition.scriptArgs);case"compile":return s.RunTask("compile");case"datestamp":return s.DateStampTask();case"package":return s.PackageTask();case"version":return s.IncrementTask();case"upload":return s.PostToPortalTask();case"details":return s.DetailsTask();case"publish":return s.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 P.Task(e.definition,e.scope||P.TaskScope.Workspace,e.name,e.source,n,[])}}ConfigErrorTask(e,t){return new P.CustomExecution(async()=>new Ge(n=>{n.write(t+`
25
- `),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 P.CustomExecution(async()=>new Ge(async n=>{await tt(n,this.getFMTKCLIPath(),t,process.cwd()),n.close()}))}},nt=class extends P.TreeItem{constructor(t,n,i,s,o,a){super(t);this.resourceUri=t;this.modinfo=n;this.keychain=i;this.context=s;this._onDidChange=o;this.gitapi=a;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 s=ys.compare(t.version,n.version,{loose:!0});return s!==0?-s*10:t.resourceUri<n.resourceUri?-1:t.resourceUri>n.resourceUri?1:0}static latestPackages(t){let n=new Map;for(let s of t)n.has(s.name)?n.get(s.name).push(s):n.set(s.name,[s]);let i=new Set;for(let s of n.values())i.add(s.reduce((o,a)=>ys.compare(o.version,a.version,{loose:!0})<0?a:o));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 s=n[i];if("refNames"in s&&s.refNames.some(u=>u.match(/^tag:/)))return`+${i}`}}}async ReloadInfo(){let n=(await P.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 P.CustomExecution(async()=>new Ge(async i=>{await tt(i,this.getFMTKCLIPath(),["run",t,...n??[]],P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}DateStampTask(){return new P.CustomExecution(async()=>new Ge(async t=>{await tt(t,this.getFMTKCLIPath(),["datestamp"],P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PackageTask(){let t=["package"];return P.workspace.getConfiguration(void 0,this.resourceUri).get("factorio.package.zipLocation","inside")==="outside"&&(t.push("--outdir"),t.push("..")),new P.CustomExecution(async()=>new Ge(async i=>{await tt(i,this.getFMTKCLIPath(),t,P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}IncrementTask(){return new P.CustomExecution(async()=>new Ge(async t=>{await tt(t,this.getFMTKCLIPath(),["version"],P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PostToPortalTask(){return new P.CustomExecution(async()=>new Ge(async t=>{await this.ReloadInfo();let n=P.workspace.getConfiguration(void 0,this.resourceUri),i=Pn.dirname(this.resourceUri.path);n.get("factorio.package.zipLocation","inside")==="outside"&&(i=Pn.dirname(i));let s=this.resourceUri.with({path:i}),a=(await P.workspace.fs.readDirectory(s)).filter(([p,f])=>f===P.FileType.File&&p.startsWith(this.name)&&p.match(/_\d+\.\d+\.\d+\.zip$/)).map(([p,f])=>p).sort().reverse(),u=await P.window.showQuickPick(a,{placeHolder:"Select Package to upload"});if(!u){t.close();return}let l=Pn.join(s.fsPath,u),h=await this.keychain.ReadyAPIKey();h&&await tt(t,this.getFMTKCLIPath(),["upload",l,this.name],P.Uri.joinPath(this.resourceUri,"..").fsPath,h.from!=="env"?{FACTORIO_UPLOAD_API_KEY:h.key}:void 0),await this.ReloadInfo(),t.close()}))}DetailsTask(){return new P.CustomExecution(async()=>new Ge(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await tt(t,this.getFMTKCLIPath(),["details"],P.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}PublishTask(){return new P.CustomExecution(async()=>new Ge(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await tt(t,this.getFMTKCLIPath(),["publish"],P.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}},ws=class{constructor(e,t,n){this.context=e;this.keychain=t;this.gitapi=n;this.modPackages=new Map,P.workspace.findFiles("**/info.json").then(s=>{s.forEach(o=>{this.updateInfoJson(o)})});let i=P.workspace.createFileSystemWatcher("**/info.json");this.subscriptions.push(i.onDidChange(s=>this.updateInfoJson(s))),this.subscriptions.push(i.onDidCreate(s=>this.updateInfoJson(s))),this.subscriptions.push(i.onDidDelete(s=>this.removeInfoJson(s))),this.subscriptions.push(i),n&&this.subscriptions.push(n.onDidOpenRepository(async s=>{for(let o of this.modPackages.values()){let a=n.getRepository(o.resourceUri);s.rootUri.toString()===a?.rootUri?.toString()&&(await o.ReloadInfo(),this.subscriptions.push(s.onDidCommit(async()=>{await o.ReloadInfo()})),this.subscriptions.push(s.onDidCheckout(async()=>{await o.ReloadInfo()})))}})),this.subscriptions.push(P.tasks.registerTaskProvider("factorio",new _s(this.context,this.modPackages))),this.subscriptions.push(P.commands.registerCommand("factorio.openchangelog",async s=>P.window.showTextDocument(P.Uri.joinPath(s.resourceUri,"../changelog.txt")))),this.subscriptions.push(P.commands.registerCommand("factorio.datestamp",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="datestamp"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.package",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="package"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.version",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="version"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.upload",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="upload"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.details",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="details"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.publish",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="publish"&&a.definition.modname===s.label);await P.tasks.executeTask(o)}))}context;keychain;gitapi;_onDidChangeTreeData=new P.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 P.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 s=new nt(e,i,this.keychain,this.context,o=>{this._onDidChangeTreeData.fire(o)},this.gitapi);this.modPackages.set(e.toString(),s),await s.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 nt){let t=[];if(this.modPackages){let n=nt.latestPackages(this.modPackages.values());n.has(e)&&this.modPackages.forEach((i,s)=>{i.label===e.label&&!n.has(i)&&(t.push(i),i.contextValue="older")})}return t.sort(nt.sort)}else return[];else{let t=[];if(this.modPackages){let n=nt.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(n.has(i)){t.push(i);let s=["latest"];try{await P.workspace.fs.stat(P.Uri.joinPath(i.resourceUri,"../changelog.txt")),s.push("haschangelog")}catch{}i.contextValue=s.join(" "),i.collapsibleState=(()=>{for(let o of this.modPackages.values())if(i.label===o.label&&!n.has(o))return P.TreeItemCollapsibleState.Collapsed;return P.TreeItemCollapsibleState.None})()}}return t.sort(nt.sort)}}},vs=P.Uri.file(Pn.join(wd(),`vscode-${process.pid}-fmtk-config.json`));async function tt(r,e,t,n,i,s){let o=P.workspace.getConfiguration("factorio");await P.workspace.fs.writeFile(vs,Buffer.from(JSON.stringify($.convert({docs:await o.get("docs"),package:await o.get("package")}))));let a=Object.assign({},process.env,i,{FMTK_CONFIG:vs.fsPath}),u=process.execArgv;for(let l of o.get("tasks.execArgvOptions",[]))switch(l){case"clear":u=[];break;case"stripjsflags":u=u.filter(h=>!h.match(/^--js-flags/));break;case"stripinspect":u=u.filter(h=>!h.match(/^--inspect/));break}return u=[...u,...o.get("tasks.execArgvExtra",[])],a.Path=Cd(a.Path??""),new Promise((l,h)=>{let p=yd(e,t,{cwd:n,execArgv:u,env:a,stdio:"pipe"});new Xn(p.stdout,Buffer.from(`
24
+ `;return!Ul.spawnSync("/bin/sh",[],{input:n,stdio:["pipe","inherit","inherit"]}).error}catch{return!1}else return r.kill("SIGKILL"),!0}});var Wl=M(Ue=>{"use strict";var vv=Ue&&Ue.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),lc=Ue&&Ue.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&vv(e,r,t)};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.DiagnosticPullMode=Ue.vsdiag=void 0;lc(N(),Ue);lc(B(),Ue);var Hl=wo();Object.defineProperty(Ue,"vsdiag",{enumerable:!0,get:function(){return Hl.vsdiag}});Object.defineProperty(Ue,"DiagnosticPullMode",{enumerable:!0,get:function(){return Hl.DiagnosticPullMode}});lc(uc(),Ue)});var Jl=M(be=>{"use strict";var Vl=be&&be.__createBinding||(Object.create?(function(r,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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),yv=be&&be.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ti=be&&be.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Vl(t,e,n[i]);return yv(t,e),t}})(),Gl=be&&be.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Vl(e,r,t)};Object.defineProperty(be,"__esModule",{value:!0});be.SettingMonitor=be.LanguageClient=be.TransportKind=void 0;var Kt=Ti(I("child_process")),dc=Ti(I("fs")),fc=Ti(I("path")),$l=Ti(I("readline")),tn=I("vscode"),Nn=Ti(We()),Bl=uc(),_v=Kl(),ue=xc(),wv=md(),Cv=vd();Gl(xc(),be);Gl(Wl(),be);var zl="^1.91.0",le;(function(r){r[r.stdio=0]="stdio",r[r.ipc=1]="ipc",r[r.pipe=2]="pipe",r[r.socket=3]="socket"})(le||(be.TransportKind=le={}));var en;(function(r){function e(t){let n=t;return n&&n.kind===le.socket&&Nn.number(n.port)}r.isSocket=e})(en||(en={}));var hc;(function(r){function e(t){return Nn.string(t.command)}r.is=e})(hc||(hc={}));var pc;(function(r){function e(t){return Nn.string(t.module)}r.is=e})(pc||(pc={}));var gc;(function(r){function e(t){let n=t;return n&&n.writer!==void 0&&n.reader!==void 0}r.is=e})(gc||(gc={}));var mc;(function(r){function e(t){let n=t;return n&&n.process!==void 0&&typeof n.detached=="boolean"}r.is=e})(mc||(mc={}));var vc=class extends Bl.BaseLanguageClient{_serverOptions;_forceDebug;_serverProcess;_isDetached;_isInDebugMode;constructor(e,t,n,i,s){let o,a,u,l,h;Nn.string(t)?(o=e,a=t,u=n,l=i,h=!!s):(o=e.toLowerCase(),a=e,u=t,l=n,h=i),h===void 0&&(h=!1),super(o,a,l),this._serverOptions=u,this._forceDebug=h,this._isInDebugMode=h;try{this.checkVersion()}catch(p){throw Nn.string(p.message)&&this.outputChannel.appendLine(p.message),p}}checkVersion(){let e=wv(tn.version);if(!e)throw new Error(`No valid VS Code version detected. Version string is: ${tn.version}`);if(e.prerelease&&e.prerelease.length>0&&(e.prerelease=[]),!Cv(e,zl))throw new Error(`The language client requires VS Code version ${zl} but received version ${tn.version}`)}get isInDebugMode(){return this._isInDebugMode}get serverProcess(){return this._serverProcess}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(e=>setTimeout(e,1e3)),await this.start()):await this.start()}shutdown(e,t=2e3){return super.shutdown(e,t).finally(()=>{if(this._serverProcess){let n=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(n),this._isDetached=void 0}})}checkProcessDied(e){!e||e.pid===void 0||setTimeout(()=>{try{e.pid!==void 0&&(process.kill(e.pid,0),(0,_v.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(f,m){if(!f&&!m)return;let g=Object.create(null);return Object.keys(process.env).forEach(v=>g[v]=process.env[v]),m&&(g.ELECTRON_RUN_AS_NODE="1",g.ELECTRON_NO_ASAR="1"),f&&Object.keys(f).forEach(v=>g[v]=f[v]),g}let n=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],i=["--debug","--debug-brk","--inspect","--inspect-brk"];function s(){let f=process.execArgv;return f?f.some(m=>n.some(g=>m.startsWith(g))||i.some(g=>m===g)):!1}function o(f){if(f.stdin===null||f.stdout===null||f.stderr===null)throw new Error("Process created without stdio streams")}function a(f,m){$l.createInterface({input:f,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",g=>m.info(g))}function u(f,m){$l.createInterface({input:f,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",g=>m.error(g))}let l=this._serverOptions;if(Nn.func(l))return l().then(f=>{if(Bl.MessageTransports.is(f))return this._isDetached=!!f.detached,f;if(gc.is(f))return this._isDetached=!!f.detached,{reader:new ue.StreamMessageReader(f.reader),writer:new ue.StreamMessageWriter(f.writer)};{let m;return mc.is(f)?(m=f.process,this._isDetached=f.detached):(m=f,this._isDetached=!1),u(m.stderr,this.outputChannel),{reader:new ue.StreamMessageReader(m.stdout),writer:new ue.StreamMessageWriter(m.stdin)}}});let h,p=l;return p.run||p.debug?this._forceDebug||s()?(h=p.debug,this._isInDebugMode=!0):(h=p.run,this._isInDebugMode=!1):h=l,this._getServerWorkingDir(h.options).then(f=>{if(pc.is(h)&&h.module){let m=h,g=m.transport||le.stdio;if(m.runtime){let v=[],_=m.options??Object.create(null);_.execArgv&&_.execArgv.forEach(F=>v.push(F)),v.push(m.module),m.args&&m.args.forEach(F=>v.push(F));let T=Object.create(null);T.cwd=f,T.env=t(_.env,!1);let C=this._getRuntimePath(m.runtime,f),D;if(g===le.ipc?(T.stdio=[null,null,null,"ipc"],v.push("--node-ipc")):g===le.stdio?v.push("--stdio"):g===le.pipe?(D=(0,ue.generateRandomPipeName)(),v.push(`--pipe=${D}`)):en.isSocket(g)&&v.push(`--socket=${g.port}`),v.push(`--clientProcessId=${process.pid.toString()}`),g===le.ipc||g===le.stdio){let F=Kt.spawn(C,v,T);return!F||!F.pid?Ln(F,`Launching server using runtime ${C} failed.`):(this._serverProcess=F,u(F.stderr,this.outputChannel),g===le.ipc?(a(F.stdout,this.outputChannel),Promise.resolve({reader:new ue.IPCMessageReader(F),writer:new ue.IPCMessageWriter(F)})):Promise.resolve({reader:new ue.StreamMessageReader(F.stdout),writer:new ue.StreamMessageWriter(F.stdin)}))}else{if(g===le.pipe)return(0,ue.createClientPipeTransport)(D).then(F=>{let E=Kt.spawn(C,v,T);return!E||!E.pid?Ln(E,`Launching server using runtime ${C} failed.`):(this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Z=>({reader:Z[0],writer:Z[1]})))});if(en.isSocket(g))return(0,ue.createClientSocketTransport)(g.port).then(F=>{let E=Kt.spawn(C,v,T);return!E||!E.pid?Ln(E,`Launching server using runtime ${C} failed.`):(this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Z=>({reader:Z[0],writer:Z[1]})))})}}else{let v;return new Promise((_,T)=>{let C=(m.args&&m.args.slice())??[];g===le.ipc?C.push("--node-ipc"):g===le.stdio?C.push("--stdio"):g===le.pipe?(v=(0,ue.generateRandomPipeName)(),C.push(`--pipe=${v}`)):en.isSocket(g)&&C.push(`--socket=${g.port}`),C.push(`--clientProcessId=${process.pid.toString()}`);let D=m.options?{...m.options}:Object.create(null);if(D.env=t(D.env,!0),D.execArgv=D.execArgv||[],D.cwd=f,D.silent=!0,g===le.ipc||g===le.stdio){let F=Kt.fork(m.module,C||[],D);o(F),this._serverProcess=F,u(F.stderr,this.outputChannel),g===le.ipc?(a(F.stdout,this.outputChannel),_({reader:new ue.IPCMessageReader(this._serverProcess),writer:new ue.IPCMessageWriter(this._serverProcess)})):_({reader:new ue.StreamMessageReader(F.stdout),writer:new ue.StreamMessageWriter(F.stdin)})}else g===le.pipe?(0,ue.createClientPipeTransport)(v).then(F=>{let E=Kt.fork(m.module,C||[],D);o(E),this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Z=>{_({reader:Z[0],writer:Z[1]})},T)},T):en.isSocket(g)&&(0,ue.createClientSocketTransport)(g.port).then(F=>{let E=Kt.fork(m.module,C||[],D);o(E),this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Z=>{_({reader:Z[0],writer:Z[1]})},T)},T)})}}else if(hc.is(h)&&h.command){let m=h,g=h.args!==void 0?h.args.slice(0):[],v,_=h.transport;if(_===le.stdio)g.push("--stdio");else if(_===le.pipe)v=(0,ue.generateRandomPipeName)(),g.push(`--pipe=${v}`);else if(en.isSocket(_))g.push(`--socket=${_.port}`);else if(_===le.ipc)throw new Error("Transport kind ipc is not support for command executable");let T=Object.assign({},m.options);if(T.cwd=T.cwd||f,_===void 0||_===le.stdio){let C=Kt.spawn(m.command,g,T);return!C||!C.pid?Ln(C,`Launching server using command ${m.command} failed.`):(u(C.stderr,this.outputChannel),this._serverProcess=C,this._isDetached=!!T.detached,Promise.resolve({reader:new ue.StreamMessageReader(C.stdout),writer:new ue.StreamMessageWriter(C.stdin)}))}else{if(_===le.pipe)return(0,ue.createClientPipeTransport)(v).then(C=>{let D=Kt.spawn(m.command,g,T);return!D||!D.pid?Ln(D,`Launching server using command ${m.command} failed.`):(this._serverProcess=D,this._isDetached=!!T.detached,u(D.stderr,this.outputChannel),a(D.stdout,this.outputChannel),C.onConnected().then(F=>({reader:F[0],writer:F[1]})))});if(en.isSocket(_))return(0,ue.createClientSocketTransport)(_.port).then(C=>{let D=Kt.spawn(m.command,g,T);return!D||!D.pid?Ln(D,`Launching server using command ${m.command} failed.`):(this._serverProcess=D,this._isDetached=!!T.detached,u(D.stderr,this.outputChannel),a(D.stdout,this.outputChannel),C.onConnected().then(F=>({reader:F[0],writer:F[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(l,null,4)))}).finally(()=>{this._serverProcess!==void 0&&this._serverProcess.on("exit",(f,m)=>{f===0?this.info("Server process exited successfully",void 0,!1):f!==null&&this.error(`Server process exited with code ${f}.`,void 0,!1),m!==null&&this.error(`Server process exited with signal ${m}.`,void 0,!1)})})}_getRuntimePath(e,t){if(fc.isAbsolute(e))return e;let n=this._mainGetRootPath();if(n!==void 0){let i=fc.join(n,e);if(dc.existsSync(i))return i}if(t!==void 0){let i=fc.join(t,e);if(dc.existsSync(i))return i}return e}_mainGetRootPath(){let e=tn.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=>{dc.lstat(t,(i,s)=>{n(!i&&s.isDirectory()?t:void 0)})}):Promise.resolve(void 0)}};be.LanguageClient=vc;var yc=class{_client;_setting;_listeners;constructor(e,t){this._client=e,this._setting=t,this._listeners=[]}start(){return tn.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new tn.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?tn.workspace.getConfiguration(t).get(n,!1):tn.workspace.getConfiguration(t);i&&this._client.needsStart()?this._client.start().catch(s=>this._client.error("Start failed after configuration change",s,"force")):!i&&this._client.needsStop()&&this._client.stop().catch(s=>this._client.error("Stop failed after configuration change",s,"force"))}};be.SettingMonitor=yc;function Ln(r,e){return r===null?Promise.reject(e):new Promise((t,n)=>{r.on("error",i=>{n(`${e} ${i}`)}),setImmediate(()=>n(e))})}});import*as H from"vscode";import*as Un from"path";import*as Vr from"fs";var _s=Qn(yd(),1);import*as P from"vscode";import*as Pn from"path";import{fork as wd}from"child_process";import{EventEmitter as _d}from"events";var Xn=class extends _d{buf;matchers;constructor(e,t){super(),this.buf=Buffer.alloc(0),this.matchers=t instanceof Buffer?[t]:t,e.on("close",()=>{this.emit("close")}),e.on("end",()=>{this.emit("end")}),e.on("data",n=>{for(this.buf=Buffer.concat([this.buf,n]);this.buf.length>0;){let i=this.matchers.map(o=>this.buf.indexOf(o instanceof Buffer?o:o.start)),s=i.reduce((o,a)=>o===-1?a:a===-1?o:Math.min(o,a));if(s!==-1){let o=this.matchers[i.indexOf(s)];if(o instanceof Buffer)s>0&&this.emit("segment",this.buf.subarray(0,s)),this.buf=this.buf.subarray(s+o.length);else{let a=o;s>0&&(this.emit("segment",this.buf.subarray(0,s)),this.buf=this.buf.subarray(s));let u=this.buf.indexOf(a.end,a.start.length);if(u!==-1)this.emit("segment",this.buf.subarray(a.start.length,u)),this.buf=this.buf.subarray(u+a.end.length);else return}}else return}})}};import*as vs from"vscode";var Vi=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 vs.window.showInformationMessage("Key already present. Replace it?",{modal:!0},"Yes","No")==="Yes"),!e))return{from:"secrets",key:t};if(t=await vs.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 Cd,tmpdir as bd}from"os";var $={valTypes:{none:"NONE",primitive:"PRIM",object:"OBJECT",array:"ARRAY"},getValType:function(r){return r&&typeof r=="object"||Array.isArray(r)?Array.isArray(r)?$.valTypes.array:typeof r=="object"?$.valTypes.object:void 0:$.valTypes.primitive},getPathType:function(r){var e=[];for(var t in r){var n=r[t];n?$.isNumber(n)?e.push($.valTypes.array):e.push($.valTypes.object):e.push($.valTypes.none)}return e},isUndefined:function(r){return r===void 0},isNumber:function(r){return!isNaN(parseFloat(r))&&isFinite(r)&&r.indexOf(".")===-1},isEmptyObj:function(r){for(var e in r)if(Object.hasOwnProperty.call(r,e))return!1;return JSON.stringify(r)===JSON.stringify({})},isNotObject:function(r){return!r||typeof r!="object"},isEmptyArray:function(r){return Array.isArray(r)&&r.length==0},isNotArray:function(r){return Array.isArray(r)==0},removeEmptyArrayItem:function(r){return r.filter(function(e){return e!=null&&e!=""})},getFieldName:function(r,e,t,n,i){return i?(e||"")+($.isNumber(r)?"["+r+"]":(t&&!e?"":".")+r):n?(e||"")+"["+r+"]":(e?e+".":"")+r},startsWith:function(r,e){return r.indexOf(e)==0},convert:function(r,e){var t={};return $.isNotObject(r)&&$.isNotArray(r)?e?(t[e]=r,t):r:$.isEmptyArray(r)?r:(function n(i,s,o){var a=Array.isArray(i);for(var u in i){var l=i[u];l&&typeof l=="object"?Array.isArray(l)?$.isEmptyArray(l)?t[$.getFieldName(u,s,o,!1,!0)]=l:t=n(l,$.getFieldName(u,s,o,!1,!0),a):a&&$.isEmptyObj(l)==0?t=n(l,$.getFieldName(u,s,o,!0)):$.isEmptyObj(l)==0?t=n(l,$.getFieldName(u,s,o)):$.isEmptyObj(l)&&(t[$.getFieldName(u,s,o,a)]=l):a||$.isNumber(u)?t[$.getFieldName(u,s,o,!0)]=l:t[$.getFieldName(u,s,o)]=l}return t})(r,e,!0)},backward:function(r,e){var t={},n=/\[(\d+)\]/g;if($.isNotObject(r)&&$.isNotArray(r))return e?r[e]:r;if($.isEmptyArray(r))return r;for(var i in r){var s=r[i];if(e){var o=new RegExp("^"+e);i=i.replace(o,"")}i=i.replace(n,".$1"),$.startsWith(i,".")&&(i=i.replace(/^\./,""));var a=i.split("."),u=$.getPathType(a);$.isUndefined(u)||u[0]!=$.valTypes.array||Array.isArray(t)!=0||(t=[]),(function l(h,p,f,m){var g=a.shift(),v=u.shift();if(g!==void 0&&g!=""){if(g=$.isNumber(g)?parseInt(g):g,a.length>0)return p[g]===void 0&&(p[g]=u[0]==$.valTypes.array?[]:{}),void l(h,p[g],g,p);v==$.valTypes.array&&f&&m?(Array.isArray(m[f])==0&&(m[f]=[]),m[f].push(h)):p[g]=h}else t=h})(s,t)}return t}};var Gi;function Sd(r){return Gi?Cd()==="win32"?`${r};${P.Uri.joinPath(Gi,"bin").fsPath}`:`${r}:${P.Uri.joinPath(Gi,"bin").fsPath}`:r}async function kc(r){if(P.workspace.workspaceFolders){let e=new Vi(r.secrets);r.subscriptions.push(P.commands.registerCommand("factorio.clearApiKey",async()=>{await e.ClearApiKey()})),r.subscriptions.push(P.commands.registerCommand("factorio.setApiKey",async()=>{await e.ReadyAPIKey(!0)}));let t=P.extensions.getExtension("vscode.git");t&&!t.isActive&&await t.activate();let n=new Cs(r,e,t?.exports.getAPI(1));r.subscriptions.push(n);let i=P.window.createTreeView("factoriomods",{treeDataProvider:n});r.subscriptions.push(i),Gi=r.extensionUri}}var ws=class{constructor(e,t){this.context=e;this.modPackages=t}context;modPackages;provideTasks(e){let t=[],n=it.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())n.has(i)&&(t.push(new P.Task({label:`${i.name}.datestamp`,type:"factorio",modname:i.label,command:"datestamp"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.datestamp`,"factorio",i.DateStampTask(),[])),t.push(new P.Task({label:`${i.name}.package`,type:"factorio",modname:i.label,command:"package"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.package`,"factorio",i.PackageTask(),[])),t.push(new P.Task({label:`${i.name}.version`,type:"factorio",modname:i.label,command:"version"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.version`,"factorio",i.IncrementTask(),[])),t.push(new P.Task({label:`${i.name}.upload`,type:"factorio",modname:i.label,command:"upload"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.upload`,"factorio",i.PostToPortalTask(),[])),t.push(new P.Task({label:`${i.name}.details`,type:"factorio",modname:i.label,command:"details"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.details`,"factorio",i.DetailsTask(),[])),t.push(new P.Task({label:`${i.name}.publish`,type:"factorio",modname:i.label,command:"publish"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.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=it.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(i.label===e.definition.modname&&n.has(i)){let s=i;switch(e.definition.command){case"run":return s.RunTask(e.definition.script,e.definition.scriptArgs);case"compile":return s.RunTask("compile");case"datestamp":return s.DateStampTask();case"package":return s.PackageTask();case"version":return s.IncrementTask();case"upload":return s.PostToPortalTask();case"details":return s.DetailsTask();case"publish":return s.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 P.Task(e.definition,e.scope||P.TaskScope.Workspace,e.name,e.source,n,[])}}ConfigErrorTask(e,t){return new P.CustomExecution(async()=>new Ge(n=>{n.write(t+`
25
+ `),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 P.CustomExecution(async()=>new Ge(async n=>{await nt(n,this.getFMTKCLIPath(),t,process.cwd()),n.close()}))}},it=class extends P.TreeItem{constructor(t,n,i,s,o,a){super(t);this.resourceUri=t;this.modinfo=n;this.keychain=i;this.context=s;this._onDidChange=o;this.gitapi=a;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 s=_s.compare(t.version,n.version,{loose:!0});return s!==0?-s*10:t.resourceUri<n.resourceUri?-1:t.resourceUri>n.resourceUri?1:0}static latestPackages(t){let n=new Map;for(let s of t)n.has(s.name)?n.get(s.name).push(s):n.set(s.name,[s]);let i=new Set;for(let s of n.values())i.add(s.reduce((o,a)=>_s.compare(o.version,a.version,{loose:!0})<0?a:o));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 s=n[i];if("refNames"in s&&s.refNames.some(u=>u.match(/^tag:/)))return`+${i}`}}}async ReloadInfo(){let n=(await P.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 P.CustomExecution(async()=>new Ge(async i=>{await nt(i,this.getFMTKCLIPath(),["run",t,...n??[]],P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}DateStampTask(){return new P.CustomExecution(async()=>new Ge(async t=>{await nt(t,this.getFMTKCLIPath(),["datestamp"],P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PackageTask(){let t=["package"];return P.workspace.getConfiguration(void 0,this.resourceUri).get("factorio.package.zipLocation","inside")==="outside"&&(t.push("--outdir"),t.push("..")),new P.CustomExecution(async()=>new Ge(async i=>{await nt(i,this.getFMTKCLIPath(),t,P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}IncrementTask(){return new P.CustomExecution(async()=>new Ge(async t=>{await nt(t,this.getFMTKCLIPath(),["version"],P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PostToPortalTask(){return new P.CustomExecution(async()=>new Ge(async t=>{await this.ReloadInfo();let n=P.workspace.getConfiguration(void 0,this.resourceUri),i=Pn.dirname(this.resourceUri.path);n.get("factorio.package.zipLocation","inside")==="outside"&&(i=Pn.dirname(i));let s=this.resourceUri.with({path:i}),a=(await P.workspace.fs.readDirectory(s)).filter(([p,f])=>f===P.FileType.File&&p.startsWith(this.name)&&p.match(/_\d+\.\d+\.\d+\.zip$/)).map(([p,f])=>p).sort().reverse(),u=await P.window.showQuickPick(a,{placeHolder:"Select Package to upload"});if(!u){t.close();return}let l=Pn.join(s.fsPath,u),h=await this.keychain.ReadyAPIKey();h&&await nt(t,this.getFMTKCLIPath(),["upload",l,this.name],P.Uri.joinPath(this.resourceUri,"..").fsPath,h.from!=="env"?{FACTORIO_UPLOAD_API_KEY:h.key}:void 0),await this.ReloadInfo(),t.close()}))}DetailsTask(){return new P.CustomExecution(async()=>new Ge(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await nt(t,this.getFMTKCLIPath(),["details"],P.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}PublishTask(){return new P.CustomExecution(async()=>new Ge(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await nt(t,this.getFMTKCLIPath(),["publish"],P.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}},Cs=class{constructor(e,t,n){this.context=e;this.keychain=t;this.gitapi=n;this.modPackages=new Map,P.workspace.findFiles("**/info.json").then(s=>{s.forEach(o=>{this.updateInfoJson(o)})});let i=P.workspace.createFileSystemWatcher("**/info.json");this.subscriptions.push(i.onDidChange(s=>this.updateInfoJson(s))),this.subscriptions.push(i.onDidCreate(s=>this.updateInfoJson(s))),this.subscriptions.push(i.onDidDelete(s=>this.removeInfoJson(s))),this.subscriptions.push(i),n&&this.subscriptions.push(n.onDidOpenRepository(async s=>{for(let o of this.modPackages.values()){let a=n.getRepository(o.resourceUri);s.rootUri.toString()===a?.rootUri?.toString()&&(await o.ReloadInfo(),this.subscriptions.push(s.onDidCommit(async()=>{await o.ReloadInfo()})),this.subscriptions.push(s.onDidCheckout(async()=>{await o.ReloadInfo()})))}})),this.subscriptions.push(P.tasks.registerTaskProvider("factorio",new ws(this.context,this.modPackages))),this.subscriptions.push(P.commands.registerCommand("factorio.openchangelog",async s=>P.window.showTextDocument(P.Uri.joinPath(s.resourceUri,"../changelog.txt")))),this.subscriptions.push(P.commands.registerCommand("factorio.datestamp",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="datestamp"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.package",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="package"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.version",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="version"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.upload",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="upload"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.details",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="details"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.publish",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="publish"&&a.definition.modname===s.label);await P.tasks.executeTask(o)}))}context;keychain;gitapi;_onDidChangeTreeData=new P.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 P.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 s=new it(e,i,this.keychain,this.context,o=>{this._onDidChangeTreeData.fire(o)},this.gitapi);this.modPackages.set(e.toString(),s),await s.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 it){let t=[];if(this.modPackages){let n=it.latestPackages(this.modPackages.values());n.has(e)&&this.modPackages.forEach((i,s)=>{i.label===e.label&&!n.has(i)&&(t.push(i),i.contextValue="older")})}return t.sort(it.sort)}else return[];else{let t=[];if(this.modPackages){let n=it.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(n.has(i)){t.push(i);let s=["latest"];try{await P.workspace.fs.stat(P.Uri.joinPath(i.resourceUri,"../changelog.txt")),s.push("haschangelog")}catch{}i.contextValue=s.join(" "),i.collapsibleState=(()=>{for(let o of this.modPackages.values())if(i.label===o.label&&!n.has(o))return P.TreeItemCollapsibleState.Collapsed;return P.TreeItemCollapsibleState.None})()}}return t.sort(it.sort)}}},ys=P.Uri.file(Pn.join(bd(),`vscode-${process.pid}-fmtk-config.json`));async function nt(r,e,t,n,i,s){let o=P.workspace.getConfiguration("factorio");await P.workspace.fs.writeFile(ys,Buffer.from(JSON.stringify($.convert({docs:await o.get("docs"),package:await o.get("package")}))));let a=Object.assign({},process.env,i,{FMTK_CONFIG:ys.fsPath}),u=process.execArgv;for(let l of o.get("tasks.execArgvOptions",[]))switch(l){case"clear":u=[];break;case"stripjsflags":u=u.filter(h=>!h.match(/^--js-flags/));break;case"stripinspect":u=u.filter(h=>!h.match(/^--inspect/));break}return u=[...u,...o.get("tasks.execArgvExtra",[])],a.Path=Sd(a.Path??""),new Promise((l,h)=>{let p=wd(e,t,{cwd:n,execArgv:u,env:a,stdio:"pipe"});new Xn(p.stdout,Buffer.from(`
26
26
  `)).on("segment",g=>{r.write(g.toString()+`\r
27
27
  `)}),new Xn(p.stderr,Buffer.from(`
28
28
  `)).on("segment",g=>{g.toString().match(/^Debugger listening/)&&console.log(g.toString()),r.write(g.toString()+`\r
29
29
  `)}),p.on("error",g=>{r.write(`${g.message}\r
30
- `)}),p.on("exit",(g,v)=>{P.workspace.fs.delete(vs),l(g??-1)}),s&&p.stdin.write(s),p.stdin.end()})}var Ge=class{constructor(e){this.runner=e}runner;writeEmitter=new P.EventEmitter;onDidWrite=this.writeEmitter.event;closeEmitter=new P.EventEmitter;onDidClose=this.closeEmitter.event;tokensource=new P.CancellationTokenSource;open(e){let t=this.writeEmitter,n=this.closeEmitter,i=this.runner({write:s=>t.fire(s.replace(/\r?\n/g,`\r
31
- `)),close:()=>n.fire()},this.tokensource.token);i?i.finally(()=>{n.fire()}):n.fire()}close(){this.tokensource.cancel()}};import*as q from"vscode";import*as Ts from"os";import*as jc from"path";var ei=Qn(Ac(),1);import*as Ie from"os";import*as G from"path";import{execFile as bd}from"child_process";function sn(r,e){return r.match(/^~[\\\/]/)&&(r=G.posix.join(Ie.homedir().replace(/\\/g,"/"),r.replace(/^~[\\\/]/,""))),r=r.replace("${userHome}",Ie.homedir()),e?.[0]&&(r=r.replace("${workspaceFolder}",e[0].uri.fsPath)),r=r.replace(/\$\{env:(\w+)}/g,(t,n)=>process.env[n]??t),r}var ti=class{constructor(e,t,n,i){this.fs=e;this.fv=t;this.docs=n;this.workspaceFolders=i}fs;fv;docs;workspaceFolders;async getBinaryVersion(){return new Promise((e,t)=>{bd(this.factorioPath,["--version"],{env:Object.assign({},process.env,{SteamAppId:"427520"})},(n,i,s)=>{n&&t(new Error(n.message));let o=i?.match(/^Version: ([0-9\.]+) /m);o&&e(o[1]),t(new Error(`Unable to read version:
30
+ `)}),p.on("exit",(g,v)=>{P.workspace.fs.delete(ys),l(g??-1)}),s&&p.stdin.write(s),p.stdin.end()})}var Ge=class{constructor(e){this.runner=e}runner;writeEmitter=new P.EventEmitter;onDidWrite=this.writeEmitter.event;closeEmitter=new P.EventEmitter;onDidClose=this.closeEmitter.event;tokensource=new P.CancellationTokenSource;open(e){let t=this.writeEmitter,n=this.closeEmitter,i=this.runner({write:s=>t.fire(s.replace(/\r?\n/g,`\r
31
+ `)),close:()=>n.fire()},this.tokensource.token);i?i.finally(()=>{n.fire()}):n.fire()}close(){this.tokensource.cancel()}};import*as q from"vscode";import*as Os from"os";import*as Lc from"path";var ei=Qn(jc(),1);import*as Ae from"os";import*as G from"path";import{execFile as Dd}from"child_process";function an(r,e){return r.match(/^~[\\\/]/)&&(r=G.posix.join(Ae.homedir().replace(/\\/g,"/"),r.replace(/^~[\\\/]/,""))),r=r.replace("${userHome}",Ae.homedir()),e?.[0]&&(r=r.replace("${workspaceFolder}",e[0].uri.fsPath)),r=r.replace(/\$\{env:(\w+)}/g,(t,n)=>process.env[n]??t),r}var ti=class{constructor(e,t,n,i){this.fs=e;this.fv=t;this.docs=n;this.workspaceFolders=i}fs;fv;docs;workspaceFolders;async getBinaryVersion(){return new Promise((e,t)=>{Dd(this.factorioPath,["--version"],{env:Object.assign({},process.env,{SteamAppId:"427520"})},(n,i,s)=>{n&&t(new Error(n.message));let o=i?.match(/^Version: ([0-9\.]+) /m);o&&e(o[1]),t(new Error(`Unable to read version:
32
32
  stdout: ${i}
33
- stderr: ${s}`))})})}get name(){return this.fv.name}get onlineOnly(){return!this.fv.factorioPath}get factorioPath(){if(!this.fv.factorioPath)throw new Error("No factorioPath");return sn(this.fv.factorioPath,this.workspaceFolders)}get isLocal(){return!!this.fv.factorioPath}async docArgs(e){let t=["luals-addon"];if(this.fv.onlineDocs?t.push("-o",this.fv.onlineDocs===!0?"latest":this.fv.onlineDocs):t.push("-d",this.docsPath,"-p",this.protosPath),e&&this.isLocal){try{let n=G.join(await this.scriptOutputPath(),"mod-settings-dump.json");await this.fs.stat(Oe.file(n)),t.push("--sdump",n)}catch{}try{let n=G.join(await this.scriptOutputPath(),"data-raw-dump.json");await this.fs.stat(Oe.file(n)),t.push("--pdump",n)}catch{}}return t}get docsPath(){return G.join(this.factorioPath,this.fv.docsPath?this.fv.docsPath:Ie.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json")}get protosPath(){return G.join(this.factorioPath,this.fv.protosPath?this.fv.protosPath:this.fv.docsPath?G.join(this.fv.docsPath,"../prototype-api.json"):Ie.platform()==="darwin"?"../../doc-html/prototype-api.json":"../../../doc-html/prototype-api.json")}configPathIsOverriden(){return!!this.fv.configPath}async configPath(){if(this.fv.configPath)return sn(this.fv.configPath,this.workspaceFolders);let e=G.resolve(G.dirname(this.factorioPath),"../../config-path.cfg");try{let t=ei.parse((await this.fs.readFile(Oe.file(e))).toString());return G.resolve(this.translatePath(t["config-path"]),"./config.ini")}catch{}return this.translatePath("__PATH__system-write-data__/config/config.ini")}iniData;async configIni(){return this.iniData||(this.iniData=this.fs.readFile(Oe.file(await this.configPath())).then(e=>ei.parse(e.toString()))),this.iniData}async isPrototypeCacheEnabled(){try{return(await this.configIni()).other?.["cache-prototype-data"]}catch{return}}async disablePrototypeCache(){this.iniData=void 0;let e=Oe.file(await this.configPath()),t=(await this.fs.readFile(e)).toString();t=t.replace("cache-prototype-data=","; cache-prototype-data="),await this.fs.writeFile(e,Buffer.from(t)),this.iniData=ei.parse(t)}async isMouseAutoCaptureDisabled(){try{return(await this.configIni()).other?.["disable-mouse-auto-capture"]}catch{return}}async disableMouseAutoCapture(){this.iniData=void 0;let e=Oe.file(await this.configPath()),t=(await this.fs.readFile(e)).toString(),n=t.match(/^;? *disable-mouse-auto-capture=.*$/m);if(n)t=t.slice(0,n.index)+`
33
+ stderr: ${s}`))})})}get name(){return this.fv.name}get onlineOnly(){return!this.fv.factorioPath}get factorioPath(){if(!this.fv.factorioPath)throw new Error("No factorioPath");return an(this.fv.factorioPath,this.workspaceFolders)}get isLocal(){return!!this.fv.factorioPath}async docArgs(e){let t=["luals-addon"];if(this.fv.onlineDocs?t.push("-o",this.fv.onlineDocs===!0?"latest":this.fv.onlineDocs):t.push("-d",this.docsPath,"-p",this.protosPath),e&&this.isLocal){try{let n=G.join(await this.scriptOutputPath(),"mod-settings-dump.json");await this.fs.stat(Re.file(n)),t.push("--sdump",n)}catch{}try{let n=G.join(await this.scriptOutputPath(),"data-raw-dump.json");await this.fs.stat(Re.file(n)),t.push("--pdump",n)}catch{}}return t}get docsPath(){return G.join(this.factorioPath,this.fv.docsPath?this.fv.docsPath:Ae.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json")}get protosPath(){return G.join(this.factorioPath,this.fv.protosPath?this.fv.protosPath:this.fv.docsPath?G.join(this.fv.docsPath,"../prototype-api.json"):Ae.platform()==="darwin"?"../../doc-html/prototype-api.json":"../../../doc-html/prototype-api.json")}configPathIsOverriden(){return!!this.fv.configPath}async configPath(){if(this.fv.configPath)return an(this.fv.configPath,this.workspaceFolders);let e=G.resolve(G.dirname(this.factorioPath),"../../config-path.cfg");try{let t=ei.parse((await this.fs.readFile(Re.file(e))).toString());return G.resolve(this.translatePath(t["config-path"]),"./config.ini")}catch{}return this.translatePath("__PATH__system-write-data__/config/config.ini")}iniData;async configIni(){return this.iniData||(this.iniData=this.fs.readFile(Re.file(await this.configPath())).then(e=>ei.parse(e.toString()))),this.iniData}async isPrototypeCacheEnabled(){try{return(await this.configIni()).other?.["cache-prototype-data"]}catch{return}}async disablePrototypeCache(){this.iniData=void 0;let e=Re.file(await this.configPath()),t=(await this.fs.readFile(e)).toString();t=t.replace("cache-prototype-data=","; cache-prototype-data="),await this.fs.writeFile(e,Buffer.from(t)),this.iniData=ei.parse(t)}async isMouseAutoCaptureDisabled(){try{return(await this.configIni()).other?.["disable-mouse-auto-capture"]}catch{return}}async disableMouseAutoCapture(){this.iniData=void 0;let e=Re.file(await this.configPath()),t=(await this.fs.readFile(e)).toString(),n=t.match(/^;? *disable-mouse-auto-capture=.*$/m);if(n)t=t.slice(0,n.index)+`
34
34
  disable-mouse-auto-capture=true
35
35
  `+t.slice(n.index+n[0].length);else{let i=t.match(/^\[other\]$/m);t=t.slice(0,i.index+i[0].length)+`
36
36
  disable-mouse-auto-capture=true
37
- `+t.slice(i.index+i[0].length)}await this.fs.writeFile(e,Buffer.from(t)),this.iniData=ei.parse(t)}async defaultModsPath(){let e=(await this.configIni())?.path?.["write-data"];if(!e)throw new Error("path.write-data missing in config.ini");return G.posix.normalize(G.resolve(this.translatePath(e),"mods"))}async dataPath(){let e=(await this.configIni().catch(()=>({path:{"read-data":"__PATH__executable__/../../data"}}))).path?.["read-data"];if(!e)throw new Error("path.read-data missing in config.ini");return G.posix.normalize(this.translatePath(e))}async lualibPath(){return G.posix.normalize(G.resolve(await this.dataPath(),"core","lualib"))}async writeDataPath(){let e=(await this.configIni()).path?.["write-data"];if(!e)throw new Error("path.write-data missing in config.ini");return G.posix.normalize(this.translatePath(e))}async scriptOutputPath(){return G.posix.join(await this.writeDataPath(),"script-output")}translatePath(e){if(e.startsWith("__PATH__executable__"))return G.join(G.dirname(this.factorioPath),e.replace("__PATH__executable__",""));if(e.startsWith("__PATH__system-write-data__")){let t=Ie.platform()==="win32"?G.resolve(process.env.APPDATA,"Factorio"):Ie.platform()==="linux"?G.resolve(Ie.homedir(),".factorio"):Ie.platform()==="darwin"?G.resolve(Ie.homedir(),"Library/Application Support/factorio"):"??";return G.join(t,e.replace("__PATH__system-write-data__",""))}if(e.startsWith("__PATH__system-read-data__")){let t=Ie.platform()==="linux"?"/usr/share/factorio":Ie.platform()==="darwin"?G.resolve(G.dirname(this.factorioPath),"../data"):G.resolve(G.dirname(this.factorioPath),"../../data");return G.join(t,e.replace("__PATH__system-read-data__",""))}return e}is(e){let t=this.fv;return t.name===e.name&&t.factorioPath===e.factorioPath&&t.configPath===e.configPath&&t.onlineDocs===e.onlineDocs&&t.docsPath===e.docsPath&&t.protosPath===e.protosPath}};var Re=q.workspace.fs,Sd=[{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"}],Ss={name:"Online Latest",onlineDocs:!0},Ds={name:"Online Stable",onlineDocs:"stable"},Ps=["tangzx.emmylua","xuhuanzy.emmylua-luals","theo.emmylua"],Ji=class{constructor(e,t,n){this.context=e;this.output=t;this.fsprovider=n;this.bar=q.window.createStatusBarItem("factorio-version",q.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(q.commands.registerCommand("factorio.selectVersion",()=>this.selectVersionCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.checkConfig",()=>this.checkConfigCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.disablePrototypeCache",()=>this.disablePrototypeCacheCommand())),e.subscriptions.push(q.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=q.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 ti(q.workspace.fs,e,t,q.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(i=>i.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: ${q.workspace.isTrusted}`),q.workspace.workspaceFolders?.forEach(i=>this.output.info(`Workspace folder: ${i.uri.toString()}`));let t=q.workspace.getConfiguration("factorio");this.output.info(`execArgv: ${JSON.stringify(process.execArgv)}`),this.output.info(`execArgvOptions: ${JSON.stringify(t.get("tasks.execArgvOptions",[]))}`),this.output.info(`execArgvExtras: ${JSON.stringify(t.get("tasks.execArgvExtras",[]))}`);let n=q.extensions.getExtension("sumneko.lua");n?await this.checkLuaLSConfig(n,e,t):this.output.info("LuaLS (sumneko.lua) not present");for(let i of Ps){let s=q.extensions.getExtension(i);s?await this.checkEmmyLuaConfig(s,e,t):this.output.info(`EmmyLua (${i}) not present`)}}async checkEmmyLuaConfig(e,t,n){this.output.info(`EmmyLua (${e.id}) ${e.packageJSON.version} ${e.isActive?"Activated":"Not Yet Activated"}`);let i=this.context.storageUri;if(!i){this.output.error("No Workspace");return}try{let s=(await Re.readFile(_e.joinPath(i,"emmylua/factorio/config.json"))).toString(),o=JSON.parse(s);this.output.info(`Library bundle found in ${i.fsPath}, generated from Factorio ${o.factorioVersion} with FMTK ${o.bundleVersion}`);for(let a of gs())try{(await Re.readFile(_e.joinPath(i,"emmylua",a.name))).toString()!==a.content&&this.output.info(`file ${a.name} content mismatch!`)}catch(u){this.output.error(`file ${a.name} ${u}`)}}catch(s){this.output.error(`Missing or damaged library bundle info ${s}`)}}async checkLuaLSConfig(e,t,n){this.output.info(`LuaLS (${e.id}) ${e.packageJSON.version} ${e.isActive?"Activated":"Not Yet Activated"}`);let i=q.workspace.getConfiguration("Lua"),s=this.context.storageUri;if(!s){this.output.error("No Workspace");return}try{let f=(await Re.readFile(_e.joinPath(s,"sumneko-3rd/factorio/config.json"))).toString(),m=JSON.parse(f);this.output.info(`Library bundle found in ${s.fsPath}, generated from Factorio ${m.factorioVersion} with FMTK ${m.bundleVersion}`);for(let g of gs())try{(await Re.readFile(_e.joinPath(s,"sumneko-3rd",g.name))).toString()!==g.content&&this.output.info(`file ${g.name} content mismatch!`)}catch(v){this.output.error(`file ${g.name} ${v}`)}}catch(f){this.output.error(`Missing or damaged library bundle info ${f}`)}let o=i.get("workspace.userThirdParty");if(!o)this.output.warn("Lua.workspace.userThirdParty not present!");else{let f=_e.joinPath(s,"sumneko-3rd").fsPath;o.includes(f)?this.output.info(`Lua.workspace.userThirdParty: workspace link OK (${f})`):this.output.warn(`Lua.workspace.userThirdParty: workspace link missing! (${f})`);let m=o.filter(g=>g!==f);for(let g of m)g.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd$/)?this.output.warn(`Lua.workspace.userThirdParty: stale workspace link? (${g})`):this.output.info(`Lua.workspace.userThirdParty: other library (${g})`)}let a=i.get("workspace.checkThirdParty"),u=a==="ApplyInMemory";a===!1||a==="Disable"?this.output.warn(`Lua.workspace.checkThirdParty = ${a}`):this.output.info(`Lua.workspace.checkThirdParty = ${a}`);let l=n.get("workspace.manageLibraryDataLinks",!1),h=i.get("workspace.library");if(!h)this.output.warn("Lua.workspace.library not present!");else{let f=[];if(!t.onlineOnly){let _=Oe.file(await t.dataPath()).fsPath;f.push(_),h.includes(_)?this.output.info(`Lua.workspace.library: /data link OK (${_})`):l&&this.output.warn(`Lua.workspace.library: /data link missing! (${_})`)}let m=_e.joinPath(s,"sumneko-3rd/factorio/library").fsPath,g=h.find(_=>Oe.file(_).fsPath===m);g?(f.push(g),u?this.output.warn(`Lua.workspace.library: redundant workspace library link (${g})`):this.output.info(`Lua.workspace.library: workspace library link OK (${g})`)):u||this.output.warn(`Lua.workspace.library: workspace library link missing! (${m})`);let v=h.filter(_=>!f.includes(_));for(let _ of v)_.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd[\\\/]factorio[\\\/]library$/)?this.output.warn(`Lua.workspace.library: stale workspace link? (${_})`):_.endsWith("data")?this.output.warn(`Lua.workspace.library: stale data link? (${_})`):this.output.info(`Lua.workspace.library: other library (${_})`)}let p=i.get("runtime.plugin");if(!p)u||this.output.warn("Lua.runtime.plugin not present!");else{let f=_e.joinPath(s,"sumneko-3rd/factorio/plugin.lua").fsPath.replace(/[\\]/g,"/");p===f?u?this.output.warn(`Lua.runtime.plugin: redundant workspace link (${p})`):this.output.info(`Lua.runtime.plugin: OK (${p})`):this.output.warn(`Lua.runtime.plugin: wrong plugin? (${p})`)}}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(q.debug.activeDebugSession?.type==="factoriomod"){q.window.showErrorMessage("Cannot select Factorio version while debugging.");return}let e=q.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.map(p=>p.factorioPath),i=(await Promise.all(Sd.filter(p=>!n.includes(p.factorioPath)).map(async p=>{try{return(await Re.stat(Oe.file(sn(p.factorioPath,q.workspace.workspaceFolders)))).type&q.FileType.File?p:void 0}catch{return}}))).filter(p=>!!p),s=async p=>p.onlineDocs===!0?"latest":p.onlineDocs?p.onlineDocs:(await this.tryJsonDocs(p).catch(()=>{}))?.application_version??"unknown",o=await q.window.showQuickPick([{kind:q.QuickPickItemKind.Separator,label:"settings"},...await Promise.all(t.map(async p=>({fv:p,label:p.name,description:await s(p),detail:p.factorioPath}))),{kind:q.QuickPickItemKind.Separator,label:"autodetected"},...await Promise.all(i.map(async p=>({fv:p,label:p.name,description:await s(p),detail:p.factorioPath}))),{fv:Ss,label:Ss.name,description:await s(Ss)},{fv:Ds,label:Ds.name,description:await s(Ds)},{kind:q.QuickPickItemKind.Separator,label:""},{fv:void 0,label:"Select another install locaton...",picked:!1}],{title:"Select Factorio Version"});if(!o)return;let a=o.fv;if(a?.factorioPath){let p=!1;try{(await Re.stat(Oe.file(sn(a.factorioPath,q.workspace.workspaceFolders)))).type&q.FileType.File&&(p=!0)}catch{}if(!p)if(await q.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(m=>m!==a));return}else return}let u=!1;if(!a){let p=await q.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Factorio binary",filters:Ts.platform()==="win32"?{"":["exe"]}:void 0});if(!p)return;let f=await q.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;a={name:f,factorioPath:p[0].fsPath},u=!0}let l;try{l=await this.tryJsonDocs(a)}catch(p){if(!a.factorioPath){q.window.showErrorMessage(`Unable to read online docs: ${p}`);return}if(await q.window.showErrorMessage(`Unable to read JSON docs: ${p}`,"Select alternate location","Cancel")!=="Select alternate location")return;let f=await q.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Runtime JSON Docs",title:"Select Runtime JSON Docs",filters:{"JSON Docs":["json"]}});if(!f)return;a.docsPath=jc.relative(sn(a.factorioPath,q.workspace.workspaceFolders),f[0].fsPath);try{l=await this.tryJsonDocs(a)}catch(m){q.window.showErrorMessage(`Unable to read JSON docs: ${m}`);return}}await this.context.workspaceState.update("active_version",a),u&&(t.push(a),e.update("versions",t)),this.bar.text=`Factorio ${l.application_version} (${a.name})`;let h=this._active_version;this._active_version=new ti(q.workspace.fs,a,l,q.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${a.name} (${l.application_version})`),await this.generateDocs(h)}_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`,s=await fetch(i);if(!s.ok)throw new Error(`Error fetching ${i} : ${s.statusText}`);t=await s.text()}else{if(!e.factorioPath)throw new Error(`Invalid Config: requires at least one of factorioPath or onlineDocs in ${e.name}`);let n=_e.joinPath(Oe.file(sn(e.factorioPath,q.workspace.workspaceFolders)),e.docsPath?e.docsPath:Ts.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json");t=(await Re.readFile(n)).toString()}return new Oc(t)}async wantsRegenFromConfigFileVersion(e,t){try{let n=(await Re.readFile(e)).toString(),i=JSON.parse(n);return i.factorioVersion!==t.docs.application_version||i.bundleVersion!==Bi}catch{return!0}}async checkDocs(){let e=await this.getActiveVersion();if(!e)return;let t=this.context.storageUri;if(!t)return;let n=!1;if(Ps.some(o=>q.extensions.getExtension(o))&&(n||=await this.wantsRegenFromConfigFileVersion(_e.joinPath(t,"emmylua/factorio/config.json"),e)),q.extensions.getExtension("sumneko.lua")&&(n||=await this.wantsRegenFromConfigFileVersion(_e.joinPath(t,"sumneko-3rd/factorio/config.json"),e)),n)return this.generateDocs()}async generateDocs(e){if(!q.workspace.getConfiguration("factorio").get("docs.generateDocs",!0))return;let t=await this.getActiveVersion();if(!t)return;let n=this.context.storageUri;if(!n){q.window.showErrorMessage("Unable to generate docs: no open workspace");return}let i=Ps.map(o=>q.extensions.getExtension(o)).find(o=>!!o);if(i){this.output.appendLine(`Generating EmmyLua bundle for ${i.id}`);let o=q.workspace.getConfiguration("factorio"),a=_e.joinPath(n,"emmylua");await this.refreshDocFiles(a,t);let u=await q.workspace.findFiles(".luarc.json"),l="{}";u.length>0&&(l=(await Re.readFile(u[0])).toString()),l=Dn(l,Sn(l,["$schema"],"https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",{})),l=Dn(l,Sn(l,["runtime","version"],"Lua5.2",{})),l=Dn(l,Sn(l,["runtime","requirePattern"],["?","?.lua"],{}));let h=[_e.joinPath(a,"factorio","library").fsPath];o.get("workspace.manageLibraryDataLinks")!==!1&&(h.push(await t.dataPath()),h.push(await t.lualibPath())),l=Dn(l,Sn(l,["workspace","library"],h,{})),l=Dn(l,Sn(l,["diagnostics","disable"],["unnecessary-if"],{})),u.length>0?await Re.writeFile(u[0],Buffer.from(l)):await Re.writeFile(_e.joinPath(q.workspace.workspaceFolders[0].uri,".luarc.json"),Buffer.from(l))}let s=q.extensions.getExtension("sumneko.lua");if(s){this.output.appendLine(`Generating LuaLS bundle for ${s.id}`);let o=_e.joinPath(n,"sumneko-3rd");await this.refreshDocFiles(o,t);let a=q.workspace.getConfiguration("Lua"),u=a.get("workspace.library",[]),l=(g,...v)=>{if(g){let _=_e.joinPath(g,...v),T=u.indexOf(_.fsPath);T!==-1&&u.splice(T,1)}},h=async(g,...v)=>{try{let _=_e.joinPath(g,...v);!u.includes(_.fsPath)&&(await Re.stat(_)).type&q.FileType.Directory&&u.push(_.fsPath)}catch{}},p=q.workspace.getConfiguration("factorio");if(e&&!e.onlineOnly){let g=Oe.file(await e.dataPath());l(g)}if(u.length===0?await a.update("workspace.library",void 0):await a.update("workspace.library",u),p.get("workspace.manageLibraryDataLinks")===!0){let g=Oe.file(await t.dataPath());await h(g)}u.length===0?await a.update("workspace.library",void 0):await a.update("workspace.library",u);let f=a.get("workspace.userThirdParty",[]);f=f.filter(g=>!g.includes("justarandomgeek.factoriomod-debug")),await a.update("workspace.userThirdParty",f),f.push(o.fsPath),await a.update("workspace.userThirdParty",f);let m=a.get("workspace.checkThirdParty");m&&["Ask","Apply","ApplyInMemory"].includes(m)||await a.update("workspace.checkThirdParty","ApplyInMemory"),s.isActive||await s.activate()}}async refreshDocFiles(e,t){await Re.createDirectory(e);try{await Promise.allSettled([Re.delete(_e.joinPath(e,"factorio","library"),{recursive:!0}),Re.delete(_e.joinPath(e,"factorio","factorio-plugin"),{recursive:!0})])}catch{}let n=this.output,i=await tt({close(){},write(s){n.info(`docgen: ${s.trimEnd()}`)}},this.context.asAbsolutePath("./dist/fmtk-cli.js"),await t.docArgs(q.workspace.getConfiguration("factorio").get("docs.usePrototypeDumps",!1)),e.fsPath);if(i!==0){this.output.warn(`docgen return code ${i}`),await q.window.showErrorMessage("Error while generating docs","Show Output")==="Show Output"&&this.output.show();return}}};import*as zt from"path";import*as te from"vscode";var Yi=class{type;ctime;mtime;size;name;data;constructor(e){this.type=te.FileType.File,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e}},on=class{type;ctime;mtime;size;name;entries;constructor(e){this.type=te.FileType.Directory,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e,this.entries=new Map}},Qi=class{root=new on("");stat(e){return this._lookup(e,!1)}readDirectory(e){let t=this._lookupAsDirectory(e,!1),n=[];for(let[i,s]of t.entries)n.push([i,s.type]);return n}readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw te.FileSystemError.FileNotFound()}writeFile(e,t,n){let i=zt.posix.basename(e.path),s=this._lookupParentDirectory(e),o=s.entries.get(i);if(o instanceof on)throw te.FileSystemError.FileIsADirectory(e);if(!o&&!n.create)throw te.FileSystemError.FileNotFound(e);if(o&&n.create&&!n.overwrite)throw te.FileSystemError.FileExists(e);o||(o=new Yi(i),s.entries.set(i,o),this._fireSoon({type:te.FileChangeType.Created,uri:e})),o.mtime=Date.now(),o.size=t.byteLength,o.data=t,this._fireSoon({type:te.FileChangeType.Changed,uri:e})}rename(e,t,n){if(!n.overwrite&&this._lookup(t,!0))throw te.FileSystemError.FileExists(t);let i=this._lookup(e,!1),s=this._lookupParentDirectory(e),o=this._lookupParentDirectory(t),a=zt.posix.basename(t.path);s.entries.delete(i.name),i.name=a,o.entries.set(a,i),this._fireSoon({type:te.FileChangeType.Deleted,uri:e},{type:te.FileChangeType.Created,uri:t})}delete(e,t){let n=e.with({path:zt.posix.dirname(e.path)}),i=zt.posix.basename(e.path),s=this._lookupAsDirectory(n,t?.silent??!1);if(!s||!s.entries.has(i)){if(t?.silent)return;throw te.FileSystemError.FileNotFound(e)}s.entries.delete(i),s.mtime=Date.now(),s.size-=1,this._fireSoon({type:te.FileChangeType.Changed,uri:n},{uri:e,type:te.FileChangeType.Deleted})}createDirectory(e){let t=zt.posix.basename(e.path),n=e.with({path:zt.posix.dirname(e.path)}),i=this._lookupAsDirectory(n,!1),s=new on(t);i.entries.set(s.name,s),i.mtime=Date.now(),i.size+=1,this._fireSoon({type:te.FileChangeType.Changed,uri:n},{type:te.FileChangeType.Created,uri:e})}_lookup(e,t){let n=e.path.split("/"),i=this.root;for(let s of n){if(!s)continue;let o;if(i instanceof on&&(o=i.entries.get(s)),!o){if(t)return;throw te.FileSystemError.FileNotFound(e)}i=o}return i}_lookupAsDirectory(e,t){let n=this._lookup(e,t);if(n instanceof on)return n;throw te.FileSystemError.FileNotADirectory(e)}_lookupAsFile(e,t){let n=this._lookup(e,t);if(n instanceof Yi)return n;throw te.FileSystemError.FileIsADirectory(e)}_lookupParentDirectory(e){let t=e.with({path:zt.posix.dirname(e.path)});return this._lookupAsDirectory(t,!1)}_emitter=new te.EventEmitter;_bufferedEvents=[];_fireSoonHandle;onDidChangeFile=this._emitter.event;watch(e){return new te.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)}};var Ti=Qn(Vl(),1);import*as Jl from"path";import{workspace as Gl}from"vscode";function Yl(r){let e=r.asAbsolutePath(Jl.join("dist","fmtk-cli.js")),t={execArgv:["--nolazy","--inspect-brk=34199"]},n={run:{module:e,transport:Ti.TransportKind.ipc,args:["lsp"]},debug:{module:e,transport:Ti.TransportKind.ipc,args:["lsp"],options:t}},i={documentSelector:[{language:"factorio-locale"},{language:"factorio-changelog"},{language:"lua"}],synchronize:{fileEvents:[Gl.createFileSystemWatcher("**/locale/*/*.cfg"),Gl.createFileSystemWatcher("**/changelog.txt")]}},s=new Ti.LanguageClient("factorioLanguageServer","Factorio Language Server",n,i);s.start(),r.subscriptions.push({dispose(){return s.stop()}})}import*as Se from"vscode";function Ql(r){return r.type==="int"?{type:"int",value:Cv("",r.value)}:r}function yc(r,e){return typeof e=="bigint"?`jsonbigint ${e}n`:e}function Cv(r,e){if(typeof e=="string"){let t=e.match(/^jsonbigint\x01\x02 (\d+)n$/);if(t)return BigInt(t[1])}return e}function Hr(){let r="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<32;t++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}var Zl=Qn(Rc()),Xl=(0,Zl.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 Wr=class{constructor(e){this.context=e;this.context.subscriptions.push(Se.window.registerCustomEditorProvider("fmtk.modsettings",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new Se.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 _c.create(e,t.backupId),s=[];return s.push(i.onDidChange(o=>{this._onDidChangeCustomDocument.fire({document:i,...o})})),s.push(i.onDidChangeContent(o=>{let a=this.webviews.get(i.uri.toString());a&&this.postMessage(a,"init",{version:i.version,saves_ints:i.saves_ints,settings:JSON.stringify(i.settings,yc),editable:Se.workspace.fs.isWritableFileSystem(i.uri.scheme)!==!1})})),i.onDidDispose(()=>s.forEach(o=>o.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=Xl.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,Hr()).replace(/\$ModSettingsWebview\.css\$/g,i.asWebviewUri(Se.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.css")).toString()).replace(/\$ModSettingsWebview\.js\$/g,i.asWebviewUri(Se.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.js")).toString()),t.webview.onDidReceiveMessage(s=>this.onMessage(e,s)),t.webview.onDidReceiveMessage(s=>{s.type==="ready"&&this.postMessage(t,"init",{version:e.version,saves_ints:e.saves_ints,settings:JSON.stringify(e.settings,yc),editable:Se.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}}},_c=class r{constructor(e,t){this.uri=e;this._settings=new ps(new Zn(t))}uri;static async create(e,t){let n=typeof t=="string"?Se.Uri.parse(t):e,i=await Se.workspace.fs.readFile(n);return new r(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 Se.workspace.fs.writeFile(e,this._settings.save())}async revert(e){this._settings=new ps(new Zn(await Se.workspace.fs.readFile(this.uri))),this._onDidChangeDocument.fire({})}async backup(e,t){return await this.saveAs(e,t),{id:e.toString(),delete:()=>{Se.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,Ql(e.value)),this._onDidChange.fire({})}_onDidDispose=new Se.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new Se.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new Se.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};import*as vn from"vscode";function Oi(r){switch(r.type){case"Table":case"TableWithMeta":return Object.assign({},r,{values:void 0,values_count:r.values.length});default:return r}}var ed=Qn(Rc()),td=(0,ed.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfFvQVTMCUDAAdWYACM1Rr9kTZPigW0cExqa5abIuCIgQB6E4YFy0vARyYYfbRjDAYvljCV4iNri8DjABNmHiuE52csWASCNDuvAANWYcka1Hb450ghaC0SPFV04aFnYjeXJ2Lg9nHB0wAPw8XpHH9co85HwGXq6Y2TMOtvxd3x/37SH1CPcpPkZsNw1iYLBe2hZggSlMMpQzWx4TDashQwet4yTdVIn2AArdMgXBDJp1LRtZAArtix7PtSLIfAgA===");import*as nn from"vscode";var $r=class r{constructor(e,t){this.uri=e;this._data=new xc(new Zn(t))}uri;static async create(e,t){let n=typeof t=="string"?nn.Uri.parse(t):e,i=await nn.workspace.fs.readFile(n);return new r(e,i)}_data;get version(){return this._data.version.format()}get rootdata(){let e={};for(let t in this._data.data)e[t]=Oi(this._data.data[t]);return e}find(e,t){return this._data.find(e,t)}_onDidDispose=new nn.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new nn.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new nn.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};var Br=class{constructor(e){this.context=e;this.context.subscriptions.push(vn.window.registerCustomEditorProvider("fmtk.scriptdat",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new vn.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async openCustomDocument(e,t,n){let i=await $r.create(e,t.backupId),s=[];return s.push(i.onDidChange(o=>{this._onDidChangeCustomDocument.fire({document:i,...o})})),s.push(i.onDidChangeContent(o=>{let a=this.webviews.get(i.uri.toString());a&&this.postMessage(a,"init",{version:i.version,data:i.rootdata})})),i.onDidDispose(()=>s.forEach(o=>o.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=td.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,Hr()).replace(/\$ScriptDatWebview\.css\$/g,i.asWebviewUri(vn.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.css")).toString()).replace(/\$ScriptDatWebview\.js\$/g,i.asWebviewUri(vn.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.js")).toString()),t.webview.onDidReceiveMessage(s=>this.onMessage(e,s)),t.webview.onDidReceiveMessage(s=>{s.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),s;n.index!==void 0&&n.count!==void 0?s=i.values.slice(n.index,n.index+n.count):s=i.values,this.postMessage(this.webviews.get(e.uri.toString()),"values",{...n,values:s.map(o=>({key:Oi(o.key),value:Oi(o.value)}))})}}};async function M_(r){let e=H.window.createOutputChannel("FMTK",{log:!0});e.info(`FMTK ${Bi}`);try{e.info("Registering FS Provider...");let t=new Qi;r.subscriptions.push(H.workspace.registerFileSystemProvider("fmtk",t,{isCaseSensitive:!0})),e.info("Registering Version Selector...");let n=new Ji(r,e,t);e.info("Registering Native Debug Provider...");let i=new wc(n);r.subscriptions.push(H.debug.registerDebugConfigurationProvider("factorio",i)),r.subscriptions.push(H.debug.registerDebugAdapterDescriptorFactory("factorio",i)),r.subscriptions.push(i),e.info("Registering Language Client..."),Yl(r),e.info("Registering Mod Package Provider..."),await Mc(r),e.info("Registering Custom Editors..."),new Wr(r),new Br(r),e.info("Activate Complete")}catch(t){e.error(`Error while activating: ${t}`)}}var wc=class{constructor(e){this.versionSelector=e;this.disposables.push(H.debug.onDidReceiveDebugSessionCustomEvent(async t=>{if(t.session.type==="factorio")switch(t.event){case"profileRunning":await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!0);break;case"profileComplete":await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1),await H.commands.executeCommand("vscode.open",H.Uri.file(t.body.path));break;default:break}})),this.disposables.push(H.commands.registerCommand("factorio.startProfile",async()=>{let t=H.debug.activeDebugSession;t&&(await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!0),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1),await t.customRequest("startProfile",{}))})),this.disposables.push(H.commands.registerCommand("factorio.stopProfile",async()=>{let t=H.debug.activeDebugSession;t&&(await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!0),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!0),await t.customRequest("stopProfile",{}))}))}versionSelector;async resolveDebugConfigurationWithSubstitutedVariables(e,t,n){let i=await this.versionSelector.getActiveVersion();if(!i)return;if(t.factorioArgs||(t.factorioArgs=[]),!t.factorioArgs.includes("--mod-directory")){let o=await H.workspace.findFiles("**/mod-list.json");if(o.length===1){let a=Un.posix.normalize(Un.resolve(H.Uri.joinPath(o[0],"..").fsPath)),u=await i.defaultModsPath();a!==u&&(t.factorioArgs=[...t.factorioArgs,"--mod-directory",a])}else if(o.length>1)throw new Error("Cannot automatically select mod directory, multiple mod-list.json in workspace")}let s=H.workspace.getConfiguration("factorio.debug").get("env",{});return t.env={...s,...t.env,SteamAppId:"427520"},t}async createDebugAdapterDescriptor(e,t){let n=await this.versionSelector.getActiveVersion();if(!n)return;if(n.onlineOnly)throw new Error("Cannot debug online docs. Select a local Factorio install to debug.");let i=0,s=Un.join(await n.writeDataPath(),".lock");for(;zr.existsSync(s);)try{zr.rmSync(s)}catch{if(i++>50)throw new Error(`Factorio lock file (${s}) still exists. Already running?`);await new Promise(l=>setTimeout(l,100))}await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1);let a=H.workspace.getConfiguration("factorio.debug").get("shim");return a?new H.DebugAdapterExecutable(a,[n.factorioPath,"--dap"],{env:e.configuration.env,cwd:H.workspace.workspaceFolders?.[0]?.uri?.fsPath}):new H.DebugAdapterExecutable(n.factorioPath,["--dap"],{env:e.configuration.env,cwd:H.workspace.workspaceFolders?.[0]?.uri?.fsPath})}disposables=[];dispose(){this.disposables.forEach(e=>e.dispose())}};export{M_ as activate};
37
+ `+t.slice(i.index+i[0].length)}await this.fs.writeFile(e,Buffer.from(t)),this.iniData=ei.parse(t)}async defaultModsPath(){let e=(await this.configIni())?.path?.["write-data"];if(!e)throw new Error("path.write-data missing in config.ini");return G.posix.normalize(G.resolve(this.translatePath(e),"mods"))}async dataPath(){let e=(await this.configIni().catch(()=>({path:{"read-data":"__PATH__executable__/../../data"}}))).path?.["read-data"];if(!e)throw new Error("path.read-data missing in config.ini");return G.posix.normalize(this.translatePath(e))}async lualibPath(){return G.posix.normalize(G.resolve(await this.dataPath(),"core","lualib"))}async writeDataPath(){let e=(await this.configIni()).path?.["write-data"];if(!e)throw new Error("path.write-data missing in config.ini");return G.posix.normalize(this.translatePath(e))}async scriptOutputPath(){return G.posix.join(await this.writeDataPath(),"script-output")}translatePath(e){if(e.startsWith("__PATH__executable__"))return G.join(G.dirname(this.factorioPath),e.replace("__PATH__executable__",""));if(e.startsWith("__PATH__system-write-data__")){let t=Ae.platform()==="win32"?G.resolve(process.env.APPDATA,"Factorio"):Ae.platform()==="linux"?G.resolve(Ae.homedir(),".factorio"):Ae.platform()==="darwin"?G.resolve(Ae.homedir(),"Library/Application Support/factorio"):"??";return G.join(t,e.replace("__PATH__system-write-data__",""))}if(e.startsWith("__PATH__system-read-data__")){let t=Ae.platform()==="linux"?"/usr/share/factorio":Ae.platform()==="darwin"?G.resolve(G.dirname(this.factorioPath),"../data"):G.resolve(G.dirname(this.factorioPath),"../../data");return G.join(t,e.replace("__PATH__system-read-data__",""))}return e}is(e){let t=this.fv;return t.name===e.name&&t.factorioPath===e.factorioPath&&t.configPath===e.configPath&&t.onlineDocs===e.onlineDocs&&t.docsPath===e.docsPath&&t.protosPath===e.protosPath}};var Fe=q.workspace.fs,Pd=[{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"}],Ds={name:"Online Latest",onlineDocs:!0},Ps={name:"Online Stable",onlineDocs:"stable"},Ts=["tangzx.emmylua","xuhuanzy.emmylua-luals"],Yi=class{constructor(e,t,n){this.context=e;this.output=t;this.fsprovider=n;this.bar=q.window.createStatusBarItem("factorio-version",q.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(q.commands.registerCommand("factorio.selectVersion",()=>this.selectVersionCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.checkConfig",()=>this.checkConfigCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.disablePrototypeCache",()=>this.disablePrototypeCacheCommand())),e.subscriptions.push(q.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=q.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 ti(q.workspace.fs,e,t,q.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(i=>i.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: ${q.workspace.isTrusted}`),q.workspace.workspaceFolders?.forEach(i=>this.output.info(`Workspace folder: ${i.uri.toString()}`));let t=q.workspace.getConfiguration("factorio");this.output.info(`execArgv: ${JSON.stringify(process.execArgv)}`),this.output.info(`execArgvOptions: ${JSON.stringify(t.get("tasks.execArgvOptions",[]))}`),this.output.info(`execArgvExtras: ${JSON.stringify(t.get("tasks.execArgvExtras",[]))}`);let n=q.extensions.getExtension("sumneko.lua");n?await this.checkLuaLSConfig(n,e,t):this.output.info("LuaLS (sumneko.lua) not present");for(let i of Ts){let s=q.extensions.getExtension(i);s?await this.checkEmmyLuaConfig(s,e,t):this.output.info(`EmmyLua (${i}) not present`)}}async checkEmmyLuaConfig(e,t,n){this.output.info(`EmmyLua (${e.id}) ${e.packageJSON.version} ${e.isActive?"Activated":"Not Yet Activated"}`);let i=this.context.storageUri;if(!i){this.output.error("No Workspace");return}try{let s=(await Fe.readFile(_e.joinPath(i,"emmylua/factorio/config.json"))).toString(),o=JSON.parse(s);this.output.info(`Library bundle found in ${i.fsPath}, generated from Factorio ${o.factorioVersion} with FMTK ${o.bundleVersion}`);for(let a of ms())try{(await Fe.readFile(_e.joinPath(i,"emmylua",a.name))).toString()!==a.content&&this.output.info(`file ${a.name} content mismatch!`)}catch(u){this.output.error(`file ${a.name} ${u}`)}}catch(s){this.output.error(`Missing or damaged library bundle info ${s}`)}}async checkLuaLSConfig(e,t,n){this.output.info(`LuaLS (${e.id}) ${e.packageJSON.version} ${e.isActive?"Activated":"Not Yet Activated"}`);let i=q.workspace.getConfiguration("Lua"),s=this.context.storageUri;if(!s){this.output.error("No Workspace");return}try{let f=(await Fe.readFile(_e.joinPath(s,"sumneko-3rd/factorio/config.json"))).toString(),m=JSON.parse(f);this.output.info(`Library bundle found in ${s.fsPath}, generated from Factorio ${m.factorioVersion} with FMTK ${m.bundleVersion}`);for(let g of ms())try{(await Fe.readFile(_e.joinPath(s,"sumneko-3rd",g.name))).toString()!==g.content&&this.output.info(`file ${g.name} content mismatch!`)}catch(v){this.output.error(`file ${g.name} ${v}`)}}catch(f){this.output.error(`Missing or damaged library bundle info ${f}`)}let o=i.get("workspace.userThirdParty");if(!o)this.output.warn("Lua.workspace.userThirdParty not present!");else{let f=_e.joinPath(s,"sumneko-3rd").fsPath;o.includes(f)?this.output.info(`Lua.workspace.userThirdParty: workspace link OK (${f})`):this.output.warn(`Lua.workspace.userThirdParty: workspace link missing! (${f})`);let m=o.filter(g=>g!==f);for(let g of m)g.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd$/)?this.output.warn(`Lua.workspace.userThirdParty: stale workspace link? (${g})`):this.output.info(`Lua.workspace.userThirdParty: other library (${g})`)}let a=i.get("workspace.checkThirdParty"),u=a==="ApplyInMemory";a===!1||a==="Disable"?this.output.warn(`Lua.workspace.checkThirdParty = ${a}`):this.output.info(`Lua.workspace.checkThirdParty = ${a}`);let l=n.get("workspace.manageLibraryDataLinks",!1),h=i.get("workspace.library");if(!h)this.output.warn("Lua.workspace.library not present!");else{let f=[];if(!t.onlineOnly){let _=Re.file(await t.dataPath()).fsPath;f.push(_),h.includes(_)?this.output.info(`Lua.workspace.library: /data link OK (${_})`):l&&this.output.warn(`Lua.workspace.library: /data link missing! (${_})`)}let m=_e.joinPath(s,"sumneko-3rd/factorio/library").fsPath,g=h.find(_=>Re.file(_).fsPath===m);g?(f.push(g),u?this.output.warn(`Lua.workspace.library: redundant workspace library link (${g})`):this.output.info(`Lua.workspace.library: workspace library link OK (${g})`)):u||this.output.warn(`Lua.workspace.library: workspace library link missing! (${m})`);let v=h.filter(_=>!f.includes(_));for(let _ of v)_.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd[\\\/]factorio[\\\/]library$/)?this.output.warn(`Lua.workspace.library: stale workspace link? (${_})`):_.endsWith("data")?this.output.warn(`Lua.workspace.library: stale data link? (${_})`):this.output.info(`Lua.workspace.library: other library (${_})`)}let p=i.get("runtime.plugin");if(!p)u||this.output.warn("Lua.runtime.plugin not present!");else{let f=_e.joinPath(s,"sumneko-3rd/factorio/plugin.lua").fsPath.replace(/[\\]/g,"/");p===f?u?this.output.warn(`Lua.runtime.plugin: redundant workspace link (${p})`):this.output.info(`Lua.runtime.plugin: OK (${p})`):this.output.warn(`Lua.runtime.plugin: wrong plugin? (${p})`)}}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(q.debug.activeDebugSession?.type==="factoriomod"){q.window.showErrorMessage("Cannot select Factorio version while debugging.");return}let e=q.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.map(p=>p.factorioPath),i=(await Promise.all(Pd.filter(p=>!n.includes(p.factorioPath)).map(async p=>{try{return(await Fe.stat(Re.file(an(p.factorioPath,q.workspace.workspaceFolders)))).type&q.FileType.File?p:void 0}catch{return}}))).filter(p=>!!p),s=async p=>p.onlineDocs===!0?"latest":p.onlineDocs?p.onlineDocs:(await this.tryJsonDocs(p).catch(()=>{}))?.application_version??"unknown",o=await q.window.showQuickPick([{kind:q.QuickPickItemKind.Separator,label:"settings"},...await Promise.all(t.map(async p=>({fv:p,label:p.name,description:await s(p),detail:p.factorioPath}))),{kind:q.QuickPickItemKind.Separator,label:"autodetected"},...await Promise.all(i.map(async p=>({fv:p,label:p.name,description:await s(p),detail:p.factorioPath}))),{fv:Ds,label:Ds.name,description:await s(Ds)},{fv:Ps,label:Ps.name,description:await s(Ps)},{kind:q.QuickPickItemKind.Separator,label:""},{fv:void 0,label:"Select another install locaton...",picked:!1}],{title:"Select Factorio Version"});if(!o)return;let a=o.fv;if(a?.factorioPath){let p=!1;try{(await Fe.stat(Re.file(an(a.factorioPath,q.workspace.workspaceFolders)))).type&q.FileType.File&&(p=!0)}catch{}if(!p)if(await q.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(m=>m!==a));return}else return}let u=!1;if(!a){let p=await q.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Factorio binary",filters:Os.platform()==="win32"?{"":["exe"]}:void 0});if(!p)return;let f=await q.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;a={name:f,factorioPath:p[0].fsPath},u=!0}let l;try{l=await this.tryJsonDocs(a)}catch(p){if(!a.factorioPath){q.window.showErrorMessage(`Unable to read online docs: ${p}`);return}if(await q.window.showErrorMessage(`Unable to read JSON docs: ${p}`,"Select alternate location","Cancel")!=="Select alternate location")return;let f=await q.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Runtime JSON Docs",title:"Select Runtime JSON Docs",filters:{"JSON Docs":["json"]}});if(!f)return;a.docsPath=Lc.relative(an(a.factorioPath,q.workspace.workspaceFolders),f[0].fsPath);try{l=await this.tryJsonDocs(a)}catch(m){q.window.showErrorMessage(`Unable to read JSON docs: ${m}`);return}}await this.context.workspaceState.update("active_version",a),u&&(t.push(a),e.update("versions",t)),this.bar.text=`Factorio ${l.application_version} (${a.name})`;let h=this._active_version;this._active_version=new ti(q.workspace.fs,a,l,q.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${a.name} (${l.application_version})`),await this.generateDocs(h)}_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`,s=await fetch(i);if(!s.ok)throw new Error(`Error fetching ${i} : ${s.statusText}`);t=await s.text()}else{if(!e.factorioPath)throw new Error(`Invalid Config: requires at least one of factorioPath or onlineDocs in ${e.name}`);let n=_e.joinPath(Re.file(an(e.factorioPath,q.workspace.workspaceFolders)),e.docsPath?e.docsPath:Os.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json");t=(await Fe.readFile(n)).toString()}return new Rc(t)}async wantsRegenFromConfigFileVersion(e,t){try{let n=(await Fe.readFile(e)).toString(),i=JSON.parse(n);return i.factorioVersion!==t.docs.application_version||i.bundleVersion!==zi}catch{return!0}}async checkDocs(){let e=await this.getActiveVersion();if(!e)return;let t=this.context.storageUri;if(!t)return;let n=!1;if(Ts.some(o=>q.extensions.getExtension(o))&&(n||=await this.wantsRegenFromConfigFileVersion(_e.joinPath(t,"emmylua/factorio/config.json"),e)),q.extensions.getExtension("sumneko.lua")&&(n||=await this.wantsRegenFromConfigFileVersion(_e.joinPath(t,"sumneko-3rd/factorio/config.json"),e)),n)return this.generateDocs()}async generateDocs(e){if(!q.workspace.getConfiguration("factorio").get("docs.generateDocs",!0))return;let t=await this.getActiveVersion();if(!t)return;let n=this.context.storageUri;if(!n){q.window.showErrorMessage("Unable to generate docs: no open workspace");return}let i=Ts.map(o=>q.extensions.getExtension(o)).find(o=>!!o);if(i){this.output.appendLine(`Generating EmmyLua bundle for ${i.id}`);let o=q.workspace.getConfiguration("factorio"),a=_e.joinPath(n,"emmylua");await this.refreshDocFiles(a,t);let u=await q.workspace.findFiles(".luarc.json"),l="{}";u.length>0&&(l=(await Fe.readFile(u[0])).toString());let h={formattingOptions:{keepLines:!0,insertFinalNewline:!0,insertSpaces:!0}};l=on(l,sn(l,["$schema"],"https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",h)),l=on(l,sn(l,["runtime","version"],"Lua5.2",h)),l=on(l,sn(l,["runtime","requirePattern"],["?","?.lua"],h));let p=[_e.joinPath(a,"factorio","library").fsPath];o.get("workspace.manageLibraryDataLinks")!==!1&&p.push({path:await t.dataPath(),ignoreDir:["core/lualib/event_handler.lua","core/lualib/crash-site.lua","core/lualib/math2d.lua","core/lualib/meld.lua","core/lualib/mod-gui.lua","core/lualib/sound-util.lua","core/lualib/util.lua","core/lualib/silo-script.lua","core/lualib/space-finish-script.lua","core/lualib/prototype-info.lua","core/lualib/circuit-connector-sprites.lua","core/lualib/resource-autoplace.lua","base/scripts/freeplay/","base/scripts/pvp/","base/scripts/sandbox/","base/scripts/wave-defense/"],ignoreGlobs:["*/migrations","*/scenarios","*/campaigns","*/tutorials","*/menu-simulations"]}),l=on(l,sn(l,["workspace","library"],p,h)),l=on(l,sn(l,["workspace","moduleMap"],[{pattern:"^__(.*)__(.*)$",replace:"$1$2"},{pattern:"^(.*)\\.lua$",replace:"$1"}],h)),l=on(l,sn(l,["diagnostics","disable"],["unnecessary-if"],h)),u.length>0?await Fe.writeFile(u[0],Buffer.from(l)):await Fe.writeFile(_e.joinPath(q.workspace.workspaceFolders[0].uri,".luarc.json"),Buffer.from(l))}let s=q.extensions.getExtension("sumneko.lua");if(s){this.output.appendLine(`Generating LuaLS bundle for ${s.id}`);let o=_e.joinPath(n,"sumneko-3rd");await this.refreshDocFiles(o,t);let a=q.workspace.getConfiguration("Lua"),u=a.get("workspace.library",[]),l=(g,...v)=>{if(g){let _=_e.joinPath(g,...v),T=u.indexOf(_.fsPath);T!==-1&&u.splice(T,1)}},h=async(g,...v)=>{try{let _=_e.joinPath(g,...v);!u.includes(_.fsPath)&&(await Fe.stat(_)).type&q.FileType.Directory&&u.push(_.fsPath)}catch{}},p=q.workspace.getConfiguration("factorio");if(e&&!e.onlineOnly){let g=Re.file(await e.dataPath());l(g)}if(u.length===0?await a.update("workspace.library",void 0):await a.update("workspace.library",u),p.get("workspace.manageLibraryDataLinks")===!0){let g=Re.file(await t.dataPath());await h(g)}u.length===0?await a.update("workspace.library",void 0):await a.update("workspace.library",u);let f=a.get("workspace.userThirdParty",[]);f=f.filter(g=>!g.includes("justarandomgeek.factoriomod-debug")),await a.update("workspace.userThirdParty",f),f.push(o.fsPath),await a.update("workspace.userThirdParty",f);let m=a.get("workspace.checkThirdParty");m&&["Ask","Apply","ApplyInMemory"].includes(m)||await a.update("workspace.checkThirdParty","ApplyInMemory"),s.isActive||await s.activate()}}async refreshDocFiles(e,t){await Fe.createDirectory(e);try{await Promise.allSettled([Fe.delete(_e.joinPath(e,"factorio","library"),{recursive:!0}),Fe.delete(_e.joinPath(e,"factorio","factorio-plugin"),{recursive:!0})])}catch{}let n=this.output,i=await nt({close(){},write(s){n.info(`docgen: ${s.trimEnd()}`)}},this.context.asAbsolutePath("./dist/fmtk-cli.js"),await t.docArgs(q.workspace.getConfiguration("factorio").get("docs.usePrototypeDumps",!1)),e.fsPath);if(i!==0){this.output.warn(`docgen return code ${i}`),await q.window.showErrorMessage("Error while generating docs","Show Output")==="Show Output"&&this.output.show();return}}};import*as Vt from"path";import*as ne from"vscode";var Qi=class{type;ctime;mtime;size;name;data;constructor(e){this.type=ne.FileType.File,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e}},cn=class{type;ctime;mtime;size;name;entries;constructor(e){this.type=ne.FileType.Directory,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e,this.entries=new Map}},Zi=class{root=new cn("");stat(e){return this._lookup(e,!1)}readDirectory(e){let t=this._lookupAsDirectory(e,!1),n=[];for(let[i,s]of t.entries)n.push([i,s.type]);return n}readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw ne.FileSystemError.FileNotFound()}writeFile(e,t,n){let i=Vt.posix.basename(e.path),s=this._lookupParentDirectory(e),o=s.entries.get(i);if(o instanceof cn)throw ne.FileSystemError.FileIsADirectory(e);if(!o&&!n.create)throw ne.FileSystemError.FileNotFound(e);if(o&&n.create&&!n.overwrite)throw ne.FileSystemError.FileExists(e);o||(o=new Qi(i),s.entries.set(i,o),this._fireSoon({type:ne.FileChangeType.Created,uri:e})),o.mtime=Date.now(),o.size=t.byteLength,o.data=t,this._fireSoon({type:ne.FileChangeType.Changed,uri:e})}rename(e,t,n){if(!n.overwrite&&this._lookup(t,!0))throw ne.FileSystemError.FileExists(t);let i=this._lookup(e,!1),s=this._lookupParentDirectory(e),o=this._lookupParentDirectory(t),a=Vt.posix.basename(t.path);s.entries.delete(i.name),i.name=a,o.entries.set(a,i),this._fireSoon({type:ne.FileChangeType.Deleted,uri:e},{type:ne.FileChangeType.Created,uri:t})}delete(e,t){let n=e.with({path:Vt.posix.dirname(e.path)}),i=Vt.posix.basename(e.path),s=this._lookupAsDirectory(n,t?.silent??!1);if(!s||!s.entries.has(i)){if(t?.silent)return;throw ne.FileSystemError.FileNotFound(e)}s.entries.delete(i),s.mtime=Date.now(),s.size-=1,this._fireSoon({type:ne.FileChangeType.Changed,uri:n},{uri:e,type:ne.FileChangeType.Deleted})}createDirectory(e){let t=Vt.posix.basename(e.path),n=e.with({path:Vt.posix.dirname(e.path)}),i=this._lookupAsDirectory(n,!1),s=new cn(t);i.entries.set(s.name,s),i.mtime=Date.now(),i.size+=1,this._fireSoon({type:ne.FileChangeType.Changed,uri:n},{type:ne.FileChangeType.Created,uri:e})}_lookup(e,t){let n=e.path.split("/"),i=this.root;for(let s of n){if(!s)continue;let o;if(i instanceof cn&&(o=i.entries.get(s)),!o){if(t)return;throw ne.FileSystemError.FileNotFound(e)}i=o}return i}_lookupAsDirectory(e,t){let n=this._lookup(e,t);if(n instanceof cn)return n;throw ne.FileSystemError.FileNotADirectory(e)}_lookupAsFile(e,t){let n=this._lookup(e,t);if(n instanceof Qi)return n;throw ne.FileSystemError.FileIsADirectory(e)}_lookupParentDirectory(e){let t=e.with({path:Vt.posix.dirname(e.path)});return this._lookupAsDirectory(t,!1)}_emitter=new ne.EventEmitter;_bufferedEvents=[];_fireSoonHandle;onDidChangeFile=this._emitter.event;watch(e){return new ne.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)}};var Oi=Qn(Jl(),1);import*as Ql from"path";import{workspace as Yl}from"vscode";function Zl(r){let e=r.asAbsolutePath(Ql.join("dist","fmtk-cli.js")),t={execArgv:["--nolazy","--inspect-brk=34199"]},n={run:{module:e,transport:Oi.TransportKind.ipc,args:["lsp"]},debug:{module:e,transport:Oi.TransportKind.ipc,args:["lsp"],options:t}},i={documentSelector:[{language:"factorio-locale"},{language:"factorio-changelog"},{language:"lua"}],synchronize:{fileEvents:[Yl.createFileSystemWatcher("**/locale/*/*.cfg"),Yl.createFileSystemWatcher("**/changelog.txt")]}},s=new Oi.LanguageClient("factorioLanguageServer","Factorio Language Server",n,i);s.start(),r.subscriptions.push({dispose(){return s.stop()}})}import*as Se from"vscode";function Xl(r){return r.type==="int"?{type:"int",value:Sv("",r.value)}:r}function _c(r,e){return typeof e=="bigint"?`jsonbigint ${e}n`:e}function Sv(r,e){if(typeof e=="string"){let t=e.match(/^jsonbigint\x01\x02 (\d+)n$/);if(t)return BigInt(t[1])}return e}function Wr(){let r="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<32;t++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}var ed=Qn(Fc()),td=(0,ed.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 $r=class{constructor(e){this.context=e;this.context.subscriptions.push(Se.window.registerCustomEditorProvider("fmtk.modsettings",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new Se.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 wc.create(e,t.backupId),s=[];return s.push(i.onDidChange(o=>{this._onDidChangeCustomDocument.fire({document:i,...o})})),s.push(i.onDidChangeContent(o=>{let a=this.webviews.get(i.uri.toString());a&&this.postMessage(a,"init",{version:i.version,saves_ints:i.saves_ints,settings:JSON.stringify(i.settings,_c),editable:Se.workspace.fs.isWritableFileSystem(i.uri.scheme)!==!1})})),i.onDidDispose(()=>s.forEach(o=>o.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=td.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,Wr()).replace(/\$ModSettingsWebview\.css\$/g,i.asWebviewUri(Se.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.css")).toString()).replace(/\$ModSettingsWebview\.js\$/g,i.asWebviewUri(Se.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.js")).toString()),t.webview.onDidReceiveMessage(s=>this.onMessage(e,s)),t.webview.onDidReceiveMessage(s=>{s.type==="ready"&&this.postMessage(t,"init",{version:e.version,saves_ints:e.saves_ints,settings:JSON.stringify(e.settings,_c),editable:Se.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}}},wc=class r{constructor(e,t){this.uri=e;this._settings=new gs(new Zn(t))}uri;static async create(e,t){let n=typeof t=="string"?Se.Uri.parse(t):e,i=await Se.workspace.fs.readFile(n);return new r(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 Se.workspace.fs.writeFile(e,this._settings.save())}async revert(e){this._settings=new gs(new Zn(await Se.workspace.fs.readFile(this.uri))),this._onDidChangeDocument.fire({})}async backup(e,t){return await this.saveAs(e,t),{id:e.toString(),delete:()=>{Se.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,Xl(e.value)),this._onDidChange.fire({})}_onDidDispose=new Se.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new Se.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new Se.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};import*as _n from"vscode";function Ri(r){switch(r.type){case"Table":case"TableWithMeta":return Object.assign({},r,{values:void 0,values_count:r.values.length});default:return r}}var nd=Qn(Fc()),id=(0,nd.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfFvQVTMCUDAAdWYACM1Rr9kTZPigW0cExqa5abIuCIgQB6E4YFy0vARyYYfbRjDAYvljCV4iNri8DjABNmHiuE52csWASCNDuvAANWYcka1Hb450ghaC0SPFV04aFnYjeXJ2Lg9nHB0wAPw8XpHH9co85HwGXq6Y2TMOtvxd3x/37SH1CPcpPkZsNw1iYLBe2hZggSlMMpQzWx4TDashQwet4yTdVIn2AArdMgXBDJp1LRtZAArtix7PtSLIfAgA===");import*as nn from"vscode";var Br=class r{constructor(e,t){this.uri=e;this._data=new Mc(new Zn(t))}uri;static async create(e,t){let n=typeof t=="string"?nn.Uri.parse(t):e,i=await nn.workspace.fs.readFile(n);return new r(e,i)}_data;get version(){return this._data.version.format()}get rootdata(){let e={};for(let t in this._data.data)e[t]=Ri(this._data.data[t]);return e}find(e,t){return this._data.find(e,t)}_onDidDispose=new nn.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new nn.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new nn.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};var zr=class{constructor(e){this.context=e;this.context.subscriptions.push(_n.window.registerCustomEditorProvider("fmtk.scriptdat",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new _n.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async openCustomDocument(e,t,n){let i=await Br.create(e,t.backupId),s=[];return s.push(i.onDidChange(o=>{this._onDidChangeCustomDocument.fire({document:i,...o})})),s.push(i.onDidChangeContent(o=>{let a=this.webviews.get(i.uri.toString());a&&this.postMessage(a,"init",{version:i.version,data:i.rootdata})})),i.onDidDispose(()=>s.forEach(o=>o.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=id.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,Wr()).replace(/\$ScriptDatWebview\.css\$/g,i.asWebviewUri(_n.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.css")).toString()).replace(/\$ScriptDatWebview\.js\$/g,i.asWebviewUri(_n.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.js")).toString()),t.webview.onDidReceiveMessage(s=>this.onMessage(e,s)),t.webview.onDidReceiveMessage(s=>{s.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),s;n.index!==void 0&&n.count!==void 0?s=i.values.slice(n.index,n.index+n.count):s=i.values,this.postMessage(this.webviews.get(e.uri.toString()),"values",{...n,values:s.map(o=>({key:Ri(o.key),value:Ri(o.value)}))})}}};async function E_(r){let e=H.window.createOutputChannel("FMTK",{log:!0});e.info(`FMTK ${zi}`);try{e.info("Registering FS Provider...");let t=new Zi;r.subscriptions.push(H.workspace.registerFileSystemProvider("fmtk",t,{isCaseSensitive:!0})),e.info("Registering Version Selector...");let n=new Yi(r,e,t);e.info("Registering Native Debug Provider...");let i=new Cc(n);r.subscriptions.push(H.debug.registerDebugConfigurationProvider("factorio",i)),r.subscriptions.push(H.debug.registerDebugAdapterDescriptorFactory("factorio",i)),r.subscriptions.push(i),e.info("Registering Language Client..."),Zl(r),e.info("Registering Mod Package Provider..."),await kc(r),e.info("Registering Custom Editors..."),new $r(r),new zr(r),e.info("Activate Complete")}catch(t){e.error(`Error while activating: ${t}`)}}var Cc=class{constructor(e){this.versionSelector=e;this.disposables.push(H.debug.onDidReceiveDebugSessionCustomEvent(async t=>{if(t.session.type==="factorio")switch(t.event){case"profileRunning":await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!0);break;case"profileComplete":await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1),await H.commands.executeCommand("vscode.open",H.Uri.file(t.body.path));break;default:break}})),this.disposables.push(H.commands.registerCommand("factorio.startProfile",async()=>{let t=H.debug.activeDebugSession;t&&(await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!0),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1),await t.customRequest("startProfile",{}))})),this.disposables.push(H.commands.registerCommand("factorio.stopProfile",async()=>{let t=H.debug.activeDebugSession;t&&(await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!0),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!0),await t.customRequest("stopProfile",{}))}))}versionSelector;async resolveDebugConfigurationWithSubstitutedVariables(e,t,n){let i=await this.versionSelector.getActiveVersion();if(!i)return;if(t.factorioArgs||(t.factorioArgs=[]),!t.factorioArgs.includes("--mod-directory")){let o=await H.workspace.findFiles("**/mod-list.json");if(o.length===1){let a=Un.posix.normalize(Un.resolve(H.Uri.joinPath(o[0],"..").fsPath)),u=await i.defaultModsPath();a!==u&&(t.factorioArgs=[...t.factorioArgs,"--mod-directory",a])}else if(o.length>1)throw new Error("Cannot automatically select mod directory, multiple mod-list.json in workspace")}let s=H.workspace.getConfiguration("factorio.debug").get("env",{});return t.env={...s,...t.env,SteamAppId:"427520"},t}async createDebugAdapterDescriptor(e,t){let n=await this.versionSelector.getActiveVersion();if(!n)return;if(n.onlineOnly)throw new Error("Cannot debug online docs. Select a local Factorio install to debug.");let i=0,s=Un.join(await n.writeDataPath(),".lock");for(;Vr.existsSync(s);)try{Vr.rmSync(s)}catch{if(i++>50)throw new Error(`Factorio lock file (${s}) still exists. Already running?`);await new Promise(l=>setTimeout(l,100))}await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1);let a=H.workspace.getConfiguration("factorio.debug").get("shim");return a?new H.DebugAdapterExecutable(a,[n.factorioPath,"--dap"],{env:e.configuration.env,cwd:H.workspace.workspaceFolders?.[0]?.uri?.fsPath}):new H.DebugAdapterExecutable(n.factorioPath,["--dap"],{env:e.configuration.env,cwd:H.workspace.workspaceFolders?.[0]?.uri?.fsPath})}disposables=[];dispose(){this.disposables.forEach(e=>e.dispose())}};export{E_ as activate};
38
38
  //# sourceMappingURL=fmtk-vscode.js.map