dotfiles/vscode/.vscode/extensions/tamasfe.even-better-toml-0.19.2/dist/browser-extension.js
2024-07-19 18:31:54 -06:00

40 lines
304 KiB
JavaScript

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var is=require("vscode");function ja(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}function Aa(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var he=Aa(is),ne=ja(is);let Xi;function mn(){return Xi||(Xi=he.window.createOutputChannel("Even Better TOML")),Xi}async function Ha(e,t){let n;switch(e.kind){case"info":n=await he.window.showInformationMessage(e.message,"Show Details");case"warn":n=await he.window.showWarningMessage(e.message,"Show Details");case"error":n=await he.window.showErrorMessage(e.message,"Show Details")}n&&t.outputChannel.show()}function $a(e,t){e.subscriptions.push(he.commands.registerTextEditorCommand("evenBetterToml.copyAsJson",async n=>{var i,r;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=mn();if((r=(i=a.error)==null?void 0:i.length)!=null&&r){c.appendLine(`Failed to convert TOML to JSON: ${a.error}`),await he.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 he.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}await he.env.clipboard.writeText(a.text)}catch(d){c.appendLine(`Couldn't write to clipboard: ${d}`),await he.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}await he.window.showInformationMessage("JSON copied!")}),he.commands.registerTextEditorCommand("evenBetterToml.copyAsToml",async n=>{var i,r;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=mn();if((r=(i=a.error)==null?void 0:i.length)!=null&&r){c.appendLine(`Failed to convert JSON to TOML: ${a.error}`),await he.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 he.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}await he.env.clipboard.writeText(a.text)}catch(d){c.appendLine(`Couldn't write to clipboard: ${d}`),await he.window.showErrorMessage("Copying has failed!","Show Details")&&c.show();return}await he.window.showInformationMessage("TOML copied!")}),he.commands.registerTextEditorCommand("evenBetterToml.pasteAsJson",async n=>{var i,r;const o=mn();let s;try{s=await he.env.clipboard.readText()}catch(c){o.appendLine(`Failed to read from clipboard:${c}`),await he.window.showErrorMessage("Paste from clipboard has failed!","Show Details")&&o.show();return}const a=await t.sendRequest("taplo/convertToJson",{text:s});if((r=(i=a.error)==null?void 0:i.length)!=null&&r){o.appendLine(`Failed to convert to JSON: ${a.error}`),await he.window.showErrorMessage("Pasting JSON has failed!","Show Details")&&o.show();return}n.edit(c=>{c.replace(n.selection,a.text)})}),he.commands.registerTextEditorCommand("evenBetterToml.pasteAsToml",async n=>{var i,r;const o=mn();let s;try{s=await he.env.clipboard.readText()}catch(c){o.appendLine(`Failed to read from clipboard:${c}`),await he.window.showErrorMessage("Paste from clipboard has failed!","Show Details")&&o.show();return}const a=await t.sendRequest("taplo/convertToToml",{text:s});if((r=(i=a.error)==null?void 0:i.length)!=null&&r){o.appendLine(`Failed to convert to TOML: ${a.error}`),await he.window.showErrorMessage("Paste from clipboard has failed!","Show Details")&&o.show();return}n.edit(c=>{c.replace(n.selection,a.text)})}))}function Wa(e,t){e.subscriptions.push(he.commands.registerTextEditorCommand("evenBetterToml.selectSchema",async n=>{if(!n)return;const i=await t.sendRequest("taplo/listSchemas",{documentUri:n.document.uri.toString()}),r=await t.sendRequest("taplo/associatedSchema",{documentUri:n.document.uri.toString()}),o=await he.window.showQuickPick(i.schemas.map(s=>{var a,c,d;return{label:(c=(a=s.meta)==null?void 0:a.name)!=null?c:s.url,description:Ua(s.meta),detail:Ka(s.url),picked:((d=r.schema)==null?void 0:d.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 Ua(e){if(typeof e?.description=="string")return e.description}function Ka(e,t){return`${e}`}function za(e,t){$a(e,t),Wa(e,t)}var je=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xa(e){var t=e.default;if(typeof t=="function"){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var _e={};Object.defineProperty(_e,"__esModule",{value:!0}),_e.asPromise=_e.thenable=_e.typedArray=_e.stringArray=_e.array=_e.func=_e.error=_e.number=_e.string=_e.boolean=void 0;function Ba(e){return e===!0||e===!1}_e.boolean=Ba;function rs(e){return typeof e=="string"||e instanceof String}_e.string=rs;function Va(e){return typeof e=="number"||e instanceof Number}_e.number=Va;function Ja(e){return e instanceof Error}_e.error=Ja;function os(e){return typeof e=="function"}_e.func=os;function ss(e){return Array.isArray(e)}_e.array=ss;function Qa(e){return ss(e)&&e.every(t=>rs(t))}_e.stringArray=Qa;function Ga(e,t){return Array.isArray(e)&&e.every(t)}_e.typedArray=Ga;function as(e){return e&&os(e.then)}_e.thenable=as;function Xa(e){return e instanceof Promise?e:as(e)?new Promise((t,n)=>{e.then(i=>t(i),i=>n(i))}):Promise.resolve(e)}_e.asPromise=Xa;var cs={},re={},Yi={exports:{}},Mt={},Zi={},wt={};Object.defineProperty(wt,"__esModule",{value:!0});let er;function tr(){if(er===void 0)throw new Error("No runtime abstraction layer installed");return er}(function(e){function t(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");er=n}e.install=t})(tr||(tr={})),wt.default=tr;var nr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Disposable=void 0,function(t){function n(i){return{dispose:i}}t.create=n}(e.Disposable||(e.Disposable={}))})(nr);var Lt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;const t=wt;(function(r){const o={dispose(){}};r.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,d=this._callbacks.length;c<d;c++)if(this._callbacks[c]===o)if(this._contexts[c]===s){this._callbacks.splice(c,1),this._contexts.splice(c,1);return}else a=!0;if(a)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...o){if(!this._callbacks)return[];const s=[],a=this._callbacks.slice(0),c=this._contexts.slice(0);for(let d=0,m=a.length;d<m;d++)try{s.push(a[d].apply(c[d],o))}catch(g){(0,t.default)().console.error(g)}return s}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class i{constructor(o){this._options=o}get event(){return this._event||(this._event=(o,s,a)=>{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=i._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=i,i._noop=function(){}})(Lt);var zn={};Object.defineProperty(zn,"__esModule",{value:!0}),zn.AbstractMessageBuffer=void 0;const Ya=13,Za=10,ec=`\r
`;class tc{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,i=0,r=0;e:for(;n<this._chunks.length;){const c=this._chunks[n];for(i=0;i<c.length;){switch(c[i]){case Ya:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case Za:switch(t){case 1:t=2;break;case 3:t=4,i++;break e;default:t=0}break;default:t=0}i++}r+=c.byteLength,n++}if(t!==4)return;const o=this._read(r+i),s=new Map,a=this.toString(o,"ascii").split(ec);if(a.length<2)return s;for(let c=0;c<a.length-2;c++){const d=a[c],m=d.indexOf(":");if(m===-1)throw new Error("Message header must separate key and value using :");const g=d.substr(0,m),l=d.substr(m+1).trim();s.set(g,l)}return s}tryReadBody(t){if(!(this._totalLength<t))return this._read(t)}get numberOfBytes(){return this._totalLength}_read(t){if(t===0)return this.emptyBuffer();if(t>this._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 i=0,r=0;for(;t>0;){const o=this._chunks[r];if(o.byteLength>t){const s=o.slice(0,t);n.set(s,i),i+=t,this._chunks[r]=o.slice(t),this._totalLength-=t,t-=t}else n.set(o,i),i+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,t-=o.byteLength}return n}}zn.AbstractMessageBuffer=tc,Object.defineProperty(Zi,"__esModule",{value:!0});const us=wt,Qt=nr,nc=Lt,ic=zn;class Qi extends ic.AbstractMessageBuffer{constructor(t="utf-8"){super(t),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return Qi.emptyBuffer}fromString(t,n){return new TextEncoder().encode(t)}toString(t,n){return n==="ascii"?this.asciiDecoder.decode(t):new TextDecoder(n).decode(t)}asNative(t,n){return n===void 0?t:t.slice(0,n)}allocNative(t){return new Uint8Array(t)}}Qi.emptyBuffer=new Uint8Array(0);class rc{constructor(t){this.socket=t,this._onData=new nc.Emitter,this._messageListener=n=>{n.data.arrayBuffer().then(r=>{this._onData.fire(new Uint8Array(r))},()=>{(0,us.default)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(t){return this.socket.addEventListener("close",t),Qt.Disposable.create(()=>this.socket.removeEventListener("close",t))}onError(t){return this.socket.addEventListener("error",t),Qt.Disposable.create(()=>this.socket.removeEventListener("error",t))}onEnd(t){return this.socket.addEventListener("end",t),Qt.Disposable.create(()=>this.socket.removeEventListener("end",t))}onData(t){return this._onData.event(t)}}class oc{constructor(t){this.socket=t}onClose(t){return this.socket.addEventListener("close",t),Qt.Disposable.create(()=>this.socket.removeEventListener("close",t))}onError(t){return this.socket.addEventListener("error",t),Qt.Disposable.create(()=>this.socket.removeEventListener("error",t))}onEnd(t){return this.socket.addEventListener("end",t),Qt.Disposable.create(()=>this.socket.removeEventListener("end",t))}write(t,n){if(typeof t=="string"){if(n!==void 0&&n!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${n}`);this.socket.send(t)}else this.socket.send(t);return Promise.resolve()}end(){this.socket.close()}}const sc=new TextEncoder,ds=Object.freeze({messageBuffer:Object.freeze({create:e=>new Qi(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{if(t.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t.charset}`);return Promise.resolve(sc.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{if(!(e instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new rc(e),asWritableStream:e=>new oc(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){const i=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(i)}},setImmediate(e,...t){const n=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(n)}},setInterval(e,t,...n){const i=setInterval(e,t,...n);return{dispose:()=>clearInterval(i)}}})});function ir(){return ds}(function(e){function t(){us.default.install(ds)}e.install=t})(ir||(ir={})),Zi.default=ir;var rr={},or={},Be={},ls;function yn(){if(ls)return Be;ls=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.stringArray=Be.array=Be.func=Be.error=Be.number=Be.string=Be.boolean=void 0;function e(a){return a===!0||a===!1}Be.boolean=e;function t(a){return typeof a=="string"||a instanceof String}Be.string=t;function n(a){return typeof a=="number"||a instanceof Number}Be.number=n;function i(a){return a instanceof Error}Be.error=i;function r(a){return typeof a=="function"}Be.func=r;function o(a){return Array.isArray(a)}Be.array=o;function s(a){return o(a)&&a.every(c=>t(c))}return Be.stringArray=s,Be}var fs;function hs(){return fs||(fs=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=yn();var n;(function(p){p.ParseError=-32700,p.InvalidRequest=-32600,p.MethodNotFound=-32601,p.InvalidParams=-32602,p.InternalError=-32603,p.jsonrpcReservedErrorRangeStart=-32099,p.serverErrorStart=-32099,p.MessageWriteError=-32099,p.MessageReadError=-32098,p.PendingResponseRejected=-32097,p.ConnectionInactive=-32096,p.ServerNotInitialized=-32002,p.UnknownErrorCode=-32001,p.jsonrpcReservedErrorRangeEnd=-32e3,p.serverErrorEnd=-32e3})(n=e.ErrorCodes||(e.ErrorCodes={}));class i extends Error{constructor(M,Y,O){super(Y),this.code=t.number(M)?M:n.UnknownErrorCode,this.data=O,Object.setPrototypeOf(this,i.prototype)}toJson(){const M={code:this.code,message:this.message};return this.data!==void 0&&(M.data=this.data),M}}e.ResponseError=i;class r{constructor(M){this.kind=M}static is(M){return M===r.auto||M===r.byName||M===r.byPosition}toString(){return this.kind}}e.ParameterStructures=r,r.auto=new r("auto"),r.byPosition=new r("byPosition"),r.byName=new r("byName");class o{constructor(M,Y){this.method=M,this.numberOfParams=Y}get parameterStructures(){return r.auto}}e.AbstractMessageSignature=o;class s extends o{constructor(M){super(M,0)}}e.RequestType0=s;class a extends o{constructor(M,Y=r.auto){super(M,1),this._parameterStructures=Y}get parameterStructures(){return this._parameterStructures}}e.RequestType=a;class c extends o{constructor(M,Y=r.auto){super(M,1),this._parameterStructures=Y}get parameterStructures(){return this._parameterStructures}}e.RequestType1=c;class d extends o{constructor(M){super(M,2)}}e.RequestType2=d;class m extends o{constructor(M){super(M,3)}}e.RequestType3=m;class g extends o{constructor(M){super(M,4)}}e.RequestType4=g;class l extends o{constructor(M){super(M,5)}}e.RequestType5=l;class h extends o{constructor(M){super(M,6)}}e.RequestType6=h;class y extends o{constructor(M){super(M,7)}}e.RequestType7=y;class P extends o{constructor(M){super(M,8)}}e.RequestType8=P;class I extends o{constructor(M){super(M,9)}}e.RequestType9=I;class N extends o{constructor(M,Y=r.auto){super(M,1),this._parameterStructures=Y}get parameterStructures(){return this._parameterStructures}}e.NotificationType=N;class w extends o{constructor(M){super(M,0)}}e.NotificationType0=w;class S extends o{constructor(M,Y=r.auto){super(M,1),this._parameterStructures=Y}get parameterStructures(){return this._parameterStructures}}e.NotificationType1=S;class j extends o{constructor(M){super(M,2)}}e.NotificationType2=j;class A extends o{constructor(M){super(M,3)}}e.NotificationType3=A;class G extends o{constructor(M){super(M,4)}}e.NotificationType4=G;class V extends o{constructor(M){super(M,5)}}e.NotificationType5=V;class k extends o{constructor(M){super(M,6)}}e.NotificationType6=k;class K extends o{constructor(M){super(M,7)}}e.NotificationType7=K;class W extends o{constructor(M){super(M,8)}}e.NotificationType8=W;class U extends o{constructor(M){super(M,9)}}e.NotificationType9=U,function(p){function M(x){const Z=x;return Z&&t.string(Z.method)&&(t.string(Z.id)||t.number(Z.id))}p.isRequest=M;function Y(x){const Z=x;return Z&&t.string(Z.method)&&x.id===void 0}p.isNotification=Y;function O(x){const Z=x;return Z&&(Z.result!==void 0||!!Z.error)&&(t.string(Z.id)||t.number(Z.id)||Z.id===null)}p.isResponse=O}(e.Message||(e.Message={}))}(or)),or}var sr={},gs;function ps(){return gs||(gs=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 i{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 d=this._map.get(s);if(d)d.value=a,c!==n.None&&this.touch(d,c);else{switch(d={key:s,value:a,next:void 0,previous:void 0},c){case n.None:this.addItemLast(d);break;case n.First:this.addItemFirst(d);break;case n.Last:this.addItemLast(d);break;default:this.addItemLast(d);break}this._map.set(s,d),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 d=this._head;for(;d;){if(a?s.bind(a)(d.value,d.key,this):s(d.value,d.key,this),this._state!==c)throw new Error("LinkedMap got modified during iteration.");d=d.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 d={value:a.key,done:!1};return a=a.next,d}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 d={value:a.value,done:!1};return a=a.next,d}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 d={value:[a.key,a.value],done:!1};return a=a.next,d}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,d=s.previous;s===this._tail?(d.next=void 0,this._tail=d):(c.previous=d,d.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,d=s.previous;s===this._head?(c.previous=void 0,this._head=c):(c.previous=d,d.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=i;class r extends i{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=r}(sr)),sr}var ar={},ms;function ys(){return ms||(ms=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;const t=wt,n=yn(),i=Lt;var r;(function(c){c.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:i.Event.None}),c.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:i.Event.None});function d(m){const g=m;return g&&(g===c.None||g===c.Cancelled||n.boolean(g.isCancellationRequested)&&!!g.onCancellationRequested)}c.is=d})(r=e.CancellationToken||(e.CancellationToken={}));const o=Object.freeze(function(c,d){const m=(0,t.default)().timer.setTimeout(c.bind(d),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 i.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=r.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=r.None}}e.CancellationTokenSource=a}(ar)),ar}var cr={},vs;function ac(){return vs||(vs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;const t=wt,n=yn(),i=Lt;(function(a){function c(d){let m=d;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 r{constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter,this.partialMessageEmitter=new i.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=r;var o;(function(a){function c(d){let m,g;const l=new Map;let h;const y=new Map;if(d===void 0||typeof d=="string")m=d??"utf-8";else{if(m=d.charset??"utf-8",d.contentDecoder!==void 0&&(g=d.contentDecoder,l.set(g.name,g)),d.contentDecoders!==void 0)for(const P of d.contentDecoders)l.set(P.name,P);if(d.contentTypeDecoder!==void 0&&(h=d.contentTypeDecoder,y.set(h.name,h)),d.contentTypeDecoders!==void 0)for(const P of d.contentTypeDecoders)y.set(P.name,P)}return h===void 0&&(h=(0,t.default)().applicationJson.decoder,y.set(h.name,h)),{charset:m,contentDecoder:g,contentDecoders:l,contentTypeDecoder:h,contentTypeDecoders:y}}a.fromOptions=c})(o||(o={}));class s extends r{constructor(c,d){super(),this.readable=c,this.options=o.fromOptions(d),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 d=this.readable.onData(m=>{this.onData(m)});return this.readable.onError(m=>this.fireError(m)),this.readable.onClose(()=>this.fireClose()),d}onData(c){for(this.buffer.append(c);;){if(this.nextMessageLength===-1){const g=this.buffer.tryReadHeaders();if(!g)return;const l=g.get("Content-Length");if(!l)throw new Error("Header must provide a Content-Length property.");const h=parseInt(l);if(isNaN(h))throw new Error("Content-Length value must be a number.");this.nextMessageLength=h}const d=this.buffer.tryReadBody(this.nextMessageLength);if(d===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1;let m;this.options.contentDecoder!==void 0?m=this.options.contentDecoder.decode(d):m=Promise.resolve(d),m.then(g=>{this.options.contentTypeDecoder.decode(g,this.options).then(l=>{this.callback(l)},l=>{this.fireError(l)})},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,d)=>{this.partialMessageTimer=void 0,c===this.messageToken&&(this.firePartialMessage({messageToken:c,waitingTime:d}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}e.ReadableStreamMessageReader=s}(cr)),cr}var ur={},vn={},Cs;function cc(){if(Cs)return vn;Cs=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.Semaphore=void 0;const e=wt;class t{constructor(i=1){if(i<=0)throw new Error("Capacity must be greater than 0");this._capacity=i,this._active=0,this._waiting=[]}lock(i){return new Promise((r,o)=>{this._waiting.push({thunk:i,resolve:r,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 i=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const r=i.thunk();r instanceof Promise?r.then(o=>{this._active--,i.resolve(o),this.runNext()},o=>{this._active--,i.reject(o),this.runNext()}):(this._active--,i.resolve(r),this.runNext())}catch(r){this._active--,i.reject(r),this.runNext()}}}return vn.Semaphore=t,vn}var _s;function uc(){return _s||(_s=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;const t=wt,n=yn(),i=cc(),r=Lt,o="Content-Length: ",s=`\r
`;(function(m){function g(l){let h=l;return h&&n.func(h.dispose)&&n.func(h.onClose)&&n.func(h.onError)&&n.func(h.write)}m.is=g})(e.MessageWriter||(e.MessageWriter={}));class a{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(g,l,h){this.errorEmitter.fire([this.asError(g),l,h])}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(l){return l===void 0||typeof l=="string"?{charset:l??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:l.charset??"utf-8",contentEncoder:l.contentEncoder,contentTypeEncoder:l.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}m.fromOptions=g})(c||(c={}));class d extends a{constructor(g,l){super(),this.writable=g,this.options=c.fromOptions(l),this.errorCount=0,this.writeSemaphore=new i.Semaphore(1),this.writable.onError(h=>this.fireError(h)),this.writable.onClose(()=>this.fireClose())}async write(g){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(g,this.options).then(h=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(h):h).then(h=>{const y=[];return y.push(o,h.byteLength.toString(),s),y.push(s),this.doWrite(g,y,h)},h=>{throw this.fireError(h),h}))}async doWrite(g,l,h){try{return await this.writable.write(l.join(""),"ascii"),this.writable.write(h)}catch(y){return this.handleError(y,g),Promise.reject(y)}}handleError(g,l){this.errorCount++,this.fireError(g,l,this.errorCount)}end(){this.writable.end()}}e.WriteableStreamMessageWriter=d}(ur)),ur}var dr={},bs;function dc(){return bs||(bs=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=wt,n=yn(),i=hs(),r=ps(),o=Lt,s=ys();var a;(function(k){k.type=new i.NotificationType("$/cancelRequest")})(a||(a={}));var c;(function(k){function K(W){return typeof W=="string"||typeof W=="number"}k.is=K})(c=e.ProgressToken||(e.ProgressToken={}));var d;(function(k){k.type=new i.NotificationType("$/progress")})(d||(d={}));class m{constructor(){}}e.ProgressType=m;var g;(function(k){function K(W){return n.func(W)}k.is=K})(g||(g={})),e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var l;(function(k){k[k.Off=0]="Off",k[k.Messages=1]="Messages",k[k.Compact=2]="Compact",k[k.Verbose=3]="Verbose"})(l=e.Trace||(e.Trace={})),function(k){k.Off="off",k.Messages="messages",k.Compact="compact",k.Verbose="verbose"}(e.TraceValues||(e.TraceValues={})),function(k){function K(U){if(!n.string(U))return k.Off;switch(U=U.toLowerCase(),U){case"off":return k.Off;case"messages":return k.Messages;case"compact":return k.Compact;case"verbose":return k.Verbose;default:return k.Off}}k.fromString=K;function W(U){switch(U){case k.Off:return"off";case k.Messages:return"messages";case k.Compact:return"compact";case k.Verbose:return"verbose";default:return"off"}}k.toString=W}(l=e.Trace||(e.Trace={}));var h;(function(k){k.Text="text",k.JSON="json"})(h=e.TraceFormat||(e.TraceFormat={})),function(k){function K(W){return n.string(W)?(W=W.toLowerCase(),W==="json"?k.JSON:k.Text):k.Text}k.fromString=K}(h=e.TraceFormat||(e.TraceFormat={}));var y;(function(k){k.type=new i.NotificationType("$/setTrace")})(y=e.SetTraceNotification||(e.SetTraceNotification={}));var P;(function(k){k.type=new i.NotificationType("$/logTrace")})(P=e.LogTraceNotification||(e.LogTraceNotification={}));var I;(function(k){k[k.Closed=1]="Closed",k[k.Disposed=2]="Disposed",k[k.AlreadyListening=3]="AlreadyListening"})(I=e.ConnectionErrors||(e.ConnectionErrors={}));class N extends Error{constructor(K,W){super(W),this.code=K,Object.setPrototypeOf(this,N.prototype)}}e.ConnectionError=N;var w;(function(k){function K(W){const U=W;return U&&n.func(U.cancelUndispatched)}k.is=K})(w=e.ConnectionStrategy||(e.ConnectionStrategy={}));var S;(function(k){k.Message=Object.freeze({createCancellationTokenSource(W){return new s.CancellationTokenSource}});function K(W){const U=W;return U&&n.func(U.createCancellationTokenSource)}k.is=K})(S=e.CancellationReceiverStrategy||(e.CancellationReceiverStrategy={}));var j;(function(k){k.Message=Object.freeze({sendCancellation(W,U){return W.sendNotification(a.type,{id:U})},cleanup(W){}});function K(W){const U=W;return U&&n.func(U.sendCancellation)&&n.func(U.cleanup)}k.is=K})(j=e.CancellationSenderStrategy||(e.CancellationSenderStrategy={}));var A;(function(k){k.Message=Object.freeze({receiver:S.Message,sender:j.Message});function K(W){const U=W;return U&&S.is(U.receiver)&&j.is(U.sender)}k.is=K})(A=e.CancellationStrategy||(e.CancellationStrategy={})),function(k){function K(W){const U=W;return U&&(A.is(U.cancellationStrategy)||w.is(U.connectionStrategy))}k.is=K}(e.ConnectionOptions||(e.ConnectionOptions={}));var G;(function(k){k[k.New=1]="New",k[k.Listening=2]="Listening",k[k.Closed=3]="Closed",k[k.Disposed=4]="Disposed"})(G||(G={}));function V(k,K,W,U){const p=W!==void 0?W:e.NullLogger;let M=0,Y=0,O=0;const x="2.0";let Z;const Ce=new Map;let Me;const Ge=new Map,et=new Map;let He,Ue=new r.LinkedMap,rt=new Map,gt=new Set,Ke=new Map,ge=l.Off,ze=h.Text,we,Ie=G.New;const ut=new o.Emitter,ot=new o.Emitter,ie=new o.Emitter,Xe=new o.Emitter,vt=new o.Emitter,pt=U&&U.cancellationStrategy?U.cancellationStrategy:A.Message;function Ye(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 X(v){return v===null?"res-unknown-"+(++O).toString():"res-"+v.toString()}function C(){return"not-"+(++Y).toString()}function R(v,q){i.Message.isRequest(q)?v.set(Ye(q.id),q):i.Message.isResponse(q)?v.set(X(q.id),q):v.set(C(),q)}function b(v){}function L(){return Ie===G.Listening}function E(){return Ie===G.Closed}function H(){return Ie===G.Disposed}function ee(){(Ie===G.New||Ie===G.Listening)&&(Ie=G.Closed,ot.fire(void 0))}function ue(v){ut.fire([v,void 0,void 0])}function De(v){ut.fire(v)}k.onClose(ee),k.onError(ue),K.onClose(ee),K.onError(De);function ke(){He||Ue.size===0||(He=(0,t.default)().timer.setImmediate(()=>{He=void 0,Ct()}))}function Ct(){if(Ue.size===0)return;const v=Ue.shift();try{i.Message.isRequest(v)?ln(v):i.Message.isNotification(v)?Vt(v):i.Message.isResponse(v)?Bt(v):fn(v)}finally{ke()}}const Ft=v=>{try{if(i.Message.isNotification(v)&&v.method===a.type.method){const q=v.params.id,$=Ye(q),Q=Ue.get($);if(i.Message.isRequest(Q)){const Te=U?.connectionStrategy,qe=Te&&Te.cancelUndispatched?Te.cancelUndispatched(Q,b):void 0;if(qe&&(qe.error!==void 0||qe.result!==void 0)){Ue.delete($),Ke.delete(q),qe.id=Q.id,_t(qe,v.method,Date.now()),K.write(qe).catch(()=>p.error("Sending response for canceled message failed."));return}}const Se=Ke.get(q);if(Se!==void 0){Se.cancel(),T(v);return}else gt.add(q)}R(Ue,v)}finally{ke()}};function ln(v){if(H())return;function q(le,Fe,ve){const u={jsonrpc:x,id:v.id};le instanceof i.ResponseError?u.error=le.toJson():u.result=le===void 0?null:le,_t(u,Fe,ve),K.write(u).catch(()=>p.error("Sending response failed."))}function $(le,Fe,ve){const u={jsonrpc:x,id:v.id,error:le.toJson()};_t(u,Fe,ve),K.write(u).catch(()=>p.error("Sending response failed."))}function Q(le,Fe,ve){le===void 0&&(le=null);const u={jsonrpc:x,id:v.id,result:le};_t(u,Fe,ve),K.write(u).catch(()=>p.error("Sending response failed."))}f(v);const Se=Ce.get(v.method);let Te,qe;Se&&(Te=Se.type,qe=Se.handler);const Le=Date.now();if(qe||Z){const le=v.id??String(Date.now()),Fe=pt.receiver.createCancellationTokenSource(le);v.id!==null&&gt.has(v.id)&&Fe.cancel(),v.id!==null&&Ke.set(le,Fe);try{let ve;if(qe)if(v.params===void 0){if(Te!==void 0&&Te.numberOfParams!==0){$(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${v.method} defines ${Te.numberOfParams} params but received none.`),v.method,Le);return}ve=qe(Fe.token)}else if(Array.isArray(v.params)){if(Te!==void 0&&Te.parameterStructures===i.ParameterStructures.byName){$(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${v.method} defines parameters by name but received parameters by position`),v.method,Le);return}ve=qe(...v.params,Fe.token)}else{if(Te!==void 0&&Te.parameterStructures===i.ParameterStructures.byPosition){$(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${v.method} defines parameters by position but received parameters by name`),v.method,Le);return}ve=qe(v.params,Fe.token)}else Z&&(ve=Z(v.method,v.params,Fe.token));const u=ve;ve?u.then?u.then(_=>{Ke.delete(le),q(_,v.method,Le)},_=>{Ke.delete(le),_ instanceof i.ResponseError?$(_,v.method,Le):_&&n.string(_.message)?$(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${v.method} failed with message: ${_.message}`),v.method,Le):$(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${v.method} failed unexpectedly without providing any details.`),v.method,Le)}):(Ke.delete(le),q(ve,v.method,Le)):(Ke.delete(le),Q(ve,v.method,Le))}catch(ve){Ke.delete(le),ve instanceof i.ResponseError?q(ve,v.method,Le):ve&&n.string(ve.message)?$(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${v.method} failed with message: ${ve.message}`),v.method,Le):$(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${v.method} failed unexpectedly without providing any details.`),v.method,Le)}}else $(new i.ResponseError(i.ErrorCodes.MethodNotFound,`Unhandled method ${v.method}`),v.method,Le)}function Bt(v){if(!H())if(v.id===null)v.error?p.error(`Received response message without id: Error is:
${JSON.stringify(v.error,void 0,4)}`):p.error("Received response message without id. No further error information provided.");else{const q=v.id,$=rt.get(q);if(J(v,$),$!==void 0){rt.delete(q);try{if(v.error){const Q=v.error;$.reject(new i.ResponseError(Q.code,Q.message,Q.data))}else if(v.result!==void 0)$.resolve(v.result);else throw new Error("Should never happen.")}catch(Q){Q.message?p.error(`Response handler '${$.method}' failed with message: ${Q.message}`):p.error(`Response handler '${$.method}' failed unexpectedly.`)}}}}function Vt(v){if(H())return;let q,$;if(v.method===a.type.method){const Q=v.params.id;gt.delete(Q),T(v);return}else{const Q=Ge.get(v.method);Q&&($=Q.handler,q=Q.type)}if($||Me)try{if(T(v),$)if(v.params===void 0)q!==void 0&&q.numberOfParams!==0&&q.parameterStructures!==i.ParameterStructures.byName&&p.error(`Notification ${v.method} defines ${q.numberOfParams} params but received none.`),$();else if(Array.isArray(v.params)){const Q=v.params;v.method===d.type.method&&Q.length===2&&c.is(Q[0])?$({token:Q[0],value:Q[1]}):(q!==void 0&&(q.parameterStructures===i.ParameterStructures.byName&&p.error(`Notification ${v.method} defines parameters by name but received parameters by position`),q.numberOfParams!==v.params.length&&p.error(`Notification ${v.method} defines ${q.numberOfParams} params but received ${Q.length} arguments`)),$(...Q))}else q!==void 0&&q.parameterStructures===i.ParameterStructures.byPosition&&p.error(`Notification ${v.method} defines parameters by position but received parameters by name`),$(v.params);else Me&&Me(v.method,v.params)}catch(Q){Q.message?p.error(`Notification handler '${v.method}' failed with message: ${Q.message}`):p.error(`Notification handler '${v.method}' failed unexpectedly.`)}else ie.fire(v)}function fn(v){if(!v){p.error("Received empty message.");return}p.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(v,null,4)}`);const q=v;if(n.string(q.id)||n.number(q.id)){const $=q.id,Q=rt.get($);Q&&Q.reject(new Error("The received response has neither a result nor an error property."))}}function st(v){if(v!=null)switch(ge){case l.Verbose:return JSON.stringify(v,null,4);case l.Compact:return JSON.stringify(v);default:return}}function hn(v){if(!(ge===l.Off||!we))if(ze===h.Text){let q;(ge===l.Verbose||ge===l.Compact)&&v.params&&(q=`Params: ${st(v.params)}
`),we.log(`Sending request '${v.method} - (${v.id})'.`,q)}else de("send-request",v)}function Jt(v){if(!(ge===l.Off||!we))if(ze===h.Text){let q;(ge===l.Verbose||ge===l.Compact)&&(v.params?q=`Params: ${st(v.params)}
`:q=`No parameters provided.
`),we.log(`Sending notification '${v.method}'.`,q)}else de("send-notification",v)}function _t(v,q,$){if(!(ge===l.Off||!we))if(ze===h.Text){let Q;(ge===l.Verbose||ge===l.Compact)&&(v.error&&v.error.data?Q=`Error data: ${st(v.error.data)}
`:v.result?Q=`Result: ${st(v.result)}
`:v.error===void 0&&(Q=`No result returned.
`)),we.log(`Sending response '${q} - (${v.id})'. Processing request took ${Date.now()-$}ms`,Q)}else de("send-response",v)}function f(v){if(!(ge===l.Off||!we))if(ze===h.Text){let q;(ge===l.Verbose||ge===l.Compact)&&v.params&&(q=`Params: ${st(v.params)}
`),we.log(`Received request '${v.method} - (${v.id})'.`,q)}else de("receive-request",v)}function T(v){if(!(ge===l.Off||!we||v.method===P.type.method))if(ze===h.Text){let q;(ge===l.Verbose||ge===l.Compact)&&(v.params?q=`Params: ${st(v.params)}
`:q=`No parameters provided.
`),we.log(`Received notification '${v.method}'.`,q)}else de("receive-notification",v)}function J(v,q){if(!(ge===l.Off||!we))if(ze===h.Text){let $;if((ge===l.Verbose||ge===l.Compact)&&(v.error&&v.error.data?$=`Error data: ${st(v.error.data)}
`:v.result?$=`Result: ${st(v.result)}
`:v.error===void 0&&($=`No result returned.
`)),q){const Q=v.error?` Request failed: ${v.error.message} (${v.error.code}).`:"";we.log(`Received response '${q.method} - (${v.id})' in ${Date.now()-q.timerStart}ms.${Q}`,$)}else we.log(`Received response ${v.id} without active response promise.`,$)}else de("receive-response",v)}function de(v,q){if(!we||ge===l.Off)return;const $={isLSPMessage:!0,type:v,message:q,timestamp:Date.now()};we.log($)}function ce(){if(E())throw new N(I.Closed,"Connection is closed.");if(H())throw new N(I.Disposed,"Connection is disposed.")}function $e(){if(L())throw new N(I.AlreadyListening,"Connection is already listening")}function mt(){if(!L())throw new Error("Call listen() first.")}function yt(v){return v===void 0?null:v}function Un(v){if(v!==null)return v}function It(v){return v!=null&&!Array.isArray(v)&&typeof v=="object"}function gn(v,q){switch(v){case i.ParameterStructures.auto:return It(q)?Un(q):[yt(q)];case i.ParameterStructures.byName:if(!It(q))throw new Error("Received parameters by name but param is not an object literal.");return Un(q);case i.ParameterStructures.byPosition:return[yt(q)];default:throw new Error(`Unknown parameter structure ${v.toString()}`)}}function pn(v,q){let $;const Q=v.numberOfParams;switch(Q){case 0:$=void 0;break;case 1:$=gn(v.parameterStructures,q[0]);break;default:$=[];for(let Se=0;Se<q.length&&Se<Q;Se++)$.push(yt(q[Se]));if(q.length<Q)for(let Se=q.length;Se<Q;Se++)$.push(null);break}return $}const qt={sendNotification:(v,...q)=>{ce();let $,Q;if(n.string(v)){$=v;const Te=q[0];let qe=0,Le=i.ParameterStructures.auto;i.ParameterStructures.is(Te)&&(qe=1,Le=Te);let le=q.length;const Fe=le-qe;switch(Fe){case 0:Q=void 0;break;case 1:Q=gn(Le,q[qe]);break;default:if(Le===i.ParameterStructures.byName)throw new Error(`Received ${Fe} parameters for 'by Name' notification parameter structure.`);Q=q.slice(qe,le).map(ve=>yt(ve));break}}else{const Te=q;$=v.method,Q=pn(v,Te)}const Se={jsonrpc:x,method:$,params:Q};return Jt(Se),K.write(Se).catch(()=>p.error("Sending notification failed."))},onNotification:(v,q)=>{ce();let $;return n.func(v)?Me=v:q&&(n.string(v)?($=v,Ge.set(v,{type:void 0,handler:q})):($=v.method,Ge.set(v.method,{type:v,handler:q}))),{dispose:()=>{$!==void 0?Ge.delete($):Me=void 0}}},onProgress:(v,q,$)=>{if(et.has(q))throw new Error(`Progress handler for token ${q} already registered`);return et.set(q,$),{dispose:()=>{et.delete(q)}}},sendProgress:(v,q,$)=>qt.sendNotification(d.type,{token:q,value:$}),onUnhandledProgress:Xe.event,sendRequest:(v,...q)=>{ce(),mt();let $,Q,Se;if(n.string(v)){$=v;const le=q[0],Fe=q[q.length-1];let ve=0,u=i.ParameterStructures.auto;i.ParameterStructures.is(le)&&(ve=1,u=le);let _=q.length;s.CancellationToken.is(Fe)&&(_=_-1,Se=Fe);const F=_-ve;switch(F){case 0:Q=void 0;break;case 1:Q=gn(u,q[ve]);break;default:if(u===i.ParameterStructures.byName)throw new Error(`Received ${F} parameters for 'by Name' request parameter structure.`);Q=q.slice(ve,_).map(B=>yt(B));break}}else{const le=q;$=v.method,Q=pn(v,le);const Fe=v.numberOfParams;Se=s.CancellationToken.is(le[Fe])?le[Fe]:void 0}const Te=M++;let qe;return Se&&(qe=Se.onCancellationRequested(()=>{const le=pt.sender.sendCancellation(qt,Te);return le===void 0?(p.log(`Received no promise from cancellation strategy when cancelling id ${Te}`),Promise.resolve()):le.catch(()=>{p.log(`Sending cancellation messages for id ${Te} failed`)})})),new Promise((le,Fe)=>{const ve={jsonrpc:x,id:Te,method:$,params:Q},u=B=>{le(B),pt.sender.cleanup(Te),qe?.dispose()},_=B=>{Fe(B),pt.sender.cleanup(Te),qe?.dispose()};let F={method:$,timerStart:Date.now(),resolve:u,reject:_};hn(ve);try{K.write(ve).catch(()=>p.error("Sending request failed."))}catch(B){F.reject(new i.ResponseError(i.ErrorCodes.MessageWriteError,B.message?B.message:"Unknown reason")),F=null}F&&rt.set(Te,F)})},onRequest:(v,q)=>{ce();let $=null;return g.is(v)?($=void 0,Z=v):n.string(v)?($=null,q!==void 0&&($=v,Ce.set(v,{handler:q,type:void 0}))):q!==void 0&&($=v.method,Ce.set(v.method,{type:v,handler:q})),{dispose:()=>{$!==null&&($!==void 0?Ce.delete($):Z=void 0)}}},hasPendingResponse:()=>rt.size>0,trace:async(v,q,$)=>{let Q=!1,Se=h.Text;$!==void 0&&(n.boolean($)?Q=$:(Q=$.sendNotification||!1,Se=$.traceFormat||h.Text)),ge=v,ze=Se,ge===l.Off?we=void 0:we=q,Q&&!E()&&!H()&&await qt.sendNotification(y.type,{value:l.toString(v)})},onError:ut.event,onClose:ot.event,onUnhandledNotification:ie.event,onDispose:vt.event,end:()=>{K.end()},dispose:()=>{if(H())return;Ie=G.Disposed,vt.fire(void 0);const v=new i.ResponseError(i.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const q of rt.values())q.reject(v);rt=new Map,Ke=new Map,gt=new Set,Ue=new r.LinkedMap,n.func(K.dispose)&&K.dispose(),n.func(k.dispose)&&k.dispose()},listen:()=>{ce(),$e(),Ie=G.Listening,k.listen(Ft)},inspect:()=>{(0,t.default)().console.log("inspect")}};return qt.onNotification(P.type,v=>{if(ge===l.Off||!we)return;const q=ge===l.Verbose||ge===l.Compact;we.log(v.message,q?v.verbose:void 0)}),qt.onNotification(d.type,v=>{const q=et.get(v.token);q?q(v.value):Xe.fire(v)}),qt}e.createMessageConnection=V}(dr)),dr}var ws;function Rs(){return ws||(ws=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=hs();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=ps();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 i=nr;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return i.Disposable}});const r=Lt;Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return r.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return r.Emitter}});const o=ys();Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:function(){return o.CancellationTokenSource}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return o.CancellationToken}});const s=ac();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=uc();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=dc();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 d=wt;e.RAL=d.default}(rr)),rr}(function(e){var t=je&&je.__createBinding||(Object.create?function(c,d,m,g){g===void 0&&(g=m);var l=Object.getOwnPropertyDescriptor(d,m);(!l||("get"in l?!d.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return d[m]}}),Object.defineProperty(c,g,l)}:function(c,d,m,g){g===void 0&&(g=m),c[g]=d[m]}),n=je&&je.__exportStar||function(c,d){for(var m in c)m!=="default"&&!Object.prototype.hasOwnProperty.call(d,m)&&t(d,c,m)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.BrowserMessageWriter=e.BrowserMessageReader=void 0,Zi.default.install();const r=Rs();n(Rs(),e);class o extends r.AbstractMessageReader{constructor(d){super(),this._onData=new r.Emitter,this._messageListener=m=>{this._onData.fire(m.data)},d.addEventListener("error",m=>this.fireError(m)),d.onmessage=this._messageListener}listen(d){return this._onData.event(d)}}e.BrowserMessageReader=o;class s extends r.AbstractMessageWriter{constructor(d){super(),this.context=d,this.errorCount=0,d.addEventListener("error",m=>this.fireError(m))}write(d){try{return this.context.postMessage(d),Promise.resolve()}catch(m){return this.handleError(m,d),Promise.reject(m)}}handleError(d,m){this.errorCount++,this.fireError(d,m,this.errorCount)}end(){}}e.BrowserMessageWriter=s;function a(c,d,m,g){return m===void 0&&(m=r.NullLogger),r.ConnectionStrategy.is(g)&&(g={connectionStrategy:g}),(0,r.createMessageConnection)(c,d,m,g)}e.createMessageConnection=a})(Mt),function(e){e.exports=Mt}(Yi);var Ds={},lr;(function(e){function t(n){return typeof n=="string"}e.is=t})(lr||(lr={}));var xn;(function(e){function t(n){return typeof n=="string"}e.is=t})(xn||(xn={}));var fr;(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})(fr||(fr={}));var Cn;(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})(Cn||(Cn={}));var dt;(function(e){function t(i,r){return i===Number.MAX_VALUE&&(i=Cn.MAX_VALUE),r===Number.MAX_VALUE&&(r=Cn.MAX_VALUE),{line:i,character:r}}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&D.uinteger(r.line)&&D.uinteger(r.character)}e.is=n})(dt||(dt={}));var Oe;(function(e){function t(i,r,o,s){if(D.uinteger(i)&&D.uinteger(r)&&D.uinteger(o)&&D.uinteger(s))return{start:dt.create(i,r),end:dt.create(o,s)};if(dt.is(i)&&dt.is(r))return{start:i,end:r};throw new Error("Range#create called with invalid arguments[".concat(i,", ").concat(r,", ").concat(o,", ").concat(s,"]"))}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&dt.is(r.start)&&dt.is(r.end)}e.is=n})(Oe||(Oe={}));var _n;(function(e){function t(i,r){return{uri:i,range:r}}e.create=t;function n(i){var r=i;return D.defined(r)&&Oe.is(r.range)&&(D.string(r.uri)||D.undefined(r.uri))}e.is=n})(_n||(_n={}));var hr;(function(e){function t(i,r,o,s){return{targetUri:i,targetRange:r,targetSelectionRange:o,originSelectionRange:s}}e.create=t;function n(i){var r=i;return D.defined(r)&&Oe.is(r.targetRange)&&D.string(r.targetUri)&&Oe.is(r.targetSelectionRange)&&(Oe.is(r.originSelectionRange)||D.undefined(r.originSelectionRange))}e.is=n})(hr||(hr={}));var Bn;(function(e){function t(i,r,o,s){return{red:i,green:r,blue:o,alpha:s}}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&D.numberRange(r.red,0,1)&&D.numberRange(r.green,0,1)&&D.numberRange(r.blue,0,1)&&D.numberRange(r.alpha,0,1)}e.is=n})(Bn||(Bn={}));var gr;(function(e){function t(i,r){return{range:i,color:r}}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&Oe.is(r.range)&&Bn.is(r.color)}e.is=n})(gr||(gr={}));var pr;(function(e){function t(i,r,o){return{label:i,textEdit:r,additionalTextEdits:o}}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&D.string(r.label)&&(D.undefined(r.textEdit)||Rt.is(r))&&(D.undefined(r.additionalTextEdits)||D.typedArray(r.additionalTextEdits,Rt.is))}e.is=n})(pr||(pr={}));var mr;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(mr||(mr={}));var yr;(function(e){function t(i,r,o,s,a,c){var d={startLine:i,endLine:r};return D.defined(o)&&(d.startCharacter=o),D.defined(s)&&(d.endCharacter=s),D.defined(a)&&(d.kind=a),D.defined(c)&&(d.collapsedText=c),d}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&D.uinteger(r.startLine)&&D.uinteger(r.startLine)&&(D.undefined(r.startCharacter)||D.uinteger(r.startCharacter))&&(D.undefined(r.endCharacter)||D.uinteger(r.endCharacter))&&(D.undefined(r.kind)||D.string(r.kind))}e.is=n})(yr||(yr={}));var Vn;(function(e){function t(i,r){return{location:i,message:r}}e.create=t;function n(i){var r=i;return D.defined(r)&&_n.is(r.location)&&D.string(r.message)}e.is=n})(Vn||(Vn={}));var vr;(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(vr||(vr={}));var Cr;(function(e){e.Unnecessary=1,e.Deprecated=2})(Cr||(Cr={}));var _r;(function(e){function t(n){var i=n;return D.objectLiteral(i)&&D.string(i.href)}e.is=t})(_r||(_r={}));var bn;(function(e){function t(i,r,o,s,a,c){var d={range:i,message:r};return D.defined(o)&&(d.severity=o),D.defined(s)&&(d.code=s),D.defined(a)&&(d.source=a),D.defined(c)&&(d.relatedInformation=c),d}e.create=t;function n(i){var r,o=i;return D.defined(o)&&Oe.is(o.range)&&D.string(o.message)&&(D.number(o.severity)||D.undefined(o.severity))&&(D.integer(o.code)||D.string(o.code)||D.undefined(o.code))&&(D.undefined(o.codeDescription)||D.string((r=o.codeDescription)===null||r===void 0?void 0:r.href))&&(D.string(o.source)||D.undefined(o.source))&&(D.undefined(o.relatedInformation)||D.typedArray(o.relatedInformation,Vn.is))}e.is=n})(bn||(bn={}));var jt;(function(e){function t(i,r){for(var o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];var a={title:i,command:r};return D.defined(o)&&o.length>0&&(a.arguments=o),a}e.create=t;function n(i){var r=i;return D.defined(r)&&D.string(r.title)&&D.string(r.command)}e.is=n})(jt||(jt={}));var Rt;(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 i(o){return{range:o,newText:""}}e.del=i;function r(o){var s=o;return D.objectLiteral(s)&&D.string(s.newText)&&Oe.is(s.range)}e.is=r})(Rt||(Rt={}));var At;(function(e){function t(i,r,o){var s={label:i};return r!==void 0&&(s.needsConfirmation=r),o!==void 0&&(s.description=o),s}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&D.string(r.label)&&(D.boolean(r.needsConfirmation)||r.needsConfirmation===void 0)&&(D.string(r.description)||r.description===void 0)}e.is=n})(At||(At={}));var Ve;(function(e){function t(n){var i=n;return D.string(i)}e.is=t})(Ve||(Ve={}));var Dt;(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 i(o,s){return{range:o,newText:"",annotationId:s}}e.del=i;function r(o){var s=o;return Rt.is(s)&&(At.is(s.annotationId)||Ve.is(s.annotationId))}e.is=r})(Dt||(Dt={}));var wn;(function(e){function t(i,r){return{textDocument:i,edits:r}}e.create=t;function n(i){var r=i;return D.defined(r)&&Rn.is(r.textDocument)&&Array.isArray(r.edits)}e.is=n})(wn||(wn={}));var Gt;(function(e){function t(i,r,o){var s={kind:"create",uri:i};return r!==void 0&&(r.overwrite!==void 0||r.ignoreIfExists!==void 0)&&(s.options=r),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(i){var r=i;return r&&r.kind==="create"&&D.string(r.uri)&&(r.options===void 0||(r.options.overwrite===void 0||D.boolean(r.options.overwrite))&&(r.options.ignoreIfExists===void 0||D.boolean(r.options.ignoreIfExists)))&&(r.annotationId===void 0||Ve.is(r.annotationId))}e.is=n})(Gt||(Gt={}));var Xt;(function(e){function t(i,r,o,s){var a={kind:"rename",oldUri:i,newUri:r};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(i){var r=i;return r&&r.kind==="rename"&&D.string(r.oldUri)&&D.string(r.newUri)&&(r.options===void 0||(r.options.overwrite===void 0||D.boolean(r.options.overwrite))&&(r.options.ignoreIfExists===void 0||D.boolean(r.options.ignoreIfExists)))&&(r.annotationId===void 0||Ve.is(r.annotationId))}e.is=n})(Xt||(Xt={}));var Yt;(function(e){function t(i,r,o){var s={kind:"delete",uri:i};return r!==void 0&&(r.recursive!==void 0||r.ignoreIfNotExists!==void 0)&&(s.options=r),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(i){var r=i;return r&&r.kind==="delete"&&D.string(r.uri)&&(r.options===void 0||(r.options.recursive===void 0||D.boolean(r.options.recursive))&&(r.options.ignoreIfNotExists===void 0||D.boolean(r.options.ignoreIfNotExists)))&&(r.annotationId===void 0||Ve.is(r.annotationId))}e.is=n})(Yt||(Yt={}));var Jn;(function(e){function t(n){var i=n;return i&&(i.changes!==void 0||i.documentChanges!==void 0)&&(i.documentChanges===void 0||i.documentChanges.every(function(r){return D.string(r.kind)?Gt.is(r)||Xt.is(r)||Yt.is(r):wn.is(r)}))}e.is=t})(Jn||(Jn={}));var Qn=function(){function e(t,n){this.edits=t,this.changeAnnotations=n}return e.prototype.insert=function(t,n,i){var r,o;if(i===void 0?r=Rt.insert(t,n):Ve.is(i)?(o=i,r=Dt.insert(t,n,i)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(i),r=Dt.insert(t,n,o)),this.edits.push(r),o!==void 0)return o},e.prototype.replace=function(t,n,i){var r,o;if(i===void 0?r=Rt.replace(t,n):Ve.is(i)?(o=i,r=Dt.replace(t,n,i)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(i),r=Dt.replace(t,n,o)),this.edits.push(r),o!==void 0)return o},e.prototype.delete=function(t,n){var i,r;if(n===void 0?i=Rt.del(t):Ve.is(n)?(r=n,i=Dt.del(t,n)):(this.assertChangeAnnotations(this.changeAnnotations),r=this.changeAnnotations.manage(n),i=Dt.del(t,r)),this.edits.push(i),r!==void 0)return r},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}(),Ss=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 i;if(Ve.is(t)?i=t:(i=this.nextId(),n=t),this._annotations[i]!==void 0)throw new Error("Id ".concat(i," is already in use."));if(n===void 0)throw new Error("No annotation provided for id ".concat(i));return this._annotations[i]=n,this._size++,i},e.prototype.nextId=function(){return this._counter++,this._counter.toString()},e}(),lc=function(){function e(t){var n=this;this._textEditChanges=Object.create(null),t!==void 0?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new Ss(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach(function(i){if(wn.is(i)){var r=new Qn(i.edits,n._changeAnnotations);n._textEditChanges[i.textDocument.uri]=r}})):t.changes&&Object.keys(t.changes).forEach(function(i){var r=new Qn(t.changes[i]);n._textEditChanges[i]=r})):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(Rn.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},i=this._textEditChanges[n.uri];if(!i){var r=[],o={textDocument:n,edits:r};this._workspaceEdit.documentChanges.push(o),i=new Qn(r,this._changeAnnotations),this._textEditChanges[n.uri]=i}return i}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var i=this._textEditChanges[t];if(!i){var r=[];this._workspaceEdit.changes[t]=r,i=new Qn(r),this._textEditChanges[t]=i}return i}},e.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ss,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,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var r;At.is(n)||Ve.is(n)?r=n:i=n;var o,s;if(r===void 0?o=Gt.create(t,i):(s=Ve.is(r)?r:this._changeAnnotations.manage(r),o=Gt.create(t,i,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s},e.prototype.renameFile=function(t,n,i,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var o;At.is(i)||Ve.is(i)?o=i:r=i;var s,a;if(o===void 0?s=Xt.create(t,n,r):(a=Ve.is(o)?o:this._changeAnnotations.manage(o),s=Xt.create(t,n,r,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a},e.prototype.deleteFile=function(t,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var r;At.is(n)||Ve.is(n)?r=n:i=n;var o,s;if(r===void 0?o=Yt.create(t,i):(s=Ve.is(r)?r:this._changeAnnotations.manage(r),o=Yt.create(t,i,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s},e}(),br;(function(e){function t(i){return{uri:i}}e.create=t;function n(i){var r=i;return D.defined(r)&&D.string(r.uri)}e.is=n})(br||(br={}));var wr;(function(e){function t(i,r){return{uri:i,version:r}}e.create=t;function n(i){var r=i;return D.defined(r)&&D.string(r.uri)&&D.integer(r.version)}e.is=n})(wr||(wr={}));var Rn;(function(e){function t(i,r){return{uri:i,version:r}}e.create=t;function n(i){var r=i;return D.defined(r)&&D.string(r.uri)&&(r.version===null||D.integer(r.version))}e.is=n})(Rn||(Rn={}));var Rr;(function(e){function t(i,r,o,s){return{uri:i,languageId:r,version:o,text:s}}e.create=t;function n(i){var r=i;return D.defined(r)&&D.string(r.uri)&&D.string(r.languageId)&&D.integer(r.version)&&D.string(r.text)}e.is=n})(Rr||(Rr={}));var Gn;(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(n){var i=n;return i===e.PlainText||i===e.Markdown}e.is=t})(Gn||(Gn={}));var Zt;(function(e){function t(n){var i=n;return D.objectLiteral(n)&&Gn.is(i.kind)&&D.string(i.value)}e.is=t})(Zt||(Zt={}));var Dr;(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})(Dr||(Dr={}));var Sr;(function(e){e.PlainText=1,e.Snippet=2})(Sr||(Sr={}));var Tr;(function(e){e.Deprecated=1})(Tr||(Tr={}));var Pr;(function(e){function t(i,r,o){return{newText:i,insert:r,replace:o}}e.create=t;function n(i){var r=i;return r&&D.string(r.newText)&&Oe.is(r.insert)&&Oe.is(r.replace)}e.is=n})(Pr||(Pr={}));var kr;(function(e){e.asIs=1,e.adjustIndentation=2})(kr||(kr={}));var Fr;(function(e){function t(n){var i=n;return i&&(D.string(i.detail)||i.detail===void 0)&&(D.string(i.description)||i.description===void 0)}e.is=t})(Fr||(Fr={}));var qr;(function(e){function t(n){return{label:n}}e.create=t})(qr||(qr={}));var Er;(function(e){function t(n,i){return{items:n||[],isIncomplete:!!i}}e.create=t})(Er||(Er={}));var Dn;(function(e){function t(i){return i.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function n(i){var r=i;return D.string(r)||D.objectLiteral(r)&&D.string(r.language)&&D.string(r.value)}e.is=n})(Dn||(Dn={}));var Or;(function(e){function t(n){var i=n;return!!i&&D.objectLiteral(i)&&(Zt.is(i.contents)||Dn.is(i.contents)||D.typedArray(i.contents,Dn.is))&&(n.range===void 0||Oe.is(n.range))}e.is=t})(Or||(Or={}));var Nr;(function(e){function t(n,i){return i?{label:n,documentation:i}:{label:n}}e.create=t})(Nr||(Nr={}));var Ir;(function(e){function t(n,i){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var s={label:n};return D.defined(i)&&(s.documentation=i),D.defined(r)?s.parameters=r:s.parameters=[],s}e.create=t})(Ir||(Ir={}));var Mr;(function(e){e.Text=1,e.Read=2,e.Write=3})(Mr||(Mr={}));var Lr;(function(e){function t(n,i){var r={range:n};return D.number(i)&&(r.kind=i),r}e.create=t})(Lr||(Lr={}));var jr;(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(jr||(jr={}));var Ar;(function(e){e.Deprecated=1})(Ar||(Ar={}));var Hr;(function(e){function t(n,i,r,o,s){var a={name:n,kind:i,location:{uri:o,range:r}};return s&&(a.containerName=s),a}e.create=t})(Hr||(Hr={}));var $r;(function(e){function t(n,i,r,o){return o!==void 0?{name:n,kind:i,location:{uri:r,range:o}}:{name:n,kind:i,location:{uri:r}}}e.create=t})($r||($r={}));var Wr;(function(e){function t(i,r,o,s,a,c){var d={name:i,detail:r,kind:o,range:s,selectionRange:a};return c!==void 0&&(d.children=c),d}e.create=t;function n(i){var r=i;return r&&D.string(r.name)&&D.number(r.kind)&&Oe.is(r.range)&&Oe.is(r.selectionRange)&&(r.detail===void 0||D.string(r.detail))&&(r.deprecated===void 0||D.boolean(r.deprecated))&&(r.children===void 0||Array.isArray(r.children))&&(r.tags===void 0||Array.isArray(r.tags))}e.is=n})(Wr||(Wr={}));var Ur;(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(Ur||(Ur={}));var Sn;(function(e){e.Invoked=1,e.Automatic=2})(Sn||(Sn={}));var Kr;(function(e){function t(i,r,o){var s={diagnostics:i};return r!=null&&(s.only=r),o!=null&&(s.triggerKind=o),s}e.create=t;function n(i){var r=i;return D.defined(r)&&D.typedArray(r.diagnostics,bn.is)&&(r.only===void 0||D.typedArray(r.only,D.string))&&(r.triggerKind===void 0||r.triggerKind===Sn.Invoked||r.triggerKind===Sn.Automatic)}e.is=n})(Kr||(Kr={}));var zr;(function(e){function t(i,r,o){var s={title:i},a=!0;return typeof r=="string"?(a=!1,s.kind=r):jt.is(r)?s.command=r:s.edit=r,a&&o!==void 0&&(s.kind=o),s}e.create=t;function n(i){var r=i;return r&&D.string(r.title)&&(r.diagnostics===void 0||D.typedArray(r.diagnostics,bn.is))&&(r.kind===void 0||D.string(r.kind))&&(r.edit!==void 0||r.command!==void 0)&&(r.command===void 0||jt.is(r.command))&&(r.isPreferred===void 0||D.boolean(r.isPreferred))&&(r.edit===void 0||Jn.is(r.edit))}e.is=n})(zr||(zr={}));var xr;(function(e){function t(i,r){var o={range:i};return D.defined(r)&&(o.data=r),o}e.create=t;function n(i){var r=i;return D.defined(r)&&Oe.is(r.range)&&(D.undefined(r.command)||jt.is(r.command))}e.is=n})(xr||(xr={}));var Br;(function(e){function t(i,r){return{tabSize:i,insertSpaces:r}}e.create=t;function n(i){var r=i;return D.defined(r)&&D.uinteger(r.tabSize)&&D.boolean(r.insertSpaces)}e.is=n})(Br||(Br={}));var Vr;(function(e){function t(i,r,o){return{range:i,target:r,data:o}}e.create=t;function n(i){var r=i;return D.defined(r)&&Oe.is(r.range)&&(D.undefined(r.target)||D.string(r.target))}e.is=n})(Vr||(Vr={}));var Jr;(function(e){function t(i,r){return{range:i,parent:r}}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&Oe.is(r.range)&&(r.parent===void 0||e.is(r.parent))}e.is=n})(Jr||(Jr={}));var Qr;(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(Qr||(Qr={}));var Gr;(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(Gr||(Gr={}));var Xr;(function(e){function t(n){var i=n;return D.objectLiteral(i)&&(i.resultId===void 0||typeof i.resultId=="string")&&Array.isArray(i.data)&&(i.data.length===0||typeof i.data[0]=="number")}e.is=t})(Xr||(Xr={}));var Yr;(function(e){function t(i,r){return{range:i,text:r}}e.create=t;function n(i){var r=i;return r!=null&&Oe.is(r.range)&&D.string(r.text)}e.is=n})(Yr||(Yr={}));var Zr;(function(e){function t(i,r,o){return{range:i,variableName:r,caseSensitiveLookup:o}}e.create=t;function n(i){var r=i;return r!=null&&Oe.is(r.range)&&D.boolean(r.caseSensitiveLookup)&&(D.string(r.variableName)||r.variableName===void 0)}e.is=n})(Zr||(Zr={}));var eo;(function(e){function t(i,r){return{range:i,expression:r}}e.create=t;function n(i){var r=i;return r!=null&&Oe.is(r.range)&&(D.string(r.expression)||r.expression===void 0)}e.is=n})(eo||(eo={}));var to;(function(e){function t(i,r){return{frameId:i,stoppedLocation:r}}e.create=t;function n(i){var r=i;return D.defined(r)&&Oe.is(i.stoppedLocation)}e.is=n})(to||(to={}));var Xn;(function(e){e.Type=1,e.Parameter=2;function t(n){return n===1||n===2}e.is=t})(Xn||(Xn={}));var Yn;(function(e){function t(i){return{value:i}}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&(r.tooltip===void 0||D.string(r.tooltip)||Zt.is(r.tooltip))&&(r.location===void 0||_n.is(r.location))&&(r.command===void 0||jt.is(r.command))}e.is=n})(Yn||(Yn={}));var no;(function(e){function t(i,r,o){var s={position:i,label:r};return o!==void 0&&(s.kind=o),s}e.create=t;function n(i){var r=i;return D.objectLiteral(r)&&dt.is(r.position)&&(D.string(r.label)||D.typedArray(r.label,Yn.is))&&(r.kind===void 0||Xn.is(r.kind))&&r.textEdits===void 0||D.typedArray(r.textEdits,Rt.is)&&(r.tooltip===void 0||D.string(r.tooltip)||Zt.is(r.tooltip))&&(r.paddingLeft===void 0||D.boolean(r.paddingLeft))&&(r.paddingRight===void 0||D.boolean(r.paddingRight))}e.is=n})(no||(no={}));var io;(function(e){function t(n){var i=n;return D.objectLiteral(i)&&xn.is(i.uri)&&D.string(i.name)}e.is=t})(io||(io={}));var fc=[`
`,`\r
`,"\r"],ro;(function(e){function t(o,s,a,c){return new hc(o,s,a,c)}e.create=t;function n(o){var s=o;return!!(D.defined(s)&&D.string(s.uri)&&(D.undefined(s.languageId)||D.string(s.languageId))&&D.uinteger(s.lineCount)&&D.func(s.getText)&&D.func(s.positionAt)&&D.func(s.offsetAt))}e.is=n;function i(o,s){for(var a=o.getText(),c=r(s,function(y,P){var I=y.range.start.line-P.range.start.line;return I===0?y.range.start.character-P.range.start.character:I}),d=a.length,m=c.length-1;m>=0;m--){var g=c[m],l=o.offsetAt(g.range.start),h=o.offsetAt(g.range.end);if(h<=d)a=a.substring(0,l)+g.newText+a.substring(h,a.length);else throw new Error("Overlapping edit");d=l}return a}e.applyEdits=i;function r(o,s){if(o.length<=1)return o;var a=o.length/2|0,c=o.slice(0,a),d=o.slice(a);r(c,s),r(d,s);for(var m=0,g=0,l=0;m<c.length&&g<d.length;){var h=s(c[m],d[g]);h<=0?o[l++]=c[m++]:o[l++]=d[g++]}for(;m<c.length;)o[l++]=c[m++];for(;g<d.length;)o[l++]=d[g++];return o}})(ro||(ro={}));var hc=function(){function e(t,n,i,r){this._uri=t,this._languageId=n,this._version=i,this._content=r,this._lineOffsets=void 0}return Object.defineProperty(e.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),e.prototype.getText=function(t){if(t){var n=this.offsetAt(t.start),i=this.offsetAt(t.end);return this._content.substring(n,i)}return this._content},e.prototype.update=function(t,n){this._content=t.text,this._version=n,this._lineOffsets=void 0},e.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var t=[],n=this._content,i=!0,r=0;r<n.length;r++){i&&(t.push(r),i=!1);var o=n.charAt(r);i=o==="\r"||o===`
`,o==="\r"&&r+1<n.length&&n.charAt(r+1)===`
`&&r++}i&&n.length>0&&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(),i=0,r=n.length;if(r===0)return dt.create(0,t);for(;i<r;){var o=Math.floor((i+r)/2);n[o]>t?r=o:i=o+1}var s=i-1;return dt.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 i=n[t.line],r=t.line+1<n.length?n[t.line+1]:this._content.length;return Math.max(Math.min(i+t.character,r),i)},Object.defineProperty(e.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),e}(),D;(function(e){var t=Object.prototype.toString;function n(h){return typeof h<"u"}e.defined=n;function i(h){return typeof h>"u"}e.undefined=i;function r(h){return h===!0||h===!1}e.boolean=r;function o(h){return t.call(h)==="[object String]"}e.string=o;function s(h){return t.call(h)==="[object Number]"}e.number=s;function a(h,y,P){return t.call(h)==="[object Number]"&&y<=h&&h<=P}e.numberRange=a;function c(h){return t.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}e.integer=c;function d(h){return t.call(h)==="[object Number]"&&0<=h&&h<=2147483647}e.uinteger=d;function m(h){return t.call(h)==="[object Function]"}e.func=m;function g(h){return h!==null&&typeof h=="object"}e.objectLiteral=g;function l(h,y){return Array.isArray(h)&&h.every(y)}e.typedArray=l})(D||(D={}));var gc=Object.freeze({__proto__:null,get DocumentUri(){return lr},get URI(){return xn},get integer(){return fr},get uinteger(){return Cn},get Position(){return dt},get Range(){return Oe},get Location(){return _n},get LocationLink(){return hr},get Color(){return Bn},get ColorInformation(){return gr},get ColorPresentation(){return pr},get FoldingRangeKind(){return mr},get FoldingRange(){return yr},get DiagnosticRelatedInformation(){return Vn},get DiagnosticSeverity(){return vr},get DiagnosticTag(){return Cr},get CodeDescription(){return _r},get Diagnostic(){return bn},get Command(){return jt},get TextEdit(){return Rt},get ChangeAnnotation(){return At},get ChangeAnnotationIdentifier(){return Ve},get AnnotatedTextEdit(){return Dt},get TextDocumentEdit(){return wn},get CreateFile(){return Gt},get RenameFile(){return Xt},get DeleteFile(){return Yt},get WorkspaceEdit(){return Jn},WorkspaceChange:lc,get TextDocumentIdentifier(){return br},get VersionedTextDocumentIdentifier(){return wr},get OptionalVersionedTextDocumentIdentifier(){return Rn},get TextDocumentItem(){return Rr},get MarkupKind(){return Gn},get MarkupContent(){return Zt},get CompletionItemKind(){return Dr},get InsertTextFormat(){return Sr},get CompletionItemTag(){return Tr},get InsertReplaceEdit(){return Pr},get InsertTextMode(){return kr},get CompletionItemLabelDetails(){return Fr},get CompletionItem(){return qr},get CompletionList(){return Er},get MarkedString(){return Dn},get Hover(){return Or},get ParameterInformation(){return Nr},get SignatureInformation(){return Ir},get DocumentHighlightKind(){return Mr},get DocumentHighlight(){return Lr},get SymbolKind(){return jr},get SymbolTag(){return Ar},get SymbolInformation(){return Hr},get WorkspaceSymbol(){return $r},get DocumentSymbol(){return Wr},get CodeActionKind(){return Ur},get CodeActionTriggerKind(){return Sn},get CodeActionContext(){return Kr},get CodeAction(){return zr},get CodeLens(){return xr},get FormattingOptions(){return Br},get DocumentLink(){return Vr},get SelectionRange(){return Jr},get SemanticTokenTypes(){return Qr},get SemanticTokenModifiers(){return Gr},get SemanticTokens(){return Xr},get InlineValueText(){return Yr},get InlineValueVariableLookup(){return Zr},get InlineValueEvaluatableExpression(){return eo},get InlineValueContext(){return to},get InlayHintKind(){return Xn},get InlayHintLabelPart(){return Yn},get InlayHint(){return no},get WorkspaceFolder(){return io},EOL:fc,get TextDocument(){return ro}}),oo=xa(gc),pe={};Object.defineProperty(pe,"__esModule",{value:!0}),pe.ProtocolNotificationType=pe.ProtocolNotificationType0=pe.ProtocolRequestType=pe.ProtocolRequestType0=pe.RegistrationType=void 0;const en=Mt;class pc{constructor(t){this.method=t}}pe.RegistrationType=pc;class mc extends en.RequestType0{constructor(t){super(t)}}pe.ProtocolRequestType0=mc;class yc extends en.RequestType{constructor(t){super(t,en.ParameterStructures.byName)}}pe.ProtocolRequestType=yc;class vc extends en.NotificationType0{constructor(t){super(t)}}pe.ProtocolNotificationType0=vc;class Cc extends en.NotificationType{constructor(t){super(t,en.ParameterStructures.byName)}}pe.ProtocolNotificationType=Cc;var Ts={},Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.objectLiteral=Ne.typedArray=Ne.stringArray=Ne.array=Ne.func=Ne.error=Ne.number=Ne.string=Ne.boolean=void 0;function _c(e){return e===!0||e===!1}Ne.boolean=_c;function Ps(e){return typeof e=="string"||e instanceof String}Ne.string=Ps;function bc(e){return typeof e=="number"||e instanceof Number}Ne.number=bc;function wc(e){return e instanceof Error}Ne.error=wc;function Rc(e){return typeof e=="function"}Ne.func=Rc;function ks(e){return Array.isArray(e)}Ne.array=ks;function Dc(e){return ks(e)&&e.every(t=>Ps(t))}Ne.stringArray=Dc;function Sc(e,t){return Array.isArray(e)&&e.every(t)}Ne.typedArray=Sc;function Tc(e){return e!==null&&typeof e=="object"}Ne.objectLiteral=Tc;var Fs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationRequest=void 0;const t=pe;(function(n){n.method="textDocument/implementation",n.type=new t.ProtocolRequestType(n.method)})(e.ImplementationRequest||(e.ImplementationRequest={}))})(Fs);var qs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TypeDefinitionRequest=void 0;const t=pe;(function(n){n.method="textDocument/typeDefinition",n.type=new t.ProtocolRequestType(n.method)})(e.TypeDefinitionRequest||(e.TypeDefinitionRequest={}))})(qs);var Es={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=void 0;const t=pe;(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={}))})(Es);var Os={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConfigurationRequest=void 0;const t=pe;(function(n){n.type=new t.ProtocolRequestType("workspace/configuration")})(e.ConfigurationRequest||(e.ConfigurationRequest={}))})(Os);var Ns={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorPresentationRequest=e.DocumentColorRequest=void 0;const t=pe;(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={}))})(Ns);var Is={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FoldingRangeRequest=void 0;const t=pe;(function(n){n.method="textDocument/foldingRange",n.type=new t.ProtocolRequestType(n.method)})(e.FoldingRangeRequest||(e.FoldingRangeRequest={}))})(Is);var Ms={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DeclarationRequest=void 0;const t=pe;(function(n){n.method="textDocument/declaration",n.type=new t.ProtocolRequestType(n.method)})(e.DeclarationRequest||(e.DeclarationRequest={}))})(Ms);var Ls={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionRangeRequest=void 0;const t=pe;(function(n){n.method="textDocument/selectionRange",n.type=new t.ProtocolRequestType(n.method)})(e.SelectionRangeRequest||(e.SelectionRangeRequest={}))})(Ls);var js={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=void 0;const t=Mt,n=pe;(function(i){i.type=new t.ProgressType;function r(o){return o===i.type}i.is=r})(e.WorkDoneProgress||(e.WorkDoneProgress={})),function(i){i.method="window/workDoneProgress/create",i.type=new n.ProtocolRequestType(i.method)}(e.WorkDoneProgressCreateRequest||(e.WorkDoneProgressCreateRequest={})),function(i){i.method="window/workDoneProgress/cancel",i.type=new n.ProtocolNotificationType(i.method)}(e.WorkDoneProgressCancelNotification||(e.WorkDoneProgressCancelNotification={}))})(js);var As={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.CallHierarchyPrepareRequest=void 0;const t=pe;(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={}))})(As);var Hs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.SemanticTokensRegistrationType=e.TokenFormat=void 0;const t=pe;(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={}))})(Hs);var $s={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ShowDocumentRequest=void 0;const t=pe;(function(n){n.method="window/showDocument",n.type=new t.ProtocolRequestType(n.method)})(e.ShowDocumentRequest||(e.ShowDocumentRequest={}))})($s);var Ws={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedEditingRangeRequest=void 0;const t=pe;(function(n){n.method="textDocument/linkedEditingRange",n.type=new t.ProtocolRequestType(n.method)})(e.LinkedEditingRangeRequest||(e.LinkedEditingRangeRequest={}))})(Ws);var Us={};(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=pe;(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={}))})(Us);var Ks={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=void 0;const t=pe;(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={}))})(Ks);var zs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHierarchySubtypesRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchyPrepareRequest=void 0;const t=pe;(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={}))})(zs);var xs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.InlineValueRefreshRequest=e.InlineValueRequest=void 0;const t=pe;(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={}))})(xs);var Bs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=void 0;const t=pe;(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={}))})(Bs);var Vs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=void 0;const t=Mt,n=Ne,i=pe;(function(r){function o(s){const a=s;return a&&n.boolean(a.retriggerRequest)}r.is=o})(e.DiagnosticServerCancellationData||(e.DiagnosticServerCancellationData={})),function(r){r.Full="full",r.Unchanged="unchanged"}(e.DocumentDiagnosticReportKind||(e.DocumentDiagnosticReportKind={})),function(r){r.method="textDocument/diagnostic",r.type=new i.ProtocolRequestType(r.method),r.partialResult=new t.ProgressType}(e.DocumentDiagnosticRequest||(e.DocumentDiagnosticRequest={})),function(r){r.method="workspace/diagnostic",r.type=new i.ProtocolRequestType(r.method),r.partialResult=new t.ProgressType}(e.WorkspaceDiagnosticRequest||(e.WorkspaceDiagnosticRequest={})),function(r){r.method="workspace/diagnostic/refresh",r.type=new i.ProtocolRequestType0(r.method)}(e.DiagnosticRefreshRequest||(e.DiagnosticRefreshRequest={}))})(Vs);var Js={};(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=oo,n=Ne,i=pe;var r;(function(a){a.Markup=1,a.Code=2;function c(d){return d===1||d===2}a.is=c})(r=e.NotebookCellKind||(e.NotebookCellKind={}));var o;(function(a){function c(g,l){const h={executionOrder:g};return(l===!0||l===!1)&&(h.success=l),h}a.create=c;function d(g){const l=g;return n.objectLiteral(l)&&t.uinteger.is(l.executionOrder)&&(l.success===void 0||n.boolean(l.success))}a.is=d;function m(g,l){return g===l?!0:g==null||l===null||l===void 0?!1:g.executionOrder===l.executionOrder&&g.success===l.success}a.equals=m})(o=e.ExecutionSummary||(e.ExecutionSummary={}));var s;(function(a){function c(l,h){return{kind:l,document:h}}a.create=c;function d(l){const h=l;return n.objectLiteral(h)&&r.is(h.kind)&&t.DocumentUri.is(h.document)&&(h.metadata===void 0||n.objectLiteral(h.metadata))}a.is=d;function m(l,h){const y=new Set;return l.document!==h.document&&y.add("document"),l.kind!==h.kind&&y.add("kind"),l.executionSummary!==h.executionSummary&&y.add("executionSummary"),(l.metadata!==void 0||h.metadata!==void 0)&&!g(l.metadata,h.metadata)&&y.add("metadata"),(l.executionSummary!==void 0||h.executionSummary!==void 0)&&!o.equals(l.executionSummary,h.executionSummary)&&y.add("executionSummary"),y}a.diff=m;function g(l,h){if(l===h)return!0;if(l==null||h===null||h===void 0||typeof l!=typeof h||typeof l!="object")return!1;const y=Array.isArray(l),P=Array.isArray(h);if(y!==P)return!1;if(y&&P){if(l.length!==h.length)return!1;for(let I=0;I<l.length;I++)if(!g(l[I],h[I]))return!1}if(n.objectLiteral(l)&&n.objectLiteral(h)){const I=Object.keys(l),N=Object.keys(h);if(I.length!==N.length||(I.sort(),N.sort(),!g(I,N)))return!1;for(let w=0;w<I.length;w++){const S=I[w];if(!g(l[S],h[S]))return!1}}return!0}})(s=e.NotebookCell||(e.NotebookCell={})),function(a){function c(m,g,l,h){return{uri:m,notebookType:g,version:l,cells:h}}a.create=c;function d(m){const g=m;return n.objectLiteral(g)&&n.string(g.uri)&&t.integer.is(g.version)&&n.typedArray(g.cells,s.is)}a.is=d}(e.NotebookDocument||(e.NotebookDocument={})),function(a){a.method="notebookDocument/sync",a.type=new i.RegistrationType(a.method)}(e.NotebookDocumentSyncRegistrationType||(e.NotebookDocumentSyncRegistrationType={})),function(a){a.method="notebookDocument/didOpen",a.type=new i.ProtocolNotificationType(a.method)}(e.DidOpenNotebookDocumentNotification||(e.DidOpenNotebookDocumentNotification={})),function(a){function c(m){const g=m;return n.objectLiteral(g)&&t.uinteger.is(g.start)&&t.uinteger.is(g.deleteCount)&&(g.cells===void 0||n.typedArray(g.cells,s.is))}a.is=c;function d(m,g,l){const h={start:m,deleteCount:g};return l!==void 0&&(h.cells=l),h}a.create=d}(e.NotebookCellArrayChange||(e.NotebookCellArrayChange={})),function(a){a.method="notebookDocument/didChange",a.type=new i.ProtocolNotificationType(a.method)}(e.DidChangeNotebookDocumentNotification||(e.DidChangeNotebookDocumentNotification={})),function(a){a.method="notebookDocument/didSave",a.type=new i.ProtocolNotificationType(a.method)}(e.DidSaveNotebookDocumentNotification||(e.DidSaveNotebookDocumentNotification={})),function(a){a.method="notebookDocument/didClose",a.type=new i.ProtocolNotificationType(a.method)}(e.DidCloseNotebookDocumentNotification||(e.DidCloseNotebookDocumentNotification={}))})(Js),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WorkspaceSymbolRequest=e.CodeActionResolveRequest=e.CodeActionRequest=e.DocumentSymbolRequest=e.DocumentHighlightRequest=e.ReferencesRequest=e.DefinitionRequest=e.SignatureHelpRequest=e.SignatureHelpTriggerKind=e.HoverRequest=e.CompletionResolveRequest=e.CompletionRequest=e.CompletionTriggerKind=e.PublishDiagnosticsNotification=e.WatchKind=e.RelativePattern=e.FileChangeType=e.DidChangeWatchedFilesNotification=e.WillSaveTextDocumentWaitUntilRequest=e.WillSaveTextDocumentNotification=e.TextDocumentSaveReason=e.DidSaveTextDocumentNotification=e.DidCloseTextDocumentNotification=e.DidChangeTextDocumentNotification=e.TextDocumentContentChangeEvent=e.DidOpenTextDocumentNotification=e.TextDocumentSyncKind=e.TelemetryEventNotification=e.LogMessageNotification=e.ShowMessageRequest=e.ShowMessageNotification=e.MessageType=e.DidChangeConfigurationNotification=e.ExitNotification=e.ShutdownRequest=e.InitializedNotification=e.InitializeErrorCodes=e.InitializeRequest=e.WorkDoneProgressOptions=e.TextDocumentRegistrationOptions=e.StaticRegistrationOptions=e.PositionEncodingKind=e.FailureHandlingKind=e.ResourceOperationKind=e.UnregistrationRequest=e.RegistrationRequest=e.DocumentSelector=e.NotebookCellTextDocumentFilter=e.NotebookDocumentFilter=e.TextDocumentFilter=void 0,e.TypeHierarchySubtypesRequest=e.TypeHierarchyPrepareRequest=e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.WillRenameFilesRequest=e.DidRenameFilesNotification=e.WillCreateFilesRequest=e.DidCreateFilesNotification=e.FileOperationPatternKind=e.LinkedEditingRangeRequest=e.ShowDocumentRequest=e.SemanticTokensRegistrationType=e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.TokenFormat=e.CallHierarchyPrepareRequest=e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=e.SelectionRangeRequest=e.DeclarationRequest=e.FoldingRangeRequest=e.ColorPresentationRequest=e.DocumentColorRequest=e.ConfigurationRequest=e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=e.TypeDefinitionRequest=e.ImplementationRequest=e.ApplyWorkspaceEditRequest=e.ExecuteCommandRequest=e.PrepareRenameRequest=e.RenameRequest=e.PrepareSupportDefaultBehavior=e.DocumentOnTypeFormattingRequest=e.DocumentRangeFormattingRequest=e.DocumentFormattingRequest=e.DocumentLinkResolveRequest=e.DocumentLinkRequest=e.CodeLensRefreshRequest=e.CodeLensResolveRequest=e.CodeLensRequest=e.WorkspaceSymbolResolveRequest=void 0,e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=e.InlineValueRefreshRequest=e.InlineValueRequest=e.TypeHierarchySupertypesRequest=void 0;const t=pe,n=oo,i=Ne,r=Fs;Object.defineProperty(e,"ImplementationRequest",{enumerable:!0,get:function(){return r.ImplementationRequest}});const o=qs;Object.defineProperty(e,"TypeDefinitionRequest",{enumerable:!0,get:function(){return o.TypeDefinitionRequest}});const s=Es;Object.defineProperty(e,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return s.WorkspaceFoldersRequest}}),Object.defineProperty(e,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return s.DidChangeWorkspaceFoldersNotification}});const a=Os;Object.defineProperty(e,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const c=Ns;Object.defineProperty(e,"DocumentColorRequest",{enumerable:!0,get:function(){return c.DocumentColorRequest}}),Object.defineProperty(e,"ColorPresentationRequest",{enumerable:!0,get:function(){return c.ColorPresentationRequest}});const d=Is;Object.defineProperty(e,"FoldingRangeRequest",{enumerable:!0,get:function(){return d.FoldingRangeRequest}});const m=Ms;Object.defineProperty(e,"DeclarationRequest",{enumerable:!0,get:function(){return m.DeclarationRequest}});const g=Ls;Object.defineProperty(e,"SelectionRangeRequest",{enumerable:!0,get:function(){return g.SelectionRangeRequest}});const l=js;Object.defineProperty(e,"WorkDoneProgress",{enumerable:!0,get:function(){return l.WorkDoneProgress}}),Object.defineProperty(e,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return l.WorkDoneProgressCreateRequest}}),Object.defineProperty(e,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return l.WorkDoneProgressCancelNotification}});const h=As;Object.defineProperty(e,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(e,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(e,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return h.CallHierarchyPrepareRequest}});const y=Hs;Object.defineProperty(e,"TokenFormat",{enumerable:!0,get:function(){return y.TokenFormat}}),Object.defineProperty(e,"SemanticTokensRequest",{enumerable:!0,get:function(){return y.SemanticTokensRequest}}),Object.defineProperty(e,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return y.SemanticTokensDeltaRequest}}),Object.defineProperty(e,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return y.SemanticTokensRangeRequest}}),Object.defineProperty(e,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return y.SemanticTokensRefreshRequest}}),Object.defineProperty(e,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return y.SemanticTokensRegistrationType}});const P=$s;Object.defineProperty(e,"ShowDocumentRequest",{enumerable:!0,get:function(){return P.ShowDocumentRequest}});const I=Ws;Object.defineProperty(e,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return I.LinkedEditingRangeRequest}});const N=Us;Object.defineProperty(e,"FileOperationPatternKind",{enumerable:!0,get:function(){return N.FileOperationPatternKind}}),Object.defineProperty(e,"DidCreateFilesNotification",{enumerable:!0,get:function(){return N.DidCreateFilesNotification}}),Object.defineProperty(e,"WillCreateFilesRequest",{enumerable:!0,get:function(){return N.WillCreateFilesRequest}}),Object.defineProperty(e,"DidRenameFilesNotification",{enumerable:!0,get:function(){return N.DidRenameFilesNotification}}),Object.defineProperty(e,"WillRenameFilesRequest",{enumerable:!0,get:function(){return N.WillRenameFilesRequest}}),Object.defineProperty(e,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return N.DidDeleteFilesNotification}}),Object.defineProperty(e,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return N.WillDeleteFilesRequest}});const w=Ks;Object.defineProperty(e,"UniquenessLevel",{enumerable:!0,get:function(){return w.UniquenessLevel}}),Object.defineProperty(e,"MonikerKind",{enumerable:!0,get:function(){return w.MonikerKind}}),Object.defineProperty(e,"MonikerRequest",{enumerable:!0,get:function(){return w.MonikerRequest}});const S=zs;Object.defineProperty(e,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return S.TypeHierarchyPrepareRequest}}),Object.defineProperty(e,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return S.TypeHierarchySubtypesRequest}}),Object.defineProperty(e,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return S.TypeHierarchySupertypesRequest}});const j=xs;Object.defineProperty(e,"InlineValueRequest",{enumerable:!0,get:function(){return j.InlineValueRequest}}),Object.defineProperty(e,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return j.InlineValueRefreshRequest}});const A=Bs;Object.defineProperty(e,"InlayHintRequest",{enumerable:!0,get:function(){return A.InlayHintRequest}}),Object.defineProperty(e,"InlayHintResolveRequest",{enumerable:!0,get:function(){return A.InlayHintResolveRequest}}),Object.defineProperty(e,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return A.InlayHintRefreshRequest}});const G=Vs;Object.defineProperty(e,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return G.DiagnosticServerCancellationData}}),Object.defineProperty(e,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return G.DocumentDiagnosticReportKind}}),Object.defineProperty(e,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return G.DocumentDiagnosticRequest}}),Object.defineProperty(e,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return G.WorkspaceDiagnosticRequest}}),Object.defineProperty(e,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return G.DiagnosticRefreshRequest}});const V=Js;Object.defineProperty(e,"NotebookCellKind",{enumerable:!0,get:function(){return V.NotebookCellKind}}),Object.defineProperty(e,"ExecutionSummary",{enumerable:!0,get:function(){return V.ExecutionSummary}}),Object.defineProperty(e,"NotebookCell",{enumerable:!0,get:function(){return V.NotebookCell}}),Object.defineProperty(e,"NotebookDocument",{enumerable:!0,get:function(){return V.NotebookDocument}}),Object.defineProperty(e,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return V.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(e,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return V.DidOpenNotebookDocumentNotification}}),Object.defineProperty(e,"NotebookCellArrayChange",{enumerable:!0,get:function(){return V.NotebookCellArrayChange}}),Object.defineProperty(e,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return V.DidChangeNotebookDocumentNotification}}),Object.defineProperty(e,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return V.DidSaveNotebookDocumentNotification}}),Object.defineProperty(e,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return V.DidCloseNotebookDocumentNotification}});var k;(function(p){function M(Y){const O=Y;return i.string(O.language)||i.string(O.scheme)||i.string(O.pattern)}p.is=M})(k=e.TextDocumentFilter||(e.TextDocumentFilter={}));var K;(function(p){function M(Y){const O=Y;return i.objectLiteral(O)&&(i.string(O.notebookType)||i.string(O.scheme)||i.string(O.pattern))}p.is=M})(K=e.NotebookDocumentFilter||(e.NotebookDocumentFilter={}));var W;(function(p){function M(Y){const O=Y;return i.objectLiteral(O)&&(i.string(O.notebook)||K.is(O.notebook))&&(O.language===void 0||i.string(O.language))}p.is=M})(W=e.NotebookCellTextDocumentFilter||(e.NotebookCellTextDocumentFilter={}));var U;(function(p){function M(Y){if(!Array.isArray(Y))return!1;for(let O of Y)if(!i.string(O)&&!k.is(O)&&!W.is(O))return!1;return!0}p.is=M})(U=e.DocumentSelector||(e.DocumentSelector={})),function(p){p.type=new t.ProtocolRequestType("client/registerCapability")}(e.RegistrationRequest||(e.RegistrationRequest={})),function(p){p.type=new t.ProtocolRequestType("client/unregisterCapability")}(e.UnregistrationRequest||(e.UnregistrationRequest={})),function(p){p.Create="create",p.Rename="rename",p.Delete="delete"}(e.ResourceOperationKind||(e.ResourceOperationKind={})),function(p){p.Abort="abort",p.Transactional="transactional",p.TextOnlyTransactional="textOnlyTransactional",p.Undo="undo"}(e.FailureHandlingKind||(e.FailureHandlingKind={})),function(p){p.UTF8="utf-8",p.UTF16="utf-16",p.UTF32="utf-32"}(e.PositionEncodingKind||(e.PositionEncodingKind={})),function(p){function M(Y){const O=Y;return O&&i.string(O.id)&&O.id.length>0}p.hasId=M}(e.StaticRegistrationOptions||(e.StaticRegistrationOptions={})),function(p){function M(Y){const O=Y;return O&&(O.documentSelector===null||U.is(O.documentSelector))}p.is=M}(e.TextDocumentRegistrationOptions||(e.TextDocumentRegistrationOptions={})),function(p){function M(O){const x=O;return i.objectLiteral(x)&&(x.workDoneProgress===void 0||i.boolean(x.workDoneProgress))}p.is=M;function Y(O){const x=O;return x&&i.boolean(x.workDoneProgress)}p.hasWorkDoneProgress=Y}(e.WorkDoneProgressOptions||(e.WorkDoneProgressOptions={})),function(p){p.type=new t.ProtocolRequestType("initialize")}(e.InitializeRequest||(e.InitializeRequest={})),function(p){p.unknownProtocolVersion=1}(e.InitializeErrorCodes||(e.InitializeErrorCodes={})),function(p){p.type=new t.ProtocolNotificationType("initialized")}(e.InitializedNotification||(e.InitializedNotification={})),function(p){p.type=new t.ProtocolRequestType0("shutdown")}(e.ShutdownRequest||(e.ShutdownRequest={})),function(p){p.type=new t.ProtocolNotificationType0("exit")}(e.ExitNotification||(e.ExitNotification={})),function(p){p.type=new t.ProtocolNotificationType("workspace/didChangeConfiguration")}(e.DidChangeConfigurationNotification||(e.DidChangeConfigurationNotification={})),function(p){p.Error=1,p.Warning=2,p.Info=3,p.Log=4}(e.MessageType||(e.MessageType={})),function(p){p.type=new t.ProtocolNotificationType("window/showMessage")}(e.ShowMessageNotification||(e.ShowMessageNotification={})),function(p){p.type=new t.ProtocolRequestType("window/showMessageRequest")}(e.ShowMessageRequest||(e.ShowMessageRequest={})),function(p){p.type=new t.ProtocolNotificationType("window/logMessage")}(e.LogMessageNotification||(e.LogMessageNotification={})),function(p){p.type=new t.ProtocolNotificationType("telemetry/event")}(e.TelemetryEventNotification||(e.TelemetryEventNotification={})),function(p){p.None=0,p.Full=1,p.Incremental=2}(e.TextDocumentSyncKind||(e.TextDocumentSyncKind={})),function(p){p.method="textDocument/didOpen",p.type=new t.ProtocolNotificationType(p.method)}(e.DidOpenTextDocumentNotification||(e.DidOpenTextDocumentNotification={})),function(p){function M(O){let x=O;return x!=null&&typeof x.text=="string"&&x.range!==void 0&&(x.rangeLength===void 0||typeof x.rangeLength=="number")}p.isIncremental=M;function Y(O){let x=O;return x!=null&&typeof x.text=="string"&&x.range===void 0&&x.rangeLength===void 0}p.isFull=Y}(e.TextDocumentContentChangeEvent||(e.TextDocumentContentChangeEvent={})),function(p){p.method="textDocument/didChange",p.type=new t.ProtocolNotificationType(p.method)}(e.DidChangeTextDocumentNotification||(e.DidChangeTextDocumentNotification={})),function(p){p.method="textDocument/didClose",p.type=new t.ProtocolNotificationType(p.method)}(e.DidCloseTextDocumentNotification||(e.DidCloseTextDocumentNotification={})),function(p){p.method="textDocument/didSave",p.type=new t.ProtocolNotificationType(p.method)}(e.DidSaveTextDocumentNotification||(e.DidSaveTextDocumentNotification={})),function(p){p.Manual=1,p.AfterDelay=2,p.FocusOut=3}(e.TextDocumentSaveReason||(e.TextDocumentSaveReason={})),function(p){p.method="textDocument/willSave",p.type=new t.ProtocolNotificationType(p.method)}(e.WillSaveTextDocumentNotification||(e.WillSaveTextDocumentNotification={})),function(p){p.method="textDocument/willSaveWaitUntil",p.type=new t.ProtocolRequestType(p.method)}(e.WillSaveTextDocumentWaitUntilRequest||(e.WillSaveTextDocumentWaitUntilRequest={})),function(p){p.type=new t.ProtocolNotificationType("workspace/didChangeWatchedFiles")}(e.DidChangeWatchedFilesNotification||(e.DidChangeWatchedFilesNotification={})),function(p){p.Created=1,p.Changed=2,p.Deleted=3}(e.FileChangeType||(e.FileChangeType={})),function(p){function M(Y){const O=Y;return i.objectLiteral(O)&&(n.URI.is(O.baseUri)||n.WorkspaceFolder.is(O.baseUri))&&i.string(O.pattern)}p.is=M}(e.RelativePattern||(e.RelativePattern={})),function(p){p.Create=1,p.Change=2,p.Delete=4}(e.WatchKind||(e.WatchKind={})),function(p){p.type=new t.ProtocolNotificationType("textDocument/publishDiagnostics")}(e.PublishDiagnosticsNotification||(e.PublishDiagnosticsNotification={})),function(p){p.Invoked=1,p.TriggerCharacter=2,p.TriggerForIncompleteCompletions=3}(e.CompletionTriggerKind||(e.CompletionTriggerKind={})),function(p){p.method="textDocument/completion",p.type=new t.ProtocolRequestType(p.method)}(e.CompletionRequest||(e.CompletionRequest={})),function(p){p.method="completionItem/resolve",p.type=new t.ProtocolRequestType(p.method)}(e.CompletionResolveRequest||(e.CompletionResolveRequest={})),function(p){p.method="textDocument/hover",p.type=new t.ProtocolRequestType(p.method)}(e.HoverRequest||(e.HoverRequest={})),function(p){p.Invoked=1,p.TriggerCharacter=2,p.ContentChange=3}(e.SignatureHelpTriggerKind||(e.SignatureHelpTriggerKind={})),function(p){p.method="textDocument/signatureHelp",p.type=new t.ProtocolRequestType(p.method)}(e.SignatureHelpRequest||(e.SignatureHelpRequest={})),function(p){p.method="textDocument/definition",p.type=new t.ProtocolRequestType(p.method)}(e.DefinitionRequest||(e.DefinitionRequest={})),function(p){p.method="textDocument/references",p.type=new t.ProtocolRequestType(p.method)}(e.ReferencesRequest||(e.ReferencesRequest={})),function(p){p.method="textDocument/documentHighlight",p.type=new t.ProtocolRequestType(p.method)}(e.DocumentHighlightRequest||(e.DocumentHighlightRequest={})),function(p){p.method="textDocument/documentSymbol",p.type=new t.ProtocolRequestType(p.method)}(e.DocumentSymbolRequest||(e.DocumentSymbolRequest={})),function(p){p.method="textDocument/codeAction",p.type=new t.ProtocolRequestType(p.method)}(e.CodeActionRequest||(e.CodeActionRequest={})),function(p){p.method="codeAction/resolve",p.type=new t.ProtocolRequestType(p.method)}(e.CodeActionResolveRequest||(e.CodeActionResolveRequest={})),function(p){p.method="workspace/symbol",p.type=new t.ProtocolRequestType(p.method)}(e.WorkspaceSymbolRequest||(e.WorkspaceSymbolRequest={})),function(p){p.method="workspaceSymbol/resolve",p.type=new t.ProtocolRequestType(p.method)}(e.WorkspaceSymbolResolveRequest||(e.WorkspaceSymbolResolveRequest={})),function(p){p.method="textDocument/codeLens",p.type=new t.ProtocolRequestType(p.method)}(e.CodeLensRequest||(e.CodeLensRequest={})),function(p){p.method="codeLens/resolve",p.type=new t.ProtocolRequestType(p.method)}(e.CodeLensResolveRequest||(e.CodeLensResolveRequest={})),function(p){p.method="workspace/codeLens/refresh",p.type=new t.ProtocolRequestType0(p.method)}(e.CodeLensRefreshRequest||(e.CodeLensRefreshRequest={})),function(p){p.method="textDocument/documentLink",p.type=new t.ProtocolRequestType(p.method)}(e.DocumentLinkRequest||(e.DocumentLinkRequest={})),function(p){p.method="documentLink/resolve",p.type=new t.ProtocolRequestType(p.method)}(e.DocumentLinkResolveRequest||(e.DocumentLinkResolveRequest={})),function(p){p.method="textDocument/formatting",p.type=new t.ProtocolRequestType(p.method)}(e.DocumentFormattingRequest||(e.DocumentFormattingRequest={})),function(p){p.method="textDocument/rangeFormatting",p.type=new t.ProtocolRequestType(p.method)}(e.DocumentRangeFormattingRequest||(e.DocumentRangeFormattingRequest={})),function(p){p.method="textDocument/onTypeFormatting",p.type=new t.ProtocolRequestType(p.method)}(e.DocumentOnTypeFormattingRequest||(e.DocumentOnTypeFormattingRequest={})),function(p){p.Identifier=1}(e.PrepareSupportDefaultBehavior||(e.PrepareSupportDefaultBehavior={})),function(p){p.method="textDocument/rename",p.type=new t.ProtocolRequestType(p.method)}(e.RenameRequest||(e.RenameRequest={})),function(p){p.method="textDocument/prepareRename",p.type=new t.ProtocolRequestType(p.method)}(e.PrepareRenameRequest||(e.PrepareRenameRequest={})),function(p){p.type=new t.ProtocolRequestType("workspace/executeCommand")}(e.ExecuteCommandRequest||(e.ExecuteCommandRequest={})),function(p){p.type=new t.ProtocolRequestType("workspace/applyEdit")}(e.ApplyWorkspaceEditRequest||(e.ApplyWorkspaceEditRequest={}))}(Ts);var Zn={};Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.createProtocolConnection=void 0;const Qs=Mt;function Pc(e,t,n,i){return Qs.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,Qs.createMessageConnection)(e,t,n,i)}Zn.createProtocolConnection=Pc,function(e){var t=je&&je.__createBinding||(Object.create?function(r,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(r,a,c)}:function(r,o,s,a){a===void 0&&(a=s),r[a]=o[s]}),n=je&&je.__exportStar||function(r,o){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,n(Mt,e),n(oo,e),n(pe,e),n(Ts,e);var i=Zn;Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:function(){return i.createProtocolConnection}}),function(r){r.lspReservedErrorRangeStart=-32899,r.RequestFailed=-32803,r.ServerCancelled=-32802,r.ContentModified=-32801,r.RequestCancelled=-32800,r.lspReservedErrorRangeEnd=-32800}(e.LSPErrorCodes||(e.LSPErrorCodes={}))}(Ds),function(e){var t=je&&je.__createBinding||(Object.create?function(o,s,a,c){c===void 0&&(c=a);var d=Object.getOwnPropertyDescriptor(s,a);(!d||("get"in d?!s.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return s[a]}}),Object.defineProperty(o,c,d)}:function(o,s,a,c){c===void 0&&(c=a),o[c]=s[a]}),n=je&&je.__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 i=Yi.exports;n(Yi.exports,e),n(Ds,e);function r(o,s,a,c){return(0,i.createMessageConnection)(o,s,a,c)}e.createProtocolConnection=r}(re);var ei={},Ze={};Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.forEach=Ze.mapAsync=Ze.map=Ze.Semaphore=Ze.Delayer=void 0;const Tn=re;class kc{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(i=>{this.onSuccess=i}).then(()=>{this.completionPromise=void 0,this.onSuccess=void 0;var i=this.task();return this.task=void 0,i})),(n>=0||this.timeout===void 0)&&(this.timeout=(0,Tn.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)}}Ze.Delayer=kc;class Fc{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,i)=>{this._waiting.push({thunk:t,resolve:n,reject:i}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,Tn.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(i=>{this._active--,t.resolve(i),this.runNext()},i=>{this._active--,t.reject(i),this.runNext()}):(this._active--,t.resolve(n),this.runNext())}catch(n){this._active--,t.reject(n),this.runNext()}}}Ze.Semaphore=Fc;const Gs=15;class so{constructor(t=Gs){this.yieldAfter=Math.max(t,Gs),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 qc(e,t,n,i){if(e.length===0)return[];const r=new Array(e.length),o=new so(i?.yieldAfter);function s(c){o.start();for(let d=c;d<e.length;d++)if(r[d]=t(e[d]),o.shouldYield())return i?.yieldCallback&&i.yieldCallback(),d+1;return-1}let a=s(0);for(;a!==-1&&!(n!==void 0&&n.isCancellationRequested);)a=await new Promise(c=>{(0,Tn.RAL)().timer.setImmediate(()=>{c(s(a))})});return r}Ze.map=qc;async function Ec(e,t,n,i){if(e.length===0)return[];const r=new Array(e.length),o=new so(i?.yieldAfter);async function s(c){o.start();for(let d=c;d<e.length;d++)if(r[d]=await t(e[d],n),o.shouldYield())return i?.yieldCallback&&i.yieldCallback(),d+1;return-1}let a=await s(0);for(;a!==-1&&!(n!==void 0&&n.isCancellationRequested);)a=await new Promise(c=>{(0,Tn.RAL)().timer.setImmediate(()=>{c(s(a))})});return r}Ze.mapAsync=Ec;async function Oc(e,t,n,i){if(e.length===0)return;const r=new so(i?.yieldAfter);function o(a){r.start();for(let c=a;c<e.length;c++)if(t(e[c]),r.shouldYield())return i?.yieldCallback&&i.yieldCallback(),c+1;return-1}let s=o(0);for(;s!==-1&&!(n!==void 0&&n.isCancellationRequested);)s=await new Promise(a=>{(0,Tn.RAL)().timer.setImmediate(()=>{a(o(s))})})}Ze.forEach=Oc;var ti={};Object.defineProperty(ti,"__esModule",{value:!0});const Nc=ne.default;class Ic extends Nc.CompletionItem{constructor(t){super(t)}}ti.default=Ic;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});const Mc=ne.default;class Lc extends Mc.CodeLens{constructor(t){super(t)}}ni.default=Lc;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});const jc=ne.default;class Ac extends jc.DocumentLink{constructor(t,n){super(t,n)}}ii.default=Ac;var ri={};Object.defineProperty(ri,"__esModule",{value:!0});const Hc=ne.default;class $c extends Hc.CodeAction{constructor(t,n){super(t),this.data=n}}ri.default=$c;var ao={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProtocolDiagnostic=e.DiagnosticCode=void 0;const t=ne.default,n=_e;(function(r){function o(s){const a=s;return a!=null&&(n.number(a.value)||n.string(a.value))&&n.string(a.target)}r.is=o})(e.DiagnosticCode||(e.DiagnosticCode={}));class i extends t.Diagnostic{constructor(o,s,a,c){super(o,s,a),this.data=c,this.hasDiagnosticCode=!1}}e.ProtocolDiagnostic=i})(ao);var oi={};Object.defineProperty(oi,"__esModule",{value:!0});const Wc=ne.default;class Uc extends Wc.CallHierarchyItem{constructor(t,n,i,r,o,s,a){super(t,n,i,r,o,s),a!==void 0&&(this.data=a)}}oi.default=Uc;var si={};Object.defineProperty(si,"__esModule",{value:!0});const Kc=ne.default;class zc extends Kc.TypeHierarchyItem{constructor(t,n,i,r,o,s,a){super(t,n,i,r,o,s),a!==void 0&&(this.data=a)}}si.default=zc;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});const ci=ne.default;class xc extends ci.SymbolInformation{constructor(t,n,i,r,o){const s=!(r instanceof ci.Uri);super(t,n,i,s?r:new ci.Location(r,new ci.Range(0,0,0,0))),this.hasRange=s,o!==void 0&&(this.data=o)}}ai.default=xc;var ui={};Object.defineProperty(ui,"__esModule",{value:!0});const Bc=ne.default;class Vc extends Bc.InlayHint{constructor(t,n,i){super(t,n,i)}}ui.default=Vc,Object.defineProperty(ei,"__esModule",{value:!0}),ei.createConverter=void 0;const Ae=ne.default,se=re,tn=_e,Xs=Ze,Jc=ti,Qc=ni,Gc=ii,Xc=ri,Ys=ao,Yc=oi,Zc=si,eu=ai,tu=ui;var co;(function(e){function t(n){const i=n;return i&&!!i.inserting&&!!i.replacing}e.is=t})(co||(co={}));function nu(e){const n=e||(f=>f.toString());function i(f){return n(f)}function r(f){return{uri:n(f.uri)}}function o(f){return{uri:n(f.uri),languageId:f.languageId,version:f.version,text:f.getText()}}function s(f){return{uri:n(f.uri),version:f.version}}function a(f){return{textDocument:o(f)}}function c(f){let T=f;return!!T.document&&!!T.contentChanges}function d(f){let T=f;return!!T.uri&&!!T.version}function m(f){if(d(f))return{textDocument:{uri:n(f.uri),version:f.version},contentChanges:[{text:f.getText()}]};if(c(f)){let T=f.document;return{textDocument:{uri:n(T.uri),version:T.version},contentChanges:f.contentChanges.map(de=>{let ce=de.range;return{range:{start:{line:ce.start.line,character:ce.start.character},end:{line:ce.end.line,character:ce.end.character}},rangeLength:de.rangeLength,text:de.text}})}}else throw Error("Unsupported text document change parameter")}function g(f){return{textDocument:r(f)}}function l(f,T=!1){let J={textDocument:r(f)};return T&&(J.text=f.getText()),J}function h(f){switch(f){case Ae.TextDocumentSaveReason.Manual:return se.TextDocumentSaveReason.Manual;case Ae.TextDocumentSaveReason.AfterDelay:return se.TextDocumentSaveReason.AfterDelay;case Ae.TextDocumentSaveReason.FocusOut:return se.TextDocumentSaveReason.FocusOut}return se.TextDocumentSaveReason.Manual}function y(f){return{textDocument:r(f.document),reason:h(f.reason)}}function P(f){return{files:f.files.map(T=>({uri:n(T)}))}}function I(f){return{files:f.files.map(T=>({oldUri:n(T.oldUri),newUri:n(T.newUri)}))}}function N(f){return{files:f.files.map(T=>({uri:n(T)}))}}function w(f){return{files:f.files.map(T=>({uri:n(T)}))}}function S(f){return{files:f.files.map(T=>({oldUri:n(T.oldUri),newUri:n(T.newUri)}))}}function j(f){return{files:f.files.map(T=>({uri:n(T)}))}}function A(f,T){return{textDocument:r(f),position:O(T)}}function G(f){switch(f){case Ae.CompletionTriggerKind.TriggerCharacter:return se.CompletionTriggerKind.TriggerCharacter;case Ae.CompletionTriggerKind.TriggerForIncompleteCompletions:return se.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return se.CompletionTriggerKind.Invoked}}function V(f,T,J){return{textDocument:r(f),position:O(T),context:{triggerKind:G(J.triggerKind),triggerCharacter:J.triggerCharacter}}}function k(f){switch(f){case Ae.SignatureHelpTriggerKind.Invoke:return se.SignatureHelpTriggerKind.Invoked;case Ae.SignatureHelpTriggerKind.TriggerCharacter:return se.SignatureHelpTriggerKind.TriggerCharacter;case Ae.SignatureHelpTriggerKind.ContentChange:return se.SignatureHelpTriggerKind.ContentChange}}function K(f){return{label:f.label}}function W(f){return f.map(K)}function U(f){return{label:f.label,parameters:W(f.parameters)}}function p(f){return f.map(U)}function M(f){return f===void 0?f:{signatures:p(f.signatures),activeSignature:f.activeSignature,activeParameter:f.activeParameter}}function Y(f,T,J){return{textDocument:r(f),position:O(T),context:{isRetrigger:J.isRetrigger,triggerCharacter:J.triggerCharacter,triggerKind:k(J.triggerKind),activeSignatureHelp:M(J.activeSignatureHelp)}}}function O(f){return{line:f.line,character:f.character}}function x(f){return f==null?f:{line:f.line>se.uinteger.MAX_VALUE?se.uinteger.MAX_VALUE:f.line,character:f.character>se.uinteger.MAX_VALUE?se.uinteger.MAX_VALUE:f.character}}function Z(f,T){return Xs.map(f,x,T)}function Ce(f){return f==null?f:{start:x(f.start),end:x(f.end)}}function Me(f){return f==null?f:se.Location.create(i(f.uri),Ce(f.range))}function Ge(f){switch(f){case Ae.DiagnosticSeverity.Error:return se.DiagnosticSeverity.Error;case Ae.DiagnosticSeverity.Warning:return se.DiagnosticSeverity.Warning;case Ae.DiagnosticSeverity.Information:return se.DiagnosticSeverity.Information;case Ae.DiagnosticSeverity.Hint:return se.DiagnosticSeverity.Hint}}function et(f){if(!f)return;let T=[];for(let J of f){let de=He(J);de!==void 0&&T.push(de)}return T.length>0?T:void 0}function He(f){switch(f){case Ae.DiagnosticTag.Unnecessary:return se.DiagnosticTag.Unnecessary;case Ae.DiagnosticTag.Deprecated:return se.DiagnosticTag.Deprecated;default:return}}function Ue(f){return{message:f.message,location:Me(f.location)}}function rt(f){return f.map(Ue)}function gt(f){if(f!=null)return tn.number(f)||tn.string(f)?f:{value:f.value,target:i(f.target)}}function Ke(f){const T=se.Diagnostic.create(Ce(f.range),f.message),J=f instanceof Ys.ProtocolDiagnostic?f:void 0;J!==void 0&&J.data!==void 0&&(T.data=J.data);const de=gt(f.code);return Ys.DiagnosticCode.is(de)?J!==void 0&&J.hasDiagnosticCode?T.code=de:(T.code=de.value,T.codeDescription={href:de.target}):T.code=de,tn.number(f.severity)&&(T.severity=Ge(f.severity)),Array.isArray(f.tags)&&(T.tags=et(f.tags)),f.relatedInformation&&(T.relatedInformation=rt(f.relatedInformation)),f.source&&(T.source=f.source),T}function ge(f,T){return f==null?f:Xs.map(f,Ke,T)}function ze(f,T){switch(f){case"$string":return T;case se.MarkupKind.PlainText:return{kind:f,value:T};case se.MarkupKind.Markdown:return{kind:f,value:T.value};default:return`Unsupported Markup content received. Kind is: ${f}`}}function we(f){switch(f){case Ae.CompletionItemTag.Deprecated:return se.CompletionItemTag.Deprecated}}function Ie(f){if(f===void 0)return f;const T=[];for(let J of f){const de=we(J);de!==void 0&&T.push(de)}return T}function ut(f,T){return T!==void 0?T:f+1}function ot(f,T=!1){let J,de;tn.string(f.label)?J=f.label:(J=f.label.label,T&&(f.label.detail!==void 0||f.label.description!==void 0)&&(de={detail:f.label.detail,description:f.label.description}));let ce={label:J};de!==void 0&&(ce.labelDetails=de);let $e=f instanceof Jc.default?f:void 0;f.detail&&(ce.detail=f.detail),f.documentation&&(!$e||$e.documentationFormat==="$string"?ce.documentation=f.documentation:ce.documentation=ze($e.documentationFormat,f.documentation)),f.filterText&&(ce.filterText=f.filterText),ie(ce,f),tn.number(f.kind)&&(ce.kind=ut(f.kind,$e&&$e.originalItemKind)),f.sortText&&(ce.sortText=f.sortText),f.additionalTextEdits&&(ce.additionalTextEdits=pt(f.additionalTextEdits)),f.commitCharacters&&(ce.commitCharacters=f.commitCharacters.slice()),f.command&&(ce.command=ue(f.command)),(f.preselect===!0||f.preselect===!1)&&(ce.preselect=f.preselect);const mt=Ie(f.tags);if($e){if($e.data!==void 0&&(ce.data=$e.data),$e.deprecated===!0||$e.deprecated===!1){if($e.deprecated===!0&&mt!==void 0&&mt.length>0){const yt=mt.indexOf(Ae.CompletionItemTag.Deprecated);yt!==-1&&mt.splice(yt,1)}ce.deprecated=$e.deprecated}$e.insertTextMode!==void 0&&(ce.insertTextMode=$e.insertTextMode)}return mt!==void 0&&mt.length>0&&(ce.tags=mt),ce.insertTextMode===void 0&&f.keepWhitespace===!0&&(ce.insertTextMode=se.InsertTextMode.adjustIndentation),ce}function ie(f,T){let J=se.InsertTextFormat.PlainText,de,ce;T.textEdit?(de=T.textEdit.newText,ce=T.textEdit.range):T.insertText instanceof Ae.SnippetString?(J=se.InsertTextFormat.Snippet,de=T.insertText.value):de=T.insertText,T.range&&(ce=T.range),f.insertTextFormat=J,T.fromEdit&&de!==void 0&&ce!==void 0?f.textEdit=Xe(de,ce):f.insertText=de}function Xe(f,T){return co.is(T)?se.InsertReplaceEdit.create(f,Ce(T.inserting),Ce(T.replacing)):{newText:f,range:Ce(T)}}function vt(f){return{range:Ce(f.range),newText:f.newText}}function pt(f){return f==null?f:f.map(vt)}function Ye(f){return f<=Ae.SymbolKind.TypeParameter?f+1:se.SymbolKind.Property}function X(f){return f}function C(f){return f.map(X)}function R(f,T,J){return{textDocument:r(f),position:O(T),context:{includeDeclaration:J.includeDeclaration}}}async function b(f,T){let J=se.CodeAction.create(f.title);if(f instanceof Xc.default&&f.data!==void 0&&(J.data=f.data),f.kind!==void 0&&(J.kind=H(f.kind)),f.diagnostics!==void 0&&(J.diagnostics=await ge(f.diagnostics,T)),f.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return f.command!==void 0&&(J.command=ue(f.command)),f.isPreferred!==void 0&&(J.isPreferred=f.isPreferred),f.disabled!==void 0&&(J.disabled={reason:f.disabled.reason}),J}async function L(f,T){if(f==null)return f;let J;return f.only&&tn.string(f.only.value)&&(J=[f.only.value]),se.CodeActionContext.create(await ge(f.diagnostics,T),J,E(f.triggerKind))}function E(f){switch(f){case Ae.CodeActionTriggerKind.Invoke:return se.CodeActionTriggerKind.Invoked;case Ae.CodeActionTriggerKind.Automatic:return se.CodeActionTriggerKind.Automatic;default:return}}function H(f){if(f!=null)return f.value}function ee(f){return f==null?f:se.InlineValueContext.create(f.frameId,Ce(f.stoppedLocation))}function ue(f){let T=se.Command.create(f.title,f.command);return f.arguments&&(T.arguments=f.arguments),T}function De(f){let T=se.CodeLens.create(Ce(f.range));return f.command&&(T.command=ue(f.command)),f instanceof Qc.default&&f.data&&(T.data=f.data),T}function ke(f,T){const J={tabSize:f.tabSize,insertSpaces:f.insertSpaces};return T.trimTrailingWhitespace&&(J.trimTrailingWhitespace=!0),T.trimFinalNewlines&&(J.trimFinalNewlines=!0),T.insertFinalNewline&&(J.insertFinalNewline=!0),J}function Ct(f){return{textDocument:r(f)}}function Ft(f){return{textDocument:r(f)}}function ln(f){let T=se.DocumentLink.create(Ce(f.range));f.target&&(T.target=i(f.target)),f.tooltip!==void 0&&(T.tooltip=f.tooltip);let J=f instanceof Gc.default?f:void 0;return J&&J.data&&(T.data=J.data),T}function Bt(f){return{textDocument:r(f)}}function Vt(f){const T={name:f.name,kind:Ye(f.kind),uri:i(f.uri),range:Ce(f.range),selectionRange:Ce(f.selectionRange)};return f.detail!==void 0&&f.detail.length>0&&(T.detail=f.detail),f.tags!==void 0&&(T.tags=C(f.tags)),f instanceof Yc.default&&f.data!==void 0&&(T.data=f.data),T}function fn(f){const T={name:f.name,kind:Ye(f.kind),uri:i(f.uri),range:Ce(f.range),selectionRange:Ce(f.selectionRange)};return f.detail!==void 0&&f.detail.length>0&&(T.detail=f.detail),f.tags!==void 0&&(T.tags=C(f.tags)),f instanceof Zc.default&&f.data!==void 0&&(T.data=f.data),T}function st(f){const T=f instanceof eu.default?{name:f.name,kind:Ye(f.kind),location:f.hasRange?Me(f.location):{uri:n(f.location.uri)},data:f.data}:{name:f.name,kind:Ye(f.kind),location:Me(f.location)};return f.tags!==void 0&&(T.tags=C(f.tags)),f.containerName!==""&&(T.containerName=f.containerName),T}function hn(f){const T=typeof f.label=="string"?f.label:f.label.map(Jt),J=se.InlayHint.create(x(f.position),T);return f.kind!==void 0&&(J.kind=f.kind),f.textEdits!==void 0&&(J.textEdits=pt(f.textEdits)),f.tooltip!==void 0&&(J.tooltip=_t(f.tooltip)),f.paddingLeft!==void 0&&(J.paddingLeft=f.paddingLeft),f.paddingRight!==void 0&&(J.paddingRight=f.paddingRight),f instanceof tu.default&&f.data!==void 0&&(J.data=f.data),J}function Jt(f){const T=se.InlayHintLabelPart.create(f.value);return f.location!==void 0&&(T.location=Me(f.location)),f.command!==void 0&&(T.command=ue(f.command)),f.tooltip!==void 0&&(T.tooltip=_t(f.tooltip)),T}function _t(f){return typeof f=="string"?f:{kind:se.MarkupKind.Markdown,value:f.value}}return{asUri:i,asTextDocumentIdentifier:r,asTextDocumentItem:o,asVersionedTextDocumentIdentifier:s,asOpenTextDocumentParams:a,asChangeTextDocumentParams:m,asCloseTextDocumentParams:g,asSaveTextDocumentParams:l,asWillSaveTextDocumentParams:y,asDidCreateFilesParams:P,asDidRenameFilesParams:I,asDidDeleteFilesParams:N,asWillCreateFilesParams:w,asWillRenameFilesParams:S,asWillDeleteFilesParams:j,asTextDocumentPositionParams:A,asCompletionParams:V,asSignatureHelpParams:Y,asWorkerPosition:O,asRange:Ce,asPosition:x,asPositions:Z,asLocation:Me,asDiagnosticSeverity:Ge,asDiagnosticTag:He,asDiagnostic:Ke,asDiagnostics:ge,asCompletionItem:ot,asTextEdit:vt,asSymbolKind:Ye,asSymbolTag:X,asSymbolTags:C,asReferenceParams:R,asCodeAction:b,asCodeActionContext:L,asInlineValueContext:ee,asCommand:ue,asCodeLens:De,asFormattingOptions:ke,asDocumentSymbolParams:Ct,asCodeLensParams:Ft,asDocumentLink:ln,asDocumentLinkParams:Bt,asCallHierarchyItem:Vt,asTypeHierarchyItem:fn,asInlayHint:hn,asWorkspaceSymbol:st}}ei.createConverter=nu;var di={};Object.defineProperty(di,"__esModule",{value:!0}),di.createConverter=void 0;const z=ne.default,te=re,lt=_e,be=Ze,iu=ti,ru=ni,ou=ii,su=ri,Zs=ao,au=oi,cu=si,uu=ai,du=ui,ea=re;var li;(function(e){function t(n){let i=n;return i&&lt.string(i.language)&&lt.string(i.value)}e.is=t})(li||(li={}));function lu(e,t,n){const r=e||(u=>z.Uri.parse(u));function o(u){return r(u)}function s(u){const _=[];for(const F of u)if(typeof F=="string")_.push(F);else if(ea.NotebookCellTextDocumentFilter.is(F))if(typeof F.notebook=="string")_.push({notebookType:F.notebook,language:F.language});else{const B=F.notebook.notebookType??"*";_.push({notebookType:B,scheme:F.notebook.scheme,pattern:F.notebook.pattern,language:F.language})}else ea.TextDocumentFilter.is(F)&&_.push({language:F.language,scheme:F.scheme,pattern:F.pattern});return _}async function a(u,_){return be.map(u,d,_)}function c(u){const _=new Array(u.length);for(let F=0;F<u.length;F++)_[F]=d(u[F]);return _}function d(u){let _=new Zs.ProtocolDiagnostic(y(u.range),u.message,I(u.severity),u.data);if(u.code!==void 0){if(typeof u.code=="string"||typeof u.code=="number")te.CodeDescription.is(u.codeDescription)?_.code={value:u.code,target:o(u.codeDescription.href)}:_.code=u.code;else if(Zs.DiagnosticCode.is(u.code)){_.hasDiagnosticCode=!0;const F=u.code;_.code={value:F.value,target:o(F.target)}}}return u.source&&(_.source=u.source),u.relatedInformation&&(_.relatedInformation=m(u.relatedInformation)),Array.isArray(u.tags)&&(_.tags=g(u.tags)),_}function m(u){const _=new Array(u.length);for(let F=0;F<u.length;F++){const B=u[F];_[F]=new z.DiagnosticRelatedInformation(He(B.location),B.message)}return _}function g(u){if(!u)return;let _=[];for(let F of u){let B=l(F);B!==void 0&&_.push(B)}return _.length>0?_:void 0}function l(u){switch(u){case te.DiagnosticTag.Unnecessary:return z.DiagnosticTag.Unnecessary;case te.DiagnosticTag.Deprecated:return z.DiagnosticTag.Deprecated;default:return}}function h(u){return u?new z.Position(u.line,u.character):void 0}function y(u){return u?new z.Range(u.start.line,u.start.character,u.end.line,u.end.character):void 0}async function P(u,_){return be.map(u,F=>new z.Range(F.start.line,F.start.character,F.end.line,F.end.character),_)}function I(u){if(u==null)return z.DiagnosticSeverity.Error;switch(u){case te.DiagnosticSeverity.Error:return z.DiagnosticSeverity.Error;case te.DiagnosticSeverity.Warning:return z.DiagnosticSeverity.Warning;case te.DiagnosticSeverity.Information:return z.DiagnosticSeverity.Information;case te.DiagnosticSeverity.Hint:return z.DiagnosticSeverity.Hint}return z.DiagnosticSeverity.Error}function N(u){if(lt.string(u))return S(u);if(li.is(u))return S().appendCodeblock(u.value,u.language);if(Array.isArray(u)){let _=[];for(let F of u){let B=S();li.is(F)?B.appendCodeblock(F.value,F.language):B.appendMarkdown(F),_.push(B)}return _}else return S(u)}function w(u){if(lt.string(u))return u;switch(u.kind){case te.MarkupKind.Markdown:return S(u.value);case te.MarkupKind.PlainText:return u.value;default:return`Unsupported Markup content received. Kind is: ${u.kind}`}}function S(u){let _;if(u===void 0||typeof u=="string")_=new z.MarkdownString(u);else switch(u.kind){case te.MarkupKind.Markdown:_=new z.MarkdownString(u.value);break;case te.MarkupKind.PlainText:_=new z.MarkdownString,_.appendText(u.value);break;default:_=new z.MarkdownString,_.appendText(`Unsupported Markup content received. Kind is: ${u.kind}`);break}return _.isTrusted=t,_.supportHtml=n,_}function j(u){if(!!u)return new z.Hover(N(u.contents),y(u.range))}async function A(u,_,F){if(!u)return;if(Array.isArray(u))return be.map(u,bt=>W(bt,_),F);const B=u,{defaultRange:tt,commitCharacters:xe}=G(B,_),Re=await be.map(B.items,bt=>W(bt,xe,tt,B.itemDefaults?.insertTextMode,B.itemDefaults?.insertTextFormat,B.itemDefaults?.data),F);return new z.CompletionList(Re,B.isIncomplete)}function G(u,_){const F=u.itemDefaults?.editRange,B=u.itemDefaults?.commitCharacters??_;return te.Range.is(F)?{defaultRange:y(F),commitCharacters:B}:F!==void 0?{defaultRange:{inserting:y(F.insert),replacing:y(F.replace)},commitCharacters:B}:{defaultRange:void 0,commitCharacters:B}}function V(u){return te.CompletionItemKind.Text<=u&&u<=te.CompletionItemKind.TypeParameter?[u-1,void 0]:[z.CompletionItemKind.Text,u]}function k(u){switch(u){case te.CompletionItemTag.Deprecated:return z.CompletionItemTag.Deprecated}}function K(u){if(u==null)return[];const _=[];for(const F of u){const B=k(F);B!==void 0&&_.push(B)}return _}function W(u,_,F,B,tt,xe){const Re=K(u.tags),bt=U(u),Pe=new iu.default(bt);u.detail&&(Pe.detail=u.detail),u.documentation&&(Pe.documentation=w(u.documentation),Pe.documentationFormat=lt.string(u.documentation)?"$string":u.documentation.kind),u.filterText&&(Pe.filterText=u.filterText);const Kn=p(u,F,tt);if(Kn&&(Pe.insertText=Kn.text,Pe.range=Kn.range,Pe.fromEdit=Kn.fromEdit),lt.number(u.kind)){let[La,ns]=V(u.kind);Pe.kind=La,ns&&(Pe.originalItemKind=ns)}u.sortText&&(Pe.sortText=u.sortText),u.additionalTextEdits&&(Pe.additionalTextEdits=x(u.additionalTextEdits));const es=u.commitCharacters!==void 0?lt.stringArray(u.commitCharacters)?u.commitCharacters:void 0:_;es&&(Pe.commitCharacters=es.slice()),u.command&&(Pe.command=C(u.command)),(u.deprecated===!0||u.deprecated===!1)&&(Pe.deprecated=u.deprecated,u.deprecated===!0&&Re.push(z.CompletionItemTag.Deprecated)),(u.preselect===!0||u.preselect===!1)&&(Pe.preselect=u.preselect);const ts=u.data??xe;ts!==void 0&&(Pe.data=ts),Re.length>0&&(Pe.tags=Re);const Gi=u.insertTextMode??B;return Gi!==void 0&&(Pe.insertTextMode=Gi,Gi===te.InsertTextMode.asIs&&(Pe.keepWhitespace=!0)),Pe}function U(u){return te.CompletionItemLabelDetails.is(u.labelDetails)?{label:u.label,detail:u.labelDetails.detail,description:u.labelDetails.description}:u.label}function p(u,_,F){const B=u.insertTextFormat??F;if(u.textEdit!==void 0||_!==void 0){const[tt,xe]=u.textEdit!==void 0?M(u.textEdit):[_,u.textEditText??u.label];return B===te.InsertTextFormat.Snippet?{text:new z.SnippetString(xe),range:tt,fromEdit:!0}:{text:xe,range:tt,fromEdit:!0}}else return u.insertText?B===te.InsertTextFormat.Snippet?{text:new z.SnippetString(u.insertText),fromEdit:!1}:{text:u.insertText,fromEdit:!1}:void 0}function M(u){return te.InsertReplaceEdit.is(u)?[{inserting:y(u.insert),replacing:y(u.replace)},u.newText]:[y(u.range),u.newText]}function Y(u){if(!!u)return new z.TextEdit(y(u.range),u.newText)}async function O(u,_){if(!!u)return be.map(u,Y,_)}function x(u){if(!u)return;const _=new Array(u.length);for(let F=0;F<u.length;F++)_[F]=Y(u[F]);return _}async function Z(u,_){if(!u)return;let F=new z.SignatureHelp;return lt.number(u.activeSignature)?F.activeSignature=u.activeSignature:F.activeSignature=0,lt.number(u.activeParameter)?F.activeParameter=u.activeParameter:F.activeParameter=0,u.signatures&&(F.signatures=await Ce(u.signatures,_)),F}async function Ce(u,_){return be.mapAsync(u,Me,_)}async function Me(u,_){let F=new z.SignatureInformation(u.label);return u.documentation!==void 0&&(F.documentation=w(u.documentation)),u.parameters!==void 0&&(F.parameters=await Ge(u.parameters,_)),u.activeParameter!==void 0&&(F.activeParameter=u.activeParameter),F}function Ge(u,_){return be.map(u,et,_)}function et(u){let _=new z.ParameterInformation(u.label);return u.documentation&&(_.documentation=w(u.documentation)),_}function He(u){return u?new z.Location(r(u.uri),y(u.range)):void 0}async function Ue(u,_){if(!!u)return Ke(u,_)}async function rt(u,_){if(!!u)return Ke(u,_)}function gt(u){if(!u)return;let _={targetUri:r(u.targetUri),targetRange:y(u.targetRange),originSelectionRange:y(u.originSelectionRange),targetSelectionRange:y(u.targetSelectionRange)};if(!_.targetSelectionRange)throw new Error("targetSelectionRange must not be undefined or null");return _}async function Ke(u,_){if(!!u)if(lt.array(u)){if(u.length===0)return[];if(te.LocationLink.is(u[0])){const F=u;return be.map(F,gt,_)}else{const F=u;return be.map(F,He,_)}}else return te.LocationLink.is(u)?[gt(u)]:He(u)}async function ge(u,_){if(!!u)return be.map(u,He,_)}async function ze(u,_){if(!!u)return be.map(u,we,_)}function we(u){let _=new z.DocumentHighlight(y(u.range));return lt.number(u.kind)&&(_.kind=Ie(u.kind)),_}function Ie(u){switch(u){case te.DocumentHighlightKind.Text:return z.DocumentHighlightKind.Text;case te.DocumentHighlightKind.Read:return z.DocumentHighlightKind.Read;case te.DocumentHighlightKind.Write:return z.DocumentHighlightKind.Write}return z.DocumentHighlightKind.Text}async function ut(u,_){if(!!u)return be.map(u,vt,_)}function ot(u){return u<=te.SymbolKind.TypeParameter?u-1:z.SymbolKind.Property}function ie(u){switch(u){case te.SymbolTag.Deprecated:return z.SymbolTag.Deprecated;default:return}}function Xe(u){if(u==null)return;const _=[];for(const F of u){const B=ie(F);B!==void 0&&_.push(B)}return _.length===0?void 0:_}function vt(u){const _=u.data,F=u.location,B=F.range===void 0||_!==void 0?new uu.default(u.name,ot(u.kind),u.containerName??"",F.range===void 0?r(F.uri):new z.Location(r(u.location.uri),y(F.range)),_):new z.SymbolInformation(u.name,ot(u.kind),u.containerName??"",new z.Location(r(u.location.uri),y(F.range)));return X(B,u),B}async function pt(u,_){if(u!=null)return be.map(u,Ye,_)}function Ye(u){let _=new z.DocumentSymbol(u.name,u.detail||"",ot(u.kind),y(u.range),y(u.selectionRange));if(X(_,u),u.children!==void 0&&u.children.length>0){let F=[];for(let B of u.children)F.push(Ye(B));_.children=F}return _}function X(u,_){u.tags=Xe(_.tags),_.deprecated&&(u.tags?u.tags.includes(z.SymbolTag.Deprecated)||(u.tags=u.tags.concat(z.SymbolTag.Deprecated)):u.tags=[z.SymbolTag.Deprecated])}function C(u){let _={title:u.title,command:u.command};return u.arguments&&(_.arguments=u.arguments),_}async function R(u,_){if(!!u)return be.map(u,C,_)}const b=new Map;b.set(te.CodeActionKind.Empty,z.CodeActionKind.Empty),b.set(te.CodeActionKind.QuickFix,z.CodeActionKind.QuickFix),b.set(te.CodeActionKind.Refactor,z.CodeActionKind.Refactor),b.set(te.CodeActionKind.RefactorExtract,z.CodeActionKind.RefactorExtract),b.set(te.CodeActionKind.RefactorInline,z.CodeActionKind.RefactorInline),b.set(te.CodeActionKind.RefactorRewrite,z.CodeActionKind.RefactorRewrite),b.set(te.CodeActionKind.Source,z.CodeActionKind.Source),b.set(te.CodeActionKind.SourceOrganizeImports,z.CodeActionKind.SourceOrganizeImports);function L(u){if(u==null)return;let _=b.get(u);if(_)return _;let F=u.split(".");_=z.CodeActionKind.Empty;for(let B of F)_=_.append(B);return _}function E(u){if(u!=null)return u.map(_=>L(_))}async function H(u,_){if(u==null)return;let F=new su.default(u.title,u.data);return u.kind!==void 0&&(F.kind=L(u.kind)),u.diagnostics!==void 0&&(F.diagnostics=c(u.diagnostics)),u.edit!==void 0&&(F.edit=await ke(u.edit,_)),u.command!==void 0&&(F.command=C(u.command)),u.isPreferred!==void 0&&(F.isPreferred=u.isPreferred),u.disabled!==void 0&&(F.disabled={reason:u.disabled.reason}),F}function ee(u,_){return be.mapAsync(u,async F=>te.Command.is(F)?C(F):H(F,_),_)}function ue(u){if(!u)return;let _=new ru.default(y(u.range));return u.command&&(_.command=C(u.command)),u.data!==void 0&&u.data!==null&&(_.data=u.data),_}async function De(u,_){if(!!u)return be.map(u,ue,_)}async function ke(u,_){if(!u)return;const F=new Map;if(u.changeAnnotations!==void 0){const xe=u.changeAnnotations;await be.forEach(Object.keys(xe),Re=>{const bt=Ct(xe[Re]);F.set(Re,bt)},_)}const B=xe=>{if(xe!==void 0)return F.get(xe)},tt=new z.WorkspaceEdit;if(u.documentChanges){const xe=u.documentChanges;await be.forEach(xe,Re=>{if(te.CreateFile.is(Re))tt.createFile(r(Re.uri),Re.options,B(Re.annotationId));else if(te.RenameFile.is(Re))tt.renameFile(r(Re.oldUri),r(Re.newUri),Re.options,B(Re.annotationId));else if(te.DeleteFile.is(Re))tt.deleteFile(r(Re.uri),Re.options,B(Re.annotationId));else if(te.TextDocumentEdit.is(Re)){const bt=r(Re.textDocument.uri);for(const Pe of Re.edits)te.AnnotatedTextEdit.is(Pe)?tt.replace(bt,y(Pe.range),Pe.newText,B(Pe.annotationId)):tt.replace(bt,y(Pe.range),Pe.newText)}else throw new Error(`Unknown workspace edit change received:
${JSON.stringify(Re,void 0,4)}`)},_)}else if(u.changes){const xe=u.changes;await be.forEach(Object.keys(xe),Re=>{tt.set(r(Re),x(xe[Re]))},_)}return tt}function Ct(u){if(u!==void 0)return{label:u.label,needsConfirmation:!!u.needsConfirmation,description:u.description}}function Ft(u){let _=y(u.range),F=u.target?o(u.target):void 0,B=new ou.default(_,F);return u.tooltip!==void 0&&(B.tooltip=u.tooltip),u.data!==void 0&&u.data!==null&&(B.data=u.data),B}async function ln(u,_){if(!!u)return be.map(u,Ft,_)}function Bt(u){return new z.Color(u.red,u.green,u.blue,u.alpha)}function Vt(u){return new z.ColorInformation(y(u.range),Bt(u.color))}async function fn(u,_){if(!!u)return be.map(u,Vt,_)}function st(u){let _=new z.ColorPresentation(u.label);return _.additionalTextEdits=x(u.additionalTextEdits),u.textEdit&&(_.textEdit=Y(u.textEdit)),_}async function hn(u,_){if(!!u)return be.map(u,st,_)}function Jt(u){if(u)switch(u){case te.FoldingRangeKind.Comment:return z.FoldingRangeKind.Comment;case te.FoldingRangeKind.Imports:return z.FoldingRangeKind.Imports;case te.FoldingRangeKind.Region:return z.FoldingRangeKind.Region}}function _t(u){return new z.FoldingRange(u.startLine,u.endLine,Jt(u.kind))}async function f(u,_){if(!!u)return be.map(u,_t,_)}function T(u){return new z.SelectionRange(y(u.range),u.parent?T(u.parent):void 0)}async function J(u,_){return Array.isArray(u)?be.map(u,T,_):[]}function de(u){return te.InlineValueText.is(u)?new z.InlineValueText(y(u.range),u.text):te.InlineValueVariableLookup.is(u)?new z.InlineValueVariableLookup(y(u.range),u.variableName,u.caseSensitiveLookup):new z.InlineValueEvaluatableExpression(y(u.range),u.expression)}async function ce(u,_){return Array.isArray(u)?be.map(u,de,_):[]}async function $e(u,_){const F=typeof u.label=="string"?u.label:await be.map(u.label,mt,_),B=new du.default(h(u.position),F);return u.kind!==void 0&&(B.kind=u.kind),u.textEdits!==void 0&&(B.textEdits=await O(u.textEdits,_)),u.tooltip!==void 0&&(B.tooltip=yt(u.tooltip)),u.paddingLeft!==void 0&&(B.paddingLeft=u.paddingLeft),u.paddingRight!==void 0&&(B.paddingRight=u.paddingRight),u.data!==void 0&&(B.data=u.data),B}function mt(u){const _=new z.InlayHintLabelPart(u.value);return u.location!==void 0&&(_.location=He(u.location)),u.tooltip!==void 0&&(_.tooltip=yt(u.tooltip)),u.command!==void 0&&(_.command=C(u.command)),_}function yt(u){return typeof u=="string"?u:S(u)}async function Un(u,_){if(!!Array.isArray(u))return be.mapAsync(u,$e,_)}function It(u){if(u===null)return;const _=new au.default(ot(u.kind),u.name,u.detail||"",o(u.uri),y(u.range),y(u.selectionRange),u.data);return u.tags!==void 0&&(_.tags=Xe(u.tags)),_}async function gn(u,_){if(u!==null)return be.map(u,It,_)}async function pn(u,_){return new z.CallHierarchyIncomingCall(It(u.from),await P(u.fromRanges,_))}async function qt(u,_){if(u!==null)return be.mapAsync(u,pn,_)}async function v(u,_){return new z.CallHierarchyOutgoingCall(It(u.to),await P(u.fromRanges,_))}async function q(u,_){if(u!==null)return be.mapAsync(u,v,_)}async function $(u,_){if(u!=null)return new z.SemanticTokens(new Uint32Array(u.data),u.resultId)}function Q(u){return new z.SemanticTokensEdit(u.start,u.deleteCount,u.data!==void 0?new Uint32Array(u.data):void 0)}async function Se(u,_){if(u!=null)return new z.SemanticTokensEdits(u.edits.map(Q),u.resultId)}function Te(u){return u}async function qe(u,_){if(u!=null)return new z.LinkedEditingRanges(await P(u.ranges,_),Le(u.wordPattern))}function Le(u){if(u!=null)return new RegExp(u)}function le(u){if(u===null)return;let _=new cu.default(ot(u.kind),u.name,u.detail||"",o(u.uri),y(u.range),y(u.selectionRange),u.data);return u.tags!==void 0&&(_.tags=Xe(u.tags)),_}async function Fe(u,_){if(u!==null)return be.map(u,le,_)}function ve(u){if(lt.string(u))return u;if(te.RelativePattern.is(u)){if(te.URI.is(u.baseUri))return new z.RelativePattern(o(u.baseUri),u.pattern);if(te.WorkspaceFolder.is(u.baseUri)){const _=z.workspace.getWorkspaceFolder(o(u.baseUri.uri));return _!==void 0?new z.RelativePattern(_,u.pattern):void 0}}}return{asUri:o,asDocumentSelector:s,asDiagnostics:a,asDiagnostic:d,asRange:y,asRanges:P,asPosition:h,asDiagnosticSeverity:I,asDiagnosticTag:l,asHover:j,asCompletionResult:A,asCompletionItem:W,asTextEdit:Y,asTextEdits:O,asSignatureHelp:Z,asSignatureInformations:Ce,asSignatureInformation:Me,asParameterInformations:Ge,asParameterInformation:et,asDeclarationResult:Ue,asDefinitionResult:rt,asLocation:He,asReferences:ge,asDocumentHighlights:ze,asDocumentHighlight:we,asDocumentHighlightKind:Ie,asSymbolKind:ot,asSymbolTag:ie,asSymbolTags:Xe,asSymbolInformations:ut,asSymbolInformation:vt,asDocumentSymbols:pt,asDocumentSymbol:Ye,asCommand:C,asCommands:R,asCodeAction:H,asCodeActionKind:L,asCodeActionKinds:E,asCodeActionResult:ee,asCodeLens:ue,asCodeLenses:De,asWorkspaceEdit:ke,asDocumentLink:Ft,asDocumentLinks:ln,asFoldingRangeKind:Jt,asFoldingRange:_t,asFoldingRanges:f,asColor:Bt,asColorInformation:Vt,asColorInformations:fn,asColorPresentation:st,asColorPresentations:hn,asSelectionRange:T,asSelectionRanges:J,asInlineValue:de,asInlineValues:ce,asInlayHint:$e,asInlayHints:Un,asSemanticTokensLegend:Te,asSemanticTokens:$,asSemanticTokensEdit:Q,asSemanticTokensEdits:Se,asCallHierarchyItem:It,asCallHierarchyItems:gn,asCallHierarchyIncomingCall:pn,asCallHierarchyIncomingCalls:qt,asCallHierarchyOutgoingCall:v,asCallHierarchyOutgoingCalls:q,asLinkedEditingRanges:qe,asTypeHierarchyItem:le,asTypeHierarchyItems:Fe,asGlobPattern:ve}}di.createConverter=lu;var me={};Object.defineProperty(me,"__esModule",{value:!0}),me.generateUuid=me.parse=me.isUUID=me.v4=me.empty=void 0;class uo{constructor(t){this._value=t}asHex(){return this._value}equals(t){return this.asHex()===t.asHex()}}class ae extends uo{constructor(){super([ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),"-",ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),"-","4",ae._randomHex(),ae._randomHex(),ae._randomHex(),"-",ae._oneOf(ae._timeHighBits),ae._randomHex(),ae._randomHex(),ae._randomHex(),"-",ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex(),ae._randomHex()].join(""))}static _oneOf(t){return t[Math.floor(t.length*Math.random())]}static _randomHex(){return ae._oneOf(ae._chars)}}ae._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"],ae._timeHighBits=["8","9","a","b"],me.empty=new uo("00000000-0000-0000-0000-000000000000");function ta(){return new ae}me.v4=ta;const fu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function na(e){return fu.test(e)}me.isUUID=na;function hu(e){if(!na(e))throw new Error("invalid uuid");return new uo(e)}me.parse=hu;function gu(){return ta().asHex()}me.generateUuid=gu;var Pn={};Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.ProgressPart=void 0;const ia=ne.default,ra=re,oa=_e;class pu{constructor(t,n,i){this._client=t,this._token=n,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(ra.WorkDoneProgress.type,this._token,r=>{switch(r.kind){case"begin":this.begin(r);break;case"report":this.report(r);break;case"end":this.done(),i&&i(this);break}})}begin(t){this._infinite=t.percentage===void 0,this._lspProgressDisposable!==void 0&&ia.window.withProgress({location:ia.ProgressLocation.Window,cancellable:t.cancellable,title:t.title},async(n,i)=>{if(this._lspProgressDisposable!==void 0)return this._progress=n,this._cancellationToken=i,this._tokenDisposable=this._cancellationToken.onCancellationRequested(()=>{this._client.sendNotification(ra.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(t),new Promise((r,o)=>{this._resolve=r,this._reject=o})})}report(t){if(this._infinite&&oa.string(t.message))this._progress!==void 0&&this._progress.report({message:t.message});else if(oa.number(t.percentage)){const n=Math.max(0,Math.min(t.percentage,100)),i=Math.max(0,n-this._reported);this._reported+=i,this._progress!==void 0&&this._progress.report({message:t.message,increment:i})}}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}}Pn.ProgressPart=pu;var ye={};(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=ne.default,n=re,i=_e,r=me;class o extends t.CancellationError{constructor(l){super(),this.data=l}}e.LSPCancellationError=o;function s(g,l){return g[l]===void 0&&(g[l]={}),g[l]}e.ensure=s,function(g){function l(h){const y=h;return y!=null&&i.func(y.fillClientCapabilities)&&i.func(y.initialize)&&i.func(y.getState)&&i.func(y.dispose)&&(y.fillInitializeParams===void 0||i.func(y.fillInitializeParams))}g.is=l}(e.StaticFeature||(e.StaticFeature={})),function(g){function l(h){const y=h;return y!=null&&i.func(y.fillClientCapabilities)&&i.func(y.initialize)&&i.func(y.getState)&&i.func(y.dispose)&&(y.fillInitializeParams===void 0||i.func(y.fillInitializeParams))&&i.func(y.register)&&i.func(y.unregister)&&y.registrationType!==void 0}g.is=l}(e.DynamicFeature||(e.DynamicFeature={}));class a{constructor(l){this._client=l}getState(){const l=this.getDocumentSelectors();let h=0;for(const P of l){h++;for(const I of t.workspace.textDocuments)if(t.languages.match(P,I)>0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}const y=h>0;return{kind:"document",id:this.registrationType.method,registrations:y,matches:!1}}}e.DynamicDocumentFeature=a;class c extends a{constructor(l,h,y,P,I,N,w){super(l),this._event=h,this._type=y,this._middleware=P,this._createParams=I,this._textDocument=N,this._selectorFilter=w,this._selectors=new Map,this._onNotificationSent=new t.EventEmitter}static textDocumentFilter(l,h){for(const y of l)if(t.languages.match(y,h)>0)return!0;return!1}getStateInfo(){return[this._selectors.values(),!1]}getDocumentSelectors(){return this._selectors.values()}register(l){!l.registerOptions.documentSelector||(this._listener||(this._listener=this._event(h=>{this.callback(h).catch(y=>{this._client.error(`Sending document notification ${this._type.method} failed.`,y)})})),this._selectors.set(l.id,this._client.protocol2CodeConverter.asDocumentSelector(l.registerOptions.documentSelector)))}async callback(l){const h=async y=>{const P=this._createParams(y);await this._client.sendNotification(this._type,P).catch(),this.notificationSent(y,this._type,P)};if(this.matches(l)){const y=this._middleware();return y?y(l,P=>h(P)):h(l)}}matches(l){return this._client.hasDedicatedTextSynchronizationFeature(this._textDocument(l))?!1:!this._selectorFilter||this._selectorFilter(this._selectors.values(),l)}get onNotificationSent(){return this._onNotificationSent.event}notificationSent(l,h,y){this._onNotificationSent.fire({original:l,type:h,params:y})}unregister(l){this._selectors.delete(l),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(l){for(const h of this._selectors.values())if(t.languages.match(h,l)>0)return{send:y=>this.callback(y)}}}e.TextDocumentEventFeature=c;class d extends a{constructor(l,h){super(l),this._registrationType=h,this._registrations=new Map}*getDocumentSelectors(){for(const l of this._registrations.values()){const h=l.data.registerOptions.documentSelector;h!==null&&(yield this._client.protocol2CodeConverter.asDocumentSelector(h))}}get registrationType(){return this._registrationType}register(l){if(!l.registerOptions.documentSelector)return;let h=this.registerLanguageProvider(l.registerOptions,l.id);this._registrations.set(l.id,{disposable:h[0],data:l,provider:h[1]})}unregister(l){let h=this._registrations.get(l);h!==void 0&&h.disposable.dispose()}dispose(){this._registrations.forEach(l=>{l.disposable.dispose()}),this._registrations.clear()}getRegistration(l,h){if(h){if(n.TextDocumentRegistrationOptions.is(h)){const y=n.StaticRegistrationOptions.hasId(h)?h.id:r.generateUuid(),P=h.documentSelector||l;if(P)return[y,Object.assign({},h,{documentSelector:P})]}else if(i.boolean(h)&&h===!0||n.WorkDoneProgressOptions.is(h)){if(!l)return[void 0,void 0];let y=i.boolean(h)&&h===!0?{documentSelector:l}:Object.assign({},h,{documentSelector:l});return[r.generateUuid(),y]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(l,h){if(!(!l||!h))return i.boolean(h)&&h===!0?{documentSelector:l}:Object.assign({},h,{documentSelector:l})}getProvider(l){for(const h of this._registrations.values()){let y=h.data.registerOptions.documentSelector;if(y!==null&&t.languages.match(this._client.protocol2CodeConverter.asDocumentSelector(y),l)>0)return h.provider}}getAllProviders(){const l=[];for(const h of this._registrations.values())l.push(h.provider);return l}}e.TextDocumentLanguageFeature=d;class m{constructor(l,h){this._client=l,this._registrationType=h,this._registrations=new Map}getState(){const l=this._registrations.size>0;return{kind:"workspace",id:this._registrationType.method,registrations:l}}get registrationType(){return this._registrationType}register(l){const h=this.registerLanguageProvider(l.registerOptions);this._registrations.set(l.id,{disposable:h[0],provider:h[1]})}unregister(l){let h=this._registrations.get(l);h!==void 0&&h.disposable.dispose()}dispose(){this._registrations.forEach(l=>{l.disposable.dispose()}),this._registrations.clear()}getProviders(){const l=[];for(const h of this._registrations.values())l.push(h.provider);return l}}e.WorkspaceFeature=m})(ye);var lo={},mu=function(e,t){for(var n=[],i=0;i<e.length;i++){var r=t(e[i],i);yu(r)?n.push.apply(n,r):n.push(r)}return n},yu=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},vu=sa;function sa(e,t,n){e instanceof RegExp&&(e=aa(e,n)),t instanceof RegExp&&(t=aa(t,n));var i=ca(e,t,n);return i&&{start:i[0],end:i[1],pre:n.slice(0,i[0]),body:n.slice(i[0]+e.length,i[1]),post:n.slice(i[1]+t.length)}}function aa(e,t){var n=t.match(e);return n?n[0]:null}sa.range=ca;function ca(e,t,n){var i,r,o,s,a,c=n.indexOf(e),d=n.indexOf(t,c+1),m=c;if(c>=0&&d>0){if(e===t)return[c,d];for(i=[],o=n.length;m>=0&&!a;)m==c?(i.push(m),c=n.indexOf(e,m+1)):i.length==1?a=[i.pop(),d]:(r=i.pop(),r<o&&(o=r,s=d),d=n.indexOf(t,m+1)),m=c<d&&c>=0?c:d;i.length&&(a=[o,s])}return a}var Cu=mu,ua=vu,_u=Ru,da="\0SLASH"+Math.random()+"\0",la="\0OPEN"+Math.random()+"\0",fo="\0CLOSE"+Math.random()+"\0",fa="\0COMMA"+Math.random()+"\0",ha="\0PERIOD"+Math.random()+"\0";function ho(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function bu(e){return e.split("\\\\").join(da).split("\\{").join(la).split("\\}").join(fo).split("\\,").join(fa).split("\\.").join(ha)}function wu(e){return e.split(da).join("\\").split(la).join("{").split(fo).join("}").split(fa).join(",").split(ha).join(".")}function ga(e){if(!e)return[""];var t=[],n=ua("{","}",e);if(!n)return e.split(",");var i=n.pre,r=n.body,o=n.post,s=i.split(",");s[s.length-1]+="{"+r+"}";var a=ga(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),t.push.apply(t,s),t}function Ru(e){return e?(e.substr(0,2)==="{}"&&(e="\\{\\}"+e.substr(2)),nn(bu(e),!0).map(wu)):[]}function Du(e){return"{"+e+"}"}function Su(e){return/^-?0\d/.test(e)}function Tu(e,t){return e<=t}function Pu(e,t){return e>=t}function nn(e,t){var n=[],i=ua("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var r=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),s=r||o,a=i.body.indexOf(",")>=0;if(!s&&!a)return i.post.match(/,.*\}/)?(e=i.pre+"{"+i.body+fo+i.post,nn(e)):[e];var c;if(s)c=i.body.split(/\.\./);else if(c=ga(i.body),c.length===1&&(c=nn(c[0],!1).map(Du),c.length===1)){var m=i.post.length?nn(i.post,!1):[""];return m.map(function(U){return i.pre+c[0]+U})}var d=i.pre,m=i.post.length?nn(i.post,!1):[""],g;if(s){var l=ho(c[0]),h=ho(c[1]),y=Math.max(c[0].length,c[1].length),P=c.length==3?Math.abs(ho(c[2])):1,I=Tu,N=h<l;N&&(P*=-1,I=Pu);var w=c.some(Su);g=[];for(var S=l;I(S,h);S+=P){var j;if(o)j=String.fromCharCode(S),j==="\\"&&(j="");else if(j=String(S),w){var A=y-j.length;if(A>0){var G=new Array(A+1).join("0");S<0?j="-"+G+j.slice(1):j=G+j}}g.push(j)}}else g=Cu(c,function(W){return nn(W,!1)});for(var V=0;V<g.length;V++)for(var k=0;k<m.length;k++){var K=d+g[V]+m[k];(!t||s||K)&&n.push(K)}return n}var go=at;at.Minimatch=Je;var kn=function(){try{return require("path")}catch{}}()||{sep:"/"};at.sep=kn.sep;var po=at.GLOBSTAR=Je.GLOBSTAR={},ku=_u,pa={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},mo="[^/]",yo=mo+"*?",Fu="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",qu="(?:(?!(?:\\/|^)\\.).)*?",ma=Eu("().*{}+?[]^$\\!");function Eu(e){return e.split("").reduce(function(t,n){return t[n]=!0,t},{})}var ya=/\/+/;at.filter=Ou;function Ou(e,t){return t=t||{},function(n,i,r){return at(n,e,t)}}function Et(e,t){t=t||{};var n={};return Object.keys(e).forEach(function(i){n[i]=e[i]}),Object.keys(t).forEach(function(i){n[i]=t[i]}),n}at.defaults=function(e){if(!e||typeof e!="object"||!Object.keys(e).length)return at;var t=at,n=function(r,o,s){return t(r,o,Et(e,s))};return n.Minimatch=function(r,o){return new t.Minimatch(r,Et(e,o))},n.Minimatch.defaults=function(r){return t.defaults(Et(e,r)).Minimatch},n.filter=function(r,o){return t.filter(r,Et(e,o))},n.defaults=function(r){return t.defaults(Et(e,r))},n.makeRe=function(r,o){return t.makeRe(r,Et(e,o))},n.braceExpand=function(r,o){return t.braceExpand(r,Et(e,o))},n.match=function(i,r,o){return t.match(i,r,Et(e,o))},n},Je.defaults=function(e){return at.defaults(e).Minimatch};function at(e,t,n){return fi(t),n||(n={}),!n.nocomment&&t.charAt(0)==="#"?!1:new Je(t,n).match(e)}function Je(e,t){if(!(this instanceof Je))return new Je(e,t);fi(e),t||(t={}),e=e.trim(),!t.allowWindowsEscape&&kn.sep!=="/"&&(e=e.split(kn.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}Je.prototype.debug=function(){},Je.prototype.make=Nu;function Nu(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,n),n=this.globParts=n.map(function(i){return i.split(ya)}),this.debug(this.pattern,n),n=n.map(function(i,r,o){return i.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(i){return i.indexOf(!1)===-1}),this.debug(this.pattern,n),this.set=n}Je.prototype.parseNegate=Iu;function Iu(){var e=this.pattern,t=!1,n=this.options,i=0;if(!n.nonegate){for(var r=0,o=e.length;r<o&&e.charAt(r)==="!";r++)t=!t,i++;i&&(this.pattern=e.substr(i)),this.negate=t}}at.braceExpand=function(e,t){return va(e,t)},Je.prototype.braceExpand=va;function va(e,t){return t||(this instanceof Je?t=this.options:t={}),e=typeof e>"u"?this.pattern:e,fi(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ku(e)}var Mu=1024*64,fi=function(e){if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>Mu)throw new TypeError("pattern is too long")};Je.prototype.parse=Lu;var hi={};function Lu(e,t){fi(e);var n=this.options;if(e==="**")if(n.noglobstar)e="*";else return po;if(e==="")return"";var i="",r=!!n.nocase,o=!1,s=[],a=[],c,d=!1,m=-1,g=-1,l=e.charAt(0)==="."?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",h=this;function y(){if(c){switch(c){case"*":i+=yo,r=!0;break;case"?":i+=mo,r=!0;break;default:i+="\\"+c;break}h.debug("clearStateChar %j %j",c,i),c=!1}}for(var P=0,I=e.length,N;P<I&&(N=e.charAt(P));P++){if(this.debug("%s %s %s %j",e,P,i,N),o&&ma[N]){i+="\\"+N,o=!1;continue}switch(N){case"/":return!1;case"\\":y(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,P,i,N),d){this.debug(" in class"),N==="!"&&P===g+1&&(N="^"),i+=N;continue}h.debug("call clearStateChar %j",c),y(),c=N,n.noext&&y();continue;case"(":if(d){i+="(";continue}if(!c){i+="\\(";continue}s.push({type:c,start:P-1,reStart:i.length,open:pa[c].open,close:pa[c].close}),i+=c==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",c,i),c=!1;continue;case")":if(d||!s.length){i+="\\)";continue}y(),r=!0;var w=s.pop();i+=w.close,w.type==="!"&&a.push(w),w.reEnd=i.length;continue;case"|":if(d||!s.length||o){i+="\\|",o=!1;continue}y(),i+="|";continue;case"[":if(y(),d){i+="\\"+N;continue}d=!0,g=P,m=i.length,i+=N;continue;case"]":if(P===g+1||!d){i+="\\"+N,o=!1;continue}var S=e.substring(g+1,P);try{}catch{var j=this.parse(S,hi);i=i.substr(0,m)+"\\["+j[0]+"\\]",r=r||j[1],d=!1;continue}r=!0,d=!1,i+=N;continue;default:y(),o?o=!1:ma[N]&&!(N==="^"&&d)&&(i+="\\"),i+=N}}for(d&&(S=e.substr(g+1),j=this.parse(S,hi),i=i.substr(0,m)+"\\["+j[0],r=r||j[1]),w=s.pop();w;w=s.pop()){var A=i.slice(w.reStart+w.open.length);this.debug("setting tail",i,w),A=A.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(Ge,et,He){return He||(He="\\"),et+et+He+"|"}),this.debug(`tail=%j
%s`,A,A,w,i);var G=w.type==="*"?yo:w.type==="?"?mo:"\\"+w.type;r=!0,i=i.slice(0,w.reStart)+G+"\\("+A}y(),o&&(i+="\\\\");var V=!1;switch(i.charAt(0)){case"[":case".":case"(":V=!0}for(var k=a.length-1;k>-1;k--){var K=a[k],W=i.slice(0,K.reStart),U=i.slice(K.reStart,K.reEnd-8),p=i.slice(K.reEnd-8,K.reEnd),M=i.slice(K.reEnd);p+=M;var Y=W.split("(").length-1,O=M;for(P=0;P<Y;P++)O=O.replace(/\)[+*?]?/,"");M=O;var x="";M===""&&t!==hi&&(x="$");var Z=W+U+M+x+p;i=Z}if(i!==""&&r&&(i="(?=.)"+i),V&&(i=l+i),t===hi)return[i,r];if(!r)return Au(e);var Ce=n.nocase?"i":"";try{var Me=new RegExp("^"+i+"$",Ce)}catch{return new RegExp("$.")}return Me._glob=e,Me._src=i,Me}at.makeRe=function(e,t){return new Je(e,t||{}).makeRe()},Je.prototype.makeRe=ju;function ju(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,n=t.noglobstar?yo:t.dot?Fu:qu,i=t.nocase?"i":"",r=e.map(function(o){return o.map(function(s){return s===po?n:typeof s=="string"?Hu(s):s._src}).join("\\/")}).join("|");r="^(?:"+r+")$",this.negate&&(r="^(?!"+r+").*$");try{this.regexp=new RegExp(r,i)}catch{this.regexp=!1}return this.regexp}at.match=function(e,t,n){n=n||{};var i=new Je(t,n);return e=e.filter(function(r){return i.match(r)}),i.options.nonull&&!e.length&&e.push(t),e},Je.prototype.match=function(t,n){if(typeof n>"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 i=this.options;kn.sep!=="/"&&(t=t.split(kn.sep).join("/")),t=t.split(ya),this.debug(this.pattern,"split",t);var r=this.set;this.debug(this.pattern,"set",r);var o,s;for(s=t.length-1;s>=0&&(o=t[s],!o);s--);for(s=0;s<r.length;s++){var a=r[s],c=t;i.matchBase&&a.length===1&&(c=[o]);var d=this.matchOne(c,a,n);if(d)return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate},Je.prototype.matchOne=function(e,t,n){var i=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var r=0,o=0,s=e.length,a=t.length;r<s&&o<a;r++,o++){this.debug("matchOne loop");var c=t[o],d=e[r];if(this.debug(t,c,d),c===!1)return!1;if(c===po){this.debug("GLOBSTAR",[t,c,d]);var m=r,g=o+1;if(g===a){for(this.debug("** at the end");r<s;r++)if(e[r]==="."||e[r]===".."||!i.dot&&e[r].charAt(0)===".")return!1;return!0}for(;m<s;){var l=e[m];if(this.debug(`
globstar while`,e,m,t,g,l),this.matchOne(e.slice(m),t.slice(g),n))return this.debug("globstar found match!",m,s,l),!0;if(l==="."||l===".."||!i.dot&&l.charAt(0)==="."){this.debug("dot detected!",e,m,t,g);break}this.debug("globstar swallow a segment, and continue"),m++}return!!(n&&(this.debug(`
>>> no match, partial?`,e,m,t,g),m===s))}var h;if(typeof c=="string"?(h=d===c,this.debug("string match",c,d,h)):(h=d.match(c),this.debug("pattern match",c,d,h)),!h)return!1}if(r===s&&o===a)return!0;if(r===s)return n;if(o===a)return r===s-1&&e[r]==="";throw new Error("wtf?")};function Au(e){return e.replace(/\\(.)/g,"$1")}function Hu(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticFeature=e.DiagnosticPullMode=e.vsdiag=void 0;const t=go,n=ne.default,i=re,r=me,o=ye;function s(N,w){return N[w]===void 0&&(N[w]={}),N[w]}var a;(function(N){(function(w){w.full="full",w.unChanged="unChanged"})(N.DocumentDiagnosticReportKind||(N.DocumentDiagnosticReportKind={}))})(a=e.vsdiag||(e.vsdiag={}));var c;(function(N){N.onType="onType",N.onSave="onSave"})(c=e.DiagnosticPullMode||(e.DiagnosticPullMode={}));var d;(function(N){N.active="open",N.reschedule="reschedule",N.outDated="drop"})(d||(d={}));class m{constructor(){this.open=new Set;const w=()=>{this.open.clear();for(const S of n.window.tabGroups.all)for(const j of S.tabs){const A=j.input;A instanceof n.TabInputText?this.open.add(A.uri.toString()):A instanceof n.TabInputTextDiff&&this.open.add(A.modified.toString())}};w(),n.window.tabGroups.onDidChangeTabs!==void 0?this.disposable=n.window.tabGroups.onDidChangeTabs(w):this.disposable={dispose:()=>{}}}dispose(){this.disposable.dispose()}isActive(w){return w instanceof n.Uri?n.window.activeTextEditor?.document.uri===w:n.window.activeTextEditor?.document===w}isVisible(w){const S=w instanceof n.Uri?w:w.uri;return this.open.has(S.toString())}getTabResources(){const w=[];for(const S of n.window.tabGroups.all)for(const j of S.tabs){const A=j.input;A instanceof n.TabInputText?w.push(A.uri):A instanceof n.TabInputTextDiff&&w.push(A.modified)}return w}}var g;(function(N){N[N.document=1]="document",N[N.workspace=2]="workspace"})(g||(g={}));class l{constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(w,S,j){const A=w===g.document?this.documentPullStates:this.workspacePullStates,[G,V,k]=S instanceof n.Uri?[S.toString(),S,j]:[S.uri.toString(),S.uri,S.version];let K=A.get(G);return K===void 0&&(K={document:V,pulledVersion:k,resultId:void 0},A.set(G,K)),K}update(w,S,j,A){const G=w===g.document?this.documentPullStates:this.workspacePullStates,[V,k,K,W]=S instanceof n.Uri?[S.toString(),S,j,A]:[S.uri.toString(),S.uri,S.version,j];let U=G.get(V);U===void 0?(U={document:k,pulledVersion:K,resultId:W},G.set(V,U)):(U.pulledVersion=K,U.resultId=W)}unTrack(w,S){const j=S instanceof n.Uri?S.toString():S.uri.toString();(w===g.document?this.documentPullStates:this.workspacePullStates).delete(j)}tracks(w,S){const j=S instanceof n.Uri?S.toString():S.uri.toString();return(w===g.document?this.documentPullStates:this.workspacePullStates).has(j)}getResultId(w,S){const j=S instanceof n.Uri?S.toString():S.uri.toString();return(w===g.document?this.documentPullStates:this.workspacePullStates).get(j)?.resultId}getAllResultIds(){const w=[];for(let[S,j]of this.workspacePullStates)this.documentPullStates.has(S)&&(j=this.documentPullStates.get(S)),j.resultId!==void 0&&w.push({uri:S,value:j.resultId});return w}}class h{constructor(w,S,j){this.client=w,this.tabs=S,this.options=j,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new n.EventEmitter,this.provider=this.createProvider(),this.diagnostics=n.languages.createDiagnosticCollection(j.identifier),this.openRequests=new Map,this.documentStates=new l,this.workspaceErrorCounter=0}knows(w,S){return this.documentStates.tracks(w,S)}pull(w,S){if(this.isDisposed)return;const j=w instanceof n.Uri?w:w.uri;this.pullAsync(w).then(()=>{S&&S()},A=>{this.client.error(`Document pull failed for text document ${j.toString()}`,A,!1)})}async pullAsync(w,S){if(this.isDisposed)return;const j=w instanceof n.Uri,A=j?w:w.uri,G=A.toString();S=j?S:w.version;const V=this.openRequests.get(G),k=j?this.documentStates.track(g.document,w,S):this.documentStates.track(g.document,w);if(V===void 0){const K=new n.CancellationTokenSource;this.openRequests.set(G,{state:d.active,document:w,version:S,tokenSource:K});let W,U;try{W=await this.provider.provideDiagnostics(w,k.resultId,K.token)??{kind:a.DocumentDiagnosticReportKind.full,items:[]}}catch(p){if(p instanceof o.LSPCancellationError&&i.DiagnosticServerCancellationData.is(p.data)&&p.data.retriggerRequest===!1&&(U={state:d.outDated,document:w}),U===void 0&&p instanceof n.CancellationError)U={state:d.reschedule,document:w};else throw p}if(U=U??this.openRequests.get(G),U===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${G}`),this.diagnostics.delete(A);return}if(this.openRequests.delete(G),!this.tabs.isVisible(w)){this.documentStates.unTrack(g.document,w);return}if(U.state===d.outDated)return;W!==void 0&&(W.kind===a.DocumentDiagnosticReportKind.full&&this.diagnostics.set(A,W.items),k.pulledVersion=S,k.resultId=W.resultId),U.state===d.reschedule&&this.pull(w)}else V.state===d.active?(V.tokenSource.cancel(),this.openRequests.set(G,{state:d.reschedule,document:V.document})):V.state===d.outDated&&this.openRequests.set(G,{state:d.reschedule,document:V.document})}cleanupPull(w){const S=w instanceof n.Uri?w:w.uri,j=S.toString(),A=this.openRequests.get(j);this.options.workspaceDiagnostics||this.options.interFileDependencies?A!==void 0?this.openRequests.set(j,{state:d.reschedule,document:w}):this.pull(w):(A!==void 0&&(A.state===d.active&&A.tokenSource.cancel(),this.openRequests.set(j,{state:d.outDated,document:w})),this.diagnostics.delete(S))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,i.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},w=>{!(w instanceof o.LSPCancellationError)&&!i.DiagnosticServerCancellationData.is(w.data)&&(this.client.error("Workspace diagnostic pull failed.",w,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,i.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 w=this.documentStates.getAllResultIds().map(S=>({uri:this.client.protocol2CodeConverter.asUri(S.uri),value:S.value}));await this.provider.provideWorkspaceDiagnostics(w,this.workspaceCancellation.token,S=>{if(!(!S||this.isDisposed))for(const j of S.items)j.kind===a.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(g.document,j.uri)||this.diagnostics.set(j.uri,j.items)),this.documentStates.update(g.workspace,j.uri,j.version??void 0,j.resultId)})}createProvider(){const w={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(S,j,A)=>{const G=(k,K,W)=>{const U={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(k instanceof n.Uri?k:k.uri)},previousResultId:K};return this.isDisposed===!0||!this.client.isRunning()?{kind:a.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(i.DocumentDiagnosticRequest.type,U,W).then(async p=>p==null||this.isDisposed||W.isCancellationRequested?{kind:a.DocumentDiagnosticReportKind.full,items:[]}:p.kind===i.DocumentDiagnosticReportKind.Full?{kind:a.DocumentDiagnosticReportKind.full,resultId:p.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(p.items,W)}:{kind:a.DocumentDiagnosticReportKind.unChanged,resultId:p.resultId},p=>this.client.handleFailedRequest(i.DocumentDiagnosticRequest.type,W,p,{kind:a.DocumentDiagnosticReportKind.full,items:[]}))},V=this.client.middleware;return V.provideDiagnostics?V.provideDiagnostics(S,j,A,G):G(S,j,A)}};return this.options.workspaceDiagnostics&&(w.provideWorkspaceDiagnostics=(S,j,A)=>{const G=async W=>W.kind===i.DocumentDiagnosticReportKind.Full?{kind:a.DocumentDiagnosticReportKind.full,uri:this.client.protocol2CodeConverter.asUri(W.uri),resultId:W.resultId,version:W.version,items:await this.client.protocol2CodeConverter.asDiagnostics(W.items,j)}:{kind:a.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(W.uri),resultId:W.resultId,version:W.version},V=W=>{const U=[];for(const p of W)U.push({uri:this.client.code2ProtocolConverter.asUri(p.uri),value:p.value});return U},k=(W,U)=>{const p=(0,r.generateUuid)(),M=this.client.onProgress(i.WorkspaceDiagnosticRequest.partialResult,p,async O=>{if(O==null){A(null);return}const x={items:[]};for(const Z of O.items)try{x.items.push(await G(Z))}catch(Ce){this.client.error("Converting workspace diagnostics failed.",Ce)}A(x)}),Y={identifier:this.options.identifier,previousResultIds:V(W),partialResultToken:p};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(i.WorkspaceDiagnosticRequest.type,Y,U).then(async O=>{if(U.isCancellationRequested)return{items:[]};const x={items:[]};for(const Z of O.items)x.items.push(await G(Z));return M.dispose(),A(x),{items:[]}},O=>(M.dispose(),this.client.handleFailedRequest(i.DocumentDiagnosticRequest.type,U,O,{items:[]})))},K=this.client.middleware;return K.provideWorkspaceDiagnostics?K.provideWorkspaceDiagnostics(S,j,A,k):k(S,j)}),w}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(const[w,S]of this.openRequests)S.state===d.active&&S.tokenSource.cancel(),this.openRequests.set(w,{state:d.outDated,document:S.document});this.diagnostics.dispose()}}class y{constructor(w){this.diagnosticRequestor=w,this.documents=new i.LinkedMap,this.isDisposed=!1}add(w){if(this.isDisposed===!0)return;const S=w instanceof n.Uri?w.toString():w.uri.toString();this.documents.has(S)||(this.documents.set(S,w,i.Touch.Last),this.trigger())}remove(w){const S=w instanceof n.Uri?w.toString():w.uri.toString();this.documents.has(S)&&(this.documents.delete(S),this.diagnosticRequestor.pull(w)),this.documents.size===0?this.stop():w===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,i.RAL)().timer.setInterval(()=>{const w=this.documents.first;if(w!==void 0){const S=w instanceof n.Uri?w.toString():w.uri.toString();this.diagnosticRequestor.pull(w),this.documents.set(S,w,i.Touch.Last),w===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 P{constructor(w,S,j){const A=w.clientOptions.diagnosticPullOptions??{onChange:!0,onSave:!1},G=w.protocol2CodeConverter.asDocumentSelector(j.documentSelector),V=[],k=O=>{const x=j.documentSelector;if(A.match!==void 0)return A.match(x,O);for(const Z of x)if(!!i.TextDocumentFilter.is(Z)){if(typeof Z=="string"||Z.language!==void 0&&Z.language!=="*"||Z.scheme!==void 0&&Z.scheme!=="*"&&Z.scheme!==O.scheme)return!1;if(Z.pattern!==void 0){const Ce=new t.Minimatch(Z.pattern,{noext:!0});if(!Ce.makeRe()||!Ce.match(O.fsPath))return!1}}return!0},K=O=>O instanceof n.Uri?k(O):n.languages.match(G,O)>0&&S.isVisible(O),W=O=>O instanceof n.Uri?this.activeTextDocument?.uri.toString()===O.toString():this.activeTextDocument===O;this.diagnosticRequestor=new h(w,S,j),this.backgroundScheduler=new y(this.diagnosticRequestor);const U=O=>{!K(O)||!j.interFileDependencies||W(O)||this.backgroundScheduler.add(O)};this.activeTextDocument=n.window.activeTextEditor?.document,n.window.onDidChangeActiveTextEditor(O=>{const x=this.activeTextDocument;this.activeTextDocument=O?.document,x!==void 0&&U(x),this.activeTextDocument!==void 0&&this.backgroundScheduler.remove(this.activeTextDocument)});const p=w.getFeature(i.DidOpenTextDocumentNotification.method);V.push(p.onNotificationSent(O=>{const x=O.original;K(x)&&this.diagnosticRequestor.pull(x,()=>{U(x)})}));const M=new Set;for(const O of n.workspace.textDocuments)K(O)&&(this.diagnosticRequestor.pull(O,()=>{U(O)}),M.add(O.uri.toString()));if(A.onTabs===!0)for(const O of S.getTabResources())!M.has(O.toString())&&K(O)&&this.diagnosticRequestor.pull(O,()=>{U(O)});if(A.onChange===!0){const O=w.getFeature(i.DidChangeTextDocumentNotification.method);V.push(O.onNotificationSent(async x=>{const Z=x.original.document;(A.filter===void 0||!A.filter(Z,c.onType))&&this.diagnosticRequestor.knows(g.document,Z)&&x.original.contentChanges.length>0&&this.diagnosticRequestor.pull(Z,()=>{this.backgroundScheduler.trigger()})}))}if(A.onSave===!0){const O=w.getFeature(i.DidSaveTextDocumentNotification.method);V.push(O.onNotificationSent(x=>{const Z=x.original;(A.filter===void 0||!A.filter(Z,c.onSave))&&this.diagnosticRequestor.knows(g.document,Z)&&this.diagnosticRequestor.pull(x.original,()=>{this.backgroundScheduler.trigger()})}))}const Y=w.getFeature(i.DidCloseTextDocumentNotification.method);V.push(Y.onNotificationSent(O=>{const x=O.original;this.diagnosticRequestor.cleanupPull(x),this.backgroundScheduler.remove(x)})),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(const O of n.workspace.textDocuments)K(O)&&this.diagnosticRequestor.pull(O)}),j.workspaceDiagnostics===!0&&j.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=n.Disposable.from(...V,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}}class I extends o.TextDocumentLanguageFeature{constructor(w){super(w,i.DocumentDiagnosticRequest.type)}fillClientCapabilities(w){let S=s(s(w,"textDocument"),"diagnostic");S.dynamicRegistration=!0,S.relatedDocumentSupport=!1,s(s(w,"workspace"),"diagnostics").refreshSupport=!0}initialize(w,S){this._client.onRequest(i.DiagnosticRefreshRequest.type,async()=>{for(const V of this.getAllProviders())V.onDidChangeDiagnosticsEmitter.fire()});let[A,G]=this.getRegistration(S,w.diagnosticProvider);!A||!G||this.register({id:A,registerOptions:G})}dispose(){this.tabs!==void 0&&(this.tabs.dispose(),this.tabs=void 0),super.dispose()}registerLanguageProvider(w){this.tabs===void 0&&(this.tabs=new m);const S=new P(this._client,this.tabs,w);return[S.disposable,S]}}e.DiagnosticFeature=I})(lo);var gi={};Object.defineProperty(gi,"__esModule",{value:!0}),gi.NotebookDocumentSyncFeature=void 0;const Qe=ne.default,$u=go,St=re,Wu=me,Ca=_e;function _a(e,t){return e[t]===void 0&&(e[t]={}),e[t]}var rn;(function(e){(function(t){function n(g,l){return{version:g.version,uri:l.asUri(g.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function i(g,l,h){const y=St.NotebookDocument.create(h.asUri(g.uri),g.notebookType,g.version,r(l,h));return Object.keys(g.metadata).length>0&&(y.metadata=o(g.metadata)),y}t.asNotebookDocument=i;function r(g,l){return g.map(h=>s(h,l))}t.asNotebookCells=r;function o(g){return c(new Set,g)}t.asMetadata=o;function s(g,l){const h=St.NotebookCell.create(a(g.kind),l.asUri(g.document.uri));return Object.keys(g.metadata).length>0&&(h.metadata=o(g.metadata)),g.executionSummary!==void 0&&Ca.number(g.executionSummary.executionOrder)&&Ca.boolean(g.executionSummary.success)&&(h.executionSummary={executionOrder:g.executionSummary.executionOrder,success:g.executionSummary.success}),h}t.asNotebookCell=s;function a(g){switch(g){case Qe.NotebookCellKind.Markup:return St.NotebookCellKind.Markup;case Qe.NotebookCellKind.Code:return St.NotebookCellKind.Code}}function c(g,l){if(g.has(l))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(l)){const h=[];for(const y of l)if(y!==null&&typeof y=="object"||Array.isArray(y))h.push(c(g,y));else{if(y instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");h.push(y)}return h}else{const h=Object.keys(l),y=Object.create(null);for(const P of h){const I=l[P];if(I!==null&&typeof I=="object"||Array.isArray(I))y[P]=c(g,I);else{if(I instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");y[P]=I}}return y}}function d(g,l){const h=l.asChangeTextDocumentParams(g);return{document:h.textDocument,changes:h.contentChanges}}t.asTextContentChange=d;function m(g,l){const h=Object.create(null);if(g.metadata&&(h.metadata=e.c2p.asMetadata(g.metadata)),g.cells!==void 0){const y=Object.create(null),P=g.cells;P.structure&&(y.structure={array:{start:P.structure.array.start,deleteCount:P.structure.array.deleteCount,cells:P.structure.array.cells!==void 0?P.structure.array.cells.map(I=>e.c2p.asNotebookCell(I,l)):void 0},didOpen:P.structure.didOpen!==void 0?P.structure.didOpen.map(I=>l.asOpenTextDocumentParams(I.document).textDocument):void 0,didClose:P.structure.didClose!==void 0?P.structure.didClose.map(I=>l.asCloseTextDocumentParams(I.document).textDocument):void 0}),P.data!==void 0&&(y.data=P.data.map(I=>e.c2p.asNotebookCell(I,l))),P.textContent!==void 0&&(y.textContent=P.textContent.map(I=>e.c2p.asTextContentChange(I,l))),Object.keys(y).length>0&&(h.cells=y)}return h}t.asNotebookDocumentChangeEvent=m})(e.c2p||(e.c2p={}))})(rn||(rn={}));var vo;(function(e){function t(a,c,d){const m=a.length,g=c.length;let l=0;for(;l<g&&l<m&&n(a[l],c[l],d);)l++;if(l<g&&l<m){let h=m-1,y=g-1;for(;h>=0&&y>=0&&n(a[h],c[y],d);)h--,y--;const P=h+1-l,I=l===y+1?void 0:c.slice(l,y+1);return I!==void 0?{start:l,deleteCount:P,cells:I}:{start:l,deleteCount:P}}else return l<g?{start:l,deleteCount:0,cells:c.slice(l)}:l<m?{start:l,deleteCount:m-l}:void 0}e.computeDiff=t;function n(a,c,d=!0){return a.kind!==c.kind||a.document.uri.toString()!==c.document.uri.toString()||a.document.languageId!==c.document.languageId||!i(a.executionSummary,c.executionSummary)?!1:!d||d&&o(a.metadata,c.metadata)}function i(a,c){return a===c?!0:a===void 0||c===void 0?!1:a.executionOrder===c.executionOrder&&a.success===c.success&&r(a.timing,c.timing)}function r(a,c){return a===c?!0:a===void 0||c===void 0?!1:a.startTime===c.startTime&&a.endTime===c.endTime}function o(a,c){if(a===c)return!0;if(a==null||c===null||c===void 0||typeof a!=typeof c||typeof a!="object")return!1;const d=Array.isArray(a),m=Array.isArray(c);if(d!==m)return!1;if(d&&m){if(a.length!==c.length)return!1;for(let g=0;g<a.length;g++)if(!o(a[g],c[g]))return!1}if(s(a)&&s(c)){const g=Object.keys(a),l=Object.keys(c);if(g.length!==l.length||(g.sort(),l.sort(),!o(g,l)))return!1;for(let h=0;h<g.length;h++){const y=g[h];if(!o(a[y],c[y]))return!1}return!0}return!1}function s(a){return a!==null&&typeof a=="object"}e.isObjectLiteral=s})(vo||(vo={}));var Co;(function(e){function t(n,i){if(typeof n=="string")return n==="*"||i.notebookType===n;if(n.notebookType!==void 0&&n.notebookType!=="*"&&i.notebookType!==n.notebookType)return!1;const r=i.uri;if(n.scheme!==void 0&&n.scheme!=="*"&&r.scheme!==n.scheme)return!1;if(n.pattern!==void 0){const o=new $u.Minimatch(n.pattern,{noext:!0});if(!o.makeRe()||!o.match(r.fsPath))return!1}return!0}e.matchNotebook=t})(Co||(Co={}));var pi;(function(e){function t(i){const r=i.notebookSelector,o=[];for(const s of r){const a=(typeof s.notebook=="string"?s.notebook:s.notebook?.notebookType)??"*",c=typeof s.notebook=="string"?void 0:s.notebook?.scheme,d=typeof s.notebook=="string"?void 0:s.notebook?.pattern;if(s.cells!==void 0)for(const m of s.cells)o.push(n(a,c,d,m.language));else o.push(n(a,c,d,void 0))}return o}e.asDocumentSelector=t;function n(i,r,o,s){return r===void 0&&o===void 0?{notebook:i,language:s}:{notebook:{notebookType:i,scheme:r,pattern:o},language:s}}})(pi||(pi={}));var mi;(function(e){function t(n){return{cells:n,uris:new Set(n.map(i=>i.document.uri.toString()))}}e.create=t})(mi||(mi={}));class yi{constructor(t,n){this.client=t,this.options=n,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=t.protocol2CodeConverter.asDocumentSelector(pi.asDocumentSelector(n)),Qe.workspace.onDidOpenNotebookDocument(i=>{this.notebookDidOpen.add(i.uri.toString()),this.didOpen(i)},void 0,this.disposables);for(const i of Qe.workspace.notebookDocuments)this.notebookDidOpen.add(i.uri.toString()),this.didOpen(i);Qe.workspace.onDidChangeNotebookDocument(i=>this.didChangeNotebookDocument(i),void 0,this.disposables),this.options.save===!0&&Qe.workspace.onDidSaveNotebookDocument(i=>this.didSave(i),void 0,this.disposables),Qe.workspace.onDidCloseNotebookDocument(i=>{this.didClose(i),this.notebookDidOpen.delete(i.uri.toString())},void 0,this.disposables)}getState(){for(const t of Qe.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 Qe.languages.match(this.selector,t)>0}didOpenNotebookCellTextDocument(t,n){if(Qe.languages.match(this.selector,n.document)===0||!this.notebookDidOpen.has(t.uri.toString()))return;const i=this.notebookSyncInfo.get(t.uri.toString()),r=this.cellMatches(t,n);if(i!==void 0){const o=i.uris.has(n.document.uri.toString());if(r&&o||!r&&!o)return;if(r){const s=this.getMatchingCells(t);if(s!==void 0){const a=this.asNotebookDocumentChangeEvent(t,void 0,i,s);a!==void 0&&this.doSendChange(a,s).catch(()=>{})}}}else r&&this.doSendOpen(t,[n]).catch(()=>{})}didChangeNotebookCellTextDocument(t,n){Qe.languages.match(this.selector,n.document)!==0&&this.doSendChange({notebook:t,cells:{textContent:[n]}},void 0).catch(()=>{})}didCloseNotebookCellTextDocument(t,n){const i=this.notebookSyncInfo.get(t.uri.toString());if(i===void 0)return;const r=n.document.uri,o=i.cells.findIndex(s=>s.document.uri.toString()===r.toString());if(o!==-1)if(o===0&&i.cells.length===1)this.doSendClose(t,i.cells).catch(()=>{});else{const s=i.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),i=this.notebookSyncInfo.get(t.uri.toString())){if(i!==void 0)if(n!==void 0){const r=this.asNotebookDocumentChangeEvent(t,void 0,i,n);r!==void 0&&this.doSendChange(r,n).catch(()=>{})}else this.doSendClose(t,[]).catch(()=>{});else{if(n===void 0)return;this.doSendOpen(t,n).catch(()=>{})}}didChangeNotebookDocument(t){const n=t.notebook,i=this.notebookSyncInfo.get(n.uri.toString());if(i===void 0){if(t.contentChanges.length===0)return;const r=this.getMatchingCells(n);if(r===void 0)return;this.didOpen(n,r,i)}else{const r=this.getMatchingCells(n);if(r===void 0){this.didClose(n,i);return}const o=this.asNotebookDocumentChangeEvent(t.notebook,t,i,r);o!==void 0&&this.doSendChange(o,r).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 i=t.getCells().filter(r=>n.uris.has(r.document.uri.toString()));this.doSendClose(t,i).catch(()=>{})}async sendDidOpenNotebookDocument(t){const n=this.getMatchingCells(t);if(n!==void 0)return this.doSendOpen(t,n)}async doSendOpen(t,n){const i=async(o,s)=>{const a=rn.c2p.asNotebookDocument(o,s,this.client.code2ProtocolConverter),c=s.map(d=>this.client.code2ProtocolConverter.asTextDocumentItem(d.document));try{await this.client.sendNotification(St.DidOpenNotebookDocumentNotification.type,{notebookDocument:a,cellTextDocuments:c})}catch(d){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",d),d}},r=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(t.uri.toString(),mi.create(n)),r?.didOpen!==void 0?r.didOpen(t,n,i):i(t,n)}async sendDidChangeNotebookDocument(t){return this.doSendChange(t,void 0)}async doSendChange(t,n=this.getMatchingCells(t.notebook)){const i=async o=>{try{await this.client.sendNotification(St.DidChangeNotebookDocumentNotification.type,{notebookDocument:rn.c2p.asVersionedNotebookDocumentIdentifier(o.notebook,this.client.code2ProtocolConverter),change:rn.c2p.asNotebookDocumentChangeEvent(o,this.client.code2ProtocolConverter)})}catch(s){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",s),s}},r=this.client.middleware?.notebooks;return t.cells?.structure!==void 0&&this.notebookSyncInfo.set(t.notebook.uri.toString(),mi.create(n??[])),r?.didChange!==void 0?r?.didChange(t,i):i(t)}async sendDidSaveNotebookDocument(t){return this.doSendSave(t)}async doSendSave(t){const n=async r=>{try{await this.client.sendNotification(St.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(r.uri)}})}catch(o){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",o),o}},i=this.client.middleware?.notebooks;return i?.didSave!==void 0?i.didSave(t,n):n(t)}async sendDidCloseNotebookDocument(t){return this.doSendClose(t,this.getMatchingCells(t)??[])}async doSendClose(t,n){const i=async(o,s)=>{try{await this.client.sendNotification(St.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}},r=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(t.uri.toString()),r?.didClose!==void 0?r.didClose(t,n,i):i(t,n)}asNotebookDocumentChangeEvent(t,n,i,r){if(n!==void 0&&n.notebook!==t)throw new Error("Notebook must be identical");const o={notebook:t};n?.metadata!==void 0&&(o.metadata=rn.c2p.asMetadata(n.metadata));let s;if(n?.cellChanges!==void 0&&n.cellChanges.length>0){const a=[];s=new Set(r.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)&&i!==void 0&&r!==void 0){const a=i.cells,c=r,d=vo.computeDiff(a,c,!1);let m,g;if(d!==void 0){m=d.cells===void 0?new Map:new Map(d.cells.map(y=>[y.document.uri.toString(),y])),g=d.deleteCount===0?new Map:new Map(a.slice(d.start,d.start+d.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 l=[],h=[];if(m.size>0||g.size>0){for(const y of m.values())l.push(y);for(const y of g.values())h.push(y)}o.cells.structure={array:d,didOpen:l,didClose:h}}}return Object.keys(o).length>1?o:void 0}getMatchingCells(t,n=t.getCells()){if(this.options.notebookSelector!==void 0){for(const i of this.options.notebookSelector)if(i.notebook===void 0){if(i.cells===void 0)return;const r=this.filterCells(t,n,i.cells);return r.length===0?void 0:r}else if(Co.matchNotebook(i.notebook,t))return i.cells===void 0?n:this.filterCells(t,n,i.cells)}}cellMatches(t,n){const i=this.getMatchingCells(t,[n]);return i!==void 0&&i[0]===n}filterCells(t,n,i){const r=n.filter(o=>{const s=o.document.languageId;return i.some(a=>a.language==="*"||s===a.language)});return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(t,n):r}}class zt{constructor(t){this.client=t,this.registrations=new Map,this.registrationType=St.NotebookDocumentSyncRegistrationType.type,Qe.workspace.onDidOpenTextDocument(n=>{if(n.uri.scheme!==zt.CellScheme)return;const[i,r]=this.findNotebookDocumentAndCell(n);if(!(i===void 0||r===void 0))for(const o of this.registrations.values())o instanceof yi&&o.didOpenNotebookCellTextDocument(i,r)}),Qe.workspace.onDidChangeTextDocument(n=>{if(n.contentChanges.length===0)return;const i=n.document;if(i.uri.scheme!==zt.CellScheme)return;const[r]=this.findNotebookDocumentAndCell(i);if(r!==void 0)for(const o of this.registrations.values())o instanceof yi&&o.didChangeNotebookCellTextDocument(r,n)}),Qe.workspace.onDidCloseTextDocument(n=>{if(n.uri.scheme!==zt.CellScheme)return;const[i,r]=this.findNotebookDocumentAndCell(n);if(!(i===void 0||r===void 0))for(const o of this.registrations.values())o instanceof yi&&o.didCloseNotebookCellTextDocument(i,r)})}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=_a(_a(t,"notebookDocument"),"synchronization");n.dynamicRegistration=!0,n.executionSummarySupport=!0}preInitialize(t){const n=t.notebookDocumentSync;n!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(pi.asDocumentSelector(n)))}initialize(t){const n=t.notebookDocumentSync;if(n===void 0)return;const i=n.id??Wu.generateUuid();this.register({id:i,registerOptions:n})}register(t){const n=new yi(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!==zt.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&Qe.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 i of Qe.workspace.notebookDocuments)for(const r of i.getCells())if(r.document.uri.toString()===n)return[i,r];return[void 0,void 0]}}gi.NotebookDocumentSyncFeature=zt,zt.CellScheme="vscode-notebook-cell";var Ot={};Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.SyncConfigurationFeature=Ot.toJSONObject=Ot.ConfigurationFeature=void 0;const on=ne.default,Fn=re,Uu=_e,Ku=me,ba=ye;class zu{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(Fn.ConfigurationRequest.type,(n,i)=>{let r=s=>{let a=[];for(let c of s.items){let d=c.scopeUri!==void 0&&c.scopeUri!==null?this._client.protocol2CodeConverter.asUri(c.scopeUri):void 0;a.push(this.getConfiguration(d,c.section!==null?c.section:void 0))}return a},o=t.middleware.workspace;return o&&o.configuration?o.configuration(n,i,r):r(n)})}getConfiguration(t,n){let i=null;if(n){let r=n.lastIndexOf(".");if(r===-1)i=Ht(on.workspace.getConfiguration(void 0,t).get(n));else{let o=on.workspace.getConfiguration(n.substr(0,r),t);o&&(i=Ht(o.get(n.substr(r+1))))}}else{let r=on.workspace.getConfiguration(void 0,t);i={};for(let o of Object.keys(r))r.has(o)&&(i[o]=Ht(r.get(o)))}return i===void 0&&(i=null),i}dispose(){}}Ot.ConfigurationFeature=zu;function Ht(e){if(e){if(Array.isArray(e))return e.map(Ht);if(typeof e=="object"){const t=Object.create(null);for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Ht(e[n]));return t}}return e}Ot.toJSONObject=Ht;class xu{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 Fn.DidChangeConfigurationNotification.type}fillClientCapabilities(t){(0,ba.ensure)((0,ba.ensure)(t,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){let t=this._client.clientOptions.synchronize?.configurationSection;t!==void 0&&this.register({id:Ku.generateUuid(),registerOptions:{section:t}})}register(t){let n=on.workspace.onDidChangeConfiguration(i=>{this.onDidChangeConfiguration(t.registerOptions.section,i)});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 i;if(Uu.string(t)?i=[t]:i=t,i!==void 0&&n!==void 0&&!i.some(a=>n.affectsConfiguration(a)))return;const r=async s=>s===void 0?this._client.sendNotification(Fn.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(Fn.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(s)});let o=this._client.middleware.workspace?.didChangeConfiguration;(o?o(i,r):r(i)).catch(s=>{this._client.error(`Sending notification ${Fn.DidChangeConfigurationNotification.type.method} failed`,s)})}extractSettingsInformation(t){function n(o,s){let a=o;for(let c=0;c<s.length-1;c++){let d=a[s[c]];d||(d=Object.create(null),a[s[c]]=d),a=d}return a}let i=this._client.clientOptions.workspaceFolder?this._client.clientOptions.workspaceFolder.uri:void 0,r=Object.create(null);for(let o=0;o<t.length;o++){let s=t[o],a=s.indexOf("."),c=null;if(a>=0?c=on.workspace.getConfiguration(s.substr(0,a),i).get(s.substr(a+1)):c=on.workspace.getConfiguration(void 0,i).get(s),c){let d=t[o].split(".");n(r,d)[d[d.length-1]]=Ht(c)}}return r}}Ot.SyncConfigurationFeature=xu;var nt={};Object.defineProperty(nt,"__esModule",{value:!0}),nt.DidSaveTextDocumentFeature=nt.WillSaveWaitUntilFeature=nt.WillSaveFeature=nt.DidChangeTextDocumentFeature=nt.DidCloseTextDocumentFeature=nt.DidOpenTextDocumentFeature=void 0;const ft=ne.default,We=re,Ee=ye,Bu=Ze,sn=me;class Vu extends Ee.TextDocumentEventFeature{constructor(t,n){super(t,ft.workspace.onDidOpenTextDocument,We.DidOpenTextDocumentNotification.type,()=>t.middleware.didOpen,i=>t.code2ProtocolConverter.asOpenTextDocumentParams(i),i=>i,Ee.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=n}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(t){(0,Ee.ensure)((0,Ee.ensure)(t,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(t,n){const i=t.resolvedTextDocumentSync;n&&i&&i.openClose&&this.register({id:sn.generateUuid(),registerOptions:{documentSelector:n}})}get registrationType(){return We.DidOpenTextDocumentNotification.type}register(t){if(super.register(t),!t.registerOptions.documentSelector)return;const n=this._client.protocol2CodeConverter.asDocumentSelector(t.registerOptions.documentSelector);ft.workspace.textDocuments.forEach(i=>{const r=i.uri.toString();if(!this._syncedDocuments.has(r)&&ft.languages.match(n,i)>0&&!this._client.hasDedicatedTextSynchronizationFeature(i)){const o=this._client.middleware,s=a=>this._client.sendNotification(this._type,this._createParams(a));(o.didOpen?o.didOpen(i,s):s(i)).catch(a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)}),this._syncedDocuments.set(r,i)}})}notificationSent(t,n,i){super.notificationSent(t,n,i),this._syncedDocuments.set(t.uri.toString(),t)}}nt.DidOpenTextDocumentFeature=Vu;class Ju extends Ee.TextDocumentEventFeature{constructor(t,n){super(t,ft.workspace.onDidCloseTextDocument,We.DidCloseTextDocumentNotification.type,()=>t.middleware.didClose,i=>t.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,Ee.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=n}get registrationType(){return We.DidCloseTextDocumentNotification.type}fillClientCapabilities(t){(0,Ee.ensure)((0,Ee.ensure)(t,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(t,n){let i=t.resolvedTextDocumentSync;n&&i&&i.openClose&&this.register({id:sn.generateUuid(),registerOptions:{documentSelector:n}})}notificationSent(t,n,i){super.notificationSent(t,n,i),this._syncedDocuments.delete(t.uri.toString())}unregister(t){const n=this._selectors.get(t);super.unregister(t);const i=this._selectors.values();this._syncedDocuments.forEach(r=>{if(ft.languages.match(n,r)>0&&!this._selectorFilter(i,r)&&!this._client.hasDedicatedTextSynchronizationFeature(r)){let o=this._client.middleware,s=a=>this._client.sendNotification(this._type,this._createParams(a));this._syncedDocuments.delete(r.uri.toString()),(o.didClose?o.didClose(r,s):s(r)).catch(a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})}})}}nt.DidCloseTextDocumentFeature=Ju;class Qu extends Ee.DynamicDocumentFeature{constructor(t){super(t),this._forcingDelivery=!1,this._changeData=new Map,this._onNotificationSent=new ft.EventEmitter}get registrationType(){return We.DidChangeTextDocumentNotification.type}fillClientCapabilities(t){(0,Ee.ensure)((0,Ee.ensure)(t,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(t,n){let i=t.resolvedTextDocumentSync;n&&i&&i.change!==void 0&&i.change!==We.TextDocumentSyncKind.None&&this.register({id:sn.generateUuid(),registerOptions:Object.assign({},{documentSelector:n},{syncKind:i.change})})}register(t){!t.registerOptions.documentSelector||(this._listener||(this._listener=ft.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 i of this._changeData.values())if(ft.languages.match(i.documentSelector,t.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(t.document)){const r=this._client.middleware;if(i.syncKind===We.TextDocumentSyncKind.Incremental){const o=async s=>{const a=this._client.code2ProtocolConverter.asChangeTextDocumentParams(s);await this._client.sendNotification(We.DidChangeTextDocumentNotification.type,a),this.notificationSent(s,We.DidChangeTextDocumentNotification.type,a)};n.push(r.didChange?r.didChange(t,s=>o(s)):o(t))}else if(i.syncKind===We.TextDocumentSyncKind.Full){const o=async s=>{const a=async c=>{const d=this._client.code2ProtocolConverter.asChangeTextDocumentParams(c.document);await this._client.sendNotification(We.DidChangeTextDocumentNotification.type,d),this.notificationSent(c,We.DidChangeTextDocumentNotification.type,d)};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 Bu.Delayer(200)},this._changeDelayer.delayer.trigger(()=>a(s),-1))};n.push(r.didChange?r.didChange(t,s=>o(s)):o(t))}}return Promise.all(n).then(void 0,i=>{throw this._client.error(`Sending document notification ${We.DidChangeTextDocumentNotification.type.method} failed`,i),i})}get onNotificationSent(){return this._onNotificationSent.event}notificationSent(t,n,i){this._onNotificationSent.fire({original:t,type:n,params:i})}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(ft.languages.match(n.documentSelector,t)>0)return{send:i=>this.callback(i)}}}nt.DidChangeTextDocumentFeature=Qu;class Gu extends Ee.TextDocumentEventFeature{constructor(t){super(t,ft.workspace.onWillSaveTextDocument,We.WillSaveTextDocumentNotification.type,()=>t.middleware.willSave,n=>t.code2ProtocolConverter.asWillSaveTextDocumentParams(n),n=>n.document,(n,i)=>Ee.TextDocumentEventFeature.textDocumentFilter(n,i.document))}get registrationType(){return We.WillSaveTextDocumentNotification.type}fillClientCapabilities(t){let n=(0,Ee.ensure)((0,Ee.ensure)(t,"textDocument"),"synchronization");n.willSave=!0}initialize(t,n){let i=t.resolvedTextDocumentSync;n&&i&&i.willSave&&this.register({id:sn.generateUuid(),registerOptions:{documentSelector:n}})}}nt.WillSaveFeature=Gu;class Xu extends Ee.DynamicDocumentFeature{constructor(t){super(t),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return We.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(t){let n=(0,Ee.ensure)((0,Ee.ensure)(t,"textDocument"),"synchronization");n.willSaveWaitUntil=!0}initialize(t,n){let i=t.resolvedTextDocumentSync;n&&i&&i.willSaveWaitUntil&&this.register({id:sn.generateUuid(),registerOptions:{documentSelector:n}})}register(t){!t.registerOptions.documentSelector||(this._listener||(this._listener=ft.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(t.id,this._client.protocol2CodeConverter.asDocumentSelector(t.registerOptions.documentSelector)))}callback(t){if(Ee.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),t.document)&&!this._client.hasDedicatedTextSynchronizationFeature(t.document)){let n=this._client.middleware,i=r=>this._client.sendRequest(We.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(r)).then(async o=>{let s=await this._client.protocol2CodeConverter.asTextEdits(o);return s===void 0?[]:s});t.waitUntil(n.willSaveWaitUntil?n.willSaveWaitUntil(t,i):i(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)}}nt.WillSaveWaitUntilFeature=Xu;class Yu extends Ee.TextDocumentEventFeature{constructor(t){super(t,ft.workspace.onDidSaveTextDocument,We.DidSaveTextDocumentNotification.type,()=>t.middleware.didSave,n=>t.code2ProtocolConverter.asSaveTextDocumentParams(n,this._includeText),n=>n,Ee.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return We.DidSaveTextDocumentNotification.type}fillClientCapabilities(t){(0,Ee.ensure)((0,Ee.ensure)(t,"textDocument"),"synchronization").didSave=!0}initialize(t,n){const i=t.resolvedTextDocumentSync;if(n&&i&&i.save){const r=typeof i.save=="boolean"?{includeText:!1}:{includeText:!!i.save.includeText};this.register({id:sn.generateUuid(),registerOptions:Object.assign({},{documentSelector:n},r)})}}register(t){this._includeText=!!t.registerOptions.includeText,super.register(t)}}nt.DidSaveTextDocumentFeature=Yu;var vi={};Object.defineProperty(vi,"__esModule",{value:!0}),vi.CompletionItemFeature=void 0;const Zu=ne.default,fe=re,_o=ye,ed=me,td=[fe.CompletionItemKind.Text,fe.CompletionItemKind.Method,fe.CompletionItemKind.Function,fe.CompletionItemKind.Constructor,fe.CompletionItemKind.Field,fe.CompletionItemKind.Variable,fe.CompletionItemKind.Class,fe.CompletionItemKind.Interface,fe.CompletionItemKind.Module,fe.CompletionItemKind.Property,fe.CompletionItemKind.Unit,fe.CompletionItemKind.Value,fe.CompletionItemKind.Enum,fe.CompletionItemKind.Keyword,fe.CompletionItemKind.Snippet,fe.CompletionItemKind.Color,fe.CompletionItemKind.File,fe.CompletionItemKind.Reference,fe.CompletionItemKind.Folder,fe.CompletionItemKind.EnumMember,fe.CompletionItemKind.Constant,fe.CompletionItemKind.Struct,fe.CompletionItemKind.Event,fe.CompletionItemKind.Operator,fe.CompletionItemKind.TypeParameter];class nd extends _o.TextDocumentLanguageFeature{constructor(t){super(t,fe.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(t){let n=(0,_o.ensure)((0,_o.ensure)(t,"textDocument"),"completion");n.dynamicRegistration=!0,n.contextSupport=!0,n.completionItem={snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[fe.MarkupKind.Markdown,fe.MarkupKind.PlainText],deprecatedSupport:!0,preselectSupport:!0,tagSupport:{valueSet:[fe.CompletionItemTag.Deprecated]},insertReplaceSupport:!0,resolveSupport:{properties:["documentation","detail","additionalTextEdits"]},insertTextModeSupport:{valueSet:[fe.InsertTextMode.asIs,fe.InsertTextMode.adjustIndentation]},labelDetailsSupport:!0},n.insertTextMode=fe.InsertTextMode.adjustIndentation,n.completionItemKind={valueSet:td},n.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode"]}}initialize(t,n){const i=this.getRegistrationOptions(n,t.completionProvider);!i||this.register({id:ed.generateUuid(),registerOptions:i})}registerLanguageProvider(t,n){this.labelDetailsSupport.set(n,!!t.completionItem?.labelDetailsSupport);const i=t.triggerCharacters??[],r=t.allCommitCharacters,o=t.documentSelector,s={provideCompletionItems:(a,c,d,m)=>{const g=this._client,l=this._client.middleware,h=(y,P,I,N)=>g.sendRequest(fe.CompletionRequest.type,g.code2ProtocolConverter.asCompletionParams(y,P,I),N).then(w=>N.isCancellationRequested?null:g.protocol2CodeConverter.asCompletionResult(w,r,N),w=>g.handleFailedRequest(fe.CompletionRequest.type,N,w,null));return l.provideCompletionItem?l.provideCompletionItem(a,c,m,d,h):h(a,c,m,d)},resolveCompletionItem:t.resolveProvider?(a,c)=>{const d=this._client,m=this._client.middleware,g=(l,h)=>d.sendRequest(fe.CompletionResolveRequest.type,d.code2ProtocolConverter.asCompletionItem(l,!!this.labelDetailsSupport.get(n)),h).then(y=>h.isCancellationRequested?null:d.protocol2CodeConverter.asCompletionItem(y),y=>d.handleFailedRequest(fe.CompletionResolveRequest.type,h,y,l));return m.resolveCompletionItem?m.resolveCompletionItem(a,c,g):g(a,c)}:void 0};return[Zu.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(o),s,...i),s]}}vi.CompletionItemFeature=nd;var Ci={};Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.HoverFeature=void 0;const id=ne.default,qn=re,bo=ye,rd=me;class od extends bo.TextDocumentLanguageFeature{constructor(t){super(t,qn.HoverRequest.type)}fillClientCapabilities(t){const n=(0,bo.ensure)((0,bo.ensure)(t,"textDocument"),"hover");n.dynamicRegistration=!0,n.contentFormat=[qn.MarkupKind.Markdown,qn.MarkupKind.PlainText]}initialize(t,n){const i=this.getRegistrationOptions(n,t.hoverProvider);!i||this.register({id:rd.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,i={provideHover:(r,o,s)=>{const a=this._client,c=(m,g,l)=>a.sendRequest(qn.HoverRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),l).then(h=>l.isCancellationRequested?null:a.protocol2CodeConverter.asHover(h),h=>a.handleFailedRequest(qn.HoverRequest.type,l,h,null)),d=a.middleware;return d.provideHover?d.provideHover(r,o,s,c):c(r,o,s)}};return[this.registerProvider(n,i),i]}registerProvider(t,n){return id.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Ci.HoverFeature=od;var _i={};Object.defineProperty(_i,"__esModule",{value:!0}),_i.DefinitionFeature=void 0;const sd=ne.default,wo=re,Ro=ye,ad=me;class cd extends Ro.TextDocumentLanguageFeature{constructor(t){super(t,wo.DefinitionRequest.type)}fillClientCapabilities(t){let n=(0,Ro.ensure)((0,Ro.ensure)(t,"textDocument"),"definition");n.dynamicRegistration=!0,n.linkSupport=!0}initialize(t,n){const i=this.getRegistrationOptions(n,t.definitionProvider);!i||this.register({id:ad.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,i={provideDefinition:(r,o,s)=>{const a=this._client,c=(m,g,l)=>a.sendRequest(wo.DefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),l).then(h=>l.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(h,l),h=>a.handleFailedRequest(wo.DefinitionRequest.type,l,h,null)),d=a.middleware;return d.provideDefinition?d.provideDefinition(r,o,s,c):c(r,o,s)}};return[this.registerProvider(n,i),i]}registerProvider(t,n){return sd.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}_i.DefinitionFeature=cd;var bi={};Object.defineProperty(bi,"__esModule",{value:!0}),bi.SignatureHelpFeature=void 0;const wa=ne.default,En=re,Do=ye,ud=me;class dd extends Do.TextDocumentLanguageFeature{constructor(t){super(t,En.SignatureHelpRequest.type)}fillClientCapabilities(t){let n=(0,Do.ensure)((0,Do.ensure)(t,"textDocument"),"signatureHelp");n.dynamicRegistration=!0,n.signatureInformation={documentationFormat:[En.MarkupKind.Markdown,En.MarkupKind.PlainText]},n.signatureInformation.parameterInformation={labelOffsetSupport:!0},n.signatureInformation.activeParameterSupport=!0,n.contextSupport=!0}initialize(t,n){const i=this.getRegistrationOptions(n,t.signatureHelpProvider);!i||this.register({id:ud.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n={provideSignatureHelp:(i,r,o,s)=>{const a=this._client,c=(m,g,l,h)=>a.sendRequest(En.SignatureHelpRequest.type,a.code2ProtocolConverter.asSignatureHelpParams(m,g,l),h).then(y=>h.isCancellationRequested?null:a.protocol2CodeConverter.asSignatureHelp(y,h),y=>a.handleFailedRequest(En.SignatureHelpRequest.type,h,y,null)),d=a.middleware;return d.provideSignatureHelp?d.provideSignatureHelp(i,r,s,o,c):c(i,r,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(t,n){const i=this._client.protocol2CodeConverter.asDocumentSelector(t.documentSelector);if(t.retriggerCharacters===void 0){const r=t.triggerCharacters||[];return wa.languages.registerSignatureHelpProvider(i,n,...r)}else{const r={triggerCharacters:t.triggerCharacters||[],retriggerCharacters:t.retriggerCharacters||[]};return wa.languages.registerSignatureHelpProvider(i,n,r)}}}bi.SignatureHelpFeature=dd;var wi={};Object.defineProperty(wi,"__esModule",{value:!0}),wi.DocumentHighlightFeature=void 0;const ld=ne.default,So=re,To=ye,fd=me;class hd extends To.TextDocumentLanguageFeature{constructor(t){super(t,So.DocumentHighlightRequest.type)}fillClientCapabilities(t){(0,To.ensure)((0,To.ensure)(t,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(t,n){const i=this.getRegistrationOptions(n,t.documentHighlightProvider);!i||this.register({id:fd.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,i={provideDocumentHighlights:(r,o,s)=>{const a=this._client,c=(m,g,l)=>a.sendRequest(So.DocumentHighlightRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),l).then(h=>l.isCancellationRequested?null:a.protocol2CodeConverter.asDocumentHighlights(h,l),h=>a.handleFailedRequest(So.DocumentHighlightRequest.type,l,h,null)),d=a.middleware;return d.provideDocumentHighlights?d.provideDocumentHighlights(r,o,s,c):c(r,o,s)}};return[ld.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),i),i]}}wi.DocumentHighlightFeature=hd;var Po={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DocumentSymbolFeature=e.SupportedSymbolTags=e.SupportedSymbolKinds=void 0;const t=ne.default,n=re,i=ye,r=me;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 i.TextDocumentLanguageFeature{constructor(a){super(a,n.DocumentSymbolRequest.type)}fillClientCapabilities(a){let c=(0,i.ensure)((0,i.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 d=this.getRegistrationOptions(c,a.documentSymbolProvider);!d||this.register({id:r.generateUuid(),registerOptions:d})}registerLanguageProvider(a){const c=a.documentSelector,d={provideDocumentSymbols:(g,l)=>{const h=this._client,y=(I,N)=>h.sendRequest(n.DocumentSymbolRequest.type,h.code2ProtocolConverter.asDocumentSymbolParams(I),N).then(async w=>{if(N.isCancellationRequested||w===void 0||w===null)return null;if(w.length===0)return[];{const S=w[0];return n.DocumentSymbol.is(S)?await h.protocol2CodeConverter.asDocumentSymbols(w,N):await h.protocol2CodeConverter.asSymbolInformations(w,N)}},w=>h.handleFailedRequest(n.DocumentSymbolRequest.type,N,w,null)),P=h.middleware;return P.provideDocumentSymbols?P.provideDocumentSymbols(g,l,y):y(g,l)}},m=a.label!==void 0?{label:a.label}:void 0;return[t.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(c),d,m),d]}}e.DocumentSymbolFeature=o})(Po);var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.WorkspaceSymbolFeature=void 0;const gd=ne.default,On=re,ko=ye,Ra=Po,pd=me;class md extends ko.WorkspaceFeature{constructor(t){super(t,On.WorkspaceSymbolRequest.type)}fillClientCapabilities(t){let n=(0,ko.ensure)((0,ko.ensure)(t,"workspace"),"symbol");n.dynamicRegistration=!0,n.symbolKind={valueSet:Ra.SupportedSymbolKinds},n.tagSupport={valueSet:Ra.SupportedSymbolTags},n.resolveSupport={properties:["location.range"]}}initialize(t){!t.workspaceSymbolProvider||this.register({id:pd.generateUuid(),registerOptions:t.workspaceSymbolProvider===!0?{workDoneProgress:!1}:t.workspaceSymbolProvider})}registerLanguageProvider(t){const n={provideWorkspaceSymbols:(i,r)=>{const o=this._client,s=(c,d)=>o.sendRequest(On.WorkspaceSymbolRequest.type,{query:c},d).then(m=>d.isCancellationRequested?null:o.protocol2CodeConverter.asSymbolInformations(m,d),m=>o.handleFailedRequest(On.WorkspaceSymbolRequest.type,d,m,null)),a=o.middleware;return a.provideWorkspaceSymbols?a.provideWorkspaceSymbols(i,r,s):s(i,r)},resolveWorkspaceSymbol:t.resolveProvider===!0?(i,r)=>{const o=this._client,s=(c,d)=>o.sendRequest(On.WorkspaceSymbolResolveRequest.type,o.code2ProtocolConverter.asWorkspaceSymbol(c),d).then(m=>d.isCancellationRequested?null:o.protocol2CodeConverter.asSymbolInformation(m),m=>o.handleFailedRequest(On.WorkspaceSymbolResolveRequest.type,d,m,null)),a=o.middleware;return a.resolveWorkspaceSymbol?a.resolveWorkspaceSymbol(i,r,s):s(i,r)}:void 0};return[gd.languages.registerWorkspaceSymbolProvider(n),n]}}Ri.WorkspaceSymbolFeature=md;var Di={};Object.defineProperty(Di,"__esModule",{value:!0}),Di.ReferencesFeature=void 0;const yd=ne.default,Fo=re,qo=ye,vd=me;class Cd extends qo.TextDocumentLanguageFeature{constructor(t){super(t,Fo.ReferencesRequest.type)}fillClientCapabilities(t){(0,qo.ensure)((0,qo.ensure)(t,"textDocument"),"references").dynamicRegistration=!0}initialize(t,n){const i=this.getRegistrationOptions(n,t.referencesProvider);!i||this.register({id:vd.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,i={provideReferences:(r,o,s,a)=>{const c=this._client,d=(g,l,h,y)=>c.sendRequest(Fo.ReferencesRequest.type,c.code2ProtocolConverter.asReferenceParams(g,l,h),y).then(P=>y.isCancellationRequested?null:c.protocol2CodeConverter.asReferences(P,y),P=>c.handleFailedRequest(Fo.ReferencesRequest.type,y,P,null)),m=c.middleware;return m.provideReferences?m.provideReferences(r,o,s,a,d):d(r,o,s,a)}};return[this.registerProvider(n,i),i]}registerProvider(t,n){return yd.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Di.ReferencesFeature=Cd;var Si={};Object.defineProperty(Si,"__esModule",{value:!0}),Si.CodeActionFeature=void 0;const _d=ne.default,ct=re,bd=me,Eo=ye;class wd extends Eo.TextDocumentLanguageFeature{constructor(t){super(t,ct.CodeActionRequest.type)}fillClientCapabilities(t){const n=(0,Eo.ensure)((0,Eo.ensure)(t,"textDocument"),"codeAction");n.dynamicRegistration=!0,n.isPreferredSupport=!0,n.disabledSupport=!0,n.dataSupport=!0,n.resolveSupport={properties:["edit"]},n.codeActionLiteralSupport={codeActionKind:{valueSet:[ct.CodeActionKind.Empty,ct.CodeActionKind.QuickFix,ct.CodeActionKind.Refactor,ct.CodeActionKind.RefactorExtract,ct.CodeActionKind.RefactorInline,ct.CodeActionKind.RefactorRewrite,ct.CodeActionKind.Source,ct.CodeActionKind.SourceOrganizeImports]}},n.honorsChangeAnnotations=!1}initialize(t,n){const i=this.getRegistrationOptions(n,t.codeActionProvider);!i||this.register({id:bd.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,i={provideCodeActions:(r,o,s,a)=>{const c=this._client,d=async(g,l,h,y)=>{const P={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),range:c.code2ProtocolConverter.asRange(l),context:await c.code2ProtocolConverter.asCodeActionContext(h,y)};return c.sendRequest(ct.CodeActionRequest.type,P,y).then(I=>y.isCancellationRequested||I===null||I===void 0?null:c.protocol2CodeConverter.asCodeActionResult(I,y),I=>c.handleFailedRequest(ct.CodeActionRequest.type,y,I,null))},m=c.middleware;return m.provideCodeActions?m.provideCodeActions(r,o,s,a,d):d(r,o,s,a)},resolveCodeAction:t.resolveProvider?(r,o)=>{const s=this._client,a=this._client.middleware,c=async(d,m)=>s.sendRequest(ct.CodeActionResolveRequest.type,await s.code2ProtocolConverter.asCodeAction(d,m),m).then(g=>m.isCancellationRequested?d:s.protocol2CodeConverter.asCodeAction(g,m),g=>s.handleFailedRequest(ct.CodeActionResolveRequest.type,m,g,d));return a.resolveCodeAction?a.resolveCodeAction(r,o,c):c(r,o)}:void 0};return[_d.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),i,t.codeActionKinds?{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(t.codeActionKinds)}:void 0),i]}}Si.CodeActionFeature=wd;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.CodeLensFeature=void 0;const Da=ne.default,an=re,Rd=me,Nn=ye;class Dd extends Nn.TextDocumentLanguageFeature{constructor(t){super(t,an.CodeLensRequest.type)}fillClientCapabilities(t){(0,Nn.ensure)((0,Nn.ensure)(t,"textDocument"),"codeLens").dynamicRegistration=!0,(0,Nn.ensure)((0,Nn.ensure)(t,"workspace"),"codeLens").refreshSupport=!0}initialize(t,n){this._client.onRequest(an.CodeLensRefreshRequest.type,async()=>{for(const o of this.getAllProviders())o.onDidChangeCodeLensEmitter.fire()});const r=this.getRegistrationOptions(n,t.codeLensProvider);!r||this.register({id:Rd.generateUuid(),registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i=new Da.EventEmitter,r={onDidChangeCodeLenses:i.event,provideCodeLenses:(o,s)=>{const a=this._client,c=(m,g)=>a.sendRequest(an.CodeLensRequest.type,a.code2ProtocolConverter.asCodeLensParams(m),g).then(l=>g.isCancellationRequested?null:a.protocol2CodeConverter.asCodeLenses(l,g),l=>a.handleFailedRequest(an.CodeLensRequest.type,g,l,null)),d=a.middleware;return d.provideCodeLenses?d.provideCodeLenses(o,s,c):c(o,s)},resolveCodeLens:t.resolveProvider?(o,s)=>{const a=this._client,c=(m,g)=>a.sendRequest(an.CodeLensResolveRequest.type,a.code2ProtocolConverter.asCodeLens(m),g).then(l=>g.isCancellationRequested?m:a.protocol2CodeConverter.asCodeLens(l),l=>a.handleFailedRequest(an.CodeLensResolveRequest.type,g,l,m)),d=a.middleware;return d.resolveCodeLens?d.resolveCodeLens(o,s,c):c(o,s)}:void 0};return[Da.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),r),{provider:r,onDidChangeCodeLensEmitter:i}]}}Ti.CodeLensFeature=Dd;var Nt={};Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.DocumentOnTypeFormattingFeature=Nt.DocumentRangeFormattingFeature=Nt.DocumentFormattingFeature=void 0;const Pi=ne.default,Tt=re,Oo=me,Pt=ye;var In;(function(e){function t(n){const i=Pi.workspace.getConfiguration("files",n);return{trimTrailingWhitespace:i.get("trimTrailingWhitespace"),trimFinalNewlines:i.get("trimFinalNewlines"),insertFinalNewline:i.get("insertFinalNewline")}}e.fromConfiguration=t})(In||(In={}));class Sd extends Pt.TextDocumentLanguageFeature{constructor(t){super(t,Tt.DocumentFormattingRequest.type)}fillClientCapabilities(t){(0,Pt.ensure)((0,Pt.ensure)(t,"textDocument"),"formatting").dynamicRegistration=!0}initialize(t,n){const i=this.getRegistrationOptions(n,t.documentFormattingProvider);!i||this.register({id:Oo.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,i={provideDocumentFormattingEdits:(r,o,s)=>{const a=this._client,c=(m,g,l)=>{const h={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(m),options:a.code2ProtocolConverter.asFormattingOptions(g,In.fromConfiguration(m))};return a.sendRequest(Tt.DocumentFormattingRequest.type,h,l).then(y=>l.isCancellationRequested?null:a.protocol2CodeConverter.asTextEdits(y,l),y=>a.handleFailedRequest(Tt.DocumentFormattingRequest.type,l,y,null))},d=a.middleware;return d.provideDocumentFormattingEdits?d.provideDocumentFormattingEdits(r,o,s,c):c(r,o,s)}};return[Pi.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),i),i]}}Nt.DocumentFormattingFeature=Sd;class Td extends Pt.TextDocumentLanguageFeature{constructor(t){super(t,Tt.DocumentRangeFormattingRequest.type)}fillClientCapabilities(t){(0,Pt.ensure)((0,Pt.ensure)(t,"textDocument"),"rangeFormatting").dynamicRegistration=!0}initialize(t,n){const i=this.getRegistrationOptions(n,t.documentRangeFormattingProvider);!i||this.register({id:Oo.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,i={provideDocumentRangeFormattingEdits:(r,o,s,a)=>{const c=this._client,d=(g,l,h,y)=>{const P={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),range:c.code2ProtocolConverter.asRange(l),options:c.code2ProtocolConverter.asFormattingOptions(h,In.fromConfiguration(g))};return c.sendRequest(Tt.DocumentRangeFormattingRequest.type,P,y).then(I=>y.isCancellationRequested?null:c.protocol2CodeConverter.asTextEdits(I,y),I=>c.handleFailedRequest(Tt.DocumentRangeFormattingRequest.type,y,I,null))},m=c.middleware;return m.provideDocumentRangeFormattingEdits?m.provideDocumentRangeFormattingEdits(r,o,s,a,d):d(r,o,s,a)}};return[Pi.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),i),i]}}Nt.DocumentRangeFormattingFeature=Td;class Pd extends Pt.TextDocumentLanguageFeature{constructor(t){super(t,Tt.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(t){(0,Pt.ensure)((0,Pt.ensure)(t,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(t,n){const i=this.getRegistrationOptions(n,t.documentOnTypeFormattingProvider);!i||this.register({id:Oo.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,i={provideOnTypeFormattingEdits:(o,s,a,c,d)=>{const m=this._client,g=(h,y,P,I,N)=>{let w={textDocument:m.code2ProtocolConverter.asTextDocumentIdentifier(h),position:m.code2ProtocolConverter.asPosition(y),ch:P,options:m.code2ProtocolConverter.asFormattingOptions(I,In.fromConfiguration(h))};return m.sendRequest(Tt.DocumentOnTypeFormattingRequest.type,w,N).then(S=>N.isCancellationRequested?null:m.protocol2CodeConverter.asTextEdits(S,N),S=>m.handleFailedRequest(Tt.DocumentOnTypeFormattingRequest.type,N,S,null))},l=m.middleware;return l.provideOnTypeFormattingEdits?l.provideOnTypeFormattingEdits(o,s,a,c,d,g):g(o,s,a,c,d)}},r=t.moreTriggerCharacter||[];return[Pi.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),i,t.firstTriggerCharacter,...r),i]}}Nt.DocumentOnTypeFormattingFeature=Pd;var ki={};Object.defineProperty(ki,"__esModule",{value:!0}),ki.RenameFeature=void 0;const kd=ne.default,$t=re,Fd=me,Sa=_e,No=ye;class qd extends No.TextDocumentLanguageFeature{constructor(t){super(t,$t.RenameRequest.type)}fillClientCapabilities(t){let n=(0,No.ensure)((0,No.ensure)(t,"textDocument"),"rename");n.dynamicRegistration=!0,n.prepareSupport=!0,n.prepareSupportDefaultBehavior=$t.PrepareSupportDefaultBehavior.Identifier,n.honorsChangeAnnotations=!0}initialize(t,n){const i=this.getRegistrationOptions(n,t.renameProvider);!i||(Sa.boolean(t.renameProvider)&&(i.prepareProvider=!1),this.register({id:Fd.generateUuid(),registerOptions:i}))}registerLanguageProvider(t){const n=t.documentSelector,i={provideRenameEdits:(r,o,s,a)=>{const c=this._client,d=(g,l,h,y)=>{let P={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),position:c.code2ProtocolConverter.asPosition(l),newName:h};return c.sendRequest($t.RenameRequest.type,P,y).then(I=>y.isCancellationRequested?null:c.protocol2CodeConverter.asWorkspaceEdit(I,y),I=>c.handleFailedRequest($t.RenameRequest.type,y,I,null,!1))},m=c.middleware;return m.provideRenameEdits?m.provideRenameEdits(r,o,s,a,d):d(r,o,s,a)},prepareRename:t.prepareProvider?(r,o,s)=>{const a=this._client,c=(m,g,l)=>{let h={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(m),position:a.code2ProtocolConverter.asPosition(g)};return a.sendRequest($t.PrepareRenameRequest.type,h,l).then(y=>l.isCancellationRequested?null:$t.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&&$t.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.")})},d=a.middleware;return d.prepareRename?d.prepareRename(r,o,s,c):c(r,o,s)}:void 0};return[this.registerProvider(n,i),i]}registerProvider(t,n){return kd.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}isDefaultBehavior(t){const n=t;return n&&Sa.boolean(n.defaultBehavior)}}ki.RenameFeature=qd;var Fi={};Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.DocumentLinkFeature=void 0;const Ed=ne.default,Mn=re,Io=ye,Od=me;class Nd extends Io.TextDocumentLanguageFeature{constructor(t){super(t,Mn.DocumentLinkRequest.type)}fillClientCapabilities(t){const n=(0,Io.ensure)((0,Io.ensure)(t,"textDocument"),"documentLink");n.dynamicRegistration=!0,n.tooltipSupport=!0}initialize(t,n){const i=this.getRegistrationOptions(n,t.documentLinkProvider);!i||this.register({id:Od.generateUuid(),registerOptions:i})}registerLanguageProvider(t){const n=t.documentSelector,i={provideDocumentLinks:(r,o)=>{const s=this._client,a=(d,m)=>s.sendRequest(Mn.DocumentLinkRequest.type,s.code2ProtocolConverter.asDocumentLinkParams(d),m).then(g=>m.isCancellationRequested?null:s.protocol2CodeConverter.asDocumentLinks(g,m),g=>s.handleFailedRequest(Mn.DocumentLinkRequest.type,m,g,null)),c=s.middleware;return c.provideDocumentLinks?c.provideDocumentLinks(r,o,a):a(r,o)},resolveDocumentLink:t.resolveProvider?(r,o)=>{const s=this._client;let a=(d,m)=>s.sendRequest(Mn.DocumentLinkResolveRequest.type,s.code2ProtocolConverter.asDocumentLink(d),m).then(g=>m.isCancellationRequested?d:s.protocol2CodeConverter.asDocumentLink(g),g=>s.handleFailedRequest(Mn.DocumentLinkResolveRequest.type,m,g,d));const c=s.middleware;return c.resolveDocumentLink?c.resolveDocumentLink(r,o,a):a(r,o)}:void 0};return[Ed.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),i),i]}}Fi.DocumentLinkFeature=Nd;var qi={};Object.defineProperty(qi,"__esModule",{value:!0}),qi.ExecuteCommandFeature=void 0;const Id=ne.default,Mo=re,Md=me,Ta=ye;class Ld{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 Mo.ExecuteCommandRequest.type}fillClientCapabilities(t){(0,Ta.ensure)((0,Ta.ensure)(t,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(t){!t.executeCommandProvider||this.register({id:Md.generateUuid(),registerOptions:Object.assign({},t.executeCommandProvider)})}register(t){const n=this._client,i=n.middleware,r=(o,s)=>{let a={command:o,arguments:s};return n.sendRequest(Mo.ExecuteCommandRequest.type,a).then(void 0,c=>n.handleFailedRequest(Mo.ExecuteCommandRequest.type,void 0,c,void 0))};if(t.registerOptions.commands){const o=[];for(const s of t.registerOptions.commands)o.push(Id.commands.registerCommand(s,(...a)=>i.executeCommand?i.executeCommand(s,a,r):r(s,a)));this._commands.set(t.id,o)}}unregister(t){let n=this._commands.get(t);n&&n.forEach(i=>i.dispose())}dispose(){this._commands.forEach(t=>{t.forEach(n=>n.dispose())}),this._commands.clear()}}qi.ExecuteCommandFeature=Ld;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0}),Ei.FileSystemWatcherFeature=void 0;const jd=ne.default,Wt=re,Oi=ye;class Ad{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 Wt.DidChangeWatchedFilesNotification.type}fillClientCapabilities(t){(0,Oi.ensure)((0,Oi.ensure)(t,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,Oi.ensure)((0,Oi.ensure)(t,"workspace"),"didChangeWatchedFiles").relativePatternSupport=!0}initialize(t,n){}register(t){if(!Array.isArray(t.registerOptions.watchers))return;const n=[];for(const i of t.registerOptions.watchers){const r=this._client.protocol2CodeConverter.asGlobPattern(i.globPattern);if(r===void 0)continue;let o=!0,s=!0,a=!0;i.kind!==void 0&&i.kind!==null&&(o=(i.kind&Wt.WatchKind.Create)!==0,s=(i.kind&Wt.WatchKind.Change)!==0,a=(i.kind&Wt.WatchKind.Delete)!==0);const c=jd.workspace.createFileSystemWatcher(r,!o,!s,!a);this.hookListeners(c,o,s,a,n),n.push(c)}this._watchers.set(t.id,n)}registerRaw(t,n){let i=[];for(let r of n)this.hookListeners(r,!0,!0,!0,i);this._watchers.set(t,i)}hookListeners(t,n,i,r,o){n&&t.onDidCreate(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:Wt.FileChangeType.Created}),null,o),i&&t.onDidChange(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:Wt.FileChangeType.Changed}),null,o),r&&t.onDidDelete(s=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(s),type:Wt.FileChangeType.Deleted}),null,o)}unregister(t){let n=this._watchers.get(t);if(n)for(let i of n)i.dispose()}dispose(){this._watchers.forEach(t=>{for(let n of t)n.dispose()}),this._watchers.clear()}}Ei.FileSystemWatcherFeature=Ad;var Ni={};Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.ColorProviderFeature=void 0;const Hd=ne.default,Ln=re,Lo=ye;class $d extends Lo.TextDocumentLanguageFeature{constructor(t){super(t,Ln.DocumentColorRequest.type)}fillClientCapabilities(t){(0,Lo.ensure)((0,Lo.ensure)(t,"textDocument"),"colorProvider").dynamicRegistration=!0}initialize(t,n){let[i,r]=this.getRegistration(n,t.colorProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i={provideColorPresentations:(r,o,s)=>{const a=this._client,c=(m,g,l)=>{const h={color:m,textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(g.document),range:a.code2ProtocolConverter.asRange(g.range)};return a.sendRequest(Ln.ColorPresentationRequest.type,h,l).then(y=>l.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(y,l),y=>a.handleFailedRequest(Ln.ColorPresentationRequest.type,l,y,null))},d=a.middleware;return d.provideColorPresentations?d.provideColorPresentations(r,o,s,c):c(r,o,s)},provideDocumentColors:(r,o)=>{const s=this._client,a=(d,m)=>{const g={textDocument:s.code2ProtocolConverter.asTextDocumentIdentifier(d)};return s.sendRequest(Ln.DocumentColorRequest.type,g,m).then(l=>m.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(l,m),l=>s.handleFailedRequest(Ln.DocumentColorRequest.type,m,l,null))},c=s.middleware;return c.provideDocumentColors?c.provideDocumentColors(r,o,a):a(r,o)}};return[Hd.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),i),i]}}Ni.ColorProviderFeature=$d;var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.ImplementationFeature=void 0;const Wd=ne.default,jo=re,Ao=ye;class Ud extends Ao.TextDocumentLanguageFeature{constructor(t){super(t,jo.ImplementationRequest.type)}fillClientCapabilities(t){let n=(0,Ao.ensure)((0,Ao.ensure)(t,"textDocument"),"implementation");n.dynamicRegistration=!0,n.linkSupport=!0}initialize(t,n){let[i,r]=this.getRegistration(n,t.implementationProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i={provideImplementation:(r,o,s)=>{const a=this._client,c=(m,g,l)=>a.sendRequest(jo.ImplementationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),l).then(h=>l.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(h,l),h=>a.handleFailedRequest(jo.ImplementationRequest.type,l,h,null)),d=a.middleware;return d.provideImplementation?d.provideImplementation(r,o,s,c):c(r,o,s)}};return[this.registerProvider(n,i),i]}registerProvider(t,n){return Wd.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Ii.ImplementationFeature=Ud;var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.TypeDefinitionFeature=void 0;const Kd=ne.default,Ho=re,jn=ye;class zd extends jn.TextDocumentLanguageFeature{constructor(t){super(t,Ho.TypeDefinitionRequest.type)}fillClientCapabilities(t){(0,jn.ensure)((0,jn.ensure)(t,"textDocument"),"typeDefinition").dynamicRegistration=!0;let n=(0,jn.ensure)((0,jn.ensure)(t,"textDocument"),"typeDefinition");n.dynamicRegistration=!0,n.linkSupport=!0}initialize(t,n){let[i,r]=this.getRegistration(n,t.typeDefinitionProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i={provideTypeDefinition:(r,o,s)=>{const a=this._client,c=(m,g,l)=>a.sendRequest(Ho.TypeDefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),l).then(h=>l.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(h,l),h=>a.handleFailedRequest(Ho.TypeDefinitionRequest.type,l,h,null)),d=a.middleware;return d.provideTypeDefinition?d.provideTypeDefinition(r,o,s,c):c(r,o,s)}};return[this.registerProvider(n,i),i]}registerProvider(t,n){return Kd.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Mi.TypeDefinitionFeature=zd;var cn={};Object.defineProperty(cn,"__esModule",{value:!0}),cn.WorkspaceFoldersFeature=cn.arrayDiff=void 0;const xd=me,Li=ne.default,An=re;function $o(e,t){if(e!==void 0)return e[t]}function Wo(e,t){return e.filter(n=>t.indexOf(n)<0)}cn.arrayDiff=Wo;class Bd{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 An.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(t){const n=Li.workspace.workspaceFolders;this.initializeWithFolders(n),n===void 0?t.workspaceFolders=null:t.workspaceFolders=n.map(i=>this.asProtocol(i))}initializeWithFolders(t){this._initialFolders=t}fillClientCapabilities(t){t.workspace=t.workspace||{},t.workspace.workspaceFolders=!0}initialize(t){const n=this._client;n.onRequest(An.WorkspaceFoldersRequest.type,o=>{const s=()=>{const c=Li.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 i=$o($o($o(t,"workspace"),"workspaceFolders"),"changeNotifications");let r;typeof i=="string"?r=i:i===!0&&(r=xd.generateUuid()),r&&this.register({id:r,registerOptions:void 0})}sendInitialEvent(t){let n;if(this._initialFolders&&t){const i=Wo(this._initialFolders,t),r=Wo(t,this._initialFolders);(r.length>0||i.length>0)&&(n=this.doSendEvent(r,i))}else this._initialFolders?n=this.doSendEvent([],this._initialFolders):t&&(n=this.doSendEvent(t,[]));n!==void 0&&n.catch(i=>{this._client.error(`Sending notification ${An.DidChangeWorkspaceFoldersNotification.type.method} failed`,i)})}doSendEvent(t,n){let i={event:{added:t.map(r=>this.asProtocol(r)),removed:n.map(r=>this.asProtocol(r))}};return this._client.sendNotification(An.DidChangeWorkspaceFoldersNotification.type,i)}register(t){let n=t.id,i=this._client,r=Li.workspace.onDidChangeWorkspaceFolders(o=>{let s=d=>this.doSendEvent(d.added,d.removed),a=i.middleware.workspace;(a&&a.didChangeWorkspaceFolders?a.didChangeWorkspaceFolders(o,s):s(o)).catch(d=>{this._client.error(`Sending notification ${An.DidChangeWorkspaceFoldersNotification.type.method} failed`,d)})});this._listeners.set(n,r),this.sendInitialEvent(Li.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}}}cn.WorkspaceFoldersFeature=Bd;var ji={};Object.defineProperty(ji,"__esModule",{value:!0}),ji.FoldingRangeFeature=void 0;const Vd=ne.default,un=re,Uo=ye;class Jd extends Uo.TextDocumentLanguageFeature{constructor(t){super(t,un.FoldingRangeRequest.type)}fillClientCapabilities(t){let n=(0,Uo.ensure)((0,Uo.ensure)(t,"textDocument"),"foldingRange");n.dynamicRegistration=!0,n.rangeLimit=5e3,n.lineFoldingOnly=!0,n.foldingRangeKind={valueSet:[un.FoldingRangeKind.Comment,un.FoldingRangeKind.Imports,un.FoldingRangeKind.Region]},n.foldingRange={collapsedText:!1}}initialize(t,n){let[i,r]=this.getRegistration(n,t.foldingRangeProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i={provideFoldingRanges:(r,o,s)=>{const a=this._client,c=(m,g,l)=>{const h={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(m)};return a.sendRequest(un.FoldingRangeRequest.type,h,l).then(y=>l.isCancellationRequested?null:a.protocol2CodeConverter.asFoldingRanges(y,l),y=>a.handleFailedRequest(un.FoldingRangeRequest.type,l,y,null))},d=a.middleware;return d.provideFoldingRanges?d.provideFoldingRanges(r,o,s,c):c(r,o,s)}};return[Vd.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(n),i),i]}}ji.FoldingRangeFeature=Jd;var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0}),Ai.DeclarationFeature=void 0;const Qd=ne.default,Ko=re,zo=ye;class Gd extends zo.TextDocumentLanguageFeature{constructor(t){super(t,Ko.DeclarationRequest.type)}fillClientCapabilities(t){const n=(0,zo.ensure)((0,zo.ensure)(t,"textDocument"),"declaration");n.dynamicRegistration=!0,n.linkSupport=!0}initialize(t,n){const[i,r]=this.getRegistration(n,t.declarationProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i={provideDeclaration:(r,o,s)=>{const a=this._client,c=(m,g,l)=>a.sendRequest(Ko.DeclarationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),l).then(h=>l.isCancellationRequested?null:a.protocol2CodeConverter.asDeclarationResult(h,l),h=>a.handleFailedRequest(Ko.DeclarationRequest.type,l,h,null)),d=a.middleware;return d.provideDeclaration?d.provideDeclaration(r,o,s,c):c(r,o,s)}};return[this.registerProvider(n,i),i]}registerProvider(t,n){return Qd.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Ai.DeclarationFeature=Gd;var Hi={};Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.SelectionRangeFeature=void 0;const Xd=ne.default,xo=re,Bo=ye;class Yd extends Bo.TextDocumentLanguageFeature{constructor(t){super(t,xo.SelectionRangeRequest.type)}fillClientCapabilities(t){const n=(0,Bo.ensure)((0,Bo.ensure)(t,"textDocument"),"selectionRange");n.dynamicRegistration=!0}initialize(t,n){const[i,r]=this.getRegistration(n,t.selectionRangeProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i={provideSelectionRanges:(r,o,s)=>{const a=this._client,c=async(m,g,l)=>{const h={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(m),positions:await a.code2ProtocolConverter.asPositions(g,l)};return a.sendRequest(xo.SelectionRangeRequest.type,h,l).then(y=>l.isCancellationRequested?null:a.protocol2CodeConverter.asSelectionRanges(y,l),y=>a.handleFailedRequest(xo.SelectionRangeRequest.type,l,y,null))},d=a.middleware;return d.provideSelectionRanges?d.provideSelectionRanges(r,o,s,c):c(r,o,s)}};return[this.registerProvider(n,i),i]}registerProvider(t,n){return Xd.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Hi.SelectionRangeFeature=Yd;var $i={};Object.defineProperty($i,"__esModule",{value:!0}),$i.ProgressFeature=void 0;const Pa=re,Zd=Pn;function el(e,t){return e[t]===void 0&&(e[t]=Object.create(null)),e[t]}class tl{constructor(t){this._client=t,this.activeParts=new Set}getState(){return{kind:"window",id:Pa.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(t){el(t,"window").workDoneProgress=!0}initialize(){const t=this._client,n=r=>{this.activeParts.delete(r)},i=r=>{this.activeParts.add(new Zd.ProgressPart(this._client,r.token,n))};t.onRequest(Pa.WorkDoneProgressCreateRequest.type,i)}dispose(){for(const t of this.activeParts)t.done();this.activeParts.clear()}}$i.ProgressFeature=tl;var Wi={};Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.CallHierarchyFeature=void 0;const nl=ne.default,Ut=re,Vo=ye;class il{constructor(t){this.client=t,this.middleware=t.middleware}prepareCallHierarchy(t,n,i){const r=this.client,o=this.middleware,s=(a,c,d)=>{const m=r.code2ProtocolConverter.asTextDocumentPositionParams(a,c);return r.sendRequest(Ut.CallHierarchyPrepareRequest.type,m,d).then(g=>d.isCancellationRequested?null:r.protocol2CodeConverter.asCallHierarchyItems(g,d),g=>r.handleFailedRequest(Ut.CallHierarchyPrepareRequest.type,d,g,null))};return o.prepareCallHierarchy?o.prepareCallHierarchy(t,n,i,s):s(t,n,i)}provideCallHierarchyIncomingCalls(t,n){const i=this.client,r=this.middleware,o=(s,a)=>{const c={item:i.code2ProtocolConverter.asCallHierarchyItem(s)};return i.sendRequest(Ut.CallHierarchyIncomingCallsRequest.type,c,a).then(d=>a.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyIncomingCalls(d,a),d=>i.handleFailedRequest(Ut.CallHierarchyIncomingCallsRequest.type,a,d,null))};return r.provideCallHierarchyIncomingCalls?r.provideCallHierarchyIncomingCalls(t,n,o):o(t,n)}provideCallHierarchyOutgoingCalls(t,n){const i=this.client,r=this.middleware,o=(s,a)=>{const c={item:i.code2ProtocolConverter.asCallHierarchyItem(s)};return i.sendRequest(Ut.CallHierarchyOutgoingCallsRequest.type,c,a).then(d=>a.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyOutgoingCalls(d,a),d=>i.handleFailedRequest(Ut.CallHierarchyOutgoingCallsRequest.type,a,d,null))};return r.provideCallHierarchyOutgoingCalls?r.provideCallHierarchyOutgoingCalls(t,n,o):o(t,n)}}class rl extends Vo.TextDocumentLanguageFeature{constructor(t){super(t,Ut.CallHierarchyPrepareRequest.type)}fillClientCapabilities(t){const n=t,i=(0,Vo.ensure)((0,Vo.ensure)(n,"textDocument"),"callHierarchy");i.dynamicRegistration=!0}initialize(t,n){const[i,r]=this.getRegistration(n,t.callHierarchyProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=this._client,i=new il(n);return[nl.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(t.documentSelector),i),i]}}Wi.CallHierarchyFeature=rl;var Ui={};Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.SemanticTokensFeature=void 0;const Ki=ne.default,oe=re,Hn=ye,ol=_e;class sl extends Hn.TextDocumentLanguageFeature{constructor(t){super(t,oe.SemanticTokensRegistrationType.type)}fillClientCapabilities(t){const n=(0,Hn.ensure)((0,Hn.ensure)(t,"textDocument"),"semanticTokens");n.dynamicRegistration=!0,n.tokenTypes=[oe.SemanticTokenTypes.namespace,oe.SemanticTokenTypes.type,oe.SemanticTokenTypes.class,oe.SemanticTokenTypes.enum,oe.SemanticTokenTypes.interface,oe.SemanticTokenTypes.struct,oe.SemanticTokenTypes.typeParameter,oe.SemanticTokenTypes.parameter,oe.SemanticTokenTypes.variable,oe.SemanticTokenTypes.property,oe.SemanticTokenTypes.enumMember,oe.SemanticTokenTypes.event,oe.SemanticTokenTypes.function,oe.SemanticTokenTypes.method,oe.SemanticTokenTypes.macro,oe.SemanticTokenTypes.keyword,oe.SemanticTokenTypes.modifier,oe.SemanticTokenTypes.comment,oe.SemanticTokenTypes.string,oe.SemanticTokenTypes.number,oe.SemanticTokenTypes.regexp,oe.SemanticTokenTypes.operator,oe.SemanticTokenTypes.decorator],n.tokenModifiers=[oe.SemanticTokenModifiers.declaration,oe.SemanticTokenModifiers.definition,oe.SemanticTokenModifiers.readonly,oe.SemanticTokenModifiers.static,oe.SemanticTokenModifiers.deprecated,oe.SemanticTokenModifiers.abstract,oe.SemanticTokenModifiers.async,oe.SemanticTokenModifiers.modification,oe.SemanticTokenModifiers.documentation,oe.SemanticTokenModifiers.defaultLibrary],n.formats=[oe.TokenFormat.Relative],n.requests={range:!0,full:{delta:!0}},n.multilineTokenSupport=!1,n.overlappingTokenSupport=!1,n.serverCancelSupport=!0,n.augmentsSyntaxTokens=!0,(0,Hn.ensure)((0,Hn.ensure)(t,"workspace"),"semanticTokens").refreshSupport=!0}initialize(t,n){this._client.onRequest(oe.SemanticTokensRefreshRequest.type,async()=>{for(const s of this.getAllProviders())s.onDidChangeSemanticTokensEmitter.fire()});const[r,o]=this.getRegistration(n,t.semanticTokensProvider);!r||!o||this.register({id:r,registerOptions:o})}registerLanguageProvider(t){const n=t.documentSelector,i=ol.boolean(t.full)?t.full:t.full!==void 0,r=t.full!==void 0&&typeof t.full!="boolean"&&t.full.delta===!0,o=new Ki.EventEmitter,s=i?{onDidChangeSemanticTokens:o.event,provideDocumentSemanticTokens:(h,y)=>{const P=this._client,I=P.middleware,N=(w,S)=>{const j={textDocument:P.code2ProtocolConverter.asTextDocumentIdentifier(w)};return P.sendRequest(oe.SemanticTokensRequest.type,j,S).then(A=>S.isCancellationRequested?null:P.protocol2CodeConverter.asSemanticTokens(A,S),A=>P.handleFailedRequest(oe.SemanticTokensRequest.type,S,A,null))};return I.provideDocumentSemanticTokens?I.provideDocumentSemanticTokens(h,y,N):N(h,y)},provideDocumentSemanticTokensEdits:r?(h,y,P)=>{const I=this._client,N=I.middleware,w=(S,j,A)=>{const G={textDocument:I.code2ProtocolConverter.asTextDocumentIdentifier(S),previousResultId:j};return I.sendRequest(oe.SemanticTokensDeltaRequest.type,G,A).then(async V=>A.isCancellationRequested?null:oe.SemanticTokens.is(V)?await I.protocol2CodeConverter.asSemanticTokens(V,A):await I.protocol2CodeConverter.asSemanticTokensEdits(V,A),V=>I.handleFailedRequest(oe.SemanticTokensDeltaRequest.type,A,V,null))};return N.provideDocumentSemanticTokensEdits?N.provideDocumentSemanticTokensEdits(h,y,P,w):w(h,y,P)}:void 0}:void 0,c=t.range===!0?{provideDocumentRangeSemanticTokens:(h,y,P)=>{const I=this._client,N=I.middleware,w=(S,j,A)=>{const G={textDocument:I.code2ProtocolConverter.asTextDocumentIdentifier(S),range:I.code2ProtocolConverter.asRange(j)};return I.sendRequest(oe.SemanticTokensRangeRequest.type,G,A).then(V=>A.isCancellationRequested?null:I.protocol2CodeConverter.asSemanticTokens(V,A),V=>I.handleFailedRequest(oe.SemanticTokensRangeRequest.type,A,V,null))};return N.provideDocumentRangeSemanticTokens?N.provideDocumentRangeSemanticTokens(h,y,P,w):w(h,y,P)}}:void 0,d=[],m=this._client,g=m.protocol2CodeConverter.asSemanticTokensLegend(t.legend),l=m.protocol2CodeConverter.asDocumentSelector(n);return s!==void 0&&d.push(Ki.languages.registerDocumentSemanticTokensProvider(l,s,g)),c!==void 0&&d.push(Ki.languages.registerDocumentRangeSemanticTokensProvider(l,c,g)),[new Ki.Disposable(()=>d.forEach(h=>h.dispose())),{range:c,full:s,onDidChangeSemanticTokensEmitter:o}]}}Ui.SemanticTokensFeature=sl;var it={};Object.defineProperty(it,"__esModule",{value:!0}),it.WillDeleteFilesFeature=it.WillRenameFilesFeature=it.WillCreateFilesFeature=it.DidDeleteFilesFeature=it.DidRenameFilesFeature=it.DidCreateFilesFeature=void 0;const ht=ne.default,al=go,kt=re,cl=me;function ka(e,t){return e[t]===void 0&&(e[t]={}),e[t]}function ul(e,t){return e[t]}function Fa(e,t,n){e[t]=n}class xt{constructor(t,n,i,r,o){this._client=t,this._event=n,this._registrationType=i,this._clientCapability=r,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=ka(ka(t,"workspace"),"fileOperations");Fa(n,"dynamicRegistration",!0),Fa(n,this._clientCapability,!0)}initialize(t){const n=t.workspace?.fileOperations,i=n!==void 0?ul(n,this._serverCapability):void 0;if(i?.filters!==void 0)try{this.register({id:cl.generateUuid(),registerOptions:{filters:i.filters}})}catch(r){this._client.warn(`Ignoring invalid glob pattern for ${this._serverCapability} registration: ${r}`)}}register(t){this._listener||(this._listener=this._event(this.send,this));const n=t.registerOptions.filters.map(i=>{const r=new al.Minimatch(i.pattern.glob,xt.asMinimatchOptions(i.pattern.options));if(!r.makeRe())throw new Error(`Invalid pattern ${i.pattern.glob}!`);return{scheme:i.scheme,matcher:r,kind:i.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 xt.getFileType(t)}async filter(t,n){const i=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 d of c)if(!(d.scheme!==void 0&&d.scheme!==s.scheme)){if(d.matcher.match(a)){if(d.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===ht.FileType.File&&d.kind===kt.FileOperationPatternKind.file||m===ht.FileType.Directory&&d.kind===kt.FileOperationPatternKind.folder)return!0}else if(d.kind===kt.FileOperationPatternKind.folder&&await xt.getFileType(s)===ht.FileType.Directory&&d.matcher.match(`${a}/`))return!0}return!1})),r=t.files.filter((o,s)=>i[s]);return{...t,files:r}}static async getFileType(t){try{return(await ht.workspace.fs.stat(t)).type}catch{return}}static asMinimatchOptions(t){if(t!==void 0&&t.ignoreCase===!0)return{nocase:!0}}}class qa extends xt{constructor(t,n,i,r,o,s,a){super(t,n,i,r,o),this._notificationType=i,this._accessUri=s,this._createParams=a}async send(t){const n=await this.filter(t,this._accessUri);if(n.files.length){const i=async r=>this._client.sendNotification(this._notificationType,this._createParams(r));return this.doSend(n,i)}}}class Ea extends qa{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 i=await xt.getFileType(t);return i&&this._fsPathFileTypes.set(n,i),i}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 dl extends qa{constructor(t){super(t,ht.workspace.onDidCreateFiles,kt.DidCreateFilesNotification.type,"didCreate","didCreate",n=>n,t.code2ProtocolConverter.asDidCreateFilesParams)}doSend(t,n){const i=this._client.middleware.workspace;return i?.didCreateFiles?i.didCreateFiles(t,n):n(t)}}it.DidCreateFilesFeature=dl;class ll extends Ea{constructor(t){super(t,ht.workspace.onDidRenameFiles,kt.DidRenameFilesNotification.type,"didRename","didRename",n=>n.oldUri,t.code2ProtocolConverter.asDidRenameFilesParams)}register(t){this._willListener||(this._willListener=ht.workspace.onWillRenameFiles(this.willRename,this)),super.register(t)}willRename(t){t.waitUntil(this.cacheFileTypes(t,n=>n.oldUri))}doSend(t,n){this.clearFileTypeCache();const i=this._client.middleware.workspace;return i?.didRenameFiles?i.didRenameFiles(t,n):n(t)}}it.DidRenameFilesFeature=ll;class fl extends Ea{constructor(t){super(t,ht.workspace.onDidDeleteFiles,kt.DidDeleteFilesNotification.type,"didDelete","didDelete",n=>n,t.code2ProtocolConverter.asDidDeleteFilesParams)}register(t){this._willListener||(this._willListener=ht.workspace.onWillDeleteFiles(this.willDelete,this)),super.register(t)}willDelete(t){t.waitUntil(this.cacheFileTypes(t,n=>n))}doSend(t,n){this.clearFileTypeCache();const i=this._client.middleware.workspace;return i?.didDeleteFiles?i.didDeleteFiles(t,n):n(t)}}it.DidDeleteFilesFeature=fl;class Jo extends xt{constructor(t,n,i,r,o,s,a){super(t,n,i,r,o),this._requestType=i,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 i=r=>this._client.sendRequest(this._requestType,this._createParams(r),r.token).then(this._client.protocol2CodeConverter.asWorkspaceEdit);return this.doSend(n,i)}else return}}class hl extends Jo{constructor(t){super(t,ht.workspace.onWillCreateFiles,kt.WillCreateFilesRequest.type,"willCreate","willCreate",n=>n,t.code2ProtocolConverter.asWillCreateFilesParams)}doSend(t,n){const i=this._client.middleware.workspace;return i?.willCreateFiles?i.willCreateFiles(t,n):n(t)}}it.WillCreateFilesFeature=hl;class gl extends Jo{constructor(t){super(t,ht.workspace.onWillRenameFiles,kt.WillRenameFilesRequest.type,"willRename","willRename",n=>n.oldUri,t.code2ProtocolConverter.asWillRenameFilesParams)}doSend(t,n){const i=this._client.middleware.workspace;return i?.willRenameFiles?i.willRenameFiles(t,n):n(t)}}it.WillRenameFilesFeature=gl;class pl extends Jo{constructor(t){super(t,ht.workspace.onWillDeleteFiles,kt.WillDeleteFilesRequest.type,"willDelete","willDelete",n=>n,t.code2ProtocolConverter.asWillDeleteFilesParams)}doSend(t,n){const i=this._client.middleware.workspace;return i?.willDeleteFiles?i.willDeleteFiles(t,n):n(t)}}it.WillDeleteFilesFeature=pl;var zi={};Object.defineProperty(zi,"__esModule",{value:!0}),zi.LinkedEditingFeature=void 0;const ml=ne.default,Qo=re,Go=ye;class yl extends Go.TextDocumentLanguageFeature{constructor(t){super(t,Qo.LinkedEditingRangeRequest.type)}fillClientCapabilities(t){const n=(0,Go.ensure)((0,Go.ensure)(t,"textDocument"),"linkedEditingRange");n.dynamicRegistration=!0}initialize(t,n){let[i,r]=this.getRegistration(n,t.linkedEditingRangeProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i={provideLinkedEditingRanges:(r,o,s)=>{const a=this._client,c=(m,g,l)=>a.sendRequest(Qo.LinkedEditingRangeRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(m,g),l).then(h=>l.isCancellationRequested?null:a.protocol2CodeConverter.asLinkedEditingRanges(h,l),h=>a.handleFailedRequest(Qo.LinkedEditingRangeRequest.type,l,h,null)),d=a.middleware;return d.provideLinkedEditingRange?d.provideLinkedEditingRange(r,o,s,c):c(r,o,s)}};return[this.registerProvider(n,i),i]}registerProvider(t,n){return ml.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}zi.LinkedEditingFeature=yl;var xi={};Object.defineProperty(xi,"__esModule",{value:!0}),xi.TypeHierarchyFeature=void 0;const vl=ne.default,Kt=re,Xo=ye;class Cl{constructor(t){this.client=t,this.middleware=t.middleware}prepareTypeHierarchy(t,n,i){const r=this.client,o=this.middleware,s=(a,c,d)=>{const m=r.code2ProtocolConverter.asTextDocumentPositionParams(a,c);return r.sendRequest(Kt.TypeHierarchyPrepareRequest.type,m,d).then(g=>d.isCancellationRequested?null:r.protocol2CodeConverter.asTypeHierarchyItems(g,d),g=>r.handleFailedRequest(Kt.TypeHierarchyPrepareRequest.type,d,g,null))};return o.prepareTypeHierarchy?o.prepareTypeHierarchy(t,n,i,s):s(t,n,i)}provideTypeHierarchySupertypes(t,n){const i=this.client,r=this.middleware,o=(s,a)=>{const c={item:i.code2ProtocolConverter.asTypeHierarchyItem(s)};return i.sendRequest(Kt.TypeHierarchySupertypesRequest.type,c,a).then(d=>a.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(d,a),d=>i.handleFailedRequest(Kt.TypeHierarchySupertypesRequest.type,a,d,null))};return r.provideTypeHierarchySupertypes?r.provideTypeHierarchySupertypes(t,n,o):o(t,n)}provideTypeHierarchySubtypes(t,n){const i=this.client,r=this.middleware,o=(s,a)=>{const c={item:i.code2ProtocolConverter.asTypeHierarchyItem(s)};return i.sendRequest(Kt.TypeHierarchySubtypesRequest.type,c,a).then(d=>a.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(d,a),d=>i.handleFailedRequest(Kt.TypeHierarchySubtypesRequest.type,a,d,null))};return r.provideTypeHierarchySubtypes?r.provideTypeHierarchySubtypes(t,n,o):o(t,n)}}class _l extends Xo.TextDocumentLanguageFeature{constructor(t){super(t,Kt.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(t){const n=(0,Xo.ensure)((0,Xo.ensure)(t,"textDocument"),"typeHierarchy");n.dynamicRegistration=!0}initialize(t,n){const[i,r]=this.getRegistration(n,t.typeHierarchyProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=this._client,i=new Cl(n);return[vl.languages.registerTypeHierarchyProvider(n.protocol2CodeConverter.asDocumentSelector(t.documentSelector),i),i]}}xi.TypeHierarchyFeature=_l;var Bi={};Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.InlineValueFeature=void 0;const Oa=ne.default,Vi=re,$n=ye;class bl extends $n.TextDocumentLanguageFeature{constructor(t){super(t,Vi.InlineValueRequest.type)}fillClientCapabilities(t){(0,$n.ensure)((0,$n.ensure)(t,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,$n.ensure)((0,$n.ensure)(t,"workspace"),"inlineValue").refreshSupport=!0}initialize(t,n){this._client.onRequest(Vi.InlineValueRefreshRequest.type,async()=>{for(const o of this.getAllProviders())o.onDidChangeInlineValues.fire()});const[i,r]=this.getRegistration(n,t.inlineValueProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i=new Oa.EventEmitter,r={onDidChangeInlineValues:i.event,provideInlineValues:(o,s,a,c)=>{const d=this._client,m=(l,h,y,P)=>{const I={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(l),range:d.code2ProtocolConverter.asRange(h),context:d.code2ProtocolConverter.asInlineValueContext(y)};return d.sendRequest(Vi.InlineValueRequest.type,I,P).then(N=>P.isCancellationRequested?null:d.protocol2CodeConverter.asInlineValues(N,P),N=>d.handleFailedRequest(Vi.InlineValueRequest.type,P,N,null))},g=d.middleware;return g.provideInlineValues?g.provideInlineValues(o,s,a,c,m):m(o,s,a,c)}};return[this.registerProvider(n,r),{provider:r,onDidChangeInlineValues:i}]}registerProvider(t,n){return Oa.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Bi.InlineValueFeature=bl;var Ji={};Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.InlayHintsFeature=void 0;const Na=ne.default,dn=re,Wn=ye;class wl extends Wn.TextDocumentLanguageFeature{constructor(t){super(t,dn.InlayHintRequest.type)}fillClientCapabilities(t){const n=(0,Wn.ensure)((0,Wn.ensure)(t,"textDocument"),"inlayHint");n.dynamicRegistration=!0,n.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,Wn.ensure)((0,Wn.ensure)(t,"workspace"),"inlayHint").refreshSupport=!0}initialize(t,n){this._client.onRequest(dn.InlayHintRefreshRequest.type,async()=>{for(const o of this.getAllProviders())o.onDidChangeInlayHints.fire()});const[i,r]=this.getRegistration(n,t.inlayHintProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(t){const n=t.documentSelector,i=new Na.EventEmitter,r={onDidChangeInlayHints:i.event,provideInlayHints:(o,s,a)=>{const c=this._client,d=async(g,l,h)=>{const y={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),range:c.code2ProtocolConverter.asRange(l)};try{const P=await c.sendRequest(dn.InlayHintRequest.type,y,h);return h.isCancellationRequested?null:c.protocol2CodeConverter.asInlayHints(P,h)}catch(P){return c.handleFailedRequest(dn.InlayHintRequest.type,h,P,null)}},m=c.middleware;return m.provideInlayHints?m.provideInlayHints(o,s,a,d):d(o,s,a)}};return r.resolveInlayHint=t.resolveProvider===!0?(o,s)=>{const a=this._client,c=async(m,g)=>{try{const l=await a.sendRequest(dn.InlayHintResolveRequest.type,a.code2ProtocolConverter.asInlayHint(m),g);if(g.isCancellationRequested)return null;const h=a.protocol2CodeConverter.asInlayHint(l,g);return g.isCancellationRequested?null:h}catch(l){return a.handleFailedRequest(dn.InlayHintResolveRequest.type,g,l,null)}},d=a.middleware;return d.resolveInlayHint?d.resolveInlayHint(o,s,c):c(o,s)}:void 0,[this.registerProvider(n,r),{provider:r,onDidChangeInlayHints:i}]}registerProvider(t,n){return Na.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n)}}Ji.InlayHintsFeature=wl,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=ne.default,n=re,i=ei,r=di,o=_e,s=Ze,a=me,c=Pn,d=ye,m=lo,g=gi,l=Ot,h=nt,y=vi,P=Ci,I=_i,N=bi,w=wi,S=Po,j=Ri,A=Di,G=Si,V=Ti,k=Nt,K=ki,W=Fi,U=qi,p=Ei,M=Ni,Y=Ii,O=Mi,x=cn,Z=ji,Ce=Ai,Me=Hi,Ge=$i,et=Wi,He=Ui,Ue=it,rt=zi,gt=xi,Ke=Bi,ge=Ji;var ze;(function(X){X[X.Info=1]="Info",X[X.Warn=2]="Warn",X[X.Error=3]="Error",X[X.Never=4]="Never"})(ze=e.RevealOutputChannelOn||(e.RevealOutputChannelOn={}));var we;(function(X){X[X.Continue=1]="Continue",X[X.Shutdown=2]="Shutdown"})(we=e.ErrorAction||(e.ErrorAction={}));var Ie;(function(X){X[X.DoNotRestart=1]="DoNotRestart",X[X.Restart=2]="Restart"})(Ie=e.CloseAction||(e.CloseAction={}));var ut;(function(X){X[X.Stopped=1]="Stopped",X[X.Starting=3]="Starting",X[X.Running=2]="Running"})(ut=e.State||(e.State={})),function(X){X.off="off",X.on="on"}(e.SuspendMode||(e.SuspendMode={}));class ot{constructor(C,R){this.client=C,this.maxRestartCount=R,this.restarts=[]}error(C,R,b){return b&&b<=3?{action:we.Continue}:{action:we.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:Ie.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=3*60*1e3?{action:Ie.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:Ie.Restart})}}var ie;(function(X){X.Initial="initial",X.Starting="starting",X.StartFailed="startFailed",X.Running="running",X.Stopping="stopping",X.Stopped="stopped"})(ie||(ie={})),function(X){function C(R){return R&&n.MessageReader.is(R.reader)&&n.MessageWriter.is(R.writer)}X.is=C}(e.MessageTransports||(e.MessageTransports={}));class Xe{constructor(C,R,b){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=C,this._name=R,b=b||{};const L={isTrusted:!1,supportHtml:!1};b.markdown!==void 0&&(L.isTrusted=b.markdown.isTrusted===!0,L.supportHtml=b.markdown.supportHtml===!0),this._clientOptions={documentSelector:b.documentSelector??[],synchronize:b.synchronize??{},diagnosticCollectionName:b.diagnosticCollectionName,outputChannelName:b.outputChannelName??this._name,revealOutputChannelOn:b.revealOutputChannelOn??ze.Error,stdioEncoding:b.stdioEncoding??"utf8",initializationOptions:b.initializationOptions,initializationFailedHandler:b.initializationFailedHandler,progressOnInitialization:!!b.progressOnInitialization,errorHandler:b.errorHandler??this.createDefaultErrorHandler(b.connectionOptions?.maxRestartCount),middleware:b.middleware??{},uriConverters:b.uriConverters,workspaceFolder:b.workspaceFolder,connectionOptions:b.connectionOptions,markdown:L,diagnosticPullOptions:b.diagnosticPullOptions??{onChange:!0,onSave:!1},notebookDocumentOptions:b.notebookDocumentOptions??{}},this._clientOptions.synchronize=this._clientOptions.synchronize||{},this._state=ie.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,b.outputChannel?(this._outputChannel=b.outputChannel,this._disposeOutputChannel=!1):(this._outputChannel=void 0,this._disposeOutputChannel=!0),this._traceOutputChannel=b.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:(E,H)=>{o.string(E)?this.logTrace(E,H):this.logObjectTrace(E)}},this._c2p=i.createConverter(b.uriConverters?b.uriConverters.code2Protocol:void 0),this._p2c=r.createConverter(b.uriConverters?b.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(C){let R=this.getPublicState();this._state=C;let b=this.getPublicState();b!==R&&this._stateChangeEmitter.fire({oldState:R,newState:b})}getPublicState(){switch(this.$state){case ie.Starting:return ut.Starting;case ie.Running:return ut.Running;default:return ut.Stopped}}get initializeResult(){return this._initializeResult}async sendRequest(C,...R){if(this.$state===ie.StartFailed||this.$state===ie.Stopping||this.$state===ie.Stopped)return Promise.reject(new n.ResponseError(n.ErrorCodes.ConnectionInactive,"Client is not running"));try{const b=await this.$start();return await this.forceDocumentSync(),b.sendRequest(C,...R)}catch(b){throw this.error(`Sending request ${o.string(C)?C:C.method} failed.`,b),b}}onRequest(C,R){const b=typeof C=="string"?C:C.method;this._requestHandlers.set(b,R);const L=this.activeConnection();let E;return L!==void 0?(this._requestDisposables.set(b,L.onRequest(C,R)),E={dispose:()=>{const H=this._requestDisposables.get(b);H!==void 0&&(H.dispose(),this._requestDisposables.delete(b))}}):(this._pendingRequestHandlers.set(b,R),E={dispose:()=>{this._pendingRequestHandlers.delete(b);const H=this._requestDisposables.get(b);H!==void 0&&(H.dispose(),this._requestDisposables.delete(b))}}),{dispose:()=>{this._requestHandlers.delete(b),E.dispose()}}}async sendNotification(C,R){if(this.$state===ie.StartFailed||this.$state===ie.Stopping||this.$state===ie.Stopped)return Promise.reject(new n.ResponseError(n.ErrorCodes.ConnectionInactive,"Client is not running"));try{const b=await this.$start();return await this.forceDocumentSync(),b.sendNotification(C,R)}catch(b){throw this.error(`Sending notification ${o.string(C)?C:C.method} failed.`,b),b}}onNotification(C,R){const b=typeof C=="string"?C:C.method;this._notificationHandlers.set(b,R);const L=this.activeConnection();let E;return L!==void 0?(this._notificationDisposables.set(b,L.onNotification(C,R)),E={dispose:()=>{const H=this._notificationDisposables.get(b);H!==void 0&&(H.dispose(),this._notificationDisposables.delete(b))}}):(this._pendingNotificationHandlers.set(b,R),E={dispose:()=>{this._pendingNotificationHandlers.delete(b);const H=this._notificationDisposables.get(b);H!==void 0&&(H.dispose(),this._notificationDisposables.delete(b))}}),{dispose:()=>{this._notificationHandlers.delete(b),E.dispose()}}}async sendProgress(C,R,b){if(this.$state===ie.StartFailed||this.$state===ie.Stopping||this.$state===ie.Stopped)return Promise.reject(new n.ResponseError(n.ErrorCodes.ConnectionInactive,"Client is not running"));try{return(await this.$start()).sendProgress(C,R,b)}catch(L){throw this.error(`Sending progress for token ${R} failed.`,L),L}}onProgress(C,R,b){this._progressHandlers.set(R,{type:C,handler:b});const L=this.activeConnection();let E;const H=this._clientOptions.middleware?.handleWorkDoneProgress,ee=n.WorkDoneProgress.is(C)&&H!==void 0?ue=>{H(R,ue,()=>b(ue))}:b;return L!==void 0?(this._progressDisposables.set(R,L.onProgress(C,R,ee)),E={dispose:()=>{const ue=this._progressDisposables.get(R);ue!==void 0&&(ue.dispose(),this._progressDisposables.delete(R))}}):(this._pendingProgressHandlers.set(R,{type:C,handler:b}),E={dispose:()=>{this._pendingProgressHandlers.delete(R);const ue=this._progressDisposables.get(R);ue!==void 0&&(ue.dispose(),this._progressDisposables.delete(R))}}),{dispose:()=>{this._progressHandlers.delete(R),E.dispose()}}}createDefaultErrorHandler(C){if(C!==void 0&&C<0)throw new Error(`Invalid maxRestartCount: ${C}`);return new ot(this,C??4)}async setTrace(C){this._trace=C;const R=this.activeConnection();R!==void 0&&await R.trace(this._trace,this._tracer,{sendNotification:!1,traceFormat:this._traceFormat})}data2String(C){if(C instanceof n.ResponseError){const R=C;return` Message: ${R.message}
Code: ${R.code} ${R.data?`
`+R.data.toString():""}`}return C instanceof Error?o.string(C.stack)?C.stack:C.message:o.string(C)?C:C.toString()}info(C,R,b=!0){this.outputChannel.appendLine(`[Info - ${new Date().toLocaleTimeString()}] ${C}`),R!=null&&this.outputChannel.appendLine(this.data2String(R)),b&&this._clientOptions.revealOutputChannelOn<=ze.Info&&this.showNotificationMessage(n.MessageType.Info,C)}warn(C,R,b=!0){this.outputChannel.appendLine(`[Warn - ${new Date().toLocaleTimeString()}] ${C}`),R!=null&&this.outputChannel.appendLine(this.data2String(R)),b&&this._clientOptions.revealOutputChannelOn<=ze.Warn&&this.showNotificationMessage(n.MessageType.Warning,C)}error(C,R,b=!0){this.outputChannel.appendLine(`[Error - ${new Date().toLocaleTimeString()}] ${C}`),R!=null&&this.outputChannel.appendLine(this.data2String(R)),(b==="force"||b&&this._clientOptions.revealOutputChannelOn<=ze.Error)&&this.showNotificationMessage(n.MessageType.Error,C)}showNotificationMessage(C,R){R=R??"A request has failed. See the output for more information.",(C===n.MessageType.Error?t.window.showErrorMessage:C===n.MessageType.Warning?t.window.showWarningMessage:t.window.showInformationMessage)(R,"Go to output").then(L=>{L!==void 0&&this.outputChannel.show(!0)})}logTrace(C,R){this.traceOutputChannel.appendLine(`[Trace - ${new Date().toLocaleTimeString()}] ${C}`),R&&this.traceOutputChannel.appendLine(this.data2String(R))}logObjectTrace(C){C.isLSPMessage&&C.type?this.traceOutputChannel.append(`[LSP - ${new Date().toLocaleTimeString()}] `):this.traceOutputChannel.append(`[Trace - ${new Date().toLocaleTimeString()}] `),C&&this.traceOutputChannel.appendLine(`${JSON.stringify(C)}`)}needsStart(){return this.$state===ie.Initial||this.$state===ie.Stopping||this.$state===ie.Stopped}needsStop(){return this.$state===ie.Starting||this.$state===ie.Running}activeConnection(){return this.$state===ie.Running&&this._connection!==void 0?this._connection:void 0}isRunning(){return this.$state===ie.Running}async start(){if(this._disposed==="disposing"||this._disposed==="disposed")throw new Error("Client got disposed and can't be restarted.");if(this.$state===ie.Stopping)throw new Error("Client is currently stopping. Can only restart a full stopped client");if(this._onStart!==void 0)return this._onStart;const[C,R,b]=this.createOnStartPromise();this._onStart=C,this._diagnostics===void 0&&(this._diagnostics=this._clientOptions.diagnosticCollectionName?t.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName):t.languages.createDiagnosticCollection());for(const[L,E]of this._notificationHandlers)this._pendingNotificationHandlers.has(L)||this._pendingNotificationHandlers.set(L,E);for(const[L,E]of this._requestHandlers)this._pendingRequestHandlers.has(L)||this._pendingRequestHandlers.set(L,E);for(const[L,E]of this._progressHandlers)this._pendingProgressHandlers.has(L)||this._pendingProgressHandlers.set(L,E);this.$state=ie.Starting;try{const L=await this.createConnection();L.onNotification(n.LogMessageNotification.type,E=>{switch(E.type){case n.MessageType.Error:this.error(E.message,void 0,!1);break;case n.MessageType.Warning:this.warn(E.message,void 0,!1);break;case n.MessageType.Info:this.info(E.message,void 0,!1);break;default:this.outputChannel.appendLine(E.message)}}),L.onNotification(n.ShowMessageNotification.type,E=>{switch(E.type){case n.MessageType.Error:t.window.showErrorMessage(E.message);break;case n.MessageType.Warning:t.window.showWarningMessage(E.message);break;case n.MessageType.Info:t.window.showInformationMessage(E.message);break;default:t.window.showInformationMessage(E.message)}}),L.onRequest(n.ShowMessageRequest.type,E=>{let H;switch(E.type){case n.MessageType.Error:H=t.window.showErrorMessage;break;case n.MessageType.Warning:H=t.window.showWarningMessage;break;case n.MessageType.Info:H=t.window.showInformationMessage;break;default:H=t.window.showInformationMessage}let ee=E.actions||[];return H(E.message,...ee)}),L.onNotification(n.TelemetryEventNotification.type,E=>{this._telemetryEmitter.fire(E)}),L.onRequest(n.ShowDocumentRequest.type,async E=>{const H=async ue=>{const De=this.protocol2CodeConverter.asUri(ue.uri);try{if(ue.external===!0)return{success:await t.env.openExternal(De)};{const ke={};return ue.selection!==void 0&&(ke.selection=this.protocol2CodeConverter.asRange(ue.selection)),ue.takeFocus===void 0||ue.takeFocus===!1?ke.preserveFocus=!0:ue.takeFocus===!0&&(ke.preserveFocus=!1),await t.window.showTextDocument(De,ke),{success:!0}}}catch{return{success:!1}}},ee=this._clientOptions.middleware.window?.showDocument;return ee!==void 0?ee(E,H):H(E)}),L.listen(),await this.initialize(L),R()}catch(L){this.$state=ie.StartFailed,this.error(`${this._name} client: couldn't create connection to server.`,L,"force"),b(L)}return this._onStart}createOnStartPromise(){let C,R;return[new Promise((L,E)=>{C=L,R=E}),C,R]}async initialize(C){this.refreshTrace(C,!1);const R=this._clientOptions.initializationOptions,[b,L]=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],E={processId:null,clientInfo:{name:t.env.appName,version:t.version},locale:this.getLocale(),rootPath:b||null,rootUri:b?this._c2p.asUri(t.Uri.file(b)):null,capabilities:this.computeClientCapabilities(),initializationOptions:o.func(R)?R():R,trace:n.Trace.toString(this._trace),workspaceFolders:L};if(this.fillInitializeParams(E),this._clientOptions.progressOnInitialization){const H=a.generateUuid(),ee=new c.ProgressPart(C,H);E.workDoneToken=H;try{const ue=await this.doInitialize(C,E);return ee.done(),ue}catch(ue){throw ee.cancel(),ue}}else return this.doInitialize(C,E)}async doInitialize(C,R){try{const b=await C.initialize(R);if(b.capabilities.positionEncoding!==void 0&&b.capabilities.positionEncoding!==n.PositionEncodingKind.UTF16)throw new Error(`Unsupported position encoding (${b.capabilities.positionEncoding}) received from server ${this.name}`);this._initializeResult=b,this.$state=ie.Running;let L;o.number(b.capabilities.textDocumentSync)?b.capabilities.textDocumentSync===n.TextDocumentSyncKind.None?L={openClose:!1,change:n.TextDocumentSyncKind.None,save:void 0}:L={openClose:!0,change:b.capabilities.textDocumentSync,save:{includeText:!1}}:b.capabilities.textDocumentSync!==void 0&&b.capabilities.textDocumentSync!==null&&(L=b.capabilities.textDocumentSync),this._capabilities=Object.assign({},b.capabilities,{resolvedTextDocumentSync:L}),C.onNotification(n.PublishDiagnosticsNotification.type,E=>this.handleDiagnostics(E)),C.onRequest(n.RegistrationRequest.type,E=>this.handleRegistrationRequest(E)),C.onRequest("client/registerFeature",E=>this.handleRegistrationRequest(E)),C.onRequest(n.UnregistrationRequest.type,E=>this.handleUnregistrationRequest(E)),C.onRequest("client/unregisterFeature",E=>this.handleUnregistrationRequest(E)),C.onRequest(n.ApplyWorkspaceEditRequest.type,E=>this.handleApplyWorkspaceEdit(E));for(const[E,H]of this._pendingNotificationHandlers)this._notificationDisposables.set(E,C.onNotification(E,H));this._pendingNotificationHandlers.clear();for(const[E,H]of this._pendingRequestHandlers)this._requestDisposables.set(E,C.onRequest(E,H));this._pendingRequestHandlers.clear();for(const[E,H]of this._pendingProgressHandlers)this._progressDisposables.set(E,C.onProgress(H.type,E,H.handler));return this._pendingProgressHandlers.clear(),await C.sendNotification(n.InitializedNotification.type,{}),this.hookFileEvents(C),this.hookConfigurationChanged(C),this.initializeFeatures(C),b}catch(b){throw this._clientOptions.initializationFailedHandler?this._clientOptions.initializationFailedHandler(b)?this.initialize(C):this.stop():b instanceof n.ResponseError&&b.data&&b.data.retry?t.window.showErrorMessage(b.message,{title:"Retry",id:"retry"}).then(L=>{L&&L.id==="retry"?this.initialize(C):this.stop()}):(b&&b.message&&t.window.showErrorMessage(b.message),this.error("Server initialization failed.",b),this.stop()),b}}_clientGetRootPath(){let C=t.workspace.workspaceFolders;if(!C||C.length===0)return;let R=C[0];if(R.uri.scheme==="file")return R.uri.fsPath}stop(C=2e3){return this.shutdown("stop",C)}dispose(C=2e3){try{return this._disposed="disposing",this.stop(C)}finally{this._disposed="disposed"}}async shutdown(C,R){if(this.$state===ie.Stopped||this.$state===ie.Initial)return;if(this.$state===ie.Stopping){if(this._onStop!==void 0)return this._onStop;throw new Error("Client is stopping but no stop promise available.")}const b=this.activeConnection();if(b===void 0||this.$state!==ie.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=ie.Stopping,this.cleanUp(C);const L=new Promise(H=>{(0,n.RAL)().timer.setTimeout(H,R)}),E=(async H=>(await H.shutdown(),await H.exit(),H))(b);return this._onStop=Promise.race([L,E]).then(H=>{if(H!==void 0)H.end(),H.dispose();else throw this.error("Stopping server timed out",void 0,!1),new Error("Stopping the server timed out")},H=>{throw this.error("Stopping server failed",H,!1),H}).finally(()=>{this.$state=ie.Stopped,C==="stop"&&this.cleanUpChannel(),this._onStart=void 0,this._onStop=void 0,this._connection=void 0,this._ignoredRegistrations.clear()})}cleanUp(C){this._fileEvents=[],this._fileEventDelayer.cancel();const R=this._listeners.splice(0,this._listeners.length);for(const b of R)b.dispose();this._syncedDocuments&&this._syncedDocuments.clear();for(const b of Array.from(this._features.entries()).map(L=>L[1]).reverse())b.dispose();C==="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(C){const R=this;async function b(E){return R._fileEvents.push(E),R._fileEventDelayer.trigger(async()=>{const H=await R.$start();await R.forceDocumentSync();const ee=H.sendNotification(n.DidChangeWatchedFilesNotification.type,{changes:R._fileEvents});return R._fileEvents=[],ee})}const L=this.clientOptions.middleware?.workspace;(L?.didChangeWatchedFile?L.didChangeWatchedFile(C,b):b(C)).catch(E=>{R.error("Notify file events failed.",E)})}async forceDocumentSync(){return this._didChangeTextDocumentFeature===void 0&&(this._didChangeTextDocumentFeature=this._dynamicFeatures.get(n.DidChangeTextDocumentNotification.type.method)),this._didChangeTextDocumentFeature.forceDelivery()}handleDiagnostics(C){if(!this._diagnostics)return;const R=C.uri;this._diagnosticQueueState.state==="busy"&&this._diagnosticQueueState.document===R&&this._diagnosticQueueState.tokenSource.cancel(),this._diagnosticQueue.set(C.uri,C.diagnostics),this.triggerDiagnosticQueue()}triggerDiagnosticQueue(){(0,n.RAL)().timer.setImmediate(()=>{this.workDiagnosticQueue()})}workDiagnosticQueue(){if(this._diagnosticQueueState.state==="busy")return;const C=this._diagnosticQueue.entries().next();if(C.done===!0)return;const[R,b]=C.value;this._diagnosticQueue.delete(R);const L=new t.CancellationTokenSource;this._diagnosticQueueState={state:"busy",document:R,tokenSource:L},this._p2c.asDiagnostics(b,L.token).then(E=>{if(!L.token.isCancellationRequested){const H=this._p2c.asUri(R),ee=this.clientOptions.middleware;ee.handleDiagnostics?ee.handleDiagnostics(H,E,(ue,De)=>this.setDiagnostics(ue,De)):this.setDiagnostics(H,E)}}).finally(()=>{this._diagnosticQueueState={state:"idle"},this.triggerDiagnosticQueue()})}setDiagnostics(C,R){!this._diagnostics||this._diagnostics.set(C,R)}async $start(){if(this.$state===ie.StartFailed)throw new Error("Previous start failed. Can't restart server.");await this.start();const C=this.activeConnection();if(C===void 0)throw new Error("Starting server failed");return C}async createConnection(){let C=(L,E,H)=>{this.handleConnectionError(L,E,H)},R=()=>{this.handleConnectionClosed()};const b=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=pt(b.reader,b.writer,C,R,this._clientOptions.connectionOptions),this._connection}handleConnectionClosed(){if(this.$state===ie.Stopped)return;try{this._connection!==void 0&&this._connection.dispose()}catch{}let C={action:Ie.DoNotRestart};if(this.$state!==ie.Stopping)try{C=this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,C.action===Ie.DoNotRestart?(this.error(C.message??"Connection to server got closed. Server will not be restarted.",void 0,"force"),this.cleanUp("stop"),this.$state===ie.Starting?this.$state=ie.StartFailed:this.$state=ie.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):C.action===Ie.Restart&&(this.info(C.message??"Connection to server got closed. Server will restart."),this.cleanUp("restart"),this.$state=ie.Initial,this._onStop=Promise.resolve(),this._onStart=void 0,this.start().catch(R=>this.error("Restarting server failed",R,"force")))}handleConnectionError(C,R,b){const L=this._clientOptions.errorHandler.error(C,R,b);L.action===we.Shutdown&&(this.error(L.message??`Client ${this._name}: connection to server is erroring. Shutting down server.`,void 0,"force"),this.stop().catch(E=>{this.error("Stopping server failed",E,!1)}))}hookConfigurationChanged(C){this._listeners.push(t.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(C,!0)}))}refreshTrace(C,R=!1){const b=t.workspace.getConfiguration(this._id);let L=n.Trace.Off,E=n.TraceFormat.Text;if(b){const H=b.get("trace.server","off");typeof H=="string"?L=n.Trace.fromString(H):(L=n.Trace.fromString(b.get("trace.server.verbosity","off")),E=n.TraceFormat.fromString(b.get("trace.server.format","text")))}this._trace=L,this._traceFormat=E,C.trace(this._trace,this._tracer,{sendNotification:R,traceFormat:this._traceFormat}).catch(H=>{this.error("Updating trace failed with error",H,!1)})}hookFileEvents(C){let R=this._clientOptions.synchronize.fileEvents;if(!R)return;let b;o.array(R)?b=R:b=[R],b&&this._dynamicFeatures.get(n.DidChangeWatchedFilesNotification.type.method).registerRaw(a.generateUuid(),b)}registerFeatures(C){for(let R of C)this.registerFeature(R)}registerFeature(C){if(this._features.push(C),d.DynamicFeature.is(C)){const R=C.registrationType;this._dynamicFeatures.set(R.method,C)}}getFeature(C){return this._dynamicFeatures.get(C)}hasDedicatedTextSynchronizationFeature(C){const R=this.getFeature(n.NotebookDocumentSyncRegistrationType.method);return R===void 0||!(R instanceof g.NotebookDocumentSyncFeature)?!1:R.handles(C)}registerBuiltinFeatures(){this.registerFeature(new l.ConfigurationFeature(this)),this.registerFeature(new h.DidOpenTextDocumentFeature(this,this._syncedDocuments)),this.registerFeature(new h.DidChangeTextDocumentFeature(this)),this.registerFeature(new h.WillSaveFeature(this)),this.registerFeature(new h.WillSaveWaitUntilFeature(this)),this.registerFeature(new h.DidSaveTextDocumentFeature(this)),this.registerFeature(new h.DidCloseTextDocumentFeature(this,this._syncedDocuments)),this.registerFeature(new p.FileSystemWatcherFeature(this,C=>this.notifyFileEvent(C))),this.registerFeature(new y.CompletionItemFeature(this)),this.registerFeature(new P.HoverFeature(this)),this.registerFeature(new N.SignatureHelpFeature(this)),this.registerFeature(new I.DefinitionFeature(this)),this.registerFeature(new A.ReferencesFeature(this)),this.registerFeature(new w.DocumentHighlightFeature(this)),this.registerFeature(new S.DocumentSymbolFeature(this)),this.registerFeature(new j.WorkspaceSymbolFeature(this)),this.registerFeature(new G.CodeActionFeature(this)),this.registerFeature(new V.CodeLensFeature(this)),this.registerFeature(new k.DocumentFormattingFeature(this)),this.registerFeature(new k.DocumentRangeFormattingFeature(this)),this.registerFeature(new k.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new K.RenameFeature(this)),this.registerFeature(new W.DocumentLinkFeature(this)),this.registerFeature(new U.ExecuteCommandFeature(this)),this.registerFeature(new l.SyncConfigurationFeature(this)),this.registerFeature(new O.TypeDefinitionFeature(this)),this.registerFeature(new Y.ImplementationFeature(this)),this.registerFeature(new M.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new x.WorkspaceFoldersFeature(this)),this.registerFeature(new Z.FoldingRangeFeature(this)),this.registerFeature(new Ce.DeclarationFeature(this)),this.registerFeature(new Me.SelectionRangeFeature(this)),this.registerFeature(new Ge.ProgressFeature(this)),this.registerFeature(new et.CallHierarchyFeature(this)),this.registerFeature(new He.SemanticTokensFeature(this)),this.registerFeature(new rt.LinkedEditingFeature(this)),this.registerFeature(new Ue.DidCreateFilesFeature(this)),this.registerFeature(new Ue.DidRenameFilesFeature(this)),this.registerFeature(new Ue.DidDeleteFilesFeature(this)),this.registerFeature(new Ue.WillCreateFilesFeature(this)),this.registerFeature(new Ue.WillRenameFilesFeature(this)),this.registerFeature(new Ue.WillDeleteFilesFeature(this)),this.registerFeature(new gt.TypeHierarchyFeature(this)),this.registerFeature(new Ke.InlineValueFeature(this)),this.registerFeature(new ge.InlayHintsFeature(this)),this.registerFeature(new m.DiagnosticFeature(this)),this.registerFeature(new g.NotebookDocumentSyncFeature(this))}registerProposedFeatures(){this.registerFeatures(Ye.createAll(this))}fillInitializeParams(C){for(let R of this._features)o.func(R.fillInitializeParams)&&R.fillInitializeParams(C)}computeClientCapabilities(){const C={};(0,d.ensure)(C,"workspace").applyEdit=!0;const R=(0,d.ensure)((0,d.ensure)(C,"workspace"),"workspaceEdit");R.documentChanges=!0,R.resourceOperations=[n.ResourceOperationKind.Create,n.ResourceOperationKind.Rename,n.ResourceOperationKind.Delete],R.failureHandling=n.FailureHandlingKind.TextOnlyTransactional,R.normalizesLineEndings=!0,R.changeAnnotationSupport={groupsOnLabel:!0};const b=(0,d.ensure)((0,d.ensure)(C,"textDocument"),"publishDiagnostics");b.relatedInformation=!0,b.versionSupport=!1,b.tagSupport={valueSet:[n.DiagnosticTag.Unnecessary,n.DiagnosticTag.Deprecated]},b.codeDescriptionSupport=!0,b.dataSupport=!0;const L=(0,d.ensure)(C,"window"),E=(0,d.ensure)(L,"showMessage");E.messageActionItem={additionalPropertiesSupport:!0};const H=(0,d.ensure)(L,"showDocument");H.support=!0;const ee=(0,d.ensure)(C,"general");ee.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(Xe.RequestsToCancelOnContentModified)},ee.regularExpressions={engine:"ECMAScript",version:"ES2020"},ee.markdown={parser:"marked",version:"1.1.0"},ee.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(ee.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 ue of this._features)ue.fillClientCapabilities(C);return C}initializeFeatures(C){const R=this._clientOptions.documentSelector;for(const b of this._features)o.func(b.preInitialize)&&b.preInitialize(this._capabilities,R);for(const b of this._features)b.initialize(this._capabilities,R)}async handleRegistrationRequest(C){if(!this.isRunning()){for(const R of C.registrations)this._ignoredRegistrations.add(R.id);return}for(const R of C.registrations){const b=this._dynamicFeatures.get(R.method);if(b===void 0)return Promise.reject(new Error(`No feature implementation for ${R.method} found. Registration failed.`));const L=R.registerOptions??{};L.documentSelector=L.documentSelector??this._clientOptions.documentSelector;const E={id:R.id,registerOptions:L};try{b.register(E)}catch(H){return Promise.reject(H)}}}async handleUnregistrationRequest(C){for(let R of C.unregisterations){if(this._ignoredRegistrations.has(R.id))continue;const b=this._dynamicFeatures.get(R.method);if(!b)return Promise.reject(new Error(`No feature implementation for ${R.method} found. Unregistration failed.`));b.unregister(R.id)}}async handleApplyWorkspaceEdit(C){const R=C.edit,b=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(R)),L=new Map;t.workspace.textDocuments.forEach(H=>L.set(H.uri.toString(),H));let E=!1;if(R.documentChanges){for(const H of R.documentChanges)if(n.TextDocumentEdit.is(H)&&H.textDocument.version&&H.textDocument.version>=0){const ee=L.get(H.textDocument.uri);if(ee&&ee.version!==H.textDocument.version){E=!0;break}}}return E?Promise.resolve({applied:!1}):o.asPromise(t.workspace.applyEdit(b).then(H=>({applied:H})))}handleFailedRequest(C,R,b,L,E=!0){if(b instanceof n.ResponseError){if(b.code===n.ErrorCodes.PendingResponseRejected||b.code===n.ErrorCodes.ConnectionInactive)return L;if(b.code===n.LSPErrorCodes.RequestCancelled||b.code===n.LSPErrorCodes.ServerCancelled){if(R!==void 0&&R.isCancellationRequested)return L;throw b.data!==void 0?new d.LSPCancellationError(b.data):new t.CancellationError}else if(b.code===n.LSPErrorCodes.ContentModified){if(Xe.RequestsToCancelOnContentModified.has(C.method))throw new t.CancellationError;return L}}throw this.error(`Request ${C.method} failed.`,b,E),b}}e.BaseLanguageClient=Xe,Xe.RequestsToCancelOnContentModified=new Set([n.SemanticTokensRequest.method,n.SemanticTokensRangeRequest.method,n.SemanticTokensDeltaRequest.method]);class vt{error(C){(0,n.RAL)().console.error(C)}warn(C){(0,n.RAL)().console.warn(C)}info(C){(0,n.RAL)().console.info(C)}log(C){(0,n.RAL)().console.log(C)}}function pt(X,C,R,b,L){let E=-1;const H=new vt,ee=(0,n.createProtocolConnection)(X,C,H,L);return ee.onError(De=>{R(De[0],De[1],De[2])}),ee.onClose(b),{get lastUsed(){return E},resetLastUsed:()=>{E=-1},listen:()=>ee.listen(),sendRequest:(De,...ke)=>(E=Date.now(),ee.sendRequest(De,...ke)),onRequest:(De,ke)=>ee.onRequest(De,ke),hasPendingResponse:()=>ee.hasPendingResponse(),sendNotification:(De,ke)=>(E=Date.now(),ee.sendNotification(De,ke)),onNotification:(De,ke)=>ee.onNotification(De,ke),onProgress:ee.onProgress,sendProgress:ee.sendProgress,trace:(De,ke,Ct)=>{const Ft={sendNotification:!1,traceFormat:n.TraceFormat.Text};return Ct===void 0?ee.trace(De,ke,Ft):(o.boolean(Ct),ee.trace(De,ke,Ct))},initialize:De=>(E=Date.now(),ee.sendRequest(n.InitializeRequest.type,De)),shutdown:()=>(E=Date.now(),ee.sendRequest(n.ShutdownRequest.type,void 0)),exit:()=>(E=Date.now(),ee.sendNotification(n.ExitNotification.type)),end:()=>ee.end(),dispose:()=>ee.dispose()}}var Ye;(function(X){function C(R){return[]}X.createAll=C})(Ye=e.ProposedFeatures||(e.ProposedFeatures={}))}(cs);var Yo={};(function(e){var t=je&&je.__createBinding||(Object.create?function(r,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(r,a,c)}:function(r,o,s,a){a===void 0&&(a=s),r[a]=o[s]}),n=je&&je.__exportStar||function(r,o){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticPullMode=e.vsdiag=void 0,n(re,e),n(ye,e);var i=lo;Object.defineProperty(e,"vsdiag",{enumerable:!0,get:function(){return i.vsdiag}}),Object.defineProperty(e,"DiagnosticPullMode",{enumerable:!0,get:function(){return i.DiagnosticPullMode}}),n(cs,e)})(Yo);var Ia={exports:{}},Ma={},Zo={exports:{}};(function(e){e.exports=re})(Zo),function(e){var t=je&&je.__createBinding||(Object.create?function(s,a,c,d){d===void 0&&(d=c);var m=Object.getOwnPropertyDescriptor(a,c);(!m||("get"in m?!a.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(s,d,m)}:function(s,a,c,d){d===void 0&&(d=c),s[d]=a[c]}),n=je&&je.__exportStar||function(s,a){for(var c in s)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&t(a,s,c)};Object.defineProperty(e,"__esModule",{value:!0}),e.LanguageClient=void 0;const i=Yo,r=Zo.exports;n(Zo.exports,e),n(Yo,e);class o extends i.BaseLanguageClient{constructor(a,c,d,m){super(a,c,d),this.worker=m}createMessageTransports(a){const c=new r.BrowserMessageReader(this.worker),d=new r.BrowserMessageWriter(this.worker);return Promise.resolve({reader:c,writer:d})}getLocale(){return"en"}}e.LanguageClient=o}(Ma),function(e){e.exports=Ma}(Ia);async function Rl(e){return console.log(!0),await Dl(e)}async function Dl(e){const t=he.Uri.joinPath(e.extensionUri,"dist/server-worker.js"),n=new Worker(t.toString(!0));return new Ia.exports.LanguageClient("taplo-lsp","Taplo LSP",await Sl(e),n)}async function Sl(e){return await he.workspace.fs.createDirectory(e.globalStorageUri),{documentSelector:[{scheme:"file",language:"toml"},{scheme:"file",language:"cargoLock"}],initializationOptions:{configurationSection:"evenBetterToml",cachePath:e.globalStorageUri.fsPath}}}function Tl(e,t){var n,i;for(const r of he.extensions.all){const o=(i=(n=r.packageJSON)==null?void 0:n.contributes)==null?void 0:i.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,d=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:r.id}}));Array.isArray(d)||(d=[d]);for(const m of d)typeof m=="string"&&t.sendNotification("taplo/associateSchema",{schemaUri:a,priority:10,rule:{regex:m},meta:{source:"extension",extensionId:r.id}})}}}async function Pl(e){var t;const n=he.window.createStatusBarItem(he.StatusBarAlignment.Right,0);n.text="no schema selected",n.tooltip="TOML Schema",n.command="evenBetterToml.selectSchema";const i=await Rl(e);await i.start(),((t=he.window.activeTextEditor)==null?void 0:t.document.languageId)==="toml"&&n.show(),za(e,i),Tl(e,i),e.subscriptions.push(mn(),n,i.onNotification("taplo/messageWithOutput",async r=>Ha(r,i)),he.window.onDidChangeActiveTextEditor(r=>{r?.document.languageId==="toml"?n.show():n.hide()}),i.onNotification("taplo/didChangeSchemaAssociation",async r=>{var o,s,a,c;const d=(o=he.window.activeTextEditor)==null?void 0:o.document.uri.toString();!d||r.documentUri===d&&(n.text=(c=(a=(s=r.meta)==null?void 0:s.name)!=null?a:r.schemaUri)!=null?c:"no schema selected")}))}exports.activate=Pl;