@likec4/mcp 1.47.0 → 1.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/THIRD-PARTY-LICENSES.md +2417 -0
- package/dist/_chunks/libs/@chevrotain/gast.mjs +1 -0
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
- package/dist/_chunks/libs/@chevrotain/utils.mjs +1 -0
- package/dist/_chunks/libs/@hono/mcp.mjs +34 -0
- package/dist/_chunks/libs/@hono/node-server.mjs +1 -0
- package/dist/_chunks/libs/@logtape/logtape.mjs +6 -0
- package/dist/_chunks/libs/@lume/kiwi.mjs +1 -0
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +15 -0
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +1 -0
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@smithy/util-base64.mjs +1 -0
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -0
- package/dist/_chunks/libs/bail.mjs +1 -0
- package/dist/_chunks/libs/ccount.mjs +1 -0
- package/dist/_chunks/libs/character-entities-html4.mjs +1 -0
- package/dist/_chunks/libs/character-entities-legacy.mjs +1 -0
- package/dist/_chunks/libs/character-entities.mjs +2 -0
- package/dist/_chunks/libs/chevrotain-allstar.mjs +2 -0
- package/dist/_chunks/libs/chevrotain.mjs +58 -0
- package/dist/_chunks/libs/chokidar.mjs +3 -0
- package/dist/_chunks/libs/citty.mjs +5 -0
- package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -0
- package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -0
- package/dist/_chunks/libs/defu.mjs +1 -0
- package/dist/_chunks/libs/devlop.mjs +1 -0
- package/dist/_chunks/libs/escape-string-regexp.mjs +1 -0
- package/dist/_chunks/libs/eventemitter3.mjs +1 -0
- package/dist/_chunks/libs/extend.mjs +1 -0
- package/dist/_chunks/libs/fast-equals.mjs +1 -0
- package/dist/_chunks/libs/fdir.mjs +1 -0
- package/dist/_chunks/libs/graphology-dag.mjs +1 -0
- package/dist/_chunks/libs/graphology.mjs +1 -0
- package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -0
- package/dist/_chunks/libs/hast-util-to-html.mjs +9 -0
- package/dist/_chunks/libs/immer.mjs +1 -0
- package/dist/_chunks/libs/is-error-instance.mjs +1 -0
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -0
- package/dist/_chunks/libs/json5.mjs +14 -0
- package/dist/_chunks/libs/khroma.mjs +1 -0
- package/dist/_chunks/libs/langium.mjs +29 -0
- package/dist/_chunks/libs/longest-streak.mjs +1 -0
- package/dist/_chunks/libs/markdown-table.mjs +2 -0
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -0
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -0
- package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -0
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -0
- package/dist/_chunks/libs/merge-error-cause.mjs +2 -0
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -0
- package/dist/_chunks/libs/mnemonist.mjs +1 -0
- package/dist/_chunks/libs/natural-compare-lite.mjs +9 -0
- package/dist/_chunks/libs/ohash.mjs +1 -0
- package/dist/_chunks/libs/p-limit.mjs +1 -0
- package/dist/_chunks/libs/p-queue.mjs +1 -0
- package/dist/_chunks/libs/parse-ms.mjs +1 -0
- package/dist/_chunks/libs/pathe.mjs +1 -0
- package/dist/_chunks/libs/pretty-ms.mjs +1 -0
- package/dist/_chunks/libs/rehype-sanitize.mjs +1 -0
- package/dist/_chunks/libs/rehype-stringify.mjs +1 -0
- package/dist/_chunks/libs/remark-gfm.mjs +1 -0
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -0
- package/dist/_chunks/libs/remark-parse.mjs +1 -0
- package/dist/_chunks/libs/remark-rehype.mjs +1 -0
- package/dist/_chunks/libs/remeda.mjs +1 -0
- package/dist/_chunks/libs/safe-stringify.mjs +1 -0
- package/dist/_chunks/libs/strip-indent.mjs +1 -0
- package/dist/_chunks/libs/trough.mjs +1 -0
- package/dist/_chunks/libs/ts-graphviz.mjs +4 -0
- package/dist/_chunks/libs/ufo.mjs +1 -0
- package/dist/_chunks/libs/unified.mjs +1 -0
- package/dist/_chunks/libs/word-wrap.mjs +12 -0
- package/dist/_chunks/rolldown-runtime.mjs +1 -0
- package/dist/index.mjs +185 -543
- package/package.json +27 -22
- package/.turbo/turbo-build.log +0 -1350
- package/CHANGELOG.md +0 -13
- package/build.config.ts +0 -22
- package/src/empty.ts +0 -2
- package/src/index.ts +0 -99
- package/tsconfig.json +0 -24
- package/turbo.json +0 -18
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../rolldown-runtime.mjs";import{n as s,t as c}from"./@chevrotain/regexp-to-ast.mjs";import{a as l,l as u,n as d,o as f,r as p,t as m,u as h}from"./chevrotain.mjs";import{t as g}from"./chevrotain-allstar.mjs";import*as _ from"node:fs";var v=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.thenable=e.typedArray=e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(e){return e===!0||e===!1}e.boolean=t;function n(e){return typeof e==`string`||e instanceof String}e.string=n;function r(e){return typeof e==`number`||e instanceof Number}e.number=r;function i(e){return e instanceof Error}e.error=i;function a(e){return typeof e==`function`}e.func=a;function o(e){return Array.isArray(e)}e.array=o;function s(e){return o(e)&&e.every(e=>n(e))}e.stringArray=s;function c(e,t){return Array.isArray(e)&&e.every(t)}e.typedArray=c;function l(e){return e&&a(e.then)}e.thenable=l})),y=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(e){return e===!0||e===!1}e.boolean=t;function n(e){return typeof e==`string`||e instanceof String}e.string=n;function r(e){return typeof e==`number`||e instanceof Number}e.number=r;function i(e){return e instanceof Error}e.error=i;function a(e){return typeof e==`function`}e.func=a;function o(e){return Array.isArray(e)}e.array=o;function s(e){return o(e)&&e.every(e=>n(e))}e.stringArray=s})),b=o((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;let t=y();var n;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(n||(e.ErrorCodes=n={})),e.ResponseError=class e extends Error{constructor(r,i,a){super(i),this.code=t.number(r)?r:n.UnknownErrorCode,this.data=a,Object.setPrototypeOf(this,e.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};var r=class e{constructor(e){this.kind=e}static is(t){return t===e.auto||t===e.byName||t===e.byPosition}toString(){return this.kind}};e.ParameterStructures=r,r.auto=new r(`auto`),r.byPosition=new r(`byPosition`),r.byName=new r(`byName`);var i=class{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return r.auto}};e.AbstractMessageSignature=i,e.RequestType0=class extends i{constructor(e){super(e,0)}},e.RequestType=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.RequestType1=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.RequestType2=class extends i{constructor(e){super(e,2)}},e.RequestType3=class extends i{constructor(e){super(e,3)}},e.RequestType4=class extends i{constructor(e){super(e,4)}},e.RequestType5=class extends i{constructor(e){super(e,5)}},e.RequestType6=class extends i{constructor(e){super(e,6)}},e.RequestType7=class extends i{constructor(e){super(e,7)}},e.RequestType8=class extends i{constructor(e){super(e,8)}},e.RequestType9=class extends i{constructor(e){super(e,9)}},e.NotificationType=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.NotificationType0=class extends i{constructor(e){super(e,0)}},e.NotificationType1=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.NotificationType2=class extends i{constructor(e){super(e,2)}},e.NotificationType3=class extends i{constructor(e){super(e,3)}},e.NotificationType4=class extends i{constructor(e){super(e,4)}},e.NotificationType5=class extends i{constructor(e){super(e,5)}},e.NotificationType6=class extends i{constructor(e){super(e,6)}},e.NotificationType7=class extends i{constructor(e){super(e,7)}},e.NotificationType8=class extends i{constructor(e){super(e,8)}},e.NotificationType9=class extends i{constructor(e){super(e,9)}};var a;(function(e){function n(e){let n=e;return n&&t.string(n.method)&&(t.string(n.id)||t.number(n.id))}e.isRequest=n;function r(e){let n=e;return n&&t.string(n.method)&&e.id===void 0}e.isNotification=r;function i(e){let n=e;return n&&(n.result!==void 0||!!n.error)&&(t.string(n.id)||t.number(n.id)||n.id===null)}e.isResponse=i})(a||(e.Message=a={}))})),x=o((e=>{var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.LRUCache=e.LinkedMap=e.Touch=void 0;var n;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(n||(e.Touch=n={}));var r=class{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(e){return this._map.has(e)}get(e,t=n.None){let r=this._map.get(e);if(r)return t!==n.None&&this.touch(r,t),r.value}set(e,t,r=n.None){let i=this._map.get(e);if(i)i.value=t,r!==n.None&&this.touch(i,r);else{switch(i={key:e,value:t,next:void 0,previous:void 0},r){case n.None:this.addItemLast(i);break;case n.First:this.addItemFirst(i);break;case n.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw Error(`Invalid list`);let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let n=this._state,r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==n)throw Error(`LinkedMap got modified during iteration.`);r=r.next}}keys(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:t.key,done:!1};return t=t.next,e}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:t.value,done:!1};return t=t.next,e}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:[t.key,t.value],done:!1};return t=t.next,e}else return{value:void 0,done:!0}}};return n}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw Error(`Invalid list`);this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw Error(`Invalid list`);this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw Error(`Invalid list`);e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw Error(`Invalid list`);e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,n=e.previous;if(!t||!n)throw Error(`Invalid list`);t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw Error(`Invalid list`);if(!(t!==n.First&&t!==n.Last)){if(t===n.First){if(e===this._head)return;let t=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===n.Last){if(e===this._tail)return;let t=e.next,n=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}};e.LinkedMap=r,e.LRUCache=class extends r{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=n.AsNew){return super.get(e,t)}peek(e){return super.get(e,n.None)}set(e,t){return super.set(e,t,n.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}})),S=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Disposable=void 0;var t;(function(e){function t(e){return{dispose:e}}e.create=t})(t||(e.Disposable=t={}))})),C=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t;function n(){if(t===void 0)throw Error(`No runtime abstraction layer installed`);return t}(function(e){function n(e){if(e===void 0)throw Error(`No runtime abstraction layer provided`);t=e}e.install=n})(n||={}),e.default=n})),w=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Emitter=e.Event=void 0;let t=C();var n;(function(e){let t={dispose(){}};e.None=function(){return t}})(n||(e.Event=n={}));var r=class{add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let r=0,i=this._callbacks.length;r<i;r++)if(this._callbacks[r]===e)if(this._contexts[r]===t){this._callbacks.splice(r,1),this._contexts.splice(r,1);return}else n=!0;if(n)throw Error(`When adding a listener with a context, you should remove it with the same context`)}invoke(...e){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let a=0,o=r.length;a<o;a++)try{n.push(r[a].apply(i[a],e))}catch(e){(0,t.default)().console.error(e)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},i=class e{constructor(e){this._options=e}get event(){return this._event||=(t,n,i)=>{this._callbacks||=new r,this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let a={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),a.dispose=e._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(i)&&i.push(a),a},this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&=(this._callbacks.dispose(),void 0)}};e.Emitter=i,i._noop=function(){}})),ee=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;let t=C(),n=y(),r=w();var i;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:r.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r.Event.None});function t(t){let r=t;return r&&(r===e.None||r===e.Cancelled||n.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}e.is=t})(i||(e.CancellationToken=i={}));let a=Object.freeze(function(e,n){let r=(0,t.default)().timer.setTimeout(e.bind(n),0);return{dispose(){r.dispose()}}});var o=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?a:(this._emitter||=new r.Emitter,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),void 0)}};e.CancellationTokenSource=class{get token(){return this._token||=new o,this._token}cancel(){this._token?this._token.cancel():this._token=i.Cancelled}dispose(){this._token?this._token instanceof o&&this._token.dispose():this._token=i.None}}})),T=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=void 0;let t=ee();var n;(function(e){e.Continue=0,e.Cancelled=1})(n||={}),e.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let t=new SharedArrayBuffer(4),r=new Int32Array(t,0,1);r[0]=n.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){let r=this.buffers.get(t);if(r===void 0)return;let i=new Int32Array(r,0,1);Atomics.store(i,0,n.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};var r=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===n.Cancelled}get onCancellationRequested(){throw Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`)}},i=class{constructor(e){this.token=new r(e)}cancel(){}dispose(){}};e.SharedArrayReceiverStrategy=class{constructor(){this.kind=`request`}createCancellationTokenSource(e){let n=e.$cancellationData;return n===void 0?new t.CancellationTokenSource:new i(n)}}})),E=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Semaphore=void 0;let t=C();e.Semaphore=class{constructor(e=1){if(e<=0)throw Error(`Capacity must be greater than 0`);this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw Error(`To many thunks active`);try{let t=e.thunk();t instanceof Promise?t.then(t=>{this._active--,e.resolve(t),this.runNext()},t=>{this._active--,e.reject(t),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}}})),D=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;let t=C(),n=y(),r=w(),i=E();var a;(function(e){function t(e){let t=e;return t&&n.func(t.listen)&&n.func(t.dispose)&&n.func(t.onError)&&n.func(t.onClose)&&n.func(t.onPartialMessage)}e.is=t})(a||(e.MessageReader=a={}));var o=class{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter,this.partialMessageEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:Error(`Reader received error. Reason: ${n.string(e.message)?e.message:`unknown`}`)}};e.AbstractMessageReader=o;var s;(function(e){function n(e){let n,r,i=new Map,a,o=new Map;if(e===void 0||typeof e==`string`)n=e??`utf-8`;else{if(n=e.charset??`utf-8`,e.contentDecoder!==void 0&&(r=e.contentDecoder,i.set(r.name,r)),e.contentDecoders!==void 0)for(let t of e.contentDecoders)i.set(t.name,t);if(e.contentTypeDecoder!==void 0&&(a=e.contentTypeDecoder,o.set(a.name,a)),e.contentTypeDecoders!==void 0)for(let t of e.contentTypeDecoders)o.set(t.name,t)}return a===void 0&&(a=(0,t.default)().applicationJson.decoder,o.set(a.name,a)),{charset:n,contentDecoder:r,contentDecoders:i,contentTypeDecoder:a,contentTypeDecoders:o}}e.fromOptions=n})(s||={}),e.ReadableStreamMessageReader=class extends o{constructor(e,n){super(),this.readable=e,this.options=s.fromOptions(n),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new i.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let t=this.readable.onData(e=>{this.onData(e)});return this.readable.onError(e=>this.fireError(e)),this.readable.onClose(()=>this.fireClose()),t}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let e=this.buffer.tryReadHeaders(!0);if(!e)return;let t=e.get(`content-length`);if(!t){this.fireError(Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));return}let n=parseInt(t);if(isNaN(n)){this.fireError(Error(`Content-Length value must be a number. Got ${t}`));return}this.nextMessageLength=n}let e=this.buffer.tryReadBody(this.nextMessageLength);if(e===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let t=this.options.contentDecoder===void 0?e:await this.options.contentDecoder.decode(e),n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)}).catch(e=>{this.fireError(e)})}}catch(e){this.fireError(e)}}clearPartialMessageTimer(){this.partialMessageTimer&&=(this.partialMessageTimer.dispose(),void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}})),te=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;let t=C(),n=y(),r=E(),i=w();var a;(function(e){function t(e){let t=e;return t&&n.func(t.dispose)&&n.func(t.onClose)&&n.func(t.onError)&&n.func(t.write)}e.is=t})(a||(e.MessageWriter=a={}));var o=class{constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:Error(`Writer received error. Reason: ${n.string(e.message)?e.message:`unknown`}`)}};e.AbstractMessageWriter=o;var s;(function(e){function n(e){return e===void 0||typeof e==`string`?{charset:e??`utf-8`,contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:e.charset??`utf-8`,contentEncoder:e.contentEncoder,contentTypeEncoder:e.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}e.fromOptions=n})(s||={}),e.WriteableStreamMessageWriter=class extends o{constructor(e,t){super(),this.writable=e,this.options=s.fromOptions(t),this.errorCount=0,this.writeSemaphore=new r.Semaphore(1),this.writable.onError(e=>this.fireError(e)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(e=>this.options.contentEncoder===void 0?e:this.options.contentEncoder.encode(e)).then(t=>{let n=[];return n.push(`Content-Length: `,t.byteLength.toString(),`\r
|
|
2
|
+
`),n.push(`\r
|
|
3
|
+
`),this.doWrite(e,n,t)},e=>{throw this.fireError(e),e}))}async doWrite(e,t,n){try{return await this.writable.write(t.join(``),`ascii`),this.writable.write(n)}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}}})),ne=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AbstractMessageBuffer=void 0,e.AbstractMessageBuffer=class{constructor(e=`utf-8`){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let t=typeof e==`string`?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let t=0,n=0,r=0,i=0;row:for(;n<this._chunks.length;){let e=this._chunks[n];r=0;column:for(;r<e.length;){switch(e[r]){case 13:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case 10:switch(t){case 1:t=2;break;case 3:t=4,r++;break row;default:t=0}break;default:t=0}r++}i+=e.byteLength,n++}if(t!==4)return;let a=this._read(i+r),o=new Map,s=this.toString(a,`ascii`).split(`\r
|
|
4
|
+
`);if(s.length<2)return o;for(let t=0;t<s.length-2;t++){let n=s[t],r=n.indexOf(`:`);if(r===-1)throw Error(`Message header must separate key and value using ':'\n${n}`);let i=n.substr(0,r),a=n.substr(r+1).trim();o.set(e?i.toLowerCase():i,a)}return o}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw Error(`Cannot read so many bytes!`);if(this._chunks[0].byteLength===e){let t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){let t=this._chunks[0],n=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,n}let t=this.allocNative(e),n=0;for(;e>0;){let r=this._chunks[0];if(r.byteLength>e){let i=r.slice(0,e);t.set(i,n),n+=e,this._chunks[0]=r.slice(e),this._totalLength-=e,e-=e}else t.set(r,n),n+=r.byteLength,this._chunks.shift(),this._totalLength-=r.byteLength,e-=r.byteLength}return t}}})),re=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;let t=C(),n=y(),r=b(),i=x(),a=w(),o=ee();var s;(function(e){e.type=new r.NotificationType(`$/cancelRequest`)})(s||={});var c;(function(e){function t(e){return typeof e==`string`||typeof e==`number`}e.is=t})(c||(e.ProgressToken=c={}));var l;(function(e){e.type=new r.NotificationType(`$/progress`)})(l||={}),e.ProgressType=class{constructor(){}};var u;(function(e){function t(e){return n.func(e)}e.is=t})(u||={}),e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var d;(function(e){e[e.Off=0]=`Off`,e[e.Messages=1]=`Messages`,e[e.Compact=2]=`Compact`,e[e.Verbose=3]=`Verbose`})(d||(e.Trace=d={}));var f;(function(e){e.Off=`off`,e.Messages=`messages`,e.Compact=`compact`,e.Verbose=`verbose`})(f||(e.TraceValues=f={})),(function(e){function t(t){if(!n.string(t))return e.Off;switch(t=t.toLowerCase(),t){case`off`:return e.Off;case`messages`:return e.Messages;case`compact`:return e.Compact;case`verbose`:return e.Verbose;default:return e.Off}}e.fromString=t;function r(t){switch(t){case e.Off:return`off`;case e.Messages:return`messages`;case e.Compact:return`compact`;case e.Verbose:return`verbose`;default:return`off`}}e.toString=r})(d||(e.Trace=d={}));var p;(function(e){e.Text=`text`,e.JSON=`json`})(p||(e.TraceFormat=p={})),(function(e){function t(t){return n.string(t)?(t=t.toLowerCase(),t===`json`?e.JSON:e.Text):e.Text}e.fromString=t})(p||(e.TraceFormat=p={}));var m;(function(e){e.type=new r.NotificationType(`$/setTrace`)})(m||(e.SetTraceNotification=m={}));var h;(function(e){e.type=new r.NotificationType(`$/logTrace`)})(h||(e.LogTraceNotification=h={}));var g;(function(e){e[e.Closed=1]=`Closed`,e[e.Disposed=2]=`Disposed`,e[e.AlreadyListening=3]=`AlreadyListening`})(g||(e.ConnectionErrors=g={}));var _=class e extends Error{constructor(t,n){super(n),this.code=t,Object.setPrototypeOf(this,e.prototype)}};e.ConnectionError=_;var v;(function(e){function t(e){let t=e;return t&&n.func(t.cancelUndispatched)}e.is=t})(v||(e.ConnectionStrategy=v={}));var S;(function(e){function t(e){let t=e;return t&&(t.kind===void 0||t.kind===`id`)&&n.func(t.createCancellationTokenSource)&&(t.dispose===void 0||n.func(t.dispose))}e.is=t})(S||(e.IdCancellationReceiverStrategy=S={}));var T;(function(e){function t(e){let t=e;return t&&t.kind===`request`&&n.func(t.createCancellationTokenSource)&&(t.dispose===void 0||n.func(t.dispose))}e.is=t})(T||(e.RequestCancellationReceiverStrategy=T={}));var E;(function(e){e.Message=Object.freeze({createCancellationTokenSource(e){return new o.CancellationTokenSource}});function t(e){return S.is(e)||T.is(e)}e.is=t})(E||(e.CancellationReceiverStrategy=E={}));var D;(function(e){e.Message=Object.freeze({sendCancellation(e,t){return e.sendNotification(s.type,{id:t})},cleanup(e){}});function t(e){let t=e;return t&&n.func(t.sendCancellation)&&n.func(t.cleanup)}e.is=t})(D||(e.CancellationSenderStrategy=D={}));var te;(function(e){e.Message=Object.freeze({receiver:E.Message,sender:D.Message});function t(e){let t=e;return t&&E.is(t.receiver)&&D.is(t.sender)}e.is=t})(te||(e.CancellationStrategy=te={}));var ne;(function(e){function t(e){let t=e;return t&&n.func(t.handleMessage)}e.is=t})(ne||(e.MessageStrategy=ne={}));var re;(function(e){function t(e){let t=e;return t&&(te.is(t.cancellationStrategy)||v.is(t.connectionStrategy)||ne.is(t.messageStrategy))}e.is=t})(re||(e.ConnectionOptions=re={}));var O;(function(e){e[e.New=1]=`New`,e[e.Listening=2]=`Listening`,e[e.Closed=3]=`Closed`,e[e.Disposed=4]=`Disposed`})(O||={});function ie(f,v,y,b){let x=y===void 0?e.NullLogger:y,C=0,w=0,ee=0,T,E=new Map,D,re=new Map,ie=new Map,k,A=new i.LinkedMap,j=new Map,ae=new Set,M=new Map,N=d.Off,P=p.Text,F,I=O.New,oe=new a.Emitter,se=new a.Emitter,ce=new a.Emitter,le=new a.Emitter,ue=new a.Emitter,de=b&&b.cancellationStrategy?b.cancellationStrategy:te.Message;function fe(e){if(e===null)throw Error(`Can't send requests with id null since the response can't be correlated.`);return`req-`+e.toString()}function pe(e){return e===null?`res-unknown-`+(++ee).toString():`res-`+e.toString()}function me(){return`not-`+(++w).toString()}function he(e,t){r.Message.isRequest(t)?e.set(fe(t.id),t):r.Message.isResponse(t)?e.set(pe(t.id),t):e.set(me(),t)}function ge(e){}function _e(){return I===O.Listening}function ve(){return I===O.Closed}function L(){return I===O.Disposed}function ye(){(I===O.New||I===O.Listening)&&(I=O.Closed,se.fire(void 0))}function R(e){oe.fire([e,void 0,void 0])}function be(e){oe.fire(e)}f.onClose(ye),f.onError(R),v.onClose(ye),v.onError(be);function xe(){k||A.size===0||(k=(0,t.default)().timer.setImmediate(()=>{k=void 0,Ce()}))}function Se(e){r.Message.isRequest(e)?Te(e):r.Message.isNotification(e)?De(e):r.Message.isResponse(e)?Ee(e):Oe(e)}function Ce(){if(A.size===0)return;let e=A.shift();try{let t=b?.messageStrategy;ne.is(t)?t.handleMessage(e,Se):Se(e)}finally{xe()}}let we=e=>{try{if(r.Message.isNotification(e)&&e.method===s.type.method){let t=e.params.id,n=fe(t),i=A.get(n);if(r.Message.isRequest(i)){let r=b?.connectionStrategy,a=r&&r.cancelUndispatched?r.cancelUndispatched(i,ge):void 0;if(a&&(a.error!==void 0||a.result!==void 0)){A.delete(n),M.delete(t),a.id=i.id,Me(a,e.method,Date.now()),v.write(a).catch(()=>x.error(`Sending response for canceled message failed.`));return}}let a=M.get(t);if(a!==void 0){a.cancel(),Pe(e);return}else ae.add(t)}he(A,e)}finally{xe()}};function Te(e){if(L())return;function t(t,n,i){let a={jsonrpc:`2.0`,id:e.id};t instanceof r.ResponseError?a.error=t.toJson():a.result=t===void 0?null:t,Me(a,n,i),v.write(a).catch(()=>x.error(`Sending response failed.`))}function i(t,n,r){let i={jsonrpc:`2.0`,id:e.id,error:t.toJson()};Me(i,n,r),v.write(i).catch(()=>x.error(`Sending response failed.`))}function a(t,n,r){t===void 0&&(t=null);let i={jsonrpc:`2.0`,id:e.id,result:t};Me(i,n,r),v.write(i).catch(()=>x.error(`Sending response failed.`))}Ne(e);let o=E.get(e.method),s,c;o&&(s=o.type,c=o.handler);let l=Date.now();if(c||T){let o=e.id??String(Date.now()),u=S.is(de.receiver)?de.receiver.createCancellationTokenSource(o):de.receiver.createCancellationTokenSource(e);e.id!==null&&ae.has(e.id)&&u.cancel(),e.id!==null&&M.set(o,u);try{let d;if(c)if(e.params===void 0){if(s!==void 0&&s.numberOfParams!==0){i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines ${s.numberOfParams} params but received none.`),e.method,l);return}d=c(u.token)}else if(Array.isArray(e.params)){if(s!==void 0&&s.parameterStructures===r.ParameterStructures.byName){i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);return}d=c(...e.params,u.token)}else{if(s!==void 0&&s.parameterStructures===r.ParameterStructures.byPosition){i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,l);return}d=c(e.params,u.token)}else T&&(d=T(e.method,e.params,u.token));let f=d;d?f.then?f.then(n=>{M.delete(o),t(n,e.method,l)},t=>{M.delete(o),t instanceof r.ResponseError?i(t,e.method,l):t&&n.string(t.message)?i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,l):i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}):(M.delete(o),t(d,e.method,l)):(M.delete(o),a(d,e.method,l))}catch(a){M.delete(o),a instanceof r.ResponseError?t(a,e.method,l):a&&n.string(a.message)?i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${a.message}`),e.method,l):i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}}else i(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,l)}function Ee(e){if(!L())if(e.id===null)e.error?x.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):x.error(`Received response message without id. No further error information provided.`);else{let t=e.id,n=j.get(t);if(Fe(e,n),n!==void 0){j.delete(t);try{if(e.error){let t=e.error;n.reject(new r.ResponseError(t.code,t.message,t.data))}else if(e.result!==void 0)n.resolve(e.result);else throw Error(`Should never happen.`)}catch(e){e.message?x.error(`Response handler '${n.method}' failed with message: ${e.message}`):x.error(`Response handler '${n.method}' failed unexpectedly.`)}}}}function De(e){if(L())return;let t,n;if(e.method===s.type.method){let t=e.params.id;ae.delete(t),Pe(e);return}else{let r=re.get(e.method);r&&(n=r.handler,t=r.type)}if(n||D)try{if(Pe(e),n)if(e.params===void 0)t!==void 0&&t.numberOfParams!==0&&t.parameterStructures!==r.ParameterStructures.byName&&x.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),n();else if(Array.isArray(e.params)){let i=e.params;e.method===l.type.method&&i.length===2&&c.is(i[0])?n({token:i[0],value:i[1]}):(t!==void 0&&(t.parameterStructures===r.ParameterStructures.byName&&x.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&x.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${i.length} arguments`)),n(...i))}else t!==void 0&&t.parameterStructures===r.ParameterStructures.byPosition&&x.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params);else D&&D(e.method,e.params)}catch(t){t.message?x.error(`Notification handler '${e.method}' failed with message: ${t.message}`):x.error(`Notification handler '${e.method}' failed unexpectedly.`)}else ce.fire(e)}function Oe(e){if(!e){x.error(`Received empty message.`);return}x.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);let t=e;if(n.string(t.id)||n.number(t.id)){let e=t.id,n=j.get(e);n&&n.reject(Error(`The received response has neither a result nor an error property.`))}}function ke(e){if(e!=null)switch(N){case d.Verbose:return JSON.stringify(e,null,4);case d.Compact:return JSON.stringify(e);default:return}}function Ae(e){if(!(N===d.Off||!F))if(P===p.Text){let t;(N===d.Verbose||N===d.Compact)&&e.params&&(t=`Params: ${ke(e.params)}\n\n`),F.log(`Sending request '${e.method} - (${e.id})'.`,t)}else Ie(`send-request`,e)}function je(e){if(!(N===d.Off||!F))if(P===p.Text){let t;(N===d.Verbose||N===d.Compact)&&(t=e.params?`Params: ${ke(e.params)}\n\n`:`No parameters provided.
|
|
5
|
+
|
|
6
|
+
`),F.log(`Sending notification '${e.method}'.`,t)}else Ie(`send-notification`,e)}function Me(e,t,n){if(!(N===d.Off||!F))if(P===p.Text){let r;(N===d.Verbose||N===d.Compact)&&(e.error&&e.error.data?r=`Error data: ${ke(e.error.data)}\n\n`:e.result?r=`Result: ${ke(e.result)}\n\n`:e.error===void 0&&(r=`No result returned.
|
|
7
|
+
|
|
8
|
+
`)),F.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,r)}else Ie(`send-response`,e)}function Ne(e){if(!(N===d.Off||!F))if(P===p.Text){let t;(N===d.Verbose||N===d.Compact)&&e.params&&(t=`Params: ${ke(e.params)}\n\n`),F.log(`Received request '${e.method} - (${e.id})'.`,t)}else Ie(`receive-request`,e)}function Pe(e){if(!(N===d.Off||!F||e.method===h.type.method))if(P===p.Text){let t;(N===d.Verbose||N===d.Compact)&&(t=e.params?`Params: ${ke(e.params)}\n\n`:`No parameters provided.
|
|
9
|
+
|
|
10
|
+
`),F.log(`Received notification '${e.method}'.`,t)}else Ie(`receive-notification`,e)}function Fe(e,t){if(!(N===d.Off||!F))if(P===p.Text){let n;if((N===d.Verbose||N===d.Compact)&&(e.error&&e.error.data?n=`Error data: ${ke(e.error.data)}\n\n`:e.result?n=`Result: ${ke(e.result)}\n\n`:e.error===void 0&&(n=`No result returned.
|
|
11
|
+
|
|
12
|
+
`)),t){let r=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:``;F.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${r}`,n)}else F.log(`Received response ${e.id} without active response promise.`,n)}else Ie(`receive-response`,e)}function Ie(e,t){if(!F||N===d.Off)return;let n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};F.log(n)}function Le(){if(ve())throw new _(g.Closed,`Connection is closed.`);if(L())throw new _(g.Disposed,`Connection is disposed.`)}function Re(){if(_e())throw new _(g.AlreadyListening,`Connection is already listening`)}function ze(){if(!_e())throw Error(`Call listen() first.`)}function Be(e){return e===void 0?null:e}function Ve(e){if(e!==null)return e}function He(e){return e!=null&&!Array.isArray(e)&&typeof e==`object`}function Ue(e,t){switch(e){case r.ParameterStructures.auto:return He(t)?Ve(t):[Be(t)];case r.ParameterStructures.byName:if(!He(t))throw Error(`Received parameters by name but param is not an object literal.`);return Ve(t);case r.ParameterStructures.byPosition:return[Be(t)];default:throw Error(`Unknown parameter structure ${e.toString()}`)}}function We(e,t){let n,r=e.numberOfParams;switch(r){case 0:n=void 0;break;case 1:n=Ue(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<r;e++)n.push(Be(t[e]));if(t.length<r)for(let e=t.length;e<r;e++)n.push(null);break}return n}let Ge={sendNotification:(e,...t)=>{Le();let i,a;if(n.string(e)){i=e;let n=t[0],o=0,s=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(o=1,s=n);let c=t.length,l=c-o;switch(l){case 0:a=void 0;break;case 1:a=Ue(s,t[o]);break;default:if(s===r.ParameterStructures.byName)throw Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);a=t.slice(o,c).map(e=>Be(e));break}}else{let n=t;i=e.method,a=We(e,n)}let o={jsonrpc:`2.0`,method:i,params:a};return je(o),v.write(o).catch(e=>{throw x.error(`Sending notification failed.`),e})},onNotification:(e,t)=>{Le();let r;return n.func(e)?D=e:t&&(n.string(e)?(r=e,re.set(e,{type:void 0,handler:t})):(r=e.method,re.set(e.method,{type:e,handler:t}))),{dispose:()=>{r===void 0?D=void 0:re.delete(r)}}},onProgress:(e,t,n)=>{if(ie.has(t))throw Error(`Progress handler for token ${t} already registered`);return ie.set(t,n),{dispose:()=>{ie.delete(t)}}},sendProgress:(e,t,n)=>Ge.sendNotification(l.type,{token:t,value:n}),onUnhandledProgress:le.event,sendRequest:(e,...t)=>{Le(),ze();let i,a,s;if(n.string(e)){i=e;let n=t[0],c=t[t.length-1],l=0,u=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(l=1,u=n);let d=t.length;o.CancellationToken.is(c)&&(--d,s=c);let f=d-l;switch(f){case 0:a=void 0;break;case 1:a=Ue(u,t[l]);break;default:if(u===r.ParameterStructures.byName)throw Error(`Received ${f} parameters for 'by Name' request parameter structure.`);a=t.slice(l,d).map(e=>Be(e));break}}else{let n=t;i=e.method,a=We(e,n);let r=e.numberOfParams;s=o.CancellationToken.is(n[r])?n[r]:void 0}let c=C++,l;s&&(l=s.onCancellationRequested(()=>{let e=de.sender.sendCancellation(Ge,c);return e===void 0?(x.log(`Received no promise from cancellation strategy when cancelling id ${c}`),Promise.resolve()):e.catch(()=>{x.log(`Sending cancellation messages for id ${c} failed`)})}));let u={jsonrpc:`2.0`,id:c,method:i,params:a};return Ae(u),typeof de.sender.enableCancellation==`function`&&de.sender.enableCancellation(u),new Promise(async(e,t)=>{let n={method:i,timerStart:Date.now(),resolve:t=>{e(t),de.sender.cleanup(c),l?.dispose()},reject:e=>{t(e),de.sender.cleanup(c),l?.dispose()}};try{j.set(c,n),await v.write(u)}catch(e){throw j.delete(c),n.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,e.message?e.message:`Unknown reason`)),x.error(`Sending request failed.`),e}})},onRequest:(e,t)=>{Le();let r=null;return u.is(e)?(r=void 0,T=e):n.string(e)?(r=null,t!==void 0&&(r=e,E.set(e,{handler:t,type:void 0}))):t!==void 0&&(r=e.method,E.set(e.method,{type:e,handler:t})),{dispose:()=>{r!==null&&(r===void 0?T=void 0:E.delete(r))}}},hasPendingResponse:()=>j.size>0,trace:async(e,t,r)=>{let i=!1,a=p.Text;r!==void 0&&(n.boolean(r)?i=r:(i=r.sendNotification||!1,a=r.traceFormat||p.Text)),N=e,P=a,F=N===d.Off?void 0:t,i&&!ve()&&!L()&&await Ge.sendNotification(m.type,{value:d.toString(e)})},onError:oe.event,onClose:se.event,onUnhandledNotification:ce.event,onDispose:ue.event,end:()=>{v.end()},dispose:()=>{if(L())return;I=O.Disposed,ue.fire(void 0);let e=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,`Pending response rejected since connection got disposed`);for(let t of j.values())t.reject(e);j=new Map,M=new Map,ae=new Set,A=new i.LinkedMap,n.func(v.dispose)&&v.dispose(),n.func(f.dispose)&&f.dispose()},listen:()=>{Le(),Re(),I=O.Listening,f.listen(we)},inspect:()=>{(0,t.default)().console.log(`inspect`)}};return Ge.onNotification(h.type,e=>{if(N===d.Off||!F)return;let t=N===d.Verbose||N===d.Compact;F.log(e.message,t?e.verbose:void 0)}),Ge.onNotification(l.type,e=>{let t=ie.get(e.token);t?t(e.value):le.fire(e)}),Ge}e.createMessageConnection=ie})),O=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=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.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;let t=b();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}});let n=x();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}});let r=S();Object.defineProperty(e,`Disposable`,{enumerable:!0,get:function(){return r.Disposable}});let i=w();Object.defineProperty(e,`Event`,{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(e,`Emitter`,{enumerable:!0,get:function(){return i.Emitter}});let a=ee();Object.defineProperty(e,`CancellationTokenSource`,{enumerable:!0,get:function(){return a.CancellationTokenSource}}),Object.defineProperty(e,`CancellationToken`,{enumerable:!0,get:function(){return a.CancellationToken}});let o=T();Object.defineProperty(e,`SharedArraySenderStrategy`,{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(e,`SharedArrayReceiverStrategy`,{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});let s=D();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}});let c=te();Object.defineProperty(e,`MessageWriter`,{enumerable:!0,get:function(){return c.MessageWriter}}),Object.defineProperty(e,`AbstractMessageWriter`,{enumerable:!0,get:function(){return c.AbstractMessageWriter}}),Object.defineProperty(e,`WriteableStreamMessageWriter`,{enumerable:!0,get:function(){return c.WriteableStreamMessageWriter}});let l=ne();Object.defineProperty(e,`AbstractMessageBuffer`,{enumerable:!0,get:function(){return l.AbstractMessageBuffer}});let u=re();Object.defineProperty(e,`ConnectionStrategy`,{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(e,`ConnectionOptions`,{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(e,`NullLogger`,{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(e,`createMessageConnection`,{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(e,`ProgressToken`,{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(e,`ProgressType`,{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(e,`Trace`,{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(e,`TraceValues`,{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(e,`TraceFormat`,{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(e,`SetTraceNotification`,{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(e,`LogTraceNotification`,{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(e,`ConnectionErrors`,{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(e,`ConnectionError`,{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(e,`CancellationReceiverStrategy`,{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(e,`CancellationSenderStrategy`,{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(e,`CancellationStrategy`,{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(e,`MessageStrategy`,{enumerable:!0,get:function(){return u.MessageStrategy}}),e.RAL=C().default})),ie=o((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`util`),r=O();var i=class e extends r.AbstractMessageBuffer{constructor(e=`utf-8`){super(e)}emptyBuffer(){return e.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new n.TextDecoder(t).decode(e)}asNative(e,t){return t===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}};i.emptyBuffer=Buffer.allocUnsafe(0);var a=class{constructor(e){this.stream=e}onClose(e){return this.stream.on(`close`,e),r.Disposable.create(()=>this.stream.off(`close`,e))}onError(e){return this.stream.on(`error`,e),r.Disposable.create(()=>this.stream.off(`error`,e))}onEnd(e){return this.stream.on(`end`,e),r.Disposable.create(()=>this.stream.off(`end`,e))}onData(e){return this.stream.on(`data`,e),r.Disposable.create(()=>this.stream.off(`data`,e))}},o=class{constructor(e){this.stream=e}onClose(e){return this.stream.on(`close`,e),r.Disposable.create(()=>this.stream.off(`close`,e))}onError(e){return this.stream.on(`error`,e),r.Disposable.create(()=>this.stream.off(`error`,e))}onEnd(e){return this.stream.on(`end`,e),r.Disposable.create(()=>this.stream.off(`end`,e))}write(e,t){return new Promise((n,r)=>{let i=e=>{e==null?n():r(e)};typeof e==`string`?this.stream.write(e,t,i):this.stream.write(e,i)})}end(){this.stream.end()}};let s=Object.freeze({messageBuffer:Object.freeze({create:e=>new i(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:`application/json`,encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(e){return Promise.reject(e)}}}),decoder:Object.freeze({name:`application/json`,decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new n.TextDecoder(t.charset).decode(e)))}catch(e){return Promise.reject(e)}}})}),stream:Object.freeze({asReadableStream:e=>new a(e),asWritableStream:e=>new o(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){let r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){let n=setImmediate(e,...t);return{dispose:()=>clearImmediate(n)}},setInterval(e,t,...n){let r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function c(){return s}(function(e){function t(){r.RAL.install(s)}e.install=t})(c||={}),t.default=c})),k=o((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__exportStar||function(e,t){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(t,`__esModule`,{value:!0}),t.createMessageConnection=t.createServerSocketTransport=t.createClientSocketTransport=t.createServerPipeTransport=t.createClientPipeTransport=t.generateRandomPipeName=t.StreamMessageWriter=t.StreamMessageReader=t.SocketMessageWriter=t.SocketMessageReader=t.PortMessageWriter=t.PortMessageReader=t.IPCMessageWriter=t.IPCMessageReader=void 0;let i=ie();i.default.install();let a=e(`path`),o=e(`os`),s=e(`crypto`),c=e(`net`),l=O();r(O(),t),t.IPCMessageReader=class extends l.AbstractMessageReader{constructor(e){super(),this.process=e;let t=this.process;t.on(`error`,e=>this.fireError(e)),t.on(`close`,()=>this.fireClose())}listen(e){return this.process.on(`message`,e),l.Disposable.create(()=>this.process.off(`message`,e))}},t.IPCMessageWriter=class extends l.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let t=this.process;t.on(`error`,e=>this.fireError(e)),t.on(`close`,()=>this.fireClose)}write(e){try{return typeof this.process.send==`function`&&this.process.send(e,void 0,void 0,t=>{t?(this.errorCount++,this.handleError(t,e)):this.errorCount=0}),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}},t.PortMessageReader=class extends l.AbstractMessageReader{constructor(e){super(),this.onData=new l.Emitter,e.on(`close`,()=>this.fireClose),e.on(`error`,e=>this.fireError(e)),e.on(`message`,e=>{this.onData.fire(e)})}listen(e){return this.onData.event(e)}},t.PortMessageWriter=class extends l.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on(`close`,()=>this.fireClose()),e.on(`error`,e=>this.fireError(e))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};var u=class extends l.ReadableStreamMessageReader{constructor(e,t=`utf-8`){super((0,i.default)().stream.asReadableStream(e),t)}};t.SocketMessageReader=u;var d=class extends l.WriteableStreamMessageWriter{constructor(e,t){super((0,i.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};t.SocketMessageWriter=d;var f=class extends l.ReadableStreamMessageReader{constructor(e,t){super((0,i.default)().stream.asReadableStream(e),t)}};t.StreamMessageReader=f;var p=class extends l.WriteableStreamMessageWriter{constructor(e,t){super((0,i.default)().stream.asWritableStream(e),t)}};t.StreamMessageWriter=p;let m=process.env.XDG_RUNTIME_DIR,h=new Map([[`linux`,107],[`darwin`,103]]);function g(){let e=(0,s.randomBytes)(21).toString(`hex`);if(process.platform===`win32`)return`\\\\.\\pipe\\vscode-jsonrpc-${e}-sock`;let t;t=m?a.join(m,`vscode-ipc-${e}.sock`):a.join(o.tmpdir(),`vscode-${e}.sock`);let n=h.get(process.platform);return n!==void 0&&t.length>n&&(0,i.default)().console.warn(`WARNING: IPC handle "${t}" is longer than ${n} characters.`),t}t.generateRandomPipeName=g;function _(e,t=`utf-8`){let n,r=new Promise((e,t)=>{n=e});return new Promise((i,a)=>{let o=(0,c.createServer)(e=>{o.close(),n([new u(e,t),new d(e,t)])});o.on(`error`,a),o.listen(e,()=>{o.removeListener(`error`,a),i({onConnected:()=>r})})})}t.createClientPipeTransport=_;function v(e,t=`utf-8`){let n=(0,c.createConnection)(e);return[new u(n,t),new d(n,t)]}t.createServerPipeTransport=v;function y(e,t=`utf-8`){let n,r=new Promise((e,t)=>{n=e});return new Promise((i,a)=>{let o=(0,c.createServer)(e=>{o.close(),n([new u(e,t),new d(e,t)])});o.on(`error`,a),o.listen(e,`127.0.0.1`,()=>{o.removeListener(`error`,a),i({onConnected:()=>r})})})}t.createClientSocketTransport=y;function b(e,t=`utf-8`){let n=(0,c.createConnection)(e,`127.0.0.1`);return[new u(n,t),new d(n,t)]}t.createServerSocketTransport=b;function x(e){let t=e;return t.read!==void 0&&t.addListener!==void 0}function S(e){let t=e;return t.write!==void 0&&t.addListener!==void 0}function C(e,t,n,r){n||=l.NullLogger;let i=x(e)?new f(e):e,a=S(t)?new p(t):t;return l.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,l.createMessageConnection)(i,a,n,r)}t.createMessageConnection=C})),A=o(((e,t)=>{t.exports=k()})),j=i({AnnotatedTextEdit:()=>be,ChangeAnnotation:()=>ye,ChangeAnnotationIdentifier:()=>R,CodeAction:()=>rt,CodeActionContext:()=>nt,CodeActionKind:()=>et,CodeActionTriggerKind:()=>tt,CodeDescription:()=>ge,CodeLens:()=>it,Color:()=>ce,ColorInformation:()=>le,ColorPresentation:()=>ue,Command:()=>ve,CompletionItem:()=>Ve,CompletionItemKind:()=>Fe,CompletionItemLabelDetails:()=>Be,CompletionItemTag:()=>Le,CompletionList:()=>He,CreateFile:()=>Se,DeleteFile:()=>we,Diagnostic:()=>_e,DiagnosticRelatedInformation:()=>pe,DiagnosticSeverity:()=>me,DiagnosticTag:()=>he,DocumentHighlight:()=>Je,DocumentHighlightKind:()=>qe,DocumentLink:()=>ot,DocumentSymbol:()=>$e,DocumentUri:()=>ae,EOL:()=>Tt,FoldingRange:()=>fe,FoldingRangeKind:()=>de,FormattingOptions:()=>at,Hover:()=>We,InlayHint:()=>_t,InlayHintKind:()=>ht,InlayHintLabelPart:()=>gt,InlineCompletionContext:()=>Ct,InlineCompletionItem:()=>yt,InlineCompletionList:()=>bt,InlineCompletionTriggerKind:()=>xt,InlineValueContext:()=>mt,InlineValueEvaluatableExpression:()=>pt,InlineValueText:()=>dt,InlineValueVariableLookup:()=>ft,InsertReplaceEdit:()=>Re,InsertTextFormat:()=>Ie,InsertTextMode:()=>ze,Location:()=>oe,LocationLink:()=>se,MarkedString:()=>Ue,MarkupContent:()=>Pe,MarkupKind:()=>Ne,OptionalVersionedTextDocumentIdentifier:()=>je,ParameterInformation:()=>Ge,Position:()=>F,Range:()=>I,RenameFile:()=>Ce,SelectedCompletionInfo:()=>St,SelectionRange:()=>st,SemanticTokenModifiers:()=>lt,SemanticTokenTypes:()=>ct,SemanticTokens:()=>ut,SignatureInformation:()=>Ke,StringValue:()=>vt,SymbolInformation:()=>Ze,SymbolKind:()=>Ye,SymbolTag:()=>Xe,TextDocument:()=>Et,TextDocumentEdit:()=>xe,TextDocumentIdentifier:()=>ke,TextDocumentItem:()=>Me,TextEdit:()=>L,URI:()=>M,VersionedTextDocumentIdentifier:()=>Ae,WorkspaceChange:()=>Oe,WorkspaceEdit:()=>Te,WorkspaceFolder:()=>wt,WorkspaceSymbol:()=>Qe,integer:()=>N,uinteger:()=>P}),ae,M,N,P,F,I,oe,se,ce,le,ue,de,fe,pe,me,he,ge,_e,ve,L,ye,R,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,yt,bt,xt,St,Ct,wt,Tt,Et,Dt,z,Ot=n((()=>{(function(e){function t(e){return typeof e==`string`}e.is=t})(ae||={}),(function(e){function t(e){return typeof e==`string`}e.is=t})(M||={}),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(t){return typeof t==`number`&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}e.is=t})(N||={}),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(t){return typeof t==`number`&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}e.is=t})(P||={}),(function(e){function t(e,t){return e===Number.MAX_VALUE&&(e=P.MAX_VALUE),t===Number.MAX_VALUE&&(t=P.MAX_VALUE),{line:e,character:t}}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&z.uinteger(t.line)&&z.uinteger(t.character)}e.is=n})(F||={}),(function(e){function t(e,t,n,r){if(z.uinteger(e)&&z.uinteger(t)&&z.uinteger(n)&&z.uinteger(r))return{start:F.create(e,t),end:F.create(n,r)};if(F.is(e)&&F.is(t))return{start:e,end:t};throw Error(`Range#create called with invalid arguments[${e}, ${t}, ${n}, ${r}]`)}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&F.is(t.start)&&F.is(t.end)}e.is=n})(I||={}),(function(e){function t(e,t){return{uri:e,range:t}}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&I.is(t.range)&&(z.string(t.uri)||z.undefined(t.uri))}e.is=n})(oe||={}),(function(e){function t(e,t,n,r){return{targetUri:e,targetRange:t,targetSelectionRange:n,originSelectionRange:r}}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&I.is(t.targetRange)&&z.string(t.targetUri)&&I.is(t.targetSelectionRange)&&(I.is(t.originSelectionRange)||z.undefined(t.originSelectionRange))}e.is=n})(se||={}),(function(e){function t(e,t,n,r){return{red:e,green:t,blue:n,alpha:r}}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&z.numberRange(t.red,0,1)&&z.numberRange(t.green,0,1)&&z.numberRange(t.blue,0,1)&&z.numberRange(t.alpha,0,1)}e.is=n})(ce||={}),(function(e){function t(e,t){return{range:e,color:t}}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&I.is(t.range)&&ce.is(t.color)}e.is=n})(le||={}),(function(e){function t(e,t,n){return{label:e,textEdit:t,additionalTextEdits:n}}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&z.string(t.label)&&(z.undefined(t.textEdit)||L.is(t))&&(z.undefined(t.additionalTextEdits)||z.typedArray(t.additionalTextEdits,L.is))}e.is=n})(ue||={}),(function(e){e.Comment=`comment`,e.Imports=`imports`,e.Region=`region`})(de||={}),(function(e){function t(e,t,n,r,i,a){let o={startLine:e,endLine:t};return z.defined(n)&&(o.startCharacter=n),z.defined(r)&&(o.endCharacter=r),z.defined(i)&&(o.kind=i),z.defined(a)&&(o.collapsedText=a),o}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&z.uinteger(t.startLine)&&z.uinteger(t.startLine)&&(z.undefined(t.startCharacter)||z.uinteger(t.startCharacter))&&(z.undefined(t.endCharacter)||z.uinteger(t.endCharacter))&&(z.undefined(t.kind)||z.string(t.kind))}e.is=n})(fe||={}),(function(e){function t(e,t){return{location:e,message:t}}e.create=t;function n(e){let t=e;return z.defined(t)&&oe.is(t.location)&&z.string(t.message)}e.is=n})(pe||={}),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(me||={}),(function(e){e.Unnecessary=1,e.Deprecated=2})(he||={}),(function(e){function t(e){let t=e;return z.objectLiteral(t)&&z.string(t.href)}e.is=t})(ge||={}),(function(e){function t(e,t,n,r,i,a){let o={range:e,message:t};return z.defined(n)&&(o.severity=n),z.defined(r)&&(o.code=r),z.defined(i)&&(o.source=i),z.defined(a)&&(o.relatedInformation=a),o}e.create=t;function n(e){let t=e;return z.defined(t)&&I.is(t.range)&&z.string(t.message)&&(z.number(t.severity)||z.undefined(t.severity))&&(z.integer(t.code)||z.string(t.code)||z.undefined(t.code))&&(z.undefined(t.codeDescription)||z.string(t.codeDescription?.href))&&(z.string(t.source)||z.undefined(t.source))&&(z.undefined(t.relatedInformation)||z.typedArray(t.relatedInformation,pe.is))}e.is=n})(_e||={}),(function(e){function t(e,t,...n){let r={title:e,command:t};return z.defined(n)&&n.length>0&&(r.arguments=n),r}e.create=t;function n(e){let t=e;return z.defined(t)&&z.string(t.title)&&z.string(t.command)}e.is=n})(ve||={}),(function(e){function t(e,t){return{range:e,newText:t}}e.replace=t;function n(e,t){return{range:{start:e,end:e},newText:t}}e.insert=n;function r(e){return{range:e,newText:``}}e.del=r;function i(e){let t=e;return z.objectLiteral(t)&&z.string(t.newText)&&I.is(t.range)}e.is=i})(L||={}),(function(e){function t(e,t,n){let r={label:e};return t!==void 0&&(r.needsConfirmation=t),n!==void 0&&(r.description=n),r}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&z.string(t.label)&&(z.boolean(t.needsConfirmation)||t.needsConfirmation===void 0)&&(z.string(t.description)||t.description===void 0)}e.is=n})(ye||={}),(function(e){function t(e){let t=e;return z.string(t)}e.is=t})(R||={}),(function(e){function t(e,t,n){return{range:e,newText:t,annotationId:n}}e.replace=t;function n(e,t,n){return{range:{start:e,end:e},newText:t,annotationId:n}}e.insert=n;function r(e,t){return{range:e,newText:``,annotationId:t}}e.del=r;function i(e){let t=e;return L.is(t)&&(ye.is(t.annotationId)||R.is(t.annotationId))}e.is=i})(be||={}),(function(e){function t(e,t){return{textDocument:e,edits:t}}e.create=t;function n(e){let t=e;return z.defined(t)&&je.is(t.textDocument)&&Array.isArray(t.edits)}e.is=n})(xe||={}),(function(e){function t(e,t,n){let r={kind:`create`,uri:e};return t!==void 0&&(t.overwrite!==void 0||t.ignoreIfExists!==void 0)&&(r.options=t),n!==void 0&&(r.annotationId=n),r}e.create=t;function n(e){let t=e;return t&&t.kind===`create`&&z.string(t.uri)&&(t.options===void 0||(t.options.overwrite===void 0||z.boolean(t.options.overwrite))&&(t.options.ignoreIfExists===void 0||z.boolean(t.options.ignoreIfExists)))&&(t.annotationId===void 0||R.is(t.annotationId))}e.is=n})(Se||={}),(function(e){function t(e,t,n,r){let i={kind:`rename`,oldUri:e,newUri:t};return n!==void 0&&(n.overwrite!==void 0||n.ignoreIfExists!==void 0)&&(i.options=n),r!==void 0&&(i.annotationId=r),i}e.create=t;function n(e){let t=e;return t&&t.kind===`rename`&&z.string(t.oldUri)&&z.string(t.newUri)&&(t.options===void 0||(t.options.overwrite===void 0||z.boolean(t.options.overwrite))&&(t.options.ignoreIfExists===void 0||z.boolean(t.options.ignoreIfExists)))&&(t.annotationId===void 0||R.is(t.annotationId))}e.is=n})(Ce||={}),(function(e){function t(e,t,n){let r={kind:`delete`,uri:e};return t!==void 0&&(t.recursive!==void 0||t.ignoreIfNotExists!==void 0)&&(r.options=t),n!==void 0&&(r.annotationId=n),r}e.create=t;function n(e){let t=e;return t&&t.kind===`delete`&&z.string(t.uri)&&(t.options===void 0||(t.options.recursive===void 0||z.boolean(t.options.recursive))&&(t.options.ignoreIfNotExists===void 0||z.boolean(t.options.ignoreIfNotExists)))&&(t.annotationId===void 0||R.is(t.annotationId))}e.is=n})(we||={}),(function(e){function t(e){let t=e;return t&&(t.changes!==void 0||t.documentChanges!==void 0)&&(t.documentChanges===void 0||t.documentChanges.every(e=>z.string(e.kind)?Se.is(e)||Ce.is(e)||we.is(e):xe.is(e)))}e.is=t})(Te||={}),Ee=class{constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,n){let r,i;if(n===void 0?r=L.insert(e,t):R.is(n)?(i=n,r=be.insert(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=be.insert(e,t,i)),this.edits.push(r),i!==void 0)return i}replace(e,t,n){let r,i;if(n===void 0?r=L.replace(e,t):R.is(n)?(i=n,r=be.replace(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=be.replace(e,t,i)),this.edits.push(r),i!==void 0)return i}delete(e,t){let n,r;if(t===void 0?n=L.del(e):R.is(t)?(r=t,n=be.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),r=this.changeAnnotations.manage(t),n=be.del(e,r)),this.edits.push(n),r!==void 0)return r}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw Error(`Text edit change is not configured to manage change annotations.`)}},De=class{constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let n;if(R.is(e)?n=e:(n=this.nextId(),t=e),this._annotations[n]!==void 0)throw Error(`Id ${n} is already in use.`);if(t===void 0)throw Error(`No annotation provided for id ${n}`);return this._annotations[n]=t,this._size++,n}nextId(){return this._counter++,this._counter.toString()}},Oe=class{constructor(e){this._textEditChanges=Object.create(null),e===void 0?this._workspaceEdit={}:(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new De(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(e=>{if(xe.is(e)){let t=new Ee(e.edits,this._changeAnnotations);this._textEditChanges[e.textDocument.uri]=t}})):e.changes&&Object.keys(e.changes).forEach(t=>{let n=new Ee(e.changes[t]);this._textEditChanges[t]=n}))}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(je.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let t={uri:e.uri,version:e.version},n=this._textEditChanges[t.uri];if(!n){let e=[],r={textDocument:t,edits:e};this._workspaceEdit.documentChanges.push(r),n=new Ee(e,this._changeAnnotations),this._textEditChanges[t.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw Error(`Workspace edit is not configured for normal text edit changes.`);let t=this._textEditChanges[e];if(!t){let n=[];this._workspaceEdit.changes[e]=n,t=new Ee(n),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new De,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let r;ye.is(t)||R.is(t)?r=t:n=t;let i,a;if(r===void 0?i=Se.create(e,n):(a=R.is(r)?r:this._changeAnnotations.manage(r),i=Se.create(e,n,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}renameFile(e,t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let i;ye.is(n)||R.is(n)?i=n:r=n;let a,o;if(i===void 0?a=Ce.create(e,t,r):(o=R.is(i)?i:this._changeAnnotations.manage(i),a=Ce.create(e,t,r,o)),this._workspaceEdit.documentChanges.push(a),o!==void 0)return o}deleteFile(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let r;ye.is(t)||R.is(t)?r=t:n=t;let i,a;if(r===void 0?i=we.create(e,n):(a=R.is(r)?r:this._changeAnnotations.manage(r),i=we.create(e,n,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}},(function(e){function t(e){return{uri:e}}e.create=t;function n(e){let t=e;return z.defined(t)&&z.string(t.uri)}e.is=n})(ke||={}),(function(e){function t(e,t){return{uri:e,version:t}}e.create=t;function n(e){let t=e;return z.defined(t)&&z.string(t.uri)&&z.integer(t.version)}e.is=n})(Ae||={}),(function(e){function t(e,t){return{uri:e,version:t}}e.create=t;function n(e){let t=e;return z.defined(t)&&z.string(t.uri)&&(t.version===null||z.integer(t.version))}e.is=n})(je||={}),(function(e){function t(e,t,n,r){return{uri:e,languageId:t,version:n,text:r}}e.create=t;function n(e){let t=e;return z.defined(t)&&z.string(t.uri)&&z.string(t.languageId)&&z.integer(t.version)&&z.string(t.text)}e.is=n})(Me||={}),(function(e){e.PlainText=`plaintext`,e.Markdown=`markdown`;function t(t){let n=t;return n===e.PlainText||n===e.Markdown}e.is=t})(Ne||={}),(function(e){function t(e){let t=e;return z.objectLiteral(e)&&Ne.is(t.kind)&&z.string(t.value)}e.is=t})(Pe||={}),(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})(Fe||={}),(function(e){e.PlainText=1,e.Snippet=2})(Ie||={}),(function(e){e.Deprecated=1})(Le||={}),(function(e){function t(e,t,n){return{newText:e,insert:t,replace:n}}e.create=t;function n(e){let t=e;return t&&z.string(t.newText)&&I.is(t.insert)&&I.is(t.replace)}e.is=n})(Re||={}),(function(e){e.asIs=1,e.adjustIndentation=2})(ze||={}),(function(e){function t(e){let t=e;return t&&(z.string(t.detail)||t.detail===void 0)&&(z.string(t.description)||t.description===void 0)}e.is=t})(Be||={}),(function(e){function t(e){return{label:e}}e.create=t})(Ve||={}),(function(e){function t(e,t){return{items:e||[],isIncomplete:!!t}}e.create=t})(He||={}),(function(e){function t(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,`\\$&`)}e.fromPlainText=t;function n(e){let t=e;return z.string(t)||z.objectLiteral(t)&&z.string(t.language)&&z.string(t.value)}e.is=n})(Ue||={}),(function(e){function t(e){let t=e;return!!t&&z.objectLiteral(t)&&(Pe.is(t.contents)||Ue.is(t.contents)||z.typedArray(t.contents,Ue.is))&&(e.range===void 0||I.is(e.range))}e.is=t})(We||={}),(function(e){function t(e,t){return t?{label:e,documentation:t}:{label:e}}e.create=t})(Ge||={}),(function(e){function t(e,t,...n){let r={label:e};return z.defined(t)&&(r.documentation=t),z.defined(n)?r.parameters=n:r.parameters=[],r}e.create=t})(Ke||={}),(function(e){e.Text=1,e.Read=2,e.Write=3})(qe||={}),(function(e){function t(e,t){let n={range:e};return z.number(t)&&(n.kind=t),n}e.create=t})(Je||={}),(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})(Ye||={}),(function(e){e.Deprecated=1})(Xe||={}),(function(e){function t(e,t,n,r,i){let a={name:e,kind:t,location:{uri:r,range:n}};return i&&(a.containerName=i),a}e.create=t})(Ze||={}),(function(e){function t(e,t,n,r){return r===void 0?{name:e,kind:t,location:{uri:n}}:{name:e,kind:t,location:{uri:n,range:r}}}e.create=t})(Qe||={}),(function(e){function t(e,t,n,r,i,a){let o={name:e,detail:t,kind:n,range:r,selectionRange:i};return a!==void 0&&(o.children=a),o}e.create=t;function n(e){let t=e;return t&&z.string(t.name)&&z.number(t.kind)&&I.is(t.range)&&I.is(t.selectionRange)&&(t.detail===void 0||z.string(t.detail))&&(t.deprecated===void 0||z.boolean(t.deprecated))&&(t.children===void 0||Array.isArray(t.children))&&(t.tags===void 0||Array.isArray(t.tags))}e.is=n})($e||={}),(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`})(et||={}),(function(e){e.Invoked=1,e.Automatic=2})(tt||={}),(function(e){function t(e,t,n){let r={diagnostics:e};return t!=null&&(r.only=t),n!=null&&(r.triggerKind=n),r}e.create=t;function n(e){let t=e;return z.defined(t)&&z.typedArray(t.diagnostics,_e.is)&&(t.only===void 0||z.typedArray(t.only,z.string))&&(t.triggerKind===void 0||t.triggerKind===tt.Invoked||t.triggerKind===tt.Automatic)}e.is=n})(nt||={}),(function(e){function t(e,t,n){let r={title:e},i=!0;return typeof t==`string`?(i=!1,r.kind=t):ve.is(t)?r.command=t:r.edit=t,i&&n!==void 0&&(r.kind=n),r}e.create=t;function n(e){let t=e;return t&&z.string(t.title)&&(t.diagnostics===void 0||z.typedArray(t.diagnostics,_e.is))&&(t.kind===void 0||z.string(t.kind))&&(t.edit!==void 0||t.command!==void 0)&&(t.command===void 0||ve.is(t.command))&&(t.isPreferred===void 0||z.boolean(t.isPreferred))&&(t.edit===void 0||Te.is(t.edit))}e.is=n})(rt||={}),(function(e){function t(e,t){let n={range:e};return z.defined(t)&&(n.data=t),n}e.create=t;function n(e){let t=e;return z.defined(t)&&I.is(t.range)&&(z.undefined(t.command)||ve.is(t.command))}e.is=n})(it||={}),(function(e){function t(e,t){return{tabSize:e,insertSpaces:t}}e.create=t;function n(e){let t=e;return z.defined(t)&&z.uinteger(t.tabSize)&&z.boolean(t.insertSpaces)}e.is=n})(at||={}),(function(e){function t(e,t,n){return{range:e,target:t,data:n}}e.create=t;function n(e){let t=e;return z.defined(t)&&I.is(t.range)&&(z.undefined(t.target)||z.string(t.target))}e.is=n})(ot||={}),(function(e){function t(e,t){return{range:e,parent:t}}e.create=t;function n(t){let n=t;return z.objectLiteral(n)&&I.is(n.range)&&(n.parent===void 0||e.is(n.parent))}e.is=n})(st||={}),(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`})(ct||={}),(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`})(lt||={}),(function(e){function t(e){let t=e;return z.objectLiteral(t)&&(t.resultId===void 0||typeof t.resultId==`string`)&&Array.isArray(t.data)&&(t.data.length===0||typeof t.data[0]==`number`)}e.is=t})(ut||={}),(function(e){function t(e,t){return{range:e,text:t}}e.create=t;function n(e){let t=e;return t!=null&&I.is(t.range)&&z.string(t.text)}e.is=n})(dt||={}),(function(e){function t(e,t,n){return{range:e,variableName:t,caseSensitiveLookup:n}}e.create=t;function n(e){let t=e;return t!=null&&I.is(t.range)&&z.boolean(t.caseSensitiveLookup)&&(z.string(t.variableName)||t.variableName===void 0)}e.is=n})(ft||={}),(function(e){function t(e,t){return{range:e,expression:t}}e.create=t;function n(e){let t=e;return t!=null&&I.is(t.range)&&(z.string(t.expression)||t.expression===void 0)}e.is=n})(pt||={}),(function(e){function t(e,t){return{frameId:e,stoppedLocation:t}}e.create=t;function n(e){let t=e;return z.defined(t)&&I.is(e.stoppedLocation)}e.is=n})(mt||={}),(function(e){e.Type=1,e.Parameter=2;function t(e){return e===1||e===2}e.is=t})(ht||={}),(function(e){function t(e){return{value:e}}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&(t.tooltip===void 0||z.string(t.tooltip)||Pe.is(t.tooltip))&&(t.location===void 0||oe.is(t.location))&&(t.command===void 0||ve.is(t.command))}e.is=n})(gt||={}),(function(e){function t(e,t,n){let r={position:e,label:t};return n!==void 0&&(r.kind=n),r}e.create=t;function n(e){let t=e;return z.objectLiteral(t)&&F.is(t.position)&&(z.string(t.label)||z.typedArray(t.label,gt.is))&&(t.kind===void 0||ht.is(t.kind))&&t.textEdits===void 0||z.typedArray(t.textEdits,L.is)&&(t.tooltip===void 0||z.string(t.tooltip)||Pe.is(t.tooltip))&&(t.paddingLeft===void 0||z.boolean(t.paddingLeft))&&(t.paddingRight===void 0||z.boolean(t.paddingRight))}e.is=n})(_t||={}),(function(e){function t(e){return{kind:`snippet`,value:e}}e.createSnippet=t})(vt||={}),(function(e){function t(e,t,n,r){return{insertText:e,filterText:t,range:n,command:r}}e.create=t})(yt||={}),(function(e){function t(e){return{items:e}}e.create=t})(bt||={}),(function(e){e.Invoked=0,e.Automatic=1})(xt||={}),(function(e){function t(e,t){return{range:e,text:t}}e.create=t})(St||={}),(function(e){function t(e,t){return{triggerKind:e,selectedCompletionInfo:t}}e.create=t})(Ct||={}),(function(e){function t(e){let t=e;return z.objectLiteral(t)&&M.is(t.uri)&&z.string(t.name)}e.is=t})(wt||={}),Tt=[`
|
|
13
|
+
`,`\r
|
|
14
|
+
`,`\r`],(function(e){function t(e,t,n,r){return new Dt(e,t,n,r)}e.create=t;function n(e){let t=e;return!!(z.defined(t)&&z.string(t.uri)&&(z.undefined(t.languageId)||z.string(t.languageId))&&z.uinteger(t.lineCount)&&z.func(t.getText)&&z.func(t.positionAt)&&z.func(t.offsetAt))}e.is=n;function r(e,t){let n=e.getText(),r=i(t,(e,t)=>{let n=e.range.start.line-t.range.start.line;return n===0?e.range.start.character-t.range.start.character:n}),a=n.length;for(let t=r.length-1;t>=0;t--){let i=r[t],o=e.offsetAt(i.range.start),s=e.offsetAt(i.range.end);if(s<=a)n=n.substring(0,o)+i.newText+n.substring(s,n.length);else throw Error(`Overlapping edit`);a=o}return n}e.applyEdits=r;function i(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),a=e.slice(n);i(r,t),i(a,t);let o=0,s=0,c=0;for(;o<r.length&&s<a.length;)t(r[o],a[s])<=0?e[c++]=r[o++]:e[c++]=a[s++];for(;o<r.length;)e[c++]=r[o++];for(;s<a.length;)e[c++]=a[s++];return e}})(Et||={}),Dt=class{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],t=this._content,n=!0;for(let r=0;r<t.length;r++){n&&=(e.push(r),!1);let i=t.charAt(r);n=i===`\r`||i===`
|
|
15
|
+
`,i===`\r`&&r+1<t.length&&t.charAt(r+1)===`
|
|
16
|
+
`&&r++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,r=t.length;if(r===0)return F.create(0,e);for(;n<r;){let i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}let i=n-1;return F.create(i,e-t[i])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,r),n)}get lineCount(){return this.getLineOffsets().length}},(function(e){let t=Object.prototype.toString;function n(e){return e!==void 0}e.defined=n;function r(e){return e===void 0}e.undefined=r;function i(e){return e===!0||e===!1}e.boolean=i;function a(e){return t.call(e)===`[object String]`}e.string=a;function o(e){return t.call(e)===`[object Number]`}e.number=o;function s(e,n,r){return t.call(e)===`[object Number]`&&n<=e&&e<=r}e.numberRange=s;function c(e){return t.call(e)===`[object Number]`&&-2147483648<=e&&e<=2147483647}e.integer=c;function l(e){return t.call(e)===`[object Number]`&&0<=e&&e<=2147483647}e.uinteger=l;function u(e){return t.call(e)===`[object Function]`}e.func=u;function d(e){return typeof e==`object`&&!!e}e.objectLiteral=d;function f(e,t){return Array.isArray(e)&&e.every(t)}e.typedArray=f})(z||={})})),B=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ProtocolNotificationType=e.ProtocolNotificationType0=e.ProtocolRequestType=e.ProtocolRequestType0=e.RegistrationType=e.MessageDirection=void 0;let t=k();var n;(function(e){e.clientToServer=`clientToServer`,e.serverToClient=`serverToClient`,e.both=`both`})(n||(e.MessageDirection=n={})),e.RegistrationType=class{constructor(e){this.method=e}},e.ProtocolRequestType0=class extends t.RequestType0{constructor(e){super(e)}},e.ProtocolRequestType=class extends t.RequestType{constructor(e){super(e,t.ParameterStructures.byName)}},e.ProtocolNotificationType0=class extends t.NotificationType0{constructor(e){super(e)}},e.ProtocolNotificationType=class extends t.NotificationType{constructor(e){super(e,t.ParameterStructures.byName)}}})),kt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.objectLiteral=e.typedArray=e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(e){return e===!0||e===!1}e.boolean=t;function n(e){return typeof e==`string`||e instanceof String}e.string=n;function r(e){return typeof e==`number`||e instanceof Number}e.number=r;function i(e){return e instanceof Error}e.error=i;function a(e){return typeof e==`function`}e.func=a;function o(e){return Array.isArray(e)}e.array=o;function s(e){return o(e)&&e.every(e=>n(e))}e.stringArray=s;function c(e,t){return Array.isArray(e)&&e.every(t)}e.typedArray=c;function l(e){return typeof e==`object`&&!!e}e.objectLiteral=l})),At=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ImplementationRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/implementation`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ImplementationRequest=n={}))})),jt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeDefinitionRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/typeDefinition`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.TypeDefinitionRequest=n={}))})),Mt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=void 0;let t=B();var n;(function(e){e.method=`workspace/workspaceFolders`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(n||(e.WorkspaceFoldersRequest=n={}));var r;(function(e){e.method=`workspace/didChangeWorkspaceFolders`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(r||(e.DidChangeWorkspaceFoldersNotification=r={}))})),Nt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConfigurationRequest=void 0;let t=B();var n;(function(e){e.method=`workspace/configuration`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ConfigurationRequest=n={}))})),Pt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ColorPresentationRequest=e.DocumentColorRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/documentColor`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.DocumentColorRequest=n={}));var r;(function(e){e.method=`textDocument/colorPresentation`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.ColorPresentationRequest=r={}))})),Ft=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/foldingRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.FoldingRangeRequest=n={}));var r;(function(e){e.method=`workspace/foldingRange/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(r||(e.FoldingRangeRefreshRequest=r={}))})),It=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DeclarationRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/declaration`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.DeclarationRequest=n={}))})),Lt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SelectionRangeRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/selectionRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.SelectionRangeRequest=n={}))})),Rt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=void 0;let t=k(),n=B();var r;(function(e){e.type=new t.ProgressType;function n(t){return t===e.type}e.is=n})(r||(e.WorkDoneProgress=r={}));var i;(function(e){e.method=`window/workDoneProgress/create`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolRequestType(e.method)})(i||(e.WorkDoneProgressCreateRequest=i={}));var a;(function(e){e.method=`window/workDoneProgress/cancel`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(a||(e.WorkDoneProgressCancelNotification=a={}))})),zt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.CallHierarchyPrepareRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/prepareCallHierarchy`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.CallHierarchyPrepareRequest=n={}));var r;(function(e){e.method=`callHierarchy/incomingCalls`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.CallHierarchyIncomingCallsRequest=r={}));var i;(function(e){e.method=`callHierarchy/outgoingCalls`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(i||(e.CallHierarchyOutgoingCallsRequest=i={}))})),Bt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.SemanticTokensRegistrationType=e.TokenFormat=void 0;let t=B();var n;(function(e){e.Relative=`relative`})(n||(e.TokenFormat=n={}));var r;(function(e){e.method=`textDocument/semanticTokens`,e.type=new t.RegistrationType(e.method)})(r||(e.SemanticTokensRegistrationType=r={}));var i;(function(e){e.method=`textDocument/semanticTokens/full`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method),e.registrationMethod=r.method})(i||(e.SemanticTokensRequest=i={}));var a;(function(e){e.method=`textDocument/semanticTokens/full/delta`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method),e.registrationMethod=r.method})(a||(e.SemanticTokensDeltaRequest=a={}));var o;(function(e){e.method=`textDocument/semanticTokens/range`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method),e.registrationMethod=r.method})(o||(e.SemanticTokensRangeRequest=o={}));var s;(function(e){e.method=`workspace/semanticTokens/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(s||(e.SemanticTokensRefreshRequest=s={}))})),Vt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ShowDocumentRequest=void 0;let t=B();var n;(function(e){e.method=`window/showDocument`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ShowDocumentRequest=n={}))})),Ht=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LinkedEditingRangeRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/linkedEditingRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.LinkedEditingRangeRequest=n={}))})),Ut=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.DidRenameFilesNotification=e.WillRenameFilesRequest=e.DidCreateFilesNotification=e.WillCreateFilesRequest=e.FileOperationPatternKind=void 0;let t=B();var n;(function(e){e.file=`file`,e.folder=`folder`})(n||(e.FileOperationPatternKind=n={}));var r;(function(e){e.method=`workspace/willCreateFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.WillCreateFilesRequest=r={}));var i;(function(e){e.method=`workspace/didCreateFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(i||(e.DidCreateFilesNotification=i={}));var a;(function(e){e.method=`workspace/willRenameFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(a||(e.WillRenameFilesRequest=a={}));var o;(function(e){e.method=`workspace/didRenameFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(o||(e.DidRenameFilesNotification=o={}));var s;(function(e){e.method=`workspace/didDeleteFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(s||(e.DidDeleteFilesNotification=s={}));var c;(function(e){e.method=`workspace/willDeleteFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(c||(e.WillDeleteFilesRequest=c={}))})),Wt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=void 0;let t=B();var n;(function(e){e.document=`document`,e.project=`project`,e.group=`group`,e.scheme=`scheme`,e.global=`global`})(n||(e.UniquenessLevel=n={}));var r;(function(e){e.$import=`import`,e.$export=`export`,e.local=`local`})(r||(e.MonikerKind=r={}));var i;(function(e){e.method=`textDocument/moniker`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(i||(e.MonikerRequest=i={}))})),Gt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHierarchySubtypesRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchyPrepareRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/prepareTypeHierarchy`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.TypeHierarchyPrepareRequest=n={}));var r;(function(e){e.method=`typeHierarchy/supertypes`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.TypeHierarchySupertypesRequest=r={}));var i;(function(e){e.method=`typeHierarchy/subtypes`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(i||(e.TypeHierarchySubtypesRequest=i={}))})),Kt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineValueRefreshRequest=e.InlineValueRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/inlineValue`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlineValueRequest=n={}));var r;(function(e){e.method=`workspace/inlineValue/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(r||(e.InlineValueRefreshRequest=r={}))})),qt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/inlayHint`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlayHintRequest=n={}));var r;(function(e){e.method=`inlayHint/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.InlayHintResolveRequest=r={}));var i;(function(e){e.method=`workspace/inlayHint/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(i||(e.InlayHintRefreshRequest=i={}))})),Jt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=void 0;let t=k(),n=kt(),r=B();var i;(function(e){function t(e){let t=e;return t&&n.boolean(t.retriggerRequest)}e.is=t})(i||(e.DiagnosticServerCancellationData=i={}));var a;(function(e){e.Full=`full`,e.Unchanged=`unchanged`})(a||(e.DocumentDiagnosticReportKind=a={}));var o;(function(e){e.method=`textDocument/diagnostic`,e.messageDirection=r.MessageDirection.clientToServer,e.type=new r.ProtocolRequestType(e.method),e.partialResult=new t.ProgressType})(o||(e.DocumentDiagnosticRequest=o={}));var s;(function(e){e.method=`workspace/diagnostic`,e.messageDirection=r.MessageDirection.clientToServer,e.type=new r.ProtocolRequestType(e.method),e.partialResult=new t.ProgressType})(s||(e.WorkspaceDiagnosticRequest=s={}));var c;(function(e){e.method=`workspace/diagnostic/refresh`,e.messageDirection=r.MessageDirection.serverToClient,e.type=new r.ProtocolRequestType0(e.method)})(c||(e.DiagnosticRefreshRequest=c={}))})),Yt=o((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;let t=(Ot(),r(j)),n=kt(),i=B();var a;(function(e){e.Markup=1,e.Code=2;function t(e){return e===1||e===2}e.is=t})(a||(e.NotebookCellKind=a={}));var o;(function(e){function r(e,t){let n={executionOrder:e};return(t===!0||t===!1)&&(n.success=t),n}e.create=r;function i(e){let r=e;return n.objectLiteral(r)&&t.uinteger.is(r.executionOrder)&&(r.success===void 0||n.boolean(r.success))}e.is=i;function a(e,t){return e===t?!0:e==null||t==null?!1:e.executionOrder===t.executionOrder&&e.success===t.success}e.equals=a})(o||(e.ExecutionSummary=o={}));var s;(function(e){function r(e,t){return{kind:e,document:t}}e.create=r;function i(e){let r=e;return n.objectLiteral(r)&&a.is(r.kind)&&t.DocumentUri.is(r.document)&&(r.metadata===void 0||n.objectLiteral(r.metadata))}e.is=i;function s(e,t){let n=new Set;return e.document!==t.document&&n.add(`document`),e.kind!==t.kind&&n.add(`kind`),e.executionSummary!==t.executionSummary&&n.add(`executionSummary`),(e.metadata!==void 0||t.metadata!==void 0)&&!c(e.metadata,t.metadata)&&n.add(`metadata`),(e.executionSummary!==void 0||t.executionSummary!==void 0)&&!o.equals(e.executionSummary,t.executionSummary)&&n.add(`executionSummary`),n}e.diff=s;function c(e,t){if(e===t)return!0;if(e==null||t==null||typeof e!=typeof t||typeof e!=`object`)return!1;let r=Array.isArray(e),i=Array.isArray(t);if(r!==i)return!1;if(r&&i){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!c(e[n],t[n]))return!1}if(n.objectLiteral(e)&&n.objectLiteral(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||(n.sort(),r.sort(),!c(n,r)))return!1;for(let r=0;r<n.length;r++){let i=n[r];if(!c(e[i],t[i]))return!1}}return!0}})(s||(e.NotebookCell=s={}));var c;(function(e){function r(e,t,n,r){return{uri:e,notebookType:t,version:n,cells:r}}e.create=r;function i(e){let r=e;return n.objectLiteral(r)&&n.string(r.uri)&&t.integer.is(r.version)&&n.typedArray(r.cells,s.is)}e.is=i})(c||(e.NotebookDocument=c={}));var l;(function(e){e.method=`notebookDocument/sync`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.RegistrationType(e.method)})(l||(e.NotebookDocumentSyncRegistrationType=l={}));var u;(function(e){e.method=`notebookDocument/didOpen`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(u||(e.DidOpenNotebookDocumentNotification=u={}));var d;(function(e){function r(e){let r=e;return n.objectLiteral(r)&&t.uinteger.is(r.start)&&t.uinteger.is(r.deleteCount)&&(r.cells===void 0||n.typedArray(r.cells,s.is))}e.is=r;function i(e,t,n){let r={start:e,deleteCount:t};return n!==void 0&&(r.cells=n),r}e.create=i})(d||(e.NotebookCellArrayChange=d={}));var f;(function(e){e.method=`notebookDocument/didChange`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(f||(e.DidChangeNotebookDocumentNotification=f={}));var p;(function(e){e.method=`notebookDocument/didSave`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(p||(e.DidSaveNotebookDocumentNotification=p={}));var m;(function(e){e.method=`notebookDocument/didClose`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(m||(e.DidCloseNotebookDocumentNotification=m={}))})),Xt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineCompletionRequest=void 0;let t=B();var n;(function(e){e.method=`textDocument/inlineCompletion`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlineCompletionRequest=n={}))})),Zt=o((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.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.FoldingRangeRefreshRequest=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.DocumentRangesFormattingRequest=e.DocumentRangeFormattingRequest=e.DocumentFormattingRequest=e.DocumentLinkResolveRequest=e.DocumentLinkRequest=e.CodeLensRefreshRequest=e.CodeLensResolveRequest=e.CodeLensRequest=e.WorkspaceSymbolResolveRequest=void 0,e.InlineCompletionRequest=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=e.TypeHierarchySubtypesRequest=e.TypeHierarchyPrepareRequest=void 0;let t=B(),n=(Ot(),r(j)),i=kt(),a=At();Object.defineProperty(e,`ImplementationRequest`,{enumerable:!0,get:function(){return a.ImplementationRequest}});let o=jt();Object.defineProperty(e,`TypeDefinitionRequest`,{enumerable:!0,get:function(){return o.TypeDefinitionRequest}});let s=Mt();Object.defineProperty(e,`WorkspaceFoldersRequest`,{enumerable:!0,get:function(){return s.WorkspaceFoldersRequest}}),Object.defineProperty(e,`DidChangeWorkspaceFoldersNotification`,{enumerable:!0,get:function(){return s.DidChangeWorkspaceFoldersNotification}});let c=Nt();Object.defineProperty(e,`ConfigurationRequest`,{enumerable:!0,get:function(){return c.ConfigurationRequest}});let l=Pt();Object.defineProperty(e,`DocumentColorRequest`,{enumerable:!0,get:function(){return l.DocumentColorRequest}}),Object.defineProperty(e,`ColorPresentationRequest`,{enumerable:!0,get:function(){return l.ColorPresentationRequest}});let u=Ft();Object.defineProperty(e,`FoldingRangeRequest`,{enumerable:!0,get:function(){return u.FoldingRangeRequest}}),Object.defineProperty(e,`FoldingRangeRefreshRequest`,{enumerable:!0,get:function(){return u.FoldingRangeRefreshRequest}});let d=It();Object.defineProperty(e,`DeclarationRequest`,{enumerable:!0,get:function(){return d.DeclarationRequest}});let f=Lt();Object.defineProperty(e,`SelectionRangeRequest`,{enumerable:!0,get:function(){return f.SelectionRangeRequest}});let p=Rt();Object.defineProperty(e,`WorkDoneProgress`,{enumerable:!0,get:function(){return p.WorkDoneProgress}}),Object.defineProperty(e,`WorkDoneProgressCreateRequest`,{enumerable:!0,get:function(){return p.WorkDoneProgressCreateRequest}}),Object.defineProperty(e,`WorkDoneProgressCancelNotification`,{enumerable:!0,get:function(){return p.WorkDoneProgressCancelNotification}});let m=zt();Object.defineProperty(e,`CallHierarchyIncomingCallsRequest`,{enumerable:!0,get:function(){return m.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(e,`CallHierarchyOutgoingCallsRequest`,{enumerable:!0,get:function(){return m.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(e,`CallHierarchyPrepareRequest`,{enumerable:!0,get:function(){return m.CallHierarchyPrepareRequest}});let h=Bt();Object.defineProperty(e,`TokenFormat`,{enumerable:!0,get:function(){return h.TokenFormat}}),Object.defineProperty(e,`SemanticTokensRequest`,{enumerable:!0,get:function(){return h.SemanticTokensRequest}}),Object.defineProperty(e,`SemanticTokensDeltaRequest`,{enumerable:!0,get:function(){return h.SemanticTokensDeltaRequest}}),Object.defineProperty(e,`SemanticTokensRangeRequest`,{enumerable:!0,get:function(){return h.SemanticTokensRangeRequest}}),Object.defineProperty(e,`SemanticTokensRefreshRequest`,{enumerable:!0,get:function(){return h.SemanticTokensRefreshRequest}}),Object.defineProperty(e,`SemanticTokensRegistrationType`,{enumerable:!0,get:function(){return h.SemanticTokensRegistrationType}});let g=Vt();Object.defineProperty(e,`ShowDocumentRequest`,{enumerable:!0,get:function(){return g.ShowDocumentRequest}});let _=Ht();Object.defineProperty(e,`LinkedEditingRangeRequest`,{enumerable:!0,get:function(){return _.LinkedEditingRangeRequest}});let v=Ut();Object.defineProperty(e,`FileOperationPatternKind`,{enumerable:!0,get:function(){return v.FileOperationPatternKind}}),Object.defineProperty(e,`DidCreateFilesNotification`,{enumerable:!0,get:function(){return v.DidCreateFilesNotification}}),Object.defineProperty(e,`WillCreateFilesRequest`,{enumerable:!0,get:function(){return v.WillCreateFilesRequest}}),Object.defineProperty(e,`DidRenameFilesNotification`,{enumerable:!0,get:function(){return v.DidRenameFilesNotification}}),Object.defineProperty(e,`WillRenameFilesRequest`,{enumerable:!0,get:function(){return v.WillRenameFilesRequest}}),Object.defineProperty(e,`DidDeleteFilesNotification`,{enumerable:!0,get:function(){return v.DidDeleteFilesNotification}}),Object.defineProperty(e,`WillDeleteFilesRequest`,{enumerable:!0,get:function(){return v.WillDeleteFilesRequest}});let y=Wt();Object.defineProperty(e,`UniquenessLevel`,{enumerable:!0,get:function(){return y.UniquenessLevel}}),Object.defineProperty(e,`MonikerKind`,{enumerable:!0,get:function(){return y.MonikerKind}}),Object.defineProperty(e,`MonikerRequest`,{enumerable:!0,get:function(){return y.MonikerRequest}});let b=Gt();Object.defineProperty(e,`TypeHierarchyPrepareRequest`,{enumerable:!0,get:function(){return b.TypeHierarchyPrepareRequest}}),Object.defineProperty(e,`TypeHierarchySubtypesRequest`,{enumerable:!0,get:function(){return b.TypeHierarchySubtypesRequest}}),Object.defineProperty(e,`TypeHierarchySupertypesRequest`,{enumerable:!0,get:function(){return b.TypeHierarchySupertypesRequest}});let x=Kt();Object.defineProperty(e,`InlineValueRequest`,{enumerable:!0,get:function(){return x.InlineValueRequest}}),Object.defineProperty(e,`InlineValueRefreshRequest`,{enumerable:!0,get:function(){return x.InlineValueRefreshRequest}});let S=qt();Object.defineProperty(e,`InlayHintRequest`,{enumerable:!0,get:function(){return S.InlayHintRequest}}),Object.defineProperty(e,`InlayHintResolveRequest`,{enumerable:!0,get:function(){return S.InlayHintResolveRequest}}),Object.defineProperty(e,`InlayHintRefreshRequest`,{enumerable:!0,get:function(){return S.InlayHintRefreshRequest}});let C=Jt();Object.defineProperty(e,`DiagnosticServerCancellationData`,{enumerable:!0,get:function(){return C.DiagnosticServerCancellationData}}),Object.defineProperty(e,`DocumentDiagnosticReportKind`,{enumerable:!0,get:function(){return C.DocumentDiagnosticReportKind}}),Object.defineProperty(e,`DocumentDiagnosticRequest`,{enumerable:!0,get:function(){return C.DocumentDiagnosticRequest}}),Object.defineProperty(e,`WorkspaceDiagnosticRequest`,{enumerable:!0,get:function(){return C.WorkspaceDiagnosticRequest}}),Object.defineProperty(e,`DiagnosticRefreshRequest`,{enumerable:!0,get:function(){return C.DiagnosticRefreshRequest}});let w=Yt();Object.defineProperty(e,`NotebookCellKind`,{enumerable:!0,get:function(){return w.NotebookCellKind}}),Object.defineProperty(e,`ExecutionSummary`,{enumerable:!0,get:function(){return w.ExecutionSummary}}),Object.defineProperty(e,`NotebookCell`,{enumerable:!0,get:function(){return w.NotebookCell}}),Object.defineProperty(e,`NotebookDocument`,{enumerable:!0,get:function(){return w.NotebookDocument}}),Object.defineProperty(e,`NotebookDocumentSyncRegistrationType`,{enumerable:!0,get:function(){return w.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(e,`DidOpenNotebookDocumentNotification`,{enumerable:!0,get:function(){return w.DidOpenNotebookDocumentNotification}}),Object.defineProperty(e,`NotebookCellArrayChange`,{enumerable:!0,get:function(){return w.NotebookCellArrayChange}}),Object.defineProperty(e,`DidChangeNotebookDocumentNotification`,{enumerable:!0,get:function(){return w.DidChangeNotebookDocumentNotification}}),Object.defineProperty(e,`DidSaveNotebookDocumentNotification`,{enumerable:!0,get:function(){return w.DidSaveNotebookDocumentNotification}}),Object.defineProperty(e,`DidCloseNotebookDocumentNotification`,{enumerable:!0,get:function(){return w.DidCloseNotebookDocumentNotification}});let ee=Xt();Object.defineProperty(e,`InlineCompletionRequest`,{enumerable:!0,get:function(){return ee.InlineCompletionRequest}});var T;(function(e){function t(e){let t=e;return i.string(t)||i.string(t.language)||i.string(t.scheme)||i.string(t.pattern)}e.is=t})(T||(e.TextDocumentFilter=T={}));var E;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(i.string(t.notebookType)||i.string(t.scheme)||i.string(t.pattern))}e.is=t})(E||(e.NotebookDocumentFilter=E={}));var D;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(i.string(t.notebook)||E.is(t.notebook))&&(t.language===void 0||i.string(t.language))}e.is=t})(D||(e.NotebookCellTextDocumentFilter=D={}));var te;(function(e){function t(e){if(!Array.isArray(e))return!1;for(let t of e)if(!i.string(t)&&!T.is(t)&&!D.is(t))return!1;return!0}e.is=t})(te||(e.DocumentSelector=te={}));var ne;(function(e){e.method=`client/registerCapability`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(ne||(e.RegistrationRequest=ne={}));var re;(function(e){e.method=`client/unregisterCapability`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(re||(e.UnregistrationRequest=re={}));var O;(function(e){e.Create=`create`,e.Rename=`rename`,e.Delete=`delete`})(O||(e.ResourceOperationKind=O={}));var ie;(function(e){e.Abort=`abort`,e.Transactional=`transactional`,e.TextOnlyTransactional=`textOnlyTransactional`,e.Undo=`undo`})(ie||(e.FailureHandlingKind=ie={}));var k;(function(e){e.UTF8=`utf-8`,e.UTF16=`utf-16`,e.UTF32=`utf-32`})(k||(e.PositionEncodingKind=k={}));var A;(function(e){function t(e){let t=e;return t&&i.string(t.id)&&t.id.length>0}e.hasId=t})(A||(e.StaticRegistrationOptions=A={}));var ae;(function(e){function t(e){let t=e;return t&&(t.documentSelector===null||te.is(t.documentSelector))}e.is=t})(ae||(e.TextDocumentRegistrationOptions=ae={}));var M;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(t.workDoneProgress===void 0||i.boolean(t.workDoneProgress))}e.is=t;function n(e){let t=e;return t&&i.boolean(t.workDoneProgress)}e.hasWorkDoneProgress=n})(M||(e.WorkDoneProgressOptions=M={}));var N;(function(e){e.method=`initialize`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(N||(e.InitializeRequest=N={}));var P;(function(e){e.unknownProtocolVersion=1})(P||(e.InitializeErrorCodes=P={}));var F;(function(e){e.method=`initialized`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(F||(e.InitializedNotification=F={}));var I;(function(e){e.method=`shutdown`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType0(e.method)})(I||(e.ShutdownRequest=I={}));var oe;(function(e){e.method=`exit`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType0(e.method)})(oe||(e.ExitNotification=oe={}));var se;(function(e){e.method=`workspace/didChangeConfiguration`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(se||(e.DidChangeConfigurationNotification=se={}));var ce;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4,e.Debug=5})(ce||(e.MessageType=ce={}));var le;(function(e){e.method=`window/showMessage`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(le||(e.ShowMessageNotification=le={}));var ue;(function(e){e.method=`window/showMessageRequest`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(ue||(e.ShowMessageRequest=ue={}));var de;(function(e){e.method=`window/logMessage`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(de||(e.LogMessageNotification=de={}));var fe;(function(e){e.method=`telemetry/event`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(fe||(e.TelemetryEventNotification=fe={}));var pe;(function(e){e.None=0,e.Full=1,e.Incremental=2})(pe||(e.TextDocumentSyncKind=pe={}));var me;(function(e){e.method=`textDocument/didOpen`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(me||(e.DidOpenTextDocumentNotification=me={}));var he;(function(e){function t(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength==`number`)}e.isIncremental=t;function n(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range===void 0&&t.rangeLength===void 0}e.isFull=n})(he||(e.TextDocumentContentChangeEvent=he={}));var ge;(function(e){e.method=`textDocument/didChange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(ge||(e.DidChangeTextDocumentNotification=ge={}));var _e;(function(e){e.method=`textDocument/didClose`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(_e||(e.DidCloseTextDocumentNotification=_e={}));var ve;(function(e){e.method=`textDocument/didSave`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(ve||(e.DidSaveTextDocumentNotification=ve={}));var L;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(L||(e.TextDocumentSaveReason=L={}));var ye;(function(e){e.method=`textDocument/willSave`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(ye||(e.WillSaveTextDocumentNotification=ye={}));var R;(function(e){e.method=`textDocument/willSaveWaitUntil`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(R||(e.WillSaveTextDocumentWaitUntilRequest=R={}));var be;(function(e){e.method=`workspace/didChangeWatchedFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(be||(e.DidChangeWatchedFilesNotification=be={}));var xe;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(xe||(e.FileChangeType=xe={}));var Se;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(n.URI.is(t.baseUri)||n.WorkspaceFolder.is(t.baseUri))&&i.string(t.pattern)}e.is=t})(Se||(e.RelativePattern=Se={}));var Ce;(function(e){e.Create=1,e.Change=2,e.Delete=4})(Ce||(e.WatchKind=Ce={}));var we;(function(e){e.method=`textDocument/publishDiagnostics`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(we||(e.PublishDiagnosticsNotification=we={}));var Te;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(Te||(e.CompletionTriggerKind=Te={}));var Ee;(function(e){e.method=`textDocument/completion`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ee||(e.CompletionRequest=Ee={}));var De;(function(e){e.method=`completionItem/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(De||(e.CompletionResolveRequest=De={}));var Oe;(function(e){e.method=`textDocument/hover`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Oe||(e.HoverRequest=Oe={}));var ke;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(ke||(e.SignatureHelpTriggerKind=ke={}));var Ae;(function(e){e.method=`textDocument/signatureHelp`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ae||(e.SignatureHelpRequest=Ae={}));var je;(function(e){e.method=`textDocument/definition`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(je||(e.DefinitionRequest=je={}));var Me;(function(e){e.method=`textDocument/references`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Me||(e.ReferencesRequest=Me={}));var Ne;(function(e){e.method=`textDocument/documentHighlight`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ne||(e.DocumentHighlightRequest=Ne={}));var Pe;(function(e){e.method=`textDocument/documentSymbol`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Pe||(e.DocumentSymbolRequest=Pe={}));var Fe;(function(e){e.method=`textDocument/codeAction`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Fe||(e.CodeActionRequest=Fe={}));var Ie;(function(e){e.method=`codeAction/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ie||(e.CodeActionResolveRequest=Ie={}));var Le;(function(e){e.method=`workspace/symbol`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Le||(e.WorkspaceSymbolRequest=Le={}));var Re;(function(e){e.method=`workspaceSymbol/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Re||(e.WorkspaceSymbolResolveRequest=Re={}));var ze;(function(e){e.method=`textDocument/codeLens`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(ze||(e.CodeLensRequest=ze={}));var Be;(function(e){e.method=`codeLens/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Be||(e.CodeLensResolveRequest=Be={}));var Ve;(function(e){e.method=`workspace/codeLens/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(Ve||(e.CodeLensRefreshRequest=Ve={}));var He;(function(e){e.method=`textDocument/documentLink`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(He||(e.DocumentLinkRequest=He={}));var Ue;(function(e){e.method=`documentLink/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ue||(e.DocumentLinkResolveRequest=Ue={}));var We;(function(e){e.method=`textDocument/formatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(We||(e.DocumentFormattingRequest=We={}));var Ge;(function(e){e.method=`textDocument/rangeFormatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ge||(e.DocumentRangeFormattingRequest=Ge={}));var Ke;(function(e){e.method=`textDocument/rangesFormatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ke||(e.DocumentRangesFormattingRequest=Ke={}));var qe;(function(e){e.method=`textDocument/onTypeFormatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(qe||(e.DocumentOnTypeFormattingRequest=qe={}));var Je;(function(e){e.Identifier=1})(Je||(e.PrepareSupportDefaultBehavior=Je={}));var Ye;(function(e){e.method=`textDocument/rename`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ye||(e.RenameRequest=Ye={}));var Xe;(function(e){e.method=`textDocument/prepareRename`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Xe||(e.PrepareRenameRequest=Xe={}));var Ze;(function(e){e.method=`workspace/executeCommand`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ze||(e.ExecuteCommandRequest=Ze={}));var Qe;(function(e){e.method=`workspace/applyEdit`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(`workspace/applyEdit`)})(Qe||(e.ApplyWorkspaceEditRequest=Qe={}))})),Qt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createProtocolConnection=void 0;let t=k();function n(e,n,r,i){return t.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,t.createMessageConnection)(e,n,r,i)}e.createProtocolConnection=n})),$t=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,n(k(),e),n((Ot(),r(j)),e),n(B(),e),n(Zt(),e);var i=Qt();Object.defineProperty(e,`createProtocolConnection`,{enumerable:!0,get:function(){return i.createProtocolConnection}});var a;(function(e){e.lspReservedErrorRangeStart=-32899,e.RequestFailed=-32803,e.ServerCancelled=-32802,e.ContentModified=-32801,e.RequestCancelled=-32800,e.lspReservedErrorRangeEnd=-32800})(a||(e.LSPErrorCodes=a={}))})),V=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.createProtocolConnection=void 0;let r=A();n(A(),e),n($t(),e);function i(e,t,n,i){return(0,r.createMessageConnection)(e,t,n,i)}e.createProtocolConnection=i})),en=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.generateUuid=e.parse=e.isUUID=e.v4=e.empty=void 0;var t=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},n=class e extends t{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return e._oneOf(e._chars)}constructor(){super([e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),`-`,e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),`-`,`4`,e._randomHex(),e._randomHex(),e._randomHex(),`-`,e._oneOf(e._timeHighBits),e._randomHex(),e._randomHex(),e._randomHex(),`-`,e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex()].join(``))}};n._chars=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`6`,`7`,`8`,`9`,`a`,`b`,`c`,`d`,`e`,`f`],n._timeHighBits=[`8`,`9`,`a`,`b`],e.empty=new t(`00000000-0000-0000-0000-000000000000`);function r(){return new n}e.v4=r;let i=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function a(e){return i.test(e)}e.isUUID=a;function o(e){if(!a(e))throw Error(`invalid uuid`);return new t(e)}e.parse=o;function s(){return r().asHex()}e.generateUuid=s})),tn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.attachPartialResult=e.ProgressFeature=e.attachWorkDone=void 0;let t=V(),n=en();var r=class e{constructor(t,n){this._connection=t,this._token=n,e.Instances.set(this._token,this)}begin(e,n,r,i){let a={kind:`begin`,title:e,percentage:n,message:r,cancellable:i};this._connection.sendProgress(t.WorkDoneProgress.type,this._token,a)}report(e,n){let r={kind:`report`};typeof e==`number`?(r.percentage=e,n!==void 0&&(r.message=n)):r.message=e,this._connection.sendProgress(t.WorkDoneProgress.type,this._token,r)}done(){e.Instances.delete(this._token),this._connection.sendProgress(t.WorkDoneProgress.type,this._token,{kind:`end`})}};r.Instances=new Map;var i=class extends r{constructor(e,n){super(e,n),this._source=new t.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},a=class{constructor(){}begin(){}report(){}done(){}},o=class extends a{constructor(){super(),this._source=new t.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function s(e,t){if(t===void 0||t.workDoneToken===void 0)return new a;let n=t.workDoneToken;return delete t.workDoneToken,new r(e,n)}e.attachWorkDone=s,e.ProgressFeature=e=>class extends e{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(t.WorkDoneProgressCancelNotification.type,e=>{let t=r.Instances.get(e.token);(t instanceof i||t instanceof o)&&t.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new a:new r(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,n.generateUuid)();return this.connection.sendRequest(t.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new i(this.connection,e))}else return Promise.resolve(new o)}};var c;(function(e){e.type=new t.ProgressType})(c||={});var l=class{constructor(e,t){this._connection=e,this._token=t}report(e){this._connection.sendProgress(c.type,this._token,e)}};function u(e,t){if(t===void 0||t.partialResultToken===void 0)return;let n=t.partialResultToken;return delete t.partialResultToken,new l(e,n)}e.attachPartialResult=u})),nn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConfigurationFeature=void 0;let t=V(),n=v();e.ConfigurationFeature=e=>class extends e{getConfiguration(e){return e?n.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let n={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(t.ConfigurationRequest.type,n).then(t=>Array.isArray(t)?Array.isArray(e)?t:t[0]:Array.isArray(e)?[]:null)}}})),rn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WorkspaceFoldersFeature=void 0;let t=V();e.WorkspaceFoldersFeature=e=>class extends e{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let n=e.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new t.Emitter,this.connection.onNotification(t.DidChangeWorkspaceFoldersNotification.type,e=>{this._onDidChangeWorkspaceFolders.fire(e.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let t=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=t===!0||typeof t==`string`}getWorkspaceFolders(){return this.connection.sendRequest(t.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw Error(`Client doesn't support sending workspace folder change events.`);return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(t.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}}})),an=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CallHierarchyFeature=void 0;let t=V();e.CallHierarchyFeature=e=>class extends e{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(t.CallHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onIncomingCalls:e=>{let n=t.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))},onOutgoingCalls:e=>{let n=t.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}}})),on=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SemanticTokensBuilder=e.SemanticTokensDiff=e.SemanticTokensFeature=void 0;let t=V();e.SemanticTokensFeature=e=>class extends e{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(t.SemanticTokensRefreshRequest.type),on:e=>{let n=t.SemanticTokensRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))},onDelta:e=>{let n=t.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))},onRange:e=>{let n=t.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}};var n=class{constructor(e,t){this.originalSequence=e,this.modifiedSequence=t}computeDiff(){let e=this.originalSequence.length,t=this.modifiedSequence.length,n=0;for(;n<t&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<t&&n<e){let r=e-1,i=t-1;for(;r>=n&&i>=n&&this.originalSequence[r]===this.modifiedSequence[i];)r--,i--;(r<n||i<n)&&(r++,i++);let a=r-n+1,o=this.modifiedSequence.slice(n,i+1);return o.length===1&&o[0]===this.originalSequence[r]?[{start:n,deleteCount:a-1}]:[{start:n,deleteCount:a,data:o}]}else if(n<t)return[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}];else if(n<e)return[{start:n,deleteCount:e-n}];else return[]}};e.SemanticTokensDiff=n,e.SemanticTokensBuilder=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,t,n,r,i){let a=e,o=t;this._dataLen>0&&(a-=this._prevLine,a===0&&(o-=this._prevChar)),this._data[this._dataLen++]=a,this._data[this._dataLen++]=o,this._data[this._dataLen++]=n,this._data[this._dataLen++]=r,this._data[this._dataLen++]=i,this._prevLine=e,this._prevChar=t}get id(){return this._id.toString()}previousResult(e){this.id===e&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData===void 0?this.build():{resultId:this.id,edits:new n(this._prevData,this._data).computeDiff()}}}})),sn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ShowDocumentFeature=void 0;let t=V();e.ShowDocumentFeature=e=>class extends e{showDocument(e){return this.connection.sendRequest(t.ShowDocumentRequest.type,e)}}})),cn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FileOperationsFeature=void 0;let t=V();e.FileOperationsFeature=e=>class extends e{onDidCreateFiles(e){return this.connection.onNotification(t.DidCreateFilesNotification.type,t=>{e(t)})}onDidRenameFiles(e){return this.connection.onNotification(t.DidRenameFilesNotification.type,t=>{e(t)})}onDidDeleteFiles(e){return this.connection.onNotification(t.DidDeleteFilesNotification.type,t=>{e(t)})}onWillCreateFiles(e){return this.connection.onRequest(t.WillCreateFilesRequest.type,(t,n)=>e(t,n))}onWillRenameFiles(e){return this.connection.onRequest(t.WillRenameFilesRequest.type,(t,n)=>e(t,n))}onWillDeleteFiles(e){return this.connection.onRequest(t.WillDeleteFilesRequest.type,(t,n)=>e(t,n))}}})),ln=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LinkedEditingRangeFeature=void 0;let t=V();e.LinkedEditingRangeFeature=e=>class extends e{onLinkedEditingRange(e){return this.connection.onRequest(t.LinkedEditingRangeRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0))}}})),un=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHierarchyFeature=void 0;let t=V();e.TypeHierarchyFeature=e=>class extends e{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(t.TypeHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onSupertypes:e=>{let n=t.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))},onSubtypes:e=>{let n=t.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}}})),dn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineValueFeature=void 0;let t=V();e.InlineValueFeature=e=>class extends e{get inlineValue(){return{refresh:()=>this.connection.sendRequest(t.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(t.InlineValueRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t)))}}}})),fn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FoldingRangeFeature=void 0;let t=V();e.FoldingRangeFeature=e=>class extends e{get foldingRange(){return{refresh:()=>this.connection.sendRequest(t.FoldingRangeRefreshRequest.type),on:e=>{let n=t.FoldingRangeRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}}})),pn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlayHintFeature=void 0;let t=V();e.InlayHintFeature=e=>class extends e{get inlayHint(){return{refresh:()=>this.connection.sendRequest(t.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(t.InlayHintRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t))),resolve:e=>this.connection.onRequest(t.InlayHintResolveRequest.type,(t,n)=>e(t,n))}}}})),mn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiagnosticFeature=void 0;let t=V();e.DiagnosticFeature=e=>class extends e{get diagnostics(){return{refresh:()=>this.connection.sendRequest(t.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(t.DocumentDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:e=>this.connection.onRequest(t.WorkspaceDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t.WorkspaceDiagnosticRequest.partialResult,n)))}}}})),hn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TextDocuments=void 0;let t=V();e.TextDocuments=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new t.Emitter,this._onDidOpen=new t.Emitter,this._onDidClose=new t.Emitter,this._onDidSave=new t.Emitter,this._onWillSave=new t.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=t.TextDocumentSyncKind.Incremental;let n=[];return n.push(e.onDidOpenTextDocument(e=>{let t=e.textDocument,n=this._configuration.create(t.uri,t.languageId,t.version,t.text);this._syncedDocuments.set(t.uri,n);let r=Object.freeze({document:n});this._onDidOpen.fire(r),this._onDidChangeContent.fire(r)})),n.push(e.onDidChangeTextDocument(e=>{let t=e.textDocument,n=e.contentChanges;if(n.length===0)return;let{version:r}=t;if(r==null)throw Error(`Received document change event for ${t.uri} without valid version identifier`);let i=this._syncedDocuments.get(t.uri);i!==void 0&&(i=this._configuration.update(i,n,r),this._syncedDocuments.set(t.uri,i),this._onDidChangeContent.fire(Object.freeze({document:i})))})),n.push(e.onDidCloseTextDocument(e=>{let t=this._syncedDocuments.get(e.textDocument.uri);t!==void 0&&(this._syncedDocuments.delete(e.textDocument.uri),this._onDidClose.fire(Object.freeze({document:t})))})),n.push(e.onWillSaveTextDocument(e=>{let t=this._syncedDocuments.get(e.textDocument.uri);t!==void 0&&this._onWillSave.fire(Object.freeze({document:t,reason:e.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((e,t)=>{let n=this._syncedDocuments.get(e.textDocument.uri);return n!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:n,reason:e.reason}),t):[]})),n.push(e.onDidSaveTextDocument(e=>{let t=this._syncedDocuments.get(e.textDocument.uri);t!==void 0&&this._onDidSave.fire(Object.freeze({document:t}))})),t.Disposable.create(()=>{n.forEach(e=>e.dispose())})}}})),gn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NotebookDocuments=e.NotebookSyncFeature=void 0;let t=V(),n=hn();e.NotebookSyncFeature=e=>class extends e{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(t.DidOpenNotebookDocumentNotification.type,t=>{e(t)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(t.DidChangeNotebookDocumentNotification.type,t=>{e(t)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(t.DidSaveNotebookDocumentNotification.type,t=>{e(t)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(t.DidCloseNotebookDocumentNotification.type,t=>{e(t)})}}};var r=class e{onDidOpenTextDocument(e){return this.openHandler=e,t.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,t.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,t.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return e.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return e.NULL_DISPOSE}onDidSaveTextDocument(){return e.NULL_DISPOSE}};r.NULL_DISPOSE=Object.freeze({dispose:()=>{}}),e.NotebookDocuments=class{constructor(e){e instanceof n.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new n.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new t.Emitter,this._onDidChange=new t.Emitter,this._onDidSave=new t.Emitter,this._onDidClose=new t.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let t=this.notebookCellMap.get(e);return t&&t[0]}findNotebookDocumentForCell(e){let t=typeof e==`string`?e:e.document,n=this.notebookCellMap.get(t);return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let n=new r,i=[];return i.push(this.cellTextDocuments.listen(n)),i.push(e.notebooks.synchronization.onDidOpenNotebookDocument(e=>{this.notebookDocuments.set(e.notebookDocument.uri,e.notebookDocument);for(let t of e.cellTextDocuments)n.openTextDocument({textDocument:t});this.updateCellMap(e.notebookDocument),this._onDidOpen.fire(e.notebookDocument)})),i.push(e.notebooks.synchronization.onDidChangeNotebookDocument(e=>{let t=this.notebookDocuments.get(e.notebookDocument.uri);if(t===void 0)return;t.version=e.notebookDocument.version;let r=t.metadata,i=!1,a=e.change;a.metadata!==void 0&&(i=!0,t.metadata=a.metadata);let o=[],s=[],c=[],l=[];if(a.cells!==void 0){let e=a.cells;if(e.structure!==void 0){let r=e.structure.array;if(t.cells.splice(r.start,r.deleteCount,...r.cells===void 0?[]:r.cells),e.structure.didOpen!==void 0)for(let t of e.structure.didOpen)n.openTextDocument({textDocument:t}),o.push(t.uri);if(e.structure.didClose)for(let t of e.structure.didClose)n.closeTextDocument({textDocument:t}),s.push(t.uri)}if(e.data!==void 0){let n=new Map(e.data.map(e=>[e.document,e]));for(let e=0;e<=t.cells.length;e++){let r=n.get(t.cells[e].document);if(r!==void 0){let i=t.cells.splice(e,1,r);if(c.push({old:i[0],new:r}),n.delete(r.document),n.size===0)break}}}if(e.textContent!==void 0)for(let t of e.textContent)n.changeTextDocument({textDocument:t.document,contentChanges:t.changes}),l.push(t.document.uri)}this.updateCellMap(t);let u={notebookDocument:t};i&&(u.metadata={old:r,new:t.metadata});let d=[];for(let e of o)d.push(this.getNotebookCell(e));let f=[];for(let e of s)f.push(this.getNotebookCell(e));let p=[];for(let e of l)p.push(this.getNotebookCell(e));(d.length>0||f.length>0||c.length>0||p.length>0)&&(u.cells={added:d,removed:f,changed:{data:c,textContent:p}}),(u.metadata!==void 0||u.cells!==void 0)&&this._onDidChange.fire(u)})),i.push(e.notebooks.synchronization.onDidSaveNotebookDocument(e=>{let t=this.notebookDocuments.get(e.notebookDocument.uri);t!==void 0&&this._onDidSave.fire(t)})),i.push(e.notebooks.synchronization.onDidCloseNotebookDocument(e=>{let t=this.notebookDocuments.get(e.notebookDocument.uri);if(t!==void 0){this._onDidClose.fire(t);for(let t of e.cellTextDocuments)n.closeTextDocument({textDocument:t});this.notebookDocuments.delete(e.notebookDocument.uri);for(let e of t.cells)this.notebookCellMap.delete(e.document)}})),t.Disposable.create(()=>{i.forEach(e=>e.dispose())})}updateCellMap(e){for(let t of e.cells)this.notebookCellMap.set(t.document,[t,e])}}})),_n=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MonikerFeature=void 0;let t=V();e.MonikerFeature=e=>class extends e{get moniker(){return{on:e=>{let n=t.MonikerRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}}})),vn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createConnection=e.combineFeatures=e.combineNotebooksFeatures=e.combineLanguagesFeatures=e.combineWorkspaceFeatures=e.combineWindowFeatures=e.combineClientFeatures=e.combineTracerFeatures=e.combineTelemetryFeatures=e.combineConsoleFeatures=e._NotebooksImpl=e._LanguagesImpl=e.BulkUnregistration=e.BulkRegistration=e.ErrorMessageTracker=void 0;let t=V(),n=v(),r=en(),i=tn(),a=nn(),o=rn(),s=an(),c=on(),l=sn(),u=cn(),d=ln(),f=un(),p=dn(),m=fn(),h=pn(),g=mn(),_=gn(),y=_n();function b(e){if(e!==null)return e}e.ErrorMessageTracker=class{constructor(){this._messages=Object.create(null)}add(e){let t=this._messages[e];t||=0,t++,this._messages[e]=t}sendErrors(e){Object.keys(this._messages).forEach(t=>{e.window.showErrorMessage(t)})}};var x=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(t.MessageType.Error,e)}warn(e){this.send(t.MessageType.Warning,e)}info(e){this.send(t.MessageType.Info,e)}log(e){this.send(t.MessageType.Log,e)}debug(e){this.send(t.MessageType.Debug,e)}send(e,n){this._rawConnection&&this._rawConnection.sendNotification(t.LogMessageNotification.type,{type:e,message:n}).catch(()=>{(0,t.RAL)().console.error(`Sending log message failed`)})}},S=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...n){let r={type:t.MessageType.Error,message:e,actions:n};return this.connection.sendRequest(t.ShowMessageRequest.type,r).then(b)}showWarningMessage(e,...n){let r={type:t.MessageType.Warning,message:e,actions:n};return this.connection.sendRequest(t.ShowMessageRequest.type,r).then(b)}showInformationMessage(e,...n){let r={type:t.MessageType.Info,message:e,actions:n};return this.connection.sendRequest(t.ShowMessageRequest.type,r).then(b)}};let C=(0,l.ShowDocumentFeature)((0,i.ProgressFeature)(S));var w;(function(e){function t(){return new ee}e.create=t})(w||(e.BulkRegistration=w={}));var ee=class{constructor(){this._registrations=[],this._registered=new Set}add(e,t){let i=n.string(e)?e:e.method;if(this._registered.has(i))throw Error(`${i} is already added to this registration`);let a=r.generateUuid();this._registrations.push({id:a,method:i,registerOptions:t||{}}),this._registered.add(i)}asRegistrationParams(){return{registrations:this._registrations}}},T;(function(e){function t(){return new E(void 0,[])}e.create=t})(T||(e.BulkUnregistration=T={}));var E=class{constructor(e,t){this._connection=e,this._unregistrations=new Map,t.forEach(e=>{this._unregistrations.set(e.method,e)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let t of this._unregistrations.values())e.push(t);let n={unregisterations:e};this._connection.sendRequest(t.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info(`Bulk unregistration failed.`)})}disposeSingle(e){let r=n.string(e)?e:e.method,i=this._unregistrations.get(r);if(!i)return!1;let a={unregisterations:[i]};return this._connection.sendRequest(t.UnregistrationRequest.type,a).then(()=>{this._unregistrations.delete(r)},e=>{this._connection.console.info(`Un-registering request handler for ${i.id} failed.`)}),!0}},D=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,t,n){return e instanceof ee?this.registerMany(e):e instanceof E?this.registerSingle1(e,t,n):this.registerSingle2(e,t)}registerSingle1(e,i,a){let o=n.string(i)?i:i.method,s=r.generateUuid(),c={registrations:[{id:s,method:o,registerOptions:a||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(t.RegistrationRequest.type,c).then(t=>(e.add({id:s,method:o}),e),e=>(this.connection.console.info(`Registering request handler for ${o} failed.`),Promise.reject(e)))}registerSingle2(e,i){let a=n.string(e)?e:e.method,o=r.generateUuid(),s={registrations:[{id:o,method:a,registerOptions:i||{}}]};return this.connection.sendRequest(t.RegistrationRequest.type,s).then(e=>t.Disposable.create(()=>{this.unregisterSingle(o,a).catch(()=>{this.connection.console.info(`Un-registering capability with id ${o} failed.`)})}),e=>(this.connection.console.info(`Registering request handler for ${a} failed.`),Promise.reject(e)))}unregisterSingle(e,n){let r={unregisterations:[{id:e,method:n}]};return this.connection.sendRequest(t.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let n=e.asRegistrationParams();return this.connection.sendRequest(t.RegistrationRequest.type,n).then(()=>new E(this._connection,n.registrations.map(e=>({id:e.id,method:e.method}))),e=>(this.connection.console.info(`Bulk registration failed.`),Promise.reject(e)))}},te=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function n(e){return e&&!!e.edit}let r=n(e)?e:{edit:e};return this.connection.sendRequest(t.ApplyWorkspaceEditRequest.type,r)}};let ne=(0,u.FileOperationsFeature)((0,o.WorkspaceFoldersFeature)((0,a.ConfigurationFeature)(te)));var re=class{constructor(){this._trace=t.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,n){this._trace!==t.Trace.Off&&this.connection.sendNotification(t.LogTraceNotification.type,{message:e,verbose:this._trace===t.Trace.Verbose?n:void 0}).catch(()=>{})}},O=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(t.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log(`Sending TelemetryEventNotification failed`)})}},ie=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,i.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,t){return(0,i.attachPartialResult)(this.connection,t)}};e._LanguagesImpl=ie;let k=(0,m.FoldingRangeFeature)((0,y.MonikerFeature)((0,g.DiagnosticFeature)((0,h.InlayHintFeature)((0,p.InlineValueFeature)((0,f.TypeHierarchyFeature)((0,d.LinkedEditingRangeFeature)((0,c.SemanticTokensFeature)((0,s.CallHierarchyFeature)(ie)))))))));var A=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,i.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,t){return(0,i.attachPartialResult)(this.connection,t)}};e._NotebooksImpl=A;let j=(0,_.NotebookSyncFeature)(A);function ae(e,t){return function(n){return t(e(n))}}e.combineConsoleFeatures=ae;function M(e,t){return function(n){return t(e(n))}}e.combineTelemetryFeatures=M;function N(e,t){return function(n){return t(e(n))}}e.combineTracerFeatures=N;function P(e,t){return function(n){return t(e(n))}}e.combineClientFeatures=P;function F(e,t){return function(n){return t(e(n))}}e.combineWindowFeatures=F;function I(e,t){return function(n){return t(e(n))}}e.combineWorkspaceFeatures=I;function oe(e,t){return function(n){return t(e(n))}}e.combineLanguagesFeatures=oe;function se(e,t){return function(n){return t(e(n))}}e.combineNotebooksFeatures=se;function ce(e,t){function n(e,t,n){return e&&t?n(e,t):e||t}return{__brand:`features`,console:n(e.console,t.console,ae),tracer:n(e.tracer,t.tracer,N),telemetry:n(e.telemetry,t.telemetry,M),client:n(e.client,t.client,P),window:n(e.window,t.window,F),workspace:n(e.workspace,t.workspace,I),languages:n(e.languages,t.languages,oe),notebooks:n(e.notebooks,t.notebooks,se)}}e.combineFeatures=ce;function le(e,r,a){let o=a&&a.console?new(a.console(x)):new x,s=e(o);o.rawAttach(s);let c=a&&a.tracer?new(a.tracer(re)):new re,l=a&&a.telemetry?new(a.telemetry(O)):new O,u=a&&a.client?new(a.client(D)):new D,d=a&&a.window?new(a.window(C)):new C,f=a&&a.workspace?new(a.workspace(ne)):new ne,p=a&&a.languages?new(a.languages(k)):new k,m=a&&a.notebooks?new(a.notebooks(j)):new j,h=[o,c,l,u,d,f,p,m];function g(e){return e instanceof Promise?e:n.thenable(e)?new Promise((t,n)=>{e.then(e=>t(e),e=>n(e))}):Promise.resolve(e)}let _,v,y,b={listen:()=>s.listen(),sendRequest:(e,...t)=>s.sendRequest(n.string(e)?e:e.method,...t),onRequest:(e,t)=>s.onRequest(e,t),sendNotification:(e,t)=>{let r=n.string(e)?e:e.method;return s.sendNotification(r,t)},onNotification:(e,t)=>s.onNotification(e,t),onProgress:s.onProgress,sendProgress:s.sendProgress,onInitialize:e=>(v=e,{dispose:()=>{v=void 0}}),onInitialized:e=>s.onNotification(t.InitializedNotification.type,e),onShutdown:e=>(_=e,{dispose:()=>{_=void 0}}),onExit:e=>(y=e,{dispose:()=>{y=void 0}}),get console(){return o},get telemetry(){return l},get tracer(){return c},get client(){return u},get window(){return d},get workspace(){return f},get languages(){return p},get notebooks(){return m},onDidChangeConfiguration:e=>s.onNotification(t.DidChangeConfigurationNotification.type,e),onDidChangeWatchedFiles:e=>s.onNotification(t.DidChangeWatchedFilesNotification.type,e),__textDocumentSync:void 0,onDidOpenTextDocument:e=>s.onNotification(t.DidOpenTextDocumentNotification.type,e),onDidChangeTextDocument:e=>s.onNotification(t.DidChangeTextDocumentNotification.type,e),onDidCloseTextDocument:e=>s.onNotification(t.DidCloseTextDocumentNotification.type,e),onWillSaveTextDocument:e=>s.onNotification(t.WillSaveTextDocumentNotification.type,e),onWillSaveTextDocumentWaitUntil:e=>s.onRequest(t.WillSaveTextDocumentWaitUntilRequest.type,e),onDidSaveTextDocument:e=>s.onNotification(t.DidSaveTextDocumentNotification.type,e),sendDiagnostics:e=>s.sendNotification(t.PublishDiagnosticsNotification.type,e),onHover:e=>s.onRequest(t.HoverRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onCompletion:e=>s.onRequest(t.CompletionRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onCompletionResolve:e=>s.onRequest(t.CompletionResolveRequest.type,e),onSignatureHelp:e=>s.onRequest(t.SignatureHelpRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onDeclaration:e=>s.onRequest(t.DeclarationRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onDefinition:e=>s.onRequest(t.DefinitionRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onTypeDefinition:e=>s.onRequest(t.TypeDefinitionRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onImplementation:e=>s.onRequest(t.ImplementationRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onReferences:e=>s.onRequest(t.ReferencesRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onDocumentHighlight:e=>s.onRequest(t.DocumentHighlightRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onDocumentSymbol:e=>s.onRequest(t.DocumentSymbolRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onWorkspaceSymbol:e=>s.onRequest(t.WorkspaceSymbolRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onWorkspaceSymbolResolve:e=>s.onRequest(t.WorkspaceSymbolResolveRequest.type,e),onCodeAction:e=>s.onRequest(t.CodeActionRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onCodeActionResolve:e=>s.onRequest(t.CodeActionResolveRequest.type,(t,n)=>e(t,n)),onCodeLens:e=>s.onRequest(t.CodeLensRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onCodeLensResolve:e=>s.onRequest(t.CodeLensResolveRequest.type,(t,n)=>e(t,n)),onDocumentFormatting:e=>s.onRequest(t.DocumentFormattingRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onDocumentRangeFormatting:e=>s.onRequest(t.DocumentRangeFormattingRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onDocumentOnTypeFormatting:e=>s.onRequest(t.DocumentOnTypeFormattingRequest.type,(t,n)=>e(t,n)),onRenameRequest:e=>s.onRequest(t.RenameRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onPrepareRename:e=>s.onRequest(t.PrepareRenameRequest.type,(t,n)=>e(t,n)),onDocumentLinks:e=>s.onRequest(t.DocumentLinkRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onDocumentLinkResolve:e=>s.onRequest(t.DocumentLinkResolveRequest.type,(t,n)=>e(t,n)),onDocumentColor:e=>s.onRequest(t.DocumentColorRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onColorPresentation:e=>s.onRequest(t.ColorPresentationRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onFoldingRanges:e=>s.onRequest(t.FoldingRangeRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onSelectionRanges:e=>s.onRequest(t.SelectionRangeRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onExecuteCommand:e=>s.onRequest(t.ExecuteCommandRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),dispose:()=>s.dispose()};for(let e of h)e.attach(b);return s.onRequest(t.InitializeRequest.type,e=>{r.initialize(e),n.string(e.trace)&&(c.trace=t.Trace.fromString(e.trace));for(let t of h)t.initialize(e.capabilities);if(v)return g(v(e,new t.CancellationTokenSource().token,(0,i.attachWorkDone)(s,e),void 0)).then(e=>{if(e instanceof t.ResponseError)return e;let r=e;r||={capabilities:{}};let i=r.capabilities;i||(i={},r.capabilities=i),i.textDocumentSync===void 0||i.textDocumentSync===null?i.textDocumentSync=n.number(b.__textDocumentSync)?b.__textDocumentSync:t.TextDocumentSyncKind.None:!n.number(i.textDocumentSync)&&!n.number(i.textDocumentSync.change)&&(i.textDocumentSync.change=n.number(b.__textDocumentSync)?b.__textDocumentSync:t.TextDocumentSyncKind.None);for(let e of h)e.fillServerCapabilities(i);return r});{let e={capabilities:{textDocumentSync:t.TextDocumentSyncKind.None}};for(let t of h)t.fillServerCapabilities(e.capabilities);return e}}),s.onRequest(t.ShutdownRequest.type,()=>{if(r.shutdownReceived=!0,_)return _(new t.CancellationTokenSource().token)}),s.onNotification(t.ExitNotification.type,()=>{try{y&&y()}finally{r.shutdownReceived?r.exit(0):r.exit(1)}}),s.onNotification(t.SetTraceNotification.type,e=>{c.trace=t.Trace.fromString(e.value)}),b}e.createConnection=le})),yn=o((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.resolveModulePath=t.FileSystem=t.resolveGlobalYarnPath=t.resolveGlobalNodePath=t.resolve=t.uriToFilePath=void 0;let n=e(`url`),r=e(`path`),i=e(`fs`),a=e(`child_process`);function o(e){let t=n.parse(e);if(t.protocol!==`file:`||!t.path)return;let i=t.path.split(`/`);for(var a=0,o=i.length;a<o;a++)i[a]=decodeURIComponent(i[a]);if(process.platform===`win32`&&i.length>1){let e=i[0],t=i[1];e.length===0&&t.length>1&&t[1]===`:`&&i.shift()}return r.normalize(i.join(`/`))}t.uriToFilePath=o;function s(){return process.platform===`win32`}function c(e,t,n,o){let s=`NODE_PATH`,c=[`var p = process;`,`p.on('message',function(m){`,`if(m.c==='e'){`,`p.exit(0);`,`}`,`else if(m.c==='rs'){`,`try{`,`var r=require.resolve(m.a);`,`p.send({c:'r',s:true,r:r});`,`}`,`catch(err){`,`p.send({c:'r',s:false});`,`}`,`}`,`});`].join(``);return new Promise((l,u)=>{let d=process.env,f=Object.create(null);Object.keys(d).forEach(e=>f[e]=d[e]),t&&i.existsSync(t)&&(f[s]?f[s]=t+r.delimiter+f[s]:f[s]=t,o&&o(`NODE_PATH value is: ${f[s]}`)),f.ELECTRON_RUN_AS_NODE=`1`;try{let t=(0,a.fork)(``,[],{cwd:n,env:f,execArgv:[`-e`,c]});if(t.pid===void 0){u(Error(`Starting process to resolve node module ${e} failed`));return}t.on(`error`,e=>{u(e)}),t.on(`message`,n=>{n.c===`r`&&(t.send({c:`e`}),n.s?l(n.r):u(Error(`Failed to resolve module: ${e}`)))});let r={c:`rs`,a:e};t.send(r)}catch(e){u(e)}})}t.resolve=c;function l(e){let t=`npm`,n=Object.create(null);Object.keys(process.env).forEach(e=>n[e]=process.env[e]),n.NO_UPDATE_NOTIFIER=`true`;let i={encoding:`utf8`,env:n};s()&&(t=`npm.cmd`,i.shell=!0);let o=()=>{};try{process.on(`SIGPIPE`,o);let n=(0,a.spawnSync)(t,[`config`,`get`,`prefix`],i).stdout;if(!n){e&&e(`'npm config get prefix' didn't return a value.`);return}let c=n.trim();return e&&e(`'npm config get prefix' value is: ${c}`),c.length>0?s()?r.join(c,`node_modules`):r.join(c,`lib`,`node_modules`):void 0}catch{return}finally{process.removeListener(`SIGPIPE`,o)}}t.resolveGlobalNodePath=l;function u(e){let t=`yarn`,n={encoding:`utf8`};s()&&(t=`yarn.cmd`,n.shell=!0);let i=()=>{};try{process.on(`SIGPIPE`,i);let o=(0,a.spawnSync)(t,[`global`,`dir`,`--json`],n),s=o.stdout;if(!s){e&&(e(`'yarn global dir' didn't return a value.`),o.stderr&&e(o.stderr));return}let c=s.trim().split(/\r?\n/);for(let e of c)try{let t=JSON.parse(e);if(t.type===`log`)return r.join(t.data,`node_modules`)}catch{}return}catch{return}finally{process.removeListener(`SIGPIPE`,i)}}t.resolveGlobalYarnPath=u;var d;(function(e){let t;function n(){return t===void 0&&(t=process.platform===`win32`?!1:!i.existsSync(__filename.toUpperCase())||!i.existsSync(__filename.toLowerCase())),t}e.isCaseSensitive=n;function a(e,t){return n()?r.normalize(t).indexOf(r.normalize(e))===0:r.normalize(t).toLowerCase().indexOf(r.normalize(e).toLowerCase())===0}e.isParent=a})(d||(t.FileSystem=d={}));function f(e,t,n,i){return n?(r.isAbsolute(n)||(n=r.join(e,n)),c(t,n,n,i).then(e=>d.isParent(n,e)?e:Promise.reject(Error(`Failed to load ${t} from node path location.`))).then(void 0,n=>c(t,l(i),e,i))):c(t,l(i),e,i)}t.resolveModulePath=f})),bn=o(((e,t)=>{t.exports=V()})),xn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineCompletionFeature=void 0;let t=V();e.InlineCompletionFeature=e=>class extends e{get inlineCompletion(){return{on:e=>this.connection.onRequest(t.InlineCompletionRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t)))}}}})),Sn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.ProposedFeatures=e.NotebookDocuments=e.TextDocuments=e.SemanticTokensBuilder=void 0;let r=on();Object.defineProperty(e,`SemanticTokensBuilder`,{enumerable:!0,get:function(){return r.SemanticTokensBuilder}});let i=xn();n(V(),e);let a=hn();Object.defineProperty(e,`TextDocuments`,{enumerable:!0,get:function(){return a.TextDocuments}});let o=gn();Object.defineProperty(e,`NotebookDocuments`,{enumerable:!0,get:function(){return o.NotebookDocuments}}),n(vn(),e);var s;(function(e){e.all={__brand:`features`,languages:i.InlineCompletionFeature}})(s||(e.ProposedFeatures=s={}))})),Cn=o((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__exportStar||function(e,t){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(t,`__esModule`,{value:!0}),t.createConnection=t.Files=void 0;let i=e(`node:util`),a=v(),o=vn(),s=yn(),c=bn();r(bn(),t),r(Sn(),t);var l;(function(e){e.uriToFilePath=s.uriToFilePath,e.resolveGlobalNodePath=s.resolveGlobalNodePath,e.resolveGlobalYarnPath=s.resolveGlobalYarnPath,e.resolve=s.resolve,e.resolveModulePath=s.resolveModulePath})(l||(t.Files=l={}));let u=!1,d;function f(){let e=`--clientProcessId`;function t(e){try{let t=parseInt(e);isNaN(t)||(d=setInterval(()=>{try{process.kill(t,0)}catch{process.exit(u?0:1)}},3e3))}catch{}}for(let n=2;n<process.argv.length;n++){let r=process.argv[n];if(r===e&&n+1<process.argv.length){t(process.argv[n+1]);return}else{let n=r.split(`=`);n[0]===e&&t(n[1])}}}f();let p={initialize:e=>{let t=e.processId;a.number(t)&&d===void 0&&setInterval(()=>{try{process.kill(t,0)}catch{process.exit(u?0:1)}},3e3)},get shutdownReceived(){return u},set shutdownReceived(e){u=e},exit:e=>{process.exit(e)}};function m(e,t,n,r){let i,a,o,s;return e!==void 0&&e.__brand===`features`&&(i=e,e=t,t=n,n=r),c.ConnectionStrategy.is(e)||c.ConnectionOptions.is(e)?s=e:(a=e,o=t,s=n),h(a,o,s,i)}t.createConnection=m;function h(e,t,n,r){let i=!1;if(!e&&!t&&process.argv.length>2){let n,r,a=process.argv.slice(2);for(let o=0;o<a.length;o++){let l=a[o];if(l===`--node-ipc`){e=new c.IPCMessageReader(process),t=new c.IPCMessageWriter(process);break}else if(l===`--stdio`){i=!0,e=process.stdin,t=process.stdout;break}else if(l===`--socket`){n=parseInt(a[o+1]);break}else if(l===`--pipe`){r=a[o+1];break}else{var s=l.split(`=`);if(s[0]===`--socket`){n=parseInt(s[1]);break}else if(s[0]===`--pipe`){r=s[1];break}}}if(n){let r=(0,c.createServerSocketTransport)(n);e=r[0],t=r[1]}else if(r){let n=(0,c.createServerPipeTransport)(r);e=n[0],t=n[1]}}var l=`Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'`;if(!e)throw Error(`Connection input stream is not set. `+l);if(!t)throw Error(`Connection output stream is not set. `+l);if(a.func(e.read)&&a.func(e.on)){let t=e;t.on(`end`,()=>{process.exit(u?0:1)}),t.on(`close`,()=>{process.exit(u?0:1)})}return(0,o.createConnection)(r=>{let a=(0,c.createProtocolConnection)(e,t,r,n);return i&&g(r),a},p,r)}function g(e){function t(e){return e.map(e=>typeof e==`string`?e:(0,i.inspect)(e)).join(` `)}let n=new Map;console.assert=function(n,...r){if(!n)if(r.length===0)e.error(`Assertion failed`);else{let[n,...i]=r;e.error(`Assertion failed: ${n} ${t(i)}`)}},console.count=function(t=`default`){let r=String(t),i=n.get(r)??0;i+=1,n.set(r,i),e.log(`${r}: ${r}`)},console.countReset=function(e){e===void 0?n.clear():n.delete(String(e))},console.debug=function(...n){e.log(t(n))},console.dir=function(t,n){e.log((0,i.inspect)(t,n))},console.log=function(...n){e.log(t(n))},console.error=function(...n){e.error(t(n))},console.trace=function(...n){let r=Error().stack.replace(/(.+\n){2}/,``),i=`Trace`;n.length!==0&&(i+=`: ${t(n)}`),e.log(`${i}\n${r}`)},console.warn=function(...n){e.warn(t(n))}}}));function H(e){return typeof e==`object`&&!!e&&typeof e.$type==`string`}function wn(e){return typeof e==`object`&&!!e&&typeof e.$refText==`string`}function Tn(e){return typeof e==`object`&&!!e&&typeof e.name==`string`&&typeof e.type==`string`&&typeof e.path==`string`}function En(e){return typeof e==`object`&&!!e&&H(e.container)&&wn(e.reference)&&typeof e.message==`string`}var Dn=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return H(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let n=this.subtypes[e];n||=this.subtypes[e]={};let r=n[t];if(r!==void 0)return r;{let r=this.computeIsSubtype(e,t);return n[t]=r,r}}getAllSubTypes(e){let t=this.allSubtypes[e];if(t)return t;{let t=this.getAllTypes(),n=[];for(let r of t)this.isSubtype(r,e)&&n.push(r);return this.allSubtypes[e]=n,n}}};function On(e){return typeof e==`object`&&!!e&&Array.isArray(e.content)}function kn(e){return typeof e==`object`&&!!e&&typeof e.tokenType==`object`}function An(e){return On(e)&&typeof e.fullText==`string`}const jn=`AbstractRule`,Mn=`AbstractType`,Nn=`Condition`,Pn=`TypeDefinition`,Fn=`ValueLiteral`,In=`AbstractElement`;function Ln(e){return W.isInstance(e,In)}const Rn=`ArrayLiteral`,zn=`ArrayType`;function Bn(e){return W.isInstance(e,zn)}const Vn=`BooleanLiteral`;function Hn(e){return W.isInstance(e,Vn)}const Un=`Conjunction`;function Wn(e){return W.isInstance(e,Un)}const Gn=`Disjunction`;function Kn(e){return W.isInstance(e,Gn)}const qn=`Grammar`,Jn=`GrammarImport`,Yn=`InferredType`;function Xn(e){return W.isInstance(e,Yn)}const Zn=`Interface`;function Qn(e){return W.isInstance(e,Zn)}const $n=`NamedArgument`,er=`Negation`;function tr(e){return W.isInstance(e,er)}const nr=`NumberLiteral`,rr=`Parameter`,ir=`ParameterReference`;function ar(e){return W.isInstance(e,ir)}const or=`ParserRule`;function U(e){return W.isInstance(e,or)}const sr=`ReferenceType`;function cr(e){return W.isInstance(e,sr)}const lr=`ReturnType`;function ur(e){return W.isInstance(e,lr)}const dr=`SimpleType`;function fr(e){return W.isInstance(e,dr)}const pr=`StringLiteral`,mr=`TerminalRule`;function hr(e){return W.isInstance(e,mr)}const gr=`Type`;function _r(e){return W.isInstance(e,gr)}const vr=`TypeAttribute`,yr=`UnionType`;function br(e){return W.isInstance(e,yr)}const xr=`Action`;function Sr(e){return W.isInstance(e,xr)}const Cr=`Alternatives`;function wr(e){return W.isInstance(e,Cr)}const Tr=`Assignment`;function Er(e){return W.isInstance(e,Tr)}const Dr=`CharacterRange`;function Or(e){return W.isInstance(e,Dr)}const kr=`CrossReference`;function Ar(e){return W.isInstance(e,kr)}const jr=`EndOfFile`;function Mr(e){return W.isInstance(e,jr)}const Nr=`Group`;function Pr(e){return W.isInstance(e,Nr)}const Fr=`Keyword`;function Ir(e){return W.isInstance(e,Fr)}const Lr=`NegatedToken`;function Rr(e){return W.isInstance(e,Lr)}const zr=`RegexToken`;function Br(e){return W.isInstance(e,zr)}const Vr=`RuleCall`;function Hr(e){return W.isInstance(e,Vr)}const Ur=`TerminalAlternatives`;function Wr(e){return W.isInstance(e,Ur)}const Gr=`TerminalGroup`;function Kr(e){return W.isInstance(e,Gr)}const qr=`TerminalRuleCall`;function Jr(e){return W.isInstance(e,qr)}const Yr=`UnorderedGroup`;function Xr(e){return W.isInstance(e,Yr)}const Zr=`UntilToken`;function Qr(e){return W.isInstance(e,Zr)}const $r=`Wildcard`;function ei(e){return W.isInstance(e,$r)}var ti=class extends Dn{getAllTypes(){return[In,jn,Mn,xr,Cr,Rn,zn,Tr,Vn,Dr,Nn,Un,kr,Gn,jr,qn,Jn,Nr,Yn,Zn,Fr,$n,Lr,er,nr,rr,ir,or,sr,zr,lr,Vr,dr,pr,Ur,Gr,mr,qr,gr,vr,Pn,yr,Yr,Zr,Fn,$r]}computeIsSubtype(e,t){switch(e){case xr:case Cr:case Tr:case Dr:case kr:case jr:case Nr:case Fr:case Lr:case zr:case Vr:case Ur:case Gr:case qr:case Yr:case Zr:case $r:return this.isSubtype(In,t);case Rn:case nr:case pr:return this.isSubtype(Fn,t);case zn:case sr:case dr:case yr:return this.isSubtype(Pn,t);case Vn:return this.isSubtype(Nn,t)||this.isSubtype(Fn,t);case Un:case Gn:case er:case ir:return this.isSubtype(Nn,t);case Yn:case Zn:case gr:return this.isSubtype(Mn,t);case or:return this.isSubtype(jn,t)||this.isSubtype(Mn,t);case mr:return this.isSubtype(jn,t);default:return!1}}getReferenceType(e){let t=`${e.container.$type}:${e.property}`;switch(t){case`Action:type`:case`CrossReference:type`:case`Interface:superTypes`:case`ParserRule:returnType`:case`SimpleType:typeRef`:return Mn;case`Grammar:hiddenTokens`:case`ParserRule:hiddenTokens`:case`RuleCall:rule`:return jn;case`Grammar:usedGrammars`:return qn;case`NamedArgument:parameter`:case`ParameterReference:parameter`:return rr;case`TerminalRuleCall:rule`:return mr;default:throw Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case In:return{name:In,properties:[{name:`cardinality`},{name:`lookahead`}]};case Rn:return{name:Rn,properties:[{name:`elements`,defaultValue:[]}]};case zn:return{name:zn,properties:[{name:`elementType`}]};case Vn:return{name:Vn,properties:[{name:`true`,defaultValue:!1}]};case Un:return{name:Un,properties:[{name:`left`},{name:`right`}]};case Gn:return{name:Gn,properties:[{name:`left`},{name:`right`}]};case qn:return{name:qn,properties:[{name:`definesHiddenTokens`,defaultValue:!1},{name:`hiddenTokens`,defaultValue:[]},{name:`imports`,defaultValue:[]},{name:`interfaces`,defaultValue:[]},{name:`isDeclared`,defaultValue:!1},{name:`name`},{name:`rules`,defaultValue:[]},{name:`types`,defaultValue:[]},{name:`usedGrammars`,defaultValue:[]}]};case Jn:return{name:Jn,properties:[{name:`path`}]};case Yn:return{name:Yn,properties:[{name:`name`}]};case Zn:return{name:Zn,properties:[{name:`attributes`,defaultValue:[]},{name:`name`},{name:`superTypes`,defaultValue:[]}]};case $n:return{name:$n,properties:[{name:`calledByName`,defaultValue:!1},{name:`parameter`},{name:`value`}]};case er:return{name:er,properties:[{name:`value`}]};case nr:return{name:nr,properties:[{name:`value`}]};case rr:return{name:rr,properties:[{name:`name`}]};case ir:return{name:ir,properties:[{name:`parameter`}]};case or:return{name:or,properties:[{name:`dataType`},{name:`definesHiddenTokens`,defaultValue:!1},{name:`definition`},{name:`entry`,defaultValue:!1},{name:`fragment`,defaultValue:!1},{name:`hiddenTokens`,defaultValue:[]},{name:`inferredType`},{name:`name`},{name:`parameters`,defaultValue:[]},{name:`returnType`},{name:`wildcard`,defaultValue:!1}]};case sr:return{name:sr,properties:[{name:`referenceType`}]};case lr:return{name:lr,properties:[{name:`name`}]};case dr:return{name:dr,properties:[{name:`primitiveType`},{name:`stringType`},{name:`typeRef`}]};case pr:return{name:pr,properties:[{name:`value`}]};case mr:return{name:mr,properties:[{name:`definition`},{name:`fragment`,defaultValue:!1},{name:`hidden`,defaultValue:!1},{name:`name`},{name:`type`}]};case gr:return{name:gr,properties:[{name:`name`},{name:`type`}]};case vr:return{name:vr,properties:[{name:`defaultValue`},{name:`isOptional`,defaultValue:!1},{name:`name`},{name:`type`}]};case yr:return{name:yr,properties:[{name:`types`,defaultValue:[]}]};case xr:return{name:xr,properties:[{name:`cardinality`},{name:`feature`},{name:`inferredType`},{name:`lookahead`},{name:`operator`},{name:`type`}]};case Cr:return{name:Cr,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case Tr:return{name:Tr,properties:[{name:`cardinality`},{name:`feature`},{name:`lookahead`},{name:`operator`},{name:`terminal`}]};case Dr:return{name:Dr,properties:[{name:`cardinality`},{name:`left`},{name:`lookahead`},{name:`right`}]};case kr:return{name:kr,properties:[{name:`cardinality`},{name:`deprecatedSyntax`,defaultValue:!1},{name:`lookahead`},{name:`terminal`},{name:`type`}]};case jr:return{name:jr,properties:[{name:`cardinality`},{name:`lookahead`}]};case Nr:return{name:Nr,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`guardCondition`},{name:`lookahead`}]};case Fr:return{name:Fr,properties:[{name:`cardinality`},{name:`lookahead`},{name:`value`}]};case Lr:return{name:Lr,properties:[{name:`cardinality`},{name:`lookahead`},{name:`terminal`}]};case zr:return{name:zr,properties:[{name:`cardinality`},{name:`lookahead`},{name:`regex`}]};case Vr:return{name:Vr,properties:[{name:`arguments`,defaultValue:[]},{name:`cardinality`},{name:`lookahead`},{name:`rule`}]};case Ur:return{name:Ur,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case Gr:return{name:Gr,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case qr:return{name:qr,properties:[{name:`cardinality`},{name:`lookahead`},{name:`rule`}]};case Yr:return{name:Yr,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case Zr:return{name:Zr,properties:[{name:`cardinality`},{name:`lookahead`},{name:`terminal`}]};case $r:return{name:$r,properties:[{name:`cardinality`},{name:`lookahead`}]};default:return{name:e,properties:[]}}}};const W=new ti;var ni=class e{constructor(e,t){this.startFn=e,this.nextFn=t}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let e=this.iterator(),t=0,n=e.next();for(;!n.done;)t++,n=e.next();return t}toArray(){let e=[],t=this.iterator(),n;do n=t.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,t){let n=this.map(n=>[e?e(n):n,t?t(n):n]);return new Map(n)}toString(){return this.join()}concat(t){return new e(()=>({first:this.startFn(),firstDone:!1,iterator:t[Symbol.iterator]()}),e=>{let t;if(!e.firstDone){do if(t=this.nextFn(e.first),!t.done)return t;while(!t.done);e.firstDone=!0}do if(t=e.iterator.next(),!t.done)return t;while(!t.done);return G})}join(e=`,`){let t=this.iterator(),n=``,r,i=!1;do r=t.next(),r.done||(i&&(n+=e),n+=ri(r.value)),i=!0;while(!r.done);return n}indexOf(e,t=0){let n=this.iterator(),r=0,i=n.next();for(;!i.done;){if(r>=t&&i.value===e)return r;i=n.next(),r++}return-1}every(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(!e(n.value))return!1;n=t.next()}return!0}some(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return!0;n=t.next()}return!1}forEach(e){let t=this.iterator(),n=0,r=t.next();for(;!r.done;)e(r.value,n),r=t.next(),n++}map(t){return new e(this.startFn,e=>{let{done:n,value:r}=this.nextFn(e);return n?G:{done:!1,value:t(r)}})}filter(t){return new e(this.startFn,e=>{let n;do if(n=this.nextFn(e),!n.done&&t(n.value))return n;while(!n.done);return G})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,t){let n=this.iterator(),r=t,i=n.next();for(;!i.done;)r=r===void 0?i.value:e(r,i.value),i=n.next();return r}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,n){let r=e.next();if(r.done)return n;let i=this.recursiveReduce(e,t,n);return i===void 0?r.value:t(i,r.value)}find(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return n.value;n=t.next()}}findIndex(e){let t=this.iterator(),n=0,r=t.next();for(;!r.done;){if(e(r.value))return n;r=t.next(),n++}return-1}includes(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(n.value===e)return!0;n=t.next()}return!1}flatMap(t){return new e(()=>({this:this.startFn()}),e=>{do{if(e.iterator){let t=e.iterator.next();if(t.done)e.iterator=void 0;else return t}let{done:n,value:r}=this.nextFn(e.this);if(!n){let n=t(r);if(ii(n))e.iterator=n[Symbol.iterator]();else return{done:!1,value:n}}}while(e.iterator);return G})}flat(t){if(t===void 0&&(t=1),t<=0)return this;let n=t>1?this.flat(t-1):this;return new e(()=>({this:n.startFn()}),e=>{do{if(e.iterator){let t=e.iterator.next();if(t.done)e.iterator=void 0;else return t}let{done:t,value:r}=n.nextFn(e.this);if(!t)if(ii(r))e.iterator=r[Symbol.iterator]();else return{done:!1,value:r}}while(e.iterator);return G})}head(){let e=this.iterator().next();if(!e.done)return e.value}tail(t=1){return new e(()=>{let e=this.startFn();for(let n=0;n<t;n++)if(this.nextFn(e).done)return e;return e},this.nextFn)}limit(t){return new e(()=>({size:0,state:this.startFn()}),e=>(e.size++,e.size>t?G:this.nextFn(e.state)))}distinct(t){return new e(()=>({set:new Set,internalState:this.startFn()}),e=>{let n;do if(n=this.nextFn(e.internalState),!n.done){let r=t?t(n.value):n.value;if(!e.set.has(r))return e.set.add(r),n}while(!n.done);return G})}exclude(e,t){let n=new Set;for(let r of e){let e=t?t(r):r;n.add(e)}return this.filter(e=>{let r=t?t(e):e;return!n.has(r)})}};function ri(e){return typeof e==`string`?e:e===void 0?`undefined`:typeof e.toString==`function`?e.toString():Object.prototype.toString.call(e)}function ii(e){return!!e&&typeof e[Symbol.iterator]==`function`}const ai=new ni(()=>void 0,()=>G),G=Object.freeze({done:!0,value:void 0});function K(...e){if(e.length===1){let t=e[0];if(t instanceof ni)return t;if(ii(t))return new ni(()=>t[Symbol.iterator](),e=>e.next());if(typeof t.length==`number`)return new ni(()=>({index:0}),e=>e.index<t.length?{done:!1,value:t[e.index++]}:G)}return e.length>1?new ni(()=>({collIndex:0,arrIndex:0}),t=>{do{if(t.iterator){let e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}if(t.array){if(t.arrIndex<t.array.length)return{done:!1,value:t.array[t.arrIndex++]};t.array=void 0,t.arrIndex=0}if(t.collIndex<e.length){let n=e[t.collIndex++];ii(n)?t.iterator=n[Symbol.iterator]():n&&typeof n.length==`number`&&(t.array=n)}}while(t.iterator||t.array||t.collIndex<e.length);return G}):ai}var oi=class extends ni{constructor(e,t,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),e=>{for(e.pruned&&=(e.iterators.pop(),!1);e.iterators.length>0;){let n=e.iterators[e.iterators.length-1].next();if(n.done)e.iterators.pop();else return e.iterators.push(t(n.value)[Symbol.iterator]()),n}return G})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}},si;(function(e){function t(e){return e.reduce((e,t)=>e+t,0)}e.sum=t;function n(e){return e.reduce((e,t)=>e*t,0)}e.product=n;function r(e){return e.reduce((e,t)=>Math.min(e,t))}e.min=r;function i(e){return e.reduce((e,t)=>Math.max(e,t))}e.max=i})(si||={});function ci(e){return new oi(e,e=>On(e)?e.content:[],{includeRoot:!0})}function li(e){return ci(e).filter(kn)}function ui(e,t){for(;e.container;)if(e=e.container,e===t)return!0;return!1}function di(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function fi(e){if(!e)return;let{offset:t,end:n,range:r}=e;return{range:r,offset:t,end:n,length:n-t}}var pi;(function(e){e[e.Before=0]=`Before`,e[e.After=1]=`After`,e[e.OverlapFront=2]=`OverlapFront`,e[e.OverlapBack=3]=`OverlapBack`,e[e.Inside=4]=`Inside`,e[e.Outside=5]=`Outside`})(pi||={});function mi(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<=t.start.character)return pi.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return pi.After;let n=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,r=e.end.line<t.end.line||e.end.line===t.end.line&&e.end.character<=t.end.character;return n&&r?pi.Inside:n?pi.OverlapBack:r?pi.OverlapFront:pi.Outside}function hi(e,t){return mi(e,t)>pi.After}const gi=/^[\w\p{L}]$/u;function _i(e,t,n=gi){if(e){if(t>0){let r=t-e.offset,i=e.text.charAt(r);n.test(i)||t--}return bi(e,t)}}function vi(e,t){if(e){let n=Ci(e,!0);if(n&&yi(n,t))return n;if(An(e)){let n=e.content.findIndex(e=>!e.hidden);for(let r=n-1;r>=0;r--){let n=e.content[r];if(yi(n,t))return n}}}}function yi(e,t){return kn(e)&&t.includes(e.tokenType.name)}function bi(e,t){if(kn(e))return e;if(On(e)){let n=Si(e,t,!1);if(n)return bi(n,t)}}function xi(e,t){if(kn(e))return e;if(On(e)){let n=Si(e,t,!0);if(n)return xi(n,t)}}function Si(e,t,n){let r=0,i=e.content.length-1,a;for(;r<=i;){let o=Math.floor((r+i)/2),s=e.content[o];if(s.offset<=t&&s.end>t)return s;s.end<=t?(a=n?s:void 0,r=o+1):i=o-1}return a}function Ci(e,t=!0){for(;e.container;){let n=e.container,r=n.content.indexOf(e);for(;r>0;){r--;let e=n.content[r];if(t||!e.hidden)return e}e=n}}function wi(e,t=!0){for(;e.container;){let n=e.container,r=n.content.indexOf(e),i=n.content.length-1;for(;r<i;){r++;let e=n.content[r];if(t||!e.hidden)return e}e=n}}function Ti(e,t){let n=Ei(e,t);return n?n.parent.content.slice(n.a+1,n.b):[]}function Ei(e,t){let n=Di(e),r=Di(t),i;for(let e=0;e<n.length&&e<r.length;e++){let t=n[e],a=r[e];if(t.parent===a.parent)i={parent:t.parent,a:t.index,b:a.index};else break}return i}function Di(e){let t=[];for(;e.container;){let n=e.container,r=n.content.indexOf(e);t.push({parent:n,index:r}),e=n}return t.reverse()}var Oi=i({assignMandatoryProperties:()=>zi,copyAstNode:()=>Vi,findLocalReferences:()=>Ri,findRootNode:()=>Mi,getContainerOfType:()=>Ai,getDocument:()=>q,hasContainerOfType:()=>ji,linkContentToContainer:()=>ki,streamAllContents:()=>Pi,streamAst:()=>Fi,streamContents:()=>Ni,streamReferences:()=>Li});function ki(e){for(let[t,n]of Object.entries(e))t.startsWith(`$`)||(Array.isArray(n)?n.forEach((n,r)=>{H(n)&&(n.$container=e,n.$containerProperty=t,n.$containerIndex=r)}):H(n)&&(n.$container=e,n.$containerProperty=t))}function Ai(e,t){let n=e;for(;n;){if(t(n))return n;n=n.$container}}function ji(e,t){let n=e;for(;n;){if(t(n))return!0;n=n.$container}return!1}function q(e){let t=Mi(e).$document;if(!t)throw Error(`AST node has no document.`);return t}function Mi(e){for(;e.$container;)e=e.$container;return e}function Ni(e,t){if(!e)throw Error(`Node must be an AstNode.`);let n=t?.range;return new ni(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),t=>{for(;t.keyIndex<t.keys.length;){let r=t.keys[t.keyIndex];if(!r.startsWith(`$`)){let i=e[r];if(H(i)){if(t.keyIndex++,Ii(i,n))return{done:!1,value:i}}else if(Array.isArray(i)){for(;t.arrayIndex<i.length;){let e=i[t.arrayIndex++];if(H(e)&&Ii(e,n))return{done:!1,value:e}}t.arrayIndex=0}}t.keyIndex++}return G})}function Pi(e,t){if(!e)throw Error(`Root node must be an AstNode.`);return new oi(e,e=>Ni(e,t))}function Fi(e,t){if(!e)throw Error(`Root node must be an AstNode.`);return t?.range&&!Ii(e,t.range)?new oi(e,()=>[]):new oi(e,e=>Ni(e,t),{includeRoot:!0})}function Ii(e,t){if(!t)return!0;let n=e.$cstNode?.range;return n?hi(n,t):!1}function Li(e){return new ni(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),t=>{for(;t.keyIndex<t.keys.length;){let n=t.keys[t.keyIndex];if(!n.startsWith(`$`)){let r=e[n];if(wn(r))return t.keyIndex++,{done:!1,value:{reference:r,container:e,property:n}};if(Array.isArray(r)){for(;t.arrayIndex<r.length;){let i=t.arrayIndex++,a=r[i];if(wn(a))return{done:!1,value:{reference:a,container:e,property:n,index:i}}}t.arrayIndex=0}}t.keyIndex++}return G})}function Ri(e,t=q(e).parseResult.value){let n=[];return Fi(t).forEach(t=>{Li(t).forEach(t=>{t.reference.ref===e&&n.push(t.reference)})}),K(n)}function zi(e,t){let n=e.getTypeMetaData(t.$type),r=t;for(let e of n.properties)e.defaultValue!==void 0&&r[e.name]===void 0&&(r[e.name]=Bi(e.defaultValue))}function Bi(e){return Array.isArray(e)?[...e.map(Bi)]:e}function Vi(e,t){let n={$type:e.$type};for(let[r,i]of Object.entries(e))if(!r.startsWith(`$`))if(H(i))n[r]=Vi(i,t);else if(wn(i))n[r]=t(n,r,i.$refNode,i.$refText);else if(Array.isArray(i)){let e=[];for(let a of i)H(a)?e.push(Vi(a,t)):wn(a)?e.push(t(n,r,a.$refNode,a.$refText)):e.push(a);n[r]=e}else n[r]=i;return ki(n),n}var Hi=class extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};function Ui(e){throw Error(`Error! The input value was not handled.`)}const Wi=/\r?\n/gm,Gi=new s,Ki=new class extends c{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join(``)}reset(e){this.multiline=!1,this.regex=e,this.startRegexp=``,this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let t=String.fromCharCode(e.value);if(!this.multiline&&t===`
|
|
17
|
+
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let e=Xi(t);this.endRegexpStack.push(e),this.isStarting&&(this.startRegexp+=e)}}visitSet(e){if(!this.multiline){let t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=!!`
|
|
18
|
+
`.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){e.type===`Group`&&e.quantifier||super.visitChildren(e)}};function qi(e){try{return typeof e==`string`&&(e=new RegExp(e)),e=e.toString(),Ki.reset(e),Ki.visit(Gi.pattern(e)),Ki.multiline}catch{return!1}}const Ji=`\f
|
|
19
|
+
\r \v \xA0 \u2028\u2029 `.split(``);function Yi(e){let t=typeof e==`string`?new RegExp(e):e;return Ji.some(e=>t.test(e))}function Xi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Zi(e,t){let n=Qi(e),r=t.match(n);return!!r&&r[0].length>0}function Qi(e){typeof e==`string`&&(e=new RegExp(e));let t=e,n=e.source,r=0;function i(){let e=``,a;function o(t){e+=n.substr(r,t),r+=t}function s(t){e+=`(?:`+n.substr(r,t)+`|$)`,r+=t}for(;r<n.length;)switch(n[r]){case`\\`:switch(n[r+1]){case`c`:s(3);break;case`x`:s(4);break;case`u`:t.unicode?n[r+2]===`{`?s(n.indexOf(`}`,r)-r+1):s(6):s(2);break;case`p`:case`P`:t.unicode?s(n.indexOf(`}`,r)-r+1):s(2);break;case`k`:s(n.indexOf(`>`,r)-r+1);break;default:s(2);break}break;case`[`:a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(n)||[],s(a[0].length);break;case`|`:case`^`:case`$`:case`*`:case`+`:case`?`:o(1);break;case`{`:a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(n),a?o(a[0].length):s(1);break;case`(`:if(n[r+1]===`?`)switch(n[r+2]){case`:`:e+=`(?:`,r+=3,e+=i()+`|$)`;break;case`=`:e+=`(?=`,r+=3,e+=i()+`)`;break;case`!`:a=r,r+=3,i(),e+=n.substr(a,r-a);break;case`<`:switch(n[r+3]){case`=`:case`!`:a=r,r+=4,i(),e+=n.substr(a,r-a);break;default:o(n.indexOf(`>`,r)-r+1),e+=i()+`|$)`;break}break}else o(1),e+=i()+`|$)`;break;case`)`:return++r,e;default:s(1);break}return e}return new RegExp(i(),e.flags)}var $i=i({findAssignment:()=>pa,findNameAssignment:()=>ma,findNodeForKeyword:()=>da,findNodeForProperty:()=>ca,findNodesForKeyword:()=>ua,findNodesForKeywordInternal:()=>fa,findNodesForProperty:()=>sa,getActionAtElement:()=>ga,getActionType:()=>Ea,getAllReachableRules:()=>na,getAllRulesUsedForCrossReferences:()=>ia,getCrossReferenceTerminal:()=>aa,getEntryRule:()=>ea,getExplicitRuleType:()=>wa,getHiddenRules:()=>ta,getRuleType:()=>Oa,getRuleTypeName:()=>Da,getTypeName:()=>Ta,isArrayCardinality:()=>va,isArrayOperator:()=>ya,isCommentTerminal:()=>oa,isDataType:()=>Sa,isDataTypeRule:()=>ba,isOptionalCardinality:()=>_a,terminalRegex:()=>ka});function ea(e){return e.rules.find(e=>U(e)&&e.entry)}function ta(e){return e.rules.filter(e=>hr(e)&&e.hidden)}function na(e,t){let n=new Set,r=ea(e);if(!r)return new Set(e.rules);let i=[r].concat(ta(e));for(let e of i)ra(e,n,t);let a=new Set;for(let t of e.rules)(n.has(t.name)||hr(t)&&t.hidden)&&a.add(t);return a}function ra(e,t,n){t.add(e.name),Pi(e).forEach(e=>{if(Hr(e)||n&&Jr(e)){let r=e.rule.ref;r&&!t.has(r.name)&&ra(r,t,n)}})}function ia(e){let t=new Set;return Pi(e).forEach(e=>{Ar(e)&&(U(e.type.ref)&&t.add(e.type.ref),Xn(e.type.ref)&&U(e.type.ref.$container)&&t.add(e.type.ref.$container))}),t}function aa(e){if(e.terminal)return e.terminal;if(e.type.ref)return ma(e.type.ref)?.terminal}function oa(e){return e.hidden&&!Yi(ka(e))}function sa(e,t){return!e||!t?[]:la(e,t,e.astNode,!0)}function ca(e,t,n){if(!e||!t)return;let r=la(e,t,e.astNode,!0);if(r.length!==0)return n=n===void 0?0:Math.max(0,Math.min(n,r.length-1)),r[n]}function la(e,t,n,r){if(!r){let n=Ai(e.grammarSource,Er);if(n&&n.feature===t)return[e]}return On(e)&&e.astNode===n?e.content.flatMap(e=>la(e,t,n,!1)):[]}function ua(e,t){return e?fa(e,t,e?.astNode):[]}function da(e,t,n){if(!e)return;let r=fa(e,t,e?.astNode);if(r.length!==0)return n=n===void 0?0:Math.max(0,Math.min(n,r.length-1)),r[n]}function fa(e,t,n){if(e.astNode!==n)return[];if(Ir(e.grammarSource)&&e.grammarSource.value===t)return[e];let r=ci(e).iterator(),i,a=[];do if(i=r.next(),!i.done){let e=i.value;e.astNode===n?Ir(e.grammarSource)&&e.grammarSource.value===t&&a.push(e):r.prune()}while(!i.done);return a}function pa(e){let t=e.astNode;for(;t===e.container?.astNode;){let t=Ai(e.grammarSource,Er);if(t)return t;e=e.container}}function ma(e){let t=e;return Xn(t)&&(Sr(t.$container)?t=t.$container.$container:U(t.$container)?t=t.$container:Ui(t.$container)),ha(e,t,new Map)}function ha(e,t,n){function r(t,r){let i;return Ai(t,Er)||(i=ha(r,r,n)),n.set(e,i),i}if(n.has(e))return n.get(e);n.set(e,void 0);for(let i of Pi(t))if(Er(i)&&i.feature.toLowerCase()===`name`)return n.set(e,i),i;else if(Hr(i)&&U(i.rule.ref))return r(i,i.rule.ref);else if(fr(i)&&i.typeRef?.ref)return r(i,i.typeRef.ref)}function ga(e){let t=e.$container;if(Pr(t)){let n=t.elements,r=n.indexOf(e);for(let e=r-1;e>=0;e--){let t=n[e];if(Sr(t))return t;{let t=Pi(n[e]).find(Sr);if(t)return t}}}if(Ln(t))return ga(t)}function _a(e,t){return e===`?`||e===`*`||Pr(t)&&!!t.guardCondition}function va(e){return e===`*`||e===`+`}function ya(e){return e===`+=`}function ba(e){return xa(e,new Set)}function xa(e,t){if(t.has(e))return!0;t.add(e);for(let n of Pi(e))if(Hr(n)){if(!n.rule.ref||U(n.rule.ref)&&!xa(n.rule.ref,t))return!1}else if(Er(n))return!1;else if(Sr(n))return!1;return!!e.definition}function Sa(e){return Ca(e.type,new Set)}function Ca(e,t){if(t.has(e))return!0;if(t.add(e),Bn(e)||cr(e))return!1;if(br(e))return e.types.every(e=>Ca(e,t));if(fr(e)){if(e.primitiveType!==void 0||e.stringType!==void 0)return!0;if(e.typeRef!==void 0){let n=e.typeRef.ref;return _r(n)?Ca(n.type,t):!1}else return!1}else return!1}function wa(e){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){let t=e.returnType.ref;if(t&&(U(t)||Qn(t)||_r(t)))return t.name}}function Ta(e){if(U(e))return ba(e)?e.name:wa(e)??e.name;if(Qn(e)||_r(e)||ur(e))return e.name;if(Sr(e)){let t=Ea(e);if(t)return t}else if(Xn(e))return e.name;throw Error(`Cannot get name of Unknown Type`)}function Ea(e){if(e.inferredType)return e.inferredType.name;if(e.type?.ref)return Ta(e.type.ref)}function Da(e){return hr(e)?e.type?.name??`string`:ba(e)?e.name:wa(e)??e.name}function Oa(e){return hr(e)?e.type?.name??`string`:wa(e)??e.name}function ka(e){let t={s:!1,i:!1,u:!1},n=ja(e.definition,t),r=Object.entries(t).filter(([,e])=>e).map(([e])=>e).join(``);return new RegExp(n,r)}const Aa=`[\\s\\S]`;function ja(e,t){if(Wr(e))return Ma(e);if(Kr(e))return Na(e);if(Or(e))return Ia(e);if(Jr(e)){let t=e.rule.ref;if(!t)throw Error(`Missing rule reference.`);return Ra(ja(t.definition),{cardinality:e.cardinality,lookahead:e.lookahead})}else if(Rr(e))return Fa(e);else if(Qr(e))return Pa(e);else if(Br(e)){let n=e.regex.lastIndexOf(`/`),r=e.regex.substring(1,n),i=e.regex.substring(n+1);return t&&(t.i=i.includes(`i`),t.s=i.includes(`s`),t.u=i.includes(`u`)),Ra(r,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}else if(ei(e))return Ra(Aa,{cardinality:e.cardinality,lookahead:e.lookahead});else throw Error(`Invalid terminal element: ${e?.$type}`)}function Ma(e){return Ra(e.elements.map(e=>ja(e)).join(`|`),{cardinality:e.cardinality,lookahead:e.lookahead})}function Na(e){return Ra(e.elements.map(e=>ja(e)).join(``),{cardinality:e.cardinality,lookahead:e.lookahead})}function Pa(e){return Ra(`${Aa}*?${ja(e.terminal)}`,{cardinality:e.cardinality,lookahead:e.lookahead})}function Fa(e){return Ra(`(?!${ja(e.terminal)})${Aa}*?`,{cardinality:e.cardinality,lookahead:e.lookahead})}function Ia(e){return e.right?Ra(`[${La(e.left)}-${La(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1}):Ra(La(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}function La(e){return Xi(e.value)}function Ra(e,t){return(t.wrap!==!1||t.lookahead)&&(e=`(${t.lookahead??``}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function za(e,t){let n={stacks:e,tokens:t};return Ga(n),n.stacks.flat().forEach(e=>{e.property=void 0}),Ka(n.stacks).map(e=>e[e.length-1])}function Ba(e){let{next:t,cardinalities:n,visited:r,plus:i}=e,a=[],o=t.feature;if(r.has(o))return[];Pr(o)||r.add(o);let s,c=o;for(;c.$container;)if(Pr(c.$container)){s=c.$container;break}else if(Ln(c.$container))c=c.$container;else break;if(va(c.cardinality)){let e=Ha({next:{feature:c,type:t.type},cardinalities:n,visited:r,plus:i});for(let t of e)i.add(t.feature);a.push(...e)}if(s){let e=s.elements.indexOf(c);e!==void 0&&e<s.elements.length-1&&a.push(...Wa({feature:s,type:t.type},e+1,n,r,i)),a.every(e=>_a(e.feature.cardinality,e.feature)||_a(n.get(e.feature))||i.has(e.feature))&&a.push(...Ba({next:{feature:s,type:t.type},cardinalities:n,visited:r,plus:i}))}return a}function Va(e){return H(e)&&(e={feature:e}),Ha({next:e,cardinalities:new Map,visited:new Set,plus:new Set})}function Ha(e){let{next:t,cardinalities:n,visited:r,plus:i}=e;if(t===void 0)return[];let{feature:a,type:o}=t;if(Pr(a))return r.has(a)?[]:(r.add(a),Wa(t,0,n,r,i).map(e=>Ua(e,a.cardinality,n)));if(wr(a)||Xr(a))return a.elements.flatMap(e=>Ha({next:{feature:e,type:o,property:t.property},cardinalities:n,visited:r,plus:i})).map(e=>Ua(e,a.cardinality,n));if(Er(a))return Ha({next:{feature:a.terminal,type:o,property:t.property??a.feature},cardinalities:n,visited:r,plus:i}).map(e=>Ua(e,a.cardinality,n));if(Sr(a))return Ba({next:{feature:a,type:Ta(a),property:t.property??a.feature},cardinalities:n,visited:r,plus:i});if(Hr(a)&&U(a.rule.ref)){let e=a.rule.ref;return Ha({next:{feature:e.definition,type:e.fragment||e.dataType?void 0:wa(e)??e.name,property:t.property},cardinalities:n,visited:r,plus:i}).map(e=>Ua(e,a.cardinality,n))}else return[t]}function Ua(e,t,n){return n.set(e.feature,t),e}function Wa(e,t,n,r,i){let a=[],o;for(;t<e.feature.elements.length&&(o={feature:e.feature.elements[t++],type:e.type},a.push(...Ha({next:o,cardinalities:n,visited:r,plus:i})),_a(o.feature.cardinality??n.get(o.feature),o.feature)););return a}function Ga(e){for(let t of e.tokens)e.stacks=Ka(e.stacks,t)}function Ka(e,t){let n=[];for(let r of e)n.push(...qa(r,t));return n}function qa(e,t){let n=new Map,r=new Set(e.map(e=>e.feature).filter(Ja)),i=[];for(;e.length>0;){let a=Ba({next:e.pop(),cardinalities:n,plus:r,visited:new Set}).filter(e=>t?Ya(e.feature,t):!0);for(let t of a)i.push([...e,t]);if(!a.every(e=>_a(e.feature.cardinality,e.feature)||_a(n.get(e.feature))))break}return i}function Ja(e){if(e.cardinality===`+`)return!0;let t=Ai(e,Er);return!!(t&&t.cardinality===`+`)}function Ya(e,t){if(Ir(e))return e.value===t.image;if(Hr(e))return Xa(e.rule.ref,t);if(Ar(e)){let n=aa(e);if(n)return Ya(n,t)}return!1}function Xa(e,t){return U(e)?Va(e.definition).some(e=>Ya(e.feature,t)):hr(e)?ka(e).test(t.image):!1}var J=Cn();function Za(e){let t=Array.from(new Set(e.flatMap(e=>e?.triggerCharacters??[]))),n=Array.from(new Set(e.flatMap(e=>e?.allCommitCharacters??[])));return{triggerCharacters:t.length>0?t:void 0,allCommitCharacters:n.length>0?n:void 0}}var Qa=class{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.lexer=e.parser.Lexer,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.fuzzyMatcher=e.shared.lsp.FuzzyMatcher,this.grammarConfig=e.parser.GrammarConfig,this.astReflection=e.shared.AstReflection,this.documentationProvider=e.documentation.DocumentationProvider}async getCompletion(e,t,n){let r=[],i=this.buildContexts(e,t.position),a=(e,t)=>{let n=this.fillCompletionItem(e,t);n&&r.push(n)},o=e=>Ir(e.feature)?e.feature.value:e.feature,s=[];for(let e of i)if(await Promise.all(K(e.features).distinct(o).exclude(s).map(t=>this.completionFor(e,t,a))),s.push(...e.features),!this.continueCompletion(r))break;return J.CompletionList.create(this.deduplicateItems(r),!0)}deduplicateItems(e){return K(e).distinct(e=>`${e.kind}_${e.label}_${e.detail}`).toArray()}findFeaturesAt(e,t){let n=e.getText({start:J.Position.create(0,0),end:e.positionAt(t)}),r=this.completionParser.parse(n),i=r.tokens;if(r.tokenIndex===0){let e=ea(this.grammar),t=Va({feature:e.definition,type:wa(e)});return i.length>0?(i.shift(),za(t.map(e=>[e]),i)):t}let a=[...i].splice(r.tokenIndex);return za([r.elementStack.map(e=>({feature:e}))],a)}*buildContexts(e,t){let n=e.parseResult.value.$cstNode;if(!n)return;let r=e.textDocument,i=r.getText(),a=r.offsetAt(t),o={document:e,textDocument:r,offset:a,position:t},s=this.findDataTypeRuleStart(n,a);if(s){let[e,t]=s,i=xi(n,e)?.astNode;yield Object.assign(Object.assign({},o),{node:i,tokenOffset:e,tokenEndOffset:t,features:this.findFeaturesAt(r,e)})}let{nextTokenStart:c,nextTokenEnd:l,previousTokenStart:u,previousTokenEnd:d}=this.backtrackToAnyToken(i,a),f=c;a<=c&&u!==void 0&&(f=u);let p=xi(n,f)?.astNode,m=!0;if(u!==void 0&&d!==void 0&&d===a&&(yield Object.assign(Object.assign({},o),{node:p,tokenOffset:u,tokenEndOffset:d,features:this.findFeaturesAt(r,u)}),m=this.performNextTokenCompletion(e,i.substring(u,d),u,d),m&&(yield Object.assign(Object.assign({},o),{node:p,tokenOffset:d,tokenEndOffset:d,features:this.findFeaturesAt(r,d)}))),p)m&&(yield Object.assign(Object.assign({},o),{node:p,tokenOffset:c,tokenEndOffset:l,features:this.findFeaturesAt(r,c)}));else{let e=ea(this.grammar);if(!e)throw Error(`Missing entry parser rule`);yield Object.assign(Object.assign({},o),{tokenOffset:c,tokenEndOffset:l,features:Va(e.definition)})}}performNextTokenCompletion(e,t,n,r){return/\P{L}$/u.test(t)}findDataTypeRuleStart(e,t){let n=_i(e,t,this.grammarConfig.nameRegexp),r=!!Ai(n?.grammarSource,U)?.dataType;if(r){for(;r;)n=n?.container,r=!!Ai(n?.grammarSource,U)?.dataType;if(n)return[n.offset,n.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,t){let n=this.lexer.tokenize(e).tokens;if(n.length===0)return{nextTokenStart:t,nextTokenEnd:t};let r;for(let e of n){if(e.startOffset>=t)return{nextTokenStart:t,nextTokenEnd:t,previousTokenStart:r?r.startOffset:void 0,previousTokenEnd:r?r.endOffset+1:void 0};if(e.endOffset>=t)return{nextTokenStart:e.startOffset,nextTokenEnd:e.endOffset+1,previousTokenStart:r?r.startOffset:void 0,previousTokenEnd:r?r.endOffset+1:void 0};r=e}return{nextTokenStart:t,nextTokenEnd:t,previousTokenStart:r?r.startOffset:void 0,previousTokenEnd:r?r.endOffset+1:void 0}}completionFor(e,t,n){if(Ir(t.feature))return this.completionForKeyword(e,t.feature,n);if(Ar(t.feature)&&e.node)return this.completionForCrossReference(e,t,n)}completionForCrossReference(e,t,n){let r=Ai(t.feature,Er),i=e.node;if(r&&i){t.type&&(i={$type:t.type,$container:i,$containerProperty:t.property},zi(this.astReflection,i));let a={reference:{$refText:``},container:i,property:r.feature};try{for(let t of this.getReferenceCandidates(a,e))n(e,this.createReferenceCompletionItem(t))}catch(e){console.error(e)}}}getReferenceCandidates(e,t){return this.scopeProvider.getScope(e).getAllElements()}createReferenceCompletionItem(e){return{nodeDescription:e,kind:this.nodeKindProvider.getCompletionItemKind(e),documentation:this.getReferenceDocumentation(e),detail:e.type,sortText:`0`}}getReferenceDocumentation(e){if(!e.node)return;let t=this.documentationProvider.getDocumentation(e.node);if(t)return{kind:`markdown`,value:t}}completionForKeyword(e,t,n){this.filterKeyword(e,t)&&n(e,{label:t.value,kind:this.getKeywordCompletionItemKind(t),detail:`Keyword`,sortText:`1`})}getKeywordCompletionItemKind(e){return J.CompletionItemKind.Keyword}filterKeyword(e,t){return/\p{L}/u.test(t.value)}fillCompletionItem(e,t){let n;if(typeof t.label==`string`)n=t.label;else if(`node`in t){let e=this.nameProvider.getName(t.node);if(!e)return;n=e}else if(`nodeDescription`in t)n=t.nodeDescription.name;else return;let r;r=typeof t.textEdit?.newText==`string`?t.textEdit.newText:typeof t.insertText==`string`?t.insertText:n;let i=t.textEdit??this.buildCompletionTextEdit(e,n,r);if(i)return{additionalTextEdits:t.additionalTextEdits,command:t.command,commitCharacters:t.commitCharacters,data:t.data,detail:t.detail,documentation:t.documentation,filterText:t.filterText,insertText:t.insertText,insertTextFormat:t.insertTextFormat,insertTextMode:t.insertTextMode,kind:t.kind,labelDetails:t.labelDetails,preselect:t.preselect,sortText:t.sortText,tags:t.tags,textEditText:t.textEditText,textEdit:i,label:n}}buildCompletionTextEdit(e,t,n){let r=e.textDocument.getText().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(r,t))return{newText:n,range:{start:e.textDocument.positionAt(e.tokenOffset),end:e.position}}}},$a;(()=>{var e={975:e=>{function t(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}function n(e,t){for(var n,r=``,i=0,a=-1,o=0,s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(n===47)break;n=47}if(n===47){if(!(a===s-1||o===1))if(a!==s-1&&o===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var c=r.lastIndexOf(`/`);if(c!==r.length-1){c===-1?(r=``,i=0):i=(r=r.slice(0,c)).length-1-r.lastIndexOf(`/`),a=s,o=0;continue}}else if(r.length===2||r.length===1){r=``,i=0,a=s,o=0;continue}}t&&(r.length>0?r+=`/..`:r=`..`,i=2)}else r.length>0?r+=`/`+e.slice(a+1,s):r=e.slice(a+1,s),i=s-a-1;a=s,o=0}else n===46&&o!==-1?++o:o=-1}return r}var r={resolve:function(){for(var e,r=``,i=!1,a=arguments.length-1;a>=-1&&!i;a--){var o;a>=0?o=arguments[a]:(e===void 0&&(e=process.cwd()),o=e),t(o),o.length!==0&&(r=o+`/`+r,i=o.charCodeAt(0)===47)}return r=n(r,!i),i?r.length>0?`/`+r:`/`:r.length>0?r:`.`},normalize:function(e){if(t(e),e.length===0)return`.`;var r=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return(e=n(e,!r)).length!==0||r||(e=`.`),e.length>0&&i&&(e+=`/`),r?`/`+e:e},isAbsolute:function(e){return t(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return`.`;for(var e,n=0;n<arguments.length;++n){var i=arguments[n];t(i),i.length>0&&(e===void 0?e=i:e+=`/`+i)}return e===void 0?`.`:r.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n||(e=r.resolve(e))===(n=r.resolve(n)))return``;for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var a=e.length,o=a-i,s=1;s<n.length&&n.charCodeAt(s)===47;++s);for(var c=n.length-s,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(n.charCodeAt(s+d)===47)return n.slice(s+d+1);if(d===0)return n.slice(s+d)}else o>l&&(e.charCodeAt(i+d)===47?u=d:d===0&&(u=0));break}var f=e.charCodeAt(i+d);if(f!==n.charCodeAt(s+d))break;f===47&&(u=d)}var p=``;for(d=i+u+1;d<=a;++d)d!==a&&e.charCodeAt(d)!==47||(p.length===0?p+=`..`:p+=`/..`);return p.length>0?p+n.slice(s+u):(s+=u,n.charCodeAt(s)===47&&++s,n.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(t(e),e.length===0)return`.`;for(var n=e.charCodeAt(0),r=n===47,i=-1,a=!0,o=e.length-1;o>=1;--o)if((n=e.charCodeAt(o))===47){if(!a){i=o;break}}else a=!1;return i===-1?r?`/`:`.`:r&&i===1?`//`:e.slice(0,i)},basename:function(e,n){if(n!==void 0&&typeof n!=`string`)throw TypeError(`"ext" argument must be a string`);t(e);var r,i=0,a=-1,o=!0;if(n!==void 0&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return``;var s=n.length-1,c=-1;for(r=e.length-1;r>=0;--r){var l=e.charCodeAt(r);if(l===47){if(!o){i=r+1;break}}else c===-1&&(o=!1,c=r+1),s>=0&&(l===n.charCodeAt(s)?--s==-1&&(a=r):(s=-1,a=c))}return i===a?a=c:a===-1&&(a=e.length),e.slice(i,a)}for(r=e.length-1;r>=0;--r)if(e.charCodeAt(r)===47){if(!o){i=r+1;break}}else a===-1&&(o=!1,a=r+1);return a===-1?``:e.slice(i,a)},extname:function(e){t(e);for(var n=-1,r=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(c!==47)i===-1&&(a=!1,i=s+1),c===46?n===-1?n=s:o!==1&&(o=1):n!==-1&&(o=-1);else if(!a){r=s+1;break}}return n===-1||i===-1||o===0||o===1&&n===i-1&&n===r+1?``:e.slice(n,i)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+`/`+r:r}(0,e)},parse:function(e){t(e);var n={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return n;var r,i=e.charCodeAt(0),a=i===47;a?(n.root=`/`,r=1):r=0;for(var o=-1,s=0,c=-1,l=!0,u=e.length-1,d=0;u>=r;--u)if((i=e.charCodeAt(u))!==47)c===-1&&(l=!1,c=u+1),i===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1);else if(!l){s=u+1;break}return o===-1||c===-1||d===0||d===1&&o===c-1&&o===s+1?c!==-1&&(n.base=n.name=s===0&&a?e.slice(1,c):e.slice(s,c)):(s===0&&a?(n.name=e.slice(1,o),n.base=e.slice(1,c)):(n.name=e.slice(s,o),n.base=e.slice(s,c)),n.ext=e.slice(o,c)),s>0?n.dir=e.slice(0,s-1):a&&(n.dir=`/`),n},sep:`/`,delimiter:`:`,win32:null,posix:null};r.posix=r,e.exports=r}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,`__esModule`,{value:!0})};var r={};let i;n.r(r),n.d(r,{URI:()=>u,Utils:()=>C}),typeof process==`object`?i=process.platform===`win32`:typeof navigator==`object`&&(i=navigator.userAgent.indexOf(`Windows`)>=0);let a=/^\w[\w\d+.-]*$/,o=/^\//,s=/^\/\//;function c(e,t){if(!e.scheme&&t)throw Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!a.test(e.scheme))throw Error(`[UriError]: Scheme contains illegal characters.`);if(e.path){if(e.authority){if(!o.test(e.path))throw Error(`[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character`)}else if(s.test(e.path))throw Error(`[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")`)}}let l=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class u{static isUri(e){return e instanceof u||!!e&&typeof e.authority==`string`&&typeof e.fragment==`string`&&typeof e.path==`string`&&typeof e.query==`string`&&typeof e.scheme==`string`&&typeof e.fsPath==`string`&&typeof e.with==`function`&&typeof e.toString==`function`}scheme;authority;path;query;fragment;constructor(e,t,n,r,i,a=!1){typeof e==`object`?(this.scheme=e.scheme||``,this.authority=e.authority||``,this.path=e.path||``,this.query=e.query||``,this.fragment=e.fragment||``):(this.scheme=function(e,t){return e||t?e:`file`}(e,a),this.authority=t||``,this.path=function(e,t){switch(e){case`https`:case`http`:case`file`:t?t[0]!==`/`&&(t=`/`+t):t=`/`}return t}(this.scheme,n||``),this.query=r||``,this.fragment=i||``,c(this,a))}get fsPath(){return g(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:n,path:r,query:i,fragment:a}=e;return t===void 0?t=this.scheme:t===null&&(t=``),n===void 0?n=this.authority:n===null&&(n=``),r===void 0?r=this.path:r===null&&(r=``),i===void 0?i=this.query:i===null&&(i=``),a===void 0?a=this.fragment:a===null&&(a=``),t===this.scheme&&n===this.authority&&r===this.path&&i===this.query&&a===this.fragment?this:new f(t,n,r,i,a)}static parse(e,t=!1){let n=l.exec(e);return n?new f(n[2]||``,b(n[4]||``),b(n[5]||``),b(n[7]||``),b(n[9]||``),t):new f(``,``,``,``,``)}static file(e){let t=``;if(i&&(e=e.replace(/\\/g,`/`)),e[0]===`/`&&e[1]===`/`){let n=e.indexOf(`/`,2);n===-1?(t=e.substring(2),e=`/`):(t=e.substring(2,n),e=e.substring(n)||`/`)}return new f(`file`,t,e,``,``)}static from(e){let t=new f(e.scheme,e.authority,e.path,e.query,e.fragment);return c(t,!0),t}toString(e=!1){return _(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof u)return e;{let t=new f(e);return t._formatted=e.external,t._fsPath=e._sep===d?e.fsPath:null,t}}return e}}let d=i?1:void 0;class f extends u{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||=g(this,!1),this._fsPath}toString(e=!1){return e?_(this,!0):(this._formatted||=_(this,!1),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=d),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}}let p={58:`%3A`,47:`%2F`,63:`%3F`,35:`%23`,91:`%5B`,93:`%5D`,64:`%40`,33:`%21`,36:`%24`,38:`%26`,39:`%27`,40:`%28`,41:`%29`,42:`%2A`,43:`%2B`,44:`%2C`,59:`%3B`,61:`%3D`,32:`%20`};function m(e,t,n){let r,i=-1;for(let a=0;a<e.length;a++){let o=e.charCodeAt(a);if(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o===45||o===46||o===95||o===126||t&&o===47||n&&o===91||n&&o===93||n&&o===58)i!==-1&&(r+=encodeURIComponent(e.substring(i,a)),i=-1),r!==void 0&&(r+=e.charAt(a));else{r===void 0&&(r=e.substr(0,a));let t=p[o];t===void 0?i===-1&&(i=a):(i!==-1&&(r+=encodeURIComponent(e.substring(i,a)),i=-1),r+=t)}}return i!==-1&&(r+=encodeURIComponent(e.substring(i))),r===void 0?e:r}function h(e){let t;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r===35||r===63?(t===void 0&&(t=e.substr(0,n)),t+=p[r]):t!==void 0&&(t+=e[n])}return t===void 0?e:t}function g(e,t){let n;return n=e.authority&&e.path.length>1&&e.scheme===`file`?`//${e.authority}${e.path}`:e.path.charCodeAt(0)===47&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&e.path.charCodeAt(2)===58?t?e.path.substr(1):e.path[1].toLowerCase()+e.path.substr(2):e.path,i&&(n=n.replace(/\//g,`\\`)),n}function _(e,t){let n=t?h:m,r=``,{scheme:i,authority:a,path:o,query:s,fragment:c}=e;if(i&&(r+=i,r+=`:`),(a||i===`file`)&&(r+=`/`,r+=`/`),a){let e=a.indexOf(`@`);if(e!==-1){let t=a.substr(0,e);a=a.substr(e+1),e=t.lastIndexOf(`:`),e===-1?r+=n(t,!1,!1):(r+=n(t.substr(0,e),!1,!1),r+=`:`,r+=n(t.substr(e+1),!1,!0)),r+=`@`}a=a.toLowerCase(),e=a.lastIndexOf(`:`),e===-1?r+=n(a,!1,!0):(r+=n(a.substr(0,e),!1,!0),r+=a.substr(e))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){let e=o.charCodeAt(1);e>=65&&e<=90&&(o=`/${String.fromCharCode(e+32)}:${o.substr(3)}`)}else if(o.length>=2&&o.charCodeAt(1)===58){let e=o.charCodeAt(0);e>=65&&e<=90&&(o=`${String.fromCharCode(e+32)}:${o.substr(2)}`)}r+=n(o,!0,!1)}return s&&(r+=`?`,r+=n(s,!1,!1)),c&&(r+=`#`,r+=t?c:m(c,!1,!1)),r}function v(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+v(e.substr(3)):e}}let y=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function b(e){return e.match(y)?e.replace(y,(e=>v(e))):e}var x=n(975);let S=x.posix||x;var C;(function(e){e.joinPath=function(e,...t){return e.with({path:S.join(e.path,...t)})},e.resolvePath=function(e,...t){let n=e.path,r=!1;n[0]!==`/`&&(n=`/`+n,r=!0);let i=S.resolve(n,...t);return r&&i[0]===`/`&&!e.authority&&(i=i.substring(1)),e.with({path:i})},e.dirname=function(e){if(e.path.length===0||e.path===`/`)return e;let t=S.dirname(e.path);return t.length===1&&t.charCodeAt(0)===46&&(t=``),e.with({path:t})},e.basename=function(e){return S.basename(e.path)},e.extname=function(e){return S.extname(e.path)}})(C||={}),$a=r})();const{URI:Y,Utils:eo}=$a;var X;(function(e){e.basename=eo.basename,e.dirname=eo.dirname,e.extname=eo.extname,e.joinPath=eo.joinPath,e.resolvePath=eo.resolvePath;let t=typeof process==`object`&&(process==null?void 0:process.platform)===`win32`;function n(e,t){return e?.toString()===t?.toString()}e.equals=n;function r(e,n){let r=typeof e==`string`?Y.parse(e).path:e.path,i=typeof n==`string`?Y.parse(n).path:n.path,a=r.split(`/`).filter(e=>e.length>0),o=i.split(`/`).filter(e=>e.length>0);if(t){let e=/^[A-Z]:$/;if(a[0]&&e.test(a[0])&&(a[0]=a[0].toLowerCase()),o[0]&&e.test(o[0])&&(o[0]=o[0].toLowerCase()),a[0]!==o[0])return i.substring(1)}let s=0;for(;s<a.length&&a[s]===o[s];s++);return`../`.repeat(a.length-s)+o.slice(s).join(`/`)}e.relative=r;function i(e){return Y.parse(e.toString()).toString()}e.normalize=i})(X||={});var to=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,t,n){let r=e.parseResult.value;if(r.$cstNode){let n=r.$cstNode,i=_i(n,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(i)return this.collectLocationLinks(i,t)}}collectLocationLinks(e,t){let n=this.findLink(e);if(n)return[J.LocationLink.create(n.targetDocument.textDocument.uri,(n.target.astNode.$cstNode??n.target).range,n.target.range,n.source.range)]}findLink(e){let t=this.references.findDeclarationNode(e);if(t?.astNode){let n=q(t.astNode);if(t&&n)return{source:e,target:t,targetDocument:n}}}};function no(e){let t=[],n=e.Grammar;for(let e of n.rules)hr(e)&&oa(e)&&qi(ka(e))&&t.push(e.name);return{multilineCommentRules:t,nameRegexp:gi}}Ot();var ro=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new co(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new oo;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let n=new ao(e.startOffset,e.image.length,di(e),e.tokenType,!t);return n.grammarSource=t,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){let t=e.container;if(t){let n=t.content.indexOf(e);n>=0&&t.content.splice(n,1)}}addHiddenNodes(e){let t=[];for(let n of e){let e=new ao(n.startOffset,n.image.length,di(n),n.tokenType,!0);e.root=this.rootNode,t.push(e)}let n=this.current,r=!1;if(n.content.length>0){n.content.push(...t);return}for(;n.container;){let e=n.container.content.indexOf(n);if(e>0){n.container.content.splice(e,0,...t),r=!0;break}n=n.container}r||this.rootNode.content.unshift(...t)}construct(e){let t=this.current;typeof e.$type==`string`&&(this.current.astNode=e),e.$cstNode=t;let n=this.nodeStack.pop();n?.content.length===0&&this.removeNode(n)}},io=class{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){let e=typeof this._astNode?.$type==`string`?this._astNode:this.container?.astNode;if(!e)throw Error(`This node has no associated AST element`);return e}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}},ao=class extends io{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,t,n,r,i=!1){super(),this._hidden=i,this._offset=e,this._tokenType=r,this._length=t,this._range=n}},oo=class extends io{constructor(){super(...arguments),this.content=new so(this)}get children(){return this.content}get offset(){return this.firstNonHiddenNode?.offset??0}get length(){return this.end-this.offset}get end(){return this.lastNonHiddenNode?.end??0}get range(){let e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(this._rangeCache===void 0){let{range:n}=e,{range:r}=t;this._rangeCache={start:n.start,end:r.end.line<n.start.line?n.start:r.end}}return this._rangeCache}else return{start:F.create(0,0),end:F.create(0,0)}}get firstNonHiddenNode(){for(let e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){let t=this.content[e];if(!t.hidden)return t}return this.content[this.content.length-1]}},so=class e extends Array{constructor(t){super(),this.parent=t,Object.setPrototypeOf(this,e.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...n){return this.addParents(n),super.splice(e,t,...n)}addParents(e){for(let t of e)t.container=this.parent}},co=class extends oo{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text=``,this._text=e??``}};const lo=Symbol(`Datatype`);function uo(e){return e.$type===lo}const fo=e=>e.endsWith(``)?e:e+``;var po=class{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;let t=this.lexer.definition,n=e.LanguageMetaData.mode===`production`;this.wrapper=new yo(t,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:n,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},mo=class extends po{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new ro,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){let n=this.computeRuleType(e),r=this.wrapper.DEFINE_RULE(fo(e.name),this.startImplementation(n,t).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}computeRuleType(e){if(!e.fragment)return ba(e)?lo:wa(e)??e.name}parse(e,t={}){this.nodeBuilder.buildRootNode(e);let n=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=n.tokens;let r=t.rule?this.allRules.get(t.rule):this.mainRule;if(!r)throw Error(t.rule?`No rule found with name '${t.rule}'`:`No main rule available.`);let i=this.doParse(r);return this.nodeBuilder.addHiddenNodes(n.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:i,lexerErrors:n.errors,lexerReport:n.report,parserErrors:this.wrapper.errors}}doParse(e){let t=e.call(this.wrapper,{});if(this.stack.length>0&&(t=this.construct()),t===void 0)throw Error(`No result from parser`);if(this.stack.length>0)throw Error(`Parser stack is not empty after parsing`);return t}startImplementation(e,t){return n=>{let r=!this.isRecording()&&e!==void 0;if(r){let t={$type:e};this.stack.push(t),e===lo&&(t.value=``)}return t(n),r?this.construct():void 0}}extractHiddenTokens(e){let t=this.lexerResult.hidden;if(!t.length)return[];let n=e.startOffset;for(let e=0;e<t.length;e++)if(t[e].startOffset>n)return t.splice(0,e);return t.splice(0,t.length)}consume(e,t,n){let r=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(r)){let e=this.extractHiddenTokens(r);this.nodeBuilder.addHiddenNodes(e);let t=this.nodeBuilder.buildLeafNode(r,n),{assignment:i,isCrossRef:a}=this.getAssignment(n),o=this.current;if(i){let e=Ir(n)?r.image:this.converter.convert(r.image,t);this.assign(i.operator,i.feature,e,t,a)}else if(uo(o)){let e=r.image;Ir(n)||(e=this.converter.convert(e,t).toString()),o.value+=e}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset==`number`&&!isNaN(e.endOffset)}subrule(e,t,n,r,i){let a;!this.isRecording()&&!n&&(a=this.nodeBuilder.buildCompositeNode(r));let o;try{o=this.wrapper.wrapSubrule(e,t,i)}finally{this.isRecording()||(o===void 0&&!n&&(o=this.construct()),o!==void 0&&a&&a.length>0&&this.performSubruleAssignment(o,r,a))}}performSubruleAssignment(e,t,n){let{assignment:r,isCrossRef:i}=this.getAssignment(t);if(r)this.assign(r.operator,r.feature,e,n,i);else if(!r){let t=this.current;if(uo(t))t.value+=e.toString();else if(typeof e==`object`&&e){let n=this.assignWithoutOverride(e,t);this.stack.pop(),this.stack.push(n)}}}action(e,t){if(!this.isRecording()){let n=this.current;if(t.feature&&t.operator){n=this.construct(),this.nodeBuilder.removeNode(n.$cstNode),this.nodeBuilder.buildCompositeNode(t).content.push(n.$cstNode);let r={$type:e};this.stack.push(r),this.assign(t.operator,t.feature,n,n.$cstNode,!1)}else n.$type=e}}construct(){if(this.isRecording())return;let e=this.current;return ki(e),this.nodeBuilder.construct(e),this.stack.pop(),uo(e)?this.converter.convert(e.value,e.$cstNode):(zi(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){let t=Ai(e,Er);this.assignmentMap.set(e,{assignment:t,isCrossRef:t?Ar(t.terminal):!1})}return this.assignmentMap.get(e)}assign(e,t,n,r,i){let a=this.current,o;switch(o=i&&typeof n==`string`?this.linker.buildReference(a,t,r,n):n,e){case`=`:a[t]=o;break;case`?=`:a[t]=!0;break;case`+=`:Array.isArray(a[t])||(a[t]=[]),a[t].push(o)}}assignWithoutOverride(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];t===void 0?e[n]=r:Array.isArray(t)&&Array.isArray(r)&&(r.push(...t),e[n]=r)}let n=e.$cstNode;return n&&(n.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}},ho=class{buildMismatchTokenMessage(e){return l.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return l.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return l.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return l.buildEarlyExitMessage(e)}},go=class extends ho{buildMismatchTokenMessage({expected:e,actual:t}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(`:KW`)?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},_o=class extends po{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){return this.resetState(),this.tokens=this.lexer.tokenize(e,{mode:`partial`}).tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,t){let n=this.wrapper.DEFINE_RULE(fo(e.name),this.startImplementation(t).bind(this));return this.allRules.set(e.name,n),e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{let n=this.keepStackSize();try{e(t)}finally{this.resetStackSize(n)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,t,n){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,n,r,i){this.before(r),this.wrapper.wrapSubrule(e,t,i),this.after(r)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}};const vo={recoveryEnabled:!0,nodeLocationTracking:`full`,skipValidations:!0,errorMessageProvider:new go};var yo=class extends d{constructor(e,t){let n=t&&`maxLookahead`in t;super(e,Object.assign(Object.assign(Object.assign({},vo),{lookaheadStrategy:n?new p({maxLookahead:t.maxLookahead}):new g({logging:t.skipValidations?()=>{}:void 0})}),t))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t,n){return this.RULE(e,t,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t,void 0)}wrapSubrule(e,t,n){return this.subrule(e,t,{ARGS:[n]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}};function bo(e,t,n){return xo({parser:t,tokens:n,ruleNames:new Map},e),t}function xo(e,t){let n=na(t,!1),r=K(t.rules).filter(U).filter(e=>n.has(e));for(let t of r){let n=Object.assign(Object.assign({},e),{consume:1,optional:1,subrule:1,many:1,or:1});e.parser.rule(t,So(n,t.definition))}}function So(e,t,n=!1){let r;if(Ir(t))r=Mo(e,t);else if(Sr(t))r=Co(e,t);else if(Er(t))r=So(e,t.terminal);else if(Ar(t))r=jo(e,t);else if(Hr(t))r=wo(e,t);else if(wr(t))r=Do(e,t);else if(Xr(t))r=Oo(e,t);else if(Pr(t))r=ko(e,t);else if(Mr(t)){let n=e.consume++;r=()=>e.parser.consume(n,f,t)}else throw new Hi(t.$cstNode,`Unexpected element type: ${t.$type}`);return No(e,n?void 0:Ao(t),r,t.cardinality)}function Co(e,t){let n=Ta(t);return()=>e.parser.action(n,t)}function wo(e,t){let n=t.rule.ref;if(U(n)){let r=e.subrule++,i=n.fragment,a=t.arguments.length>0?To(n,t.arguments):()=>({});return o=>e.parser.subrule(r,Po(e,n),i,t,a(o))}else if(hr(n)){let r=e.consume++,i=Io(e,n.name);return()=>e.parser.consume(r,i,t)}else if(n)Ui(n);else throw new Hi(t.$cstNode,`Undefined rule: ${t.rule.$refText}`)}function To(e,t){let n=t.map(e=>Eo(e.value));return t=>{let r={};for(let i=0;i<n.length;i++){let a=e.parameters[i],o=n[i];r[a.name]=o(t)}return r}}function Eo(e){if(Kn(e)){let t=Eo(e.left),n=Eo(e.right);return e=>t(e)||n(e)}else if(Wn(e)){let t=Eo(e.left),n=Eo(e.right);return e=>t(e)&&n(e)}else if(tr(e)){let t=Eo(e.value);return e=>!t(e)}else if(ar(e)){let t=e.parameter.ref.name;return e=>e!==void 0&&e[t]===!0}else if(Hn(e)){let t=!!e.true;return()=>t}Ui(e)}function Do(e,t){if(t.elements.length===1)return So(e,t.elements[0]);{let n=[];for(let r of t.elements){let t={ALT:So(e,r,!0)},i=Ao(r);i&&(t.GATE=Eo(i)),n.push(t)}let r=e.or++;return t=>e.parser.alternatives(r,n.map(e=>{let n={ALT:()=>e.ALT(t)},r=e.GATE;return r&&(n.GATE=()=>r(t)),n}))}}function Oo(e,t){if(t.elements.length===1)return So(e,t.elements[0]);let n=[];for(let r of t.elements){let t={ALT:So(e,r,!0)},i=Ao(r);i&&(t.GATE=Eo(i)),n.push(t)}let r=e.or++,i=(e,t)=>`uGroup_${e}_${t.getRuleStack().join(`-`)}`,a=No(e,Ao(t),t=>e.parser.alternatives(r,n.map((n,a)=>{let o={ALT:()=>!0},s=e.parser;o.ALT=()=>{if(n.ALT(t),!s.isRecording()){let e=i(r,s);s.unorderedGroups.get(e)||s.unorderedGroups.set(e,[]);let t=s.unorderedGroups.get(e);t?.[a]===void 0&&(t[a]=!0)}};let c=n.GATE;return c?o.GATE=()=>c(t):o.GATE=()=>!s.unorderedGroups.get(i(r,s))?.[a],o})),`*`);return t=>{a(t),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(r,e.parser))}}function ko(e,t){let n=t.elements.map(t=>So(e,t));return e=>n.forEach(t=>t(e))}function Ao(e){if(Pr(e))return e.guardCondition}function jo(e,t,n=t.terminal){if(!n){if(!t.type.ref)throw Error(`Could not resolve reference to type: `+t.type.$refText);let n=ma(t.type.ref)?.terminal;if(!n)throw Error(`Could not find name assignment for type: `+Ta(t.type.ref));return jo(e,t,n)}else if(Hr(n)&&U(n.rule.ref)){let r=n.rule.ref,i=e.subrule++;return n=>e.parser.subrule(i,Po(e,r),!1,t,n)}else if(Hr(n)&&hr(n.rule.ref)){let r=e.consume++,i=Io(e,n.rule.ref.name);return()=>e.parser.consume(r,i,t)}else if(Ir(n)){let r=e.consume++,i=Io(e,n.value);return()=>e.parser.consume(r,i,t)}else throw Error(`Could not build cross reference parser`)}function Mo(e,t){let n=e.consume++,r=e.tokens[t.value];if(!r)throw Error(`Could not find token for keyword: `+t.value);return()=>e.parser.consume(n,r,t)}function No(e,t,n,r){let i=t&&Eo(t);if(!r)if(i){let t=e.or++;return r=>e.parser.alternatives(t,[{ALT:()=>n(r),GATE:()=>i(r)},{ALT:m(),GATE:()=>!i(r)}])}else return n;if(r===`*`){let t=e.many++;return r=>e.parser.many(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}else if(r===`+`){let t=e.many++;if(i){let r=e.or++;return a=>e.parser.alternatives(r,[{ALT:()=>e.parser.atLeastOne(t,{DEF:()=>n(a)}),GATE:()=>i(a)},{ALT:m(),GATE:()=>!i(a)}])}else return r=>e.parser.atLeastOne(t,{DEF:()=>n(r)})}else if(r===`?`){let t=e.optional++;return r=>e.parser.optional(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}else Ui(r)}function Po(e,t){let n=Fo(e,t),r=e.parser.getRule(n);if(!r)throw Error(`Rule "${n}" not found."`);return r}function Fo(e,t){if(U(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let n=t,r=n.$container,i=t.$type;for(;!U(r);)(Pr(r)||wr(r)||Xr(r))&&(i=r.elements.indexOf(n).toString()+`:`+i),n=r,r=r.$container;return i=r.name+`:`+i,e.ruleNames.set(t,i),i}}function Io(e,t){let n=e.tokens[t];if(!n)throw Error(`Token "${t}" not found."`);return n}function Lo(e){let t=e.Grammar,n=e.parser.Lexer,r=new _o(e);return bo(t,r,n.definition),r.finalize(),r}function Ro(e){let t=zo(e);return t.finalize(),t}function zo(e){let t=e.Grammar,n=e.parser.Lexer;return bo(t,new mo(e),n.definition)}var Bo=class{constructor(){this.diagnostics=[]}buildTokens(e,t){let n=K(na(e,!1)),r=this.buildTerminalTokens(n),i=this.buildKeywordTokens(n,r,t);return i.push(...r),i}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(hr).filter(e=>!e.fragment).map(e=>this.buildTerminalToken(e)).toArray()}buildTerminalToken(e){let t=ka(e),n=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,r={name:e.name,PATTERN:n};return typeof n==`function`&&(r.LINE_BREAKS=!0),e.hidden&&(r.GROUP=Yi(t)?u.SKIPPED:`hidden`),r}requiresCustomPattern(e){return e.flags.includes(`u`)||e.flags.includes(`s`)?!0:!!(e.source.includes(`?<=`)||e.source.includes(`?<!`))}regexPatternFunction(e){let t=new RegExp(e,e.flags+`y`);return(e,n)=>(t.lastIndex=n,t.exec(e))}buildKeywordTokens(e,t,n){return e.filter(U).flatMap(e=>Pi(e).filter(Ir)).distinct(e=>e.value).toArray().sort((e,t)=>t.value.length-e.value.length).map(e=>this.buildKeywordToken(e,t,!!n?.caseInsensitive))}buildKeywordToken(e,t,n){let r=this.buildKeywordPattern(e,n),i={name:e.value,PATTERN:r,LONGER_ALT:this.findLongerAlt(e,t)};return typeof r==`function`&&(i.LINE_BREAKS=!0),i}buildKeywordPattern(e,t){return t?new RegExp(Xi(e.value),`i`):e.value}findLongerAlt(e,t){return t.reduce((t,n)=>{let r=n?.PATTERN;return r?.source&&Zi(`^`+r.source+`$`,e.value)&&t.push(n),t},[])}},Vo=class{convert(e,t){let n=t.grammarSource;if(Ar(n)&&(n=aa(n)),Hr(n)){let r=n.rule.ref;if(!r)throw Error(`This cst node was not parsed by a rule.`);return this.runConverter(r,e,t)}return e}runConverter(e,t,n){switch(e.name.toUpperCase()){case`INT`:return Ho.convertInt(t);case`STRING`:return Ho.convertString(t);case`ID`:return Ho.convertID(t)}switch(Oa(e)?.toLowerCase()){case`number`:return Ho.convertNumber(t);case`boolean`:return Ho.convertBoolean(t);case`bigint`:return Ho.convertBigint(t);case`date`:return Ho.convertDate(t);default:return t}}},Ho;(function(e){function t(e){let t=``;for(let r=1;r<e.length-1;r++){let i=e.charAt(r);if(i===`\\`){let i=e.charAt(++r);t+=n(i)}else t+=i}return t}e.convertString=t;function n(e){switch(e){case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
|
|
20
|
+
`;case`r`:return`\r`;case`t`:return` `;case`v`:return`\v`;case`0`:return`\0`;default:return e}}function r(e){return e.charAt(0)===`^`?e.substring(1):e}e.convertID=r;function i(e){return parseInt(e)}e.convertInt=i;function a(e){return BigInt(e)}e.convertBigint=a;function o(e){return new Date(e)}e.convertDate=o;function s(e){return Number(e)}e.convertNumber=s;function c(e){return e.toLowerCase()===`true`}e.convertBoolean=c})(Ho||={});var Z=i({});t(Z,a(ee(),1));function Uo(){return new Promise(e=>{typeof setImmediate>`u`?setTimeout(e,0):setImmediate(e)})}let Wo=0;function Go(){return Wo=performance.now(),new Z.CancellationTokenSource}const Ko=Symbol(`OperationCancelled`);function qo(e){return e===Ko}async function Q(e){if(e===Z.CancellationToken.None)return;let t=performance.now();if(t-Wo>=10&&(Wo=t,await Uo(),Wo=performance.now()),e.isCancellationRequested)throw Ko}var Jo=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>(e(t),this),this.reject=e=>(t(e),this)})}},Yo=class e{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(t,n){for(let n of t)if(e.isIncremental(n)){let e=$o(n.range),t=this.offsetAt(e.start),r=this.offsetAt(e.end);this._content=this._content.substring(0,t)+n.text+this._content.substring(r,this._content.length);let i=Math.max(e.start.line,0),a=Math.max(e.end.line,0),o=this._lineOffsets,s=Qo(n.text,!1,t);if(a-i===s.length)for(let e=0,t=s.length;e<t;e++)o[e+i+1]=s[e];else s.length<1e4?o.splice(i+1,a-i,...s):this._lineOffsets=o=o.slice(0,i+1).concat(s,o.slice(a+1));let c=n.text.length-(r-t);if(c!==0)for(let e=i+1+s.length,t=o.length;e<t;e++)o[e]=o[e]+c}else if(e.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw Error(`Unknown change event received`);this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Qo(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,r=t.length;if(r===0)return{line:0,character:e};for(;n<r;){let i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}let i=n-1;return{line:i,character:e-t[i]}}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,r),n)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength==`number`)}static isFull(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range===void 0&&t.rangeLength===void 0}},Xo;(function(e){function t(e,t,n,r){return new Yo(e,t,n,r)}e.create=t;function n(e,t,n){if(e instanceof Yo)return e.update(t,n),e;throw Error(`TextDocument.update: document must be created by TextDocument.create`)}e.update=n;function r(e,t){let n=e.getText(),r=Zo(t.map(es),(e,t)=>{let n=e.range.start.line-t.range.start.line;return n===0?e.range.start.character-t.range.start.character:n}),i=0,a=[];for(let t of r){let r=e.offsetAt(t.range.start);if(r<i)throw Error(`Overlapping edit`);r>i&&a.push(n.substring(i,r)),t.newText.length&&a.push(t.newText),i=e.offsetAt(t.range.end)}return a.push(n.substr(i)),a.join(``)}e.applyEdits=r})(Xo||={});function Zo(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),i=e.slice(n);Zo(r,t),Zo(i,t);let a=0,o=0,s=0;for(;a<r.length&&o<i.length;)t(r[a],i[o])<=0?e[s++]=r[a++]:e[s++]=i[o++];for(;a<r.length;)e[s++]=r[a++];for(;o<i.length;)e[s++]=i[o++];return e}function Qo(e,t,n=0){let r=t?[n]:[];for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);(i===13||i===10)&&(i===13&&t+1<e.length&&e.charCodeAt(t+1)===10&&t++,r.push(n+t+1))}return r}function $o(e){let t=e.start,n=e.end;return t.line>n.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function es(e){let t=$o(e.range);return t===e.range?e:{newText:e.newText,range:t}}var $;(function(e){e[e.Changed=0]=`Changed`,e[e.Parsed=1]=`Parsed`,e[e.IndexedContent=2]=`IndexedContent`,e[e.ComputedScopes=3]=`ComputedScopes`,e[e.Linked=4]=`Linked`,e[e.IndexedReferences=5]=`IndexedReferences`,e[e.Validated=6]=`Validated`})($||={});var ts=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=Z.CancellationToken.None){let n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,t)}fromTextDocument(e,t,n){return t??=Y.parse(e.uri),Z.CancellationToken.is(n)?this.createAsync(t,e,n):this.create(t,e,n)}fromString(e,t,n){return Z.CancellationToken.is(n)?this.createAsync(t,e,n):this.create(t,e,n)}fromModel(e,t){return this.create(t,{$model:e})}create(e,t,n){if(typeof t==`string`){let r=this.parse(e,t,n);return this.createLangiumDocument(r,e,void 0,t)}else if(`$model`in t){let n={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}else{let r=this.parse(e,t.getText(),n);return this.createLangiumDocument(r,e,t)}}async createAsync(e,t,n){if(typeof t==`string`){let r=await this.parseAsync(e,t,n);return this.createLangiumDocument(r,e,void 0,t)}else{let r=await this.parseAsync(e,t.getText(),n);return this.createLangiumDocument(r,e,t)}}createLangiumDocument(e,t,n,r){let i;if(n)i={parseResult:e,uri:t,state:$.Parsed,references:[],textDocument:n};else{let n=this.createTextDocumentGetter(t,r);i={parseResult:e,uri:t,state:$.Parsed,references:[],get textDocument(){return n()}}}return e.value.$document=i,i}async update(e,t){let n=e.parseResult.value.$cstNode?.root.fullText,r=this.textDocuments?.get(e.uri.toString()),i=r?r.getText():await this.fileSystemProvider.readFile(e.uri);if(r)Object.defineProperty(e,`textDocument`,{value:r});else{let t=this.createTextDocumentGetter(e.uri,i);Object.defineProperty(e,`textDocument`,{get:t})}return n!==i&&(e.parseResult=await this.parseAsync(e.uri,i,t),e.parseResult.value.$document=e),e.state=$.Parsed,e}parse(e,t,n){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(t,n)}parseAsync(e,t,n){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(t,n)}createTextDocumentGetter(e,t){let n=this.serviceRegistry,r;return()=>r??=Xo.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,t??``)}},ns=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return K(this.documentMap.values())}addDocument(e){let t=e.uri.toString();if(this.documentMap.has(t))throw Error(`A document with the URI '${t}' is already present.`);this.documentMap.set(t,e)}getDocument(e){let t=e.toString();return this.documentMap.get(t)}async getOrCreateDocument(e,t){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(n),n)}createDocument(e,t,n){if(n)return this.langiumDocumentFactory.fromString(t,e,n).then(e=>(this.addDocument(e),e));{let n=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(n),n}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let t=e.toString(),n=this.documentMap.get(t);return n&&(this.serviceRegistry.getServices(e).references.Linker.unlink(n),n.state=$.Changed,n.precomputedScopes=void 0,n.diagnostics=void 0),n}deleteDocument(e){let t=e.toString(),n=this.documentMap.get(t);return n&&(n.state=$.Changed,this.documentMap.delete(t)),n}};const rs=Symbol(`ref_resolving`);var is=class{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,t=Z.CancellationToken.None){for(let n of Fi(e.parseResult.value))await Q(t),Li(n).forEach(t=>this.doLink(t,e))}doLink(e,t){let n=e.reference;if(n._ref===void 0){n._ref=rs;try{let t=this.getCandidate(e);En(t)?n._ref=t:(n._nodeDescription=t,this.langiumDocuments().hasDocument(t.documentUri)?n._ref=this.loadAstNode(t)??this.createLinkingError(e,t):n._ref=void 0)}catch(t){console.error(`An error occurred while resolving reference to '${n.$refText}':`,t);let r=t.message??String(t);n._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${n.$refText}': ${r}`})}t.references.push(n)}}unlink(e){for(let t of e.references)delete t._ref,delete t._nodeDescription;e.references=[]}getCandidate(e){return this.scopeProvider.getScope(e).getElement(e.reference.$refText)??this.createLinkingError(e)}buildReference(e,t,n,r){let i=this,a={$refNode:n,$refText:r,get ref(){if(H(this._ref))return this._ref;if(Tn(this._nodeDescription))this._ref=i.loadAstNode(this._nodeDescription)??i.createLinkingError({reference:a,container:e,property:t},this._nodeDescription);else if(this._ref===void 0){this._ref=rs;let n=Mi(e).$document,r=i.getLinkedNode({reference:a,container:e,property:t});if(r.error&&n&&n.state<$.ComputedScopes){this._ref=void 0;return}this._ref=r.node??r.error,this._nodeDescription=r.descr,n?.references.push(this)}else if(this._ref===rs)throw Error(`Cyclic reference resolution detected: ${i.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`);return H(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return En(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){try{let t=this.getCandidate(e);if(En(t))return{error:t};let n=this.loadAstNode(t);return n?{node:n,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,t);let n=t.message??String(t);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${n}`})}}}loadAstNode(e){if(e.node)return e.node;let t=this.langiumDocuments().getDocument(e.documentUri);if(t)return this.astNodeLocator.getAstNode(t.parseResult.value,e.path)}createLinkingError(e,t){let n=Mi(e.container).$document;n&&n.state<$.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);let r=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${r} named '${e.reference.$refText}'.`,targetDescription:t})}};function as(e){return typeof e.name==`string`}var os=class{getName(e){if(as(e))return e.name}getNameNode(e){return ca(e.$cstNode,`name`)}},ss=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let t=pa(e),n=e.astNode;if(t&&n){let r=n[t.feature];if(wn(r))return r.ref;if(Array.isArray(r)){for(let t of r)if(wn(t)&&t.$refNode&&t.$refNode.offset<=e.offset&&t.$refNode.end>=e.end)return t.ref}}if(n){let t=this.nameProvider.getNameNode(n);if(t&&(t===e||ui(e,t)))return n}}}findDeclarationNode(e){let t=this.findDeclaration(e);if(t?.$cstNode)return this.nameProvider.getNameNode(t)??t.$cstNode}findReferences(e,t){let n=[];if(t.includeDeclaration){let t=this.getReferenceToSelf(e);t&&n.push(t)}let r=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(r=r.filter(e=>X.equals(e.sourceUri,t.documentUri))),n.push(...r),K(n)}getReferenceToSelf(e){let t=this.nameProvider.getNameNode(e);if(t){let n=q(e),r=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:r,targetUri:n.uri,targetPath:r,segment:fi(t),local:!0}}}},cs=class{constructor(e){if(this.map=new Map,e)for(let[t,n]of e)this.add(t,n)}get size(){return si.sum(K(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(t===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let r=n.indexOf(t);if(r>=0)return n.length===1?this.map.delete(e):n.splice(r,1),!0}return!1}}get(e){return this.map.get(e)??[]}has(e,t){if(t===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(t)>=0:!1}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach((t,n)=>t.forEach(t=>e(t,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return K(this.map.entries()).flatMap(([e,t])=>t.map(t=>[e,t]))}keys(){return K(this.map.keys())}values(){return K(this.map.values()).flat()}entriesGroupedByKey(){return K(this.map.entries())}},ls=class{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[t,n]of e)this.set(t,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,t){return this.map.set(e,t),this.inverse.set(t,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let t=this.map.get(e);return t===void 0?!1:(this.map.delete(e),this.inverse.delete(t),!0)}},us=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=Z.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=Ni,r=Z.CancellationToken.None){let i=[];this.exportNode(e,i,t);for(let a of n(e))await Q(r),this.exportNode(a,i,t);return i}exportNode(e,t,n){let r=this.nameProvider.getName(e);r&&t.push(this.descriptions.createDescription(e,r,n))}async computeLocalScopes(e,t=Z.CancellationToken.None){let n=e.parseResult.value,r=new cs;for(let i of Pi(n))await Q(t),this.processNode(i,e,r);return r}processNode(e,t,n){let r=e.$container;if(r){let i=this.nameProvider.getName(e);i&&n.add(r,this.descriptions.createDescription(e,i,t))}}},ds=class{constructor(e,t,n){this.elements=e,this.outerScope=t,this.caseInsensitive=n?.caseInsensitive??!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let t=this.caseInsensitive?this.elements.find(t=>t.name.toLowerCase()===e.toLowerCase()):this.elements.find(t=>t.name===e);if(t)return t;if(this.outerScope)return this.outerScope.getElement(e)}},fs=class{constructor(e,t,n){this.elements=new Map,this.caseInsensitive=n?.caseInsensitive??!1;for(let t of e){let e=this.caseInsensitive?t.name.toLowerCase():t.name;this.elements.set(e,t)}this.outerScope=t}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(t);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=K(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}};const ps={getElement(){},getAllElements(){return ai}};var ms=class{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw Error(`This cache has already been disposed`)}},hs=class extends ms{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,t){this.throwIfDisposed(),this.cache.set(e,t)}get(e,t){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(t){let n=t();return this.cache.set(e,n),n}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},gs=class extends ms{constructor(e){super(),this.cache=new Map,this.converter=e??(e=>e)}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,n){this.throwIfDisposed(),this.cacheForContext(e).set(t,n)}get(e,t,n){this.throwIfDisposed();let r=this.cacheForContext(e);if(r.has(t))return r.get(t);if(n){let e=n();return r.set(t,e),e}else return}delete(e,t){return this.throwIfDisposed(),this.cacheForContext(e).delete(t)}clear(e){if(this.throwIfDisposed(),e){let t=this.converter(e);this.cache.delete(t)}else this.cache.clear()}cacheForContext(e){let t=this.converter(e),n=this.cache.get(t);return n||(n=new Map,this.cache.set(t,n)),n}},_s=class extends hs{constructor(e,t){super(),t?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(t,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((e,t)=>{t.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}},vs=class{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new _s(e.shared)}getScope(e){let t=[],n=this.reflection.getReferenceType(e),r=q(e.container).precomputedScopes;if(r){let i=e.container;do{let e=r.get(i);e.length>0&&t.push(K(e).filter(e=>this.reflection.isSubtype(e.type,n))),i=i.$container}while(i)}let i=this.getGlobalScope(n,e);for(let e=t.length-1;e>=0;e--)i=this.createScope(t[e],i);return i}createScope(e,t,n){return new ds(K(e),t,n)}createScopeForNodes(e,t,n){return new ds(K(e).map(e=>{let t=this.nameProvider.getName(e);if(t)return this.descriptions.createDescription(e,t)}).nonNullable(),t,n)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new fs(this.indexManager.allElements(e)))}};function ys(e){return typeof e.$comment==`string`}function bs(e){return typeof e==`object`&&!!e&&(`$ref`in e||`$error`in e)}var xs=class{constructor(e){this.ignoreProperties=new Set([`$container`,`$containerProperty`,`$containerIndex`,`$document`,`$cstNode`]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,t){let n=t??{},r=t?.replacer,i=(e,t)=>this.replacer(e,t,n),a=r?(e,t)=>r(e,t,i):i;try{return this.currentDocument=q(e),JSON.stringify(e,a,t?.space)}finally{this.currentDocument=void 0}}deserialize(e,t){let n=t??{},r=JSON.parse(e);return this.linkNode(r,r,n),r}replacer(e,t,{refText:n,sourceText:r,textRegions:i,comments:a,uriConverter:o}){if(!this.ignoreProperties.has(e))if(wn(t)){let e=t.ref,r=n?t.$refText:void 0;if(e){let n=q(e),i=``;this.currentDocument&&this.currentDocument!==n&&(i=o?o(n.uri,t):n.uri.toString());let a=this.astNodeLocator.getAstNodePath(e);return{$ref:`${i}#${a}`,$refText:r}}else return{$error:t.error?.message??`Could not resolve reference`,$refText:r}}else if(H(t)){let n;if(i&&(n=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},t)),(!e||t.$document)&&n?.$textRegion&&(n.$textRegion.documentURI=this.currentDocument?.uri.toString())),r&&!e&&(n??=Object.assign({},t),n.$sourceText=t.$cstNode?.text),a){n??=Object.assign({},t);let e=this.commentProvider.getComment(t);e&&(n.$comment=e.replace(/\r/g,``))}return n??t}else return t}addAstNodeRegionWithAssignmentsTo(e){let t=e=>({offset:e.offset,end:e.end,length:e.length,range:e.range});if(e.$cstNode){let n=e.$textRegion=t(e.$cstNode),r=n.assignments={};return Object.keys(e).filter(e=>!e.startsWith(`$`)).forEach(n=>{let i=sa(e.$cstNode,n).map(t);i.length!==0&&(r[n]=i)}),e}}linkNode(e,t,n,r,i,a){for(let[r,i]of Object.entries(e))if(Array.isArray(i))for(let a=0;a<i.length;a++){let o=i[a];bs(o)?i[a]=this.reviveReference(e,r,t,o,n):H(o)&&this.linkNode(o,t,n,e,r,a)}else bs(i)?e[r]=this.reviveReference(e,r,t,i,n):H(i)&&this.linkNode(i,t,n,e,r);let o=e;o.$container=r,o.$containerProperty=i,o.$containerIndex=a}reviveReference(e,t,n,r,i){let a=r.$refText,o=r.$error;if(r.$ref){let e=this.getRefNode(n,r.$ref,i.uriConverter);if(H(e))return a||=this.nameProvider.getName(e),{$refText:a??``,ref:e};o=e}if(o){let n={$refText:a??``};return n.error={container:e,property:t,message:o,reference:n},n}else return}getRefNode(e,t,n){try{let r=t.indexOf(`#`);if(r===0)return this.astNodeLocator.getAstNode(e,t.substring(1))||`Could not resolve path: `+t;if(r<0){let e=n?n(t):Y.parse(t),r=this.langiumDocuments.getDocument(e);return r?r.parseResult.value:`Could not find document for URI: `+t}let i=n?n(t.substring(0,r)):Y.parse(t.substring(0,r)),a=this.langiumDocuments.getDocument(i);return a?r===t.length-1?a.parseResult.value:this.astNodeLocator.getAstNode(a.parseResult.value,t.substring(r+1))||`Could not resolve URI: `+t:`Could not find document for URI: `+t}catch(e){return String(e)}}},Ss=class{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=e?.workspace.TextDocuments}register(e){let t=e.LanguageMetaData;for(let n of t.fileExtensions)this.fileExtensionMap.has(n)&&console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${t.languageId}'.`),this.fileExtensionMap.set(n,e);if(t.fileNames)for(let n of t.fileNames)this.fileNameMap.has(n)&&console.warn(`The file name ${n} is used by multiple languages. It is now assigned to '${t.languageId}'.`),this.fileNameMap.set(n,e);this.languageIdMap.set(t.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw Error("The service registry is empty. Use `register` to register the services of a language.");let t=this.textDocuments?.get(e)?.languageId;if(t!==void 0){let e=this.languageIdMap.get(t);if(e)return e}let n=X.extname(e),r=X.basename(e),i=this.fileNameMap.get(r)??this.fileExtensionMap.get(n);if(!i)throw t?Error(`The service registry contains no services for the extension '${n}' for language '${t}'.`):Error(`The service registry contains no services for the extension '${n}'.`);return i}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}},Cs;(function(e){e.merge=(e,t)=>As(As({},e),t)})(Cs||={});function ws(e,t,n,r,i,a,o,s,c){return Ds([e,t,n,r,i,a,o,s,c].reduce(As,{}))}const Ts=Symbol(`isProxy`);function Es(e){if(e&&e[Ts])for(let t of Object.values(e))Es(t);return e}function Ds(e,t){let n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw Error(`Cannot set property on injected service container`)},get:(r,i)=>i===Ts?!0:ks(r,i,e,t||n),getOwnPropertyDescriptor:(r,i)=>(ks(r,i,e,t||n),Object.getOwnPropertyDescriptor(r,i)),has:(t,n)=>n in e,ownKeys:()=>[...Object.getOwnPropertyNames(e)]});return n}const Os=Symbol();function ks(e,t,n,r){if(t in e){if(e[t]instanceof Error)throw Error(`Construction failure. Please make sure that your dependencies are constructable.`,{cause:e[t]});if(e[t]===Os)throw Error(`Cycle detected. Please make "`+String(t)+`" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies`);return e[t]}else if(t in n){let i=n[t];e[t]=Os;try{e[t]=typeof i==`function`?i(r):Ds(i,r)}catch(n){throw e[t]=n instanceof Error?n:void 0,n}return e[t]}else return}function As(e,t){if(t){for(let[n,r]of Object.entries(t))if(r!==void 0){let t=e[n];t!==null&&r!==null&&typeof t==`object`&&typeof r==`object`?e[n]=As(t,r):e[n]=r}}return e}var js=class{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return ys(e)?e.$comment:vi(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}};Ot();function Ms(e,t,n){let r,i;typeof e==`string`?(i=t,r=n):(i=e.range.start,r=t),i||=F.create(0,0);let a=Ps(e),o=Xs(r);return Us({index:0,tokens:Ls({lines:a,position:i,options:o}),position:i})}function Ns(e,t){let n=Xs(t),r=Ps(e);if(r.length===0)return!1;let i=r[0],a=r[r.length-1],o=n.start,s=n.end;return!!o?.exec(i)&&!!s?.exec(a)}function Ps(e){let t=``;return t=typeof e==`string`?e:e.text,t.split(Wi)}const Fs=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,Is=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function Ls(e){let t=[],n=e.position.line,r=e.position.character;for(let i=0;i<e.lines.length;i++){let a=i===0,o=i===e.lines.length-1,s=e.lines[i],c=0;if(a&&e.options.start){let t=e.options.start?.exec(s);t&&(c=t.index+t[0].length)}else{let t=e.options.line?.exec(s);t&&(c=t.index+t[0].length)}if(o){let t=e.options.end?.exec(s);t&&(s=s.substring(0,t.index))}if(s=s.substring(0,Hs(s)),Vs(s,c)>=s.length){if(t.length>0){let e=F.create(n,r);t.push({type:`break`,content:``,range:I.create(e,e)})}}else{Fs.lastIndex=c;let e=Fs.exec(s);if(e){let i=e[0],a=e[1],o=F.create(n,r+c),l=F.create(n,r+c+i.length);t.push({type:`tag`,content:a,range:I.create(o,l)}),c+=i.length,c=Vs(s,c)}if(c<s.length){let e=s.substring(c),i=Array.from(e.matchAll(Is));t.push(...Rs(i,e,n,r+c))}}n++,r=0}return t.length>0&&t[t.length-1].type===`break`?t.slice(0,-1):t}function Rs(e,t,n,r){let i=[];if(e.length===0){let e=F.create(n,r),a=F.create(n,r+t.length);i.push({type:`text`,content:t,range:I.create(e,a)})}else{let a=0;for(let o of e){let e=o.index,s=t.substring(a,e);s.length>0&&i.push({type:`text`,content:t.substring(a,e),range:I.create(F.create(n,a+r),F.create(n,e+r))});let c=s.length+1,l=o[1];if(i.push({type:`inline-tag`,content:l,range:I.create(F.create(n,a+c+r),F.create(n,a+c+l.length+r))}),c+=l.length,o.length===4){c+=o[2].length;let e=o[3];i.push({type:`text`,content:e,range:I.create(F.create(n,a+c+r),F.create(n,a+c+e.length+r))})}else i.push({type:`text`,content:``,range:I.create(F.create(n,a+c+r),F.create(n,a+c+r))});a=e+o[0].length}let o=t.substring(a);o.length>0&&i.push({type:`text`,content:o,range:I.create(F.create(n,a+r),F.create(n,a+r+o.length))})}return i}const zs=/\S/,Bs=/\s*$/;function Vs(e,t){let n=e.substring(t).match(zs);return n?t+n.index:e.length}function Hs(e){let t=e.match(Bs);if(t&&typeof t.index==`number`)return t.index}function Us(e){let t=F.create(e.position.line,e.position.character);if(e.tokens.length===0)return new Qs([],I.create(t,t));let n=[];for(;e.index<e.tokens.length;){let t=Ws(e,n[n.length-1]);t&&n.push(t)}let r=n[0]?.range.start??t,i=n[n.length-1]?.range.end??t;return new Qs(n,I.create(r,i))}function Ws(e,t){let n=e.tokens[e.index];if(n.type===`tag`)return Js(e,!1);if(n.type===`text`||n.type===`inline-tag`)return Ks(e);Gs(n,t),e.index++}function Gs(e,t){if(t){let n=new rc(``,e.range);`inlines`in t?t.inlines.push(n):t.content.inlines.push(n)}}function Ks(e){let t=e.tokens[e.index],n=t,r=t,i=[];for(;t&&t.type!==`break`&&t.type!==`tag`;)i.push(qs(e)),r=t,t=e.tokens[e.index];return new nc(i,I.create(n.range.start,r.range.end))}function qs(e){return e.tokens[e.index].type===`inline-tag`?Js(e,!0):Ys(e)}function Js(e,t){let n=e.tokens[e.index++],r=n.content.substring(1);if(e.tokens[e.index]?.type===`text`)if(t){let i=Ys(e);return new $s(r,new nc([i],i.range),t,I.create(n.range.start,i.range.end))}else{let i=Ks(e);return new $s(r,i,t,I.create(n.range.start,i.range.end))}else{let e=n.range;return new $s(r,new nc([],e),t,e)}}function Ys(e){let t=e.tokens[e.index++];return new rc(t.content,t.range)}function Xs(e){if(!e)return Xs({start:`/**`,end:`*/`,line:`*`});let{start:t,end:n,line:r}=e;return{start:Zs(t,!0),end:Zs(n,!1),line:Zs(r,!0)}}function Zs(e,t){if(typeof e==`string`||typeof e==`object`){let n=typeof e==`string`?Xi(e):e.source;return t?RegExp(`^\\s*${n}`):RegExp(`\\s*${n}\\s*$`)}else return e}var Qs=class{constructor(e,t){this.elements=e,this.range=t}getTag(e){return this.getAllTags().find(t=>t.name===e)}getTags(e){return this.getAllTags().filter(t=>t.name===e)}getAllTags(){return this.elements.filter(e=>`name`in e)}toString(){let e=``;for(let t of this.elements)if(e.length===0)e=t.toString();else{let n=t.toString();e+=ic(e)+n}return e.trim()}toMarkdown(e){let t=``;for(let n of this.elements)if(t.length===0)t=n.toMarkdown(e);else{let r=n.toMarkdown(e);t+=ic(t)+r}return t.trim()}},$s=class{constructor(e,t,n,r){this.name=e,this.content=t,this.inline=n,this.range=r}toString(){let e=`@${this.name}`,t=this.content.toString();return this.content.inlines.length===1?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e}\n${t}`),this.inline?`{${e}}`:e}toMarkdown(e){return(e?.renderTag)?.call(e,this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){let t=this.content.toMarkdown(e);if(this.inline){let n=ec(this.name,t,e??{});if(typeof n==`string`)return n}let n=``;e?.tag===`italic`||e?.tag===void 0?n=`*`:e?.tag===`bold`?n=`**`:e?.tag===`bold-italic`&&(n=`***`);let r=`${n}@${this.name}${n}`;return this.content.inlines.length===1?r=`${r} — ${t}`:this.content.inlines.length>1&&(r=`${r}\n${t}`),this.inline?`{${r}}`:r}};function ec(e,t,n){if(e===`linkplain`||e===`linkcode`||e===`link`){let r=t.indexOf(` `),i=t;if(r>0){let e=Vs(t,r);i=t.substring(e),t=t.substring(0,r)}return(e===`linkcode`||e===`link`&&n.link===`code`)&&(i=`\`${i}\``),n.renderLink?.call(n,t,i)??tc(t,i)}}function tc(e,t){try{return Y.parse(e,!0),`[${t}](${e})`}catch{return e}}var nc=class{constructor(e,t){this.inlines=e,this.range=t}toString(){let e=``;for(let t=0;t<this.inlines.length;t++){let n=this.inlines[t],r=this.inlines[t+1];e+=n.toString(),r&&r.range.start.line>n.range.start.line&&(e+=`
|
|
21
|
+
`)}return e}toMarkdown(e){let t=``;for(let n=0;n<this.inlines.length;n++){let r=this.inlines[n],i=this.inlines[n+1];t+=r.toMarkdown(e),i&&i.range.start.line>r.range.start.line&&(t+=`
|
|
22
|
+
`)}return t}},rc=class{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}};function ic(e){return e.endsWith(`
|
|
23
|
+
`)?`
|
|
24
|
+
`:`
|
|
25
|
+
|
|
26
|
+
`}var ac=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let t=this.commentProvider.getComment(e);if(t&&Ns(t))return Ms(t).toMarkdown({renderLink:(t,n)=>this.documentationLinkRenderer(e,t,n),renderTag:t=>this.documentationTagRenderer(e,t)})}documentationLinkRenderer(e,t,n){let r=this.findNameInPrecomputedScopes(e,t)??this.findNameInGlobalScope(e,t);if(r&&r.nameSegment){let e=r.nameSegment.range.start.line+1,t=r.nameSegment.range.start.character+1;return`[${n}](${r.documentUri.with({fragment:`L${e},${t}`}).toString()})`}else return}documentationTagRenderer(e,t){}findNameInPrecomputedScopes(e,t){let n=q(e).precomputedScopes;if(!n)return;let r=e;do{let e=n.get(r).find(e=>e.name===t);if(e)return e;r=r.$container}while(r)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(e=>e.name===t)}},oc=i({});t(oc,a(w(),1));var sc=class{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}},cc=class{buildUnexpectedCharactersMessage(e,t,n,r,i){return h.buildUnexpectedCharactersMessage(e,t,n,r,i)}buildUnableToPopLexerModeMessage(e){return h.buildUnableToPopLexerModeMessage(e)}};const lc={mode:`full`};var uc=class{constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;let t=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(t),this.chevrotainLexer=new u(pc(t)?Object.values(t):t,{positionTracking:`full`,skipValidations:e.LanguageMetaData.mode===`production`,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=lc){var n;let r=this.chevrotainLexer.tokenize(e);return{tokens:r.tokens,errors:r.errors,hidden:r.groups.hidden??[],report:(n=this.tokenBuilder).flushLexingReport?.call(n,e)}}toTokenTypeDictionary(e){if(pc(e))return e;let t=fc(e)?Object.values(e.modes).flat():e,n={};return t.forEach(e=>n[e.name]=e),n}};function dc(e){return Array.isArray(e)&&(e.length===0||`name`in e[0])}function fc(e){return e&&`modes`in e&&`defaultMode`in e}function pc(e){return!dc(e)&&!fc(e)}var mc=class{constructor(e){this.grammarElementIdMap=new ls,this.tokenTypeIdMap=new ls,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(e=>Object.assign(Object.assign({},e),{message:e.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){let t=new Map,n=new Map;for(let n of Fi(e))t.set(n,{});if(e.$cstNode)for(let t of ci(e.$cstNode))n.set(t,{});return{astNodes:t,cstNodes:n}}dehydrateAstNode(e,t){let n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(let[r,i]of Object.entries(e))if(!r.startsWith(`$`))if(Array.isArray(i)){let e=[];n[r]=e;for(let n of i)H(n)?e.push(this.dehydrateAstNode(n,t)):wn(n)?e.push(this.dehydrateReference(n,t)):e.push(n)}else H(i)?n[r]=this.dehydrateAstNode(i,t):wn(i)?n[r]=this.dehydrateReference(i,t):i!==void 0&&(n[r]=i);return n}dehydrateReference(e,t){let n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=t.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,t){let n=t.cstNodes.get(e);return An(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=t.astNodes.get(e.astNode),On(e)?n.content=e.content.map(e=>this.dehydrateCstNode(e,t)):kn(e)&&(n.tokenType=e.tokenType.name,n.offset=e.offset,n.length=e.length,n.startLine=e.range.start.line,n.startColumn=e.range.start.character,n.endLine=e.range.end.line,n.endColumn=e.range.end.character),n}hydrate(e){let t=e.value,n=this.createHydrationContext(t);return`$cstNode`in t&&this.hydrateCstNode(t.$cstNode,n),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,n)}}createHydrationContext(e){let t=new Map,n=new Map;for(let n of Fi(e))t.set(n,{});let r;if(e.$cstNode)for(let t of ci(e.$cstNode)){let e;`fullText`in t?(e=new co(t.fullText),r=e):`content`in t?e=new oo:`tokenType`in t&&(e=this.hydrateCstLeafNode(t)),e&&(n.set(t,e),e.root=r)}return{astNodes:t,cstNodes:n}}hydrateAstNode(e,t){let n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode&&(n.$cstNode=t.cstNodes.get(e.$cstNode));for(let[r,i]of Object.entries(e))if(!r.startsWith(`$`))if(Array.isArray(i)){let e=[];n[r]=e;for(let a of i)H(a)?e.push(this.setParent(this.hydrateAstNode(a,t),n)):wn(a)?e.push(this.hydrateReference(a,n,r,t)):e.push(a)}else H(i)?n[r]=this.setParent(this.hydrateAstNode(i,t),n):wn(i)?n[r]=this.hydrateReference(i,n,r,t):i!==void 0&&(n[r]=i);return n}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,n,r){return this.linker.buildReference(t,n,r.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,n=0){let r=t.cstNodes.get(e);if(typeof e.grammarSource==`number`&&(r.grammarSource=this.getGrammarElement(e.grammarSource)),r.astNode=t.astNodes.get(e.astNode),On(r))for(let i of e.content){let e=this.hydrateCstNode(i,t,n++);r.content.push(e)}return r}hydrateCstLeafNode(e){let t=this.getTokenType(e.tokenType),n=e.offset,r=e.length,i=e.startLine,a=e.startColumn,o=e.endLine,s=e.endColumn,c=e.hidden;return new ao(n,r,{start:{line:i,character:a},end:{line:o,character:s}},t,c)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(let t of Fi(this.grammar))Ln(t)&&this.grammarElementIdMap.set(t,e++)}},hc;(function(e){function t(e){return{dispose:async()=>await e()}}e.create=t})(hc||={});var gc=class{readFile(){throw Error(`No file system is available.`)}async readDirectory(){return[]}};const _c={fileSystemProvider:()=>new gc},vc={Grammar:()=>void 0,LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[`.langium`],languageId:`langium`})},yc={AstReflection:()=>new ti};function bc(){let e=ws(zc(_c),yc),t=ws(Rc({shared:e}),vc);return e.ServiceRegistry.register(t),t}function xc(e){let t=bc(),n=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(n,Y.parse(`memory://${n.name??`grammar`}.langium`)),n}var Sc=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,n){let r=n??q(e);t??=this.nameProvider.getName(e);let i=this.astNodeLocator.getAstNodePath(e);if(!t)throw Error(`Node at path ${i} has no name.`);let a,o=()=>a??=fi(this.nameProvider.getNameNode(e)??e.$cstNode);return{node:e,name:t,get nameSegment(){return o()},selectionSegment:fi(e.$cstNode),type:e.$type,documentUri:r.uri,path:i}}},Cc=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=Z.CancellationToken.None){let n=[],r=e.parseResult.value;for(let e of Fi(r))await Q(t),Li(e).filter(e=>!En(e)).forEach(e=>{let t=this.createDescription(e);t&&n.push(t)});return n}createDescription(e){let t=e.reference.$nodeDescription,n=e.reference.$refNode;if(!t||!n)return;let r=q(e.container).uri;return{sourceUri:r,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:fi(n),local:X.equals(t.documentUri,r)}}},wc=class{constructor(){this.segmentSeparator=`/`,this.indexSeparator=`@`}getAstNodePath(e){if(e.$container){let t=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return t+this.segmentSeparator+n}return``}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw Error(`Missing '$containerProperty' in AST node.`);return t===void 0?e:e+this.indexSeparator+t}getAstNode(e,t){return t.split(this.segmentSeparator).reduce((e,t)=>{if(!e||t.length===0)return e;let n=t.indexOf(this.indexSeparator);if(n>0){let r=t.substring(0,n),i=parseInt(t.substring(n+1));return e[r]?.[i]}return e[t]},e)}},Tc=class{constructor(e){this._ready=new Jo,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new oc.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){this.workspaceConfig=e.capabilities.workspace?.configuration??!1}async initialized(e){if(this.workspaceConfig){if(e.register){let t=this.serviceRegistry.all;e.register({section:t.map(e=>this.toSectionName(e.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let t=this.serviceRegistry.all.map(e=>({section:this.toSectionName(e.LanguageMetaData.languageId)})),n=await e.fetchConfiguration(t);t.forEach((e,t)=>{this.updateSectionConfiguration(e.section,n[t])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(t=>{let n=e.settings[t];this.updateSectionConfiguration(t,n),this.onConfigurationSectionUpdateEmitter.fire({section:t,configuration:n})})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][t]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}},Ec=class{constructor(e){this.updateBuildOptions={validation:{categories:[`built-in`,`fast`]}},this.updateListeners=[],this.buildPhaseListeners=new cs,this.documentPhaseListeners=new cs,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=$.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},n=Z.CancellationToken.None){for(let n of e){let e=n.uri.toString();if(n.state===$.Validated){if(typeof t.validation==`boolean`&&t.validation)n.state=$.IndexedReferences,n.diagnostics=void 0,this.buildState.delete(e);else if(typeof t.validation==`object`){let r=this.buildState.get(e),i=r?.result?.validationChecks;if(i){let a=(t.validation.categories??jc.all).filter(e=>!i.includes(e));a.length>0&&(this.buildState.set(e,{completed:!1,options:{validation:Object.assign(Object.assign({},t.validation),{categories:a})},result:r.result}),n.state=$.IndexedReferences)}}}else this.buildState.delete(e)}this.currentState=$.Changed,await this.emitUpdate(e.map(e=>e.uri),[]),await this.buildDocuments(e,t,n)}async update(e,t,n=Z.CancellationToken.None){this.currentState=$.Changed;for(let e of t)this.langiumDocuments.deleteDocument(e),this.buildState.delete(e.toString()),this.indexManager.remove(e);for(let t of e){if(!this.langiumDocuments.invalidateDocument(t)){let e=this.langiumDocumentFactory.fromModel({$type:`INVALID`},t);e.state=$.Changed,this.langiumDocuments.addDocument(e)}this.buildState.delete(t.toString())}let r=K(e).concat(t).map(e=>e.toString()).toSet();this.langiumDocuments.all.filter(e=>!r.has(e.uri.toString())&&this.shouldRelink(e,r)).forEach(e=>{this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e),e.state=Math.min(e.state,$.ComputedScopes),e.diagnostics=void 0}),await this.emitUpdate(e,t),await Q(n);let i=this.sortDocuments(this.langiumDocuments.all.filter(e=>e.state<$.Linked||!this.buildState.get(e.uri.toString())?.completed).toArray());await this.buildDocuments(i,this.updateBuildOptions,n)}async emitUpdate(e,t){await Promise.all(this.updateListeners.map(n=>n(e,t)))}sortDocuments(e){let t=0,n=e.length-1;for(;t<n;){for(;t<e.length&&this.hasTextDocument(e[t]);)t++;for(;n>=0&&!this.hasTextDocument(e[n]);)n--;t<n&&([e[t],e[n]]=[e[n],e[t]])}return e}hasTextDocument(e){return!!this.textDocuments?.get(e.uri)}shouldRelink(e,t){return e.references.some(e=>e.error!==void 0)?!0:this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),hc.create(()=>{let t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}async buildDocuments(e,t,n){this.prepareBuild(e,t),await this.runCancelable(e,$.Parsed,n,e=>this.langiumDocumentFactory.update(e,n)),await this.runCancelable(e,$.IndexedContent,n,e=>this.indexManager.updateContent(e,n)),await this.runCancelable(e,$.ComputedScopes,n,async e=>{e.precomputedScopes=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeLocalScopes(e,n)});let r=e.filter(e=>this.shouldLink(e));await this.runCancelable(r,$.Linked,n,e=>this.serviceRegistry.getServices(e.uri).references.Linker.link(e,n)),await this.runCancelable(r,$.IndexedReferences,n,e=>this.indexManager.updateReferences(e,n));let i=e.filter(e=>this.shouldValidate(e));await this.runCancelable(i,$.Validated,n,e=>this.validate(e,n));for(let t of e){let e=this.buildState.get(t.uri.toString());e&&(e.completed=!0)}}prepareBuild(e,t){for(let n of e){let e=n.uri.toString(),r=this.buildState.get(e);(!r||r.completed)&&this.buildState.set(e,{completed:!1,options:t,result:r?.result})}}async runCancelable(e,t,n,r){let i=e.filter(e=>e.state<t);for(let e of i)await Q(n),await r(e),e.state=t,await this.notifyDocumentPhase(e,t,n);let a=e.filter(e=>e.state===t);await this.notifyBuildPhase(a,t,n),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),hc.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),hc.create(()=>{this.documentPhaseListeners.delete(e,t)})}waitUntil(e,t,n){let r;if(t&&`path`in t?r=t:n=t,n??=Z.CancellationToken.None,r){let t=this.langiumDocuments.getDocument(r);if(t&&t.state>=e)return Promise.resolve(r)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Ko):new Promise((t,i)=>{let a=this.onBuildPhase(e,()=>{a.dispose(),o.dispose(),t(r?this.langiumDocuments.getDocument(r)?.uri:void 0)}),o=n.onCancellationRequested(()=>{a.dispose(),o.dispose(),i(Ko)})})}async notifyDocumentPhase(e,t,n){let r=this.documentPhaseListeners.get(t).slice();for(let t of r)try{await t(e,n)}catch(e){if(!qo(e))throw e}}async notifyBuildPhase(e,t,n){if(e.length===0)return;let r=this.buildPhaseListeners.get(t).slice();for(let t of r)await Q(n),await t(e,n)}shouldLink(e){return this.getBuildOptions(e).eagerLinking??!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,t){let n=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,r=this.getBuildOptions(e).validation,i=typeof r==`object`?r:void 0,a=await n.validateDocument(e,i,t);e.diagnostics?e.diagnostics.push(...a):e.diagnostics=a;let o=this.buildState.get(e.uri.toString());if(o){o.result??={};let e=i?.categories??jc.all;o.result.validationChecks?o.result.validationChecks.push(...e):o.result.validationChecks=[...e]}}getBuildOptions(e){return this.buildState.get(e.uri.toString())?.options??{}}},Dc=class{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new gs,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){let n=q(e).uri,r=[];return this.referenceIndex.forEach(e=>{e.forEach(e=>{X.equals(e.targetUri,n)&&e.targetPath===t&&r.push(e)})}),K(r)}allElements(e,t){let n=K(this.symbolIndex.keys());return t&&(n=n.filter(e=>!t||t.has(e))),n.map(t=>this.getFileDescriptions(t,e)).flat()}getFileDescriptions(e,t){return t?this.symbolByTypeIndex.get(e,t,()=>(this.symbolIndex.get(e)??[]).filter(e=>this.astReflection.isSubtype(e.type,t))):this.symbolIndex.get(e)??[]}remove(e){let t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t),this.referenceIndex.delete(t)}async updateContent(e,t=Z.CancellationToken.None){let n=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,t),r=e.uri.toString();this.symbolIndex.set(r,n),this.symbolByTypeIndex.clear(r)}async updateReferences(e,t=Z.CancellationToken.None){let n=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),n)}isAffected(e,t){let n=this.referenceIndex.get(e.uri.toString());return n?n.some(e=>!e.local&&t.has(e.targetUri.toString())):!1}},Oc=class{constructor(){this.previousTokenSource=new Z.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let t=Go();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,n=Z.CancellationToken.None){let r=new Jo,i={action:t,deferred:r,cancellationToken:n};return e.push(i),this.performNextOperation(),r.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:e,deferred:t,cancellationToken:n})=>{try{let r=await Promise.resolve().then(()=>e(n));t.resolve(r)}catch(e){qo(e)?t.resolve(void 0):t.reject(e)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}},kc=class{constructor(e){this.initialBuildOptions={},this._ready=new Jo,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){this.folders=e.workspaceFolders??void 0}initialized(e){return this.mutex.write(e=>this.initializeWorkspace(this.folders??[],e))}async initializeWorkspace(e,t=Z.CancellationToken.None){let n=await this.performStartup(e);await Q(t),await this.documentBuilder.build(n,this.initialBuildOptions,t)}async performStartup(e){let t=this.serviceRegistry.all.flatMap(e=>e.LanguageMetaData.fileExtensions),n=this.serviceRegistry.all.flatMap(e=>e.LanguageMetaData.fileNames??[]),r=[],i=e=>{r.push(e),this.langiumDocuments.hasDocument(e.uri)||this.langiumDocuments.addDocument(e)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(e=>[e,this.getRootFolder(e)]).map(async e=>this.traverseFolder(...e,{fileExtensions:t,fileNames:n},i))),this._ready.resolve(),r}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return Y.parse(e.uri)}async traverseFolder(e,t,n,r){let i=await this.fileSystemProvider.readDirectory(t);await Promise.all(i.map(async t=>{this.includeEntry(e,t,n)&&(t.isDirectory?await this.traverseFolder(e,t.uri,n,r):t.isFile&&r(await this.langiumDocuments.getOrCreateDocument(t.uri)))}))}includeEntry(e,t,n){let r=X.basename(t.uri);return r.startsWith(`.`)?!1:t.isDirectory?r!==`node_modules`&&r!==`out`:t.isFile?n.fileExtensions.includes(X.extname(t.uri))||n.fileNames.includes(X.basename(t.uri)):!1}};function Ac(e){return{code:e}}var jc;(function(e){e.all=[`fast`,`slow`,`built-in`]})(jc||={});var Mc=class{constructor(e){this.entries=new cs,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,t=this,n=`fast`){if(n===`built-in`)throw Error(`The 'built-in' category is reserved for lexer, parser, and linker errors.`);for(let[r,i]of Object.entries(e)){let e=i;if(Array.isArray(e))for(let i of e){let e={check:this.wrapValidationException(i,t),category:n};this.addEntry(r,e)}else if(typeof e==`function`){let i={check:this.wrapValidationException(e,t),category:n};this.addEntry(r,i)}else Ui(e)}}wrapValidationException(e,t){return async(n,r,i)=>{await this.handleException(()=>e.call(t,n,r,i),`An error occurred during validation`,r,n)}}async handleException(e,t,n,r){try{await e()}catch(e){if(qo(e))throw e;console.error(`${t}:`,e),e instanceof Error&&e.stack&&console.error(e.stack),n(`error`,`${t}: ${e instanceof Error?e.message:String(e)}`,{node:r})}}addEntry(e,t){if(e===`AstNode`){this.entries.add(`AstNode`,t);return}for(let n of this.reflection.getAllSubTypes(e))this.entries.add(n,t)}getChecks(e,t){let n=K(this.entries.get(e)).concat(this.entries.get(`AstNode`));return t&&(n=n.filter(e=>t.includes(e.category))),n.map(e=>e.check)}registerBeforeDocument(e,t=this){this.entriesBefore.push(this.wrapPreparationException(e,`An error occurred during set-up of the validation`,t))}registerAfterDocument(e,t=this){this.entriesAfter.push(this.wrapPreparationException(e,`An error occurred during tear-down of the validation`,t))}wrapPreparationException(e,t,n){return async(r,i,a,o)=>{await this.handleException(()=>e.call(n,r,i,a,o),t,i,r)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}},Nc=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t={},n=Z.CancellationToken.None){let r=e.parseResult,i=[];if(await Q(n),(!t.categories||t.categories.includes(`built-in`))&&(this.processLexingErrors(r,i,t),t.stopAfterLexingErrors&&i.some(e=>e.data?.code===Lc.LexingError)||(this.processParsingErrors(r,i,t),t.stopAfterParsingErrors&&i.some(e=>e.data?.code===Lc.ParsingError))||(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some(e=>e.data?.code===Lc.LinkingError))))return i;try{i.push(...await this.validateAst(r.value,t,n))}catch(e){if(qo(e))throw e;console.error(`An error occurred during validation:`,e)}return await Q(n),i}processLexingErrors(e,t,n){let r=[...e.lexerErrors,...e.lexerReport?.diagnostics??[]];for(let e of r){let n=e.severity??`error`,r={severity:Fc(n),range:{start:{line:e.line-1,character:e.column-1},end:{line:e.line-1,character:e.column+e.length-1}},message:e.message,data:Ic(n),source:this.getSource()};t.push(r)}}processParsingErrors(e,t,n){for(let n of e.parserErrors){let e;if(isNaN(n.token.startOffset)){if(`previousToken`in n){let t=n.previousToken;if(isNaN(t.startOffset)){let t={line:0,character:0};e={start:t,end:t}}else{let n={line:t.endLine-1,character:t.endColumn};e={start:n,end:n}}}}else e=di(n.token);if(e){let r={severity:Fc(`error`),range:e,message:n.message,data:Ac(Lc.ParsingError),source:this.getSource()};t.push(r)}}}processLinkingErrors(e,t,n){for(let n of e.references){let e=n.error;if(e){let n={node:e.container,property:e.property,index:e.index,data:{code:Lc.LinkingError,containerType:e.container.$type,property:e.property,refText:e.reference.$refText}};t.push(this.toDiagnostic(`error`,e.message,n))}}}async validateAst(e,t,n=Z.CancellationToken.None){let r=[],i=(e,t,n)=>{r.push(this.toDiagnostic(e,t,n))};return await this.validateAstBefore(e,t,i,n),await this.validateAstNodes(e,t,i,n),await this.validateAstAfter(e,t,i,n),r}async validateAstBefore(e,t,n,r=Z.CancellationToken.None){let i=this.validationRegistry.checksBefore;for(let a of i)await Q(r),await a(e,n,t.categories??[],r)}async validateAstNodes(e,t,n,r=Z.CancellationToken.None){await Promise.all(Fi(e).map(async e=>{await Q(r);let i=this.validationRegistry.getChecks(e.$type,t.categories);for(let t of i)await t(e,n,r)}))}async validateAstAfter(e,t,n,r=Z.CancellationToken.None){let i=this.validationRegistry.checksAfter;for(let a of i)await Q(r),await a(e,n,t.categories??[],r)}toDiagnostic(e,t,n){return{message:t,range:Pc(n),severity:Fc(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};function Pc(e){if(e.range)return e.range;let t;return typeof e.property==`string`?t=ca(e.node.$cstNode,e.property,e.index):typeof e.keyword==`string`&&(t=da(e.node.$cstNode,e.keyword,e.index)),t??=e.node.$cstNode,t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Fc(e){switch(e){case`error`:return 1;case`warning`:return 2;case`info`:return 3;case`hint`:return 4;default:throw Error(`Invalid diagnostic severity: `+e)}}function Ic(e){switch(e){case`error`:return Ac(Lc.LexingError);case`warning`:return Ac(Lc.LexingWarning);case`info`:return Ac(Lc.LexingInfo);case`hint`:return Ac(Lc.LexingHint);default:throw Error(`Invalid diagnostic severity: `+e)}}var Lc;(function(e){e.LexingError=`lexing-error`,e.LexingWarning=`lexing-warning`,e.LexingInfo=`lexing-info`,e.LexingHint=`lexing-hint`,e.ParsingError=`parsing-error`,e.LinkingError=`linking-error`})(Lc||={});function Rc(e){return{documentation:{CommentProvider:e=>new js(e),DocumentationProvider:e=>new ac(e)},parser:{AsyncParser:e=>new sc(e),GrammarConfig:e=>no(e),LangiumParser:e=>Ro(e),CompletionParser:e=>Lo(e),ValueConverter:()=>new Vo,TokenBuilder:()=>new Bo,Lexer:e=>new uc(e),ParserErrorMessageProvider:()=>new go,LexerErrorMessageProvider:()=>new cc},workspace:{AstNodeLocator:()=>new wc,AstNodeDescriptionProvider:e=>new Sc(e),ReferenceDescriptionProvider:e=>new Cc(e)},references:{Linker:e=>new is(e),NameProvider:()=>new os,ScopeProvider:e=>new vs(e),ScopeComputation:e=>new us(e),References:e=>new ss(e)},serializer:{Hydrator:e=>new mc(e),JsonSerializer:e=>new xs(e)},validation:{DocumentValidator:e=>new Nc(e),ValidationRegistry:e=>new Mc(e)},shared:()=>e.shared}}function zc(e){return{ServiceRegistry:e=>new Ss(e),workspace:{LangiumDocuments:e=>new ns(e),LangiumDocumentFactory:e=>new ts(e),DocumentBuilder:e=>new Ec(e),IndexManager:e=>new Dc(e),WorkspaceManager:e=>new kc(e),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new Oc,ConfigurationProvider:e=>new Tc(e)}}}var Bc=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,t,n){let r=e.parseResult.value.$cstNode;if(!r)return;let i=_i(r,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(!i)return;let a=this.references.findDeclaration(i);if(a){let t=X.equals(q(a).uri,e.uri),n={documentUri:e.uri,includeDeclaration:t};return this.references.findReferences(a,n).map(e=>this.createDocumentHighlight(e)).toArray()}}createDocumentHighlight(e){return J.DocumentHighlight.create(e.segment.range)}},Vc=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e,t,n){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,t){let n=t.$cstNode,r=this.nameProvider.getNameNode(t);if(r&&n){let i=this.nameProvider.getName(t);return[{kind:this.nodeKindProvider.getSymbolKind(t),name:i||r.text,range:n.range,selectionRange:r.range,children:this.getChildSymbols(e,t)}]}else return this.getChildSymbols(e,t)||[]}getChildSymbols(e,t){let n=[];for(let r of Ni(t)){let t=this.getSymbol(e,r);n.push(...t)}if(n.length>0)return n}},Hc=class{constructor(e){this.workspaceManager=e.workspace.WorkspaceManager,this.documentBuilder=e.workspace.DocumentBuilder,this.workspaceLock=e.workspace.WorkspaceLock,this.serviceRegistry=e.ServiceRegistry;let t=!1;e.lsp.LanguageServer.onInitialize(e=>{t=!!e.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration}),e.lsp.LanguageServer.onInitialized(n=>{t&&this.registerFileWatcher(e)})}registerFileWatcher(e){let t=[],n=K(e.ServiceRegistry.all).flatMap(e=>e.LanguageMetaData.fileExtensions).map(e=>e.startsWith(`.`)?e.substring(1):e).distinct().toArray();n.length>0&&t.push({globPattern:n.length===1?`**/*.${n[0]}`:`**/*.{${n.join(`,`)}}`});let r=K(e.ServiceRegistry.all).flatMap(e=>e.LanguageMetaData.fileNames??[]).distinct().toArray();if(r.length>0&&t.push({globPattern:r.length===1?`**/${r[0]}`:`**/{${r.join(`,`)}}`}),t.length>0){let n=e.lsp.Connection,r={watchers:t};n?.client.register(J.DidChangeWatchedFilesNotification.type,r)}}fireDocumentUpdate(e,t){e=e.filter(e=>this.serviceRegistry.hasServices(e)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(n=>this.documentBuilder.update(e,t,n))}).catch(e=>{console.error(`Workspace initialization failed. Could not perform document update.`,e)})}didChangeContent(e){this.fireDocumentUpdate([Y.parse(e.document.uri)],[])}didChangeWatchedFiles(e){let t=K(e.changes).filter(e=>e.type!==J.FileChangeType.Deleted).distinct(e=>e.uri).map(e=>Y.parse(e.uri)).toArray(),n=K(e.changes).filter(e=>e.type===J.FileChangeType.Deleted).distinct(e=>e.uri).map(e=>Y.parse(e.uri)).toArray();this.fireDocumentUpdate(t,n)}},Uc=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,t,n){let r=[];return this.collectFolding(e,e=>r.push(e)),r}collectFolding(e,t){let n=e.parseResult?.value;if(n){if(this.shouldProcessContent(n)){let r=Pi(n).iterator(),i;do if(i=r.next(),!i.done){let n=i.value;this.shouldProcess(n)&&this.collectObjectFolding(e,n,t),this.shouldProcessContent(n)||r.prune()}while(!i.done)}this.collectCommentFolding(e,n,t)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,t,n){let r=t.$cstNode;if(r){let t=this.toFoldingRange(e,r);t&&n(t)}}collectCommentFolding(e,t,n){let r=t.$cstNode;if(r){for(let t of li(r))if(this.commentNames.includes(t.tokenType.name)){let r=this.toFoldingRange(e,t,J.FoldingRangeKind.Comment);r&&n(r)}}}toFoldingRange(e,t,n){let r=t.range,i=r.start,a=r.end;if(!(a.line-i.line<2))return this.includeLastFoldingLine(t,n)||(a=e.textDocument.positionAt(e.textDocument.offsetAt({line:a.line,character:0})-1)),J.FoldingRange.create(i.line,a.line,i.character,a.character,n)}includeLastFoldingLine(e,t){if(t===J.FoldingRangeKind.Comment)return!1;let n=e.text,r=n.charAt(n.length-1);return!(r===`}`||r===`)`||r===`]`)}},Wc=class{match(e,t){if(e.length===0)return!0;let n=!1,r,i=0,a=t.length;for(let o=0;o<a;o++){let a=t.charCodeAt(o),s=e.charCodeAt(i);if((a===s||this.toUpperCharCode(a)===this.toUpperCharCode(s))&&(n||=r===void 0||this.isWordTransition(r,a),n&&i++,i===e.length))return!0;r=a}return!1}isWordTransition(e,t){return Gc<=e&&e<=Kc&&qc<=t&&t<=Jc||e===Yc&&t!==Yc}toUpperCharCode(e){return Gc<=e&&e<=Kc?e-32:e}};const Gc=97,Kc=122,qc=65,Jc=90,Yc=95;var Xc=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,t){let n=e.parseResult?.value?.$cstNode;if(n){let r=e.textDocument.offsetAt(t.position),i=_i(n,r,this.grammarConfig.nameRegexp);if(i&&i.offset+i.length>r){let e=this.references.findDeclaration(i);if(e)return this.getAstNodeHoverContent(e);if(Ir(i.grammarSource))return this.getKeywordHoverContent(i.grammarSource)}}}getKeywordHoverContent(e){let t=ys(e)?e.$comment:void 0;if(t||=vi(e.$cstNode,[`ML_COMMENT`])?.text,t&&Ns(t)){let e=Ms(t).toMarkdown();if(e)return{contents:{kind:`markdown`,value:e}}}}},Zc=class extends Xc{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){let t=this.documentationProvider.getDocumentation(e);if(t)return{contents:{kind:`markdown`,value:t}}}};const Qc={[J.SemanticTokenTypes.class]:0,[J.SemanticTokenTypes.comment]:1,[J.SemanticTokenTypes.enum]:2,[J.SemanticTokenTypes.enumMember]:3,[J.SemanticTokenTypes.event]:4,[J.SemanticTokenTypes.function]:5,[J.SemanticTokenTypes.interface]:6,[J.SemanticTokenTypes.keyword]:7,[J.SemanticTokenTypes.macro]:8,[J.SemanticTokenTypes.method]:9,[J.SemanticTokenTypes.modifier]:10,[J.SemanticTokenTypes.namespace]:11,[J.SemanticTokenTypes.number]:12,[J.SemanticTokenTypes.operator]:13,[J.SemanticTokenTypes.parameter]:14,[J.SemanticTokenTypes.property]:15,[J.SemanticTokenTypes.regexp]:16,[J.SemanticTokenTypes.string]:17,[J.SemanticTokenTypes.struct]:18,[J.SemanticTokenTypes.type]:19,[J.SemanticTokenTypes.typeParameter]:20,[J.SemanticTokenTypes.variable]:21,[J.SemanticTokenTypes.decorator]:22},$c={[J.SemanticTokenModifiers.abstract]:1,[J.SemanticTokenModifiers.async]:2,[J.SemanticTokenModifiers.declaration]:4,[J.SemanticTokenModifiers.defaultLibrary]:8,[J.SemanticTokenModifiers.definition]:16,[J.SemanticTokenModifiers.deprecated]:32,[J.SemanticTokenModifiers.documentation]:64,[J.SemanticTokenModifiers.modification]:128,[J.SemanticTokenModifiers.readonly]:256,[J.SemanticTokenModifiers.static]:512};function el(e){let t=[],n=[],r=!0,i=!0,a=!0;for(let o of e)o&&(o.legend.tokenTypes.forEach((e,n)=>{let r=t[n];if(r&&r!==e)throw Error(`Cannot merge '${r}' and '${e}' token types. They use the same index ${n}.`);t[n]=e}),o.legend.tokenModifiers.forEach((e,t)=>{let r=n[t];if(r&&r!==e)throw Error(`Cannot merge '${r}' and '${e}' token modifier. They use the same index ${t}.`);n[t]=e}),o.full?typeof o.full==`object`&&!o.full.delta&&(i=!1):r=!1,o.range||(a=!1));return{legend:{tokenTypes:t,tokenModifiers:n},full:r&&{delta:i},range:a}}var tl=class extends J.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,t,n,r,i){this._tokens.push({line:e,char:t,length:n,tokenType:r,tokenModifiers:i})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}flush(){this.previousResult(this.id)}applyTokens(){for(let e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,t){return e.line===t.line?e.char-t.char:e.line-t.line}},nl=class{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(e=>{this.tokensBuilders.delete(e.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(e=>{this.initialize(e.capabilities.textDocument?.semanticTokens)})}initialize(e){this.clientCapabilities=e}get tokenTypes(){return Qc}get tokenModifiers(){return $c}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(e,t,n=Z.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightRange(e,t,n=Z.CancellationToken.None){return this.currentRange=t.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightDelta(e,t,n=Z.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(t.previousResultId),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.buildEdits()}createAcceptor(){return e=>{`line`in e?this.highlightToken({range:{start:{line:e.line,character:e.char},end:{line:e.line,character:e.char+e.length}},type:e.type,modifier:e.modifier}):`range`in e?this.highlightToken(e):`keyword`in e?this.highlightKeyword(e):`property`in e?this.highlightProperty(e):this.highlightNode({node:e.cst,type:e.type,modifier:e.modifier})}}getDocumentTokensBuilder(e){let t=this.tokensBuilders.get(e.uri.toString());if(t)return t;let n=new tl;return this.tokensBuilders.set(e.uri.toString(),n),n}async computeHighlighting(e,t,n){let r=e.parseResult.value,i=Fi(r,{range:this.currentRange}).iterator(),a;do if(a=i.next(),!a.done){await Q(n);let e=a.value;this.highlightElement(e,t)===`prune`&&i.prune()}while(!a.done)}highlightToken(e){let{range:t,type:n}=e,r=e.modifier;if(this.currentRange&&!hi(t,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;let i=this.tokenTypes[n],a=0;if(r!==void 0){typeof r==`string`&&(r=[r]);for(let e of r){let t=this.tokenModifiers[e];a|=t}}let o=t.start.line,s=t.end.line;if(o===s){let e=t.start.character,n=t.end.character-e;this.currentTokensBuilder.push(o,e,n,i,a)}else if(this.clientCapabilities?.multilineTokenSupport){let e=t.start.character,n=this.currentDocument.textDocument.offsetAt(t.start),r=this.currentDocument.textDocument.offsetAt(t.end);this.currentTokensBuilder.push(o,e,r-n,i,a)}else{let e=t.start,n=this.currentDocument.textDocument.offsetAt({line:o+1,character:0});this.currentTokensBuilder.push(e.line,e.character,n-e.character-1,i,a);for(let e=o+1;e<s;e++){let t=n;n=this.currentDocument.textDocument.offsetAt({line:e+1,character:0}),this.currentTokensBuilder.push(e,0,n-t-1,i,a)}this.currentTokensBuilder.push(s,0,t.end.character,i,a)}}highlightProperty(e){let t=[];if(typeof e.index==`number`){let n=ca(e.node.$cstNode,e.property,e.index);n&&t.push(n)}else t.push(...sa(e.node.$cstNode,e.property));let{type:n,modifier:r}=e;for(let e of t)this.highlightNode({node:e,type:n,modifier:r})}highlightKeyword(e){let{node:t,keyword:n,type:r,index:i,modifier:a}=e,o=[];if(typeof i==`number`){let e=da(t.$cstNode,n,i);e&&o.push(e)}else o.push(...ua(t.$cstNode,n));for(let e of o)this.highlightNode({node:e,type:r,modifier:a})}highlightNode(e){let{node:t,type:n,modifier:r}=e,i=t.range;this.highlightToken({range:i,type:n,modifier:r})}},rl;(function(e){function t(e,t,r){let i=new Map;Object.entries(t).forEach(([e,t])=>i.set(t,e));let a=0,o=0;return n(e.data,5).map(e=>{a+=e[0],e[0]!==0&&(o=0),o+=e[1];let t=e[2];return{offset:r.textDocument.offsetAt({line:a,character:o}),tokenType:i.get(e[3]),tokenModifiers:e[4],text:r.textDocument.getText({start:{line:a,character:o},end:{line:a,character:o+t}})}})}e.decode=t;function n(e,t){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}})(rl||={});function il(e){let t=[],n=[];e.forEach(e=>{e?.triggerCharacters&&t.push(...e.triggerCharacters),e?.retriggerCharacters&&n.push(...e.retriggerCharacters)});let r={triggerCharacters:t.length>0?Array.from(new Set(t)).sort():void 0,retriggerCharacters:n.length>0?Array.from(new Set(n)).sort():void 0};return r.triggerCharacters?r:void 0}var al=V(),ol=class{constructor(e){this.onInitializeEmitter=new al.Emitter,this.onInitializedEmitter=new al.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.fireInitializeOnDefaultServices(e),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){Es(this.services),this.services.ServiceRegistry.all.forEach(e=>Es(e))}hasService(e){return this.services.ServiceRegistry.all.some(t=>e(t)!==void 0)}buildInitializeResult(e){let t=this.services.lsp.DocumentUpdateHandler,n=this.services.lsp.FileOperationHandler?.fileOperationOptions,r=this.services.ServiceRegistry.all,i=this.hasService(e=>e.lsp?.Formatter),a=r.map(e=>e.lsp?.Formatter?.formatOnTypeOptions).find(e=>!!e),o=this.hasService(e=>e.lsp?.CodeActionProvider),s=this.hasService(e=>e.lsp?.SemanticTokenProvider),c=el(r.map(e=>e.lsp?.SemanticTokenProvider?.semanticTokensOptions)),l=this.services.lsp?.ExecuteCommandHandler?.commands,u=this.hasService(e=>e.lsp?.DocumentLinkProvider),d=il(r.map(e=>e.lsp?.SignatureHelp?.signatureHelpOptions)),f=this.hasService(e=>e.lsp?.TypeProvider),p=this.hasService(e=>e.lsp?.ImplementationProvider),m=this.hasService(e=>e.lsp?.CompletionProvider),h=Za(r.map(e=>e.lsp?.CompletionProvider?.completionOptions)),g=this.hasService(e=>e.lsp?.ReferencesProvider),_=this.hasService(e=>e.lsp?.DocumentSymbolProvider),v=this.hasService(e=>e.lsp?.DefinitionProvider),y=this.hasService(e=>e.lsp?.DocumentHighlightProvider),b=this.hasService(e=>e.lsp?.FoldingRangeProvider),x=this.hasService(e=>e.lsp?.HoverProvider),S=this.hasService(e=>e.lsp?.RenameProvider),C=this.hasService(e=>e.lsp?.CallHierarchyProvider),w=this.hasService(e=>e.lsp?.TypeHierarchyProvider),ee=this.hasService(e=>e.lsp?.CodeLensProvider),T=this.hasService(e=>e.lsp?.DeclarationProvider),E=this.hasService(e=>e.lsp?.InlayHintProvider),D=this.services.lsp?.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:n},executeCommandProvider:l&&{commands:l},textDocumentSync:{change:al.TextDocumentSyncKind.Incremental,openClose:!0,save:!!t.didSaveDocument,willSave:!!t.willSaveDocument,willSaveWaitUntil:!!t.willSaveDocumentWaitUntil},completionProvider:m?h:void 0,referencesProvider:g,documentSymbolProvider:_,definitionProvider:v,typeDefinitionProvider:f,documentHighlightProvider:y,codeActionProvider:o,documentFormattingProvider:i,documentRangeFormattingProvider:i,documentOnTypeFormattingProvider:a,foldingRangeProvider:b,hoverProvider:x,renameProvider:S?{prepareProvider:!0}:void 0,semanticTokensProvider:s?c:void 0,signatureHelpProvider:d,implementationProvider:p,callHierarchyProvider:C?{}:void 0,typeHierarchyProvider:w?{}:void 0,documentLinkProvider:u?{resolveProvider:!1}:void 0,codeLensProvider:ee?{resolveProvider:!1}:void 0,declarationProvider:T,inlayHintProvider:E?{resolveProvider:!1}:void 0,workspaceSymbolProvider:D?{resolveProvider:!!D.resolveSymbol}:void 0}}}initialized(e){this.fireInitializedOnDefaultServices(e),this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}fireInitializeOnDefaultServices(e){this.services.workspace.ConfigurationProvider.initialize(e),this.services.workspace.WorkspaceManager.initialize(e)}fireInitializedOnDefaultServices(e){let t=this.services.lsp.Connection,n=t?Object.assign(Object.assign({},e),{register:e=>t.client.register(al.DidChangeConfigurationNotification.type,e),fetchConfiguration:e=>t.workspace.getConfiguration(e)}):e;this.services.workspace.ConfigurationProvider.initialized(n).catch(e=>console.error(`Error in ConfigurationProvider initialization:`,e)),this.services.workspace.WorkspaceManager.initialized(e).catch(e=>console.error(`Error in WorkspaceManager initialization:`,e))}},sl=class{getSymbolKind(e){return J.SymbolKind.Field}getCompletionItemKind(e){return J.CompletionItemKind.Reference}},cl=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,t,n){let r=e.parseResult.value.$cstNode;if(!r)return[];let i=_i(r,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);return i?this.getReferences(i,t,e):[]}getReferences(e,t,n){let r=[],i=this.references.findDeclaration(e);if(i){let e={includeDeclaration:t.context.includeDeclaration};this.references.findReferences(i,e).forEach(e=>{r.push(J.Location.create(e.sourceUri.toString(),e.segment.range))})}return r}};Ot();var ll=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,t,n){let r={},i=e.parseResult.value.$cstNode;if(!i)return;let a=_i(i,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(!a)return;let o=this.references.findDeclaration(a);if(o)return this.references.findReferences(o,{onlyLocal:!1,includeDeclaration:!0}).forEach(e=>{let n=L.replace(e.segment.range,t.newName),i=e.sourceUri.toString();r[i]?r[i].push(n):r[i]=[n]}),{changes:r}}prepareRename(e,t,n){return this.renameNodeRange(e,t.position)}renameNodeRange(e,t){let n=e.parseResult.value.$cstNode,r=e.textDocument.offsetAt(t);if(n&&r){let e=_i(n,r,this.grammarConfig.nameRegexp);if(!e)return;if(this.references.findDeclaration(e)||this.isNameNode(e))return e.range}}isNameNode(e){return e?.astNode&&as(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}},ul=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,t=Z.CancellationToken.None){let n=[],r=e.query.toLowerCase();for(let e of this.indexManager.allElements())if(await Q(t),this.fuzzyMatcher.match(r,e.name)){let t=this.getWorkspaceSymbol(e);t&&n.push(t)}return n}getWorkspaceSymbol(e){let t=e.nameSegment;if(t)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:t.range,uri:e.documentUri.toString()}}}},dl=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new J.Emitter,this._onDidOpen=new J.Emitter,this._onDidClose=new J.Emitter,this._onDidSave=new J.Emitter,this._onWillSave=new J.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(X.normalize(e))}set(e){let t=X.normalize(e.uri),n=!0;this._syncedDocuments.has(t)&&(n=!1),this._syncedDocuments.set(t,e);let r=Object.freeze({document:e});return this._onDidOpen.fire(r),this._onDidChangeContent.fire(r),n}delete(e){let t=X.normalize(typeof e==`object`&&`uri`in e?e.uri:e),n=this._syncedDocuments.get(t);n!==void 0&&(this._syncedDocuments.delete(t),this._onDidClose.fire(Object.freeze({document:n})))}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=J.TextDocumentSyncKind.Incremental;let t=[];return t.push(e.onDidOpenTextDocument(e=>{let t=e.textDocument,n=X.normalize(t.uri),r=this._configuration.create(n,t.languageId,t.version,t.text);this._syncedDocuments.set(n,r);let i=Object.freeze({document:r});this._onDidOpen.fire(i),this._onDidChangeContent.fire(i)})),t.push(e.onDidChangeTextDocument(e=>{let t=e.textDocument,n=e.contentChanges;if(n.length===0)return;let{version:r}=t;if(r==null)throw Error(`Received document change event for ${t.uri} without valid version identifier`);let i=X.normalize(t.uri),a=this._syncedDocuments.get(i);a!==void 0&&(a=this._configuration.update(a,n,r),this._syncedDocuments.set(i,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),t.push(e.onDidCloseTextDocument(e=>{let t=X.normalize(e.textDocument.uri),n=this._syncedDocuments.get(t);n!==void 0&&(this._syncedDocuments.delete(t),this._onDidClose.fire(Object.freeze({document:n})))})),t.push(e.onWillSaveTextDocument(e=>{let t=this._syncedDocuments.get(X.normalize(e.textDocument.uri));t!==void 0&&this._onWillSave.fire(Object.freeze({document:t,reason:e.reason}))})),t.push(e.onWillSaveTextDocumentWaitUntil((e,t)=>{let n=this._syncedDocuments.get(X.normalize(e.textDocument.uri));return n!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:n,reason:e.reason}),t):[]})),t.push(e.onDidSaveTextDocument(e=>{let t=this._syncedDocuments.get(X.normalize(e.textDocument.uri));t!==void 0&&this._onDidSave.fire(Object.freeze({document:t}))})),J.Disposable.create(()=>{t.forEach(e=>e.dispose())})}},fl=class{constructor(e){this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new J.Emitter,this._onDidSave=new J.Emitter,this._onDidChange=new J.Emitter,this._onDidClose=new J.Emitter,`listen`in e?this._cellTextDocuments=e:this._cellTextDocuments=new dl(e)}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(X.normalize(e))}getNotebookCell(e){let t=this.notebookCellMap.get(X.normalize(e));return t&&t[0]}findNotebookDocumentForCell(e){let t=typeof e==`string`||`scheme`in e?e:e.document,n=this.notebookCellMap.get(X.normalize(t));return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let t=new pl,n=[];return n.push(this.cellTextDocuments.listen(t)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(e=>{let n=X.normalize(e.notebookDocument.uri);this.notebookDocuments.set(n,e.notebookDocument);for(let n of e.cellTextDocuments)t.openTextDocument({textDocument:n});this.updateCellMap(e.notebookDocument),this._onDidOpen.fire(e.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(e=>{let n=X.normalize(e.notebookDocument.uri),r=this.notebookDocuments.get(n);if(r===void 0)return;r.version=e.notebookDocument.version;let i=r.metadata,a=!1,o=e.change;o.metadata!==void 0&&(a=!0,r.metadata=o.metadata);let s=[],c=[],l=[],u=[];if(o.cells!==void 0){let e=o.cells;if(e.structure!==void 0){let n=e.structure.array;if(r.cells.splice(n.start,n.deleteCount,...n.cells===void 0?[]:n.cells),e.structure.didOpen!==void 0)for(let n of e.structure.didOpen)t.openTextDocument({textDocument:n}),s.push(n.uri);if(e.structure.didClose)for(let n of e.structure.didClose)t.closeTextDocument({textDocument:n}),c.push(n.uri)}if(e.data!==void 0){let t=new Map(e.data.map(e=>[e.document,e]));for(let e=0;e<=r.cells.length;e++){let n=t.get(r.cells[e].document);if(n!==void 0){let i=r.cells.splice(e,1,n);if(l.push({old:i[0],new:n}),t.delete(n.document),t.size===0)break}}}if(e.textContent!==void 0)for(let n of e.textContent)t.changeTextDocument({textDocument:n.document,contentChanges:n.changes}),u.push(n.document.uri)}this.updateCellMap(r);let d={notebookDocument:r};a&&(d.metadata={old:i,new:r.metadata});let f=[];for(let e of s)f.push(this.getNotebookCell(e));let p=[];for(let e of c)p.push(this.getNotebookCell(e));let m=[];for(let e of u)m.push(this.getNotebookCell(e));(f.length>0||p.length>0||l.length>0||m.length>0)&&(d.cells={added:f,removed:p,changed:{data:l,textContent:m}}),(d.metadata!==void 0||d.cells!==void 0)&&this._onDidChange.fire(d)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(e=>{let t=this.getNotebookDocument(e.notebookDocument.uri);t!==void 0&&this._onDidSave.fire(t)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(e=>{let n=X.normalize(e.notebookDocument.uri),r=this.notebookDocuments.get(n);if(r!==void 0){this._onDidClose.fire(r);for(let n of e.cellTextDocuments)t.closeTextDocument({textDocument:n});this.notebookDocuments.delete(n);for(let e of r.cells)this.notebookCellMap.delete(e.document)}})),J.Disposable.create(()=>{n.forEach(e=>e.dispose())})}updateCellMap(e){for(let t of e.cells)this.notebookCellMap.set(t.document,[t,e])}},pl=class e{onDidOpenTextDocument(e){return this.openHandler=e,J.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,J.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,J.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return e.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return e.NULL_DISPOSE}onDidSaveTextDocument(){return e.NULL_DISPOSE}};pl.NULL_DISPOSE=Object.freeze({dispose:()=>{}});function ml(e){return Cs.merge(Rc(e),hl(e))}function hl(e){return{lsp:{CompletionProvider:e=>new Qa(e),DocumentSymbolProvider:e=>new Vc(e),HoverProvider:e=>new Zc(e),FoldingRangeProvider:e=>new Uc(e),ReferencesProvider:e=>new cl(e),DefinitionProvider:e=>new to(e),DocumentHighlightProvider:e=>new Bc(e),RenameProvider:e=>new ll(e)},shared:()=>e.shared}}function gl(e){return Cs.merge(zc(e),_l(e))}function _l(e){return{lsp:{Connection:()=>e.connection,LanguageServer:e=>new ol(e),DocumentUpdateHandler:e=>new Hc(e),WorkspaceSymbolProvider:e=>new ul(e),NodeKindProvider:()=>new sl,FuzzyMatcher:()=>new Wc},workspace:{TextDocuments:()=>new dl(Xo),NotebookDocuments:e=>new fl(e.workspace.TextDocuments)}}}var vl=class{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new yl(e,this.collector)}formatDocument(e,t){let n=e.parseResult;return n.lexerErrors.length===0&&n.parserErrors.length===0?this.doDocumentFormat(e,t.options):[]}isFormatRangeErrorFree(e,t){let n=e.parseResult;return n.lexerErrors.length||n.parserErrors.length?Math.min(...n.lexerErrors.map(e=>e.line??Number.MAX_VALUE),...n.parserErrors.map(e=>e.token.startLine??Number.MAX_VALUE))>t.end.line:!0}formatDocumentRange(e,t){return this.isFormatRangeErrorFree(e,t.range)?this.doDocumentFormat(e,t.options,t.range):[]}formatDocumentOnType(e,t){let n={start:{character:0,line:t.position.line},end:t.position};return this.isFormatRangeErrorFree(e,n)?this.doDocumentFormat(e,t.options,n):[]}get formatOnTypeOptions(){}doDocumentFormat(e,t,n){let r=new Map;this.collector=(e,t,n)=>{let i=this.nodeModeToKey(e,t),a=r.get(i),o=n.options.priority??0,s=a?.options.priority??0;(!a||s<=o)&&r.set(i,n)},this.iterateAstFormatting(e,n);let i=this.iterateCstFormatting(e,r,t,n);return this.avoidOverlappingEdits(e.textDocument,i)}avoidOverlappingEdits(e,t){let n=[];for(let r of t){let t=n[n.length-1];for(;t&&e.offsetAt(r.range.start)<e.offsetAt(t.range.end);)n.pop(),t=n[n.length-1];n.push(r)}return n.filter(t=>this.isNecessary(t,e))}iterateAstFormatting(e,t){let n=e.parseResult.value;this.format(n);let r=Pi(n).iterator(),i;do if(i=r.next(),!i.done){let e=i.value;this.insideRange(e.$cstNode.range,t)?this.format(e):r.prune()}while(!i.done)}nodeModeToKey(e,t){return`${e.offset}:${e.end}:${t}`}insideRange(e,t){return!t||e.start.line<=t.start.line&&e.end.line>=t.end.line||e.start.line>=t.start.line&&e.end.line<=t.end.line||e.start.line<=t.end.line&&e.end.line>=t.end.line}isNecessary(e,t){return e.newText!==t.getText(e.range).replace(/\r/g,``)}iterateCstFormatting(e,t,n,r){let i={indentation:0,options:n,document:e.textDocument},a=[],o=this.iterateCstTree(e,i).iterator(),s,c;do if(c=o.next(),!c.done){let e=c.value,n=kn(e),o=this.nodeModeToKey(e,`prepend`),l=t.get(o);if(t.delete(o),l){let t=this.createTextEdit(s,e,l,i);for(let e of t)e&&this.insideRange(e.range,r)&&a.push(e)}let u=this.nodeModeToKey(e,`append`),d=t.get(u);if(t.delete(u),d){let t=wi(e);if(t){let n=this.createTextEdit(e,t,d,i);for(let e of n)e&&this.insideRange(e.range,r)&&a.push(e)}}if(!l&&e.hidden){let t=this.createHiddenTextEdits(s,e,void 0,i);for(let e of t)e&&this.insideRange(e.range,r)&&a.push(e)}n&&(s=e)}while(!c.done);return a}createHiddenTextEdits(e,t,n,r){let i=t.range.start.line;if(e&&e.range.end.line===i)return[];let a=[],o={start:{character:0,line:i},end:t.range.start},s=r.document.getText(o),c=this.findFittingMove(o,n?.moves??[],r),l=this.getExistingIndentationCharacterCount(s,r),u=this.getIndentationCharacterCount(r,c)-l;if(u===0)return[];let d=``;u>0&&(d=(r.options.insertSpaces?` `:` `).repeat(u));let f=t.text.split(`
|
|
27
|
+
`);f[0]=s+f[0];for(let e=0;e<f.length;e++){let t=i+e,n={character:0,line:t};if(u>0)a.push({newText:d,range:{start:n,end:n}});else{let r=f[e],i=0;for(;i<r.length;i++){let e=r.charAt(i);if(e!==` `&&e!==` `)break}a.push({newText:``,range:{start:n,end:{line:t,character:Math.min(i,Math.abs(u))}}})}}return a}getExistingIndentationCharacterCount(e,t){let n=` `.repeat(t.options.tabSize);return(t.options.insertSpaces?e.replaceAll(` `,n):e.replaceAll(n,` `)).length}getIndentationCharacterCount(e,t){let n=e.indentation;return t&&t.tabs&&(n+=t.tabs),(e.options.insertSpaces?e.options.tabSize:1)*n}createTextEdit(e,t,n,r){if(t.hidden)return this.createHiddenTextEdits(e,t,n,r);if(e&&(e.range.end.line>t.range.start.line||e.range.end.line===t.range.start.line&&e.range.end.character>t.range.start.character))return[];let i={start:e?.range.end??{character:0,line:0},end:t.range.start},a=this.findFittingMove(i,n.moves,r);if(!a)return[];let o=a.characters,s=a.lines,c=a.tabs,l=r.indentation;r.indentation+=c??0;let u=[];return o===void 0?s===void 0?c!==void 0&&u.push(this.createTabTextEdit(i,!!e,r)):u.push(this.createLineTextEdit(i,s,r,n.options)):e?.hidden||u.push(this.createSpaceTextEdit(i,o,n.options)),kn(t)&&(r.indentation=l),u}createSpaceTextEdit(e,t,n){if(e.start.line===e.end.line){let r=e.end.character-e.start.character;t=this.fitIntoOptions(t,r,n)}return{newText:` `.repeat(t),range:e}}createLineTextEdit(e,t,n,r){let i=e.end.line-e.start.line;t=this.fitIntoOptions(t,i,r);let a=(n.options.insertSpaces?` `.repeat(n.options.tabSize):` `).repeat(n.indentation);return{newText:`${`
|
|
28
|
+
`.repeat(t)}${a}`,range:e}}createTabTextEdit(e,t,n){let r=(n.options.insertSpaces?` `.repeat(n.options.tabSize):` `).repeat(n.indentation),i=t?1:0,a=Math.max(e.end.line-e.start.line,i);return{newText:`${`
|
|
29
|
+
`.repeat(a)}${r}`,range:e}}fitIntoOptions(e,t,n){return n.allowMore?e=Math.max(t,e):n.allowLess&&(e=Math.min(t,e)),e}findFittingMove(e,t,n){if(t.length===0)return;if(t.length===1)return t[0];let r=e.end.line-e.start.line;for(let e of t)if(e.lines!==void 0&&r<=e.lines)return e;else if(e.lines===void 0&&r===0)return e;return t[t.length-1]}iterateCstTree(e,t){let n=e.parseResult.value.$cstNode;return n?new oi(n,e=>this.iterateCst(e,t)):ai}iterateCst(e,t){if(!On(e))return ai;let n=t.indentation;return new ni(()=>({index:0}),r=>r.index<e.content.length?{done:!1,value:e.content[r.index++]}:(t.indentation=n,G))}},yl=class{constructor(e,t){this.astNode=e,this.collector=t}node(e){return new bl(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let t=[];for(let n of e)n.$cstNode&&t.push(n.$cstNode);return new bl(t,this.collector)}property(e,t){let n=ca(this.astNode.$cstNode,e,t);return new bl(n?[n]:[],this.collector)}properties(...e){let t=[];for(let n of e){let e=sa(this.astNode.$cstNode,n);t.push(...e)}return new bl(t,this.collector)}keyword(e,t){let n=da(this.astNode.$cstNode,e,t);return new bl(n?[n]:[],this.collector)}keywords(...e){let t=[];for(let n of e){let e=ua(this.astNode.$cstNode,n);t.push(...e)}return new bl(t,this.collector)}cst(e){return new bl([...e],this.collector)}interior(e,t){let n=e.nodes,r=t.nodes;if(n.length!==1||r.length!==1)return new bl([],this.collector);let i=n[0],a=r[0];if(i.offset>a.offset){let e=i;i=a,a=e}return new bl(Ti(i,a),this.collector)}},bl=class e{constructor(e,t){this.nodes=e,this.collector=t}prepend(e){for(let t of this.nodes)this.collector(t,`prepend`,e);return this}append(e){for(let t of this.nodes)this.collector(t,`append`,e);return this}surround(e){for(let t of this.nodes)this.collector(t,`prepend`,e),this.collector(t,`append`,e);return this}slice(t,n){return new e(this.nodes.slice(t,n),this.collector)}},xl;(function(e){function t(...e){return{options:{},moves:e.flatMap(e=>e.moves).sort(l)}}e.fit=t;function n(e){return i(0,e)}e.noSpace=n;function r(e){return i(1,e)}e.oneSpace=r;function i(e,t){return{options:t??{},moves:[{characters:e}]}}e.spaces=i;function a(e){return o(1,e)}e.newLine=a;function o(e,t){return{options:t??{},moves:[{lines:e}]}}e.newLines=o;function s(e){return{options:e??{},moves:[{tabs:1,lines:1}]}}e.indent=s;function c(e){return{options:e??{},moves:[{tabs:0}]}}e.noIndent=c;function l(e,t){let n=e.lines??0,r=t.lines??0,i=e.tabs??0,a=t.tabs??0,o=e.characters??0,s=t.characters??0;return n<r?-1:n>r?1:i<a?-1:i>a?1:o<s?-1:o>s?1:0}})(xl||={});var Sl=class{constructor(){this.encoding=`utf-8`}readFile(e){return _.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await _.promises.readdir(e.fsPath,{withFileTypes:!0})).map(t=>({dirent:t,isFile:t.isFile(),isDirectory:t.isDirectory(),uri:X.joinPath(e,t.name)}))}};export{H as $,Q as A,$i as B,ds as C,as as D,os as E,Y as F,Pi as G,Ai as H,Qa as I,K as J,vi as K,da as L,Vo as M,Ho as N,ns as O,X as P,Dn as Q,ca as R,fs as S,cs as T,q as U,Oi as V,ji as W,Ir as X,Ar as Y,Hr as Z,ws as _,gl as a,F as at,_s as b,Xc as c,ct,kc as d,Ot as dt,Cn as et,Dc as f,k as ft,ac as g,hc as h,ml as i,Ie as it,qo as j,$ as k,Bc as l,Ye as lt,xc as m,vl as n,Fe as nt,ul as o,I as ot,Sc as p,ai as q,xl as r,me as rt,nl as s,lt as st,Sl as t,V as tt,Nc as u,L as ut,vs as v,us as w,ps as x,hs as y,sa as z};
|