"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Bs=require("vscode"),He=require("./_commonjsHelpers.js"),uu=require("child_process"),lu=require("fs"),du=require("path"),fu=require("util"),hu=require("os"),gu=require("crypto"),pu=require("net");function $t(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}function mu(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var me=mu(Bs),de=$t(Bs),Xs=$t(uu),Ri=$t(lu),er=$t(du),yu=$t(fu),vu=$t(hu),Cu=$t(gu),_u=$t(pu);let wi;function tn(){return wi||(wi=me.window.createOutputChannel("Even Better TOML")),wi}async function Ru(e,t){let n;switch(e.kind){case"info":n=await me.window.showInformationMessage(e.message,"Show Details");case"warn":n=await me.window.showWarningMessage(e.message,"Show Details");case"error":n=await me.window.showErrorMessage(e.message,"Show Details")}n&&t.outputChannel.show()}function wu(e,t){e.subscriptions.push(me.commands.registerTextEditorCommand("evenBetterToml.copyAsJson",async n=>{var r,i;const o=n?.document;if(!o||n.selection.isEmpty)return;const s=o.getText(n.selection);if(s.trim().length===0)return;const a=await t.sendRequest("taplo/convertToJson",{text:s}),c=tn();if((i=(r=a.error)==null?void 0:r.length)!=null&&i){c.appendLine(`Failed to convert TOML to JSON: ${a.error}`),await me.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}try{if(!a.text){c.appendLine("The response shouldn't be empty, but it is."),await me.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}await me.env.clipboard.writeText(a.text)}catch(l){c.appendLine(`Couldn't write to clipboard: ${l}`),await me.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}await me.window.showInformationMessage("JSON copied!")}),me.commands.registerTextEditorCommand("evenBetterToml.copyAsToml",async n=>{var r,i;const o=n?.document;if(!o||n.selection.isEmpty)return;const s=o.getText(n.selection);if(s.trim().length===0)return;const a=await t.sendRequest("taplo/convertToToml",{text:s}),c=tn();if((i=(r=a.error)==null?void 0:r.length)!=null&&i){c.appendLine(`Failed to convert JSON to TOML: ${a.error}`),await me.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}try{if(!a.text){c.appendLine("The response shouldn't be empty, but it is."),await me.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}await me.env.clipboard.writeText(a.text)}catch(l){c.appendLine(`Couldn't write to clipboard: ${l}`),await me.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}await me.window.showInformationMessage("TOML copied!")}),me.commands.registerTextEditorCommand("evenBetterToml.pasteAsJson",async n=>{var r,i;const o=tn();let s;try{s=await me.env.clipboard.readText()}catch(c){o.appendLine(`Failed to read from clipboard:${c}`),await me.window.showErrorMessage("Paste from clipboard has failed!","Show Details")&&o.show();return}const a=await t.sendRequest("taplo/convertToJson",{text:s});if((i=(r=a.error)==null?void 0:r.length)!=null&&i){o.appendLine(`Failed to convert to JSON: ${a.error}`),await me.window.showErrorMessage("Pasting JSON has failed!","Show Details")&&o.show();return}n.edit(c=>{c.replace(n.selection,a.text)})}),me.commands.registerTextEditorCommand("evenBetterToml.pasteAsToml",async n=>{var r,i;const o=tn();let s;try{s=await me.env.clipboard.readText()}catch(c){o.appendLine(`Failed to read from clipboard:${c}`),await me.window.showErrorMessage("Paste from clipboard has failed!","Show Details")&&o.show();return}const a=await t.sendRequest("taplo/convertToToml",{text:s});if((i=(r=a.error)==null?void 0:r.length)!=null&&i){o.appendLine(`Failed to convert to TOML: ${a.error}`),await me.window.showErrorMessage("Paste from clipboard has failed!","Show Details")&&o.show();return}n.edit(c=>{c.replace(n.selection,a.text)})}))}function bu(e,t){e.subscriptions.push(me.commands.registerTextEditorCommand("evenBetterToml.selectSchema",async n=>{if(!n)return;const r=await t.sendRequest("taplo/listSchemas",{documentUri:n.document.uri.toString()}),i=await t.sendRequest("taplo/associatedSchema",{documentUri:n.document.uri.toString()}),o=await me.window.showQuickPick(r.schemas.map(s=>{var a,c,l;return{label:(c=(a=s.meta)==null?void 0:a.name)!=null?c:s.url,description:Su(s.meta),detail:Du(s.url),picked:((l=i.schema)==null?void 0:l.url)===s.url,url:s.url,meta:s.meta}}));!o||t.sendNotification("taplo/associateSchema",{documentUri:n.document.uri.toString(),schemaUri:o.url,rule:{url:n.document.uri.toString()},meta:o.meta})}))}function Su(e){if(typeof e?.description=="string")return e.description}function Du(e,t){return`${e}`}function Tu(e,t){wu(e,t),bu(e,t)}var bi={exports:{}},Js={},Lt={exports:{}};const Pu="2.0.0",Eu=256,ku=Number.MAX_SAFE_INTEGER||9007199254740991,Fu=16;var tr={SEMVER_SPEC_VERSION:Pu,MAX_LENGTH:Eu,MAX_SAFE_INTEGER:ku,MAX_SAFE_COMPONENT_LENGTH:Fu};const Ou=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var nr=Ou;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n}=tr,r=nr;t=e.exports={};const i=t.re=[],o=t.src=[],s=t.t={};let a=0;const c=(l,m,g)=>{const d=a++;r(l,d,m),s[l]=d,o[d]=m,i[d]=new RegExp(m,g?"g":void 0)};c("NUMERICIDENTIFIER","0|[1-9]\\d*"),c("NUMERICIDENTIFIERLOOSE","[0-9]+"),c("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),c("MAINVERSION",`(${o[s.NUMERICIDENTIFIER]})\\.(${o[s.NUMERICIDENTIFIER]})\\.(${o[s.NUMERICIDENTIFIER]})`),c("MAINVERSIONLOOSE",`(${o[s.NUMERICIDENTIFIERLOOSE]})\\.(${o[s.NUMERICIDENTIFIERLOOSE]})\\.(${o[s.NUMERICIDENTIFIERLOOSE]})`),c("PRERELEASEIDENTIFIER",`(?:${o[s.NUMERICIDENTIFIER]}|${o[s.NONNUMERICIDENTIFIER]})`),c("PRERELEASEIDENTIFIERLOOSE",`(?:${o[s.NUMERICIDENTIFIERLOOSE]}|${o[s.NONNUMERICIDENTIFIER]})`),c("PRERELEASE",`(?:-(${o[s.PRERELEASEIDENTIFIER]}(?:\\.${o[s.PRERELEASEIDENTIFIER]})*))`),c("PRERELEASELOOSE",`(?:-?(${o[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[s.PRERELEASEIDENTIFIERLOOSE]})*))`),c("BUILDIDENTIFIER","[0-9A-Za-z-]+"),c("BUILD",`(?:\\+(${o[s.BUILDIDENTIFIER]}(?:\\.${o[s.BUILDIDENTIFIER]})*))`),c("FULLPLAIN",`v?${o[s.MAINVERSION]}${o[s.PRERELEASE]}?${o[s.BUILD]}?`),c("FULL",`^${o[s.FULLPLAIN]}$`),c("LOOSEPLAIN",`[v=\\s]*${o[s.MAINVERSIONLOOSE]}${o[s.PRERELEASELOOSE]}?${o[s.BUILD]}?`),c("LOOSE",`^${o[s.LOOSEPLAIN]}$`),c("GTLT","((?:<|>)?=?)"),c("XRANGEIDENTIFIERLOOSE",`${o[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),c("XRANGEIDENTIFIER",`${o[s.NUMERICIDENTIFIER]}|x|X|\\*`),c("XRANGEPLAIN",`[v=\\s]*(${o[s.XRANGEIDENTIFIER]})(?:\\.(${o[s.XRANGEIDENTIFIER]})(?:\\.(${o[s.XRANGEIDENTIFIER]})(?:${o[s.PRERELEASE]})?${o[s.BUILD]}?)?)?`),c("XRANGEPLAINLOOSE",`[v=\\s]*(${o[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[s.XRANGEIDENTIFIERLOOSE]})(?:${o[s.PRERELEASELOOSE]})?${o[s.BUILD]}?)?)?`),c("XRANGE",`^${o[s.GTLT]}\\s*${o[s.XRANGEPLAIN]}$`),c("XRANGELOOSE",`^${o[s.GTLT]}\\s*${o[s.XRANGEPLAINLOOSE]}$`),c("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),c("COERCERTL",o[s.COERCE],!0),c("LONETILDE","(?:~>?)"),c("TILDETRIM",`(\\s*)${o[s.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",c("TILDE",`^${o[s.LONETILDE]}${o[s.XRANGEPLAIN]}$`),c("TILDELOOSE",`^${o[s.LONETILDE]}${o[s.XRANGEPLAINLOOSE]}$`),c("LONECARET","(?:\\^)"),c("CARETTRIM",`(\\s*)${o[s.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",c("CARET",`^${o[s.LONECARET]}${o[s.XRANGEPLAIN]}$`),c("CARETLOOSE",`^${o[s.LONECARET]}${o[s.XRANGEPLAINLOOSE]}$`),c("COMPARATORLOOSE",`^${o[s.GTLT]}\\s*(${o[s.LOOSEPLAIN]})$|^$`),c("COMPARATOR",`^${o[s.GTLT]}\\s*(${o[s.FULLPLAIN]})$|^$`),c("COMPARATORTRIM",`(\\s*)${o[s.GTLT]}\\s*(${o[s.LOOSEPLAIN]}|${o[s.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",c("HYPHENRANGE",`^\\s*(${o[s.XRANGEPLAIN]})\\s+-\\s+(${o[s.XRANGEPLAIN]})\\s*$`),c("HYPHENRANGELOOSE",`^\\s*(${o[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[s.XRANGEPLAINLOOSE]})\\s*$`),c("STAR","(<|>)?=?\\s*\\*"),c("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),c("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Lt,Lt.exports);const Iu=["includePrerelease","loose","rtl"],qu=e=>e?typeof e!="object"?{loose:!0}:Iu.filter(t=>e[t]).reduce((t,n)=>(t[n]=!0,t),{}):{};var rr=qu;const Qs=/^[0-9]+$/,Ys=(e,t)=>{const n=Qs.test(e),r=Qs.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:eYs(t,e);var Si={compareIdentifiers:Ys,rcompareIdentifiers:Nu};const ir=nr,{MAX_LENGTH:Zs,MAX_SAFE_INTEGER:or}=tr,{re:ea,t:ta}=Lt.exports,$u=rr,{compareIdentifiers:nn}=Si;class Rt{constructor(t,n){if(n=$u(n),t instanceof Rt){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid Version: ${t}`);if(t.length>Zs)throw new TypeError(`version is longer than ${Zs} characters`);ir("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?ea[ta.LOOSE]:ea[ta.FULL]);if(!r)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>or||this.major<0)throw new TypeError("Invalid major version");if(this.minor>or||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>or||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const o=+i;if(o>=0&&o=0;)typeof this.prerelease[r]=="number"&&(this.prerelease[r]++,r=-2);r===-1&&this.prerelease.push(0)}n&&(nn(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=[n,0]):this.prerelease=[n,0]);break;default:throw new Error(`invalid increment argument: ${t}`)}return this.format(),this.raw=this.version,this}}var nt=Rt;const{MAX_LENGTH:Lu}=tr,{re:na,t:ra}=Lt.exports,ia=nt,Mu=rr,Au=(e,t)=>{if(t=Mu(t),e instanceof ia)return e;if(typeof e!="string"||e.length>Lu||!(t.loose?na[ra.LOOSE]:na[ra.FULL]).test(e))return null;try{return new ia(e,t)}catch{return null}};var rn=Au;const ju=rn,Hu=(e,t)=>{const n=ju(e,t);return n?n.version:null};var Wu=Hu;const Uu=rn,xu=(e,t)=>{const n=Uu(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null};var zu=xu;const oa=nt,Ku=(e,t,n,r)=>{typeof n=="string"&&(r=n,n=void 0);try{return new oa(e instanceof oa?e.version:e,n).inc(t,r).version}catch{return null}};var Gu=Ku;const sa=nt,Vu=(e,t,n)=>new sa(e,n).compare(new sa(t,n));var Ct=Vu;const Bu=Ct,Xu=(e,t,n)=>Bu(e,t,n)===0;var Di=Xu;const aa=rn,Ju=Di,Qu=(e,t)=>{if(Ju(e,t))return null;{const n=aa(e),r=aa(t),i=n.prerelease.length||r.prerelease.length,o=i?"pre":"",s=i?"prerelease":"";for(const a in n)if((a==="major"||a==="minor"||a==="patch")&&n[a]!==r[a])return o+a;return s}};var Yu=Qu;const Zu=nt,el=(e,t)=>new Zu(e,t).major;var tl=el;const nl=nt,rl=(e,t)=>new nl(e,t).minor;var il=rl;const ol=nt,sl=(e,t)=>new ol(e,t).patch;var al=sl;const cl=rn,ul=(e,t)=>{const n=cl(e,t);return n&&n.prerelease.length?n.prerelease:null};var ll=ul;const dl=Ct,fl=(e,t,n)=>dl(t,e,n);var hl=fl;const gl=Ct,pl=(e,t)=>gl(e,t,!0);var ml=pl;const ca=nt,yl=(e,t,n)=>{const r=new ca(e,n),i=new ca(t,n);return r.compare(i)||r.compareBuild(i)};var Ti=yl;const vl=Ti,Cl=(e,t)=>e.sort((n,r)=>vl(n,r,t));var _l=Cl;const Rl=Ti,wl=(e,t)=>e.sort((n,r)=>Rl(r,n,t));var bl=wl;const Sl=Ct,Dl=(e,t,n)=>Sl(e,t,n)>0;var sr=Dl;const Tl=Ct,Pl=(e,t,n)=>Tl(e,t,n)<0;var Pi=Pl;const El=Ct,kl=(e,t,n)=>El(e,t,n)!==0;var ua=kl;const Fl=Ct,Ol=(e,t,n)=>Fl(e,t,n)>=0;var Ei=Ol;const Il=Ct,ql=(e,t,n)=>Il(e,t,n)<=0;var ki=ql;const Nl=Di,$l=ua,Ll=sr,Ml=Ei,Al=Pi,jl=ki,Hl=(e,t,n,r)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e===n;case"!==":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e!==n;case"":case"=":case"==":return Nl(e,n,r);case"!=":return $l(e,n,r);case">":return Ll(e,n,r);case">=":return Ml(e,n,r);case"<":return Al(e,n,r);case"<=":return jl(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};var la=Hl;const Wl=nt,Ul=rn,{re:ar,t:cr}=Lt.exports,xl=(e,t)=>{if(e instanceof Wl)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let n=null;if(!t.rtl)n=e.match(ar[cr.COERCE]);else{let r;for(;(r=ar[cr.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)(!n||r.index+r[0].length!==n.index+n[0].length)&&(n=r),ar[cr.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;ar[cr.COERCERTL].lastIndex=-1}return n===null?null:Ul(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};var zl=xl,Fi,da;function Kl(){return da||(da=1,Fi=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),Fi}var Oi,fa;function Gl(){if(fa)return Oi;fa=1,Oi=e,e.Node=i,e.create=e;function e(o){var s=this;if(s instanceof e||(s=new e),s.tail=null,s.head=null,s.length=0,o&&typeof o.forEach=="function")o.forEach(function(l){s.push(l)});else if(arguments.length>0)for(var a=0,c=arguments.length;a1)a=s;else if(this.head)c=this.head.next,a=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=0;c!==null;l++)a=o(a,c.value,l),c=c.next;return a},e.prototype.reduceReverse=function(o,s){var a,c=this.tail;if(arguments.length>1)a=s;else if(this.tail)c=this.tail.prev,a=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=this.length-1;c!==null;l--)a=o(a,c.value,l),c=c.prev;return a},e.prototype.toArray=function(){for(var o=new Array(this.length),s=0,a=this.head;a!==null;s++)o[s]=a.value,a=a.next;return o},e.prototype.toArrayReverse=function(){for(var o=new Array(this.length),s=0,a=this.tail;a!==null;s++)o[s]=a.value,a=a.prev;return o},e.prototype.slice=function(o,s){s=s||this.length,s<0&&(s+=this.length),o=o||0,o<0&&(o+=this.length);var a=new e;if(sthis.length&&(s=this.length);for(var c=0,l=this.head;l!==null&&cthis.length&&(s=this.length);for(var c=this.length,l=this.tail;l!==null&&c>s;c--)l=l.prev;for(;l!==null&&c>o;c--,l=l.prev)a.push(l.value);return a},e.prototype.splice=function(o,s,...a){o>this.length&&(o=this.length-1),o<0&&(o=this.length+o);for(var c=0,l=this.head;l!==null&&c1;class d{constructor(w){if(typeof w=="number"&&(w={max:w}),w||(w={}),w.max&&(typeof w.max!="number"||w.max<0))throw new TypeError("max must be a non-negative number");this[t]=w.max||1/0;const $=w.length||g;if(this[r]=typeof $!="function"?g:$,this[i]=w.stale||!1,w.maxAge&&typeof w.maxAge!="number")throw new TypeError("maxAge must be a number");this[o]=w.maxAge||0,this[s]=w.dispose,this[a]=w.noDisposeOnSet||!1,this[m]=w.updateAgeOnGet||!1,this.reset()}set max(w){if(typeof w!="number"||w<0)throw new TypeError("max must be a non-negative number");this[t]=w||1/0,L(this)}get max(){return this[t]}set allowStale(w){this[i]=!!w}get allowStale(){return this[i]}set maxAge(w){if(typeof w!="number")throw new TypeError("maxAge must be a non-negative number");this[o]=w,L(this)}get maxAge(){return this[o]}set lengthCalculator(w){typeof w!="function"&&(w=g),w!==this[r]&&(this[r]=w,this[n]=0,this[c].forEach($=>{$.length=this[r]($.value,$.key),this[n]+=$.length})),L(this)}get lengthCalculator(){return this[r]}get length(){return this[n]}get itemCount(){return this[c].length}rforEach(w,$){$=$||this;for(let H=this[c].tail;H!==null;){const T=H.prev;b(this,w,H,$),H=T}}forEach(w,$){$=$||this;for(let H=this[c].head;H!==null;){const T=H.next;b(this,w,H,$),H=T}}keys(){return this[c].toArray().map(w=>w.key)}values(){return this[c].toArray().map(w=>w.value)}reset(){this[s]&&this[c]&&this[c].length&&this[c].forEach(w=>this[s](w.key,w.value)),this[l]=new Map,this[c]=new e,this[n]=0}dump(){return this[c].map(w=>y(this,w)?!1:{k:w.key,v:w.value,e:w.now+(w.maxAge||0)}).toArray().filter(w=>w)}dumpLru(){return this[c]}set(w,$,H){if(H=H||this[o],H&&typeof H!="number")throw new TypeError("maxAge must be a number");const T=H?Date.now():0,S=this[r]($,w);if(this[l].has(w)){if(S>this[t])return M(this,this[l].get(w)),!1;const C=this[l].get(w).value;return this[s]&&(this[a]||this[s](w,C.value)),C.now=T,C.maxAge=H,C.value=$,this[n]+=S-C.length,C.length=S,this.get(w),L(this),!0}const N=new x(w,$,S,T,H);return N.length>this[t]?(this[s]&&this[s](w,$),!1):(this[n]+=N.length,this[c].unshift(N),this[l].set(w,this[c].head),L(this),!0)}has(w){if(!this[l].has(w))return!1;const $=this[l].get(w).value;return!y(this,$)}get(w){return f(this,w,!0)}peek(w){return f(this,w,!1)}pop(){const w=this[c].tail;return w?(M(this,w),w.value):null}del(w){M(this,this[l].get(w))}load(w){this.reset();const $=Date.now();for(let H=w.length-1;H>=0;H--){const T=w[H],S=T.e||0;if(S===0)this.set(T.k,T.v);else{const N=S-$;N>0&&this.set(T.k,T.v,N)}}}prune(){this[l].forEach((w,$)=>f(this,$,!1))}}const f=(E,w,$)=>{const H=E[l].get(w);if(H){const T=H.value;if(y(E,T)){if(M(E,H),!E[i])return}else $&&(E[m]&&(H.value.now=Date.now()),E[c].unshiftNode(H));return T.value}},y=(E,w)=>{if(!w||!w.maxAge&&!E[o])return!1;const $=Date.now()-w.now;return w.maxAge?$>w.maxAge:E[o]&&$>E[o]},L=E=>{if(E[n]>E[t])for(let w=E[c].tail;E[n]>E[t]&&w!==null;){const $=w.prev;M(E,w),w=$}},M=(E,w)=>{if(w){const $=w.value;E[s]&&E[s]($.key,$.value),E[n]-=$.length,E[l].delete($.key),E[c].removeNode(w)}};class x{constructor(w,$,H,T,S){this.key=w,this.value=$,this.length=H,this.now=T,this.maxAge=S||0}}const b=(E,w,$,H)=>{let T=$.value;y(E,T)&&(M(E,$),E[i]||(T=void 0)),T&&w.call(H,T.value,T.key,E)};return Ii=d,Ii}var qi,ga;function _t(){if(ga)return qi;ga=1;class e{constructor(h,k){if(k=r(k),h instanceof e)return h.loose===!!k.loose&&h.includePrerelease===!!k.includePrerelease?h:new e(h.raw,k);if(h instanceof i)return this.raw=h.value,this.set=[[h]],this.format(),this;if(this.options=k,this.loose=!!k.loose,this.includePrerelease=!!k.includePrerelease,this.raw=h,this.set=h.split("||").map(W=>this.parseRange(W.trim())).filter(W=>W.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${h}`);if(this.set.length>1){const W=this.set[0];if(this.set=this.set.filter(P=>!d(P[0])),this.set.length===0)this.set=[W];else if(this.set.length>1){for(const P of this.set)if(P.length===1&&f(P[0])){this.set=[P];break}}}this.format()}format(){return this.range=this.set.map(h=>h.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(h){h=h.trim();const W=`parseRange:${Object.keys(this.options).join(",")}:${h}`,P=n.get(W);if(P)return P;const F=this.options.loose,j=F?a[c.HYPHENRANGELOOSE]:a[c.HYPHENRANGE];h=h.replace(j,N(this.options.includePrerelease)),o("hyphen replace",h),h=h.replace(a[c.COMPARATORTRIM],l),o("comparator trim",h),h=h.replace(a[c.TILDETRIM],m),h=h.replace(a[c.CARETTRIM],g),h=h.split(/\s+/).join(" ");let G=h.split(" ").map(Y=>L(Y,this.options)).join(" ").split(/\s+/).map(Y=>S(Y,this.options));F&&(G=G.filter(Y=>(o("loose invalid filter",Y,this.options),!!Y.match(a[c.COMPARATORLOOSE])))),o("range list",G);const X=new Map,ie=G.map(Y=>new i(Y,this.options));for(const Y of ie){if(d(Y))return[Y];X.set(Y.value,Y)}X.size>1&&X.has("")&&X.delete("");const ce=[...X.values()];return n.set(W,ce),ce}intersects(h,k){if(!(h instanceof e))throw new TypeError("a Range is required");return this.set.some(W=>y(W,k)&&h.set.some(P=>y(P,k)&&W.every(F=>P.every(j=>F.intersects(j,k)))))}test(h){if(!h)return!1;if(typeof h=="string")try{h=new s(h,this.options)}catch{return!1}for(let k=0;kC.value==="<0.0.0-0",f=C=>C.value==="",y=(C,h)=>{let k=!0;const W=C.slice();let P=W.pop();for(;k&&W.length;)k=W.every(F=>P.intersects(F,h)),P=W.pop();return k},L=(C,h)=>(o("comp",C,h),C=E(C,h),o("caret",C),C=x(C,h),o("tildes",C),C=$(C,h),o("xrange",C),C=T(C,h),o("stars",C),C),M=C=>!C||C.toLowerCase()==="x"||C==="*",x=(C,h)=>C.trim().split(/\s+/).map(k=>b(k,h)).join(" "),b=(C,h)=>{const k=h.loose?a[c.TILDELOOSE]:a[c.TILDE];return C.replace(k,(W,P,F,j,G)=>{o("tilde",C,W,P,F,j,G);let X;return M(P)?X="":M(F)?X=`>=${P}.0.0 <${+P+1}.0.0-0`:M(j)?X=`>=${P}.${F}.0 <${P}.${+F+1}.0-0`:G?(o("replaceTilde pr",G),X=`>=${P}.${F}.${j}-${G} <${P}.${+F+1}.0-0`):X=`>=${P}.${F}.${j} <${P}.${+F+1}.0-0`,o("tilde return",X),X})},E=(C,h)=>C.trim().split(/\s+/).map(k=>w(k,h)).join(" "),w=(C,h)=>{o("caret",C,h);const k=h.loose?a[c.CARETLOOSE]:a[c.CARET],W=h.includePrerelease?"-0":"";return C.replace(k,(P,F,j,G,X)=>{o("caret",C,P,F,j,G,X);let ie;return M(F)?ie="":M(j)?ie=`>=${F}.0.0${W} <${+F+1}.0.0-0`:M(G)?F==="0"?ie=`>=${F}.${j}.0${W} <${F}.${+j+1}.0-0`:ie=`>=${F}.${j}.0${W} <${+F+1}.0.0-0`:X?(o("replaceCaret pr",X),F==="0"?j==="0"?ie=`>=${F}.${j}.${G}-${X} <${F}.${j}.${+G+1}-0`:ie=`>=${F}.${j}.${G}-${X} <${F}.${+j+1}.0-0`:ie=`>=${F}.${j}.${G}-${X} <${+F+1}.0.0-0`):(o("no pr"),F==="0"?j==="0"?ie=`>=${F}.${j}.${G}${W} <${F}.${j}.${+G+1}-0`:ie=`>=${F}.${j}.${G}${W} <${F}.${+j+1}.0-0`:ie=`>=${F}.${j}.${G} <${+F+1}.0.0-0`),o("caret return",ie),ie})},$=(C,h)=>(o("replaceXRanges",C,h),C.split(/\s+/).map(k=>H(k,h)).join(" ")),H=(C,h)=>{C=C.trim();const k=h.loose?a[c.XRANGELOOSE]:a[c.XRANGE];return C.replace(k,(W,P,F,j,G,X)=>{o("xRange",C,W,P,F,j,G,X);const ie=M(F),ce=ie||M(j),Y=ce||M(G),oe=Y;return P==="="&&oe&&(P=""),X=h.includePrerelease?"-0":"",ie?P===">"||P==="<"?W="<0.0.0-0":W="*":P&&oe?(ce&&(j=0),G=0,P===">"?(P=">=",ce?(F=+F+1,j=0,G=0):(j=+j+1,G=0)):P==="<="&&(P="<",ce?F=+F+1:j=+j+1),P==="<"&&(X="-0"),W=`${P+F}.${j}.${G}${X}`):ce?W=`>=${F}.0.0${X} <${+F+1}.0.0-0`:Y&&(W=`>=${F}.${j}.0${X} <${F}.${+j+1}.0-0`),o("xRange return",W),W})},T=(C,h)=>(o("replaceStars",C,h),C.trim().replace(a[c.STAR],"")),S=(C,h)=>(o("replaceGTE0",C,h),C.trim().replace(a[h.includePrerelease?c.GTE0PRE:c.GTE0],"")),N=C=>(h,k,W,P,F,j,G,X,ie,ce,Y,oe,Z)=>(M(W)?k="":M(P)?k=`>=${W}.0.0${C?"-0":""}`:M(F)?k=`>=${W}.${P}.0${C?"-0":""}`:j?k=`>=${k}`:k=`>=${k}${C?"-0":""}`,M(ie)?X="":M(ce)?X=`<${+ie+1}.0.0-0`:M(Y)?X=`<${ie}.${+ce+1}.0-0`:oe?X=`<=${ie}.${ce}.${Y}-${oe}`:C?X=`<${ie}.${ce}.${+Y+1}-0`:X=`<=${X}`,`${k} ${X}`.trim()),O=(C,h,k)=>{for(let W=0;W0){const P=C[W].semver;if(P.major===h.major&&P.minor===h.minor&&P.patch===h.patch)return!0}return!1}return!0};return qi}var Ni,pa;function ur(){if(pa)return Ni;pa=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(m,g){if(g=n(g),m instanceof t){if(m.loose===!!g.loose)return m;m=m.value}s("comparator",m,g),this.options=g,this.loose=!!g.loose,this.parse(m),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(m){const g=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],d=m.match(g);if(!d)throw new TypeError(`Invalid comparator: ${m}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new a(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(m){if(s("Comparator.test",m,this.options.loose),this.semver===e||m===e)return!0;if(typeof m=="string")try{m=new a(m,this.options)}catch{return!1}return o(m,this.operator,this.semver,this.options)}intersects(m,g){if(!(m instanceof t))throw new TypeError("a Comparator is required");if((!g||typeof g!="object")&&(g={loose:!!g,includePrerelease:!1}),this.operator==="")return this.value===""?!0:new c(m.value,g).test(this.value);if(m.operator==="")return m.value===""?!0:new c(this.value,g).test(m.semver);const d=(this.operator===">="||this.operator===">")&&(m.operator===">="||m.operator===">"),f=(this.operator==="<="||this.operator==="<")&&(m.operator==="<="||m.operator==="<"),y=this.semver.version===m.semver.version,L=(this.operator===">="||this.operator==="<=")&&(m.operator===">="||m.operator==="<="),M=o(this.semver,"<",m.semver,g)&&(this.operator===">="||this.operator===">")&&(m.operator==="<="||m.operator==="<"),x=o(this.semver,">",m.semver,g)&&(this.operator==="<="||this.operator==="<")&&(m.operator===">="||m.operator===">");return d||f||y&&L||M||x}}Ni=t;const n=rr,{re:r,t:i}=Lt.exports,o=la,s=nr,a=nt,c=_t();return Ni}const Bl=_t(),Xl=(e,t,n)=>{try{t=new Bl(t,n)}catch{return!1}return t.test(e)};var lr=Xl;const Jl=_t(),Ql=(e,t)=>new Jl(e,t).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));var Yl=Ql;const Zl=nt,ed=_t(),td=(e,t,n)=>{let r=null,i=null,o=null;try{o=new ed(t,n)}catch{return null}return e.forEach(s=>{o.test(s)&&(!r||i.compare(s)===-1)&&(r=s,i=new Zl(r,n))}),r};var nd=td;const rd=nt,id=_t(),od=(e,t,n)=>{let r=null,i=null,o=null;try{o=new id(t,n)}catch{return null}return e.forEach(s=>{o.test(s)&&(!r||i.compare(s)===1)&&(r=s,i=new rd(r,n))}),r};var sd=od;const $i=nt,ad=_t(),ma=sr,cd=(e,t)=>{e=new ad(e,t);let n=new $i("0.0.0");if(e.test(n)||(n=new $i("0.0.0-0"),e.test(n)))return n;n=null;for(let r=0;r{const a=new $i(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||ma(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),o&&(!n||ma(n,o))&&(n=o)}return n&&e.test(n)?n:null};var ud=cd;const ld=_t(),dd=(e,t)=>{try{return new ld(e,t).range||"*"}catch{return null}};var fd=dd;const hd=nt,ya=ur(),{ANY:gd}=ya,pd=_t(),md=lr,va=sr,Ca=Pi,yd=ki,vd=Ei,Cd=(e,t,n,r)=>{e=new hd(e,r),t=new pd(t,r);let i,o,s,a,c;switch(n){case">":i=va,o=yd,s=Ca,a=">",c=">=";break;case"<":i=Ca,o=vd,s=va,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(md(e,t,r))return!1;for(let l=0;l{f.semver===gd&&(f=new ya(">=0.0.0")),g=g||f,d=d||f,i(f.semver,g.semver,r)?g=f:s(f.semver,d.semver,r)&&(d=f)}),g.operator===a||g.operator===c||(!d.operator||d.operator===a)&&o(e,d.semver))return!1;if(d.operator===c&&s(e,d.semver))return!1}return!0};var Li=Cd;const _d=Li,Rd=(e,t,n)=>_d(e,t,">",n);var wd=Rd;const bd=Li,Sd=(e,t,n)=>bd(e,t,"<",n);var Dd=Sd;const _a=_t(),Td=(e,t,n)=>(e=new _a(e,n),t=new _a(t,n),e.intersects(t));var Pd=Td;const Ed=lr,kd=Ct;var Fd=(e,t,n)=>{const r=[];let i=null,o=null;const s=e.sort((m,g)=>kd(m,g,n));for(const m of s)Ed(m,t,n)?(o=m,i||(i=m)):(o&&r.push([i,o]),o=null,i=null);i&&r.push([i,null]);const a=[];for(const[m,g]of r)m===g?a.push(m):!g&&m===s[0]?a.push("*"):g?m===s[0]?a.push(`<=${g}`):a.push(`${m} - ${g}`):a.push(`>=${m}`);const c=a.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length{if(e===t)return!0;e=new Ra(e,n),t=new Ra(t,n);let r=!1;e:for(const i of e.set){for(const o of t.set){const s=Id(i,o,n);if(r=r||s!==null,s)continue e}if(r)return!1}return!0},Id=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Mi){if(t.length===1&&t[0].semver===Mi)return!0;n.includePrerelease?e=[new dr(">=0.0.0-0")]:e=[new dr(">=0.0.0")]}if(t.length===1&&t[0].semver===Mi){if(n.includePrerelease)return!0;t=[new dr(">=0.0.0")]}const r=new Set;let i,o;for(const f of e)f.operator===">"||f.operator===">="?i=wa(i,f,n):f.operator==="<"||f.operator==="<="?o=ba(o,f,n):r.add(f.semver);if(r.size>1)return null;let s;if(i&&o){if(s=Ai(i.semver,o.semver,n),s>0)return null;if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(const f of r){if(i&&!Tn(f,String(i),n)||o&&!Tn(f,String(o),n))return null;for(const y of t)if(!Tn(f,String(y),n))return!1;return!0}let a,c,l,m,g=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1,d=i&&!n.includePrerelease&&i.semver.prerelease.length?i.semver:!1;g&&g.prerelease.length===1&&o.operator==="<"&&g.prerelease[0]===0&&(g=!1);for(const f of t){if(m=m||f.operator===">"||f.operator===">=",l=l||f.operator==="<"||f.operator==="<=",i){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator===">"||f.operator===">="){if(a=wa(i,f,n),a===f&&a!==i)return!1}else if(i.operator===">="&&!Tn(i.semver,String(f),n))return!1}if(o){if(g&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===g.major&&f.semver.minor===g.minor&&f.semver.patch===g.patch&&(g=!1),f.operator==="<"||f.operator==="<="){if(c=ba(o,f,n),c===f&&c!==o)return!1}else if(o.operator==="<="&&!Tn(o.semver,String(f),n))return!1}if(!f.operator&&(o||i)&&s!==0)return!1}return!(i&&l&&!o&&s!==0||o&&m&&!i&&s!==0||d||g)},wa=(e,t,n)=>{if(!e)return t;const r=Ai(e.semver,t.semver,n);return r>0?e:r<0||t.operator===">"&&e.operator===">="?t:e},ba=(e,t,n)=>{if(!e)return t;const r=Ai(e.semver,t.semver,n);return r<0?e:r>0||t.operator==="<"&&e.operator==="<="?t:e};var qd=Od;const ji=Lt.exports;var Nd={re:ji.re,src:ji.src,tokens:ji.t,SEMVER_SPEC_VERSION:tr.SEMVER_SPEC_VERSION,SemVer:nt,compareIdentifiers:Si.compareIdentifiers,rcompareIdentifiers:Si.rcompareIdentifiers,parse:rn,valid:Wu,clean:zu,inc:Gu,diff:Yu,major:tl,minor:il,patch:al,prerelease:ll,compare:Ct,rcompare:hl,compareLoose:ml,compareBuild:Ti,sort:_l,rsort:bl,gt:sr,lt:Pi,eq:Di,neq:ua,gte:Ei,lte:ki,cmp:la,coerce:zl,Comparator:ur(),Range:_t(),satisfies:lr,toComparators:Yl,maxSatisfying:nd,minSatisfying:sd,minVersion:ud,validRange:fd,outside:Li,gtr:wd,ltr:Dd,intersects:Pd,simplifyRange:Fd,subset:qd},Ee={};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.asPromise=Ee.thenable=Ee.typedArray=Ee.stringArray=Ee.array=Ee.func=Ee.error=Ee.number=Ee.string=Ee.boolean=void 0;function $d(e){return e===!0||e===!1}Ee.boolean=$d;function Sa(e){return typeof e=="string"||e instanceof String}Ee.string=Sa;function Ld(e){return typeof e=="number"||e instanceof Number}Ee.number=Ld;function Md(e){return e instanceof Error}Ee.error=Md;function Da(e){return typeof e=="function"}Ee.func=Da;function Ta(e){return Array.isArray(e)}Ee.array=Ta;function Ad(e){return Ta(e)&&e.every(t=>Sa(t))}Ee.stringArray=Ad;function jd(e,t){return Array.isArray(e)&&e.every(t)}Ee.typedArray=jd;function Pa(e){return e&&Da(e.then)}Ee.thenable=Pa;function Hd(e){return e instanceof Promise?e:Pa(e)?new Promise((t,n)=>{e.then(r=>t(r),r=>n(r))}):Promise.resolve(e)}Ee.asPromise=Hd;var Hi={},he={},Wi={exports:{}},Wt={},Ui={},Tt={};Object.defineProperty(Tt,"__esModule",{value:!0});let xi;function zi(){if(xi===void 0)throw new Error("No runtime abstraction layer installed");return xi}(function(e){function t(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");xi=n}e.install=t})(zi||(zi={})),Tt.default=zi;var Ki={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Disposable=void 0,function(t){function n(r){return{dispose:r}}t.create=n}(e.Disposable||(e.Disposable={}))})(Ki);var fr={};Object.defineProperty(fr,"__esModule",{value:!0}),fr.AbstractMessageBuffer=void 0;const Wd=13,Ud=10,xd=`\r `;class zd{constructor(t="utf-8"){this._encoding=t,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(t){const n=typeof t=="string"?this.fromString(t,this._encoding):t;this._chunks.push(n),this._totalLength+=n.byteLength}tryReadHeaders(){if(this._chunks.length===0)return;let t=0,n=0,r=0,i=0;e:for(;nthis._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){const o=this._chunks[0];return this._chunks.shift(),this._totalLength-=t,this.asNative(o)}if(this._chunks[0].byteLength>t){const o=this._chunks[0],s=this.asNative(o,t);return this._chunks[0]=o.slice(t),this._totalLength-=t,s}const n=this.allocNative(t);let r=0,i=0;for(;t>0;){const o=this._chunks[i];if(o.byteLength>t){const s=o.slice(0,t);n.set(s,r),r+=t,this._chunks[i]=o.slice(t),this._totalLength-=t,t-=t}else n.set(o,r),r+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,t-=o.byteLength}return n}}fr.AbstractMessageBuffer=zd,Object.defineProperty(Ui,"__esModule",{value:!0});const Kd=Tt,Ea=yu.default,Ut=Ki,Gd=fr;class Ci extends Gd.AbstractMessageBuffer{constructor(t="utf-8"){super(t)}emptyBuffer(){return Ci.emptyBuffer}fromString(t,n){return Buffer.from(t,n)}toString(t,n){return t instanceof Buffer?t.toString(n):new Ea.TextDecoder(n).decode(t)}asNative(t,n){return n===void 0?t instanceof Buffer?t:Buffer.from(t):t instanceof Buffer?t.slice(0,n):Buffer.from(t,0,n)}allocNative(t){return Buffer.allocUnsafe(t)}}Ci.emptyBuffer=Buffer.allocUnsafe(0);class Vd{constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),Ut.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),Ut.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),Ut.Disposable.create(()=>this.stream.off("end",t))}onData(t){return this.stream.on("data",t),Ut.Disposable.create(()=>this.stream.off("data",t))}}class Bd{constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),Ut.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),Ut.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),Ut.Disposable.create(()=>this.stream.off("end",t))}write(t,n){return new Promise((r,i)=>{const o=s=>{s==null?r():i(s)};typeof t=="string"?this.stream.write(t,n,o):this.stream.write(t,o)})}end(){this.stream.end()}}const ka=Object.freeze({messageBuffer:Object.freeze({create:e=>new Ci(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(n){return Promise.reject(n)}}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new Ea.TextDecoder(t.charset).decode(e)))}catch(n){return Promise.reject(n)}}})}),stream:Object.freeze({asReadableStream:e=>new Vd(e),asWritableStream:e=>new Bd(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){const r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){const n=setImmediate(e,...t);return{dispose:()=>clearImmediate(n)}},setInterval(e,t,...n){const r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function Gi(){return ka}(function(e){function t(){Kd.default.install(ka)}e.install=t})(Gi||(Gi={})),Ui.default=Gi;var Vi={},Bi={},Je={},Fa;function Pn(){if(Fa)return Je;Fa=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.stringArray=Je.array=Je.func=Je.error=Je.number=Je.string=Je.boolean=void 0;function e(a){return a===!0||a===!1}Je.boolean=e;function t(a){return typeof a=="string"||a instanceof String}Je.string=t;function n(a){return typeof a=="number"||a instanceof Number}Je.number=n;function r(a){return a instanceof Error}Je.error=r;function i(a){return typeof a=="function"}Je.func=i;function o(a){return Array.isArray(a)}Je.array=o;function s(a){return o(a)&&a.every(c=>t(c))}return Je.stringArray=s,Je}var Oa;function Ia(){return Oa||(Oa=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Message=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType=e.RequestType0=e.AbstractMessageSignature=e.ParameterStructures=e.ResponseError=e.ErrorCodes=void 0;const t=Pn();var n;(function(h){h.ParseError=-32700,h.InvalidRequest=-32600,h.MethodNotFound=-32601,h.InvalidParams=-32602,h.InternalError=-32603,h.jsonrpcReservedErrorRangeStart=-32099,h.serverErrorStart=-32099,h.MessageWriteError=-32099,h.MessageReadError=-32098,h.PendingResponseRejected=-32097,h.ConnectionInactive=-32096,h.ServerNotInitialized=-32002,h.UnknownErrorCode=-32001,h.jsonrpcReservedErrorRangeEnd=-32e3,h.serverErrorEnd=-32e3})(n=e.ErrorCodes||(e.ErrorCodes={}));class r extends Error{constructor(k,W,P){super(W),this.code=t.number(k)?k:n.UnknownErrorCode,this.data=P,Object.setPrototypeOf(this,r.prototype)}toJson(){const k={code:this.code,message:this.message};return this.data!==void 0&&(k.data=this.data),k}}e.ResponseError=r;class i{constructor(k){this.kind=k}static is(k){return k===i.auto||k===i.byName||k===i.byPosition}toString(){return this.kind}}e.ParameterStructures=i,i.auto=new i("auto"),i.byPosition=new i("byPosition"),i.byName=new i("byName");class o{constructor(k,W){this.method=k,this.numberOfParams=W}get parameterStructures(){return i.auto}}e.AbstractMessageSignature=o;class s extends o{constructor(k){super(k,0)}}e.RequestType0=s;class a extends o{constructor(k,W=i.auto){super(k,1),this._parameterStructures=W}get parameterStructures(){return this._parameterStructures}}e.RequestType=a;class c extends o{constructor(k,W=i.auto){super(k,1),this._parameterStructures=W}get parameterStructures(){return this._parameterStructures}}e.RequestType1=c;class l extends o{constructor(k){super(k,2)}}e.RequestType2=l;class m extends o{constructor(k){super(k,3)}}e.RequestType3=m;class g extends o{constructor(k){super(k,4)}}e.RequestType4=g;class d extends o{constructor(k){super(k,5)}}e.RequestType5=d;class f extends o{constructor(k){super(k,6)}}e.RequestType6=f;class y extends o{constructor(k){super(k,7)}}e.RequestType7=y;class L extends o{constructor(k){super(k,8)}}e.RequestType8=L;class M extends o{constructor(k){super(k,9)}}e.RequestType9=M;class x extends o{constructor(k,W=i.auto){super(k,1),this._parameterStructures=W}get parameterStructures(){return this._parameterStructures}}e.NotificationType=x;class b extends o{constructor(k){super(k,0)}}e.NotificationType0=b;class E extends o{constructor(k,W=i.auto){super(k,1),this._parameterStructures=W}get parameterStructures(){return this._parameterStructures}}e.NotificationType1=E;class w extends o{constructor(k){super(k,2)}}e.NotificationType2=w;class $ extends o{constructor(k){super(k,3)}}e.NotificationType3=$;class H extends o{constructor(k){super(k,4)}}e.NotificationType4=H;class T extends o{constructor(k){super(k,5)}}e.NotificationType5=T;class S extends o{constructor(k){super(k,6)}}e.NotificationType6=S;class N extends o{constructor(k){super(k,7)}}e.NotificationType7=N;class O extends o{constructor(k){super(k,8)}}e.NotificationType8=O;class C extends o{constructor(k){super(k,9)}}e.NotificationType9=C,function(h){function k(F){const j=F;return j&&t.string(j.method)&&(t.string(j.id)||t.number(j.id))}h.isRequest=k;function W(F){const j=F;return j&&t.string(j.method)&&F.id===void 0}h.isNotification=W;function P(F){const j=F;return j&&(j.result!==void 0||!!j.error)&&(t.string(j.id)||t.number(j.id)||j.id===null)}h.isResponse=P}(e.Message||(e.Message={}))}(Bi)),Bi}var Xi={},qa;function Na(){return qa||(qa=1,function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=e.LinkedMap=e.Touch=void 0;var n;(function(o){o.None=0,o.First=1,o.AsOld=o.First,o.Last=2,o.AsNew=o.Last})(n=e.Touch||(e.Touch={}));class r{constructor(){this[t]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(s){return this._map.has(s)}get(s,a=n.None){const c=this._map.get(s);if(!!c)return a!==n.None&&this.touch(c,a),c.value}set(s,a,c=n.None){let l=this._map.get(s);if(l)l.value=a,c!==n.None&&this.touch(l,c);else{switch(l={key:s,value:a,next:void 0,previous:void 0},c){case n.None:this.addItemLast(l);break;case n.First:this.addItemFirst(l);break;case n.Last:this.addItemLast(l);break;default:this.addItemLast(l);break}this._map.set(s,l),this._size++}return this}delete(s){return!!this.remove(s)}remove(s){const a=this._map.get(s);if(!!a)return this._map.delete(s),this.removeItem(a),this._size--,a.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const s=this._head;return this._map.delete(s.key),this.removeItem(s),this._size--,s.value}forEach(s,a){const c=this._state;let l=this._head;for(;l;){if(a?s.bind(a)(l.value,l.key,this):s(l.value,l.key,this),this._state!==c)throw new Error("LinkedMap got modified during iteration.");l=l.next}}keys(){const s=this._state;let a=this._head;const c={[Symbol.iterator]:()=>c,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(a){const l={value:a.key,done:!1};return a=a.next,l}else return{value:void 0,done:!0}}};return c}values(){const s=this._state;let a=this._head;const c={[Symbol.iterator]:()=>c,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(a){const l={value:a.value,done:!1};return a=a.next,l}else return{value:void 0,done:!0}}};return c}entries(){const s=this._state;let a=this._head;const c={[Symbol.iterator]:()=>c,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(a){const l={value:[a.key,a.value],done:!1};return a=a.next,l}else return{value:void 0,done:!0}}};return c}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(s){if(s>=this.size)return;if(s===0){this.clear();return}let a=this._head,c=this.size;for(;a&&c>s;)this._map.delete(a.key),a=a.next,c--;this._head=a,this._size=c,a&&(a.previous=void 0),this._state++}addItemFirst(s){if(!this._head&&!this._tail)this._tail=s;else if(this._head)s.next=this._head,this._head.previous=s;else throw new Error("Invalid list");this._head=s,this._state++}addItemLast(s){if(!this._head&&!this._tail)this._head=s;else if(this._tail)s.previous=this._tail,this._tail.next=s;else throw new Error("Invalid list");this._tail=s,this._state++}removeItem(s){if(s===this._head&&s===this._tail)this._head=void 0,this._tail=void 0;else if(s===this._head){if(!s.next)throw new Error("Invalid list");s.next.previous=void 0,this._head=s.next}else if(s===this._tail){if(!s.previous)throw new Error("Invalid list");s.previous.next=void 0,this._tail=s.previous}else{const a=s.next,c=s.previous;if(!a||!c)throw new Error("Invalid list");a.previous=c,c.next=a}s.next=void 0,s.previous=void 0,this._state++}touch(s,a){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(a!==n.First&&a!==n.Last)){if(a===n.First){if(s===this._head)return;const c=s.next,l=s.previous;s===this._tail?(l.next=void 0,this._tail=l):(c.previous=l,l.next=c),s.previous=void 0,s.next=this._head,this._head.previous=s,this._head=s,this._state++}else if(a===n.Last){if(s===this._tail)return;const c=s.next,l=s.previous;s===this._head?(c.previous=void 0,this._head=c):(c.previous=l,l.next=c),s.next=void 0,s.previous=this._tail,this._tail.next=s,this._tail=s,this._state++}}}toJSON(){const s=[];return this.forEach((a,c)=>{s.push([c,a])}),s}fromJSON(s){this.clear();for(const[a,c]of s)this.set(a,c)}}e.LinkedMap=r;class i extends r{constructor(s,a=1){super(),this._limit=s,this._ratio=Math.min(Math.max(0,a),1)}get limit(){return this._limit}set limit(s){this._limit=s,this.checkTrim()}get ratio(){return this._ratio}set ratio(s){this._ratio=Math.min(Math.max(0,s),1),this.checkTrim()}get(s,a=n.AsNew){return super.get(s,a)}peek(s){return super.get(s,n.None)}set(s,a){return super.set(s,a,n.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}e.LRUCache=i}(Xi)),Xi}var on={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;const t=Tt;(function(i){const o={dispose(){}};i.None=function(){return o}})(e.Event||(e.Event={}));class n{add(o,s=null,a){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(o),this._contexts.push(s),Array.isArray(a)&&a.push({dispose:()=>this.remove(o,s)})}remove(o,s=null){if(!this._callbacks)return;let a=!1;for(let c=0,l=this._callbacks.length;c{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(o,s);const c={dispose:()=>{!this._callbacks||(this._callbacks.remove(o,s),c.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(a)&&a.push(c),c}),this._event}fire(o){this._callbacks&&this._callbacks.invoke.call(this._callbacks,o)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}e.Emitter=r,r._noop=function(){}})(on);var Ji={},$a;function La(){return $a||($a=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;const t=Tt,n=Pn(),r=on;var i;(function(c){c.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:r.Event.None}),c.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r.Event.None});function l(m){const g=m;return g&&(g===c.None||g===c.Cancelled||n.boolean(g.isCancellationRequested)&&!!g.onCancellationRequested)}c.is=l})(i=e.CancellationToken||(e.CancellationToken={}));const o=Object.freeze(function(c,l){const m=(0,t.default)().timer.setTimeout(c.bind(l),0);return{dispose(){m.dispose()}}});class s{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?o:(this._emitter||(this._emitter=new r.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class a{get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=i.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=i.None}}e.CancellationTokenSource=a}(Ji)),Ji}var Qi={},Ma;function Xd(){return Ma||(Ma=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;const t=Tt,n=Pn(),r=on;(function(a){function c(l){let m=l;return m&&n.func(m.listen)&&n.func(m.dispose)&&n.func(m.onError)&&n.func(m.onClose)&&n.func(m.onPartialMessage)}a.is=c})(e.MessageReader||(e.MessageReader={}));class i{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter,this.partialMessageEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(c){this.errorEmitter.fire(this.asError(c))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(c){this.partialMessageEmitter.fire(c)}asError(c){return c instanceof Error?c:new Error(`Reader received error. Reason: ${n.string(c.message)?c.message:"unknown"}`)}}e.AbstractMessageReader=i;var o;(function(a){function c(l){let m,g;const d=new Map;let f;const y=new Map;if(l===void 0||typeof l=="string")m=l??"utf-8";else{if(m=l.charset??"utf-8",l.contentDecoder!==void 0&&(g=l.contentDecoder,d.set(g.name,g)),l.contentDecoders!==void 0)for(const L of l.contentDecoders)d.set(L.name,L);if(l.contentTypeDecoder!==void 0&&(f=l.contentTypeDecoder,y.set(f.name,f)),l.contentTypeDecoders!==void 0)for(const L of l.contentTypeDecoders)y.set(L.name,L)}return f===void 0&&(f=(0,t.default)().applicationJson.decoder,y.set(f.name,f)),{charset:m,contentDecoder:g,contentDecoders:d,contentTypeDecoder:f,contentTypeDecoders:y}}a.fromOptions=c})(o||(o={}));class s extends i{constructor(c,l){super(),this.readable=c,this.options=o.fromOptions(l),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0}set partialMessageTimeout(c){this._partialMessageTimeout=c}get partialMessageTimeout(){return this._partialMessageTimeout}listen(c){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=c;const l=this.readable.onData(m=>{this.onData(m)});return this.readable.onError(m=>this.fireError(m)),this.readable.onClose(()=>this.fireClose()),l}onData(c){for(this.buffer.append(c);;){if(this.nextMessageLength===-1){const g=this.buffer.tryReadHeaders();if(!g)return;const d=g.get("Content-Length");if(!d)throw new Error("Header must provide a Content-Length property.");const f=parseInt(d);if(isNaN(f))throw new Error("Content-Length value must be a number.");this.nextMessageLength=f}const l=this.buffer.tryReadBody(this.nextMessageLength);if(l===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1;let m;this.options.contentDecoder!==void 0?m=this.options.contentDecoder.decode(l):m=Promise.resolve(l),m.then(g=>{this.options.contentTypeDecoder.decode(g,this.options).then(d=>{this.callback(d)},d=>{this.fireError(d)})},g=>{this.fireError(g)})}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((c,l)=>{this.partialMessageTimer=void 0,c===this.messageToken&&(this.firePartialMessage({messageToken:c,waitingTime:l}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}e.ReadableStreamMessageReader=s}(Qi)),Qi}var Yi={},En={},Aa;function Jd(){if(Aa)return En;Aa=1,Object.defineProperty(En,"__esModule",{value:!0}),En.Semaphore=void 0;const e=Tt;class t{constructor(r=1){if(r<=0)throw new Error("Capacity must be greater than 0");this._capacity=r,this._active=0,this._waiting=[]}lock(r){return new Promise((i,o)=>{this._waiting.push({thunk:r,resolve:i,reject:o}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,e.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;const r=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const i=r.thunk();i instanceof Promise?i.then(o=>{this._active--,r.resolve(o),this.runNext()},o=>{this._active--,r.reject(o),this.runNext()}):(this._active--,r.resolve(i),this.runNext())}catch(i){this._active--,r.reject(i),this.runNext()}}}return En.Semaphore=t,En}var ja;function Qd(){return ja||(ja=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;const t=Tt,n=Pn(),r=Jd(),i=on,o="Content-Length: ",s=`\r `;(function(m){function g(d){let f=d;return f&&n.func(f.dispose)&&n.func(f.onClose)&&n.func(f.onError)&&n.func(f.write)}m.is=g})(e.MessageWriter||(e.MessageWriter={}));class a{constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(g,d,f){this.errorEmitter.fire([this.asError(g),d,f])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(g){return g instanceof Error?g:new Error(`Writer received error. Reason: ${n.string(g.message)?g.message:"unknown"}`)}}e.AbstractMessageWriter=a;var c;(function(m){function g(d){return d===void 0||typeof d=="string"?{charset:d??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:d.charset??"utf-8",contentEncoder:d.contentEncoder,contentTypeEncoder:d.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}m.fromOptions=g})(c||(c={}));class l extends a{constructor(g,d){super(),this.writable=g,this.options=c.fromOptions(d),this.errorCount=0,this.writeSemaphore=new r.Semaphore(1),this.writable.onError(f=>this.fireError(f)),this.writable.onClose(()=>this.fireClose())}async write(g){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(g,this.options).then(f=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(f):f).then(f=>{const y=[];return y.push(o,f.byteLength.toString(),s),y.push(s),this.doWrite(g,y,f)},f=>{throw this.fireError(f),f}))}async doWrite(g,d,f){try{return await this.writable.write(d.join(""),"ascii"),this.writable.write(f)}catch(y){return this.handleError(y,g),Promise.reject(y)}}handleError(g,d){this.errorCount++,this.fireError(g,d,this.errorCount)}end(){this.writable.end()}}e.WriteableStreamMessageWriter=l}(Yi)),Yi}var Zi={},Ha;function Yd(){return Ha||(Ha=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;const t=Tt,n=Pn(),r=Ia(),i=Na(),o=on,s=La();var a;(function(S){S.type=new r.NotificationType("$/cancelRequest")})(a||(a={}));var c;(function(S){function N(O){return typeof O=="string"||typeof O=="number"}S.is=N})(c=e.ProgressToken||(e.ProgressToken={}));var l;(function(S){S.type=new r.NotificationType("$/progress")})(l||(l={}));class m{constructor(){}}e.ProgressType=m;var g;(function(S){function N(O){return n.func(O)}S.is=N})(g||(g={})),e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var d;(function(S){S[S.Off=0]="Off",S[S.Messages=1]="Messages",S[S.Compact=2]="Compact",S[S.Verbose=3]="Verbose"})(d=e.Trace||(e.Trace={})),function(S){S.Off="off",S.Messages="messages",S.Compact="compact",S.Verbose="verbose"}(e.TraceValues||(e.TraceValues={})),function(S){function N(C){if(!n.string(C))return S.Off;switch(C=C.toLowerCase(),C){case"off":return S.Off;case"messages":return S.Messages;case"compact":return S.Compact;case"verbose":return S.Verbose;default:return S.Off}}S.fromString=N;function O(C){switch(C){case S.Off:return"off";case S.Messages:return"messages";case S.Compact:return"compact";case S.Verbose:return"verbose";default:return"off"}}S.toString=O}(d=e.Trace||(e.Trace={}));var f;(function(S){S.Text="text",S.JSON="json"})(f=e.TraceFormat||(e.TraceFormat={})),function(S){function N(O){return n.string(O)?(O=O.toLowerCase(),O==="json"?S.JSON:S.Text):S.Text}S.fromString=N}(f=e.TraceFormat||(e.TraceFormat={}));var y;(function(S){S.type=new r.NotificationType("$/setTrace")})(y=e.SetTraceNotification||(e.SetTraceNotification={}));var L;(function(S){S.type=new r.NotificationType("$/logTrace")})(L=e.LogTraceNotification||(e.LogTraceNotification={}));var M;(function(S){S[S.Closed=1]="Closed",S[S.Disposed=2]="Disposed",S[S.AlreadyListening=3]="AlreadyListening"})(M=e.ConnectionErrors||(e.ConnectionErrors={}));class x extends Error{constructor(N,O){super(O),this.code=N,Object.setPrototypeOf(this,x.prototype)}}e.ConnectionError=x;var b;(function(S){function N(O){const C=O;return C&&n.func(C.cancelUndispatched)}S.is=N})(b=e.ConnectionStrategy||(e.ConnectionStrategy={}));var E;(function(S){S.Message=Object.freeze({createCancellationTokenSource(O){return new s.CancellationTokenSource}});function N(O){const C=O;return C&&n.func(C.createCancellationTokenSource)}S.is=N})(E=e.CancellationReceiverStrategy||(e.CancellationReceiverStrategy={}));var w;(function(S){S.Message=Object.freeze({sendCancellation(O,C){return O.sendNotification(a.type,{id:C})},cleanup(O){}});function N(O){const C=O;return C&&n.func(C.sendCancellation)&&n.func(C.cleanup)}S.is=N})(w=e.CancellationSenderStrategy||(e.CancellationSenderStrategy={}));var $;(function(S){S.Message=Object.freeze({receiver:E.Message,sender:w.Message});function N(O){const C=O;return C&&E.is(C.receiver)&&w.is(C.sender)}S.is=N})($=e.CancellationStrategy||(e.CancellationStrategy={})),function(S){function N(O){const C=O;return C&&($.is(C.cancellationStrategy)||b.is(C.connectionStrategy))}S.is=N}(e.ConnectionOptions||(e.ConnectionOptions={}));var H;(function(S){S[S.New=1]="New",S[S.Listening=2]="Listening",S[S.Closed=3]="Closed",S[S.Disposed=4]="Disposed"})(H||(H={}));function T(S,N,O,C){const h=O!==void 0?O:e.NullLogger;let k=0,W=0,P=0;const F="2.0";let j;const G=new Map;let X;const ie=new Map,ce=new Map;let Y,oe=new i.LinkedMap,Z=new Map,se=new Set,re=new Map,be=d.Off,Be=f.Text,Fe,xe=H.New;const dt=new o.Emitter,at=new o.Emitter,fe=new o.Emitter,et=new o.Emitter,wt=new o.Emitter,mt=C&&C.cancellationStrategy?C.cancellationStrategy:$.Message;function tt(v){if(v===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+v.toString()}function ae(v){return v===null?"res-unknown-"+(++P).toString():"res-"+v.toString()}function _(){return"not-"+(++W).toString()}function I(v,z){r.Message.isRequest(z)?v.set(tt(z.id),z):r.Message.isResponse(z)?v.set(ae(z.id),z):v.set(_(),z)}function D(v){}function V(){return xe===H.Listening}function K(){return xe===H.Closed}function B(){return xe===H.Disposed}function ue(){(xe===H.New||xe===H.Listening)&&(xe=H.Closed,at.fire(void 0))}function Ce(v){dt.fire([v,void 0,void 0])}function Ie(v){dt.fire(v)}S.onClose(ue),S.onError(Ce),N.onClose(ue),N.onError(Ie);function Le(){Y||oe.size===0||(Y=(0,t.default)().timer.setImmediate(()=>{Y=void 0,bt()}))}function bt(){if(oe.size===0)return;const v=oe.shift();try{r.Message.isRequest(v)?Rn(v):r.Message.isNotification(v)?Zt(v):r.Message.isResponse(v)?Yt(v):wn(v)}finally{Le()}}const qt=v=>{try{if(r.Message.isNotification(v)&&v.method===a.type.method){const z=v.params.id,J=tt(z),ne=oe.get(J);if(r.Message.isRequest(ne)){const Ne=C?.connectionStrategy,Ae=Ne&&Ne.cancelUndispatched?Ne.cancelUndispatched(ne,D):void 0;if(Ae&&(Ae.error!==void 0||Ae.result!==void 0)){oe.delete(J),re.delete(z),Ae.id=ne.id,St(Ae,v.method,Date.now()),N.write(Ae).catch(()=>h.error("Sending response for canceled message failed."));return}}const qe=re.get(z);if(qe!==void 0){qe.cancel(),A(v);return}else se.add(z)}I(oe,v)}finally{Le()}};function Rn(v){if(B())return;function z(Re,Me,Pe){const u={jsonrpc:F,id:v.id};Re instanceof r.ResponseError?u.error=Re.toJson():u.result=Re===void 0?null:Re,St(u,Me,Pe),N.write(u).catch(()=>h.error("Sending response failed."))}function J(Re,Me,Pe){const u={jsonrpc:F,id:v.id,error:Re.toJson()};St(u,Me,Pe),N.write(u).catch(()=>h.error("Sending response failed."))}function ne(Re,Me,Pe){Re===void 0&&(Re=null);const u={jsonrpc:F,id:v.id,result:Re};St(u,Me,Pe),N.write(u).catch(()=>h.error("Sending response failed."))}p(v);const qe=G.get(v.method);let Ne,Ae;qe&&(Ne=qe.type,Ae=qe.handler);const ze=Date.now();if(Ae||j){const Re=v.id??String(Date.now()),Me=mt.receiver.createCancellationTokenSource(Re);v.id!==null&&se.has(v.id)&&Me.cancel(),v.id!==null&&re.set(Re,Me);try{let Pe;if(Ae)if(v.params===void 0){if(Ne!==void 0&&Ne.numberOfParams!==0){J(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${v.method} defines ${Ne.numberOfParams} params but received none.`),v.method,ze);return}Pe=Ae(Me.token)}else if(Array.isArray(v.params)){if(Ne!==void 0&&Ne.parameterStructures===r.ParameterStructures.byName){J(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${v.method} defines parameters by name but received parameters by position`),v.method,ze);return}Pe=Ae(...v.params,Me.token)}else{if(Ne!==void 0&&Ne.parameterStructures===r.ParameterStructures.byPosition){J(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${v.method} defines parameters by position but received parameters by name`),v.method,ze);return}Pe=Ae(v.params,Me.token)}else j&&(Pe=j(v.method,v.params,Me.token));const u=Pe;Pe?u.then?u.then(R=>{re.delete(Re),z(R,v.method,ze)},R=>{re.delete(Re),R instanceof r.ResponseError?J(R,v.method,ze):R&&n.string(R.message)?J(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${v.method} failed with message: ${R.message}`),v.method,ze):J(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${v.method} failed unexpectedly without providing any details.`),v.method,ze)}):(re.delete(Re),z(Pe,v.method,ze)):(re.delete(Re),ne(Pe,v.method,ze))}catch(Pe){re.delete(Re),Pe instanceof r.ResponseError?z(Pe,v.method,ze):Pe&&n.string(Pe.message)?J(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${v.method} failed with message: ${Pe.message}`),v.method,ze):J(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${v.method} failed unexpectedly without providing any details.`),v.method,ze)}}else J(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${v.method}`),v.method,ze)}function Yt(v){if(!B())if(v.id===null)v.error?h.error(`Received response message without id: Error is: ${JSON.stringify(v.error,void 0,4)}`):h.error("Received response message without id. No further error information provided.");else{const z=v.id,J=Z.get(z);if(te(v,J),J!==void 0){Z.delete(z);try{if(v.error){const ne=v.error;J.reject(new r.ResponseError(ne.code,ne.message,ne.data))}else if(v.result!==void 0)J.resolve(v.result);else throw new Error("Should never happen.")}catch(ne){ne.message?h.error(`Response handler '${J.method}' failed with message: ${ne.message}`):h.error(`Response handler '${J.method}' failed unexpectedly.`)}}}}function Zt(v){if(B())return;let z,J;if(v.method===a.type.method){const ne=v.params.id;se.delete(ne),A(v);return}else{const ne=ie.get(v.method);ne&&(J=ne.handler,z=ne.type)}if(J||X)try{if(A(v),J)if(v.params===void 0)z!==void 0&&z.numberOfParams!==0&&z.parameterStructures!==r.ParameterStructures.byName&&h.error(`Notification ${v.method} defines ${z.numberOfParams} params but received none.`),J();else if(Array.isArray(v.params)){const ne=v.params;v.method===l.type.method&&ne.length===2&&c.is(ne[0])?J({token:ne[0],value:ne[1]}):(z!==void 0&&(z.parameterStructures===r.ParameterStructures.byName&&h.error(`Notification ${v.method} defines parameters by name but received parameters by position`),z.numberOfParams!==v.params.length&&h.error(`Notification ${v.method} defines ${z.numberOfParams} params but received ${ne.length} arguments`)),J(...ne))}else z!==void 0&&z.parameterStructures===r.ParameterStructures.byPosition&&h.error(`Notification ${v.method} defines parameters by position but received parameters by name`),J(v.params);else X&&X(v.method,v.params)}catch(ne){ne.message?h.error(`Notification handler '${v.method}' failed with message: ${ne.message}`):h.error(`Notification handler '${v.method}' failed unexpectedly.`)}else fe.fire(v)}function wn(v){if(!v){h.error("Received empty message.");return}h.error(`Received message which is neither a response nor a notification message: ${JSON.stringify(v,null,4)}`);const z=v;if(n.string(z.id)||n.number(z.id)){const J=z.id,ne=Z.get(J);ne&&ne.reject(new Error("The received response has neither a result nor an error property."))}}function ct(v){if(v!=null)switch(be){case d.Verbose:return JSON.stringify(v,null,4);case d.Compact:return JSON.stringify(v);default:return}}function bn(v){if(!(be===d.Off||!Fe))if(Be===f.Text){let z;(be===d.Verbose||be===d.Compact)&&v.params&&(z=`Params: ${ct(v.params)} `),Fe.log(`Sending request '${v.method} - (${v.id})'.`,z)}else _e("send-request",v)}function en(v){if(!(be===d.Off||!Fe))if(Be===f.Text){let z;(be===d.Verbose||be===d.Compact)&&(v.params?z=`Params: ${ct(v.params)} `:z=`No parameters provided. `),Fe.log(`Sending notification '${v.method}'.`,z)}else _e("send-notification",v)}function St(v,z,J){if(!(be===d.Off||!Fe))if(Be===f.Text){let ne;(be===d.Verbose||be===d.Compact)&&(v.error&&v.error.data?ne=`Error data: ${ct(v.error.data)} `:v.result?ne=`Result: ${ct(v.result)} `:v.error===void 0&&(ne=`No result returned. `)),Fe.log(`Sending response '${z} - (${v.id})'. Processing request took ${Date.now()-J}ms`,ne)}else _e("send-response",v)}function p(v){if(!(be===d.Off||!Fe))if(Be===f.Text){let z;(be===d.Verbose||be===d.Compact)&&v.params&&(z=`Params: ${ct(v.params)} `),Fe.log(`Received request '${v.method} - (${v.id})'.`,z)}else _e("receive-request",v)}function A(v){if(!(be===d.Off||!Fe||v.method===L.type.method))if(Be===f.Text){let z;(be===d.Verbose||be===d.Compact)&&(v.params?z=`Params: ${ct(v.params)} `:z=`No parameters provided. `),Fe.log(`Received notification '${v.method}'.`,z)}else _e("receive-notification",v)}function te(v,z){if(!(be===d.Off||!Fe))if(Be===f.Text){let J;if((be===d.Verbose||be===d.Compact)&&(v.error&&v.error.data?J=`Error data: ${ct(v.error.data)} `:v.result?J=`Result: ${ct(v.result)} `:v.error===void 0&&(J=`No result returned. `)),z){const ne=v.error?` Request failed: ${v.error.message} (${v.error.code}).`:"";Fe.log(`Received response '${z.method} - (${v.id})' in ${Date.now()-z.timerStart}ms.${ne}`,J)}else Fe.log(`Received response ${v.id} without active response promise.`,J)}else _e("receive-response",v)}function _e(v,z){if(!Fe||be===d.Off)return;const J={isLSPMessage:!0,type:v,message:z,timestamp:Date.now()};Fe.log(J)}function ve(){if(K())throw new x(M.Closed,"Connection is closed.");if(B())throw new x(M.Disposed,"Connection is disposed.")}function Ge(){if(V())throw new x(M.AlreadyListening,"Connection is already listening")}function yt(){if(!V())throw new Error("Call listen() first.")}function vt(v){return v===void 0?null:v}function Yn(v){if(v!==null)return v}function Ht(v){return v!=null&&!Array.isArray(v)&&typeof v=="object"}function Sn(v,z){switch(v){case r.ParameterStructures.auto:return Ht(z)?Yn(z):[vt(z)];case r.ParameterStructures.byName:if(!Ht(z))throw new Error("Received parameters by name but param is not an object literal.");return Yn(z);case r.ParameterStructures.byPosition:return[vt(z)];default:throw new Error(`Unknown parameter structure ${v.toString()}`)}}function Dn(v,z){let J;const ne=v.numberOfParams;switch(ne){case 0:J=void 0;break;case 1:J=Sn(v.parameterStructures,z[0]);break;default:J=[];for(let qe=0;qe{ve();let J,ne;if(n.string(v)){J=v;const Ne=z[0];let Ae=0,ze=r.ParameterStructures.auto;r.ParameterStructures.is(Ne)&&(Ae=1,ze=Ne);let Re=z.length;const Me=Re-Ae;switch(Me){case 0:ne=void 0;break;case 1:ne=Sn(ze,z[Ae]);break;default:if(ze===r.ParameterStructures.byName)throw new Error(`Received ${Me} parameters for 'by Name' notification parameter structure.`);ne=z.slice(Ae,Re).map(Pe=>vt(Pe));break}}else{const Ne=z;J=v.method,ne=Dn(v,Ne)}const qe={jsonrpc:F,method:J,params:ne};return en(qe),N.write(qe).catch(()=>h.error("Sending notification failed."))},onNotification:(v,z)=>{ve();let J;return n.func(v)?X=v:z&&(n.string(v)?(J=v,ie.set(v,{type:void 0,handler:z})):(J=v.method,ie.set(v.method,{type:v,handler:z}))),{dispose:()=>{J!==void 0?ie.delete(J):X=void 0}}},onProgress:(v,z,J)=>{if(ce.has(z))throw new Error(`Progress handler for token ${z} already registered`);return ce.set(z,J),{dispose:()=>{ce.delete(z)}}},sendProgress:(v,z,J)=>Nt.sendNotification(l.type,{token:z,value:J}),onUnhandledProgress:et.event,sendRequest:(v,...z)=>{ve(),yt();let J,ne,qe;if(n.string(v)){J=v;const Re=z[0],Me=z[z.length-1];let Pe=0,u=r.ParameterStructures.auto;r.ParameterStructures.is(Re)&&(Pe=1,u=Re);let R=z.length;s.CancellationToken.is(Me)&&(R=R-1,qe=Me);const U=R-Pe;switch(U){case 0:ne=void 0;break;case 1:ne=Sn(u,z[Pe]);break;default:if(u===r.ParameterStructures.byName)throw new Error(`Received ${U} parameters for 'by Name' request parameter structure.`);ne=z.slice(Pe,R).map(ee=>vt(ee));break}}else{const Re=z;J=v.method,ne=Dn(v,Re);const Me=v.numberOfParams;qe=s.CancellationToken.is(Re[Me])?Re[Me]:void 0}const Ne=k++;let Ae;return qe&&(Ae=qe.onCancellationRequested(()=>{const Re=mt.sender.sendCancellation(Nt,Ne);return Re===void 0?(h.log(`Received no promise from cancellation strategy when cancelling id ${Ne}`),Promise.resolve()):Re.catch(()=>{h.log(`Sending cancellation messages for id ${Ne} failed`)})})),new Promise((Re,Me)=>{const Pe={jsonrpc:F,id:Ne,method:J,params:ne},u=ee=>{Re(ee),mt.sender.cleanup(Ne),Ae?.dispose()},R=ee=>{Me(ee),mt.sender.cleanup(Ne),Ae?.dispose()};let U={method:J,timerStart:Date.now(),resolve:u,reject:R};bn(Pe);try{N.write(Pe).catch(()=>h.error("Sending request failed."))}catch(ee){U.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,ee.message?ee.message:"Unknown reason")),U=null}U&&Z.set(Ne,U)})},onRequest:(v,z)=>{ve();let J=null;return g.is(v)?(J=void 0,j=v):n.string(v)?(J=null,z!==void 0&&(J=v,G.set(v,{handler:z,type:void 0}))):z!==void 0&&(J=v.method,G.set(v.method,{type:v,handler:z})),{dispose:()=>{J!==null&&(J!==void 0?G.delete(J):j=void 0)}}},hasPendingResponse:()=>Z.size>0,trace:async(v,z,J)=>{let ne=!1,qe=f.Text;J!==void 0&&(n.boolean(J)?ne=J:(ne=J.sendNotification||!1,qe=J.traceFormat||f.Text)),be=v,Be=qe,be===d.Off?Fe=void 0:Fe=z,ne&&!K()&&!B()&&await Nt.sendNotification(y.type,{value:d.toString(v)})},onError:dt.event,onClose:at.event,onUnhandledNotification:fe.event,onDispose:wt.event,end:()=>{N.end()},dispose:()=>{if(B())return;xe=H.Disposed,wt.fire(void 0);const v=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const z of Z.values())z.reject(v);Z=new Map,re=new Map,se=new Set,oe=new i.LinkedMap,n.func(N.dispose)&&N.dispose(),n.func(S.dispose)&&S.dispose()},listen:()=>{ve(),Ge(),xe=H.Listening,S.listen(qt)},inspect:()=>{(0,t.default)().console.log("inspect")}};return Nt.onNotification(L.type,v=>{if(be===d.Off||!Fe)return;const z=be===d.Verbose||be===d.Compact;Fe.log(v.message,z?v.verbose:void 0)}),Nt.onNotification(l.type,v=>{const z=ce.get(v.token);z?z(v.value):et.fire(v)}),Nt}e.createMessageConnection=T}(Zi)),Zi}var Wa;function Ua(){return Wa||(Wa=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TraceFormat=e.TraceValues=e.Trace=e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=void 0;const t=Ia();Object.defineProperty(e,"Message",{enumerable:!0,get:function(){return t.Message}}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:function(){return t.RequestType}}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:function(){return t.RequestType0}}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:function(){return t.RequestType1}}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:function(){return t.RequestType2}}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:function(){return t.RequestType3}}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:function(){return t.RequestType4}}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:function(){return t.RequestType5}}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:function(){return t.RequestType6}}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:function(){return t.RequestType7}}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:function(){return t.RequestType8}}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:function(){return t.RequestType9}}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:function(){return t.ResponseError}}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:function(){return t.ErrorCodes}}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:function(){return t.NotificationType}}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:function(){return t.NotificationType0}}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:function(){return t.NotificationType1}}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:function(){return t.NotificationType2}}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:function(){return t.NotificationType3}}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:function(){return t.NotificationType4}}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:function(){return t.NotificationType5}}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:function(){return t.NotificationType6}}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:function(){return t.NotificationType7}}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:function(){return t.NotificationType8}}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:function(){return t.NotificationType9}}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:function(){return t.ParameterStructures}});const n=Na();Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(e,"Touch",{enumerable:!0,get:function(){return n.Touch}});const r=Ki;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const i=on;Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});const o=La();Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:function(){return o.CancellationTokenSource}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return o.CancellationToken}});const s=Xd();Object.defineProperty(e,"MessageReader",{enumerable:!0,get:function(){return s.MessageReader}}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:function(){return s.AbstractMessageReader}}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return s.ReadableStreamMessageReader}});const a=Qd();Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:function(){return a.MessageWriter}}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:function(){return a.AbstractMessageWriter}}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return a.WriteableStreamMessageWriter}});const c=Yd();Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:function(){return c.ConnectionStrategy}}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:function(){return c.ConnectionOptions}}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:function(){return c.NullLogger}}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:function(){return c.createMessageConnection}}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:function(){return c.ProgressToken}}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:function(){return c.ProgressType}}),Object.defineProperty(e,"Trace",{enumerable:!0,get:function(){return c.Trace}}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:function(){return c.TraceValues}}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:function(){return c.TraceFormat}}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:function(){return c.SetTraceNotification}}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:function(){return c.LogTraceNotification}}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:function(){return c.ConnectionErrors}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return c.ConnectionError}}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return c.CancellationReceiverStrategy}}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:function(){return c.CancellationSenderStrategy}}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:function(){return c.CancellationStrategy}});const l=Tt;e.RAL=l.default}(Vi)),Vi}(function(e){var t=He.commonjsGlobal&&He.commonjsGlobal.__createBinding||(Object.create?function(N,O,C,h){h===void 0&&(h=C);var k=Object.getOwnPropertyDescriptor(O,C);(!k||("get"in k?!O.__esModule:k.writable||k.configurable))&&(k={enumerable:!0,get:function(){return O[C]}}),Object.defineProperty(N,h,k)}:function(N,O,C,h){h===void 0&&(h=C),N[h]=O[C]}),n=He.commonjsGlobal&&He.commonjsGlobal.__exportStar||function(N,O){for(var C in N)C!=="default"&&!Object.prototype.hasOwnProperty.call(O,C)&&t(O,N,C)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.createServerSocketTransport=e.createClientSocketTransport=e.createServerPipeTransport=e.createClientPipeTransport=e.generateRandomPipeName=e.StreamMessageWriter=e.StreamMessageReader=e.SocketMessageWriter=e.SocketMessageReader=e.IPCMessageWriter=e.IPCMessageReader=void 0;const r=Ui;r.default.install();const i=Ua(),o=er.default,s=vu.default,a=Cu.default,c=_u.default;n(Ua(),e);class l extends i.AbstractMessageReader{constructor(O){super(),this.process=O;let C=this.process;C.on("error",h=>this.fireError(h)),C.on("close",()=>this.fireClose())}listen(O){return this.process.on("message",O),i.Disposable.create(()=>this.process.off("message",O))}}e.IPCMessageReader=l;class m extends i.AbstractMessageWriter{constructor(O){super(),this.process=O,this.errorCount=0;let C=this.process;C.on("error",h=>this.fireError(h)),C.on("close",()=>this.fireClose)}write(O){try{return typeof this.process.send=="function"&&this.process.send(O,void 0,void 0,C=>{C?(this.errorCount++,this.handleError(C,O)):this.errorCount=0}),Promise.resolve()}catch(C){return this.handleError(C,O),Promise.reject(C)}}handleError(O,C){this.errorCount++,this.fireError(O,C,this.errorCount)}end(){}}e.IPCMessageWriter=m;class g extends i.ReadableStreamMessageReader{constructor(O,C="utf-8"){super((0,r.default)().stream.asReadableStream(O),C)}}e.SocketMessageReader=g;class d extends i.WriteableStreamMessageWriter{constructor(O,C){super((0,r.default)().stream.asWritableStream(O),C),this.socket=O}dispose(){super.dispose(),this.socket.destroy()}}e.SocketMessageWriter=d;class f extends i.ReadableStreamMessageReader{constructor(O,C){super((0,r.default)().stream.asReadableStream(O),C)}}e.StreamMessageReader=f;class y extends i.WriteableStreamMessageWriter{constructor(O,C){super((0,r.default)().stream.asWritableStream(O),C)}}e.StreamMessageWriter=y;const L=process.env.XDG_RUNTIME_DIR,M=new Map([["linux",107],["darwin",103]]);function x(){const N=(0,a.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${N}-sock`;let O;L?O=o.join(L,`vscode-ipc-${N}.sock`):O=o.join(s.tmpdir(),`vscode-${N}.sock`);const C=M.get(process.platform);return C!==void 0&&O.length>=C&&(0,r.default)().console.warn(`WARNING: IPC handle "${O}" is longer than ${C} characters.`),O}e.generateRandomPipeName=x;function b(N,O="utf-8"){let C;const h=new Promise((k,W)=>{C=k});return new Promise((k,W)=>{let P=(0,c.createServer)(F=>{P.close(),C([new g(F,O),new d(F,O)])});P.on("error",W),P.listen(N,()=>{P.removeListener("error",W),k({onConnected:()=>h})})})}e.createClientPipeTransport=b;function E(N,O="utf-8"){const C=(0,c.createConnection)(N);return[new g(C,O),new d(C,O)]}e.createServerPipeTransport=E;function w(N,O="utf-8"){let C;const h=new Promise((k,W)=>{C=k});return new Promise((k,W)=>{const P=(0,c.createServer)(F=>{P.close(),C([new g(F,O),new d(F,O)])});P.on("error",W),P.listen(N,"127.0.0.1",()=>{P.removeListener("error",W),k({onConnected:()=>h})})})}e.createClientSocketTransport=w;function $(N,O="utf-8"){const C=(0,c.createConnection)(N,"127.0.0.1");return[new g(C,O),new d(C,O)]}e.createServerSocketTransport=$;function H(N){const O=N;return O.read!==void 0&&O.addListener!==void 0}function T(N){const O=N;return O.write!==void 0&&O.addListener!==void 0}function S(N,O,C,h){C||(C=i.NullLogger);const k=H(N)?new f(N):N,W=T(O)?new y(O):O;return i.ConnectionStrategy.is(h)&&(h={connectionStrategy:h}),(0,i.createMessageConnection)(k,W,C,h)}e.createMessageConnection=S})(Wt),function(e){e.exports=Wt}(Wi);var xa={},eo;(function(e){function t(n){return typeof n=="string"}e.is=t})(eo||(eo={}));var hr;(function(e){function t(n){return typeof n=="string"}e.is=t})(hr||(hr={}));var to;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(to||(to={}));var kn;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(kn||(kn={}));var ft;(function(e){function t(r,i){return r===Number.MAX_VALUE&&(r=kn.MAX_VALUE),i===Number.MAX_VALUE&&(i=kn.MAX_VALUE),{line:r,character:i}}e.create=t;function n(r){var i=r;return q.objectLiteral(i)&&q.uinteger(i.line)&&q.uinteger(i.character)}e.is=n})(ft||(ft={}));var We;(function(e){function t(r,i,o,s){if(q.uinteger(r)&&q.uinteger(i)&&q.uinteger(o)&&q.uinteger(s))return{start:ft.create(r,i),end:ft.create(o,s)};if(ft.is(r)&&ft.is(i))return{start:r,end:i};throw new Error("Range#create called with invalid arguments[".concat(r,", ").concat(i,", ").concat(o,", ").concat(s,"]"))}e.create=t;function n(r){var i=r;return q.objectLiteral(i)&&ft.is(i.start)&&ft.is(i.end)}e.is=n})(We||(We={}));var Fn;(function(e){function t(r,i){return{uri:r,range:i}}e.create=t;function n(r){var i=r;return q.defined(i)&&We.is(i.range)&&(q.string(i.uri)||q.undefined(i.uri))}e.is=n})(Fn||(Fn={}));var no;(function(e){function t(r,i,o,s){return{targetUri:r,targetRange:i,targetSelectionRange:o,originSelectionRange:s}}e.create=t;function n(r){var i=r;return q.defined(i)&&We.is(i.targetRange)&&q.string(i.targetUri)&&We.is(i.targetSelectionRange)&&(We.is(i.originSelectionRange)||q.undefined(i.originSelectionRange))}e.is=n})(no||(no={}));var gr;(function(e){function t(r,i,o,s){return{red:r,green:i,blue:o,alpha:s}}e.create=t;function n(r){var i=r;return q.objectLiteral(i)&&q.numberRange(i.red,0,1)&&q.numberRange(i.green,0,1)&&q.numberRange(i.blue,0,1)&&q.numberRange(i.alpha,0,1)}e.is=n})(gr||(gr={}));var ro;(function(e){function t(r,i){return{range:r,color:i}}e.create=t;function n(r){var i=r;return q.objectLiteral(i)&&We.is(i.range)&&gr.is(i.color)}e.is=n})(ro||(ro={}));var io;(function(e){function t(r,i,o){return{label:r,textEdit:i,additionalTextEdits:o}}e.create=t;function n(r){var i=r;return q.objectLiteral(i)&&q.string(i.label)&&(q.undefined(i.textEdit)||Pt.is(i))&&(q.undefined(i.additionalTextEdits)||q.typedArray(i.additionalTextEdits,Pt.is))}e.is=n})(io||(io={}));var oo;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(oo||(oo={}));var so;(function(e){function t(r,i,o,s,a,c){var l={startLine:r,endLine:i};return q.defined(o)&&(l.startCharacter=o),q.defined(s)&&(l.endCharacter=s),q.defined(a)&&(l.kind=a),q.defined(c)&&(l.collapsedText=c),l}e.create=t;function n(r){var i=r;return q.objectLiteral(i)&&q.uinteger(i.startLine)&&q.uinteger(i.startLine)&&(q.undefined(i.startCharacter)||q.uinteger(i.startCharacter))&&(q.undefined(i.endCharacter)||q.uinteger(i.endCharacter))&&(q.undefined(i.kind)||q.string(i.kind))}e.is=n})(so||(so={}));var pr;(function(e){function t(r,i){return{location:r,message:i}}e.create=t;function n(r){var i=r;return q.defined(i)&&Fn.is(i.location)&&q.string(i.message)}e.is=n})(pr||(pr={}));var ao;(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(ao||(ao={}));var co;(function(e){e.Unnecessary=1,e.Deprecated=2})(co||(co={}));var uo;(function(e){function t(n){var r=n;return q.objectLiteral(r)&&q.string(r.href)}e.is=t})(uo||(uo={}));var On;(function(e){function t(r,i,o,s,a,c){var l={range:r,message:i};return q.defined(o)&&(l.severity=o),q.defined(s)&&(l.code=s),q.defined(a)&&(l.source=a),q.defined(c)&&(l.relatedInformation=c),l}e.create=t;function n(r){var i,o=r;return q.defined(o)&&We.is(o.range)&&q.string(o.message)&&(q.number(o.severity)||q.undefined(o.severity))&&(q.integer(o.code)||q.string(o.code)||q.undefined(o.code))&&(q.undefined(o.codeDescription)||q.string((i=o.codeDescription)===null||i===void 0?void 0:i.href))&&(q.string(o.source)||q.undefined(o.source))&&(q.undefined(o.relatedInformation)||q.typedArray(o.relatedInformation,pr.is))}e.is=n})(On||(On={}));var xt;(function(e){function t(r,i){for(var o=[],s=2;s0&&(a.arguments=o),a}e.create=t;function n(r){var i=r;return q.defined(i)&&q.string(i.title)&&q.string(i.command)}e.is=n})(xt||(xt={}));var Pt;(function(e){function t(o,s){return{range:o,newText:s}}e.replace=t;function n(o,s){return{range:{start:o,end:o},newText:s}}e.insert=n;function r(o){return{range:o,newText:""}}e.del=r;function i(o){var s=o;return q.objectLiteral(s)&&q.string(s.newText)&&We.is(s.range)}e.is=i})(Pt||(Pt={}));var zt;(function(e){function t(r,i,o){var s={label:r};return i!==void 0&&(s.needsConfirmation=i),o!==void 0&&(s.description=o),s}e.create=t;function n(r){var i=r;return q.objectLiteral(i)&&q.string(i.label)&&(q.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(q.string(i.description)||i.description===void 0)}e.is=n})(zt||(zt={}));var Qe;(function(e){function t(n){var r=n;return q.string(r)}e.is=t})(Qe||(Qe={}));var Et;(function(e){function t(o,s,a){return{range:o,newText:s,annotationId:a}}e.replace=t;function n(o,s,a){return{range:{start:o,end:o},newText:s,annotationId:a}}e.insert=n;function r(o,s){return{range:o,newText:"",annotationId:s}}e.del=r;function i(o){var s=o;return Pt.is(s)&&(zt.is(s.annotationId)||Qe.is(s.annotationId))}e.is=i})(Et||(Et={}));var In;(function(e){function t(r,i){return{textDocument:r,edits:i}}e.create=t;function n(r){var i=r;return q.defined(i)&&qn.is(i.textDocument)&&Array.isArray(i.edits)}e.is=n})(In||(In={}));var sn;(function(e){function t(r,i,o){var s={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(r){var i=r;return i&&i.kind==="create"&&q.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||q.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||q.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Qe.is(i.annotationId))}e.is=n})(sn||(sn={}));var an;(function(e){function t(r,i,o,s){var a={kind:"rename",oldUri:r,newUri:i};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}e.create=t;function n(r){var i=r;return i&&i.kind==="rename"&&q.string(i.oldUri)&&q.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||q.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||q.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Qe.is(i.annotationId))}e.is=n})(an||(an={}));var cn;(function(e){function t(r,i,o){var s={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(r){var i=r;return i&&i.kind==="delete"&&q.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||q.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||q.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Qe.is(i.annotationId))}e.is=n})(cn||(cn={}));var mr;(function(e){function t(n){var r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(function(i){return q.string(i.kind)?sn.is(i)||an.is(i)||cn.is(i):In.is(i)}))}e.is=t})(mr||(mr={}));var yr=function(){function e(t,n){this.edits=t,this.changeAnnotations=n}return e.prototype.insert=function(t,n,r){var i,o;if(r===void 0?i=Pt.insert(t,n):Qe.is(r)?(o=r,i=Et.insert(t,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(r),i=Et.insert(t,n,o)),this.edits.push(i),o!==void 0)return o},e.prototype.replace=function(t,n,r){var i,o;if(r===void 0?i=Pt.replace(t,n):Qe.is(r)?(o=r,i=Et.replace(t,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(r),i=Et.replace(t,n,o)),this.edits.push(i),o!==void 0)return o},e.prototype.delete=function(t,n){var r,i;if(n===void 0?r=Pt.del(t):Qe.is(n)?(i=n,r=Et.del(t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=Et.del(t,i)),this.edits.push(r),i!==void 0)return i},e.prototype.add=function(t){this.edits.push(t)},e.prototype.all=function(){return this.edits},e.prototype.clear=function(){this.edits.splice(0,this.edits.length)},e.prototype.assertChangeAnnotations=function(t){if(t===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},e}(),za=function(){function e(t){this._annotations=t===void 0?Object.create(null):t,this._counter=0,this._size=0}return e.prototype.all=function(){return this._annotations},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.manage=function(t,n){var r;if(Qe.is(t)?r=t:(r=this.nextId(),n=t),this._annotations[r]!==void 0)throw new Error("Id ".concat(r," is already in use."));if(n===void 0)throw new Error("No annotation provided for id ".concat(r));return this._annotations[r]=n,this._size++,r},e.prototype.nextId=function(){return this._counter++,this._counter.toString()},e}(),Zd=function(){function e(t){var n=this;this._textEditChanges=Object.create(null),t!==void 0?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new za(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach(function(r){if(In.is(r)){var i=new yr(r.edits,n._changeAnnotations);n._textEditChanges[r.textDocument.uri]=i}})):t.changes&&Object.keys(t.changes).forEach(function(r){var i=new yr(t.changes[r]);n._textEditChanges[r]=i})):this._workspaceEdit={}}return Object.defineProperty(e.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),e.prototype.getTextEditChange=function(t){if(qn.is(t)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var n={uri:t.uri,version:t.version},r=this._textEditChanges[n.uri];if(!r){var i=[],o={textDocument:n,edits:i};this._workspaceEdit.documentChanges.push(o),r=new yr(i,this._changeAnnotations),this._textEditChanges[n.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var r=this._textEditChanges[t];if(!r){var i=[];this._workspaceEdit.changes[t]=i,r=new yr(i),this._textEditChanges[t]=r}return r}},e.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new za,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},e.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},e.prototype.createFile=function(t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;zt.is(n)||Qe.is(n)?i=n:r=n;var o,s;if(i===void 0?o=sn.create(t,r):(s=Qe.is(i)?i:this._changeAnnotations.manage(i),o=sn.create(t,r,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s},e.prototype.renameFile=function(t,n,r,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var o;zt.is(r)||Qe.is(r)?o=r:i=r;var s,a;if(o===void 0?s=an.create(t,n,i):(a=Qe.is(o)?o:this._changeAnnotations.manage(o),s=an.create(t,n,i,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a},e.prototype.deleteFile=function(t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;zt.is(n)||Qe.is(n)?i=n:r=n;var o,s;if(i===void 0?o=cn.create(t,r):(s=Qe.is(i)?i:this._changeAnnotations.manage(i),o=cn.create(t,r,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s},e}(),lo;(function(e){function t(r){return{uri:r}}e.create=t;function n(r){var i=r;return q.defined(i)&&q.string(i.uri)}e.is=n})(lo||(lo={}));var fo;(function(e){function t(r,i){return{uri:r,version:i}}e.create=t;function n(r){var i=r;return q.defined(i)&&q.string(i.uri)&&q.integer(i.version)}e.is=n})(fo||(fo={}));var qn;(function(e){function t(r,i){return{uri:r,version:i}}e.create=t;function n(r){var i=r;return q.defined(i)&&q.string(i.uri)&&(i.version===null||q.integer(i.version))}e.is=n})(qn||(qn={}));var ho;(function(e){function t(r,i,o,s){return{uri:r,languageId:i,version:o,text:s}}e.create=t;function n(r){var i=r;return q.defined(i)&&q.string(i.uri)&&q.string(i.languageId)&&q.integer(i.version)&&q.string(i.text)}e.is=n})(ho||(ho={}));var vr;(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(n){var r=n;return r===e.PlainText||r===e.Markdown}e.is=t})(vr||(vr={}));var un;(function(e){function t(n){var r=n;return q.objectLiteral(n)&&vr.is(r.kind)&&q.string(r.value)}e.is=t})(un||(un={}));var go;(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(go||(go={}));var po;(function(e){e.PlainText=1,e.Snippet=2})(po||(po={}));var mo;(function(e){e.Deprecated=1})(mo||(mo={}));var yo;(function(e){function t(r,i,o){return{newText:r,insert:i,replace:o}}e.create=t;function n(r){var i=r;return i&&q.string(i.newText)&&We.is(i.insert)&&We.is(i.replace)}e.is=n})(yo||(yo={}));var vo;(function(e){e.asIs=1,e.adjustIndentation=2})(vo||(vo={}));var Co;(function(e){function t(n){var r=n;return r&&(q.string(r.detail)||r.detail===void 0)&&(q.string(r.description)||r.description===void 0)}e.is=t})(Co||(Co={}));var _o;(function(e){function t(n){return{label:n}}e.create=t})(_o||(_o={}));var Ro;(function(e){function t(n,r){return{items:n||[],isIncomplete:!!r}}e.create=t})(Ro||(Ro={}));var Nn;(function(e){function t(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function n(r){var i=r;return q.string(i)||q.objectLiteral(i)&&q.string(i.language)&&q.string(i.value)}e.is=n})(Nn||(Nn={}));var wo;(function(e){function t(n){var r=n;return!!r&&q.objectLiteral(r)&&(un.is(r.contents)||Nn.is(r.contents)||q.typedArray(r.contents,Nn.is))&&(n.range===void 0||We.is(n.range))}e.is=t})(wo||(wo={}));var bo;(function(e){function t(n,r){return r?{label:n,documentation:r}:{label:n}}e.create=t})(bo||(bo={}));var So;(function(e){function t(n,r){for(var i=[],o=2;o=0;m--){var g=c[m],d=o.offsetAt(g.range.start),f=o.offsetAt(g.range.end);if(f<=l)a=a.substring(0,d)+g.newText+a.substring(f,a.length);else throw new Error("Overlapping edit");l=d}return a}e.applyEdits=r;function i(o,s){if(o.length<=1)return o;var a=o.length/2|0,c=o.slice(0,a),l=o.slice(a);i(c,s),i(l,s);for(var m=0,g=0,d=0;m0&&t.push(n.length),this._lineOffsets=t}return this._lineOffsets},e.prototype.positionAt=function(t){t=Math.max(Math.min(t,this._content.length),0);var n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return ft.create(0,t);for(;rt?i=o:r=o+1}var s=r-1;return ft.create(s,t-n[s])},e.prototype.offsetAt=function(t){var n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;var r=n[t.line],i=t.line+1"u"}e.undefined=r;function i(f){return f===!0||f===!1}e.boolean=i;function o(f){return t.call(f)==="[object String]"}e.string=o;function s(f){return t.call(f)==="[object Number]"}e.number=s;function a(f,y,L){return t.call(f)==="[object Number]"&&y<=f&&f<=L}e.numberRange=a;function c(f){return t.call(f)==="[object Number]"&&-2147483648<=f&&f<=2147483647}e.integer=c;function l(f){return t.call(f)==="[object Number]"&&0<=f&&f<=2147483647}e.uinteger=l;function m(f){return t.call(f)==="[object Function]"}e.func=m;function g(f){return f!==null&&typeof f=="object"}e.objectLiteral=g;function d(f,y){return Array.isArray(f)&&f.every(y)}e.typedArray=d})(q||(q={}));var nf=Object.freeze({__proto__:null,get DocumentUri(){return eo},get URI(){return hr},get integer(){return to},get uinteger(){return kn},get Position(){return ft},get Range(){return We},get Location(){return Fn},get LocationLink(){return no},get Color(){return gr},get ColorInformation(){return ro},get ColorPresentation(){return io},get FoldingRangeKind(){return oo},get FoldingRange(){return so},get DiagnosticRelatedInformation(){return pr},get DiagnosticSeverity(){return ao},get DiagnosticTag(){return co},get CodeDescription(){return uo},get Diagnostic(){return On},get Command(){return xt},get TextEdit(){return Pt},get ChangeAnnotation(){return zt},get ChangeAnnotationIdentifier(){return Qe},get AnnotatedTextEdit(){return Et},get TextDocumentEdit(){return In},get CreateFile(){return sn},get RenameFile(){return an},get DeleteFile(){return cn},get WorkspaceEdit(){return mr},WorkspaceChange:Zd,get TextDocumentIdentifier(){return lo},get VersionedTextDocumentIdentifier(){return fo},get OptionalVersionedTextDocumentIdentifier(){return qn},get TextDocumentItem(){return ho},get MarkupKind(){return vr},get MarkupContent(){return un},get CompletionItemKind(){return go},get InsertTextFormat(){return po},get CompletionItemTag(){return mo},get InsertReplaceEdit(){return yo},get InsertTextMode(){return vo},get CompletionItemLabelDetails(){return Co},get CompletionItem(){return _o},get CompletionList(){return Ro},get MarkedString(){return Nn},get Hover(){return wo},get ParameterInformation(){return bo},get SignatureInformation(){return So},get DocumentHighlightKind(){return Do},get DocumentHighlight(){return To},get SymbolKind(){return Po},get SymbolTag(){return Eo},get SymbolInformation(){return ko},get WorkspaceSymbol(){return Fo},get DocumentSymbol(){return Oo},get CodeActionKind(){return Io},get CodeActionTriggerKind(){return $n},get CodeActionContext(){return qo},get CodeAction(){return No},get CodeLens(){return $o},get FormattingOptions(){return Lo},get DocumentLink(){return Mo},get SelectionRange(){return Ao},get SemanticTokenTypes(){return jo},get SemanticTokenModifiers(){return Ho},get SemanticTokens(){return Wo},get InlineValueText(){return Uo},get InlineValueVariableLookup(){return xo},get InlineValueEvaluatableExpression(){return zo},get InlineValueContext(){return Ko},get InlayHintKind(){return Cr},get InlayHintLabelPart(){return _r},get InlayHint(){return Go},get WorkspaceFolder(){return Vo},EOL:ef,get TextDocument(){return Bo}}),Xo=He.getAugmentedNamespace(nf),Se={};Object.defineProperty(Se,"__esModule",{value:!0}),Se.ProtocolNotificationType=Se.ProtocolNotificationType0=Se.ProtocolRequestType=Se.ProtocolRequestType0=Se.RegistrationType=void 0;const ln=Wt;class rf{constructor(t){this.method=t}}Se.RegistrationType=rf;class of extends ln.RequestType0{constructor(t){super(t)}}Se.ProtocolRequestType0=of;class sf extends ln.RequestType{constructor(t){super(t,ln.ParameterStructures.byName)}}Se.ProtocolRequestType=sf;class af extends ln.NotificationType0{constructor(t){super(t)}}Se.ProtocolNotificationType0=af;class cf extends ln.NotificationType{constructor(t){super(t,ln.ParameterStructures.byName)}}Se.ProtocolNotificationType=cf;var Ka={},Ue={};Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.objectLiteral=Ue.typedArray=Ue.stringArray=Ue.array=Ue.func=Ue.error=Ue.number=Ue.string=Ue.boolean=void 0;function uf(e){return e===!0||e===!1}Ue.boolean=uf;function Ga(e){return typeof e=="string"||e instanceof String}Ue.string=Ga;function lf(e){return typeof e=="number"||e instanceof Number}Ue.number=lf;function df(e){return e instanceof Error}Ue.error=df;function ff(e){return typeof e=="function"}Ue.func=ff;function Va(e){return Array.isArray(e)}Ue.array=Va;function hf(e){return Va(e)&&e.every(t=>Ga(t))}Ue.stringArray=hf;function gf(e,t){return Array.isArray(e)&&e.every(t)}Ue.typedArray=gf;function pf(e){return e!==null&&typeof e=="object"}Ue.objectLiteral=pf;var Ba={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationRequest=void 0;const t=Se;(function(n){n.method="textDocument/implementation",n.type=new t.ProtocolRequestType(n.method)})(e.ImplementationRequest||(e.ImplementationRequest={}))})(Ba);var Xa={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TypeDefinitionRequest=void 0;const t=Se;(function(n){n.method="textDocument/typeDefinition",n.type=new t.ProtocolRequestType(n.method)})(e.TypeDefinitionRequest||(e.TypeDefinitionRequest={}))})(Xa);var Ja={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=void 0;const t=Se;(function(n){n.type=new t.ProtocolRequestType0("workspace/workspaceFolders")})(e.WorkspaceFoldersRequest||(e.WorkspaceFoldersRequest={})),function(n){n.type=new t.ProtocolNotificationType("workspace/didChangeWorkspaceFolders")}(e.DidChangeWorkspaceFoldersNotification||(e.DidChangeWorkspaceFoldersNotification={}))})(Ja);var Qa={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConfigurationRequest=void 0;const t=Se;(function(n){n.type=new t.ProtocolRequestType("workspace/configuration")})(e.ConfigurationRequest||(e.ConfigurationRequest={}))})(Qa);var Ya={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorPresentationRequest=e.DocumentColorRequest=void 0;const t=Se;(function(n){n.method="textDocument/documentColor",n.type=new t.ProtocolRequestType(n.method)})(e.DocumentColorRequest||(e.DocumentColorRequest={})),function(n){n.type=new t.ProtocolRequestType("textDocument/colorPresentation")}(e.ColorPresentationRequest||(e.ColorPresentationRequest={}))})(Ya);var Za={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FoldingRangeRequest=void 0;const t=Se;(function(n){n.method="textDocument/foldingRange",n.type=new t.ProtocolRequestType(n.method)})(e.FoldingRangeRequest||(e.FoldingRangeRequest={}))})(Za);var ec={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DeclarationRequest=void 0;const t=Se;(function(n){n.method="textDocument/declaration",n.type=new t.ProtocolRequestType(n.method)})(e.DeclarationRequest||(e.DeclarationRequest={}))})(ec);var tc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionRangeRequest=void 0;const t=Se;(function(n){n.method="textDocument/selectionRange",n.type=new t.ProtocolRequestType(n.method)})(e.SelectionRangeRequest||(e.SelectionRangeRequest={}))})(tc);var nc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=void 0;const t=Wt,n=Se;(function(r){r.type=new t.ProgressType;function i(o){return o===r.type}r.is=i})(e.WorkDoneProgress||(e.WorkDoneProgress={})),function(r){r.method="window/workDoneProgress/create",r.type=new n.ProtocolRequestType(r.method)}(e.WorkDoneProgressCreateRequest||(e.WorkDoneProgressCreateRequest={})),function(r){r.method="window/workDoneProgress/cancel",r.type=new n.ProtocolNotificationType(r.method)}(e.WorkDoneProgressCancelNotification||(e.WorkDoneProgressCancelNotification={}))})(nc);var rc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.CallHierarchyPrepareRequest=void 0;const t=Se;(function(n){n.method="textDocument/prepareCallHierarchy",n.type=new t.ProtocolRequestType(n.method)})(e.CallHierarchyPrepareRequest||(e.CallHierarchyPrepareRequest={})),function(n){n.method="callHierarchy/incomingCalls",n.type=new t.ProtocolRequestType(n.method)}(e.CallHierarchyIncomingCallsRequest||(e.CallHierarchyIncomingCallsRequest={})),function(n){n.method="callHierarchy/outgoingCalls",n.type=new t.ProtocolRequestType(n.method)}(e.CallHierarchyOutgoingCallsRequest||(e.CallHierarchyOutgoingCallsRequest={}))})(rc);var ic={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.SemanticTokensRegistrationType=e.TokenFormat=void 0;const t=Se;(function(n){n.Relative="relative"})(e.TokenFormat||(e.TokenFormat={})),function(n){n.method="textDocument/semanticTokens",n.type=new t.RegistrationType(n.method)}(e.SemanticTokensRegistrationType||(e.SemanticTokensRegistrationType={})),function(n){n.method="textDocument/semanticTokens/full",n.type=new t.ProtocolRequestType(n.method)}(e.SemanticTokensRequest||(e.SemanticTokensRequest={})),function(n){n.method="textDocument/semanticTokens/full/delta",n.type=new t.ProtocolRequestType(n.method)}(e.SemanticTokensDeltaRequest||(e.SemanticTokensDeltaRequest={})),function(n){n.method="textDocument/semanticTokens/range",n.type=new t.ProtocolRequestType(n.method)}(e.SemanticTokensRangeRequest||(e.SemanticTokensRangeRequest={})),function(n){n.method="workspace/semanticTokens/refresh",n.type=new t.ProtocolRequestType0(n.method)}(e.SemanticTokensRefreshRequest||(e.SemanticTokensRefreshRequest={}))})(ic);var oc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ShowDocumentRequest=void 0;const t=Se;(function(n){n.method="window/showDocument",n.type=new t.ProtocolRequestType(n.method)})(e.ShowDocumentRequest||(e.ShowDocumentRequest={}))})(oc);var sc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedEditingRangeRequest=void 0;const t=Se;(function(n){n.method="textDocument/linkedEditingRange",n.type=new t.ProtocolRequestType(n.method)})(e.LinkedEditingRangeRequest||(e.LinkedEditingRangeRequest={}))})(sc);var ac={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.DidRenameFilesNotification=e.WillRenameFilesRequest=e.DidCreateFilesNotification=e.WillCreateFilesRequest=e.FileOperationPatternKind=void 0;const t=Se;(function(n){n.file="file",n.folder="folder"})(e.FileOperationPatternKind||(e.FileOperationPatternKind={})),function(n){n.method="workspace/willCreateFiles",n.type=new t.ProtocolRequestType(n.method)}(e.WillCreateFilesRequest||(e.WillCreateFilesRequest={})),function(n){n.method="workspace/didCreateFiles",n.type=new t.ProtocolNotificationType(n.method)}(e.DidCreateFilesNotification||(e.DidCreateFilesNotification={})),function(n){n.method="workspace/willRenameFiles",n.type=new t.ProtocolRequestType(n.method)}(e.WillRenameFilesRequest||(e.WillRenameFilesRequest={})),function(n){n.method="workspace/didRenameFiles",n.type=new t.ProtocolNotificationType(n.method)}(e.DidRenameFilesNotification||(e.DidRenameFilesNotification={})),function(n){n.method="workspace/didDeleteFiles",n.type=new t.ProtocolNotificationType(n.method)}(e.DidDeleteFilesNotification||(e.DidDeleteFilesNotification={})),function(n){n.method="workspace/willDeleteFiles",n.type=new t.ProtocolRequestType(n.method)}(e.WillDeleteFilesRequest||(e.WillDeleteFilesRequest={}))})(ac);var cc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=void 0;const t=Se;(function(n){n.document="document",n.project="project",n.group="group",n.scheme="scheme",n.global="global"})(e.UniquenessLevel||(e.UniquenessLevel={})),function(n){n.$import="import",n.$export="export",n.local="local"}(e.MonikerKind||(e.MonikerKind={})),function(n){n.method="textDocument/moniker",n.type=new t.ProtocolRequestType(n.method)}(e.MonikerRequest||(e.MonikerRequest={}))})(cc);var uc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHierarchySubtypesRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchyPrepareRequest=void 0;const t=Se;(function(n){n.method="textDocument/prepareTypeHierarchy",n.type=new t.ProtocolRequestType(n.method)})(e.TypeHierarchyPrepareRequest||(e.TypeHierarchyPrepareRequest={})),function(n){n.method="typeHierarchy/supertypes",n.type=new t.ProtocolRequestType(n.method)}(e.TypeHierarchySupertypesRequest||(e.TypeHierarchySupertypesRequest={})),function(n){n.method="typeHierarchy/subtypes",n.type=new t.ProtocolRequestType(n.method)}(e.TypeHierarchySubtypesRequest||(e.TypeHierarchySubtypesRequest={}))})(uc);var lc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.InlineValueRefreshRequest=e.InlineValueRequest=void 0;const t=Se;(function(n){n.method="textDocument/inlineValue",n.type=new t.ProtocolRequestType(n.method)})(e.InlineValueRequest||(e.InlineValueRequest={})),function(n){n.method="workspace/inlineValue/refresh",n.type=new t.ProtocolRequestType0(n.method)}(e.InlineValueRefreshRequest||(e.InlineValueRefreshRequest={}))})(lc);var dc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=void 0;const t=Se;(function(n){n.method="textDocument/inlayHint",n.type=new t.ProtocolRequestType(n.method)})(e.InlayHintRequest||(e.InlayHintRequest={})),function(n){n.method="inlayHint/resolve",n.type=new t.ProtocolRequestType(n.method)}(e.InlayHintResolveRequest||(e.InlayHintResolveRequest={})),function(n){n.method="workspace/inlayHint/refresh",n.type=new t.ProtocolRequestType0(n.method)}(e.InlayHintRefreshRequest||(e.InlayHintRefreshRequest={}))})(dc);var fc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=void 0;const t=Wt,n=Ue,r=Se;(function(i){function o(s){const a=s;return a&&n.boolean(a.retriggerRequest)}i.is=o})(e.DiagnosticServerCancellationData||(e.DiagnosticServerCancellationData={})),function(i){i.Full="full",i.Unchanged="unchanged"}(e.DocumentDiagnosticReportKind||(e.DocumentDiagnosticReportKind={})),function(i){i.method="textDocument/diagnostic",i.type=new r.ProtocolRequestType(i.method),i.partialResult=new t.ProgressType}(e.DocumentDiagnosticRequest||(e.DocumentDiagnosticRequest={})),function(i){i.method="workspace/diagnostic",i.type=new r.ProtocolRequestType(i.method),i.partialResult=new t.ProgressType}(e.WorkspaceDiagnosticRequest||(e.WorkspaceDiagnosticRequest={})),function(i){i.method="workspace/diagnostic/refresh",i.type=new r.ProtocolRequestType0(i.method)}(e.DiagnosticRefreshRequest||(e.DiagnosticRefreshRequest={}))})(fc);var hc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=void 0;const t=Xo,n=Ue,r=Se;var i;(function(a){a.Markup=1,a.Code=2;function c(l){return l===1||l===2}a.is=c})(i=e.NotebookCellKind||(e.NotebookCellKind={}));var o;(function(a){function c(g,d){const f={executionOrder:g};return(d===!0||d===!1)&&(f.success=d),f}a.create=c;function l(g){const d=g;return n.objectLiteral(d)&&t.uinteger.is(d.executionOrder)&&(d.success===void 0||n.boolean(d.success))}a.is=l;function m(g,d){return g===d?!0:g==null||d===null||d===void 0?!1:g.executionOrder===d.executionOrder&&g.success===d.success}a.equals=m})(o=e.ExecutionSummary||(e.ExecutionSummary={}));var s;(function(a){function c(d,f){return{kind:d,document:f}}a.create=c;function l(d){const f=d;return n.objectLiteral(f)&&i.is(f.kind)&&t.DocumentUri.is(f.document)&&(f.metadata===void 0||n.objectLiteral(f.metadata))}a.is=l;function m(d,f){const y=new Set;return d.document!==f.document&&y.add("document"),d.kind!==f.kind&&y.add("kind"),d.executionSummary!==f.executionSummary&&y.add("executionSummary"),(d.metadata!==void 0||f.metadata!==void 0)&&!g(d.metadata,f.metadata)&&y.add("metadata"),(d.executionSummary!==void 0||f.executionSummary!==void 0)&&!o.equals(d.executionSummary,f.executionSummary)&&y.add("executionSummary"),y}a.diff=m;function g(d,f){if(d===f)return!0;if(d==null||f===null||f===void 0||typeof d!=typeof f||typeof d!="object")return!1;const y=Array.isArray(d),L=Array.isArray(f);if(y!==L)return!1;if(y&&L){if(d.length!==f.length)return!1;for(let M=0;M0}h.hasId=k}(e.StaticRegistrationOptions||(e.StaticRegistrationOptions={})),function(h){function k(W){const P=W;return P&&(P.documentSelector===null||C.is(P.documentSelector))}h.is=k}(e.TextDocumentRegistrationOptions||(e.TextDocumentRegistrationOptions={})),function(h){function k(P){const F=P;return r.objectLiteral(F)&&(F.workDoneProgress===void 0||r.boolean(F.workDoneProgress))}h.is=k;function W(P){const F=P;return F&&r.boolean(F.workDoneProgress)}h.hasWorkDoneProgress=W}(e.WorkDoneProgressOptions||(e.WorkDoneProgressOptions={})),function(h){h.type=new t.ProtocolRequestType("initialize")}(e.InitializeRequest||(e.InitializeRequest={})),function(h){h.unknownProtocolVersion=1}(e.InitializeErrorCodes||(e.InitializeErrorCodes={})),function(h){h.type=new t.ProtocolNotificationType("initialized")}(e.InitializedNotification||(e.InitializedNotification={})),function(h){h.type=new t.ProtocolRequestType0("shutdown")}(e.ShutdownRequest||(e.ShutdownRequest={})),function(h){h.type=new t.ProtocolNotificationType0("exit")}(e.ExitNotification||(e.ExitNotification={})),function(h){h.type=new t.ProtocolNotificationType("workspace/didChangeConfiguration")}(e.DidChangeConfigurationNotification||(e.DidChangeConfigurationNotification={})),function(h){h.Error=1,h.Warning=2,h.Info=3,h.Log=4}(e.MessageType||(e.MessageType={})),function(h){h.type=new t.ProtocolNotificationType("window/showMessage")}(e.ShowMessageNotification||(e.ShowMessageNotification={})),function(h){h.type=new t.ProtocolRequestType("window/showMessageRequest")}(e.ShowMessageRequest||(e.ShowMessageRequest={})),function(h){h.type=new t.ProtocolNotificationType("window/logMessage")}(e.LogMessageNotification||(e.LogMessageNotification={})),function(h){h.type=new t.ProtocolNotificationType("telemetry/event")}(e.TelemetryEventNotification||(e.TelemetryEventNotification={})),function(h){h.None=0,h.Full=1,h.Incremental=2}(e.TextDocumentSyncKind||(e.TextDocumentSyncKind={})),function(h){h.method="textDocument/didOpen",h.type=new t.ProtocolNotificationType(h.method)}(e.DidOpenTextDocumentNotification||(e.DidOpenTextDocumentNotification={})),function(h){function k(P){let F=P;return F!=null&&typeof F.text=="string"&&F.range!==void 0&&(F.rangeLength===void 0||typeof F.rangeLength=="number")}h.isIncremental=k;function W(P){let F=P;return F!=null&&typeof F.text=="string"&&F.range===void 0&&F.rangeLength===void 0}h.isFull=W}(e.TextDocumentContentChangeEvent||(e.TextDocumentContentChangeEvent={})),function(h){h.method="textDocument/didChange",h.type=new t.ProtocolNotificationType(h.method)}(e.DidChangeTextDocumentNotification||(e.DidChangeTextDocumentNotification={})),function(h){h.method="textDocument/didClose",h.type=new t.ProtocolNotificationType(h.method)}(e.DidCloseTextDocumentNotification||(e.DidCloseTextDocumentNotification={})),function(h){h.method="textDocument/didSave",h.type=new t.ProtocolNotificationType(h.method)}(e.DidSaveTextDocumentNotification||(e.DidSaveTextDocumentNotification={})),function(h){h.Manual=1,h.AfterDelay=2,h.FocusOut=3}(e.TextDocumentSaveReason||(e.TextDocumentSaveReason={})),function(h){h.method="textDocument/willSave",h.type=new t.ProtocolNotificationType(h.method)}(e.WillSaveTextDocumentNotification||(e.WillSaveTextDocumentNotification={})),function(h){h.method="textDocument/willSaveWaitUntil",h.type=new t.ProtocolRequestType(h.method)}(e.WillSaveTextDocumentWaitUntilRequest||(e.WillSaveTextDocumentWaitUntilRequest={})),function(h){h.type=new t.ProtocolNotificationType("workspace/didChangeWatchedFiles")}(e.DidChangeWatchedFilesNotification||(e.DidChangeWatchedFilesNotification={})),function(h){h.Created=1,h.Changed=2,h.Deleted=3}(e.FileChangeType||(e.FileChangeType={})),function(h){function k(W){const P=W;return r.objectLiteral(P)&&(n.URI.is(P.baseUri)||n.WorkspaceFolder.is(P.baseUri))&&r.string(P.pattern)}h.is=k}(e.RelativePattern||(e.RelativePattern={})),function(h){h.Create=1,h.Change=2,h.Delete=4}(e.WatchKind||(e.WatchKind={})),function(h){h.type=new t.ProtocolNotificationType("textDocument/publishDiagnostics")}(e.PublishDiagnosticsNotification||(e.PublishDiagnosticsNotification={})),function(h){h.Invoked=1,h.TriggerCharacter=2,h.TriggerForIncompleteCompletions=3}(e.CompletionTriggerKind||(e.CompletionTriggerKind={})),function(h){h.method="textDocument/completion",h.type=new t.ProtocolRequestType(h.method)}(e.CompletionRequest||(e.CompletionRequest={})),function(h){h.method="completionItem/resolve",h.type=new t.ProtocolRequestType(h.method)}(e.CompletionResolveRequest||(e.CompletionResolveRequest={})),function(h){h.method="textDocument/hover",h.type=new t.ProtocolRequestType(h.method)}(e.HoverRequest||(e.HoverRequest={})),function(h){h.Invoked=1,h.TriggerCharacter=2,h.ContentChange=3}(e.SignatureHelpTriggerKind||(e.SignatureHelpTriggerKind={})),function(h){h.method="textDocument/signatureHelp",h.type=new t.ProtocolRequestType(h.method)}(e.SignatureHelpRequest||(e.SignatureHelpRequest={})),function(h){h.method="textDocument/definition",h.type=new t.ProtocolRequestType(h.method)}(e.DefinitionRequest||(e.DefinitionRequest={})),function(h){h.method="textDocument/references",h.type=new t.ProtocolRequestType(h.method)}(e.ReferencesRequest||(e.ReferencesRequest={})),function(h){h.method="textDocument/documentHighlight",h.type=new t.ProtocolRequestType(h.method)}(e.DocumentHighlightRequest||(e.DocumentHighlightRequest={})),function(h){h.method="textDocument/documentSymbol",h.type=new t.ProtocolRequestType(h.method)}(e.DocumentSymbolRequest||(e.DocumentSymbolRequest={})),function(h){h.method="textDocument/codeAction",h.type=new t.ProtocolRequestType(h.method)}(e.CodeActionRequest||(e.CodeActionRequest={})),function(h){h.method="codeAction/resolve",h.type=new t.ProtocolRequestType(h.method)}(e.CodeActionResolveRequest||(e.CodeActionResolveRequest={})),function(h){h.method="workspace/symbol",h.type=new t.ProtocolRequestType(h.method)}(e.WorkspaceSymbolRequest||(e.WorkspaceSymbolRequest={})),function(h){h.method="workspaceSymbol/resolve",h.type=new t.ProtocolRequestType(h.method)}(e.WorkspaceSymbolResolveRequest||(e.WorkspaceSymbolResolveRequest={})),function(h){h.method="textDocument/codeLens",h.type=new t.ProtocolRequestType(h.method)}(e.CodeLensRequest||(e.CodeLensRequest={})),function(h){h.method="codeLens/resolve",h.type=new t.ProtocolRequestType(h.method)}(e.CodeLensResolveRequest||(e.CodeLensResolveRequest={})),function(h){h.method="workspace/codeLens/refresh",h.type=new t.ProtocolRequestType0(h.method)}(e.CodeLensRefreshRequest||(e.CodeLensRefreshRequest={})),function(h){h.method="textDocument/documentLink",h.type=new t.ProtocolRequestType(h.method)}(e.DocumentLinkRequest||(e.DocumentLinkRequest={})),function(h){h.method="documentLink/resolve",h.type=new t.ProtocolRequestType(h.method)}(e.DocumentLinkResolveRequest||(e.DocumentLinkResolveRequest={})),function(h){h.method="textDocument/formatting",h.type=new t.ProtocolRequestType(h.method)}(e.DocumentFormattingRequest||(e.DocumentFormattingRequest={})),function(h){h.method="textDocument/rangeFormatting",h.type=new t.ProtocolRequestType(h.method)}(e.DocumentRangeFormattingRequest||(e.DocumentRangeFormattingRequest={})),function(h){h.method="textDocument/onTypeFormatting",h.type=new t.ProtocolRequestType(h.method)}(e.DocumentOnTypeFormattingRequest||(e.DocumentOnTypeFormattingRequest={})),function(h){h.Identifier=1}(e.PrepareSupportDefaultBehavior||(e.PrepareSupportDefaultBehavior={})),function(h){h.method="textDocument/rename",h.type=new t.ProtocolRequestType(h.method)}(e.RenameRequest||(e.RenameRequest={})),function(h){h.method="textDocument/prepareRename",h.type=new t.ProtocolRequestType(h.method)}(e.PrepareRenameRequest||(e.PrepareRenameRequest={})),function(h){h.type=new t.ProtocolRequestType("workspace/executeCommand")}(e.ExecuteCommandRequest||(e.ExecuteCommandRequest={})),function(h){h.type=new t.ProtocolRequestType("workspace/applyEdit")}(e.ApplyWorkspaceEditRequest||(e.ApplyWorkspaceEditRequest={}))}(Ka);var Rr={};Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.createProtocolConnection=void 0;const gc=Wt;function mf(e,t,n,r){return gc.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,gc.createMessageConnection)(e,t,n,r)}Rr.createProtocolConnection=mf,function(e){var t=He.commonjsGlobal&&He.commonjsGlobal.__createBinding||(Object.create?function(i,o,s,a){a===void 0&&(a=s);var c=Object.getOwnPropertyDescriptor(o,s);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(i,a,c)}:function(i,o,s,a){a===void 0&&(a=s),i[a]=o[s]}),n=He.commonjsGlobal&&He.commonjsGlobal.__exportStar||function(i,o){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,n(Wt,e),n(Xo,e),n(Se,e),n(Ka,e);var r=Rr;Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:function(){return r.createProtocolConnection}}),function(i){i.lspReservedErrorRangeStart=-32899,i.RequestFailed=-32803,i.ServerCancelled=-32802,i.ContentModified=-32801,i.RequestCancelled=-32800,i.lspReservedErrorRangeEnd=-32800}(e.LSPErrorCodes||(e.LSPErrorCodes={}))}(xa),function(e){var t=He.commonjsGlobal&&He.commonjsGlobal.__createBinding||(Object.create?function(o,s,a,c){c===void 0&&(c=a);var l=Object.getOwnPropertyDescriptor(s,a);(!l||("get"in l?!s.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return s[a]}}),Object.defineProperty(o,c,l)}:function(o,s,a,c){c===void 0&&(c=a),o[c]=s[a]}),n=He.commonjsGlobal&&He.commonjsGlobal.__exportStar||function(o,s){for(var a in o)a!=="default"&&!Object.prototype.hasOwnProperty.call(s,a)&&t(s,o,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;const r=Wi.exports;n(Wi.exports,e),n(xa,e);function i(o,s,a,c){return(0,r.createMessageConnection)(o,s,a,c)}e.createProtocolConnection=i}(he);var wr={},rt={};Object.defineProperty(rt,"__esModule",{value:!0}),rt.forEach=rt.mapAsync=rt.map=rt.Semaphore=rt.Delayer=void 0;const Ln=he;class yf{constructor(t){this.defaultDelay=t,this.timeout=void 0,this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0}trigger(t,n=this.defaultDelay){return this.task=t,n>=0&&this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(r=>{this.onSuccess=r}).then(()=>{this.completionPromise=void 0,this.onSuccess=void 0;var r=this.task();return this.task=void 0,r})),(n>=0||this.timeout===void 0)&&(this.timeout=(0,Ln.RAL)().timer.setTimeout(()=>{this.timeout=void 0,this.onSuccess(void 0)},n>=0?n:this.defaultDelay)),this.completionPromise}forceDelivery(){if(!this.completionPromise)return;this.cancelTimeout();let t=this.task();return this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0,t}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)}}rt.Delayer=yf;class vf{constructor(t=1){if(t<=0)throw new Error("Capacity must be greater than 0");this._capacity=t,this._active=0,this._waiting=[]}lock(t){return new Promise((n,r)=>{this._waiting.push({thunk:t,resolve:n,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,Ln.RAL)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;const t=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const n=t.thunk();n instanceof Promise?n.then(r=>{this._active--,t.resolve(r),this.runNext()},r=>{this._active--,t.reject(r),this.runNext()}):(this._active--,t.resolve(n),this.runNext())}catch(n){this._active--,t.reject(n),this.runNext()}}}rt.Semaphore=vf;const pc=15;class Jo{constructor(t=pc){this.yieldAfter=Math.max(t,pc),this.startTime=Date.now(),this.counter=0,this.total=0,this.counterInterval=1}start(){this.startTime=Date.now()}shouldYield(){if(++this.counter>=this.counterInterval){const t=Date.now()-this.startTime,n=Math.max(0,this.yieldAfter-t);if(this.total+=this.counter,this.counter=0,t>=this.yieldAfter||n<=1)return this.counterInterval=1,this.total=0,!0;switch(t){case 0:case 1:this.counterInterval=this.total*2;break}}return!1}}async function Cf(e,t,n,r){if(e.length===0)return[];const i=new Array(e.length),o=new Jo(r?.yieldAfter);function s(c){o.start();for(let l=c;l{(0,Ln.RAL)().timer.setImmediate(()=>{c(s(a))})});return i}rt.map=Cf;async function _f(e,t,n,r){if(e.length===0)return[];const i=new Array(e.length),o=new Jo(r?.yieldAfter);async function s(c){o.start();for(let l=c;l{(0,Ln.RAL)().timer.setImmediate(()=>{c(s(a))})});return i}rt.mapAsync=_f;async function Rf(e,t,n,r){if(e.length===0)return;const i=new Jo(r?.yieldAfter);function o(a){i.start();for(let c=a;c{(0,Ln.RAL)().timer.setImmediate(()=>{a(o(s))})})}rt.forEach=Rf;var br={};Object.defineProperty(br,"__esModule",{value:!0});const wf=de.default;class bf extends wf.CompletionItem{constructor(t){super(t)}}br.default=bf;var Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});const Sf=de.default;class Df extends Sf.CodeLens{constructor(t){super(t)}}Sr.default=Df;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});const Tf=de.default;class Pf extends Tf.DocumentLink{constructor(t,n){super(t,n)}}Dr.default=Pf;var Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});const Ef=de.default;class kf extends Ef.CodeAction{constructor(t,n){super(t),this.data=n}}Tr.default=kf;var Qo={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProtocolDiagnostic=e.DiagnosticCode=void 0;const t=de.default,n=Ee;(function(i){function o(s){const a=s;return a!=null&&(n.number(a.value)||n.string(a.value))&&n.string(a.target)}i.is=o})(e.DiagnosticCode||(e.DiagnosticCode={}));class r extends t.Diagnostic{constructor(o,s,a,c){super(o,s,a),this.data=c,this.hasDiagnosticCode=!1}}e.ProtocolDiagnostic=r})(Qo);var Pr={};Object.defineProperty(Pr,"__esModule",{value:!0});const Ff=de.default;class Of extends Ff.CallHierarchyItem{constructor(t,n,r,i,o,s,a){super(t,n,r,i,o,s),a!==void 0&&(this.data=a)}}Pr.default=Of;var Er={};Object.defineProperty(Er,"__esModule",{value:!0});const If=de.default;class qf extends If.TypeHierarchyItem{constructor(t,n,r,i,o,s,a){super(t,n,r,i,o,s),a!==void 0&&(this.data=a)}}Er.default=qf;var kr={};Object.defineProperty(kr,"__esModule",{value:!0});const Fr=de.default;class Nf extends Fr.SymbolInformation{constructor(t,n,r,i,o){const s=!(i instanceof Fr.Uri);super(t,n,r,s?i:new Fr.Location(i,new Fr.Range(0,0,0,0))),this.hasRange=s,o!==void 0&&(this.data=o)}}kr.default=Nf;var Or={};Object.defineProperty(Or,"__esModule",{value:!0});const $f=de.default;class Lf extends $f.InlayHint{constructor(t,n,r){super(t,n,r)}}Or.default=Lf,Object.defineProperty(wr,"__esModule",{value:!0}),wr.createConverter=void 0;const Ke=de.default,pe=he,dn=Ee,mc=rt,Mf=br,Af=Sr,jf=Dr,Hf=Tr,yc=Qo,Wf=Pr,Uf=Er,xf=kr,zf=Or;var Yo;(function(e){function t(n){const r=n;return r&&!!r.inserting&&!!r.replacing}e.is=t})(Yo||(Yo={}));function Kf(e){const n=e||(p=>p.toString());function r(p){return n(p)}function i(p){return{uri:n(p.uri)}}function o(p){return{uri:n(p.uri),languageId:p.languageId,version:p.version,text:p.getText()}}function s(p){return{uri:n(p.uri),version:p.version}}function a(p){return{textDocument:o(p)}}function c(p){let A=p;return!!A.document&&!!A.contentChanges}function l(p){let A=p;return!!A.uri&&!!A.version}function m(p){if(l(p))return{textDocument:{uri:n(p.uri),version:p.version},contentChanges:[{text:p.getText()}]};if(c(p)){let A=p.document;return{textDocument:{uri:n(A.uri),version:A.version},contentChanges:p.contentChanges.map(_e=>{let ve=_e.range;return{range:{start:{line:ve.start.line,character:ve.start.character},end:{line:ve.end.line,character:ve.end.character}},rangeLength:_e.rangeLength,text:_e.text}})}}else throw Error("Unsupported text document change parameter")}function g(p){return{textDocument:i(p)}}function d(p,A=!1){let te={textDocument:i(p)};return A&&(te.text=p.getText()),te}function f(p){switch(p){case Ke.TextDocumentSaveReason.Manual:return pe.TextDocumentSaveReason.Manual;case Ke.TextDocumentSaveReason.AfterDelay:return pe.TextDocumentSaveReason.AfterDelay;case Ke.TextDocumentSaveReason.FocusOut:return pe.TextDocumentSaveReason.FocusOut}return pe.TextDocumentSaveReason.Manual}function y(p){return{textDocument:i(p.document),reason:f(p.reason)}}function L(p){return{files:p.files.map(A=>({uri:n(A)}))}}function M(p){return{files:p.files.map(A=>({oldUri:n(A.oldUri),newUri:n(A.newUri)}))}}function x(p){return{files:p.files.map(A=>({uri:n(A)}))}}function b(p){return{files:p.files.map(A=>({uri:n(A)}))}}function E(p){return{files:p.files.map(A=>({oldUri:n(A.oldUri),newUri:n(A.newUri)}))}}function w(p){return{files:p.files.map(A=>({uri:n(A)}))}}function $(p,A){return{textDocument:i(p),position:P(A)}}function H(p){switch(p){case Ke.CompletionTriggerKind.TriggerCharacter:return pe.CompletionTriggerKind.TriggerCharacter;case Ke.CompletionTriggerKind.TriggerForIncompleteCompletions:return pe.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return pe.CompletionTriggerKind.Invoked}}function T(p,A,te){return{textDocument:i(p),position:P(A),context:{triggerKind:H(te.triggerKind),triggerCharacter:te.triggerCharacter}}}function S(p){switch(p){case Ke.SignatureHelpTriggerKind.Invoke:return pe.SignatureHelpTriggerKind.Invoked;case Ke.SignatureHelpTriggerKind.TriggerCharacter:return pe.SignatureHelpTriggerKind.TriggerCharacter;case Ke.SignatureHelpTriggerKind.ContentChange:return pe.SignatureHelpTriggerKind.ContentChange}}function N(p){return{label:p.label}}function O(p){return p.map(N)}function C(p){return{label:p.label,parameters:O(p.parameters)}}function h(p){return p.map(C)}function k(p){return p===void 0?p:{signatures:h(p.signatures),activeSignature:p.activeSignature,activeParameter:p.activeParameter}}function W(p,A,te){return{textDocument:i(p),position:P(A),context:{isRetrigger:te.isRetrigger,triggerCharacter:te.triggerCharacter,triggerKind:S(te.triggerKind),activeSignatureHelp:k(te.activeSignatureHelp)}}}function P(p){return{line:p.line,character:p.character}}function F(p){return p==null?p:{line:p.line>pe.uinteger.MAX_VALUE?pe.uinteger.MAX_VALUE:p.line,character:p.character>pe.uinteger.MAX_VALUE?pe.uinteger.MAX_VALUE:p.character}}function j(p,A){return mc.map(p,F,A)}function G(p){return p==null?p:{start:F(p.start),end:F(p.end)}}function X(p){return p==null?p:pe.Location.create(r(p.uri),G(p.range))}function ie(p){switch(p){case Ke.DiagnosticSeverity.Error:return pe.DiagnosticSeverity.Error;case Ke.DiagnosticSeverity.Warning:return pe.DiagnosticSeverity.Warning;case Ke.DiagnosticSeverity.Information:return pe.DiagnosticSeverity.Information;case Ke.DiagnosticSeverity.Hint:return pe.DiagnosticSeverity.Hint}}function ce(p){if(!p)return;let A=[];for(let te of p){let _e=Y(te);_e!==void 0&&A.push(_e)}return A.length>0?A:void 0}function Y(p){switch(p){case Ke.DiagnosticTag.Unnecessary:return pe.DiagnosticTag.Unnecessary;case Ke.DiagnosticTag.Deprecated:return pe.DiagnosticTag.Deprecated;default:return}}function oe(p){return{message:p.message,location:X(p.location)}}function Z(p){return p.map(oe)}function se(p){if(p!=null)return dn.number(p)||dn.string(p)?p:{value:p.value,target:r(p.target)}}function re(p){const A=pe.Diagnostic.create(G(p.range),p.message),te=p instanceof yc.ProtocolDiagnostic?p:void 0;te!==void 0&&te.data!==void 0&&(A.data=te.data);const _e=se(p.code);return yc.DiagnosticCode.is(_e)?te!==void 0&&te.hasDiagnosticCode?A.code=_e:(A.code=_e.value,A.codeDescription={href:_e.target}):A.code=_e,dn.number(p.severity)&&(A.severity=ie(p.severity)),Array.isArray(p.tags)&&(A.tags=ce(p.tags)),p.relatedInformation&&(A.relatedInformation=Z(p.relatedInformation)),p.source&&(A.source=p.source),A}function be(p,A){return p==null?p:mc.map(p,re,A)}function Be(p,A){switch(p){case"$string":return A;case pe.MarkupKind.PlainText:return{kind:p,value:A};case pe.MarkupKind.Markdown:return{kind:p,value:A.value};default:return`Unsupported Markup content received. Kind is: ${p}`}}function Fe(p){switch(p){case Ke.CompletionItemTag.Deprecated:return pe.CompletionItemTag.Deprecated}}function xe(p){if(p===void 0)return p;const A=[];for(let te of p){const _e=Fe(te);_e!==void 0&&A.push(_e)}return A}function dt(p,A){return A!==void 0?A:p+1}function at(p,A=!1){let te,_e;dn.string(p.label)?te=p.label:(te=p.label.label,A&&(p.label.detail!==void 0||p.label.description!==void 0)&&(_e={detail:p.label.detail,description:p.label.description}));let ve={label:te};_e!==void 0&&(ve.labelDetails=_e);let Ge=p instanceof Mf.default?p:void 0;p.detail&&(ve.detail=p.detail),p.documentation&&(!Ge||Ge.documentationFormat==="$string"?ve.documentation=p.documentation:ve.documentation=Be(Ge.documentationFormat,p.documentation)),p.filterText&&(ve.filterText=p.filterText),fe(ve,p),dn.number(p.kind)&&(ve.kind=dt(p.kind,Ge&&Ge.originalItemKind)),p.sortText&&(ve.sortText=p.sortText),p.additionalTextEdits&&(ve.additionalTextEdits=mt(p.additionalTextEdits)),p.commitCharacters&&(ve.commitCharacters=p.commitCharacters.slice()),p.command&&(ve.command=Ce(p.command)),(p.preselect===!0||p.preselect===!1)&&(ve.preselect=p.preselect);const yt=xe(p.tags);if(Ge){if(Ge.data!==void 0&&(ve.data=Ge.data),Ge.deprecated===!0||Ge.deprecated===!1){if(Ge.deprecated===!0&&yt!==void 0&&yt.length>0){const vt=yt.indexOf(Ke.CompletionItemTag.Deprecated);vt!==-1&&yt.splice(vt,1)}ve.deprecated=Ge.deprecated}Ge.insertTextMode!==void 0&&(ve.insertTextMode=Ge.insertTextMode)}return yt!==void 0&&yt.length>0&&(ve.tags=yt),ve.insertTextMode===void 0&&p.keepWhitespace===!0&&(ve.insertTextMode=pe.InsertTextMode.adjustIndentation),ve}function fe(p,A){let te=pe.InsertTextFormat.PlainText,_e,ve;A.textEdit?(_e=A.textEdit.newText,ve=A.textEdit.range):A.insertText instanceof Ke.SnippetString?(te=pe.InsertTextFormat.Snippet,_e=A.insertText.value):_e=A.insertText,A.range&&(ve=A.range),p.insertTextFormat=te,A.fromEdit&&_e!==void 0&&ve!==void 0?p.textEdit=et(_e,ve):p.insertText=_e}function et(p,A){return Yo.is(A)?pe.InsertReplaceEdit.create(p,G(A.inserting),G(A.replacing)):{newText:p,range:G(A)}}function wt(p){return{range:G(p.range),newText:p.newText}}function mt(p){return p==null?p:p.map(wt)}function tt(p){return p<=Ke.SymbolKind.TypeParameter?p+1:pe.SymbolKind.Property}function ae(p){return p}function _(p){return p.map(ae)}function I(p,A,te){return{textDocument:i(p),position:P(A),context:{includeDeclaration:te.includeDeclaration}}}async function D(p,A){let te=pe.CodeAction.create(p.title);if(p instanceof Hf.default&&p.data!==void 0&&(te.data=p.data),p.kind!==void 0&&(te.kind=B(p.kind)),p.diagnostics!==void 0&&(te.diagnostics=await be(p.diagnostics,A)),p.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return p.command!==void 0&&(te.command=Ce(p.command)),p.isPreferred!==void 0&&(te.isPreferred=p.isPreferred),p.disabled!==void 0&&(te.disabled={reason:p.disabled.reason}),te}async function V(p,A){if(p==null)return p;let te;return p.only&&dn.string(p.only.value)&&(te=[p.only.value]),pe.CodeActionContext.create(await be(p.diagnostics,A),te,K(p.triggerKind))}function K(p){switch(p){case Ke.CodeActionTriggerKind.Invoke:return pe.CodeActionTriggerKind.Invoked;case Ke.CodeActionTriggerKind.Automatic:return pe.CodeActionTriggerKind.Automatic;default:return}}function B(p){if(p!=null)return p.value}function ue(p){return p==null?p:pe.InlineValueContext.create(p.frameId,G(p.stoppedLocation))}function Ce(p){let A=pe.Command.create(p.title,p.command);return p.arguments&&(A.arguments=p.arguments),A}function Ie(p){let A=pe.CodeLens.create(G(p.range));return p.command&&(A.command=Ce(p.command)),p instanceof Af.default&&p.data&&(A.data=p.data),A}function Le(p,A){const te={tabSize:p.tabSize,insertSpaces:p.insertSpaces};return A.trimTrailingWhitespace&&(te.trimTrailingWhitespace=!0),A.trimFinalNewlines&&(te.trimFinalNewlines=!0),A.insertFinalNewline&&(te.insertFinalNewline=!0),te}function bt(p){return{textDocument:i(p)}}function qt(p){return{textDocument:i(p)}}function Rn(p){let A=pe.DocumentLink.create(G(p.range));p.target&&(A.target=r(p.target)),p.tooltip!==void 0&&(A.tooltip=p.tooltip);let te=p instanceof jf.default?p:void 0;return te&&te.data&&(A.data=te.data),A}function Yt(p){return{textDocument:i(p)}}function Zt(p){const A={name:p.name,kind:tt(p.kind),uri:r(p.uri),range:G(p.range),selectionRange:G(p.selectionRange)};return p.detail!==void 0&&p.detail.length>0&&(A.detail=p.detail),p.tags!==void 0&&(A.tags=_(p.tags)),p instanceof Wf.default&&p.data!==void 0&&(A.data=p.data),A}function wn(p){const A={name:p.name,kind:tt(p.kind),uri:r(p.uri),range:G(p.range),selectionRange:G(p.selectionRange)};return p.detail!==void 0&&p.detail.length>0&&(A.detail=p.detail),p.tags!==void 0&&(A.tags=_(p.tags)),p instanceof Uf.default&&p.data!==void 0&&(A.data=p.data),A}function ct(p){const A=p instanceof xf.default?{name:p.name,kind:tt(p.kind),location:p.hasRange?X(p.location):{uri:n(p.location.uri)},data:p.data}:{name:p.name,kind:tt(p.kind),location:X(p.location)};return p.tags!==void 0&&(A.tags=_(p.tags)),p.containerName!==""&&(A.containerName=p.containerName),A}function bn(p){const A=typeof p.label=="string"?p.label:p.label.map(en),te=pe.InlayHint.create(F(p.position),A);return p.kind!==void 0&&(te.kind=p.kind),p.textEdits!==void 0&&(te.textEdits=mt(p.textEdits)),p.tooltip!==void 0&&(te.tooltip=St(p.tooltip)),p.paddingLeft!==void 0&&(te.paddingLeft=p.paddingLeft),p.paddingRight!==void 0&&(te.paddingRight=p.paddingRight),p instanceof zf.default&&p.data!==void 0&&(te.data=p.data),te}function en(p){const A=pe.InlayHintLabelPart.create(p.value);return p.location!==void 0&&(A.location=X(p.location)),p.command!==void 0&&(A.command=Ce(p.command)),p.tooltip!==void 0&&(A.tooltip=St(p.tooltip)),A}function St(p){return typeof p=="string"?p:{kind:pe.MarkupKind.Markdown,value:p.value}}return{asUri:r,asTextDocumentIdentifier:i,asTextDocumentItem:o,asVersionedTextDocumentIdentifier:s,asOpenTextDocumentParams:a,asChangeTextDocumentParams:m,asCloseTextDocumentParams:g,asSaveTextDocumentParams:d,asWillSaveTextDocumentParams:y,asDidCreateFilesParams:L,asDidRenameFilesParams:M,asDidDeleteFilesParams:x,asWillCreateFilesParams:b,asWillRenameFilesParams:E,asWillDeleteFilesParams:w,asTextDocumentPositionParams:$,asCompletionParams:T,asSignatureHelpParams:W,asWorkerPosition:P,asRange:G,asPosition:F,asPositions:j,asLocation:X,asDiagnosticSeverity:ie,asDiagnosticTag:Y,asDiagnostic:re,asDiagnostics:be,asCompletionItem:at,asTextEdit:wt,asSymbolKind:tt,asSymbolTag:ae,asSymbolTags:_,asReferenceParams:I,asCodeAction:D,asCodeActionContext:V,asInlineValueContext:ue,asCommand:Ce,asCodeLens:Ie,asFormattingOptions:Le,asDocumentSymbolParams:bt,asCodeLensParams:qt,asDocumentLink:Rn,asDocumentLinkParams:Yt,asCallHierarchyItem:Zt,asTypeHierarchyItem:wn,asInlayHint:bn,asWorkspaceSymbol:ct}}wr.createConverter=Kf;var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.createConverter=void 0;const Q=de.default,le=he,ht=Ee,ke=rt,Gf=br,Vf=Sr,Bf=Dr,Xf=Tr,vc=Qo,Jf=Pr,Qf=Er,Yf=kr,Zf=Or,Cc=he;var qr;(function(e){function t(n){let r=n;return r&&ht.string(r.language)&&ht.string(r.value)}e.is=t})(qr||(qr={}));function eh(e,t,n){const i=e||(u=>Q.Uri.parse(u));function o(u){return i(u)}function s(u){const R=[];for(const U of u)if(typeof U=="string")R.push(U);else if(Cc.NotebookCellTextDocumentFilter.is(U))if(typeof U.notebook=="string")R.push({notebookType:U.notebook,language:U.language});else{const ee=U.notebook.notebookType??"*";R.push({notebookType:ee,scheme:U.notebook.scheme,pattern:U.notebook.pattern,language:U.language})}else Cc.TextDocumentFilter.is(U)&&R.push({language:U.language,scheme:U.scheme,pattern:U.pattern});return R}async function a(u,R){return ke.map(u,l,R)}function c(u){const R=new Array(u.length);for(let U=0;U0?R:void 0}function d(u){switch(u){case le.DiagnosticTag.Unnecessary:return Q.DiagnosticTag.Unnecessary;case le.DiagnosticTag.Deprecated:return Q.DiagnosticTag.Deprecated;default:return}}function f(u){return u?new Q.Position(u.line,u.character):void 0}function y(u){return u?new Q.Range(u.start.line,u.start.character,u.end.line,u.end.character):void 0}async function L(u,R){return ke.map(u,U=>new Q.Range(U.start.line,U.start.character,U.end.line,U.end.character),R)}function M(u){if(u==null)return Q.DiagnosticSeverity.Error;switch(u){case le.DiagnosticSeverity.Error:return Q.DiagnosticSeverity.Error;case le.DiagnosticSeverity.Warning:return Q.DiagnosticSeverity.Warning;case le.DiagnosticSeverity.Information:return Q.DiagnosticSeverity.Information;case le.DiagnosticSeverity.Hint:return Q.DiagnosticSeverity.Hint}return Q.DiagnosticSeverity.Error}function x(u){if(ht.string(u))return E(u);if(qr.is(u))return E().appendCodeblock(u.value,u.language);if(Array.isArray(u)){let R=[];for(let U of u){let ee=E();qr.is(U)?ee.appendCodeblock(U.value,U.language):ee.appendMarkdown(U),R.push(ee)}return R}else return E(u)}function b(u){if(ht.string(u))return u;switch(u.kind){case le.MarkupKind.Markdown:return E(u.value);case le.MarkupKind.PlainText:return u.value;default:return`Unsupported Markup content received. Kind is: ${u.kind}`}}function E(u){let R;if(u===void 0||typeof u=="string")R=new Q.MarkdownString(u);else switch(u.kind){case le.MarkupKind.Markdown:R=new Q.MarkdownString(u.value);break;case le.MarkupKind.PlainText:R=new Q.MarkdownString,R.appendText(u.value);break;default:R=new Q.MarkdownString,R.appendText(`Unsupported Markup content received. Kind is: ${u.kind}`);break}return R.isTrusted=t,R.supportHtml=n,R}function w(u){if(!!u)return new Q.Hover(x(u.contents),y(u.range))}async function $(u,R,U){if(!u)return;if(Array.isArray(u))return ke.map(u,Dt=>O(Dt,R),U);const ee=u,{defaultRange:it,commitCharacters:Xe}=H(ee,R),Oe=await ke.map(ee.items,Dt=>O(Dt,Xe,it,ee.itemDefaults?.insertTextMode,ee.itemDefaults?.insertTextFormat,ee.itemDefaults?.data),U);return new Q.CompletionList(Oe,ee.isIncomplete)}function H(u,R){const U=u.itemDefaults?.editRange,ee=u.itemDefaults?.commitCharacters??R;return le.Range.is(U)?{defaultRange:y(U),commitCharacters:ee}:U!==void 0?{defaultRange:{inserting:y(U.insert),replacing:y(U.replace)},commitCharacters:ee}:{defaultRange:void 0,commitCharacters:ee}}function T(u){return le.CompletionItemKind.Text<=u&&u<=le.CompletionItemKind.TypeParameter?[u-1,void 0]:[Q.CompletionItemKind.Text,u]}function S(u){switch(u){case le.CompletionItemTag.Deprecated:return Q.CompletionItemTag.Deprecated}}function N(u){if(u==null)return[];const R=[];for(const U of u){const ee=S(U);ee!==void 0&&R.push(ee)}return R}function O(u,R,U,ee,it,Xe){const Oe=N(u.tags),Dt=C(u),$e=new Gf.default(Dt);u.detail&&($e.detail=u.detail),u.documentation&&($e.documentation=b(u.documentation),$e.documentationFormat=ht.string(u.documentation)?"$string":u.documentation.kind),u.filterText&&($e.filterText=u.filterText);const Zn=h(u,U,it);if(Zn&&($e.insertText=Zn.text,$e.range=Zn.range,$e.fromEdit=Zn.fromEdit),ht.number(u.kind)){let[cu,Vs]=T(u.kind);$e.kind=cu,Vs&&($e.originalItemKind=Vs)}u.sortText&&($e.sortText=u.sortText),u.additionalTextEdits&&($e.additionalTextEdits=F(u.additionalTextEdits));const Ks=u.commitCharacters!==void 0?ht.stringArray(u.commitCharacters)?u.commitCharacters:void 0:R;Ks&&($e.commitCharacters=Ks.slice()),u.command&&($e.command=_(u.command)),(u.deprecated===!0||u.deprecated===!1)&&($e.deprecated=u.deprecated,u.deprecated===!0&&Oe.push(Q.CompletionItemTag.Deprecated)),(u.preselect===!0||u.preselect===!1)&&($e.preselect=u.preselect);const Gs=u.data??Xe;Gs!==void 0&&($e.data=Gs),Oe.length>0&&($e.tags=Oe);const _i=u.insertTextMode??ee;return _i!==void 0&&($e.insertTextMode=_i,_i===le.InsertTextMode.asIs&&($e.keepWhitespace=!0)),$e}function C(u){return le.CompletionItemLabelDetails.is(u.labelDetails)?{label:u.label,detail:u.labelDetails.detail,description:u.labelDetails.description}:u.label}function h(u,R,U){const ee=u.insertTextFormat??U;if(u.textEdit!==void 0||R!==void 0){const[it,Xe]=u.textEdit!==void 0?k(u.textEdit):[R,u.textEditText??u.label];return ee===le.InsertTextFormat.Snippet?{text:new Q.SnippetString(Xe),range:it,fromEdit:!0}:{text:Xe,range:it,fromEdit:!0}}else return u.insertText?ee===le.InsertTextFormat.Snippet?{text:new Q.SnippetString(u.insertText),fromEdit:!1}:{text:u.insertText,fromEdit:!1}:void 0}function k(u){return le.InsertReplaceEdit.is(u)?[{inserting:y(u.insert),replacing:y(u.replace)},u.newText]:[y(u.range),u.newText]}function W(u){if(!!u)return new Q.TextEdit(y(u.range),u.newText)}async function P(u,R){if(!!u)return ke.map(u,W,R)}function F(u){if(!u)return;const R=new Array(u.length);for(let U=0;U0){let U=[];for(let ee of u.children)U.push(tt(ee));R.children=U}return R}function ae(u,R){u.tags=et(R.tags),R.deprecated&&(u.tags?u.tags.includes(Q.SymbolTag.Deprecated)||(u.tags=u.tags.concat(Q.SymbolTag.Deprecated)):u.tags=[Q.SymbolTag.Deprecated])}function _(u){let R={title:u.title,command:u.command};return u.arguments&&(R.arguments=u.arguments),R}async function I(u,R){if(!!u)return ke.map(u,_,R)}const D=new Map;D.set(le.CodeActionKind.Empty,Q.CodeActionKind.Empty),D.set(le.CodeActionKind.QuickFix,Q.CodeActionKind.QuickFix),D.set(le.CodeActionKind.Refactor,Q.CodeActionKind.Refactor),D.set(le.CodeActionKind.RefactorExtract,Q.CodeActionKind.RefactorExtract),D.set(le.CodeActionKind.RefactorInline,Q.CodeActionKind.RefactorInline),D.set(le.CodeActionKind.RefactorRewrite,Q.CodeActionKind.RefactorRewrite),D.set(le.CodeActionKind.Source,Q.CodeActionKind.Source),D.set(le.CodeActionKind.SourceOrganizeImports,Q.CodeActionKind.SourceOrganizeImports);function V(u){if(u==null)return;let R=D.get(u);if(R)return R;let U=u.split(".");R=Q.CodeActionKind.Empty;for(let ee of U)R=R.append(ee);return R}function K(u){if(u!=null)return u.map(R=>V(R))}async function B(u,R){if(u==null)return;let U=new Xf.default(u.title,u.data);return u.kind!==void 0&&(U.kind=V(u.kind)),u.diagnostics!==void 0&&(U.diagnostics=c(u.diagnostics)),u.edit!==void 0&&(U.edit=await Le(u.edit,R)),u.command!==void 0&&(U.command=_(u.command)),u.isPreferred!==void 0&&(U.isPreferred=u.isPreferred),u.disabled!==void 0&&(U.disabled={reason:u.disabled.reason}),U}function ue(u,R){return ke.mapAsync(u,async U=>le.Command.is(U)?_(U):B(U,R),R)}function Ce(u){if(!u)return;let R=new Vf.default(y(u.range));return u.command&&(R.command=_(u.command)),u.data!==void 0&&u.data!==null&&(R.data=u.data),R}async function Ie(u,R){if(!!u)return ke.map(u,Ce,R)}async function Le(u,R){if(!u)return;const U=new Map;if(u.changeAnnotations!==void 0){const Xe=u.changeAnnotations;await ke.forEach(Object.keys(Xe),Oe=>{const Dt=bt(Xe[Oe]);U.set(Oe,Dt)},R)}const ee=Xe=>{if(Xe!==void 0)return U.get(Xe)},it=new Q.WorkspaceEdit;if(u.documentChanges){const Xe=u.documentChanges;await ke.forEach(Xe,Oe=>{if(le.CreateFile.is(Oe))it.createFile(i(Oe.uri),Oe.options,ee(Oe.annotationId));else if(le.RenameFile.is(Oe))it.renameFile(i(Oe.oldUri),i(Oe.newUri),Oe.options,ee(Oe.annotationId));else if(le.DeleteFile.is(Oe))it.deleteFile(i(Oe.uri),Oe.options,ee(Oe.annotationId));else if(le.TextDocumentEdit.is(Oe)){const Dt=i(Oe.textDocument.uri);for(const $e of Oe.edits)le.AnnotatedTextEdit.is($e)?it.replace(Dt,y($e.range),$e.newText,ee($e.annotationId)):it.replace(Dt,y($e.range),$e.newText)}else throw new Error(`Unknown workspace edit change received: ${JSON.stringify(Oe,void 0,4)}`)},R)}else if(u.changes){const Xe=u.changes;await ke.forEach(Object.keys(Xe),Oe=>{it.set(i(Oe),F(Xe[Oe]))},R)}return it}function bt(u){if(u!==void 0)return{label:u.label,needsConfirmation:!!u.needsConfirmation,description:u.description}}function qt(u){let R=y(u.range),U=u.target?o(u.target):void 0,ee=new Bf.default(R,U);return u.tooltip!==void 0&&(ee.tooltip=u.tooltip),u.data!==void 0&&u.data!==null&&(ee.data=u.data),ee}async function Rn(u,R){if(!!u)return ke.map(u,qt,R)}function Yt(u){return new Q.Color(u.red,u.green,u.blue,u.alpha)}function Zt(u){return new Q.ColorInformation(y(u.range),Yt(u.color))}async function wn(u,R){if(!!u)return ke.map(u,Zt,R)}function ct(u){let R=new Q.ColorPresentation(u.label);return R.additionalTextEdits=F(u.additionalTextEdits),u.textEdit&&(R.textEdit=W(u.textEdit)),R}async function bn(u,R){if(!!u)return ke.map(u,ct,R)}function en(u){if(u)switch(u){case le.FoldingRangeKind.Comment:return Q.FoldingRangeKind.Comment;case le.FoldingRangeKind.Imports:return Q.FoldingRangeKind.Imports;case le.FoldingRangeKind.Region:return Q.FoldingRangeKind.Region}}function St(u){return new Q.FoldingRange(u.startLine,u.endLine,en(u.kind))}async function p(u,R){if(!!u)return ke.map(u,St,R)}function A(u){return new Q.SelectionRange(y(u.range),u.parent?A(u.parent):void 0)}async function te(u,R){return Array.isArray(u)?ke.map(u,A,R):[]}function _e(u){return le.InlineValueText.is(u)?new Q.InlineValueText(y(u.range),u.text):le.InlineValueVariableLookup.is(u)?new Q.InlineValueVariableLookup(y(u.range),u.variableName,u.caseSensitiveLookup):new Q.InlineValueEvaluatableExpression(y(u.range),u.expression)}async function ve(u,R){return Array.isArray(u)?ke.map(u,_e,R):[]}async function Ge(u,R){const U=typeof u.label=="string"?u.label:await ke.map(u.label,yt,R),ee=new Zf.default(f(u.position),U);return u.kind!==void 0&&(ee.kind=u.kind),u.textEdits!==void 0&&(ee.textEdits=await P(u.textEdits,R)),u.tooltip!==void 0&&(ee.tooltip=vt(u.tooltip)),u.paddingLeft!==void 0&&(ee.paddingLeft=u.paddingLeft),u.paddingRight!==void 0&&(ee.paddingRight=u.paddingRight),u.data!==void 0&&(ee.data=u.data),ee}function yt(u){const R=new Q.InlayHintLabelPart(u.value);return u.location!==void 0&&(R.location=Y(u.location)),u.tooltip!==void 0&&(R.tooltip=vt(u.tooltip)),u.command!==void 0&&(R.command=_(u.command)),R}function vt(u){return typeof u=="string"?u:E(u)}async function Yn(u,R){if(!!Array.isArray(u))return ke.mapAsync(u,Ge,R)}function Ht(u){if(u===null)return;const R=new Jf.default(at(u.kind),u.name,u.detail||"",o(u.uri),y(u.range),y(u.selectionRange),u.data);return u.tags!==void 0&&(R.tags=et(u.tags)),R}async function Sn(u,R){if(u!==null)return ke.map(u,Ht,R)}async function Dn(u,R){return new Q.CallHierarchyIncomingCall(Ht(u.from),await L(u.fromRanges,R))}async function Nt(u,R){if(u!==null)return ke.mapAsync(u,Dn,R)}async function v(u,R){return new Q.CallHierarchyOutgoingCall(Ht(u.to),await L(u.fromRanges,R))}async function z(u,R){if(u!==null)return ke.mapAsync(u,v,R)}async function J(u,R){if(u!=null)return new Q.SemanticTokens(new Uint32Array(u.data),u.resultId)}function ne(u){return new Q.SemanticTokensEdit(u.start,u.deleteCount,u.data!==void 0?new Uint32Array(u.data):void 0)}async function qe(u,R){if(u!=null)return new Q.SemanticTokensEdits(u.edits.map(ne),u.resultId)}function Ne(u){return u}async function Ae(u,R){if(u!=null)return new Q.LinkedEditingRanges(await L(u.ranges,R),ze(u.wordPattern))}function ze(u){if(u!=null)return new RegExp(u)}function Re(u){if(u===null)return;let R=new Qf.default(at(u.kind),u.name,u.detail||"",o(u.uri),y(u.range),y(u.selectionRange),u.data);return u.tags!==void 0&&(R.tags=et(u.tags)),R}async function Me(u,R){if(u!==null)return ke.map(u,Re,R)}function Pe(u){if(ht.string(u))return u;if(le.RelativePattern.is(u)){if(le.URI.is(u.baseUri))return new Q.RelativePattern(o(u.baseUri),u.pattern);if(le.WorkspaceFolder.is(u.baseUri)){const R=Q.workspace.getWorkspaceFolder(o(u.baseUri.uri));return R!==void 0?new Q.RelativePattern(R,u.pattern):void 0}}}return{asUri:o,asDocumentSelector:s,asDiagnostics:a,asDiagnostic:l,asRange:y,asRanges:L,asPosition:f,asDiagnosticSeverity:M,asDiagnosticTag:d,asHover:w,asCompletionResult:$,asCompletionItem:O,asTextEdit:W,asTextEdits:P,asSignatureHelp:j,asSignatureInformations:G,asSignatureInformation:X,asParameterInformations:ie,asParameterInformation:ce,asDeclarationResult:oe,asDefinitionResult:Z,asLocation:Y,asReferences:be,asDocumentHighlights:Be,asDocumentHighlight:Fe,asDocumentHighlightKind:xe,asSymbolKind:at,asSymbolTag:fe,asSymbolTags:et,asSymbolInformations:dt,asSymbolInformation:wt,asDocumentSymbols:mt,asDocumentSymbol:tt,asCommand:_,asCommands:I,asCodeAction:B,asCodeActionKind:V,asCodeActionKinds:K,asCodeActionResult:ue,asCodeLens:Ce,asCodeLenses:Ie,asWorkspaceEdit:Le,asDocumentLink:qt,asDocumentLinks:Rn,asFoldingRangeKind:en,asFoldingRange:St,asFoldingRanges:p,asColor:Yt,asColorInformation:Zt,asColorInformations:wn,asColorPresentation:ct,asColorPresentations:bn,asSelectionRange:A,asSelectionRanges:te,asInlineValue:_e,asInlineValues:ve,asInlayHint:Ge,asInlayHints:Yn,asSemanticTokensLegend:Ne,asSemanticTokens:J,asSemanticTokensEdit:ne,asSemanticTokensEdits:qe,asCallHierarchyItem:Ht,asCallHierarchyItems:Sn,asCallHierarchyIncomingCall:Dn,asCallHierarchyIncomingCalls:Nt,asCallHierarchyOutgoingCall:v,asCallHierarchyOutgoingCalls:z,asLinkedEditingRanges:Ae,asTypeHierarchyItem:Re,asTypeHierarchyItems:Me,asGlobPattern:Pe}}Ir.createConverter=eh;var De={};Object.defineProperty(De,"__esModule",{value:!0}),De.generateUuid=De.parse=De.isUUID=De.v4=De.empty=void 0;class Zo{constructor(t){this._value=t}asHex(){return this._value}equals(t){return this.asHex()===t.asHex()}}class ye extends Zo{constructor(){super([ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),"-",ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),"-","4",ye._randomHex(),ye._randomHex(),ye._randomHex(),"-",ye._oneOf(ye._timeHighBits),ye._randomHex(),ye._randomHex(),ye._randomHex(),"-",ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex(),ye._randomHex()].join(""))}static _oneOf(t){return t[Math.floor(t.length*Math.random())]}static _randomHex(){return ye._oneOf(ye._chars)}}ye._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"],ye._timeHighBits=["8","9","a","b"],De.empty=new Zo("00000000-0000-0000-0000-000000000000");function _c(){return new ye}De.v4=_c;const th=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Rc(e){return th.test(e)}De.isUUID=Rc;function nh(e){if(!Rc(e))throw new Error("invalid uuid");return new Zo(e)}De.parse=nh;function rh(){return _c().asHex()}De.generateUuid=rh;var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.ProgressPart=void 0;const wc=de.default,bc=he,Sc=Ee;class ih{constructor(t,n,r){this._client=t,this._token=n,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(bc.WorkDoneProgress.type,this._token,i=>{switch(i.kind){case"begin":this.begin(i);break;case"report":this.report(i);break;case"end":this.done(),r&&r(this);break}})}begin(t){this._infinite=t.percentage===void 0,this._lspProgressDisposable!==void 0&&wc.window.withProgress({location:wc.ProgressLocation.Window,cancellable:t.cancellable,title:t.title},async(n,r)=>{if(this._lspProgressDisposable!==void 0)return this._progress=n,this._cancellationToken=r,this._tokenDisposable=this._cancellationToken.onCancellationRequested(()=>{this._client.sendNotification(bc.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(t),new Promise((i,o)=>{this._resolve=i,this._reject=o})})}report(t){if(this._infinite&&Sc.string(t.message))this._progress!==void 0&&this._progress.report({message:t.message});else if(Sc.number(t.percentage)){const n=Math.max(0,Math.min(t.percentage,100)),r=Math.max(0,n-this._reported);this._reported+=r,this._progress!==void 0&&this._progress.report({message:t.message,increment:r})}}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}}Mn.ProgressPart=ih;var Te={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WorkspaceFeature=e.TextDocumentLanguageFeature=e.TextDocumentEventFeature=e.DynamicDocumentFeature=e.DynamicFeature=e.StaticFeature=e.ensure=e.LSPCancellationError=void 0;const t=de.default,n=he,r=Ee,i=De;class o extends t.CancellationError{constructor(d){super(),this.data=d}}e.LSPCancellationError=o;function s(g,d){return g[d]===void 0&&(g[d]={}),g[d]}e.ensure=s,function(g){function d(f){const y=f;return y!=null&&r.func(y.fillClientCapabilities)&&r.func(y.initialize)&&r.func(y.getState)&&r.func(y.dispose)&&(y.fillInitializeParams===void 0||r.func(y.fillInitializeParams))}g.is=d}(e.StaticFeature||(e.StaticFeature={})),function(g){function d(f){const y=f;return y!=null&&r.func(y.fillClientCapabilities)&&r.func(y.initialize)&&r.func(y.getState)&&r.func(y.dispose)&&(y.fillInitializeParams===void 0||r.func(y.fillInitializeParams))&&r.func(y.register)&&r.func(y.unregister)&&y.registrationType!==void 0}g.is=d}(e.DynamicFeature||(e.DynamicFeature={}));class a{constructor(d){this._client=d}getState(){const d=this.getDocumentSelectors();let f=0;for(const L of d){f++;for(const M of t.workspace.textDocuments)if(t.languages.match(L,M)>0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}const y=f>0;return{kind:"document",id:this.registrationType.method,registrations:y,matches:!1}}}e.DynamicDocumentFeature=a;class c extends a{constructor(d,f,y,L,M,x,b){super(d),this._event=f,this._type=y,this._middleware=L,this._createParams=M,this._textDocument=x,this._selectorFilter=b,this._selectors=new Map,this._onNotificationSent=new t.EventEmitter}static textDocumentFilter(d,f){for(const y of d)if(t.languages.match(y,f)>0)return!0;return!1}getStateInfo(){return[this._selectors.values(),!1]}getDocumentSelectors(){return this._selectors.values()}register(d){!d.registerOptions.documentSelector||(this._listener||(this._listener=this._event(f=>{this.callback(f).catch(y=>{this._client.error(`Sending document notification ${this._type.method} failed.`,y)})})),this._selectors.set(d.id,this._client.protocol2CodeConverter.asDocumentSelector(d.registerOptions.documentSelector)))}async callback(d){const f=async y=>{const L=this._createParams(y);await this._client.sendNotification(this._type,L).catch(),this.notificationSent(y,this._type,L)};if(this.matches(d)){const y=this._middleware();return y?y(d,L=>f(L)):f(d)}}matches(d){return this._client.hasDedicatedTextSynchronizationFeature(this._textDocument(d))?!1:!this._selectorFilter||this._selectorFilter(this._selectors.values(),d)}get onNotificationSent(){return this._onNotificationSent.event}notificationSent(d,f,y){this._onNotificationSent.fire({original:d,type:f,params:y})}unregister(d){this._selectors.delete(d),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}dispose(){this._selectors.clear(),this._onNotificationSent.dispose(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(d){for(const f of this._selectors.values())if(t.languages.match(f,d)>0)return{send:y=>this.callback(y)}}}e.TextDocumentEventFeature=c;class l extends a{constructor(d,f){super(d),this._registrationType=f,this._registrations=new Map}*getDocumentSelectors(){for(const d of this._registrations.values()){const f=d.data.registerOptions.documentSelector;f!==null&&(yield this._client.protocol2CodeConverter.asDocumentSelector(f))}}get registrationType(){return this._registrationType}register(d){if(!d.registerOptions.documentSelector)return;let f=this.registerLanguageProvider(d.registerOptions,d.id);this._registrations.set(d.id,{disposable:f[0],data:d,provider:f[1]})}unregister(d){let f=this._registrations.get(d);f!==void 0&&f.disposable.dispose()}dispose(){this._registrations.forEach(d=>{d.disposable.dispose()}),this._registrations.clear()}getRegistration(d,f){if(f){if(n.TextDocumentRegistrationOptions.is(f)){const y=n.StaticRegistrationOptions.hasId(f)?f.id:i.generateUuid(),L=f.documentSelector||d;if(L)return[y,Object.assign({},f,{documentSelector:L})]}else if(r.boolean(f)&&f===!0||n.WorkDoneProgressOptions.is(f)){if(!d)return[void 0,void 0];let y=r.boolean(f)&&f===!0?{documentSelector:d}:Object.assign({},f,{documentSelector:d});return[i.generateUuid(),y]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(d,f){if(!(!d||!f))return r.boolean(f)&&f===!0?{documentSelector:d}:Object.assign({},f,{documentSelector:d})}getProvider(d){for(const f of this._registrations.values()){let y=f.data.registerOptions.documentSelector;if(y!==null&&t.languages.match(this._client.protocol2CodeConverter.asDocumentSelector(y),d)>0)return f.provider}}getAllProviders(){const d=[];for(const f of this._registrations.values())d.push(f.provider);return d}}e.TextDocumentLanguageFeature=l;class m{constructor(d,f){this._client=d,this._registrationType=f,this._registrations=new Map}getState(){const d=this._registrations.size>0;return{kind:"workspace",id:this._registrationType.method,registrations:d}}get registrationType(){return this._registrationType}register(d){const f=this.registerLanguageProvider(d.registerOptions);this._registrations.set(d.id,{disposable:f[0],provider:f[1]})}unregister(d){let f=this._registrations.get(d);f!==void 0&&f.disposable.dispose()}dispose(){this._registrations.forEach(d=>{d.disposable.dispose()}),this._registrations.clear()}getProviders(){const d=[];for(const f of this._registrations.values())d.push(f.provider);return d}}e.WorkspaceFeature=m})(Te);var es={},oh=function(e,t){for(var n=[],r=0;r=0&&l>0){if(e===t)return[c,l];for(r=[],o=n.length;m>=0&&!a;)m==c?(r.push(m),c=n.indexOf(e,m+1)):r.length==1?a=[r.pop(),l]:(i=r.pop(),i=0?c:l;r.length&&(a=[o,s])}return a}var ch=oh,Ec=ah,uh=fh,kc="\0SLASH"+Math.random()+"\0",Fc="\0OPEN"+Math.random()+"\0",ts="\0CLOSE"+Math.random()+"\0",Oc="\0COMMA"+Math.random()+"\0",Ic="\0PERIOD"+Math.random()+"\0";function ns(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function lh(e){return e.split("\\\\").join(kc).split("\\{").join(Fc).split("\\}").join(ts).split("\\,").join(Oc).split("\\.").join(Ic)}function dh(e){return e.split(kc).join("\\").split(Fc).join("{").split(ts).join("}").split(Oc).join(",").split(Ic).join(".")}function qc(e){if(!e)return[""];var t=[],n=Ec("{","}",e);if(!n)return e.split(",");var r=n.pre,i=n.body,o=n.post,s=r.split(",");s[s.length-1]+="{"+i+"}";var a=qc(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),t.push.apply(t,s),t}function fh(e){return e?(e.substr(0,2)==="{}"&&(e="\\{\\}"+e.substr(2)),fn(lh(e),!0).map(dh)):[]}function hh(e){return"{"+e+"}"}function gh(e){return/^-?0\d/.test(e)}function ph(e,t){return e<=t}function mh(e,t){return e>=t}function fn(e,t){var n=[],r=Ec("{","}",e);if(!r||/\$$/.test(r.pre))return[e];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),s=i||o,a=r.body.indexOf(",")>=0;if(!s&&!a)return r.post.match(/,.*\}/)?(e=r.pre+"{"+r.body+ts+r.post,fn(e)):[e];var c;if(s)c=r.body.split(/\.\./);else if(c=qc(r.body),c.length===1&&(c=fn(c[0],!1).map(hh),c.length===1)){var m=r.post.length?fn(r.post,!1):[""];return m.map(function(C){return r.pre+c[0]+C})}var l=r.pre,m=r.post.length?fn(r.post,!1):[""],g;if(s){var d=ns(c[0]),f=ns(c[1]),y=Math.max(c[0].length,c[1].length),L=c.length==3?Math.abs(ns(c[2])):1,M=ph,x=f0){var H=new Array($+1).join("0");E<0?w="-"+H+w.slice(1):w=H+w}}g.push(w)}}else g=ch(c,function(O){return fn(O,!1)});for(var T=0;T"u"?this.pattern:e,Nr(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:yh(e)}var Sh=1024*64,Nr=function(e){if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>Sh)throw new TypeError("pattern is too long")};Ye.prototype.parse=Dh;var $r={};function Dh(e,t){Nr(e);var n=this.options;if(e==="**")if(n.noglobstar)e="*";else return is;if(e==="")return"";var r="",i=!!n.nocase,o=!1,s=[],a=[],c,l=!1,m=-1,g=-1,d=e.charAt(0)==="."?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",f=this;function y(){if(c){switch(c){case"*":r+=ss,i=!0;break;case"?":r+=os,i=!0;break;default:r+="\\"+c;break}f.debug("clearStateChar %j %j",c,r),c=!1}}for(var L=0,M=e.length,x;L-1;S--){var N=a[S],O=r.slice(0,N.reStart),C=r.slice(N.reStart,N.reEnd-8),h=r.slice(N.reEnd-8,N.reEnd),k=r.slice(N.reEnd);h+=k;var W=O.split("(").length-1,P=k;for(L=0;L"u"&&(n=this.partial),this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;var r=this.options;An.sep!=="/"&&(t=t.split(An.sep).join("/")),t=t.split(Lc),this.debug(this.pattern,"split",t);var i=this.set;this.debug(this.pattern,"set",i);var o,s;for(s=t.length-1;s>=0&&(o=t[s],!o);s--);for(s=0;s>> no match, partial?`,e,m,t,g),m===s))}var f;if(typeof c=="string"?(f=l===c,this.debug("string match",c,l,f)):(f=l.match(c),this.debug("pattern match",c,l,f)),!f)return!1}if(i===s&&o===a)return!0;if(i===s)return n;if(o===a)return i===s-1&&e[i]==="";throw new Error("wtf?")};function Ph(e){return e.replace(/\\(.)/g,"$1")}function Eh(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticFeature=e.DiagnosticPullMode=e.vsdiag=void 0;const t=rs,n=de.default,r=he,i=De,o=Te;function s(x,b){return x[b]===void 0&&(x[b]={}),x[b]}var a;(function(x){(function(b){b.full="full",b.unChanged="unChanged"})(x.DocumentDiagnosticReportKind||(x.DocumentDiagnosticReportKind={}))})(a=e.vsdiag||(e.vsdiag={}));var c;(function(x){x.onType="onType",x.onSave="onSave"})(c=e.DiagnosticPullMode||(e.DiagnosticPullMode={}));var l;(function(x){x.active="open",x.reschedule="reschedule",x.outDated="drop"})(l||(l={}));class m{constructor(){this.open=new Set;const b=()=>{this.open.clear();for(const E of n.window.tabGroups.all)for(const w of E.tabs){const $=w.input;$ instanceof n.TabInputText?this.open.add($.uri.toString()):$ instanceof n.TabInputTextDiff&&this.open.add($.modified.toString())}};b(),n.window.tabGroups.onDidChangeTabs!==void 0?this.disposable=n.window.tabGroups.onDidChangeTabs(b):this.disposable={dispose:()=>{}}}dispose(){this.disposable.dispose()}isActive(b){return b instanceof n.Uri?n.window.activeTextEditor?.document.uri===b:n.window.activeTextEditor?.document===b}isVisible(b){const E=b instanceof n.Uri?b:b.uri;return this.open.has(E.toString())}getTabResources(){const b=[];for(const E of n.window.tabGroups.all)for(const w of E.tabs){const $=w.input;$ instanceof n.TabInputText?b.push($.uri):$ instanceof n.TabInputTextDiff&&b.push($.modified)}return b}}var g;(function(x){x[x.document=1]="document",x[x.workspace=2]="workspace"})(g||(g={}));class d{constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(b,E,w){const $=b===g.document?this.documentPullStates:this.workspacePullStates,[H,T,S]=E instanceof n.Uri?[E.toString(),E,w]:[E.uri.toString(),E.uri,E.version];let N=$.get(H);return N===void 0&&(N={document:T,pulledVersion:S,resultId:void 0},$.set(H,N)),N}update(b,E,w,$){const H=b===g.document?this.documentPullStates:this.workspacePullStates,[T,S,N,O]=E instanceof n.Uri?[E.toString(),E,w,$]:[E.uri.toString(),E.uri,E.version,w];let C=H.get(T);C===void 0?(C={document:S,pulledVersion:N,resultId:O},H.set(T,C)):(C.pulledVersion=N,C.resultId=O)}unTrack(b,E){const w=E instanceof n.Uri?E.toString():E.uri.toString();(b===g.document?this.documentPullStates:this.workspacePullStates).delete(w)}tracks(b,E){const w=E instanceof n.Uri?E.toString():E.uri.toString();return(b===g.document?this.documentPullStates:this.workspacePullStates).has(w)}getResultId(b,E){const w=E instanceof n.Uri?E.toString():E.uri.toString();return(b===g.document?this.documentPullStates:this.workspacePullStates).get(w)?.resultId}getAllResultIds(){const b=[];for(let[E,w]of this.workspacePullStates)this.documentPullStates.has(E)&&(w=this.documentPullStates.get(E)),w.resultId!==void 0&&b.push({uri:E,value:w.resultId});return b}}class f{constructor(b,E,w){this.client=b,this.tabs=E,this.options=w,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new n.EventEmitter,this.provider=this.createProvider(),this.diagnostics=n.languages.createDiagnosticCollection(w.identifier),this.openRequests=new Map,this.documentStates=new d,this.workspaceErrorCounter=0}knows(b,E){return this.documentStates.tracks(b,E)}pull(b,E){if(this.isDisposed)return;const w=b instanceof n.Uri?b:b.uri;this.pullAsync(b).then(()=>{E&&E()},$=>{this.client.error(`Document pull failed for text document ${w.toString()}`,$,!1)})}async pullAsync(b,E){if(this.isDisposed)return;const w=b instanceof n.Uri,$=w?b:b.uri,H=$.toString();E=w?E:b.version;const T=this.openRequests.get(H),S=w?this.documentStates.track(g.document,b,E):this.documentStates.track(g.document,b);if(T===void 0){const N=new n.CancellationTokenSource;this.openRequests.set(H,{state:l.active,document:b,version:E,tokenSource:N});let O,C;try{O=await this.provider.provideDiagnostics(b,S.resultId,N.token)??{kind:a.DocumentDiagnosticReportKind.full,items:[]}}catch(h){if(h instanceof o.LSPCancellationError&&r.DiagnosticServerCancellationData.is(h.data)&&h.data.retriggerRequest===!1&&(C={state:l.outDated,document:b}),C===void 0&&h instanceof n.CancellationError)C={state:l.reschedule,document:b};else throw h}if(C=C??this.openRequests.get(H),C===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${H}`),this.diagnostics.delete($);return}if(this.openRequests.delete(H),!this.tabs.isVisible(b)){this.documentStates.unTrack(g.document,b);return}if(C.state===l.outDated)return;O!==void 0&&(O.kind===a.DocumentDiagnosticReportKind.full&&this.diagnostics.set($,O.items),S.pulledVersion=E,S.resultId=O.resultId),C.state===l.reschedule&&this.pull(b)}else T.state===l.active?(T.tokenSource.cancel(),this.openRequests.set(H,{state:l.reschedule,document:T.document})):T.state===l.outDated&&this.openRequests.set(H,{state:l.reschedule,document:T.document})}cleanupPull(b){const E=b instanceof n.Uri?b:b.uri,w=E.toString(),$=this.openRequests.get(w);this.options.workspaceDiagnostics||this.options.interFileDependencies?$!==void 0?this.openRequests.set(w,{state:l.reschedule,document:b}):this.pull(b):($!==void 0&&($.state===l.active&&$.tokenSource.cancel(),this.openRequests.set(w,{state:l.outDated,document:b})),this.diagnostics.delete(E))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,r.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},b=>{!(b instanceof o.LSPCancellationError)&&!r.DiagnosticServerCancellationData.is(b.data)&&(this.client.error("Workspace diagnostic pull failed.",b,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,r.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3))})}async pullWorkspaceAsync(){if(!this.provider.provideWorkspaceDiagnostics||this.isDisposed)return;this.workspaceCancellation!==void 0&&(this.workspaceCancellation.cancel(),this.workspaceCancellation=void 0),this.workspaceCancellation=new n.CancellationTokenSource;const b=this.documentStates.getAllResultIds().map(E=>({uri:this.client.protocol2CodeConverter.asUri(E.uri),value:E.value}));await this.provider.provideWorkspaceDiagnostics(b,this.workspaceCancellation.token,E=>{if(!(!E||this.isDisposed))for(const w of E.items)w.kind===a.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(g.document,w.uri)||this.diagnostics.set(w.uri,w.items)),this.documentStates.update(g.workspace,w.uri,w.version??void 0,w.resultId)})}createProvider(){const b={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(E,w,$)=>{const H=(S,N,O)=>{const C={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(S instanceof n.Uri?S:S.uri)},previousResultId:N};return this.isDisposed===!0||!this.client.isRunning()?{kind:a.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(r.DocumentDiagnosticRequest.type,C,O).then(async h=>h==null||this.isDisposed||O.isCancellationRequested?{kind:a.DocumentDiagnosticReportKind.full,items:[]}:h.kind===r.DocumentDiagnosticReportKind.Full?{kind:a.DocumentDiagnosticReportKind.full,resultId:h.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(h.items,O)}:{kind:a.DocumentDiagnosticReportKind.unChanged,resultId:h.resultId},h=>this.client.handleFailedRequest(r.DocumentDiagnosticRequest.type,O,h,{kind:a.DocumentDiagnosticReportKind.full,items:[]}))},T=this.client.middleware;return T.provideDiagnostics?T.provideDiagnostics(E,w,$,H):H(E,w,$)}};return this.options.workspaceDiagnostics&&(b.provideWorkspaceDiagnostics=(E,w,$)=>{const H=async O=>O.kind===r.DocumentDiagnosticReportKind.Full?{kind:a.DocumentDiagnosticReportKind.full,uri:this.client.protocol2CodeConverter.asUri(O.uri),resultId:O.resultId,version:O.version,items:await this.client.protocol2CodeConverter.asDiagnostics(O.items,w)}:{kind:a.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(O.uri),resultId:O.resultId,version:O.version},T=O=>{const C=[];for(const h of O)C.push({uri:this.client.code2ProtocolConverter.asUri(h.uri),value:h.value});return C},S=(O,C)=>{const h=(0,i.generateUuid)(),k=this.client.onProgress(r.WorkspaceDiagnosticRequest.partialResult,h,async P=>{if(P==null){$(null);return}const F={items:[]};for(const j of P.items)try{F.items.push(await H(j))}catch(G){this.client.error("Converting workspace diagnostics failed.",G)}$(F)}),W={identifier:this.options.identifier,previousResultIds:T(O),partialResultToken:h};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(r.WorkspaceDiagnosticRequest.type,W,C).then(async P=>{if(C.isCancellationRequested)return{items:[]};const F={items:[]};for(const j of P.items)F.items.push(await H(j));return k.dispose(),$(F),{items:[]}},P=>(k.dispose(),this.client.handleFailedRequest(r.DocumentDiagnosticRequest.type,C,P,{items:[]})))},N=this.client.middleware;return N.provideWorkspaceDiagnostics?N.provideWorkspaceDiagnostics(E,w,$,S):S(E,w)}),b}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(const[b,E]of this.openRequests)E.state===l.active&&E.tokenSource.cancel(),this.openRequests.set(b,{state:l.outDated,document:E.document});this.diagnostics.dispose()}}class y{constructor(b){this.diagnosticRequestor=b,this.documents=new r.LinkedMap,this.isDisposed=!1}add(b){if(this.isDisposed===!0)return;const E=b instanceof n.Uri?b.toString():b.uri.toString();this.documents.has(E)||(this.documents.set(E,b,r.Touch.Last),this.trigger())}remove(b){const E=b instanceof n.Uri?b.toString():b.uri.toString();this.documents.has(E)&&(this.documents.delete(E),this.diagnosticRequestor.pull(b)),this.documents.size===0?this.stop():b===this.endDocument&&(this.endDocument=this.documents.last)}trigger(){if(this.isDisposed!==!0){if(this.intervalHandle!==void 0){this.endDocument=this.documents.last;return}this.endDocument=this.documents.last,this.intervalHandle=(0,r.RAL)().timer.setInterval(()=>{const b=this.documents.first;if(b!==void 0){const E=b instanceof n.Uri?b.toString():b.uri.toString();this.diagnosticRequestor.pull(b),this.documents.set(E,b,r.Touch.Last),b===this.endDocument&&this.stop()}},200)}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear()}stop(){this.intervalHandle?.dispose(),this.intervalHandle=void 0,this.endDocument=void 0}}class L{constructor(b,E,w){const $=b.clientOptions.diagnosticPullOptions??{onChange:!0,onSave:!1},H=b.protocol2CodeConverter.asDocumentSelector(w.documentSelector),T=[],S=P=>{const F=w.documentSelector;if($.match!==void 0)return $.match(F,P);for(const j of F)if(!!r.TextDocumentFilter.is(j)){if(typeof j=="string"||j.language!==void 0&&j.language!=="*"||j.scheme!==void 0&&j.scheme!=="*"&&j.scheme!==P.scheme)return!1;if(j.pattern!==void 0){const G=new t.Minimatch(j.pattern,{noext:!0});if(!G.makeRe()||!G.match(P.fsPath))return!1}}return!0},N=P=>P instanceof n.Uri?S(P):n.languages.match(H,P)>0&&E.isVisible(P),O=P=>P instanceof n.Uri?this.activeTextDocument?.uri.toString()===P.toString():this.activeTextDocument===P;this.diagnosticRequestor=new f(b,E,w),this.backgroundScheduler=new y(this.diagnosticRequestor);const C=P=>{!N(P)||!w.interFileDependencies||O(P)||this.backgroundScheduler.add(P)};this.activeTextDocument=n.window.activeTextEditor?.document,n.window.onDidChangeActiveTextEditor(P=>{const F=this.activeTextDocument;this.activeTextDocument=P?.document,F!==void 0&&C(F),this.activeTextDocument!==void 0&&this.backgroundScheduler.remove(this.activeTextDocument)});const h=b.getFeature(r.DidOpenTextDocumentNotification.method);T.push(h.onNotificationSent(P=>{const F=P.original;N(F)&&this.diagnosticRequestor.pull(F,()=>{C(F)})}));const k=new Set;for(const P of n.workspace.textDocuments)N(P)&&(this.diagnosticRequestor.pull(P,()=>{C(P)}),k.add(P.uri.toString()));if($.onTabs===!0)for(const P of E.getTabResources())!k.has(P.toString())&&N(P)&&this.diagnosticRequestor.pull(P,()=>{C(P)});if($.onChange===!0){const P=b.getFeature(r.DidChangeTextDocumentNotification.method);T.push(P.onNotificationSent(async F=>{const j=F.original.document;($.filter===void 0||!$.filter(j,c.onType))&&this.diagnosticRequestor.knows(g.document,j)&&F.original.contentChanges.length>0&&this.diagnosticRequestor.pull(j,()=>{this.backgroundScheduler.trigger()})}))}if($.onSave===!0){const P=b.getFeature(r.DidSaveTextDocumentNotification.method);T.push(P.onNotificationSent(F=>{const j=F.original;($.filter===void 0||!$.filter(j,c.onSave))&&this.diagnosticRequestor.knows(g.document,j)&&this.diagnosticRequestor.pull(F.original,()=>{this.backgroundScheduler.trigger()})}))}const W=b.getFeature(r.DidCloseTextDocumentNotification.method);T.push(W.onNotificationSent(P=>{const F=P.original;this.diagnosticRequestor.cleanupPull(F),this.backgroundScheduler.remove(F)})),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(const P of n.workspace.textDocuments)N(P)&&this.diagnosticRequestor.pull(P)}),w.workspaceDiagnostics===!0&&w.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=n.Disposable.from(...T,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}}class M extends o.TextDocumentLanguageFeature{constructor(b){super(b,r.DocumentDiagnosticRequest.type)}fillClientCapabilities(b){let E=s(s(b,"textDocument"),"diagnostic");E.dynamicRegistration=!0,E.relatedDocumentSupport=!1,s(s(b,"workspace"),"diagnostics").refreshSupport=!0}initialize(b,E){this._client.onRequest(r.DiagnosticRefreshRequest.type,async()=>{for(const T of this.getAllProviders())T.onDidChangeDiagnosticsEmitter.fire()});let[$,H]=this.getRegistration(E,b.diagnosticProvider);!$||!H||this.register({id:$,registerOptions:H})}dispose(){this.tabs!==void 0&&(this.tabs.dispose(),this.tabs=void 0),super.dispose()}registerLanguageProvider(b){this.tabs===void 0&&(this.tabs=new m);const E=new L(this._client,this.tabs,b);return[E.disposable,E]}}e.DiagnosticFeature=M})(es);var Lr={};Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.NotebookDocumentSyncFeature=void 0;const Ze=de.default,kh=rs,kt=he,Fh=De,Ac=Ee;function jc(e,t){return e[t]===void 0&&(e[t]={}),e[t]}var hn;(function(e){(function(t){function n(g,d){return{version:g.version,uri:d.asUri(g.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function r(g,d,f){const y=kt.NotebookDocument.create(f.asUri(g.uri),g.notebookType,g.version,i(d,f));return Object.keys(g.metadata).length>0&&(y.metadata=o(g.metadata)),y}t.asNotebookDocument=r;function i(g,d){return g.map(f=>s(f,d))}t.asNotebookCells=i;function o(g){return c(new Set,g)}t.asMetadata=o;function s(g,d){const f=kt.NotebookCell.create(a(g.kind),d.asUri(g.document.uri));return Object.keys(g.metadata).length>0&&(f.metadata=o(g.metadata)),g.executionSummary!==void 0&&Ac.number(g.executionSummary.executionOrder)&&Ac.boolean(g.executionSummary.success)&&(f.executionSummary={executionOrder:g.executionSummary.executionOrder,success:g.executionSummary.success}),f}t.asNotebookCell=s;function a(g){switch(g){case Ze.NotebookCellKind.Markup:return kt.NotebookCellKind.Markup;case Ze.NotebookCellKind.Code:return kt.NotebookCellKind.Code}}function c(g,d){if(g.has(d))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(d)){const f=[];for(const y of d)if(y!==null&&typeof y=="object"||Array.isArray(y))f.push(c(g,y));else{if(y instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");f.push(y)}return f}else{const f=Object.keys(d),y=Object.create(null);for(const L of f){const M=d[L];if(M!==null&&typeof M=="object"||Array.isArray(M))y[L]=c(g,M);else{if(M instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");y[L]=M}}return y}}function l(g,d){const f=d.asChangeTextDocumentParams(g);return{document:f.textDocument,changes:f.contentChanges}}t.asTextContentChange=l;function m(g,d){const f=Object.create(null);if(g.metadata&&(f.metadata=e.c2p.asMetadata(g.metadata)),g.cells!==void 0){const y=Object.create(null),L=g.cells;L.structure&&(y.structure={array:{start:L.structure.array.start,deleteCount:L.structure.array.deleteCount,cells:L.structure.array.cells!==void 0?L.structure.array.cells.map(M=>e.c2p.asNotebookCell(M,d)):void 0},didOpen:L.structure.didOpen!==void 0?L.structure.didOpen.map(M=>d.asOpenTextDocumentParams(M.document).textDocument):void 0,didClose:L.structure.didClose!==void 0?L.structure.didClose.map(M=>d.asCloseTextDocumentParams(M.document).textDocument):void 0}),L.data!==void 0&&(y.data=L.data.map(M=>e.c2p.asNotebookCell(M,d))),L.textContent!==void 0&&(y.textContent=L.textContent.map(M=>e.c2p.asTextContentChange(M,d))),Object.keys(y).length>0&&(f.cells=y)}return f}t.asNotebookDocumentChangeEvent=m})(e.c2p||(e.c2p={}))})(hn||(hn={}));var as;(function(e){function t(a,c,l){const m=a.length,g=c.length;let d=0;for(;d=0&&y>=0&&n(a[f],c[y],l);)f--,y--;const L=f+1-d,M=d===y+1?void 0:c.slice(d,y+1);return M!==void 0?{start:d,deleteCount:L,cells:M}:{start:d,deleteCount:L}}else return dr.document.uri.toString()))}}e.create=t})(Ar||(Ar={}));class jr{constructor(t,n){this.client=t,this.options=n,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=t.protocol2CodeConverter.asDocumentSelector(Mr.asDocumentSelector(n)),Ze.workspace.onDidOpenNotebookDocument(r=>{this.notebookDidOpen.add(r.uri.toString()),this.didOpen(r)},void 0,this.disposables);for(const r of Ze.workspace.notebookDocuments)this.notebookDidOpen.add(r.uri.toString()),this.didOpen(r);Ze.workspace.onDidChangeNotebookDocument(r=>this.didChangeNotebookDocument(r),void 0,this.disposables),this.options.save===!0&&Ze.workspace.onDidSaveNotebookDocument(r=>this.didSave(r),void 0,this.disposables),Ze.workspace.onDidCloseNotebookDocument(r=>{this.didClose(r),this.notebookDidOpen.delete(r.uri.toString())},void 0,this.disposables)}getState(){for(const t of Ze.workspace.notebookDocuments)if(this.getMatchingCells(t)!==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(t){return Ze.languages.match(this.selector,t)>0}didOpenNotebookCellTextDocument(t,n){if(Ze.languages.match(this.selector,n.document)===0||!this.notebookDidOpen.has(t.uri.toString()))return;const r=this.notebookSyncInfo.get(t.uri.toString()),i=this.cellMatches(t,n);if(r!==void 0){const o=r.uris.has(n.document.uri.toString());if(i&&o||!i&&!o)return;if(i){const s=this.getMatchingCells(t);if(s!==void 0){const a=this.asNotebookDocumentChangeEvent(t,void 0,r,s);a!==void 0&&this.doSendChange(a,s).catch(()=>{})}}}else i&&this.doSendOpen(t,[n]).catch(()=>{})}didChangeNotebookCellTextDocument(t,n){Ze.languages.match(this.selector,n.document)!==0&&this.doSendChange({notebook:t,cells:{textContent:[n]}},void 0).catch(()=>{})}didCloseNotebookCellTextDocument(t,n){const r=this.notebookSyncInfo.get(t.uri.toString());if(r===void 0)return;const i=n.document.uri,o=r.cells.findIndex(s=>s.document.uri.toString()===i.toString());if(o!==-1)if(o===0&&r.cells.length===1)this.doSendClose(t,r.cells).catch(()=>{});else{const s=r.cells.slice(),a=s.splice(o,1);this.doSendChange({notebook:t,cells:{structure:{array:{start:o,deleteCount:1},didClose:a}}},s).catch(()=>{})}}dispose(){for(const t of this.disposables)t.dispose()}didOpen(t,n=this.getMatchingCells(t),r=this.notebookSyncInfo.get(t.uri.toString())){if(r!==void 0)if(n!==void 0){const i=this.asNotebookDocumentChangeEvent(t,void 0,r,n);i!==void 0&&this.doSendChange(i,n).catch(()=>{})}else this.doSendClose(t,[]).catch(()=>{});else{if(n===void 0)return;this.doSendOpen(t,n).catch(()=>{})}}didChangeNotebookDocument(t){const n=t.notebook,r=this.notebookSyncInfo.get(n.uri.toString());if(r===void 0){if(t.contentChanges.length===0)return;const i=this.getMatchingCells(n);if(i===void 0)return;this.didOpen(n,i,r)}else{const i=this.getMatchingCells(n);if(i===void 0){this.didClose(n,r);return}const o=this.asNotebookDocumentChangeEvent(t.notebook,t,r,i);o!==void 0&&this.doSendChange(o,i).catch(()=>{})}}didSave(t){this.notebookSyncInfo.get(t.uri.toString())!==void 0&&this.doSendSave(t).catch(()=>{})}didClose(t,n=this.notebookSyncInfo.get(t.uri.toString())){if(n===void 0)return;const r=t.getCells().filter(i=>n.uris.has(i.document.uri.toString()));this.doSendClose(t,r).catch(()=>{})}async sendDidOpenNotebookDocument(t){const n=this.getMatchingCells(t);if(n!==void 0)return this.doSendOpen(t,n)}async doSendOpen(t,n){const r=async(o,s)=>{const a=hn.c2p.asNotebookDocument(o,s,this.client.code2ProtocolConverter),c=s.map(l=>this.client.code2ProtocolConverter.asTextDocumentItem(l.document));try{await this.client.sendNotification(kt.DidOpenNotebookDocumentNotification.type,{notebookDocument:a,cellTextDocuments:c})}catch(l){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",l),l}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(t.uri.toString(),Ar.create(n)),i?.didOpen!==void 0?i.didOpen(t,n,r):r(t,n)}async sendDidChangeNotebookDocument(t){return this.doSendChange(t,void 0)}async doSendChange(t,n=this.getMatchingCells(t.notebook)){const r=async o=>{try{await this.client.sendNotification(kt.DidChangeNotebookDocumentNotification.type,{notebookDocument:hn.c2p.asVersionedNotebookDocumentIdentifier(o.notebook,this.client.code2ProtocolConverter),change:hn.c2p.asNotebookDocumentChangeEvent(o,this.client.code2ProtocolConverter)})}catch(s){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",s),s}},i=this.client.middleware?.notebooks;return t.cells?.structure!==void 0&&this.notebookSyncInfo.set(t.notebook.uri.toString(),Ar.create(n??[])),i?.didChange!==void 0?i?.didChange(t,r):r(t)}async sendDidSaveNotebookDocument(t){return this.doSendSave(t)}async doSendSave(t){const n=async i=>{try{await this.client.sendNotification(kt.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}})}catch(o){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",o),o}},r=this.client.middleware?.notebooks;return r?.didSave!==void 0?r.didSave(t,n):n(t)}async sendDidCloseNotebookDocument(t){return this.doSendClose(t,this.getMatchingCells(t)??[])}async doSendClose(t,n){const r=async(o,s)=>{try{await this.client.sendNotification(kt.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(o.uri)},cellTextDocuments:s.map(a=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(a.document))})}catch(a){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",a),a}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(t.uri.toString()),i?.didClose!==void 0?i.didClose(t,n,r):r(t,n)}asNotebookDocumentChangeEvent(t,n,r,i){if(n!==void 0&&n.notebook!==t)throw new Error("Notebook must be identical");const o={notebook:t};n?.metadata!==void 0&&(o.metadata=hn.c2p.asMetadata(n.metadata));let s;if(n?.cellChanges!==void 0&&n.cellChanges.length>0){const a=[];s=new Set(i.map(c=>c.document.uri.toString()));for(const c of n.cellChanges)s.has(c.cell.document.uri.toString())&&(c.executionSummary!==void 0||c.metadata!==void 0)&&a.push(c.cell);a.length>0&&(o.cells=o.cells??{},o.cells.data=a)}if((n?.contentChanges!==void 0&&n.contentChanges.length>0||n===void 0)&&r!==void 0&&i!==void 0){const a=r.cells,c=i,l=as.computeDiff(a,c,!1);let m,g;if(l!==void 0){m=l.cells===void 0?new Map:new Map(l.cells.map(y=>[y.document.uri.toString(),y])),g=l.deleteCount===0?new Map:new Map(a.slice(l.start,l.start+l.deleteCount).map(y=>[y.document.uri.toString(),y]));for(const y of Array.from(g.keys()))m.has(y)&&(g.delete(y),m.delete(y));o.cells=o.cells??{};const d=[],f=[];if(m.size>0||g.size>0){for(const y of m.values())d.push(y);for(const y of g.values())f.push(y)}o.cells.structure={array:l,didOpen:d,didClose:f}}}return Object.keys(o).length>1?o:void 0}getMatchingCells(t,n=t.getCells()){if(this.options.notebookSelector!==void 0){for(const r of this.options.notebookSelector)if(r.notebook===void 0){if(r.cells===void 0)return;const i=this.filterCells(t,n,r.cells);return i.length===0?void 0:i}else if(cs.matchNotebook(r.notebook,t))return r.cells===void 0?n:this.filterCells(t,n,r.cells)}}cellMatches(t,n){const r=this.getMatchingCells(t,[n]);return r!==void 0&&r[0]===n}filterCells(t,n,r){const i=n.filter(o=>{const s=o.document.languageId;return r.some(a=>a.language==="*"||s===a.language)});return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(t,n):i}}class Jt{constructor(t){this.client=t,this.registrations=new Map,this.registrationType=kt.NotebookDocumentSyncRegistrationType.type,Ze.workspace.onDidOpenTextDocument(n=>{if(n.uri.scheme!==Jt.CellScheme)return;const[r,i]=this.findNotebookDocumentAndCell(n);if(!(r===void 0||i===void 0))for(const o of this.registrations.values())o instanceof jr&&o.didOpenNotebookCellTextDocument(r,i)}),Ze.workspace.onDidChangeTextDocument(n=>{if(n.contentChanges.length===0)return;const r=n.document;if(r.uri.scheme!==Jt.CellScheme)return;const[i]=this.findNotebookDocumentAndCell(r);if(i!==void 0)for(const o of this.registrations.values())o instanceof jr&&o.didChangeNotebookCellTextDocument(i,n)}),Ze.workspace.onDidCloseTextDocument(n=>{if(n.uri.scheme!==Jt.CellScheme)return;const[r,i]=this.findNotebookDocumentAndCell(n);if(!(r===void 0||i===void 0))for(const o of this.registrations.values())o instanceof jr&&o.didCloseNotebookCellTextDocument(r,i)})}getState(){if(this.registrations.size===0)return{kind:"document",id:this.registrationType.method,registrations:!1,matches:!1};for(const t of this.registrations.values()){const n=t.getState();if(n.kind==="document"&&n.registrations===!0&&n.matches===!0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!1}}fillClientCapabilities(t){const n=jc(jc(t,"notebookDocument"),"synchronization");n.dynamicRegistration=!0,n.executionSummarySupport=!0}preInitialize(t){const n=t.notebookDocumentSync;n!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(Mr.asDocumentSelector(n)))}initialize(t){const n=t.notebookDocumentSync;if(n===void 0)return;const r=n.id??Fh.generateUuid();this.register({id:r,registerOptions:n})}register(t){const n=new jr(this.client,t.registerOptions);this.registrations.set(t.id,n)}unregister(t){const n=this.registrations.get(t);n&&n.dispose()}dispose(){for(const t of this.registrations.values())t.dispose();this.registrations.clear()}handles(t){if(t.uri.scheme!==Jt.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&Ze.languages.match(this.dedicatedChannel,t)>0)return!0;for(const n of this.registrations.values())if(n.handles(t))return!0;return!1}getProvider(t){for(const n of this.registrations.values())if(n.handles(t.document))return n}findNotebookDocumentAndCell(t){const n=t.uri.toString();for(const r of Ze.workspace.notebookDocuments)for(const i of r.getCells())if(i.document.uri.toString()===n)return[r,i];return[void 0,void 0]}}Lr.NotebookDocumentSyncFeature=Jt,Jt.CellScheme="vscode-notebook-cell";var At={};Object.defineProperty(At,"__esModule",{value:!0}),At.SyncConfigurationFeature=At.toJSONObject=At.ConfigurationFeature=void 0;const gn=de.default,jn=he,Oh=Ee,Ih=De,Hc=Te;class qh{constructor(t){this._client=t}getState(){return{kind:"static"}}fillClientCapabilities(t){t.workspace=t.workspace||{},t.workspace.configuration=!0}initialize(){let t=this._client;t.onRequest(jn.ConfigurationRequest.type,(n,r)=>{let i=s=>{let a=[];for(let c of s.items){let l=c.scopeUri!==void 0&&c.scopeUri!==null?this._client.protocol2CodeConverter.asUri(c.scopeUri):void 0;a.push(this.getConfiguration(l,c.section!==null?c.section:void 0))}return a},o=t.middleware.workspace;return o&&o.configuration?o.configuration(n,r,i):i(n)})}getConfiguration(t,n){let r=null;if(n){let i=n.lastIndexOf(".");if(i===-1)r=Kt(gn.workspace.getConfiguration(void 0,t).get(n));else{let o=gn.workspace.getConfiguration(n.substr(0,i),t);o&&(r=Kt(o.get(n.substr(i+1))))}}else{let i=gn.workspace.getConfiguration(void 0,t);r={};for(let o of Object.keys(i))i.has(o)&&(r[o]=Kt(i.get(o)))}return r===void 0&&(r=null),r}dispose(){}}At.ConfigurationFeature=qh;function Kt(e){if(e){if(Array.isArray(e))return e.map(Kt);if(typeof e=="object"){const t=Object.create(null);for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Kt(e[n]));return t}}return e}At.toJSONObject=Kt;class Nh{constructor(t){this._client=t,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return jn.DidChangeConfigurationNotification.type}fillClientCapabilities(t){(0,Hc.ensure)((0,Hc.ensure)(t,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){let t=this._client.clientOptions.synchronize?.configurationSection;t!==void 0&&this.register({id:Ih.generateUuid(),registerOptions:{section:t}})}register(t){let n=gn.workspace.onDidChangeConfiguration(r=>{this.onDidChangeConfiguration(t.registerOptions.section,r)});this._listeners.set(t.id,n),t.registerOptions.section!==void 0&&this.onDidChangeConfiguration(t.registerOptions.section,void 0)}unregister(t){let n=this._listeners.get(t);n&&(this._listeners.delete(t),n.dispose())}dispose(){for(const t of this._listeners.values())t.dispose();this._listeners.clear()}onDidChangeConfiguration(t,n){let r;if(Oh.string(t)?r=[t]:r=t,r!==void 0&&n!==void 0&&!r.some(a=>n.affectsConfiguration(a)))return;const i=async s=>s===void 0?this._client.sendNotification(jn.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(jn.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(s)});let o=this._client.middleware.workspace?.didChangeConfiguration;(o?o(r,i):i(r)).catch(s=>{this._client.error(`Sending notification ${jn.DidChangeConfigurationNotification.type.method} failed`,s)})}extractSettingsInformation(t){function n(o,s){let a=o;for(let c=0;c=0?c=gn.workspace.getConfiguration(s.substr(0,a),r).get(s.substr(a+1)):c=gn.workspace.getConfiguration(void 0,r).get(s),c){let l=t[o].split(".");n(i,l)[l[l.length-1]]=Kt(c)}}return i}}At.SyncConfigurationFeature=Nh;var ot={};Object.defineProperty(ot,"__esModule",{value:!0}),ot.DidSaveTextDocumentFeature=ot.WillSaveWaitUntilFeature=ot.WillSaveFeature=ot.DidChangeTextDocumentFeature=ot.DidCloseTextDocumentFeature=ot.DidOpenTextDocumentFeature=void 0;const gt=de.default,Ve=he,je=Te,$h=rt,pn=De;class Lh extends je.TextDocumentEventFeature{constructor(t,n){super(t,gt.workspace.onDidOpenTextDocument,Ve.DidOpenTextDocumentNotification.type,()=>t.middleware.didOpen,r=>t.code2ProtocolConverter.asOpenTextDocumentParams(r),r=>r,je.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=n}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(t){(0,je.ensure)((0,je.ensure)(t,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(t,n){const r=t.resolvedTextDocumentSync;n&&r&&r.openClose&&this.register({id:pn.generateUuid(),registerOptions:{documentSelector:n}})}get registrationType(){return Ve.DidOpenTextDocumentNotification.type}register(t){if(super.register(t),!t.registerOptions.documentSelector)return;const n=this._client.protocol2CodeConverter.asDocumentSelector(t.registerOptions.documentSelector);gt.workspace.textDocuments.forEach(r=>{const i=r.uri.toString();if(!this._syncedDocuments.has(i)&>.languages.match(n,r)>0&&!this._client.hasDedicatedTextSynchronizationFeature(r)){const o=this._client.middleware,s=a=>this._client.sendNotification(this._type,this._createParams(a));(o.didOpen?o.didOpen(r,s):s(r)).catch(a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)}),this._syncedDocuments.set(i,r)}})}notificationSent(t,n,r){super.notificationSent(t,n,r),this._syncedDocuments.set(t.uri.toString(),t)}}ot.DidOpenTextDocumentFeature=Lh;class Mh extends je.TextDocumentEventFeature{constructor(t,n){super(t,gt.workspace.onDidCloseTextDocument,Ve.DidCloseTextDocumentNotification.type,()=>t.middleware.didClose,r=>t.code2ProtocolConverter.asCloseTextDocumentParams(r),r=>r,je.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=n}get registrationType(){return Ve.DidCloseTextDocumentNotification.type}fillClientCapabilities(t){(0,je.ensure)((0,je.ensure)(t,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(t,n){let r=t.resolvedTextDocumentSync;n&&r&&r.openClose&&this.register({id:pn.generateUuid(),registerOptions:{documentSelector:n}})}notificationSent(t,n,r){super.notificationSent(t,n,r),this._syncedDocuments.delete(t.uri.toString())}unregister(t){const n=this._selectors.get(t);super.unregister(t);const r=this._selectors.values();this._syncedDocuments.forEach(i=>{if(gt.languages.match(n,i)>0&&!this._selectorFilter(r,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let o=this._client.middleware,s=a=>this._client.sendNotification(this._type,this._createParams(a));this._syncedDocuments.delete(i.uri.toString()),(o.didClose?o.didClose(i,s):s(i)).catch(a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})}})}}ot.DidCloseTextDocumentFeature=Mh;class Ah extends je.DynamicDocumentFeature{constructor(t){super(t),this._forcingDelivery=!1,this._changeData=new Map,this._onNotificationSent=new gt.EventEmitter}get registrationType(){return Ve.DidChangeTextDocumentNotification.type}fillClientCapabilities(t){(0,je.ensure)((0,je.ensure)(t,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(t,n){let r=t.resolvedTextDocumentSync;n&&r&&r.change!==void 0&&r.change!==Ve.TextDocumentSyncKind.None&&this.register({id:pn.generateUuid(),registerOptions:Object.assign({},{documentSelector:n},{syncKind:r.change})})}register(t){!t.registerOptions.documentSelector||(this._listener||(this._listener=gt.workspace.onDidChangeTextDocument(this.callback,this)),this._changeData.set(t.id,{syncKind:t.registerOptions.syncKind,documentSelector:this._client.protocol2CodeConverter.asDocumentSelector(t.registerOptions.documentSelector)}))}*getDocumentSelectors(){for(const t of this._changeData.values())yield t.documentSelector}async callback(t){if(t.contentChanges.length===0)return;const n=[];for(const r of this._changeData.values())if(gt.languages.match(r.documentSelector,t.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(t.document)){const i=this._client.middleware;if(r.syncKind===Ve.TextDocumentSyncKind.Incremental){const o=async s=>{const a=this._client.code2ProtocolConverter.asChangeTextDocumentParams(s);await this._client.sendNotification(Ve.DidChangeTextDocumentNotification.type,a),this.notificationSent(s,Ve.DidChangeTextDocumentNotification.type,a)};n.push(i.didChange?i.didChange(t,s=>o(s)):o(t))}else if(r.syncKind===Ve.TextDocumentSyncKind.Full){const o=async s=>{const a=async c=>{const l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(c.document);await this._client.sendNotification(Ve.DidChangeTextDocumentNotification.type,l),this.notificationSent(c,Ve.DidChangeTextDocumentNotification.type,l)};return this._changeDelayer?(this._changeDelayer.uri!==s.document.uri.toString()&&(await this.forceDelivery(),this._changeDelayer.uri=s.document.uri.toString()),this._changeDelayer.delayer.trigger(()=>a(s))):(this._changeDelayer={uri:s.document.uri.toString(),delayer:new $h.Delayer(200)},this._changeDelayer.delayer.trigger(()=>a(s),-1))};n.push(i.didChange?i.didChange(t,s=>o(s)):o(t))}}return Promise.all(n).then(void 0,r=>{throw this._client.error(`Sending document notification ${Ve.DidChangeTextDocumentNotification.type.method} failed`,r),r})}get onNotificationSent(){return this._onNotificationSent.event}notificationSent(t,n,r){this._onNotificationSent.fire({original:t,type:n,params:r})}unregister(t){this._changeData.delete(t),this._changeData.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}dispose(){this._changeDelayer!==void 0&&this._changeDelayer.delayer.cancel(),this._changeDelayer=void 0,this._forcingDelivery=!1,this._changeData.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}async forceDelivery(){if(!(this._forcingDelivery||!this._changeDelayer))try{return this._forcingDelivery=!0,this._changeDelayer.delayer.forceDelivery()}finally{this._forcingDelivery=!1}}getProvider(t){for(const n of this._changeData.values())if(gt.languages.match(n.documentSelector,t)>0)return{send:r=>this.callback(r)}}}ot.DidChangeTextDocumentFeature=Ah;class jh extends je.TextDocumentEventFeature{constructor(t){super(t,gt.workspace.onWillSaveTextDocument,Ve.WillSaveTextDocumentNotification.type,()=>t.middleware.willSave,n=>t.code2ProtocolConverter.asWillSaveTextDocumentParams(n),n=>n.document,(n,r)=>je.TextDocumentEventFeature.textDocumentFilter(n,r.document))}get registrationType(){return Ve.WillSaveTextDocumentNotification.type}fillClientCapabilities(t){let n=(0,je.ensure)((0,je.ensure)(t,"textDocument"),"synchronization");n.willSave=!0}initialize(t,n){let r=t.resolvedTextDocumentSync;n&&r&&r.willSave&&this.register({id:pn.generateUuid(),registerOptions:{documentSelector:n}})}}ot.WillSaveFeature=jh;class Hh extends je.DynamicDocumentFeature{constructor(t){super(t),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return Ve.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(t){let n=(0,je.ensure)((0,je.ensure)(t,"textDocument"),"synchronization");n.willSaveWaitUntil=!0}initialize(t,n){let r=t.resolvedTextDocumentSync;n&&r&&r.willSaveWaitUntil&&this.register({id:pn.generateUuid(),registerOptions:{documentSelector:n}})}register(t){!t.registerOptions.documentSelector||(this._listener||(this._listener=gt.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(t.id,this._client.protocol2CodeConverter.asDocumentSelector(t.registerOptions.documentSelector)))}callback(t){if(je.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),t.document)&&!this._client.hasDedicatedTextSynchronizationFeature(t.document)){let n=this._client.middleware,r=i=>this._client.sendRequest(Ve.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async o=>{let s=await this._client.protocol2CodeConverter.asTextEdits(o);return s===void 0?[]:s});t.waitUntil(n.willSaveWaitUntil?n.willSaveWaitUntil(t,r):r(t))}}unregister(t){this._selectors.delete(t),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}dispose(){this._selectors.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}}ot.WillSaveWaitUntilFeature=Hh;class Wh extends je.TextDocumentEventFeature{constructor(t){super(t,gt.workspace.onDidSaveTextDocument,Ve.DidSaveTextDocumentNotification.type,()=>t.middleware.didSave,n=>t.code2ProtocolConverter.asSaveTextDocumentParams(n,this._includeText),n=>n,je.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return Ve.DidSaveTextDocumentNotification.type}fillClientCapabilities(t){(0,je.ensure)((0,je.ensure)(t,"textDocument"),"synchronization").didSave=!0}initialize(t,n){const r=t.resolvedTextDocumentSync;if(n&&r&&r.save){const i=typeof r.save=="boolean"?{includeText:!1}:{includeText:!!r.save.includeText};this.register({id:pn.generateUuid(),registerOptions:Object.assign({},{documentSelector:n},i)})}}register(t){this._includeText=!!t.registerOptions.includeText,super.register(t)}}ot.DidSaveTextDocumentFeature=Wh;var Hr={};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.CompletionItemFeature=void 0;const Uh=de.default,we=he,us=Te,xh=De,zh=[we.CompletionItemKind.Text,we.CompletionItemKind.Method,we.CompletionItemKind.Function,we.CompletionItemKind.Constructor,we.CompletionItemKind.Field,we.CompletionItemKind.Variable,we.CompletionItemKind.Class,we.CompletionItemKind.Interface,we.CompletionItemKind.Module,we.CompletionItemKind.Property,we.CompletionItemKind.Unit,we.CompletionItemKind.Value,we.CompletionItemKind.Enum,we.CompletionItemKind.Keyword,we.CompletionItemKind.Snippet,we.CompletionItemKind.Color,we.CompletionItemKind.File,we.CompletionItemKind.Reference,we.CompletionItemKind.Folder,we.CompletionItemKind.EnumMember,we.CompletionItemKind.Constant,we.CompletionItemKind.Struct,we.CompletionItemKind.Event,we.CompletionItemKind.Operator,we.CompletionItemKind.TypeParameter];class Kh extends us.TextDocumentLanguageFeature{constructor(t){super(t,we.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(t){let n=(0,us.ensure)((0,us.ensure)(t,"textDocument"),"completion");n.dynamicRegistration=!0,n.contextSupport=!0,n.completionItem={snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[we.MarkupKind.Markdown,we.MarkupKind.PlainText],deprecatedSupport:!0,preselectSupport:!0,tagSupport:{valueSet:[we.CompletionItemTag.Deprecated]},insertReplaceSupport:!0,resolveSupport:{properties:["documentation","detail","additionalTextEdits"]},insertTextModeSupport:{valueSet:[we.InsertTextMode.asIs,we.InsertTextMode.adjustIndentation]},labelDetailsSupport:!0},n.insertTextMode=we.InsertTextMode.adjustIndentation,n.completionItemKind={valueSet:zh},n.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode"]}}initialize(t,n){const r=this.getRegistrationOptions(n,t.completionProvider);!r||this.register({id:xh.generateUuid(),registerOptions:r})}registerLanguageProvider(t,n){this.labelDetailsSupport.set(n,!!t.completionItem?.labelDetailsSupport);const r=t.triggerCharacters??[],i=t.allCommitCharacters,o=t.documentSelector,s={provideCompletionItems:(a,c,l,m)=>{const g=this._client,d=this._client.middleware,f=(y,L,M,x)=>g.sendRequest(we.CompletionRequest.type,g.code2ProtocolConverter.asCompletionParams(y,L,M),x).then(b=>x.isCancellationRequested?null:g.protocol2CodeConverter.asCompletionResult(b,i,x),b=>g.handleFailedRequest(we.CompletionRequest.type,x,b,null));return d.provideCompletionItem?d.provideCompletionItem(a,c,m,l,f):f(a,c,m,l)},resolveCompletionItem:t.resolveProvider?(a,c)=>{const l=this._client,m=this._client.middleware,g=(d,f)=>l.sendRequest(we.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(d,!!this.labelDetailsSupport.get(n)),f).then(y=>f.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(y),y=>l.handleFailedRequest(we.CompletionResolveRequest.type,f,y,d));return m.resolveCompletionItem?m.resolveCompletionItem(a,c,g):g(a,c)}:void 0};return[Uh.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(o),s,...r),s]}}Hr.CompletionItemFeature=Kh;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.HoverFeature=void 0;const Gh=de.default,Hn=he,ls=Te,Vh=De;class Bh extends ls.TextDocumentLanguageFeature{constructor(t){super(t,Hn.HoverRequest.type)}fillClientCapabilities(t){const n=(0,ls.ensure)((0,ls.ensure)(t,"textDocument"),"hover");n.dynamicRegistration=!0,n.contentFormat=[Hn.MarkupKind.Markdown,Hn.MarkupKind.PlainText]}initialize(t,n){const r=this.getRegistrationOptions(n,t.hoverProvider);!r||this.register({id:Vh.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,r={provideHover:(i,o,s)=>{const a=this._client,c=(m,g,d)=>a.sendRequest(Hn.HoverRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),d).then(f=>d.isCancellationRequested?null:a.protocol2CodeConverter.asHover(f),f=>a.handleFailedRequest(Hn.HoverRequest.type,d,f,null)),l=a.middleware;return l.provideHover?l.provideHover(i,o,s,c):c(i,o,s)}};return[this.registerProvider(n,r),r]}registerProvider(t,n){return Gh.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Wr.HoverFeature=Bh;var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.DefinitionFeature=void 0;const Xh=de.default,ds=he,fs=Te,Jh=De;class Qh extends fs.TextDocumentLanguageFeature{constructor(t){super(t,ds.DefinitionRequest.type)}fillClientCapabilities(t){let n=(0,fs.ensure)((0,fs.ensure)(t,"textDocument"),"definition");n.dynamicRegistration=!0,n.linkSupport=!0}initialize(t,n){const r=this.getRegistrationOptions(n,t.definitionProvider);!r||this.register({id:Jh.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,r={provideDefinition:(i,o,s)=>{const a=this._client,c=(m,g,d)=>a.sendRequest(ds.DefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),d).then(f=>d.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(f,d),f=>a.handleFailedRequest(ds.DefinitionRequest.type,d,f,null)),l=a.middleware;return l.provideDefinition?l.provideDefinition(i,o,s,c):c(i,o,s)}};return[this.registerProvider(n,r),r]}registerProvider(t,n){return Xh.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Ur.DefinitionFeature=Qh;var xr={};Object.defineProperty(xr,"__esModule",{value:!0}),xr.SignatureHelpFeature=void 0;const Wc=de.default,Wn=he,hs=Te,Yh=De;class Zh extends hs.TextDocumentLanguageFeature{constructor(t){super(t,Wn.SignatureHelpRequest.type)}fillClientCapabilities(t){let n=(0,hs.ensure)((0,hs.ensure)(t,"textDocument"),"signatureHelp");n.dynamicRegistration=!0,n.signatureInformation={documentationFormat:[Wn.MarkupKind.Markdown,Wn.MarkupKind.PlainText]},n.signatureInformation.parameterInformation={labelOffsetSupport:!0},n.signatureInformation.activeParameterSupport=!0,n.contextSupport=!0}initialize(t,n){const r=this.getRegistrationOptions(n,t.signatureHelpProvider);!r||this.register({id:Yh.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n={provideSignatureHelp:(r,i,o,s)=>{const a=this._client,c=(m,g,d,f)=>a.sendRequest(Wn.SignatureHelpRequest.type,a.code2ProtocolConverter.asSignatureHelpParams(m,g,d),f).then(y=>f.isCancellationRequested?null:a.protocol2CodeConverter.asSignatureHelp(y,f),y=>a.handleFailedRequest(Wn.SignatureHelpRequest.type,f,y,null)),l=a.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(r,i,s,o,c):c(r,i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(t,n){const r=this._client.protocol2CodeConverter.asDocumentSelector(t.documentSelector);if(t.retriggerCharacters===void 0){const i=t.triggerCharacters||[];return Wc.languages.registerSignatureHelpProvider(r,n,...i)}else{const i={triggerCharacters:t.triggerCharacters||[],retriggerCharacters:t.retriggerCharacters||[]};return Wc.languages.registerSignatureHelpProvider(r,n,i)}}}xr.SignatureHelpFeature=Zh;var zr={};Object.defineProperty(zr,"__esModule",{value:!0}),zr.DocumentHighlightFeature=void 0;const eg=de.default,gs=he,ps=Te,tg=De;class ng extends ps.TextDocumentLanguageFeature{constructor(t){super(t,gs.DocumentHighlightRequest.type)}fillClientCapabilities(t){(0,ps.ensure)((0,ps.ensure)(t,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(t,n){const r=this.getRegistrationOptions(n,t.documentHighlightProvider);!r||this.register({id:tg.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,r={provideDocumentHighlights:(i,o,s)=>{const a=this._client,c=(m,g,d)=>a.sendRequest(gs.DocumentHighlightRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),d).then(f=>d.isCancellationRequested?null:a.protocol2CodeConverter.asDocumentHighlights(f,d),f=>a.handleFailedRequest(gs.DocumentHighlightRequest.type,d,f,null)),l=a.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,o,s,c):c(i,o,s)}};return[eg.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),r),r]}}zr.DocumentHighlightFeature=ng;var ms={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DocumentSymbolFeature=e.SupportedSymbolTags=e.SupportedSymbolKinds=void 0;const t=de.default,n=he,r=Te,i=De;e.SupportedSymbolKinds=[n.SymbolKind.File,n.SymbolKind.Module,n.SymbolKind.Namespace,n.SymbolKind.Package,n.SymbolKind.Class,n.SymbolKind.Method,n.SymbolKind.Property,n.SymbolKind.Field,n.SymbolKind.Constructor,n.SymbolKind.Enum,n.SymbolKind.Interface,n.SymbolKind.Function,n.SymbolKind.Variable,n.SymbolKind.Constant,n.SymbolKind.String,n.SymbolKind.Number,n.SymbolKind.Boolean,n.SymbolKind.Array,n.SymbolKind.Object,n.SymbolKind.Key,n.SymbolKind.Null,n.SymbolKind.EnumMember,n.SymbolKind.Struct,n.SymbolKind.Event,n.SymbolKind.Operator,n.SymbolKind.TypeParameter],e.SupportedSymbolTags=[n.SymbolTag.Deprecated];class o extends r.TextDocumentLanguageFeature{constructor(a){super(a,n.DocumentSymbolRequest.type)}fillClientCapabilities(a){let c=(0,r.ensure)((0,r.ensure)(a,"textDocument"),"documentSymbol");c.dynamicRegistration=!0,c.symbolKind={valueSet:e.SupportedSymbolKinds},c.hierarchicalDocumentSymbolSupport=!0,c.tagSupport={valueSet:e.SupportedSymbolTags},c.labelSupport=!0}initialize(a,c){const l=this.getRegistrationOptions(c,a.documentSymbolProvider);!l||this.register({id:i.generateUuid(),registerOptions:l})}registerLanguageProvider(a){const c=a.documentSelector,l={provideDocumentSymbols:(g,d)=>{const f=this._client,y=(M,x)=>f.sendRequest(n.DocumentSymbolRequest.type,f.code2ProtocolConverter.asDocumentSymbolParams(M),x).then(async b=>{if(x.isCancellationRequested||b===void 0||b===null)return null;if(b.length===0)return[];{const E=b[0];return n.DocumentSymbol.is(E)?await f.protocol2CodeConverter.asDocumentSymbols(b,x):await f.protocol2CodeConverter.asSymbolInformations(b,x)}},b=>f.handleFailedRequest(n.DocumentSymbolRequest.type,x,b,null)),L=f.middleware;return L.provideDocumentSymbols?L.provideDocumentSymbols(g,d,y):y(g,d)}},m=a.label!==void 0?{label:a.label}:void 0;return[t.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(c),l,m),l]}}e.DocumentSymbolFeature=o})(ms);var Kr={};Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.WorkspaceSymbolFeature=void 0;const rg=de.default,Un=he,ys=Te,Uc=ms,ig=De;class og extends ys.WorkspaceFeature{constructor(t){super(t,Un.WorkspaceSymbolRequest.type)}fillClientCapabilities(t){let n=(0,ys.ensure)((0,ys.ensure)(t,"workspace"),"symbol");n.dynamicRegistration=!0,n.symbolKind={valueSet:Uc.SupportedSymbolKinds},n.tagSupport={valueSet:Uc.SupportedSymbolTags},n.resolveSupport={properties:["location.range"]}}initialize(t){!t.workspaceSymbolProvider||this.register({id:ig.generateUuid(),registerOptions:t.workspaceSymbolProvider===!0?{workDoneProgress:!1}:t.workspaceSymbolProvider})}registerLanguageProvider(t){const n={provideWorkspaceSymbols:(r,i)=>{const o=this._client,s=(c,l)=>o.sendRequest(Un.WorkspaceSymbolRequest.type,{query:c},l).then(m=>l.isCancellationRequested?null:o.protocol2CodeConverter.asSymbolInformations(m,l),m=>o.handleFailedRequest(Un.WorkspaceSymbolRequest.type,l,m,null)),a=o.middleware;return a.provideWorkspaceSymbols?a.provideWorkspaceSymbols(r,i,s):s(r,i)},resolveWorkspaceSymbol:t.resolveProvider===!0?(r,i)=>{const o=this._client,s=(c,l)=>o.sendRequest(Un.WorkspaceSymbolResolveRequest.type,o.code2ProtocolConverter.asWorkspaceSymbol(c),l).then(m=>l.isCancellationRequested?null:o.protocol2CodeConverter.asSymbolInformation(m),m=>o.handleFailedRequest(Un.WorkspaceSymbolResolveRequest.type,l,m,null)),a=o.middleware;return a.resolveWorkspaceSymbol?a.resolveWorkspaceSymbol(r,i,s):s(r,i)}:void 0};return[rg.languages.registerWorkspaceSymbolProvider(n),n]}}Kr.WorkspaceSymbolFeature=og;var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.ReferencesFeature=void 0;const sg=de.default,vs=he,Cs=Te,ag=De;class cg extends Cs.TextDocumentLanguageFeature{constructor(t){super(t,vs.ReferencesRequest.type)}fillClientCapabilities(t){(0,Cs.ensure)((0,Cs.ensure)(t,"textDocument"),"references").dynamicRegistration=!0}initialize(t,n){const r=this.getRegistrationOptions(n,t.referencesProvider);!r||this.register({id:ag.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,r={provideReferences:(i,o,s,a)=>{const c=this._client,l=(g,d,f,y)=>c.sendRequest(vs.ReferencesRequest.type,c.code2ProtocolConverter.asReferenceParams(g,d,f),y).then(L=>y.isCancellationRequested?null:c.protocol2CodeConverter.asReferences(L,y),L=>c.handleFailedRequest(vs.ReferencesRequest.type,y,L,null)),m=c.middleware;return m.provideReferences?m.provideReferences(i,o,s,a,l):l(i,o,s,a)}};return[this.registerProvider(n,r),r]}registerProvider(t,n){return sg.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Gr.ReferencesFeature=cg;var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.CodeActionFeature=void 0;const ug=de.default,lt=he,lg=De,_s=Te;class dg extends _s.TextDocumentLanguageFeature{constructor(t){super(t,lt.CodeActionRequest.type)}fillClientCapabilities(t){const n=(0,_s.ensure)((0,_s.ensure)(t,"textDocument"),"codeAction");n.dynamicRegistration=!0,n.isPreferredSupport=!0,n.disabledSupport=!0,n.dataSupport=!0,n.resolveSupport={properties:["edit"]},n.codeActionLiteralSupport={codeActionKind:{valueSet:[lt.CodeActionKind.Empty,lt.CodeActionKind.QuickFix,lt.CodeActionKind.Refactor,lt.CodeActionKind.RefactorExtract,lt.CodeActionKind.RefactorInline,lt.CodeActionKind.RefactorRewrite,lt.CodeActionKind.Source,lt.CodeActionKind.SourceOrganizeImports]}},n.honorsChangeAnnotations=!1}initialize(t,n){const r=this.getRegistrationOptions(n,t.codeActionProvider);!r||this.register({id:lg.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,r={provideCodeActions:(i,o,s,a)=>{const c=this._client,l=async(g,d,f,y)=>{const L={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),range:c.code2ProtocolConverter.asRange(d),context:await c.code2ProtocolConverter.asCodeActionContext(f,y)};return c.sendRequest(lt.CodeActionRequest.type,L,y).then(M=>y.isCancellationRequested||M===null||M===void 0?null:c.protocol2CodeConverter.asCodeActionResult(M,y),M=>c.handleFailedRequest(lt.CodeActionRequest.type,y,M,null))},m=c.middleware;return m.provideCodeActions?m.provideCodeActions(i,o,s,a,l):l(i,o,s,a)},resolveCodeAction:t.resolveProvider?(i,o)=>{const s=this._client,a=this._client.middleware,c=async(l,m)=>s.sendRequest(lt.CodeActionResolveRequest.type,await s.code2ProtocolConverter.asCodeAction(l,m),m).then(g=>m.isCancellationRequested?l:s.protocol2CodeConverter.asCodeAction(g,m),g=>s.handleFailedRequest(lt.CodeActionResolveRequest.type,m,g,l));return a.resolveCodeAction?a.resolveCodeAction(i,o,c):c(i,o)}:void 0};return[ug.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),r,t.codeActionKinds?{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(t.codeActionKinds)}:void 0),r]}}Vr.CodeActionFeature=dg;var Br={};Object.defineProperty(Br,"__esModule",{value:!0}),Br.CodeLensFeature=void 0;const xc=de.default,mn=he,fg=De,xn=Te;class hg extends xn.TextDocumentLanguageFeature{constructor(t){super(t,mn.CodeLensRequest.type)}fillClientCapabilities(t){(0,xn.ensure)((0,xn.ensure)(t,"textDocument"),"codeLens").dynamicRegistration=!0,(0,xn.ensure)((0,xn.ensure)(t,"workspace"),"codeLens").refreshSupport=!0}initialize(t,n){this._client.onRequest(mn.CodeLensRefreshRequest.type,async()=>{for(const o of this.getAllProviders())o.onDidChangeCodeLensEmitter.fire()});const i=this.getRegistrationOptions(n,t.codeLensProvider);!i||this.register({id:fg.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r=new xc.EventEmitter,i={onDidChangeCodeLenses:r.event,provideCodeLenses:(o,s)=>{const a=this._client,c=(m,g)=>a.sendRequest(mn.CodeLensRequest.type,a.code2ProtocolConverter.asCodeLensParams(m),g).then(d=>g.isCancellationRequested?null:a.protocol2CodeConverter.asCodeLenses(d,g),d=>a.handleFailedRequest(mn.CodeLensRequest.type,g,d,null)),l=a.middleware;return l.provideCodeLenses?l.provideCodeLenses(o,s,c):c(o,s)},resolveCodeLens:t.resolveProvider?(o,s)=>{const a=this._client,c=(m,g)=>a.sendRequest(mn.CodeLensResolveRequest.type,a.code2ProtocolConverter.asCodeLens(m),g).then(d=>g.isCancellationRequested?m:a.protocol2CodeConverter.asCodeLens(d),d=>a.handleFailedRequest(mn.CodeLensResolveRequest.type,g,d,m)),l=a.middleware;return l.resolveCodeLens?l.resolveCodeLens(o,s,c):c(o,s)}:void 0};return[xc.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),i),{provider:i,onDidChangeCodeLensEmitter:r}]}}Br.CodeLensFeature=hg;var jt={};Object.defineProperty(jt,"__esModule",{value:!0}),jt.DocumentOnTypeFormattingFeature=jt.DocumentRangeFormattingFeature=jt.DocumentFormattingFeature=void 0;const Xr=de.default,Ft=he,Rs=De,Ot=Te;var zn;(function(e){function t(n){const r=Xr.workspace.getConfiguration("files",n);return{trimTrailingWhitespace:r.get("trimTrailingWhitespace"),trimFinalNewlines:r.get("trimFinalNewlines"),insertFinalNewline:r.get("insertFinalNewline")}}e.fromConfiguration=t})(zn||(zn={}));class gg extends Ot.TextDocumentLanguageFeature{constructor(t){super(t,Ft.DocumentFormattingRequest.type)}fillClientCapabilities(t){(0,Ot.ensure)((0,Ot.ensure)(t,"textDocument"),"formatting").dynamicRegistration=!0}initialize(t,n){const r=this.getRegistrationOptions(n,t.documentFormattingProvider);!r||this.register({id:Rs.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,r={provideDocumentFormattingEdits:(i,o,s)=>{const a=this._client,c=(m,g,d)=>{const f={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(m),options:a.code2ProtocolConverter.asFormattingOptions(g,zn.fromConfiguration(m))};return a.sendRequest(Ft.DocumentFormattingRequest.type,f,d).then(y=>d.isCancellationRequested?null:a.protocol2CodeConverter.asTextEdits(y,d),y=>a.handleFailedRequest(Ft.DocumentFormattingRequest.type,d,y,null))},l=a.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,o,s,c):c(i,o,s)}};return[Xr.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),r),r]}}jt.DocumentFormattingFeature=gg;class pg extends Ot.TextDocumentLanguageFeature{constructor(t){super(t,Ft.DocumentRangeFormattingRequest.type)}fillClientCapabilities(t){(0,Ot.ensure)((0,Ot.ensure)(t,"textDocument"),"rangeFormatting").dynamicRegistration=!0}initialize(t,n){const r=this.getRegistrationOptions(n,t.documentRangeFormattingProvider);!r||this.register({id:Rs.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,r={provideDocumentRangeFormattingEdits:(i,o,s,a)=>{const c=this._client,l=(g,d,f,y)=>{const L={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),range:c.code2ProtocolConverter.asRange(d),options:c.code2ProtocolConverter.asFormattingOptions(f,zn.fromConfiguration(g))};return c.sendRequest(Ft.DocumentRangeFormattingRequest.type,L,y).then(M=>y.isCancellationRequested?null:c.protocol2CodeConverter.asTextEdits(M,y),M=>c.handleFailedRequest(Ft.DocumentRangeFormattingRequest.type,y,M,null))},m=c.middleware;return m.provideDocumentRangeFormattingEdits?m.provideDocumentRangeFormattingEdits(i,o,s,a,l):l(i,o,s,a)}};return[Xr.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),r),r]}}jt.DocumentRangeFormattingFeature=pg;class mg extends Ot.TextDocumentLanguageFeature{constructor(t){super(t,Ft.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(t){(0,Ot.ensure)((0,Ot.ensure)(t,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(t,n){const r=this.getRegistrationOptions(n,t.documentOnTypeFormattingProvider);!r||this.register({id:Rs.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,r={provideOnTypeFormattingEdits:(o,s,a,c,l)=>{const m=this._client,g=(f,y,L,M,x)=>{let b={textDocument:m.code2ProtocolConverter.asTextDocumentIdentifier(f),position:m.code2ProtocolConverter.asPosition(y),ch:L,options:m.code2ProtocolConverter.asFormattingOptions(M,zn.fromConfiguration(f))};return m.sendRequest(Ft.DocumentOnTypeFormattingRequest.type,b,x).then(E=>x.isCancellationRequested?null:m.protocol2CodeConverter.asTextEdits(E,x),E=>m.handleFailedRequest(Ft.DocumentOnTypeFormattingRequest.type,x,E,null))},d=m.middleware;return d.provideOnTypeFormattingEdits?d.provideOnTypeFormattingEdits(o,s,a,c,l,g):g(o,s,a,c,l)}},i=t.moreTriggerCharacter||[];return[Xr.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),r,t.firstTriggerCharacter,...i),r]}}jt.DocumentOnTypeFormattingFeature=mg;var Jr={};Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.RenameFeature=void 0;const yg=de.default,Gt=he,vg=De,zc=Ee,ws=Te;class Cg extends ws.TextDocumentLanguageFeature{constructor(t){super(t,Gt.RenameRequest.type)}fillClientCapabilities(t){let n=(0,ws.ensure)((0,ws.ensure)(t,"textDocument"),"rename");n.dynamicRegistration=!0,n.prepareSupport=!0,n.prepareSupportDefaultBehavior=Gt.PrepareSupportDefaultBehavior.Identifier,n.honorsChangeAnnotations=!0}initialize(t,n){const r=this.getRegistrationOptions(n,t.renameProvider);!r||(zc.boolean(t.renameProvider)&&(r.prepareProvider=!1),this.register({id:vg.generateUuid(),registerOptions:r}))}registerLanguageProvider(t){const n=t.documentSelector,r={provideRenameEdits:(i,o,s,a)=>{const c=this._client,l=(g,d,f,y)=>{let L={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),position:c.code2ProtocolConverter.asPosition(d),newName:f};return c.sendRequest(Gt.RenameRequest.type,L,y).then(M=>y.isCancellationRequested?null:c.protocol2CodeConverter.asWorkspaceEdit(M,y),M=>c.handleFailedRequest(Gt.RenameRequest.type,y,M,null,!1))},m=c.middleware;return m.provideRenameEdits?m.provideRenameEdits(i,o,s,a,l):l(i,o,s,a)},prepareRename:t.prepareProvider?(i,o,s)=>{const a=this._client,c=(m,g,d)=>{let f={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(m),position:a.code2ProtocolConverter.asPosition(g)};return a.sendRequest(Gt.PrepareRenameRequest.type,f,d).then(y=>d.isCancellationRequested?null:Gt.Range.is(y)?a.protocol2CodeConverter.asRange(y):this.isDefaultBehavior(y)?y.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):y&&Gt.Range.is(y.range)?{range:a.protocol2CodeConverter.asRange(y.range),placeholder:y.placeholder}:Promise.reject(new Error("The element can't be renamed.")),y=>{throw typeof y.message=="string"?new Error(y.message):new Error("The element can't be renamed.")})},l=a.middleware;return l.prepareRename?l.prepareRename(i,o,s,c):c(i,o,s)}:void 0};return[this.registerProvider(n,r),r]}registerProvider(t,n){return yg.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}isDefaultBehavior(t){const n=t;return n&&zc.boolean(n.defaultBehavior)}}Jr.RenameFeature=Cg;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.DocumentLinkFeature=void 0;const _g=de.default,Kn=he,bs=Te,Rg=De;class wg extends bs.TextDocumentLanguageFeature{constructor(t){super(t,Kn.DocumentLinkRequest.type)}fillClientCapabilities(t){const n=(0,bs.ensure)((0,bs.ensure)(t,"textDocument"),"documentLink");n.dynamicRegistration=!0,n.tooltipSupport=!0}initialize(t,n){const r=this.getRegistrationOptions(n,t.documentLinkProvider);!r||this.register({id:Rg.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,r={provideDocumentLinks:(i,o)=>{const s=this._client,a=(l,m)=>s.sendRequest(Kn.DocumentLinkRequest.type,s.code2ProtocolConverter.asDocumentLinkParams(l),m).then(g=>m.isCancellationRequested?null:s.protocol2CodeConverter.asDocumentLinks(g,m),g=>s.handleFailedRequest(Kn.DocumentLinkRequest.type,m,g,null)),c=s.middleware;return c.provideDocumentLinks?c.provideDocumentLinks(i,o,a):a(i,o)},resolveDocumentLink:t.resolveProvider?(i,o)=>{const s=this._client;let a=(l,m)=>s.sendRequest(Kn.DocumentLinkResolveRequest.type,s.code2ProtocolConverter.asDocumentLink(l),m).then(g=>m.isCancellationRequested?l:s.protocol2CodeConverter.asDocumentLink(g),g=>s.handleFailedRequest(Kn.DocumentLinkResolveRequest.type,m,g,l));const c=s.middleware;return c.resolveDocumentLink?c.resolveDocumentLink(i,o,a):a(i,o)}:void 0};return[_g.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),r),r]}}Qr.DocumentLinkFeature=wg;var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.ExecuteCommandFeature=void 0;const bg=de.default,Ss=he,Sg=De,Kc=Te;class Dg{constructor(t){this._client=t,this._commands=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._commands.size>0}}get registrationType(){return Ss.ExecuteCommandRequest.type}fillClientCapabilities(t){(0,Kc.ensure)((0,Kc.ensure)(t,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(t){!t.executeCommandProvider||this.register({id:Sg.generateUuid(),registerOptions:Object.assign({},t.executeCommandProvider)})}register(t){const n=this._client,r=n.middleware,i=(o,s)=>{let a={command:o,arguments:s};return n.sendRequest(Ss.ExecuteCommandRequest.type,a).then(void 0,c=>n.handleFailedRequest(Ss.ExecuteCommandRequest.type,void 0,c,void 0))};if(t.registerOptions.commands){const o=[];for(const s of t.registerOptions.commands)o.push(bg.commands.registerCommand(s,(...a)=>r.executeCommand?r.executeCommand(s,a,i):i(s,a)));this._commands.set(t.id,o)}}unregister(t){let n=this._commands.get(t);n&&n.forEach(r=>r.dispose())}dispose(){this._commands.forEach(t=>{t.forEach(n=>n.dispose())}),this._commands.clear()}}Yr.ExecuteCommandFeature=Dg;var Zr={};Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.FileSystemWatcherFeature=void 0;const Tg=de.default,Vt=he,ei=Te;class Pg{constructor(t,n){this._client=t,this._notifyFileEvent=n,this._watchers=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._watchers.size>0}}get registrationType(){return Vt.DidChangeWatchedFilesNotification.type}fillClientCapabilities(t){(0,ei.ensure)((0,ei.ensure)(t,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,ei.ensure)((0,ei.ensure)(t,"workspace"),"didChangeWatchedFiles").relativePatternSupport=!0}initialize(t,n){}register(t){if(!Array.isArray(t.registerOptions.watchers))return;const n=[];for(const r of t.registerOptions.watchers){const i=this._client.protocol2CodeConverter.asGlobPattern(r.globPattern);if(i===void 0)continue;let o=!0,s=!0,a=!0;r.kind!==void 0&&r.kind!==null&&(o=(r.kind&Vt.WatchKind.Create)!==0,s=(r.kind&Vt.WatchKind.Change)!==0,a=(r.kind&Vt.WatchKind.Delete)!==0);const c=Tg.workspace.createFileSystemWatcher(i,!o,!s,!a);this.hookListeners(c,o,s,a,n),n.push(c)}this._watchers.set(t.id,n)}registerRaw(t,n){let r=[];for(let i of n)this.hookListeners(i,!0,!0,!0,r);this._watchers.set(t,r)}hookListeners(t,n,r,i,o){n&&t.onDidCreate(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:Vt.FileChangeType.Created}),null,o),r&&t.onDidChange(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:Vt.FileChangeType.Changed}),null,o),i&&t.onDidDelete(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:Vt.FileChangeType.Deleted}),null,o)}unregister(t){let n=this._watchers.get(t);if(n)for(let r of n)r.dispose()}dispose(){this._watchers.forEach(t=>{for(let n of t)n.dispose()}),this._watchers.clear()}}Zr.FileSystemWatcherFeature=Pg;var ti={};Object.defineProperty(ti,"__esModule",{value:!0}),ti.ColorProviderFeature=void 0;const Eg=de.default,Gn=he,Ds=Te;class kg extends Ds.TextDocumentLanguageFeature{constructor(t){super(t,Gn.DocumentColorRequest.type)}fillClientCapabilities(t){(0,Ds.ensure)((0,Ds.ensure)(t,"textDocument"),"colorProvider").dynamicRegistration=!0}initialize(t,n){let[r,i]=this.getRegistration(n,t.colorProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r={provideColorPresentations:(i,o,s)=>{const a=this._client,c=(m,g,d)=>{const f={color:m,textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(g.document),range:a.code2ProtocolConverter.asRange(g.range)};return a.sendRequest(Gn.ColorPresentationRequest.type,f,d).then(y=>d.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(y,d),y=>a.handleFailedRequest(Gn.ColorPresentationRequest.type,d,y,null))},l=a.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,o,s,c):c(i,o,s)},provideDocumentColors:(i,o)=>{const s=this._client,a=(l,m)=>{const g={textDocument:s.code2ProtocolConverter.asTextDocumentIdentifier(l)};return s.sendRequest(Gn.DocumentColorRequest.type,g,m).then(d=>m.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(d,m),d=>s.handleFailedRequest(Gn.DocumentColorRequest.type,m,d,null))},c=s.middleware;return c.provideDocumentColors?c.provideDocumentColors(i,o,a):a(i,o)}};return[Eg.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),r),r]}}ti.ColorProviderFeature=kg;var ni={};Object.defineProperty(ni,"__esModule",{value:!0}),ni.ImplementationFeature=void 0;const Fg=de.default,Ts=he,Ps=Te;class Og extends Ps.TextDocumentLanguageFeature{constructor(t){super(t,Ts.ImplementationRequest.type)}fillClientCapabilities(t){let n=(0,Ps.ensure)((0,Ps.ensure)(t,"textDocument"),"implementation");n.dynamicRegistration=!0,n.linkSupport=!0}initialize(t,n){let[r,i]=this.getRegistration(n,t.implementationProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r={provideImplementation:(i,o,s)=>{const a=this._client,c=(m,g,d)=>a.sendRequest(Ts.ImplementationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),d).then(f=>d.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(f,d),f=>a.handleFailedRequest(Ts.ImplementationRequest.type,d,f,null)),l=a.middleware;return l.provideImplementation?l.provideImplementation(i,o,s,c):c(i,o,s)}};return[this.registerProvider(n,r),r]}registerProvider(t,n){return Fg.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}ni.ImplementationFeature=Og;var ri={};Object.defineProperty(ri,"__esModule",{value:!0}),ri.TypeDefinitionFeature=void 0;const Ig=de.default,Es=he,Vn=Te;class qg extends Vn.TextDocumentLanguageFeature{constructor(t){super(t,Es.TypeDefinitionRequest.type)}fillClientCapabilities(t){(0,Vn.ensure)((0,Vn.ensure)(t,"textDocument"),"typeDefinition").dynamicRegistration=!0;let n=(0,Vn.ensure)((0,Vn.ensure)(t,"textDocument"),"typeDefinition");n.dynamicRegistration=!0,n.linkSupport=!0}initialize(t,n){let[r,i]=this.getRegistration(n,t.typeDefinitionProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r={provideTypeDefinition:(i,o,s)=>{const a=this._client,c=(m,g,d)=>a.sendRequest(Es.TypeDefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),d).then(f=>d.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(f,d),f=>a.handleFailedRequest(Es.TypeDefinitionRequest.type,d,f,null)),l=a.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,o,s,c):c(i,o,s)}};return[this.registerProvider(n,r),r]}registerProvider(t,n){return Ig.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}ri.TypeDefinitionFeature=qg;var yn={};Object.defineProperty(yn,"__esModule",{value:!0}),yn.WorkspaceFoldersFeature=yn.arrayDiff=void 0;const Ng=De,ii=de.default,Bn=he;function ks(e,t){if(e!==void 0)return e[t]}function Fs(e,t){return e.filter(n=>t.indexOf(n)<0)}yn.arrayDiff=Fs;class $g{constructor(t){this._client=t,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return Bn.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(t){const n=ii.workspace.workspaceFolders;this.initializeWithFolders(n),n===void 0?t.workspaceFolders=null:t.workspaceFolders=n.map(r=>this.asProtocol(r))}initializeWithFolders(t){this._initialFolders=t}fillClientCapabilities(t){t.workspace=t.workspace||{},t.workspace.workspaceFolders=!0}initialize(t){const n=this._client;n.onRequest(Bn.WorkspaceFoldersRequest.type,o=>{const s=()=>{const c=ii.workspace.workspaceFolders;return c===void 0?null:c.map(m=>this.asProtocol(m))},a=n.middleware.workspace;return a&&a.workspaceFolders?a.workspaceFolders(o,s):s()});const r=ks(ks(ks(t,"workspace"),"workspaceFolders"),"changeNotifications");let i;typeof r=="string"?i=r:r===!0&&(i=Ng.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(t){let n;if(this._initialFolders&&t){const r=Fs(this._initialFolders,t),i=Fs(t,this._initialFolders);(i.length>0||r.length>0)&&(n=this.doSendEvent(i,r))}else this._initialFolders?n=this.doSendEvent([],this._initialFolders):t&&(n=this.doSendEvent(t,[]));n!==void 0&&n.catch(r=>{this._client.error(`Sending notification ${Bn.DidChangeWorkspaceFoldersNotification.type.method} failed`,r)})}doSendEvent(t,n){let r={event:{added:t.map(i=>this.asProtocol(i)),removed:n.map(i=>this.asProtocol(i))}};return this._client.sendNotification(Bn.DidChangeWorkspaceFoldersNotification.type,r)}register(t){let n=t.id,r=this._client,i=ii.workspace.onDidChangeWorkspaceFolders(o=>{let s=l=>this.doSendEvent(l.added,l.removed),a=r.middleware.workspace;(a&&a.didChangeWorkspaceFolders?a.didChangeWorkspaceFolders(o,s):s(o)).catch(l=>{this._client.error(`Sending notification ${Bn.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(n,i),this.sendInitialEvent(ii.workspace.workspaceFolders)}unregister(t){let n=this._listeners.get(t);n!==void 0&&(this._listeners.delete(t),n.dispose())}dispose(){for(let t of this._listeners.values())t.dispose();this._listeners.clear()}asProtocol(t){return t===void 0?null:{uri:this._client.code2ProtocolConverter.asUri(t.uri),name:t.name}}}yn.WorkspaceFoldersFeature=$g;var oi={};Object.defineProperty(oi,"__esModule",{value:!0}),oi.FoldingRangeFeature=void 0;const Lg=de.default,vn=he,Os=Te;class Mg extends Os.TextDocumentLanguageFeature{constructor(t){super(t,vn.FoldingRangeRequest.type)}fillClientCapabilities(t){let n=(0,Os.ensure)((0,Os.ensure)(t,"textDocument"),"foldingRange");n.dynamicRegistration=!0,n.rangeLimit=5e3,n.lineFoldingOnly=!0,n.foldingRangeKind={valueSet:[vn.FoldingRangeKind.Comment,vn.FoldingRangeKind.Imports,vn.FoldingRangeKind.Region]},n.foldingRange={collapsedText:!1}}initialize(t,n){let[r,i]=this.getRegistration(n,t.foldingRangeProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r={provideFoldingRanges:(i,o,s)=>{const a=this._client,c=(m,g,d)=>{const f={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(m)};return a.sendRequest(vn.FoldingRangeRequest.type,f,d).then(y=>d.isCancellationRequested?null:a.protocol2CodeConverter.asFoldingRanges(y,d),y=>a.handleFailedRequest(vn.FoldingRangeRequest.type,d,y,null))},l=a.middleware;return l.provideFoldingRanges?l.provideFoldingRanges(i,o,s,c):c(i,o,s)}};return[Lg.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),r),r]}}oi.FoldingRangeFeature=Mg;var si={};Object.defineProperty(si,"__esModule",{value:!0}),si.DeclarationFeature=void 0;const Ag=de.default,Is=he,qs=Te;class jg extends qs.TextDocumentLanguageFeature{constructor(t){super(t,Is.DeclarationRequest.type)}fillClientCapabilities(t){const n=(0,qs.ensure)((0,qs.ensure)(t,"textDocument"),"declaration");n.dynamicRegistration=!0,n.linkSupport=!0}initialize(t,n){const[r,i]=this.getRegistration(n,t.declarationProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r={provideDeclaration:(i,o,s)=>{const a=this._client,c=(m,g,d)=>a.sendRequest(Is.DeclarationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),d).then(f=>d.isCancellationRequested?null:a.protocol2CodeConverter.asDeclarationResult(f,d),f=>a.handleFailedRequest(Is.DeclarationRequest.type,d,f,null)),l=a.middleware;return l.provideDeclaration?l.provideDeclaration(i,o,s,c):c(i,o,s)}};return[this.registerProvider(n,r),r]}registerProvider(t,n){return Ag.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}si.DeclarationFeature=jg;var ai={};Object.defineProperty(ai,"__esModule",{value:!0}),ai.SelectionRangeFeature=void 0;const Hg=de.default,Ns=he,$s=Te;class Wg extends $s.TextDocumentLanguageFeature{constructor(t){super(t,Ns.SelectionRangeRequest.type)}fillClientCapabilities(t){const n=(0,$s.ensure)((0,$s.ensure)(t,"textDocument"),"selectionRange");n.dynamicRegistration=!0}initialize(t,n){const[r,i]=this.getRegistration(n,t.selectionRangeProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r={provideSelectionRanges:(i,o,s)=>{const a=this._client,c=async(m,g,d)=>{const f={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(m),positions:await a.code2ProtocolConverter.asPositions(g,d)};return a.sendRequest(Ns.SelectionRangeRequest.type,f,d).then(y=>d.isCancellationRequested?null:a.protocol2CodeConverter.asSelectionRanges(y,d),y=>a.handleFailedRequest(Ns.SelectionRangeRequest.type,d,y,null))},l=a.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,o,s,c):c(i,o,s)}};return[this.registerProvider(n,r),r]}registerProvider(t,n){return Hg.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}ai.SelectionRangeFeature=Wg;var ci={};Object.defineProperty(ci,"__esModule",{value:!0}),ci.ProgressFeature=void 0;const Gc=he,Ug=Mn;function xg(e,t){return e[t]===void 0&&(e[t]=Object.create(null)),e[t]}class zg{constructor(t){this._client=t,this.activeParts=new Set}getState(){return{kind:"window",id:Gc.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(t){xg(t,"window").workDoneProgress=!0}initialize(){const t=this._client,n=i=>{this.activeParts.delete(i)},r=i=>{this.activeParts.add(new Ug.ProgressPart(this._client,i.token,n))};t.onRequest(Gc.WorkDoneProgressCreateRequest.type,r)}dispose(){for(const t of this.activeParts)t.done();this.activeParts.clear()}}ci.ProgressFeature=zg;var ui={};Object.defineProperty(ui,"__esModule",{value:!0}),ui.CallHierarchyFeature=void 0;const Kg=de.default,Bt=he,Ls=Te;class Gg{constructor(t){this.client=t,this.middleware=t.middleware}prepareCallHierarchy(t,n,r){const i=this.client,o=this.middleware,s=(a,c,l)=>{const m=i.code2ProtocolConverter.asTextDocumentPositionParams(a,c);return i.sendRequest(Bt.CallHierarchyPrepareRequest.type,m,l).then(g=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(g,l),g=>i.handleFailedRequest(Bt.CallHierarchyPrepareRequest.type,l,g,null))};return o.prepareCallHierarchy?o.prepareCallHierarchy(t,n,r,s):s(t,n,r)}provideCallHierarchyIncomingCalls(t,n){const r=this.client,i=this.middleware,o=(s,a)=>{const c={item:r.code2ProtocolConverter.asCallHierarchyItem(s)};return r.sendRequest(Bt.CallHierarchyIncomingCallsRequest.type,c,a).then(l=>a.isCancellationRequested?null:r.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,a),l=>r.handleFailedRequest(Bt.CallHierarchyIncomingCallsRequest.type,a,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(t,n,o):o(t,n)}provideCallHierarchyOutgoingCalls(t,n){const r=this.client,i=this.middleware,o=(s,a)=>{const c={item:r.code2ProtocolConverter.asCallHierarchyItem(s)};return r.sendRequest(Bt.CallHierarchyOutgoingCallsRequest.type,c,a).then(l=>a.isCancellationRequested?null:r.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,a),l=>r.handleFailedRequest(Bt.CallHierarchyOutgoingCallsRequest.type,a,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(t,n,o):o(t,n)}}class Vg extends Ls.TextDocumentLanguageFeature{constructor(t){super(t,Bt.CallHierarchyPrepareRequest.type)}fillClientCapabilities(t){const n=t,r=(0,Ls.ensure)((0,Ls.ensure)(n,"textDocument"),"callHierarchy");r.dynamicRegistration=!0}initialize(t,n){const[r,i]=this.getRegistration(n,t.callHierarchyProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=this._client,r=new Gg(n);return[Kg.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(t.documentSelector),r),r]}}ui.CallHierarchyFeature=Vg;var li={};Object.defineProperty(li,"__esModule",{value:!0}),li.SemanticTokensFeature=void 0;const di=de.default,ge=he,Xn=Te,Bg=Ee;class Xg extends Xn.TextDocumentLanguageFeature{constructor(t){super(t,ge.SemanticTokensRegistrationType.type)}fillClientCapabilities(t){const n=(0,Xn.ensure)((0,Xn.ensure)(t,"textDocument"),"semanticTokens");n.dynamicRegistration=!0,n.tokenTypes=[ge.SemanticTokenTypes.namespace,ge.SemanticTokenTypes.type,ge.SemanticTokenTypes.class,ge.SemanticTokenTypes.enum,ge.SemanticTokenTypes.interface,ge.SemanticTokenTypes.struct,ge.SemanticTokenTypes.typeParameter,ge.SemanticTokenTypes.parameter,ge.SemanticTokenTypes.variable,ge.SemanticTokenTypes.property,ge.SemanticTokenTypes.enumMember,ge.SemanticTokenTypes.event,ge.SemanticTokenTypes.function,ge.SemanticTokenTypes.method,ge.SemanticTokenTypes.macro,ge.SemanticTokenTypes.keyword,ge.SemanticTokenTypes.modifier,ge.SemanticTokenTypes.comment,ge.SemanticTokenTypes.string,ge.SemanticTokenTypes.number,ge.SemanticTokenTypes.regexp,ge.SemanticTokenTypes.operator,ge.SemanticTokenTypes.decorator],n.tokenModifiers=[ge.SemanticTokenModifiers.declaration,ge.SemanticTokenModifiers.definition,ge.SemanticTokenModifiers.readonly,ge.SemanticTokenModifiers.static,ge.SemanticTokenModifiers.deprecated,ge.SemanticTokenModifiers.abstract,ge.SemanticTokenModifiers.async,ge.SemanticTokenModifiers.modification,ge.SemanticTokenModifiers.documentation,ge.SemanticTokenModifiers.defaultLibrary],n.formats=[ge.TokenFormat.Relative],n.requests={range:!0,full:{delta:!0}},n.multilineTokenSupport=!1,n.overlappingTokenSupport=!1,n.serverCancelSupport=!0,n.augmentsSyntaxTokens=!0,(0,Xn.ensure)((0,Xn.ensure)(t,"workspace"),"semanticTokens").refreshSupport=!0}initialize(t,n){this._client.onRequest(ge.SemanticTokensRefreshRequest.type,async()=>{for(const s of this.getAllProviders())s.onDidChangeSemanticTokensEmitter.fire()});const[i,o]=this.getRegistration(n,t.semanticTokensProvider);!i||!o||this.register({id:i,registerOptions:o})}registerLanguageProvider(t){const n=t.documentSelector,r=Bg.boolean(t.full)?t.full:t.full!==void 0,i=t.full!==void 0&&typeof t.full!="boolean"&&t.full.delta===!0,o=new di.EventEmitter,s=r?{onDidChangeSemanticTokens:o.event,provideDocumentSemanticTokens:(f,y)=>{const L=this._client,M=L.middleware,x=(b,E)=>{const w={textDocument:L.code2ProtocolConverter.asTextDocumentIdentifier(b)};return L.sendRequest(ge.SemanticTokensRequest.type,w,E).then($=>E.isCancellationRequested?null:L.protocol2CodeConverter.asSemanticTokens($,E),$=>L.handleFailedRequest(ge.SemanticTokensRequest.type,E,$,null))};return M.provideDocumentSemanticTokens?M.provideDocumentSemanticTokens(f,y,x):x(f,y)},provideDocumentSemanticTokensEdits:i?(f,y,L)=>{const M=this._client,x=M.middleware,b=(E,w,$)=>{const H={textDocument:M.code2ProtocolConverter.asTextDocumentIdentifier(E),previousResultId:w};return M.sendRequest(ge.SemanticTokensDeltaRequest.type,H,$).then(async T=>$.isCancellationRequested?null:ge.SemanticTokens.is(T)?await M.protocol2CodeConverter.asSemanticTokens(T,$):await M.protocol2CodeConverter.asSemanticTokensEdits(T,$),T=>M.handleFailedRequest(ge.SemanticTokensDeltaRequest.type,$,T,null))};return x.provideDocumentSemanticTokensEdits?x.provideDocumentSemanticTokensEdits(f,y,L,b):b(f,y,L)}:void 0}:void 0,c=t.range===!0?{provideDocumentRangeSemanticTokens:(f,y,L)=>{const M=this._client,x=M.middleware,b=(E,w,$)=>{const H={textDocument:M.code2ProtocolConverter.asTextDocumentIdentifier(E),range:M.code2ProtocolConverter.asRange(w)};return M.sendRequest(ge.SemanticTokensRangeRequest.type,H,$).then(T=>$.isCancellationRequested?null:M.protocol2CodeConverter.asSemanticTokens(T,$),T=>M.handleFailedRequest(ge.SemanticTokensRangeRequest.type,$,T,null))};return x.provideDocumentRangeSemanticTokens?x.provideDocumentRangeSemanticTokens(f,y,L,b):b(f,y,L)}}:void 0,l=[],m=this._client,g=m.protocol2CodeConverter.asSemanticTokensLegend(t.legend),d=m.protocol2CodeConverter.asDocumentSelector(n);return s!==void 0&&l.push(di.languages.registerDocumentSemanticTokensProvider(d,s,g)),c!==void 0&&l.push(di.languages.registerDocumentRangeSemanticTokensProvider(d,c,g)),[new di.Disposable(()=>l.forEach(f=>f.dispose())),{range:c,full:s,onDidChangeSemanticTokensEmitter:o}]}}li.SemanticTokensFeature=Xg;var st={};Object.defineProperty(st,"__esModule",{value:!0}),st.WillDeleteFilesFeature=st.WillRenameFilesFeature=st.WillCreateFilesFeature=st.DidDeleteFilesFeature=st.DidRenameFilesFeature=st.DidCreateFilesFeature=void 0;const pt=de.default,Jg=rs,It=he,Qg=De;function Vc(e,t){return e[t]===void 0&&(e[t]={}),e[t]}function Yg(e,t){return e[t]}function Bc(e,t,n){e[t]=n}class Qt{constructor(t,n,r,i,o){this._client=t,this._event=n,this._registrationType=r,this._clientCapability=i,this._serverCapability=o,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(t){const n=Vc(Vc(t,"workspace"),"fileOperations");Bc(n,"dynamicRegistration",!0),Bc(n,this._clientCapability,!0)}initialize(t){const n=t.workspace?.fileOperations,r=n!==void 0?Yg(n,this._serverCapability):void 0;if(r?.filters!==void 0)try{this.register({id:Qg.generateUuid(),registerOptions:{filters:r.filters}})}catch(i){this._client.warn(`Ignoring invalid glob pattern for ${this._serverCapability} registration: ${i}`)}}register(t){this._listener||(this._listener=this._event(this.send,this));const n=t.registerOptions.filters.map(r=>{const i=new Jg.Minimatch(r.pattern.glob,Qt.asMinimatchOptions(r.pattern.options));if(!i.makeRe())throw new Error(`Invalid pattern ${r.pattern.glob}!`);return{scheme:r.scheme,matcher:i,kind:r.pattern.matches}});this._filters.set(t.id,n)}unregister(t){this._filters.delete(t),this._filters.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}dispose(){this._filters.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getFileType(t){return Qt.getFileType(t)}async filter(t,n){const r=await Promise.all(t.files.map(async o=>{const s=n(o),a=s.fsPath.replace(/\\/g,"/");for(const c of this._filters.values())for(const l of c)if(!(l.scheme!==void 0&&l.scheme!==s.scheme)){if(l.matcher.match(a)){if(l.kind===void 0)return!0;const m=await this.getFileType(s);if(m===void 0)return this._client.error(`Failed to determine file type for ${s.toString()}.`),!0;if(m===pt.FileType.File&&l.kind===It.FileOperationPatternKind.file||m===pt.FileType.Directory&&l.kind===It.FileOperationPatternKind.folder)return!0}else if(l.kind===It.FileOperationPatternKind.folder&&await Qt.getFileType(s)===pt.FileType.Directory&&l.matcher.match(`${a}/`))return!0}return!1})),i=t.files.filter((o,s)=>r[s]);return{...t,files:i}}static async getFileType(t){try{return(await pt.workspace.fs.stat(t)).type}catch{return}}static asMinimatchOptions(t){if(t!==void 0&&t.ignoreCase===!0)return{nocase:!0}}}class Xc extends Qt{constructor(t,n,r,i,o,s,a){super(t,n,r,i,o),this._notificationType=r,this._accessUri=s,this._createParams=a}async send(t){const n=await this.filter(t,this._accessUri);if(n.files.length){const r=async i=>this._client.sendNotification(this._notificationType,this._createParams(i));return this.doSend(n,r)}}}class Jc extends Xc{constructor(){super(...arguments),this._fsPathFileTypes=new Map}async getFileType(t){const n=t.fsPath;if(this._fsPathFileTypes.has(n))return this._fsPathFileTypes.get(n);const r=await Qt.getFileType(t);return r&&this._fsPathFileTypes.set(n,r),r}async cacheFileTypes(t,n){await this.filter(t,n)}clearFileTypeCache(){this._fsPathFileTypes.clear()}unregister(t){super.unregister(t),this.filterSize()===0&&this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}dispose(){super.dispose(),this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}}class Zg extends Xc{constructor(t){super(t,pt.workspace.onDidCreateFiles,It.DidCreateFilesNotification.type,"didCreate","didCreate",n=>n,t.code2ProtocolConverter.asDidCreateFilesParams)}doSend(t,n){const r=this._client.middleware.workspace;return r?.didCreateFiles?r.didCreateFiles(t,n):n(t)}}st.DidCreateFilesFeature=Zg;class ep extends Jc{constructor(t){super(t,pt.workspace.onDidRenameFiles,It.DidRenameFilesNotification.type,"didRename","didRename",n=>n.oldUri,t.code2ProtocolConverter.asDidRenameFilesParams)}register(t){this._willListener||(this._willListener=pt.workspace.onWillRenameFiles(this.willRename,this)),super.register(t)}willRename(t){t.waitUntil(this.cacheFileTypes(t,n=>n.oldUri))}doSend(t,n){this.clearFileTypeCache();const r=this._client.middleware.workspace;return r?.didRenameFiles?r.didRenameFiles(t,n):n(t)}}st.DidRenameFilesFeature=ep;class tp extends Jc{constructor(t){super(t,pt.workspace.onDidDeleteFiles,It.DidDeleteFilesNotification.type,"didDelete","didDelete",n=>n,t.code2ProtocolConverter.asDidDeleteFilesParams)}register(t){this._willListener||(this._willListener=pt.workspace.onWillDeleteFiles(this.willDelete,this)),super.register(t)}willDelete(t){t.waitUntil(this.cacheFileTypes(t,n=>n))}doSend(t,n){this.clearFileTypeCache();const r=this._client.middleware.workspace;return r?.didDeleteFiles?r.didDeleteFiles(t,n):n(t)}}st.DidDeleteFilesFeature=tp;class Ms extends Qt{constructor(t,n,r,i,o,s,a){super(t,n,r,i,o),this._requestType=r,this._accessUri=s,this._createParams=a}async send(t){const n=this.waitUntil(t);t.waitUntil(n)}async waitUntil(t){const n=await this.filter(t,this._accessUri);if(n.files.length){const r=i=>this._client.sendRequest(this._requestType,this._createParams(i),i.token).then(this._client.protocol2CodeConverter.asWorkspaceEdit);return this.doSend(n,r)}else return}}class np extends Ms{constructor(t){super(t,pt.workspace.onWillCreateFiles,It.WillCreateFilesRequest.type,"willCreate","willCreate",n=>n,t.code2ProtocolConverter.asWillCreateFilesParams)}doSend(t,n){const r=this._client.middleware.workspace;return r?.willCreateFiles?r.willCreateFiles(t,n):n(t)}}st.WillCreateFilesFeature=np;class rp extends Ms{constructor(t){super(t,pt.workspace.onWillRenameFiles,It.WillRenameFilesRequest.type,"willRename","willRename",n=>n.oldUri,t.code2ProtocolConverter.asWillRenameFilesParams)}doSend(t,n){const r=this._client.middleware.workspace;return r?.willRenameFiles?r.willRenameFiles(t,n):n(t)}}st.WillRenameFilesFeature=rp;class ip extends Ms{constructor(t){super(t,pt.workspace.onWillDeleteFiles,It.WillDeleteFilesRequest.type,"willDelete","willDelete",n=>n,t.code2ProtocolConverter.asWillDeleteFilesParams)}doSend(t,n){const r=this._client.middleware.workspace;return r?.willDeleteFiles?r.willDeleteFiles(t,n):n(t)}}st.WillDeleteFilesFeature=ip;var fi={};Object.defineProperty(fi,"__esModule",{value:!0}),fi.LinkedEditingFeature=void 0;const op=de.default,As=he,js=Te;class sp extends js.TextDocumentLanguageFeature{constructor(t){super(t,As.LinkedEditingRangeRequest.type)}fillClientCapabilities(t){const n=(0,js.ensure)((0,js.ensure)(t,"textDocument"),"linkedEditingRange");n.dynamicRegistration=!0}initialize(t,n){let[r,i]=this.getRegistration(n,t.linkedEditingRangeProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r={provideLinkedEditingRanges:(i,o,s)=>{const a=this._client,c=(m,g,d)=>a.sendRequest(As.LinkedEditingRangeRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),d).then(f=>d.isCancellationRequested?null:a.protocol2CodeConverter.asLinkedEditingRanges(f,d),f=>a.handleFailedRequest(As.LinkedEditingRangeRequest.type,d,f,null)),l=a.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,o,s,c):c(i,o,s)}};return[this.registerProvider(n,r),r]}registerProvider(t,n){return op.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}fi.LinkedEditingFeature=sp;var hi={};Object.defineProperty(hi,"__esModule",{value:!0}),hi.TypeHierarchyFeature=void 0;const ap=de.default,Xt=he,Hs=Te;class cp{constructor(t){this.client=t,this.middleware=t.middleware}prepareTypeHierarchy(t,n,r){const i=this.client,o=this.middleware,s=(a,c,l)=>{const m=i.code2ProtocolConverter.asTextDocumentPositionParams(a,c);return i.sendRequest(Xt.TypeHierarchyPrepareRequest.type,m,l).then(g=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(g,l),g=>i.handleFailedRequest(Xt.TypeHierarchyPrepareRequest.type,l,g,null))};return o.prepareTypeHierarchy?o.prepareTypeHierarchy(t,n,r,s):s(t,n,r)}provideTypeHierarchySupertypes(t,n){const r=this.client,i=this.middleware,o=(s,a)=>{const c={item:r.code2ProtocolConverter.asTypeHierarchyItem(s)};return r.sendRequest(Xt.TypeHierarchySupertypesRequest.type,c,a).then(l=>a.isCancellationRequested?null:r.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>r.handleFailedRequest(Xt.TypeHierarchySupertypesRequest.type,a,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(t,n,o):o(t,n)}provideTypeHierarchySubtypes(t,n){const r=this.client,i=this.middleware,o=(s,a)=>{const c={item:r.code2ProtocolConverter.asTypeHierarchyItem(s)};return r.sendRequest(Xt.TypeHierarchySubtypesRequest.type,c,a).then(l=>a.isCancellationRequested?null:r.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>r.handleFailedRequest(Xt.TypeHierarchySubtypesRequest.type,a,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(t,n,o):o(t,n)}}class up extends Hs.TextDocumentLanguageFeature{constructor(t){super(t,Xt.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(t){const n=(0,Hs.ensure)((0,Hs.ensure)(t,"textDocument"),"typeHierarchy");n.dynamicRegistration=!0}initialize(t,n){const[r,i]=this.getRegistration(n,t.typeHierarchyProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=this._client,r=new cp(n);return[ap.languages.registerTypeHierarchyProvider(n.protocol2CodeConverter.asDocumentSelector(t.documentSelector),r),r]}}hi.TypeHierarchyFeature=up;var gi={};Object.defineProperty(gi,"__esModule",{value:!0}),gi.InlineValueFeature=void 0;const Qc=de.default,pi=he,Jn=Te;class lp extends Jn.TextDocumentLanguageFeature{constructor(t){super(t,pi.InlineValueRequest.type)}fillClientCapabilities(t){(0,Jn.ensure)((0,Jn.ensure)(t,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,Jn.ensure)((0,Jn.ensure)(t,"workspace"),"inlineValue").refreshSupport=!0}initialize(t,n){this._client.onRequest(pi.InlineValueRefreshRequest.type,async()=>{for(const o of this.getAllProviders())o.onDidChangeInlineValues.fire()});const[r,i]=this.getRegistration(n,t.inlineValueProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r=new Qc.EventEmitter,i={onDidChangeInlineValues:r.event,provideInlineValues:(o,s,a,c)=>{const l=this._client,m=(d,f,y,L)=>{const M={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(d),range:l.code2ProtocolConverter.asRange(f),context:l.code2ProtocolConverter.asInlineValueContext(y)};return l.sendRequest(pi.InlineValueRequest.type,M,L).then(x=>L.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(x,L),x=>l.handleFailedRequest(pi.InlineValueRequest.type,L,x,null))},g=l.middleware;return g.provideInlineValues?g.provideInlineValues(o,s,a,c,m):m(o,s,a,c)}};return[this.registerProvider(n,i),{provider:i,onDidChangeInlineValues:r}]}registerProvider(t,n){return Qc.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}gi.InlineValueFeature=lp;var mi={};Object.defineProperty(mi,"__esModule",{value:!0}),mi.InlayHintsFeature=void 0;const Yc=de.default,Cn=he,Qn=Te;class dp extends Qn.TextDocumentLanguageFeature{constructor(t){super(t,Cn.InlayHintRequest.type)}fillClientCapabilities(t){const n=(0,Qn.ensure)((0,Qn.ensure)(t,"textDocument"),"inlayHint");n.dynamicRegistration=!0,n.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,Qn.ensure)((0,Qn.ensure)(t,"workspace"),"inlayHint").refreshSupport=!0}initialize(t,n){this._client.onRequest(Cn.InlayHintRefreshRequest.type,async()=>{for(const o of this.getAllProviders())o.onDidChangeInlayHints.fire()});const[r,i]=this.getRegistration(n,t.inlayHintProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,r=new Yc.EventEmitter,i={onDidChangeInlayHints:r.event,provideInlayHints:(o,s,a)=>{const c=this._client,l=async(g,d,f)=>{const y={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),range:c.code2ProtocolConverter.asRange(d)};try{const L=await c.sendRequest(Cn.InlayHintRequest.type,y,f);return f.isCancellationRequested?null:c.protocol2CodeConverter.asInlayHints(L,f)}catch(L){return c.handleFailedRequest(Cn.InlayHintRequest.type,f,L,null)}},m=c.middleware;return m.provideInlayHints?m.provideInlayHints(o,s,a,l):l(o,s,a)}};return i.resolveInlayHint=t.resolveProvider===!0?(o,s)=>{const a=this._client,c=async(m,g)=>{try{const d=await a.sendRequest(Cn.InlayHintResolveRequest.type,a.code2ProtocolConverter.asInlayHint(m),g);if(g.isCancellationRequested)return null;const f=a.protocol2CodeConverter.asInlayHint(d,g);return g.isCancellationRequested?null:f}catch(d){return a.handleFailedRequest(Cn.InlayHintResolveRequest.type,g,d,null)}},l=a.middleware;return l.resolveInlayHint?l.resolveInlayHint(o,s,c):c(o,s)}:void 0,[this.registerProvider(n,i),{provider:i,onDidChangeInlayHints:r}]}registerProvider(t,n){return Yc.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}mi.InlayHintsFeature=dp,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProposedFeatures=e.BaseLanguageClient=e.MessageTransports=e.SuspendMode=e.State=e.CloseAction=e.ErrorAction=e.RevealOutputChannelOn=void 0;const t=de.default,n=he,r=wr,i=Ir,o=Ee,s=rt,a=De,c=Mn,l=Te,m=es,g=Lr,d=At,f=ot,y=Hr,L=Wr,M=Ur,x=xr,b=zr,E=ms,w=Kr,$=Gr,H=Vr,T=Br,S=jt,N=Jr,O=Qr,C=Yr,h=Zr,k=ti,W=ni,P=ri,F=yn,j=oi,G=si,X=ai,ie=ci,ce=ui,Y=li,oe=st,Z=fi,se=hi,re=gi,be=mi;var Be;(function(ae){ae[ae.Info=1]="Info",ae[ae.Warn=2]="Warn",ae[ae.Error=3]="Error",ae[ae.Never=4]="Never"})(Be=e.RevealOutputChannelOn||(e.RevealOutputChannelOn={}));var Fe;(function(ae){ae[ae.Continue=1]="Continue",ae[ae.Shutdown=2]="Shutdown"})(Fe=e.ErrorAction||(e.ErrorAction={}));var xe;(function(ae){ae[ae.DoNotRestart=1]="DoNotRestart",ae[ae.Restart=2]="Restart"})(xe=e.CloseAction||(e.CloseAction={}));var dt;(function(ae){ae[ae.Stopped=1]="Stopped",ae[ae.Starting=3]="Starting",ae[ae.Running=2]="Running"})(dt=e.State||(e.State={})),function(ae){ae.off="off",ae.on="on"}(e.SuspendMode||(e.SuspendMode={}));class at{constructor(_,I){this.client=_,this.maxRestartCount=I,this.restarts=[]}error(_,I,D){return D&&D<=3?{action:Fe.Continue}:{action:Fe.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:xe.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=3*60*1e3?{action:xe.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:xe.Restart})}}var fe;(function(ae){ae.Initial="initial",ae.Starting="starting",ae.StartFailed="startFailed",ae.Running="running",ae.Stopping="stopping",ae.Stopped="stopped"})(fe||(fe={})),function(ae){function _(I){return I&&n.MessageReader.is(I.reader)&&n.MessageWriter.is(I.writer)}ae.is=_}(e.MessageTransports||(e.MessageTransports={}));class et{constructor(_,I,D){this._traceFormat=n.TraceFormat.Text,this._diagnosticQueue=new Map,this._diagnosticQueueState={state:"idle"},this._features=[],this._dynamicFeatures=new Map,this.workspaceEditLock=new s.Semaphore(1),this._id=_,this._name=I,D=D||{};const V={isTrusted:!1,supportHtml:!1};D.markdown!==void 0&&(V.isTrusted=D.markdown.isTrusted===!0,V.supportHtml=D.markdown.supportHtml===!0),this._clientOptions={documentSelector:D.documentSelector??[],synchronize:D.synchronize??{},diagnosticCollectionName:D.diagnosticCollectionName,outputChannelName:D.outputChannelName??this._name,revealOutputChannelOn:D.revealOutputChannelOn??Be.Error,stdioEncoding:D.stdioEncoding??"utf8",initializationOptions:D.initializationOptions,initializationFailedHandler:D.initializationFailedHandler,progressOnInitialization:!!D.progressOnInitialization,errorHandler:D.errorHandler??this.createDefaultErrorHandler(D.connectionOptions?.maxRestartCount),middleware:D.middleware??{},uriConverters:D.uriConverters,workspaceFolder:D.workspaceFolder,connectionOptions:D.connectionOptions,markdown:V,diagnosticPullOptions:D.diagnosticPullOptions??{onChange:!0,onSave:!1},notebookDocumentOptions:D.notebookDocumentOptions??{}},this._clientOptions.synchronize=this._clientOptions.synchronize||{},this._state=fe.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,D.outputChannel?(this._outputChannel=D.outputChannel,this._disposeOutputChannel=!1):(this._outputChannel=void 0,this._disposeOutputChannel=!0),this._traceOutputChannel=D.traceOutputChannel,this._diagnostics=void 0,this._fileEvents=[],this._fileEventDelayer=new s.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new n.Emitter,this._stateChangeEmitter=new n.Emitter,this._trace=n.Trace.Off,this._tracer={log:(K,B)=>{o.string(K)?this.logTrace(K,B):this.logObjectTrace(K)}},this._c2p=r.createConverter(D.uriConverters?D.uriConverters.code2Protocol:void 0),this._p2c=i.createConverter(D.uriConverters?D.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}get name(){return this._name}get middleware(){return this._clientOptions.middleware??Object.create(null)}get clientOptions(){return this._clientOptions}get protocol2CodeConverter(){return this._p2c}get code2ProtocolConverter(){return this._c2p}get onTelemetry(){return this._telemetryEmitter.event}get onDidChangeState(){return this._stateChangeEmitter.event}get outputChannel(){return this._outputChannel||(this._outputChannel=t.window.createOutputChannel(this._clientOptions.outputChannelName?this._clientOptions.outputChannelName:this._name)),this._outputChannel}get traceOutputChannel(){return this._traceOutputChannel?this._traceOutputChannel:this.outputChannel}get diagnostics(){return this._diagnostics}get state(){return this.getPublicState()}get $state(){return this._state}set $state(_){let I=this.getPublicState();this._state=_;let D=this.getPublicState();D!==I&&this._stateChangeEmitter.fire({oldState:I,newState:D})}getPublicState(){switch(this.$state){case fe.Starting:return dt.Starting;case fe.Running:return dt.Running;default:return dt.Stopped}}get initializeResult(){return this._initializeResult}async sendRequest(_,...I){if(this.$state===fe.StartFailed||this.$state===fe.Stopping||this.$state===fe.Stopped)return Promise.reject(new n.ResponseError(n.ErrorCodes.ConnectionInactive,"Client is not running"));try{const D=await this.$start();return await this.forceDocumentSync(),D.sendRequest(_,...I)}catch(D){throw this.error(`Sending request ${o.string(_)?_:_.method} failed.`,D),D}}onRequest(_,I){const D=typeof _=="string"?_:_.method;this._requestHandlers.set(D,I);const V=this.activeConnection();let K;return V!==void 0?(this._requestDisposables.set(D,V.onRequest(_,I)),K={dispose:()=>{const B=this._requestDisposables.get(D);B!==void 0&&(B.dispose(),this._requestDisposables.delete(D))}}):(this._pendingRequestHandlers.set(D,I),K={dispose:()=>{this._pendingRequestHandlers.delete(D);const B=this._requestDisposables.get(D);B!==void 0&&(B.dispose(),this._requestDisposables.delete(D))}}),{dispose:()=>{this._requestHandlers.delete(D),K.dispose()}}}async sendNotification(_,I){if(this.$state===fe.StartFailed||this.$state===fe.Stopping||this.$state===fe.Stopped)return Promise.reject(new n.ResponseError(n.ErrorCodes.ConnectionInactive,"Client is not running"));try{const D=await this.$start();return await this.forceDocumentSync(),D.sendNotification(_,I)}catch(D){throw this.error(`Sending notification ${o.string(_)?_:_.method} failed.`,D),D}}onNotification(_,I){const D=typeof _=="string"?_:_.method;this._notificationHandlers.set(D,I);const V=this.activeConnection();let K;return V!==void 0?(this._notificationDisposables.set(D,V.onNotification(_,I)),K={dispose:()=>{const B=this._notificationDisposables.get(D);B!==void 0&&(B.dispose(),this._notificationDisposables.delete(D))}}):(this._pendingNotificationHandlers.set(D,I),K={dispose:()=>{this._pendingNotificationHandlers.delete(D);const B=this._notificationDisposables.get(D);B!==void 0&&(B.dispose(),this._notificationDisposables.delete(D))}}),{dispose:()=>{this._notificationHandlers.delete(D),K.dispose()}}}async sendProgress(_,I,D){if(this.$state===fe.StartFailed||this.$state===fe.Stopping||this.$state===fe.Stopped)return Promise.reject(new n.ResponseError(n.ErrorCodes.ConnectionInactive,"Client is not running"));try{return(await this.$start()).sendProgress(_,I,D)}catch(V){throw this.error(`Sending progress for token ${I} failed.`,V),V}}onProgress(_,I,D){this._progressHandlers.set(I,{type:_,handler:D});const V=this.activeConnection();let K;const B=this._clientOptions.middleware?.handleWorkDoneProgress,ue=n.WorkDoneProgress.is(_)&&B!==void 0?Ce=>{B(I,Ce,()=>D(Ce))}:D;return V!==void 0?(this._progressDisposables.set(I,V.onProgress(_,I,ue)),K={dispose:()=>{const Ce=this._progressDisposables.get(I);Ce!==void 0&&(Ce.dispose(),this._progressDisposables.delete(I))}}):(this._pendingProgressHandlers.set(I,{type:_,handler:D}),K={dispose:()=>{this._pendingProgressHandlers.delete(I);const Ce=this._progressDisposables.get(I);Ce!==void 0&&(Ce.dispose(),this._progressDisposables.delete(I))}}),{dispose:()=>{this._progressHandlers.delete(I),K.dispose()}}}createDefaultErrorHandler(_){if(_!==void 0&&_<0)throw new Error(`Invalid maxRestartCount: ${_}`);return new at(this,_??4)}async setTrace(_){this._trace=_;const I=this.activeConnection();I!==void 0&&await I.trace(this._trace,this._tracer,{sendNotification:!1,traceFormat:this._traceFormat})}data2String(_){if(_ instanceof n.ResponseError){const I=_;return` Message: ${I.message} Code: ${I.code} ${I.data?` `+I.data.toString():""}`}return _ instanceof Error?o.string(_.stack)?_.stack:_.message:o.string(_)?_:_.toString()}info(_,I,D=!0){this.outputChannel.appendLine(`[Info - ${new Date().toLocaleTimeString()}] ${_}`),I!=null&&this.outputChannel.appendLine(this.data2String(I)),D&&this._clientOptions.revealOutputChannelOn<=Be.Info&&this.showNotificationMessage(n.MessageType.Info,_)}warn(_,I,D=!0){this.outputChannel.appendLine(`[Warn - ${new Date().toLocaleTimeString()}] ${_}`),I!=null&&this.outputChannel.appendLine(this.data2String(I)),D&&this._clientOptions.revealOutputChannelOn<=Be.Warn&&this.showNotificationMessage(n.MessageType.Warning,_)}error(_,I,D=!0){this.outputChannel.appendLine(`[Error - ${new Date().toLocaleTimeString()}] ${_}`),I!=null&&this.outputChannel.appendLine(this.data2String(I)),(D==="force"||D&&this._clientOptions.revealOutputChannelOn<=Be.Error)&&this.showNotificationMessage(n.MessageType.Error,_)}showNotificationMessage(_,I){I=I??"A request has failed. See the output for more information.",(_===n.MessageType.Error?t.window.showErrorMessage:_===n.MessageType.Warning?t.window.showWarningMessage:t.window.showInformationMessage)(I,"Go to output").then(V=>{V!==void 0&&this.outputChannel.show(!0)})}logTrace(_,I){this.traceOutputChannel.appendLine(`[Trace - ${new Date().toLocaleTimeString()}] ${_}`),I&&this.traceOutputChannel.appendLine(this.data2String(I))}logObjectTrace(_){_.isLSPMessage&&_.type?this.traceOutputChannel.append(`[LSP - ${new Date().toLocaleTimeString()}] `):this.traceOutputChannel.append(`[Trace - ${new Date().toLocaleTimeString()}] `),_&&this.traceOutputChannel.appendLine(`${JSON.stringify(_)}`)}needsStart(){return this.$state===fe.Initial||this.$state===fe.Stopping||this.$state===fe.Stopped}needsStop(){return this.$state===fe.Starting||this.$state===fe.Running}activeConnection(){return this.$state===fe.Running&&this._connection!==void 0?this._connection:void 0}isRunning(){return this.$state===fe.Running}async start(){if(this._disposed==="disposing"||this._disposed==="disposed")throw new Error("Client got disposed and can't be restarted.");if(this.$state===fe.Stopping)throw new Error("Client is currently stopping. Can only restart a full stopped client");if(this._onStart!==void 0)return this._onStart;const[_,I,D]=this.createOnStartPromise();this._onStart=_,this._diagnostics===void 0&&(this._diagnostics=this._clientOptions.diagnosticCollectionName?t.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName):t.languages.createDiagnosticCollection());for(const[V,K]of this._notificationHandlers)this._pendingNotificationHandlers.has(V)||this._pendingNotificationHandlers.set(V,K);for(const[V,K]of this._requestHandlers)this._pendingRequestHandlers.has(V)||this._pendingRequestHandlers.set(V,K);for(const[V,K]of this._progressHandlers)this._pendingProgressHandlers.has(V)||this._pendingProgressHandlers.set(V,K);this.$state=fe.Starting;try{const V=await this.createConnection();V.onNotification(n.LogMessageNotification.type,K=>{switch(K.type){case n.MessageType.Error:this.error(K.message,void 0,!1);break;case n.MessageType.Warning:this.warn(K.message,void 0,!1);break;case n.MessageType.Info:this.info(K.message,void 0,!1);break;default:this.outputChannel.appendLine(K.message)}}),V.onNotification(n.ShowMessageNotification.type,K=>{switch(K.type){case n.MessageType.Error:t.window.showErrorMessage(K.message);break;case n.MessageType.Warning:t.window.showWarningMessage(K.message);break;case n.MessageType.Info:t.window.showInformationMessage(K.message);break;default:t.window.showInformationMessage(K.message)}}),V.onRequest(n.ShowMessageRequest.type,K=>{let B;switch(K.type){case n.MessageType.Error:B=t.window.showErrorMessage;break;case n.MessageType.Warning:B=t.window.showWarningMessage;break;case n.MessageType.Info:B=t.window.showInformationMessage;break;default:B=t.window.showInformationMessage}let ue=K.actions||[];return B(K.message,...ue)}),V.onNotification(n.TelemetryEventNotification.type,K=>{this._telemetryEmitter.fire(K)}),V.onRequest(n.ShowDocumentRequest.type,async K=>{const B=async Ce=>{const Ie=this.protocol2CodeConverter.asUri(Ce.uri);try{if(Ce.external===!0)return{success:await t.env.openExternal(Ie)};{const Le={};return Ce.selection!==void 0&&(Le.selection=this.protocol2CodeConverter.asRange(Ce.selection)),Ce.takeFocus===void 0||Ce.takeFocus===!1?Le.preserveFocus=!0:Ce.takeFocus===!0&&(Le.preserveFocus=!1),await t.window.showTextDocument(Ie,Le),{success:!0}}}catch{return{success:!1}}},ue=this._clientOptions.middleware.window?.showDocument;return ue!==void 0?ue(K,B):B(K)}),V.listen(),await this.initialize(V),I()}catch(V){this.$state=fe.StartFailed,this.error(`${this._name} client: couldn't create connection to server.`,V,"force"),D(V)}return this._onStart}createOnStartPromise(){let _,I;return[new Promise((V,K)=>{_=V,I=K}),_,I]}async initialize(_){this.refreshTrace(_,!1);const I=this._clientOptions.initializationOptions,[D,V]=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],K={processId:null,clientInfo:{name:t.env.appName,version:t.version},locale:this.getLocale(),rootPath:D||null,rootUri:D?this._c2p.asUri(t.Uri.file(D)):null,capabilities:this.computeClientCapabilities(),initializationOptions:o.func(I)?I():I,trace:n.Trace.toString(this._trace),workspaceFolders:V};if(this.fillInitializeParams(K),this._clientOptions.progressOnInitialization){const B=a.generateUuid(),ue=new c.ProgressPart(_,B);K.workDoneToken=B;try{const Ce=await this.doInitialize(_,K);return ue.done(),Ce}catch(Ce){throw ue.cancel(),Ce}}else return this.doInitialize(_,K)}async doInitialize(_,I){try{const D=await _.initialize(I);if(D.capabilities.positionEncoding!==void 0&&D.capabilities.positionEncoding!==n.PositionEncodingKind.UTF16)throw new Error(`Unsupported position encoding (${D.capabilities.positionEncoding}) received from server ${this.name}`);this._initializeResult=D,this.$state=fe.Running;let V;o.number(D.capabilities.textDocumentSync)?D.capabilities.textDocumentSync===n.TextDocumentSyncKind.None?V={openClose:!1,change:n.TextDocumentSyncKind.None,save:void 0}:V={openClose:!0,change:D.capabilities.textDocumentSync,save:{includeText:!1}}:D.capabilities.textDocumentSync!==void 0&&D.capabilities.textDocumentSync!==null&&(V=D.capabilities.textDocumentSync),this._capabilities=Object.assign({},D.capabilities,{resolvedTextDocumentSync:V}),_.onNotification(n.PublishDiagnosticsNotification.type,K=>this.handleDiagnostics(K)),_.onRequest(n.RegistrationRequest.type,K=>this.handleRegistrationRequest(K)),_.onRequest("client/registerFeature",K=>this.handleRegistrationRequest(K)),_.onRequest(n.UnregistrationRequest.type,K=>this.handleUnregistrationRequest(K)),_.onRequest("client/unregisterFeature",K=>this.handleUnregistrationRequest(K)),_.onRequest(n.ApplyWorkspaceEditRequest.type,K=>this.handleApplyWorkspaceEdit(K));for(const[K,B]of this._pendingNotificationHandlers)this._notificationDisposables.set(K,_.onNotification(K,B));this._pendingNotificationHandlers.clear();for(const[K,B]of this._pendingRequestHandlers)this._requestDisposables.set(K,_.onRequest(K,B));this._pendingRequestHandlers.clear();for(const[K,B]of this._pendingProgressHandlers)this._progressDisposables.set(K,_.onProgress(B.type,K,B.handler));return this._pendingProgressHandlers.clear(),await _.sendNotification(n.InitializedNotification.type,{}),this.hookFileEvents(_),this.hookConfigurationChanged(_),this.initializeFeatures(_),D}catch(D){throw this._clientOptions.initializationFailedHandler?this._clientOptions.initializationFailedHandler(D)?this.initialize(_):this.stop():D instanceof n.ResponseError&&D.data&&D.data.retry?t.window.showErrorMessage(D.message,{title:"Retry",id:"retry"}).then(V=>{V&&V.id==="retry"?this.initialize(_):this.stop()}):(D&&D.message&&t.window.showErrorMessage(D.message),this.error("Server initialization failed.",D),this.stop()),D}}_clientGetRootPath(){let _=t.workspace.workspaceFolders;if(!_||_.length===0)return;let I=_[0];if(I.uri.scheme==="file")return I.uri.fsPath}stop(_=2e3){return this.shutdown("stop",_)}dispose(_=2e3){try{return this._disposed="disposing",this.stop(_)}finally{this._disposed="disposed"}}async shutdown(_,I){if(this.$state===fe.Stopped||this.$state===fe.Initial)return;if(this.$state===fe.Stopping){if(this._onStop!==void 0)return this._onStop;throw new Error("Client is stopping but no stop promise available.")}const D=this.activeConnection();if(D===void 0||this.$state!==fe.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=fe.Stopping,this.cleanUp(_);const V=new Promise(B=>{(0,n.RAL)().timer.setTimeout(B,I)}),K=(async B=>(await B.shutdown(),await B.exit(),B))(D);return this._onStop=Promise.race([V,K]).then(B=>{if(B!==void 0)B.end(),B.dispose();else throw this.error("Stopping server timed out",void 0,!1),new Error("Stopping the server timed out")},B=>{throw this.error("Stopping server failed",B,!1),B}).finally(()=>{this.$state=fe.Stopped,_==="stop"&&this.cleanUpChannel(),this._onStart=void 0,this._onStop=void 0,this._connection=void 0,this._ignoredRegistrations.clear()})}cleanUp(_){this._fileEvents=[],this._fileEventDelayer.cancel();const I=this._listeners.splice(0,this._listeners.length);for(const D of I)D.dispose();this._syncedDocuments&&this._syncedDocuments.clear();for(const D of Array.from(this._features.entries()).map(V=>V[1]).reverse())D.dispose();_==="stop"&&this._diagnostics!==void 0&&(this._diagnostics.dispose(),this._diagnostics=void 0),this._idleInterval!==void 0&&(this._idleInterval.dispose(),this._idleInterval=void 0)}cleanUpChannel(){this._outputChannel!==void 0&&this._disposeOutputChannel&&(this._outputChannel.dispose(),this._outputChannel=void 0)}notifyFileEvent(_){const I=this;async function D(K){return I._fileEvents.push(K),I._fileEventDelayer.trigger(async()=>{const B=await I.$start();await I.forceDocumentSync();const ue=B.sendNotification(n.DidChangeWatchedFilesNotification.type,{changes:I._fileEvents});return I._fileEvents=[],ue})}const V=this.clientOptions.middleware?.workspace;(V?.didChangeWatchedFile?V.didChangeWatchedFile(_,D):D(_)).catch(K=>{I.error("Notify file events failed.",K)})}async forceDocumentSync(){return this._didChangeTextDocumentFeature===void 0&&(this._didChangeTextDocumentFeature=this._dynamicFeatures.get(n.DidChangeTextDocumentNotification.type.method)),this._didChangeTextDocumentFeature.forceDelivery()}handleDiagnostics(_){if(!this._diagnostics)return;const I=_.uri;this._diagnosticQueueState.state==="busy"&&this._diagnosticQueueState.document===I&&this._diagnosticQueueState.tokenSource.cancel(),this._diagnosticQueue.set(_.uri,_.diagnostics),this.triggerDiagnosticQueue()}triggerDiagnosticQueue(){(0,n.RAL)().timer.setImmediate(()=>{this.workDiagnosticQueue()})}workDiagnosticQueue(){if(this._diagnosticQueueState.state==="busy")return;const _=this._diagnosticQueue.entries().next();if(_.done===!0)return;const[I,D]=_.value;this._diagnosticQueue.delete(I);const V=new t.CancellationTokenSource;this._diagnosticQueueState={state:"busy",document:I,tokenSource:V},this._p2c.asDiagnostics(D,V.token).then(K=>{if(!V.token.isCancellationRequested){const B=this._p2c.asUri(I),ue=this.clientOptions.middleware;ue.handleDiagnostics?ue.handleDiagnostics(B,K,(Ce,Ie)=>this.setDiagnostics(Ce,Ie)):this.setDiagnostics(B,K)}}).finally(()=>{this._diagnosticQueueState={state:"idle"},this.triggerDiagnosticQueue()})}setDiagnostics(_,I){!this._diagnostics||this._diagnostics.set(_,I)}async $start(){if(this.$state===fe.StartFailed)throw new Error("Previous start failed. Can't restart server.");await this.start();const _=this.activeConnection();if(_===void 0)throw new Error("Starting server failed");return _}async createConnection(){let _=(V,K,B)=>{this.handleConnectionError(V,K,B)},I=()=>{this.handleConnectionClosed()};const D=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=mt(D.reader,D.writer,_,I,this._clientOptions.connectionOptions),this._connection}handleConnectionClosed(){if(this.$state===fe.Stopped)return;try{this._connection!==void 0&&this._connection.dispose()}catch{}let _={action:xe.DoNotRestart};if(this.$state!==fe.Stopping)try{_=this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,_.action===xe.DoNotRestart?(this.error(_.message??"Connection to server got closed. Server will not be restarted.",void 0,"force"),this.cleanUp("stop"),this.$state===fe.Starting?this.$state=fe.StartFailed:this.$state=fe.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):_.action===xe.Restart&&(this.info(_.message??"Connection to server got closed. Server will restart."),this.cleanUp("restart"),this.$state=fe.Initial,this._onStop=Promise.resolve(),this._onStart=void 0,this.start().catch(I=>this.error("Restarting server failed",I,"force")))}handleConnectionError(_,I,D){const V=this._clientOptions.errorHandler.error(_,I,D);V.action===Fe.Shutdown&&(this.error(V.message??`Client ${this._name}: connection to server is erroring. Shutting down server.`,void 0,"force"),this.stop().catch(K=>{this.error("Stopping server failed",K,!1)}))}hookConfigurationChanged(_){this._listeners.push(t.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(_,!0)}))}refreshTrace(_,I=!1){const D=t.workspace.getConfiguration(this._id);let V=n.Trace.Off,K=n.TraceFormat.Text;if(D){const B=D.get("trace.server","off");typeof B=="string"?V=n.Trace.fromString(B):(V=n.Trace.fromString(D.get("trace.server.verbosity","off")),K=n.TraceFormat.fromString(D.get("trace.server.format","text")))}this._trace=V,this._traceFormat=K,_.trace(this._trace,this._tracer,{sendNotification:I,traceFormat:this._traceFormat}).catch(B=>{this.error("Updating trace failed with error",B,!1)})}hookFileEvents(_){let I=this._clientOptions.synchronize.fileEvents;if(!I)return;let D;o.array(I)?D=I:D=[I],D&&this._dynamicFeatures.get(n.DidChangeWatchedFilesNotification.type.method).registerRaw(a.generateUuid(),D)}registerFeatures(_){for(let I of _)this.registerFeature(I)}registerFeature(_){if(this._features.push(_),l.DynamicFeature.is(_)){const I=_.registrationType;this._dynamicFeatures.set(I.method,_)}}getFeature(_){return this._dynamicFeatures.get(_)}hasDedicatedTextSynchronizationFeature(_){const I=this.getFeature(n.NotebookDocumentSyncRegistrationType.method);return I===void 0||!(I instanceof g.NotebookDocumentSyncFeature)?!1:I.handles(_)}registerBuiltinFeatures(){this.registerFeature(new d.ConfigurationFeature(this)),this.registerFeature(new f.DidOpenTextDocumentFeature(this,this._syncedDocuments)),this.registerFeature(new f.DidChangeTextDocumentFeature(this)),this.registerFeature(new f.WillSaveFeature(this)),this.registerFeature(new f.WillSaveWaitUntilFeature(this)),this.registerFeature(new f.DidSaveTextDocumentFeature(this)),this.registerFeature(new f.DidCloseTextDocumentFeature(this,this._syncedDocuments)),this.registerFeature(new h.FileSystemWatcherFeature(this,_=>this.notifyFileEvent(_))),this.registerFeature(new y.CompletionItemFeature(this)),this.registerFeature(new L.HoverFeature(this)),this.registerFeature(new x.SignatureHelpFeature(this)),this.registerFeature(new M.DefinitionFeature(this)),this.registerFeature(new $.ReferencesFeature(this)),this.registerFeature(new b.DocumentHighlightFeature(this)),this.registerFeature(new E.DocumentSymbolFeature(this)),this.registerFeature(new w.WorkspaceSymbolFeature(this)),this.registerFeature(new H.CodeActionFeature(this)),this.registerFeature(new T.CodeLensFeature(this)),this.registerFeature(new S.DocumentFormattingFeature(this)),this.registerFeature(new S.DocumentRangeFormattingFeature(this)),this.registerFeature(new S.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new N.RenameFeature(this)),this.registerFeature(new O.DocumentLinkFeature(this)),this.registerFeature(new C.ExecuteCommandFeature(this)),this.registerFeature(new d.SyncConfigurationFeature(this)),this.registerFeature(new P.TypeDefinitionFeature(this)),this.registerFeature(new W.ImplementationFeature(this)),this.registerFeature(new k.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new F.WorkspaceFoldersFeature(this)),this.registerFeature(new j.FoldingRangeFeature(this)),this.registerFeature(new G.DeclarationFeature(this)),this.registerFeature(new X.SelectionRangeFeature(this)),this.registerFeature(new ie.ProgressFeature(this)),this.registerFeature(new ce.CallHierarchyFeature(this)),this.registerFeature(new Y.SemanticTokensFeature(this)),this.registerFeature(new Z.LinkedEditingFeature(this)),this.registerFeature(new oe.DidCreateFilesFeature(this)),this.registerFeature(new oe.DidRenameFilesFeature(this)),this.registerFeature(new oe.DidDeleteFilesFeature(this)),this.registerFeature(new oe.WillCreateFilesFeature(this)),this.registerFeature(new oe.WillRenameFilesFeature(this)),this.registerFeature(new oe.WillDeleteFilesFeature(this)),this.registerFeature(new se.TypeHierarchyFeature(this)),this.registerFeature(new re.InlineValueFeature(this)),this.registerFeature(new be.InlayHintsFeature(this)),this.registerFeature(new m.DiagnosticFeature(this)),this.registerFeature(new g.NotebookDocumentSyncFeature(this))}registerProposedFeatures(){this.registerFeatures(tt.createAll(this))}fillInitializeParams(_){for(let I of this._features)o.func(I.fillInitializeParams)&&I.fillInitializeParams(_)}computeClientCapabilities(){const _={};(0,l.ensure)(_,"workspace").applyEdit=!0;const I=(0,l.ensure)((0,l.ensure)(_,"workspace"),"workspaceEdit");I.documentChanges=!0,I.resourceOperations=[n.ResourceOperationKind.Create,n.ResourceOperationKind.Rename,n.ResourceOperationKind.Delete],I.failureHandling=n.FailureHandlingKind.TextOnlyTransactional,I.normalizesLineEndings=!0,I.changeAnnotationSupport={groupsOnLabel:!0};const D=(0,l.ensure)((0,l.ensure)(_,"textDocument"),"publishDiagnostics");D.relatedInformation=!0,D.versionSupport=!1,D.tagSupport={valueSet:[n.DiagnosticTag.Unnecessary,n.DiagnosticTag.Deprecated]},D.codeDescriptionSupport=!0,D.dataSupport=!0;const V=(0,l.ensure)(_,"window"),K=(0,l.ensure)(V,"showMessage");K.messageActionItem={additionalPropertiesSupport:!0};const B=(0,l.ensure)(V,"showDocument");B.support=!0;const ue=(0,l.ensure)(_,"general");ue.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(et.RequestsToCancelOnContentModified)},ue.regularExpressions={engine:"ECMAScript",version:"ES2020"},ue.markdown={parser:"marked",version:"1.1.0"},ue.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(ue.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 Ce of this._features)Ce.fillClientCapabilities(_);return _}initializeFeatures(_){const I=this._clientOptions.documentSelector;for(const D of this._features)o.func(D.preInitialize)&&D.preInitialize(this._capabilities,I);for(const D of this._features)D.initialize(this._capabilities,I)}async handleRegistrationRequest(_){if(!this.isRunning()){for(const I of _.registrations)this._ignoredRegistrations.add(I.id);return}for(const I of _.registrations){const D=this._dynamicFeatures.get(I.method);if(D===void 0)return Promise.reject(new Error(`No feature implementation for ${I.method} found. Registration failed.`));const V=I.registerOptions??{};V.documentSelector=V.documentSelector??this._clientOptions.documentSelector;const K={id:I.id,registerOptions:V};try{D.register(K)}catch(B){return Promise.reject(B)}}}async handleUnregistrationRequest(_){for(let I of _.unregisterations){if(this._ignoredRegistrations.has(I.id))continue;const D=this._dynamicFeatures.get(I.method);if(!D)return Promise.reject(new Error(`No feature implementation for ${I.method} found. Unregistration failed.`));D.unregister(I.id)}}async handleApplyWorkspaceEdit(_){const I=_.edit,D=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(I)),V=new Map;t.workspace.textDocuments.forEach(B=>V.set(B.uri.toString(),B));let K=!1;if(I.documentChanges){for(const B of I.documentChanges)if(n.TextDocumentEdit.is(B)&&B.textDocument.version&&B.textDocument.version>=0){const ue=V.get(B.textDocument.uri);if(ue&&ue.version!==B.textDocument.version){K=!0;break}}}return K?Promise.resolve({applied:!1}):o.asPromise(t.workspace.applyEdit(D).then(B=>({applied:B})))}handleFailedRequest(_,I,D,V,K=!0){if(D instanceof n.ResponseError){if(D.code===n.ErrorCodes.PendingResponseRejected||D.code===n.ErrorCodes.ConnectionInactive)return V;if(D.code===n.LSPErrorCodes.RequestCancelled||D.code===n.LSPErrorCodes.ServerCancelled){if(I!==void 0&&I.isCancellationRequested)return V;throw D.data!==void 0?new l.LSPCancellationError(D.data):new t.CancellationError}else if(D.code===n.LSPErrorCodes.ContentModified){if(et.RequestsToCancelOnContentModified.has(_.method))throw new t.CancellationError;return V}}throw this.error(`Request ${_.method} failed.`,D,K),D}}e.BaseLanguageClient=et,et.RequestsToCancelOnContentModified=new Set([n.SemanticTokensRequest.method,n.SemanticTokensRangeRequest.method,n.SemanticTokensDeltaRequest.method]);class wt{error(_){(0,n.RAL)().console.error(_)}warn(_){(0,n.RAL)().console.warn(_)}info(_){(0,n.RAL)().console.info(_)}log(_){(0,n.RAL)().console.log(_)}}function mt(ae,_,I,D,V){let K=-1;const B=new wt,ue=(0,n.createProtocolConnection)(ae,_,B,V);return ue.onError(Ie=>{I(Ie[0],Ie[1],Ie[2])}),ue.onClose(D),{get lastUsed(){return K},resetLastUsed:()=>{K=-1},listen:()=>ue.listen(),sendRequest:(Ie,...Le)=>(K=Date.now(),ue.sendRequest(Ie,...Le)),onRequest:(Ie,Le)=>ue.onRequest(Ie,Le),hasPendingResponse:()=>ue.hasPendingResponse(),sendNotification:(Ie,Le)=>(K=Date.now(),ue.sendNotification(Ie,Le)),onNotification:(Ie,Le)=>ue.onNotification(Ie,Le),onProgress:ue.onProgress,sendProgress:ue.sendProgress,trace:(Ie,Le,bt)=>{const qt={sendNotification:!1,traceFormat:n.TraceFormat.Text};return bt===void 0?ue.trace(Ie,Le,qt):(o.boolean(bt),ue.trace(Ie,Le,bt))},initialize:Ie=>(K=Date.now(),ue.sendRequest(n.InitializeRequest.type,Ie)),shutdown:()=>(K=Date.now(),ue.sendRequest(n.ShutdownRequest.type,void 0)),exit:()=>(K=Date.now(),ue.sendNotification(n.ExitNotification.type)),end:()=>ue.end(),dispose:()=>ue.dispose()}}var tt;(function(ae){function _(I){return[]}ae.createAll=_})(tt=e.ProposedFeatures||(e.ProposedFeatures={}))}(Hi);var yi={};Object.defineProperty(yi,"__esModule",{value:!0}),yi.terminate=void 0;const Zc=Xs.default,fp=er.default,hp=process.platform==="win32",gp=process.platform==="darwin",pp=process.platform==="linux";function mp(e,t){if(hp)try{let i={stdio:["pipe","pipe","ignore"]};return t&&(i.cwd=t),Zc.execFileSync("taskkill",["/T","/F","/PID",e.pid.toString()],i),!0}catch{return!1}else if(pp||gp)try{var n=(0,fp.join)(__dirname,"terminateProcess.sh"),r=Zc.spawnSync(n,[e.pid.toString()]);return!r.error}catch{return!1}else return e.kill("SIGKILL"),!0}yi.terminate=mp;var Ws={exports:{}};(function(e){e.exports=he})(Ws);var eu={};(function(e){var t=He.commonjsGlobal&&He.commonjsGlobal.__createBinding||(Object.create?function(i,o,s,a){a===void 0&&(a=s);var c=Object.getOwnPropertyDescriptor(o,s);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(i,a,c)}:function(i,o,s,a){a===void 0&&(a=s),i[a]=o[s]}),n=He.commonjsGlobal&&He.commonjsGlobal.__exportStar||function(i,o){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticPullMode=e.vsdiag=void 0,n(he,e),n(Te,e);var r=es;Object.defineProperty(e,"vsdiag",{enumerable:!0,get:function(){return r.vsdiag}}),Object.defineProperty(e,"DiagnosticPullMode",{enumerable:!0,get:function(){return r.DiagnosticPullMode}}),n(Hi,e)})(eu),function(e){var t=He.commonjsGlobal&&He.commonjsGlobal.__createBinding||(Object.create?function(H,T,S,N){N===void 0&&(N=S);var O=Object.getOwnPropertyDescriptor(T,S);(!O||("get"in O?!T.__esModule:O.writable||O.configurable))&&(O={enumerable:!0,get:function(){return T[S]}}),Object.defineProperty(H,N,O)}:function(H,T,S,N){N===void 0&&(N=S),H[N]=T[S]}),n=He.commonjsGlobal&&He.commonjsGlobal.__exportStar||function(H,T){for(var S in H)S!=="default"&&!Object.prototype.hasOwnProperty.call(T,S)&&t(T,H,S)};Object.defineProperty(e,"__esModule",{value:!0}),e.SettingMonitor=e.LanguageClient=e.TransportKind=void 0;const r=Xs.default,i=Ri.default,o=er.default,s=Nd,a=de.default,c=Ee,l=Hi,m=yi,g=Ws.exports;n(Ws.exports,e),n(eu,e);const d="^1.67.0";var f;(function(H){H[H.stdio=0]="stdio",H[H.ipc=1]="ipc",H[H.pipe=2]="pipe",H[H.socket=3]="socket"})(f=e.TransportKind||(e.TransportKind={}));var y;(function(H){function T(S){const N=S;return N&&N.kind===f.socket&&c.number(N.port)}H.isSocket=T})(y||(y={}));var L;(function(H){function T(S){return c.string(S.command)}H.is=T})(L||(L={}));var M;(function(H){function T(S){return c.string(S.module)}H.is=T})(M||(M={}));var x;(function(H){function T(S){let N=S;return N&&N.writer!==void 0&&N.reader!==void 0}H.is=T})(x||(x={}));var b;(function(H){function T(S){let N=S;return N&&N.process!==void 0&&typeof N.detached=="boolean"}H.is=T})(b||(b={}));class E extends l.BaseLanguageClient{constructor(T,S,N,O,C){let h,k,W,P,F;c.string(S)?(h=T,k=S,W=N,P=O,F=!!C):(h=T.toLowerCase(),k=T,W=S,P=N,F=O),F===void 0&&(F=!1),super(h,k,P),this._serverOptions=W,this._forceDebug=F,this._isInDebugMode=F;try{this.checkVersion()}catch(j){throw c.string(j.message)&&this.outputChannel.appendLine(j.message),j}}checkVersion(){const T=s.parse(a.version);if(!T)throw new Error(`No valid VS Code version detected. Version string is: ${a.version}`);if(T.prerelease&&T.prerelease.length>0&&(T.prerelease=[]),!s.satisfies(T,d))throw new Error(`The language client requires VS Code version ${d} but received version ${a.version}`)}get isInDebugMode(){return this._isInDebugMode}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(T=>setTimeout(T,1e3)),await this.start()):await this.start()}stop(T=2e3){return super.stop(T).finally(()=>{if(this._serverProcess){const S=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(S),this._isDetached=void 0}})}checkProcessDied(T){!T||T.pid===void 0||setTimeout(()=>{try{T.pid!==void 0&&(process.kill(T.pid,0),(0,m.terminate)(T))}catch{}},2e3)}handleConnectionClosed(){this._serverProcess=void 0,super.handleConnectionClosed()}fillInitializeParams(T){super.fillInitializeParams(T),T.processId===null&&(T.processId=process.pid)}createMessageTransports(T){function S(F,j){if(!F&&!j)return;const G=Object.create(null);return Object.keys(process.env).forEach(X=>G[X]=process.env[X]),j&&(G.ELECTRON_RUN_AS_NODE="1",G.ELECTRON_NO_ASAR="1"),F&&Object.keys(F).forEach(X=>G[X]=F[X]),G}const N=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],O=["--debug","--debug-brk","--inspect","--inspect-brk"];function C(){let F=process.execArgv;return F?F.some(j=>N.some(G=>j.startsWith(G))||O.some(G=>j===G)):!1}function h(F){if(F.stdin===null||F.stdout===null||F.stderr===null)throw new Error("Process created without stdio streams")}const k=this._serverOptions;if(c.func(k))return k().then(F=>{if(l.MessageTransports.is(F))return this._isDetached=!!F.detached,F;if(x.is(F))return this._isDetached=!!F.detached,{reader:new g.StreamMessageReader(F.reader),writer:new g.StreamMessageWriter(F.writer)};{let j;return b.is(F)?(j=F.process,this._isDetached=F.detached):(j=F,this._isDetached=!1),j.stderr.on("data",G=>this.outputChannel.append(c.string(G)?G:G.toString(T))),{reader:new g.StreamMessageReader(j.stdout),writer:new g.StreamMessageWriter(j.stdin)}}});let W,P=k;return P.run||P.debug?this._forceDebug||C()?(W=P.debug,this._isInDebugMode=!0):(W=P.run,this._isInDebugMode=!1):W=k,this._getServerWorkingDir(W.options).then(F=>{if(M.is(W)&&W.module){let j=W,G=j.transport||f.stdio;if(j.runtime){const X=[],ie=j.options??Object.create(null);ie.execArgv&&ie.execArgv.forEach(Z=>X.push(Z)),X.push(j.module),j.args&&j.args.forEach(Z=>X.push(Z));const ce=Object.create(null);ce.cwd=F,ce.env=S(ie.env,!1);const Y=this._getRuntimePath(j.runtime,F);let oe;if(G===f.ipc?(ce.stdio=[null,null,null,"ipc"],X.push("--node-ipc")):G===f.stdio?X.push("--stdio"):G===f.pipe?(oe=(0,g.generateRandomPipeName)(),X.push(`--pipe=${oe}`)):y.isSocket(G)&&X.push(`--socket=${G.port}`),X.push(`--clientProcessId=${process.pid.toString()}`),G===f.ipc||G===f.stdio){const Z=r.spawn(Y,X,ce);return!Z||!Z.pid?$(Z,`Launching server using runtime ${Y} failed.`):(this._serverProcess=Z,Z.stderr.on("data",se=>this.outputChannel.append(c.string(se)?se:se.toString(T))),G===f.ipc?(Z.stdout.on("data",se=>this.outputChannel.append(c.string(se)?se:se.toString(T))),Promise.resolve({reader:new g.IPCMessageReader(Z),writer:new g.IPCMessageWriter(Z)})):Promise.resolve({reader:new g.StreamMessageReader(Z.stdout),writer:new g.StreamMessageWriter(Z.stdin)}))}else{if(G===f.pipe)return(0,g.createClientPipeTransport)(oe).then(Z=>{const se=r.spawn(Y,X,ce);return!se||!se.pid?$(se,`Launching server using runtime ${Y} failed.`):(this._serverProcess=se,se.stderr.on("data",re=>this.outputChannel.append(c.string(re)?re:re.toString(T))),se.stdout.on("data",re=>this.outputChannel.append(c.string(re)?re:re.toString(T))),Z.onConnected().then(re=>({reader:re[0],writer:re[1]})))});if(y.isSocket(G))return(0,g.createClientSocketTransport)(G.port).then(Z=>{const se=r.spawn(Y,X,ce);return!se||!se.pid?$(se,`Launching server using runtime ${Y} failed.`):(this._serverProcess=se,se.stderr.on("data",re=>this.outputChannel.append(c.string(re)?re:re.toString(T))),se.stdout.on("data",re=>this.outputChannel.append(c.string(re)?re:re.toString(T))),Z.onConnected().then(re=>({reader:re[0],writer:re[1]})))})}}else{let X;return new Promise((ie,ce)=>{const Y=(j.args&&j.args.slice())??[];G===f.ipc?Y.push("--node-ipc"):G===f.stdio?Y.push("--stdio"):G===f.pipe?(X=(0,g.generateRandomPipeName)(),Y.push(`--pipe=${X}`)):y.isSocket(G)&&Y.push(`--socket=${G.port}`),Y.push(`--clientProcessId=${process.pid.toString()}`);const oe=j.options??Object.create(null);if(oe.env=S(oe.env,!0),oe.execArgv=oe.execArgv||[],oe.cwd=F,oe.silent=!0,G===f.ipc||G===f.stdio){const Z=r.fork(j.module,Y||[],oe);h(Z),this._serverProcess=Z,Z.stderr.on("data",se=>this.outputChannel.append(c.string(se)?se:se.toString(T))),G===f.ipc?(Z.stdout.on("data",se=>this.outputChannel.append(c.string(se)?se:se.toString(T))),ie({reader:new g.IPCMessageReader(this._serverProcess),writer:new g.IPCMessageWriter(this._serverProcess)})):ie({reader:new g.StreamMessageReader(Z.stdout),writer:new g.StreamMessageWriter(Z.stdin)})}else G===f.pipe?(0,g.createClientPipeTransport)(X).then(Z=>{const se=r.fork(j.module,Y||[],oe);h(se),this._serverProcess=se,se.stderr.on("data",re=>this.outputChannel.append(c.string(re)?re:re.toString(T))),se.stdout.on("data",re=>this.outputChannel.append(c.string(re)?re:re.toString(T))),Z.onConnected().then(re=>{ie({reader:re[0],writer:re[1]})},ce)},ce):y.isSocket(G)&&(0,g.createClientSocketTransport)(G.port).then(Z=>{const se=r.fork(j.module,Y||[],oe);h(se),this._serverProcess=se,se.stderr.on("data",re=>this.outputChannel.append(c.string(re)?re:re.toString(T))),se.stdout.on("data",re=>this.outputChannel.append(c.string(re)?re:re.toString(T))),Z.onConnected().then(re=>{ie({reader:re[0],writer:re[1]})},ce)},ce)})}}else if(L.is(W)&&W.command){const j=W,G=W.args!==void 0?W.args.slice(0):[];let X;const ie=W.transport;if(ie===f.stdio)G.push("--stdio");else if(ie===f.pipe)X=(0,g.generateRandomPipeName)(),G.push(`--pipe=${X}`);else if(y.isSocket(ie))G.push(`--socket=${ie.port}`);else if(ie===f.ipc)throw new Error("Transport kind ipc is not support for command executable");const ce=Object.assign({},j.options);if(ce.cwd=ce.cwd||F,ie===void 0||ie===f.stdio){const Y=r.spawn(j.command,G,ce);return!Y||!Y.pid?$(Y,`Launching server using command ${j.command} failed.`):(Y.stderr.on("data",oe=>this.outputChannel.append(c.string(oe)?oe:oe.toString(T))),this._serverProcess=Y,this._isDetached=!!ce.detached,Promise.resolve({reader:new g.StreamMessageReader(Y.stdout),writer:new g.StreamMessageWriter(Y.stdin)}))}else{if(ie===f.pipe)return(0,g.createClientPipeTransport)(X).then(Y=>{const oe=r.spawn(j.command,G,ce);return!oe||!oe.pid?$(oe,`Launching server using command ${j.command} failed.`):(this._serverProcess=oe,this._isDetached=!!ce.detached,oe.stderr.on("data",Z=>this.outputChannel.append(c.string(Z)?Z:Z.toString(T))),oe.stdout.on("data",Z=>this.outputChannel.append(c.string(Z)?Z:Z.toString(T))),Y.onConnected().then(Z=>({reader:Z[0],writer:Z[1]})))});if(y.isSocket(ie))return(0,g.createClientSocketTransport)(ie.port).then(Y=>{const oe=r.spawn(j.command,G,ce);return!oe||!oe.pid?$(oe,`Launching server using command ${j.command} failed.`):(this._serverProcess=oe,this._isDetached=!!ce.detached,oe.stderr.on("data",Z=>this.outputChannel.append(c.string(Z)?Z:Z.toString(T))),oe.stdout.on("data",Z=>this.outputChannel.append(c.string(Z)?Z:Z.toString(T))),Y.onConnected().then(Z=>({reader:Z[0],writer:Z[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(k,null,4)))})}_getRuntimePath(T,S){if(o.isAbsolute(T))return T;const N=this._mainGetRootPath();if(N!==void 0){const O=o.join(N,T);if(i.existsSync(O))return O}if(S!==void 0){const O=o.join(S,T);if(i.existsSync(O))return O}return T}_mainGetRootPath(){let T=a.workspace.workspaceFolders;if(!T||T.length===0)return;let S=T[0];if(S.uri.scheme==="file")return S.uri.fsPath}_getServerWorkingDir(T){let S=T&&T.cwd;return S||(S=this.clientOptions.workspaceFolder?this.clientOptions.workspaceFolder.uri.fsPath:this._mainGetRootPath()),S?new Promise(N=>{i.lstat(S,(O,C)=>{N(!O&&C.isDirectory()?S:void 0)})}):Promise.resolve(void 0)}getLocale(){const T=process.env.VSCODE_NLS_CONFIG;if(T===void 0)return"en";let S;try{S=JSON.parse(T)}catch{}return S===void 0||typeof S.locale!="string"?"en":S.locale}}e.LanguageClient=E;class w{constructor(T,S){this._client=T,this._setting=S,this._listeners=[]}start(){return a.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new a.Disposable(()=>{this._client.needsStop()&&this._client.stop()})}onDidChangeConfiguration(){let T=this._setting.indexOf("."),S=T>=0?this._setting.substr(0,T):this._setting,N=T>=0?this._setting.substr(T+1):void 0,O=N?a.workspace.getConfiguration(S).get(N,!1):a.workspace.getConfiguration(S);O&&this._client.needsStart()?this._client.start().catch(C=>this._client.error("Start failed after configuration change",C,"force")):!O&&this._client.needsStop()&&this._client.stop().catch(C=>this._client.error("Stop failed after configuration change",C,"force"))}}e.SettingMonitor=w;function $(H,T){return H===null?Promise.reject(T):new Promise((S,N)=>{H.on("error",O=>{N(`${T} ${O}`)}),setImmediate(()=>N(T))})}}(Js),function(e){e.exports=Js}(bi);var Us,tu;function yp(){if(tu)return Us;tu=1,Us=r,r.sync=i;var e=Ri.default;function t(o,s){var a=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var c=0;cObject.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),su=(e,t)=>{const n=t.colon||Rp,r=e.match(/\//)||_n&&e.match(/\\/)?[""]:[..._n?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],i=_n?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=_n?i.split(n):[""];return _n&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:r,pathExt:o,pathExtExe:i}},au=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});const{pathEnv:r,pathExt:i,pathExtExe:o}=su(e,t),s=[],a=l=>new Promise((m,g)=>{if(l===r.length)return t.all&&s.length?m(s):g(ou(e));const d=r[l],f=/^".*"$/.test(d)?d.slice(1,-1):d,y=ru.join(f,e),L=!f&&/^\.[\\\/]/.test(e)?e.slice(0,2)+y:y;m(c(L,l,0))}),c=(l,m,g)=>new Promise((d,f)=>{if(g===i.length)return d(a(m+1));const y=i[g];iu(l+y,{pathExt:o},(L,M)=>{if(!L&&M)if(t.all)s.push(l+y);else return d(l+y);return d(c(l,m,g+1))})});return n?a(0).then(l=>n(null,l),n):a(0)},wp=(e,t)=>{t=t||{};const{pathEnv:n,pathExt:r,pathExtExe:i}=su(e,t),o=[];for(let s=0;stypeof g=="string"),m={command:a,args:["lsp","stdio",...l],options:{env:(r=me.workspace.getConfiguration().get("evenBetterToml.taplo.environment"))!=null?r:void 0}};s={run:m,debug:m}}return new bi.exports.LanguageClient("evenBetterToml","Even Better TOML LSP",s,await Pp(e))}async function Pp(e){return await me.workspace.fs.createDirectory(e.globalStorageUri),{documentSelector:[{scheme:"file",language:"toml"},{scheme:"file",language:"cargoLock"}],initializationOptions:{configurationSection:"evenBetterToml",cachePath:e.globalStorageUri.fsPath}}}function Ep(e,t){var n,r;for(const i of me.extensions.all){const o=(r=(n=i.packageJSON)==null?void 0:n.contributes)==null?void 0:r.tomlValidation;if(Array.isArray(o))for(const s of o){if(typeof s!="object")continue;const a=s.url;if(typeof a!="string")continue;let c=s.fileMatch,l=s.regexMatch;Array.isArray(c)||(c=[c]);for(let m of c)typeof m=="string"&&(m.startsWith("/")||(m=`/${m}`),t.sendNotification("taplo/associateSchema",{schemaUri:a,priority:10,rule:{glob:`**${m}`},meta:{source:"extension",extensionId:i.id}}));Array.isArray(l)||(l=[l]);for(const m of l)typeof m=="string"&&t.sendNotification("taplo/associateSchema",{schemaUri:a,priority:10,rule:{regex:m},meta:{source:"extension",extensionId:i.id}})}}}async function kp(e){var t;const n=me.window.createStatusBarItem(me.StatusBarAlignment.Right,0);n.text="no schema selected",n.tooltip="TOML Schema",n.command="evenBetterToml.selectSchema";const r=await Dp(e);await r.start(),((t=me.window.activeTextEditor)==null?void 0:t.document.languageId)==="toml"&&n.show(),Tu(e,r),Ep(e,r),e.subscriptions.push(tn(),n,r.onNotification("taplo/messageWithOutput",async i=>Ru(i,r)),me.window.onDidChangeActiveTextEditor(i=>{i?.document.languageId==="toml"?n.show():n.hide()}),r.onNotification("taplo/didChangeSchemaAssociation",async i=>{var o,s,a,c;const l=(o=me.window.activeTextEditor)==null?void 0:o.document.uri.toString();!l||i.documentUri===l&&(n.text=(c=(a=(s=i.meta)==null?void 0:s.name)!=null?a:i.schemaUri)!=null?c:"no schema selected")}))}exports.activate=kp;