acspec-parser 0.5.2 → 0.6.1

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/dist/cjs/main.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var ZA=Object.create;var Qu=Object.defineProperty;var ew=Object.getOwnPropertyDescriptor;var tw=Object.getOwnPropertyNames;var rw=Object.getPrototypeOf,nw=Object.prototype.hasOwnProperty;var G=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Kn=(t,e)=>{for(var r in e)Qu(t,r,{get:e[r],enumerable:!0})},Ju=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of tw(e))!nw.call(t,i)&&i!==r&&Qu(t,i,{get:()=>e[i],enumerable:!(n=ew(e,i))||n.enumerable});return t},ve=(t,e,r)=>(Ju(t,e,"default"),r&&Ju(r,e,"default")),Nr=(t,e,r)=>(r=t!=null?ZA(rw(t)):{},Ju(e||!t||!t.__esModule?Qu(r,"default",{value:t,enumerable:!0}):r,t)),iw=t=>Ju(Qu({},"__esModule",{value:!0}),t);var yi=G(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});var Pm;function Im(){if(Pm===void 0)throw new Error("No runtime abstraction layer installed");return Pm}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");Pm=r}t.install=e})(Im||(Im={}));Dm.default=Im});var ua=G(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.stringArray=Yt.array=Yt.func=Yt.error=Yt.number=Yt.string=Yt.boolean=void 0;function vF(t){return t===!0||t===!1}Yt.boolean=vF;function W_(t){return typeof t=="string"||t instanceof String}Yt.string=W_;function xF(t){return typeof t=="number"||t instanceof Number}Yt.number=xF;function TF(t){return t instanceof Error}Yt.error=TF;function RF(t){return typeof t=="function"}Yt.func=RF;function B_(t){return Array.isArray(t)}Yt.array=B_;function bF(t){return B_(t)&&t.every(e=>W_(e))}Yt.stringArray=bF});var oo=G(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.Emitter=la.Event=void 0;var _F=yi(),H_;(function(t){let e={dispose(){}};t.None=function(){return e}})(H_||(la.Event=H_={}));var Om=class{add(e,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,r)})}remove(e,r=null){if(!this._callbacks)return;let n=!1;for(let i=0,o=this._callbacks.length;i<o;i++)if(this._callbacks[i]===e)if(this._contexts[i]===r){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else n=!0;if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];let r=[],n=this._callbacks.slice(0),i=this._contexts.slice(0);for(let o=0,s=n.length;o<s;o++)try{r.push(n[o].apply(i[o],e))}catch(a){(0,_F.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},Dd=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,r,n)=>{this._callbacks||(this._callbacks=new Om),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,r);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,r),i.dispose=t._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};la.Emitter=Dd;Dd._noop=function(){}});var Bc=G(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.CancellationTokenSource=da.CancellationToken=void 0;var CF=yi(),SF=ua(),Lm=oo(),Od;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Lm.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Lm.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||SF.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(Od||(da.CancellationToken=Od={}));var kF=Object.freeze(function(t,e){let r=(0,CF.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),Ld=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?kF:(this._emitter||(this._emitter=new Lm.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Mm=class{get token(){return this._token||(this._token=new Ld),this._token}cancel(){this._token?this._token.cancel():this._token=Od.Cancelled}dispose(){this._token?this._token instanceof Ld&&this._token.dispose():this._token=Od.None}};da.CancellationTokenSource=Mm});var Yd=G(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.thenable=St.typedArray=St.stringArray=St.array=St.func=St.error=St.number=St.string=St.boolean=void 0;function HF(t){return t===!0||t===!1}St.boolean=HF;function lC(t){return typeof t=="string"||t instanceof String}St.string=lC;function GF(t){return typeof t=="number"||t instanceof Number}St.number=GF;function zF(t){return t instanceof Error}St.error=zF;function dC(t){return typeof t=="function"}St.func=dC;function fC(t){return Array.isArray(t)}St.array=fC;function VF(t){return fC(t)&&t.every(e=>lC(e))}St.stringArray=VF;function KF(t,e){return Array.isArray(t)&&t.every(e)}St.typedArray=KF;function XF(t){return t&&dC(t.then)}St.thenable=XF});var xg=G(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.Message=Y.NotificationType9=Y.NotificationType8=Y.NotificationType7=Y.NotificationType6=Y.NotificationType5=Y.NotificationType4=Y.NotificationType3=Y.NotificationType2=Y.NotificationType1=Y.NotificationType0=Y.NotificationType=Y.RequestType9=Y.RequestType8=Y.RequestType7=Y.RequestType6=Y.RequestType5=Y.RequestType4=Y.RequestType3=Y.RequestType2=Y.RequestType1=Y.RequestType=Y.RequestType0=Y.AbstractMessageSignature=Y.ParameterStructures=Y.ResponseError=Y.ErrorCodes=void 0;var po=ua(),Xm;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(Xm||(Y.ErrorCodes=Xm={}));var Ym=class t extends Error{constructor(e,r,n){super(r),this.code=po.number(e)?e:Xm.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,t.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};Y.ResponseError=Ym;var mr=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};Y.ParameterStructures=mr;mr.auto=new mr("auto");mr.byPosition=new mr("byPosition");mr.byName=new mr("byName");var Ke=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return mr.auto}};Y.AbstractMessageSignature=Ke;var Jm=class extends Ke{constructor(e){super(e,0)}};Y.RequestType0=Jm;var Qm=class extends Ke{constructor(e,r=mr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};Y.RequestType=Qm;var Zm=class extends Ke{constructor(e,r=mr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};Y.RequestType1=Zm;var eg=class extends Ke{constructor(e){super(e,2)}};Y.RequestType2=eg;var tg=class extends Ke{constructor(e){super(e,3)}};Y.RequestType3=tg;var rg=class extends Ke{constructor(e){super(e,4)}};Y.RequestType4=rg;var ng=class extends Ke{constructor(e){super(e,5)}};Y.RequestType5=ng;var ig=class extends Ke{constructor(e){super(e,6)}};Y.RequestType6=ig;var og=class extends Ke{constructor(e){super(e,7)}};Y.RequestType7=og;var sg=class extends Ke{constructor(e){super(e,8)}};Y.RequestType8=sg;var ag=class extends Ke{constructor(e){super(e,9)}};Y.RequestType9=ag;var cg=class extends Ke{constructor(e,r=mr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};Y.NotificationType=cg;var ug=class extends Ke{constructor(e){super(e,0)}};Y.NotificationType0=ug;var lg=class extends Ke{constructor(e,r=mr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};Y.NotificationType1=lg;var dg=class extends Ke{constructor(e){super(e,2)}};Y.NotificationType2=dg;var fg=class extends Ke{constructor(e){super(e,3)}};Y.NotificationType3=fg;var hg=class extends Ke{constructor(e){super(e,4)}};Y.NotificationType4=hg;var pg=class extends Ke{constructor(e){super(e,5)}};Y.NotificationType5=pg;var mg=class extends Ke{constructor(e){super(e,6)}};Y.NotificationType6=mg;var gg=class extends Ke{constructor(e){super(e,7)}};Y.NotificationType7=gg;var yg=class extends Ke{constructor(e){super(e,8)}};Y.NotificationType8=yg;var vg=class extends Ke{constructor(e){super(e,9)}};Y.NotificationType9=vg;var hC;(function(t){function e(i){let o=i;return o&&po.string(o.method)&&(po.string(o.id)||po.number(o.id))}t.isRequest=e;function r(i){let o=i;return o&&po.string(o.method)&&i.id===void 0}t.isNotification=r;function n(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(po.string(o.id)||po.number(o.id)||o.id===null)}t.isResponse=n})(hC||(Y.Message=hC={}))});var Rg=G(Ti=>{"use strict";var pC;Object.defineProperty(Ti,"__esModule",{value:!0});Ti.LRUCache=Ti.LinkedMap=Ti.Touch=void 0;var Jt;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(Jt||(Ti.Touch=Jt={}));var Jd=class{constructor(){this[pC]="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,r=Jt.None){let n=this._map.get(e);if(n)return r!==Jt.None&&this.touch(n,r),n.value}set(e,r,n=Jt.None){let i=this._map.get(e);if(i)i.value=r,n!==Jt.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case Jt.None:this.addItemLast(i);break;case Jt.First:this.addItemFirst(i);break;case Jt.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 r=this._map.get(e);if(r)return this._map.delete(e),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,r){let n=this._state,i=this._head;for(;i;){if(r?e.bind(r)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:r.key,done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:r.value,done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:[r.key,r.value],done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}[(pC=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>e;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.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 new 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 new 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 new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let r=e.next,n=e.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}e.next=void 0,e.previous=void 0,this._state++}touch(e,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==Jt.First&&r!==Jt.Last)){if(r===Jt.First){if(e===this._head)return;let n=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(r===Jt.Last){if(e===this._tail)return;let n=e.next,i=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((r,n)=>{e.push([n,r])}),e}fromJSON(e){this.clear();for(let[r,n]of e)this.set(r,n)}};Ti.LinkedMap=Jd;var Tg=class extends Jd{constructor(e,r=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,r),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,r=Jt.AsNew){return super.get(e,r)}peek(e){return super.get(e,Jt.None)}set(e,r){return super.set(e,r,Jt.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Ti.LRUCache=Tg});var gC=G(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.Disposable=void 0;var mC;(function(t){function e(r){return{dispose:r}}t.create=e})(mC||(Qd.Disposable=mC={}))});var yC=G(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.SharedArrayReceiverStrategy=va.SharedArraySenderStrategy=void 0;var YF=Bc(),Cu;(function(t){t.Continue=0,t.Cancelled=1})(Cu||(Cu={}));var bg=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let r=new SharedArrayBuffer(4),n=new Int32Array(r,0,1);n[0]=Cu.Continue,this.buffers.set(e.id,r),e.$cancellationData=r}async sendCancellation(e,r){let n=this.buffers.get(r);if(n===void 0)return;let i=new Int32Array(n,0,1);Atomics.store(i,0,Cu.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};va.SharedArraySenderStrategy=bg;var _g=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Cu.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Cg=class{constructor(e){this.token=new _g(e)}cancel(){}dispose(){}},Sg=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new YF.CancellationTokenSource:new Cg(r)}};va.SharedArrayReceiverStrategy=Sg});var Eg=G(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.Semaphore=void 0;var JF=yi(),kg=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((r,n)=>{this._waiting.push({thunk:e,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,JF.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 new Error("To many thunks active");try{let r=e.thunk();r instanceof Promise?r.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(r),this.runNext())}catch(r){this._active--,e.reject(r),this.runNext()}}};Zd.Semaphore=kg});var xC=G(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.ReadableStreamMessageReader=Ri.AbstractMessageReader=Ri.MessageReader=void 0;var wg=yi(),xa=ua(),Ag=oo(),QF=Eg(),vC;(function(t){function e(r){let n=r;return n&&xa.func(n.listen)&&xa.func(n.dispose)&&xa.func(n.onError)&&xa.func(n.onClose)&&xa.func(n.onPartialMessage)}t.is=e})(vC||(Ri.MessageReader=vC={}));var ef=class{constructor(){this.errorEmitter=new Ag.Emitter,this.closeEmitter=new Ag.Emitter,this.partialMessageEmitter=new Ag.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:new Error(`Reader received error. Reason: ${xa.string(e.message)?e.message:"unknown"}`)}};Ri.AbstractMessageReader=ef;var Ng;(function(t){function e(r){let n,i,o,s=new Map,a,c=new Map;if(r===void 0||typeof r=="string")n=r??"utf-8";else{if(n=r.charset??"utf-8",r.contentDecoder!==void 0&&(o=r.contentDecoder,s.set(o.name,o)),r.contentDecoders!==void 0)for(let u of r.contentDecoders)s.set(u.name,u);if(r.contentTypeDecoder!==void 0&&(a=r.contentTypeDecoder,c.set(a.name,a)),r.contentTypeDecoders!==void 0)for(let u of r.contentTypeDecoders)c.set(u.name,u)}return a===void 0&&(a=(0,wg.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:o,contentDecoders:s,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(Ng||(Ng={}));var Pg=class extends ef{constructor(e,r){super(),this.readable=e,this.options=Ng.fromOptions(r),this.buffer=(0,wg.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new QF.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 r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let i=n.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property.
2
- ${JSON.stringify(Object.fromEntries(n))}`));return}let o=parseInt(i);if(isNaN(o)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=o}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(r):r,i=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(i)}).catch(n=>{this.fireError(n)})}}catch(r){this.fireError(r)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,wg.default)().timer.setTimeout((e,r)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};Ri.ReadableStreamMessageReader=Pg});var CC=G(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.WriteableStreamMessageWriter=bi.AbstractMessageWriter=bi.MessageWriter=void 0;var TC=yi(),Su=ua(),ZF=Eg(),RC=oo(),e$="Content-Length: ",bC=`\r
3
- `,_C;(function(t){function e(r){let n=r;return n&&Su.func(n.dispose)&&Su.func(n.onClose)&&Su.func(n.onError)&&Su.func(n.write)}t.is=e})(_C||(bi.MessageWriter=_C={}));var tf=class{constructor(){this.errorEmitter=new RC.Emitter,this.closeEmitter=new RC.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,r,n){this.errorEmitter.fire([this.asError(e),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${Su.string(e.message)?e.message:"unknown"}`)}};bi.AbstractMessageWriter=tf;var Ig;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,TC.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,TC.default)().applicationJson.encoder}}t.fromOptions=e})(Ig||(Ig={}));var Dg=class extends tf{constructor(e,r){super(),this.writable=e,this.options=Ig.fromOptions(r),this.errorCount=0,this.writeSemaphore=new ZF.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let i=[];return i.push(e$,n.byteLength.toString(),bC),i.push(bC),this.doWrite(e,i,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){this.writable.end()}};bi.WriteableStreamMessageWriter=Dg});var SC=G(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.AbstractMessageBuffer=void 0;var t$=13,r$=10,n$=`\r
4
- `,Og=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let r=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let r=0,n=0,i=0,o=0;e:for(;n<this._chunks.length;){let u=this._chunks[n];for(i=0;i<u.length;){switch(u[i]){case t$:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case r$:switch(r){case 1:r=2;break;case 3:r=4,i++;break e;default:r=0}break;default:r=0}i++}o+=u.byteLength,n++}if(r!==4)return;let s=this._read(o+i),a=new Map,c=this.toString(s,"ascii").split(n$);if(c.length<2)return a;for(let u=0;u<c.length-2;u++){let l=c[u],h=l.indexOf(":");if(h===-1)throw new Error(`Message header must separate key and value using ':'
5
- ${l}`);let p=l.substr(0,h),y=l.substr(h+1).trim();a.set(e?p.toLowerCase():p,y)}return a}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 new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let o=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(o)}if(this._chunks[0].byteLength>e){let o=this._chunks[0],s=this.asNative(o,e);return this._chunks[0]=o.slice(e),this._totalLength-=e,s}let r=this.allocNative(e),n=0,i=0;for(;e>0;){let o=this._chunks[i];if(o.byteLength>e){let s=o.slice(0,e);r.set(s,n),n+=e,this._chunks[i]=o.slice(e),this._totalLength-=e,e-=e}else r.set(o,n),n+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,e-=o.byteLength}return r}};rf.AbstractMessageBuffer=Og});var NC=G(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.createMessageConnection=se.ConnectionOptions=se.MessageStrategy=se.CancellationStrategy=se.CancellationSenderStrategy=se.CancellationReceiverStrategy=se.RequestCancellationReceiverStrategy=se.IdCancellationReceiverStrategy=se.ConnectionStrategy=se.ConnectionError=se.ConnectionErrors=se.LogTraceNotification=se.SetTraceNotification=se.TraceFormat=se.TraceValues=se.Trace=se.NullLogger=se.ProgressType=se.ProgressToken=void 0;var kC=yi(),st=ua(),re=xg(),EC=Rg(),ku=oo(),Lg=Bc(),wu;(function(t){t.type=new re.NotificationType("$/cancelRequest")})(wu||(wu={}));var Mg;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(Mg||(se.ProgressToken=Mg={}));var Eu;(function(t){t.type=new re.NotificationType("$/progress")})(Eu||(Eu={}));var Fg=class{constructor(){}};se.ProgressType=Fg;var $g;(function(t){function e(r){return st.func(r)}t.is=e})($g||($g={}));se.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Ce;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(Ce||(se.Trace=Ce={}));var AC;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(AC||(se.TraceValues=AC={}));(function(t){function e(n){if(!st.string(n))return t.Off;switch(n=n.toLowerCase(),n){case"off":return t.Off;case"messages":return t.Messages;case"compact":return t.Compact;case"verbose":return t.Verbose;default:return t.Off}}t.fromString=e;function r(n){switch(n){case t.Off:return"off";case t.Messages:return"messages";case t.Compact:return"compact";case t.Verbose:return"verbose";default:return"off"}}t.toString=r})(Ce||(se.Trace=Ce={}));var Er;(function(t){t.Text="text",t.JSON="json"})(Er||(se.TraceFormat=Er={}));(function(t){function e(r){return st.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(Er||(se.TraceFormat=Er={}));var qg;(function(t){t.type=new re.NotificationType("$/setTrace")})(qg||(se.SetTraceNotification=qg={}));var nf;(function(t){t.type=new re.NotificationType("$/logTrace")})(nf||(se.LogTraceNotification=nf={}));var Au;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(Au||(se.ConnectionErrors=Au={}));var Ta=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};se.ConnectionError=Ta;var jg;(function(t){function e(r){let n=r;return n&&st.func(n.cancelUndispatched)}t.is=e})(jg||(se.ConnectionStrategy=jg={}));var of;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&st.func(n.createCancellationTokenSource)&&(n.dispose===void 0||st.func(n.dispose))}t.is=e})(of||(se.IdCancellationReceiverStrategy=of={}));var Ug;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&st.func(n.createCancellationTokenSource)&&(n.dispose===void 0||st.func(n.dispose))}t.is=e})(Ug||(se.RequestCancellationReceiverStrategy=Ug={}));var sf;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new Lg.CancellationTokenSource}});function e(r){return of.is(r)||Ug.is(r)}t.is=e})(sf||(se.CancellationReceiverStrategy=sf={}));var af;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(wu.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&st.func(n.sendCancellation)&&st.func(n.cleanup)}t.is=e})(af||(se.CancellationSenderStrategy=af={}));var cf;(function(t){t.Message=Object.freeze({receiver:sf.Message,sender:af.Message});function e(r){let n=r;return n&&sf.is(n.receiver)&&af.is(n.sender)}t.is=e})(cf||(se.CancellationStrategy=cf={}));var uf;(function(t){function e(r){let n=r;return n&&st.func(n.handleMessage)}t.is=e})(uf||(se.MessageStrategy=uf={}));var wC;(function(t){function e(r){let n=r;return n&&(cf.is(n.cancellationStrategy)||jg.is(n.connectionStrategy)||uf.is(n.messageStrategy))}t.is=e})(wC||(se.ConnectionOptions=wC={}));var Jr;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(Jr||(Jr={}));function i$(t,e,r,n){let i=r!==void 0?r:se.NullLogger,o=0,s=0,a=0,c="2.0",u,l=new Map,h,p=new Map,y=new Map,_,E=new EC.LinkedMap,D=new Map,w=new Set,x=new Map,g=Ce.Off,A=Er.Text,M,te=Jr.New,_e=new ku.Emitter,Se=new ku.Emitter,Nt=new ku.Emitter,xt=new ku.Emitter,$=new ku.Emitter,I=n&&n.cancellationStrategy?n.cancellationStrategy:cf.Message;function z(T){if(T===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+T.toString()}function W(T){return T===null?"res-unknown-"+(++a).toString():"res-"+T.toString()}function le(){return"not-"+(++s).toString()}function Z(T,O){re.Message.isRequest(O)?T.set(z(O.id),O):re.Message.isResponse(O)?T.set(W(O.id),O):T.set(le(),O)}function Q(T){}function at(){return te===Jr.Listening}function B(){return te===Jr.Closed}function N(){return te===Jr.Disposed}function ke(){(te===Jr.New||te===Jr.Listening)&&(te=Jr.Closed,Se.fire(void 0))}function en(T){_e.fire([T,void 0,void 0])}function bo(T){_e.fire(T)}t.onClose(ke),t.onError(en),e.onClose(ke),e.onError(bo);function zn(){_||E.size===0||(_=(0,kC.default)().timer.setImmediate(()=>{_=void 0,Pi()}))}function qt(T){re.Message.isRequest(T)?jt(T):re.Message.isNotification(T)?Pt(T):re.Message.isResponse(T)?Wr(T):Gt(T)}function Pi(){if(E.size===0)return;let T=E.shift();try{let O=n?.messageStrategy;uf.is(O)?O.handleMessage(T,qt):qt(T)}finally{zn()}}let pt=T=>{try{if(re.Message.isNotification(T)&&T.method===wu.type.method){let O=T.params.id,q=z(O),K=E.get(q);if(re.Message.isRequest(K)){let Ee=n?.connectionStrategy,He=Ee&&Ee.cancelUndispatched?Ee.cancelUndispatched(K,Q):void 0;if(He&&(He.error!==void 0||He.result!==void 0)){E.delete(q),x.delete(O),He.id=K.id,Br(He,T.method,Date.now()),e.write(He).catch(()=>i.error("Sending response for canceled message failed."));return}}let Ne=x.get(O);if(Ne!==void 0){Ne.cancel(),_o(T);return}else w.add(O)}Z(E,T)}finally{zn()}};function jt(T){if(N())return;function O(de,Ie,xe){let ct={jsonrpc:c,id:T.id};de instanceof re.ResponseError?ct.error=de.toJson():ct.result=de===void 0?null:de,Br(ct,Ie,xe),e.write(ct).catch(()=>i.error("Sending response failed."))}function q(de,Ie,xe){let ct={jsonrpc:c,id:T.id,error:de.toJson()};Br(ct,Ie,xe),e.write(ct).catch(()=>i.error("Sending response failed."))}function K(de,Ie,xe){de===void 0&&(de=null);let ct={jsonrpc:c,id:T.id,result:de};Br(ct,Ie,xe),e.write(ct).catch(()=>i.error("Sending response failed."))}Ii(T);let Ne=l.get(T.method),Ee,He;Ne&&(Ee=Ne.type,He=Ne.handler);let Xe=Date.now();if(He||u){let de=T.id??String(Date.now()),Ie=of.is(I.receiver)?I.receiver.createCancellationTokenSource(de):I.receiver.createCancellationTokenSource(T);T.id!==null&&w.has(T.id)&&Ie.cancel(),T.id!==null&&x.set(de,Ie);try{let xe;if(He)if(T.params===void 0){if(Ee!==void 0&&Ee.numberOfParams!==0){q(new re.ResponseError(re.ErrorCodes.InvalidParams,`Request ${T.method} defines ${Ee.numberOfParams} params but received none.`),T.method,Xe);return}xe=He(Ie.token)}else if(Array.isArray(T.params)){if(Ee!==void 0&&Ee.parameterStructures===re.ParameterStructures.byName){q(new re.ResponseError(re.ErrorCodes.InvalidParams,`Request ${T.method} defines parameters by name but received parameters by position`),T.method,Xe);return}xe=He(...T.params,Ie.token)}else{if(Ee!==void 0&&Ee.parameterStructures===re.ParameterStructures.byPosition){q(new re.ResponseError(re.ErrorCodes.InvalidParams,`Request ${T.method} defines parameters by position but received parameters by name`),T.method,Xe);return}xe=He(T.params,Ie.token)}else u&&(xe=u(T.method,T.params,Ie.token));let ct=xe;xe?ct.then?ct.then(It=>{x.delete(de),O(It,T.method,Xe)},It=>{x.delete(de),It instanceof re.ResponseError?q(It,T.method,Xe):It&&st.string(It.message)?q(new re.ResponseError(re.ErrorCodes.InternalError,`Request ${T.method} failed with message: ${It.message}`),T.method,Xe):q(new re.ResponseError(re.ErrorCodes.InternalError,`Request ${T.method} failed unexpectedly without providing any details.`),T.method,Xe)}):(x.delete(de),O(xe,T.method,Xe)):(x.delete(de),K(xe,T.method,Xe))}catch(xe){x.delete(de),xe instanceof re.ResponseError?O(xe,T.method,Xe):xe&&st.string(xe.message)?q(new re.ResponseError(re.ErrorCodes.InternalError,`Request ${T.method} failed with message: ${xe.message}`),T.method,Xe):q(new re.ResponseError(re.ErrorCodes.InternalError,`Request ${T.method} failed unexpectedly without providing any details.`),T.method,Xe)}}else q(new re.ResponseError(re.ErrorCodes.MethodNotFound,`Unhandled method ${T.method}`),T.method,Xe)}function Wr(T){if(!N())if(T.id===null)T.error?i.error(`Received response message without id: Error is:
1
+ "use strict";var ew=Object.create;var Qu=Object.defineProperty;var tw=Object.getOwnPropertyDescriptor;var rw=Object.getOwnPropertyNames;var nw=Object.getPrototypeOf,iw=Object.prototype.hasOwnProperty;var G=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Kn=(t,e)=>{for(var r in e)Qu(t,r,{get:e[r],enumerable:!0})},Ju=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rw(e))!iw.call(t,i)&&i!==r&&Qu(t,i,{get:()=>e[i],enumerable:!(n=tw(e,i))||n.enumerable});return t},ve=(t,e,r)=>(Ju(t,e,"default"),r&&Ju(r,e,"default")),Nr=(t,e,r)=>(r=t!=null?ew(nw(t)):{},Ju(e||!t||!t.__esModule?Qu(r,"default",{value:t,enumerable:!0}):r,t)),ow=t=>Ju(Qu({},"__esModule",{value:!0}),t);var yi=G(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});var Pm;function Im(){if(Pm===void 0)throw new Error("No runtime abstraction layer installed");return Pm}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");Pm=r}t.install=e})(Im||(Im={}));Dm.default=Im});var ua=G(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.stringArray=Yt.array=Yt.func=Yt.error=Yt.number=Yt.string=Yt.boolean=void 0;function xF(t){return t===!0||t===!1}Yt.boolean=xF;function W_(t){return typeof t=="string"||t instanceof String}Yt.string=W_;function TF(t){return typeof t=="number"||t instanceof Number}Yt.number=TF;function RF(t){return t instanceof Error}Yt.error=RF;function bF(t){return typeof t=="function"}Yt.func=bF;function B_(t){return Array.isArray(t)}Yt.array=B_;function _F(t){return B_(t)&&t.every(e=>W_(e))}Yt.stringArray=_F});var oo=G(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.Emitter=la.Event=void 0;var CF=yi(),H_;(function(t){let e={dispose(){}};t.None=function(){return e}})(H_||(la.Event=H_={}));var Om=class{add(e,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,r)})}remove(e,r=null){if(!this._callbacks)return;let n=!1;for(let i=0,o=this._callbacks.length;i<o;i++)if(this._callbacks[i]===e)if(this._contexts[i]===r){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else n=!0;if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];let r=[],n=this._callbacks.slice(0),i=this._contexts.slice(0);for(let o=0,s=n.length;o<s;o++)try{r.push(n[o].apply(i[o],e))}catch(a){(0,CF.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},Dd=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,r,n)=>{this._callbacks||(this._callbacks=new Om),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,r);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,r),i.dispose=t._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};la.Emitter=Dd;Dd._noop=function(){}});var Bc=G(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.CancellationTokenSource=da.CancellationToken=void 0;var SF=yi(),kF=ua(),Lm=oo(),Od;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Lm.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Lm.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||kF.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(Od||(da.CancellationToken=Od={}));var EF=Object.freeze(function(t,e){let r=(0,SF.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),Ld=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?EF:(this._emitter||(this._emitter=new Lm.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Mm=class{get token(){return this._token||(this._token=new Ld),this._token}cancel(){this._token?this._token.cancel():this._token=Od.Cancelled}dispose(){this._token?this._token instanceof Ld&&this._token.dispose():this._token=Od.None}};da.CancellationTokenSource=Mm});var Yd=G(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.thenable=St.typedArray=St.stringArray=St.array=St.func=St.error=St.number=St.string=St.boolean=void 0;function GF(t){return t===!0||t===!1}St.boolean=GF;function lC(t){return typeof t=="string"||t instanceof String}St.string=lC;function zF(t){return typeof t=="number"||t instanceof Number}St.number=zF;function VF(t){return t instanceof Error}St.error=VF;function dC(t){return typeof t=="function"}St.func=dC;function fC(t){return Array.isArray(t)}St.array=fC;function KF(t){return fC(t)&&t.every(e=>lC(e))}St.stringArray=KF;function XF(t,e){return Array.isArray(t)&&t.every(e)}St.typedArray=XF;function YF(t){return t&&dC(t.then)}St.thenable=YF});var xg=G(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.Message=Y.NotificationType9=Y.NotificationType8=Y.NotificationType7=Y.NotificationType6=Y.NotificationType5=Y.NotificationType4=Y.NotificationType3=Y.NotificationType2=Y.NotificationType1=Y.NotificationType0=Y.NotificationType=Y.RequestType9=Y.RequestType8=Y.RequestType7=Y.RequestType6=Y.RequestType5=Y.RequestType4=Y.RequestType3=Y.RequestType2=Y.RequestType1=Y.RequestType=Y.RequestType0=Y.AbstractMessageSignature=Y.ParameterStructures=Y.ResponseError=Y.ErrorCodes=void 0;var po=ua(),Xm;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(Xm||(Y.ErrorCodes=Xm={}));var Ym=class t extends Error{constructor(e,r,n){super(r),this.code=po.number(e)?e:Xm.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,t.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};Y.ResponseError=Ym;var mr=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};Y.ParameterStructures=mr;mr.auto=new mr("auto");mr.byPosition=new mr("byPosition");mr.byName=new mr("byName");var Ke=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return mr.auto}};Y.AbstractMessageSignature=Ke;var Jm=class extends Ke{constructor(e){super(e,0)}};Y.RequestType0=Jm;var Qm=class extends Ke{constructor(e,r=mr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};Y.RequestType=Qm;var Zm=class extends Ke{constructor(e,r=mr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};Y.RequestType1=Zm;var eg=class extends Ke{constructor(e){super(e,2)}};Y.RequestType2=eg;var tg=class extends Ke{constructor(e){super(e,3)}};Y.RequestType3=tg;var rg=class extends Ke{constructor(e){super(e,4)}};Y.RequestType4=rg;var ng=class extends Ke{constructor(e){super(e,5)}};Y.RequestType5=ng;var ig=class extends Ke{constructor(e){super(e,6)}};Y.RequestType6=ig;var og=class extends Ke{constructor(e){super(e,7)}};Y.RequestType7=og;var sg=class extends Ke{constructor(e){super(e,8)}};Y.RequestType8=sg;var ag=class extends Ke{constructor(e){super(e,9)}};Y.RequestType9=ag;var cg=class extends Ke{constructor(e,r=mr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};Y.NotificationType=cg;var ug=class extends Ke{constructor(e){super(e,0)}};Y.NotificationType0=ug;var lg=class extends Ke{constructor(e,r=mr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};Y.NotificationType1=lg;var dg=class extends Ke{constructor(e){super(e,2)}};Y.NotificationType2=dg;var fg=class extends Ke{constructor(e){super(e,3)}};Y.NotificationType3=fg;var hg=class extends Ke{constructor(e){super(e,4)}};Y.NotificationType4=hg;var pg=class extends Ke{constructor(e){super(e,5)}};Y.NotificationType5=pg;var mg=class extends Ke{constructor(e){super(e,6)}};Y.NotificationType6=mg;var gg=class extends Ke{constructor(e){super(e,7)}};Y.NotificationType7=gg;var yg=class extends Ke{constructor(e){super(e,8)}};Y.NotificationType8=yg;var vg=class extends Ke{constructor(e){super(e,9)}};Y.NotificationType9=vg;var hC;(function(t){function e(i){let o=i;return o&&po.string(o.method)&&(po.string(o.id)||po.number(o.id))}t.isRequest=e;function r(i){let o=i;return o&&po.string(o.method)&&i.id===void 0}t.isNotification=r;function n(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(po.string(o.id)||po.number(o.id)||o.id===null)}t.isResponse=n})(hC||(Y.Message=hC={}))});var Rg=G(Ti=>{"use strict";var pC;Object.defineProperty(Ti,"__esModule",{value:!0});Ti.LRUCache=Ti.LinkedMap=Ti.Touch=void 0;var Jt;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(Jt||(Ti.Touch=Jt={}));var Jd=class{constructor(){this[pC]="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,r=Jt.None){let n=this._map.get(e);if(n)return r!==Jt.None&&this.touch(n,r),n.value}set(e,r,n=Jt.None){let i=this._map.get(e);if(i)i.value=r,n!==Jt.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case Jt.None:this.addItemLast(i);break;case Jt.First:this.addItemFirst(i);break;case Jt.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 r=this._map.get(e);if(r)return this._map.delete(e),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,r){let n=this._state,i=this._head;for(;i;){if(r?e.bind(r)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:r.key,done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:r.value,done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let i={value:[r.key,r.value],done:!1};return r=r.next,i}else return{value:void 0,done:!0}}};return n}[(pC=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>e;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.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 new 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 new 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 new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let r=e.next,n=e.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}e.next=void 0,e.previous=void 0,this._state++}touch(e,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==Jt.First&&r!==Jt.Last)){if(r===Jt.First){if(e===this._head)return;let n=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(r===Jt.Last){if(e===this._tail)return;let n=e.next,i=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((r,n)=>{e.push([n,r])}),e}fromJSON(e){this.clear();for(let[r,n]of e)this.set(r,n)}};Ti.LinkedMap=Jd;var Tg=class extends Jd{constructor(e,r=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,r),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,r=Jt.AsNew){return super.get(e,r)}peek(e){return super.get(e,Jt.None)}set(e,r){return super.set(e,r,Jt.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Ti.LRUCache=Tg});var gC=G(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.Disposable=void 0;var mC;(function(t){function e(r){return{dispose:r}}t.create=e})(mC||(Qd.Disposable=mC={}))});var yC=G(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.SharedArrayReceiverStrategy=va.SharedArraySenderStrategy=void 0;var JF=Bc(),Cu;(function(t){t.Continue=0,t.Cancelled=1})(Cu||(Cu={}));var bg=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let r=new SharedArrayBuffer(4),n=new Int32Array(r,0,1);n[0]=Cu.Continue,this.buffers.set(e.id,r),e.$cancellationData=r}async sendCancellation(e,r){let n=this.buffers.get(r);if(n===void 0)return;let i=new Int32Array(n,0,1);Atomics.store(i,0,Cu.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};va.SharedArraySenderStrategy=bg;var _g=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Cu.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Cg=class{constructor(e){this.token=new _g(e)}cancel(){}dispose(){}},Sg=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new JF.CancellationTokenSource:new Cg(r)}};va.SharedArrayReceiverStrategy=Sg});var Eg=G(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.Semaphore=void 0;var QF=yi(),kg=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((r,n)=>{this._waiting.push({thunk:e,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,QF.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 new Error("To many thunks active");try{let r=e.thunk();r instanceof Promise?r.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(r),this.runNext())}catch(r){this._active--,e.reject(r),this.runNext()}}};Zd.Semaphore=kg});var xC=G(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.ReadableStreamMessageReader=Ri.AbstractMessageReader=Ri.MessageReader=void 0;var wg=yi(),xa=ua(),Ag=oo(),ZF=Eg(),vC;(function(t){function e(r){let n=r;return n&&xa.func(n.listen)&&xa.func(n.dispose)&&xa.func(n.onError)&&xa.func(n.onClose)&&xa.func(n.onPartialMessage)}t.is=e})(vC||(Ri.MessageReader=vC={}));var ef=class{constructor(){this.errorEmitter=new Ag.Emitter,this.closeEmitter=new Ag.Emitter,this.partialMessageEmitter=new Ag.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:new Error(`Reader received error. Reason: ${xa.string(e.message)?e.message:"unknown"}`)}};Ri.AbstractMessageReader=ef;var Ng;(function(t){function e(r){let n,i,o,s=new Map,a,c=new Map;if(r===void 0||typeof r=="string")n=r??"utf-8";else{if(n=r.charset??"utf-8",r.contentDecoder!==void 0&&(o=r.contentDecoder,s.set(o.name,o)),r.contentDecoders!==void 0)for(let u of r.contentDecoders)s.set(u.name,u);if(r.contentTypeDecoder!==void 0&&(a=r.contentTypeDecoder,c.set(a.name,a)),r.contentTypeDecoders!==void 0)for(let u of r.contentTypeDecoders)c.set(u.name,u)}return a===void 0&&(a=(0,wg.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:o,contentDecoders:s,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(Ng||(Ng={}));var Pg=class extends ef{constructor(e,r){super(),this.readable=e,this.options=Ng.fromOptions(r),this.buffer=(0,wg.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new ZF.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 r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let i=n.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property.
2
+ ${JSON.stringify(Object.fromEntries(n))}`));return}let o=parseInt(i);if(isNaN(o)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=o}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(r):r,i=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(i)}).catch(n=>{this.fireError(n)})}}catch(r){this.fireError(r)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,wg.default)().timer.setTimeout((e,r)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};Ri.ReadableStreamMessageReader=Pg});var CC=G(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.WriteableStreamMessageWriter=bi.AbstractMessageWriter=bi.MessageWriter=void 0;var TC=yi(),Su=ua(),e$=Eg(),RC=oo(),t$="Content-Length: ",bC=`\r
3
+ `,_C;(function(t){function e(r){let n=r;return n&&Su.func(n.dispose)&&Su.func(n.onClose)&&Su.func(n.onError)&&Su.func(n.write)}t.is=e})(_C||(bi.MessageWriter=_C={}));var tf=class{constructor(){this.errorEmitter=new RC.Emitter,this.closeEmitter=new RC.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,r,n){this.errorEmitter.fire([this.asError(e),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${Su.string(e.message)?e.message:"unknown"}`)}};bi.AbstractMessageWriter=tf;var Ig;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,TC.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,TC.default)().applicationJson.encoder}}t.fromOptions=e})(Ig||(Ig={}));var Dg=class extends tf{constructor(e,r){super(),this.writable=e,this.options=Ig.fromOptions(r),this.errorCount=0,this.writeSemaphore=new e$.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let i=[];return i.push(t$,n.byteLength.toString(),bC),i.push(bC),this.doWrite(e,i,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){this.writable.end()}};bi.WriteableStreamMessageWriter=Dg});var SC=G(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.AbstractMessageBuffer=void 0;var r$=13,n$=10,i$=`\r
4
+ `,Og=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let r=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let r=0,n=0,i=0,o=0;e:for(;n<this._chunks.length;){let u=this._chunks[n];for(i=0;i<u.length;){switch(u[i]){case r$:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case n$:switch(r){case 1:r=2;break;case 3:r=4,i++;break e;default:r=0}break;default:r=0}i++}o+=u.byteLength,n++}if(r!==4)return;let s=this._read(o+i),a=new Map,c=this.toString(s,"ascii").split(i$);if(c.length<2)return a;for(let u=0;u<c.length-2;u++){let l=c[u],h=l.indexOf(":");if(h===-1)throw new Error(`Message header must separate key and value using ':'
5
+ ${l}`);let p=l.substr(0,h),y=l.substr(h+1).trim();a.set(e?p.toLowerCase():p,y)}return a}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 new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let o=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(o)}if(this._chunks[0].byteLength>e){let o=this._chunks[0],s=this.asNative(o,e);return this._chunks[0]=o.slice(e),this._totalLength-=e,s}let r=this.allocNative(e),n=0,i=0;for(;e>0;){let o=this._chunks[i];if(o.byteLength>e){let s=o.slice(0,e);r.set(s,n),n+=e,this._chunks[i]=o.slice(e),this._totalLength-=e,e-=e}else r.set(o,n),n+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,e-=o.byteLength}return r}};rf.AbstractMessageBuffer=Og});var NC=G(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.createMessageConnection=se.ConnectionOptions=se.MessageStrategy=se.CancellationStrategy=se.CancellationSenderStrategy=se.CancellationReceiverStrategy=se.RequestCancellationReceiverStrategy=se.IdCancellationReceiverStrategy=se.ConnectionStrategy=se.ConnectionError=se.ConnectionErrors=se.LogTraceNotification=se.SetTraceNotification=se.TraceFormat=se.TraceValues=se.Trace=se.NullLogger=se.ProgressType=se.ProgressToken=void 0;var kC=yi(),st=ua(),re=xg(),EC=Rg(),ku=oo(),Lg=Bc(),wu;(function(t){t.type=new re.NotificationType("$/cancelRequest")})(wu||(wu={}));var Mg;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(Mg||(se.ProgressToken=Mg={}));var Eu;(function(t){t.type=new re.NotificationType("$/progress")})(Eu||(Eu={}));var Fg=class{constructor(){}};se.ProgressType=Fg;var $g;(function(t){function e(r){return st.func(r)}t.is=e})($g||($g={}));se.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Ce;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(Ce||(se.Trace=Ce={}));var AC;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(AC||(se.TraceValues=AC={}));(function(t){function e(n){if(!st.string(n))return t.Off;switch(n=n.toLowerCase(),n){case"off":return t.Off;case"messages":return t.Messages;case"compact":return t.Compact;case"verbose":return t.Verbose;default:return t.Off}}t.fromString=e;function r(n){switch(n){case t.Off:return"off";case t.Messages:return"messages";case t.Compact:return"compact";case t.Verbose:return"verbose";default:return"off"}}t.toString=r})(Ce||(se.Trace=Ce={}));var Er;(function(t){t.Text="text",t.JSON="json"})(Er||(se.TraceFormat=Er={}));(function(t){function e(r){return st.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(Er||(se.TraceFormat=Er={}));var qg;(function(t){t.type=new re.NotificationType("$/setTrace")})(qg||(se.SetTraceNotification=qg={}));var nf;(function(t){t.type=new re.NotificationType("$/logTrace")})(nf||(se.LogTraceNotification=nf={}));var Au;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(Au||(se.ConnectionErrors=Au={}));var Ta=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};se.ConnectionError=Ta;var jg;(function(t){function e(r){let n=r;return n&&st.func(n.cancelUndispatched)}t.is=e})(jg||(se.ConnectionStrategy=jg={}));var of;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&st.func(n.createCancellationTokenSource)&&(n.dispose===void 0||st.func(n.dispose))}t.is=e})(of||(se.IdCancellationReceiverStrategy=of={}));var Ug;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&st.func(n.createCancellationTokenSource)&&(n.dispose===void 0||st.func(n.dispose))}t.is=e})(Ug||(se.RequestCancellationReceiverStrategy=Ug={}));var sf;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new Lg.CancellationTokenSource}});function e(r){return of.is(r)||Ug.is(r)}t.is=e})(sf||(se.CancellationReceiverStrategy=sf={}));var af;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(wu.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&st.func(n.sendCancellation)&&st.func(n.cleanup)}t.is=e})(af||(se.CancellationSenderStrategy=af={}));var cf;(function(t){t.Message=Object.freeze({receiver:sf.Message,sender:af.Message});function e(r){let n=r;return n&&sf.is(n.receiver)&&af.is(n.sender)}t.is=e})(cf||(se.CancellationStrategy=cf={}));var uf;(function(t){function e(r){let n=r;return n&&st.func(n.handleMessage)}t.is=e})(uf||(se.MessageStrategy=uf={}));var wC;(function(t){function e(r){let n=r;return n&&(cf.is(n.cancellationStrategy)||jg.is(n.connectionStrategy)||uf.is(n.messageStrategy))}t.is=e})(wC||(se.ConnectionOptions=wC={}));var Jr;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(Jr||(Jr={}));function o$(t,e,r,n){let i=r!==void 0?r:se.NullLogger,o=0,s=0,a=0,c="2.0",u,l=new Map,h,p=new Map,y=new Map,_,E=new EC.LinkedMap,D=new Map,w=new Set,x=new Map,g=Ce.Off,A=Er.Text,M,te=Jr.New,_e=new ku.Emitter,Se=new ku.Emitter,Nt=new ku.Emitter,xt=new ku.Emitter,$=new ku.Emitter,I=n&&n.cancellationStrategy?n.cancellationStrategy:cf.Message;function z(T){if(T===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+T.toString()}function W(T){return T===null?"res-unknown-"+(++a).toString():"res-"+T.toString()}function le(){return"not-"+(++s).toString()}function Z(T,O){re.Message.isRequest(O)?T.set(z(O.id),O):re.Message.isResponse(O)?T.set(W(O.id),O):T.set(le(),O)}function Q(T){}function at(){return te===Jr.Listening}function B(){return te===Jr.Closed}function N(){return te===Jr.Disposed}function ke(){(te===Jr.New||te===Jr.Listening)&&(te=Jr.Closed,Se.fire(void 0))}function en(T){_e.fire([T,void 0,void 0])}function bo(T){_e.fire(T)}t.onClose(ke),t.onError(en),e.onClose(ke),e.onError(bo);function zn(){_||E.size===0||(_=(0,kC.default)().timer.setImmediate(()=>{_=void 0,Pi()}))}function qt(T){re.Message.isRequest(T)?jt(T):re.Message.isNotification(T)?Pt(T):re.Message.isResponse(T)?Wr(T):Gt(T)}function Pi(){if(E.size===0)return;let T=E.shift();try{let O=n?.messageStrategy;uf.is(O)?O.handleMessage(T,qt):qt(T)}finally{zn()}}let pt=T=>{try{if(re.Message.isNotification(T)&&T.method===wu.type.method){let O=T.params.id,q=z(O),K=E.get(q);if(re.Message.isRequest(K)){let Ee=n?.connectionStrategy,He=Ee&&Ee.cancelUndispatched?Ee.cancelUndispatched(K,Q):void 0;if(He&&(He.error!==void 0||He.result!==void 0)){E.delete(q),x.delete(O),He.id=K.id,Br(He,T.method,Date.now()),e.write(He).catch(()=>i.error("Sending response for canceled message failed."));return}}let Ne=x.get(O);if(Ne!==void 0){Ne.cancel(),_o(T);return}else w.add(O)}Z(E,T)}finally{zn()}};function jt(T){if(N())return;function O(de,Ie,xe){let ct={jsonrpc:c,id:T.id};de instanceof re.ResponseError?ct.error=de.toJson():ct.result=de===void 0?null:de,Br(ct,Ie,xe),e.write(ct).catch(()=>i.error("Sending response failed."))}function q(de,Ie,xe){let ct={jsonrpc:c,id:T.id,error:de.toJson()};Br(ct,Ie,xe),e.write(ct).catch(()=>i.error("Sending response failed."))}function K(de,Ie,xe){de===void 0&&(de=null);let ct={jsonrpc:c,id:T.id,result:de};Br(ct,Ie,xe),e.write(ct).catch(()=>i.error("Sending response failed."))}Ii(T);let Ne=l.get(T.method),Ee,He;Ne&&(Ee=Ne.type,He=Ne.handler);let Xe=Date.now();if(He||u){let de=T.id??String(Date.now()),Ie=of.is(I.receiver)?I.receiver.createCancellationTokenSource(de):I.receiver.createCancellationTokenSource(T);T.id!==null&&w.has(T.id)&&Ie.cancel(),T.id!==null&&x.set(de,Ie);try{let xe;if(He)if(T.params===void 0){if(Ee!==void 0&&Ee.numberOfParams!==0){q(new re.ResponseError(re.ErrorCodes.InvalidParams,`Request ${T.method} defines ${Ee.numberOfParams} params but received none.`),T.method,Xe);return}xe=He(Ie.token)}else if(Array.isArray(T.params)){if(Ee!==void 0&&Ee.parameterStructures===re.ParameterStructures.byName){q(new re.ResponseError(re.ErrorCodes.InvalidParams,`Request ${T.method} defines parameters by name but received parameters by position`),T.method,Xe);return}xe=He(...T.params,Ie.token)}else{if(Ee!==void 0&&Ee.parameterStructures===re.ParameterStructures.byPosition){q(new re.ResponseError(re.ErrorCodes.InvalidParams,`Request ${T.method} defines parameters by position but received parameters by name`),T.method,Xe);return}xe=He(T.params,Ie.token)}else u&&(xe=u(T.method,T.params,Ie.token));let ct=xe;xe?ct.then?ct.then(It=>{x.delete(de),O(It,T.method,Xe)},It=>{x.delete(de),It instanceof re.ResponseError?q(It,T.method,Xe):It&&st.string(It.message)?q(new re.ResponseError(re.ErrorCodes.InternalError,`Request ${T.method} failed with message: ${It.message}`),T.method,Xe):q(new re.ResponseError(re.ErrorCodes.InternalError,`Request ${T.method} failed unexpectedly without providing any details.`),T.method,Xe)}):(x.delete(de),O(xe,T.method,Xe)):(x.delete(de),K(xe,T.method,Xe))}catch(xe){x.delete(de),xe instanceof re.ResponseError?O(xe,T.method,Xe):xe&&st.string(xe.message)?q(new re.ResponseError(re.ErrorCodes.InternalError,`Request ${T.method} failed with message: ${xe.message}`),T.method,Xe):q(new re.ResponseError(re.ErrorCodes.InternalError,`Request ${T.method} failed unexpectedly without providing any details.`),T.method,Xe)}}else q(new re.ResponseError(re.ErrorCodes.MethodNotFound,`Unhandled method ${T.method}`),T.method,Xe)}function Wr(T){if(!N())if(T.id===null)T.error?i.error(`Received response message without id: Error is:
6
6
  ${JSON.stringify(T.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let O=T.id,q=D.get(O);if(zu(T,q),q!==void 0){D.delete(O);try{if(T.error){let K=T.error;q.reject(new re.ResponseError(K.code,K.message,K.data))}else if(T.result!==void 0)q.resolve(T.result);else throw new Error("Should never happen.")}catch(K){K.message?i.error(`Response handler '${q.method}' failed with message: ${K.message}`):i.error(`Response handler '${q.method}' failed unexpectedly.`)}}}}function Pt(T){if(N())return;let O,q;if(T.method===wu.type.method){let K=T.params.id;w.delete(K),_o(T);return}else{let K=p.get(T.method);K&&(q=K.handler,O=K.type)}if(q||h)try{if(_o(T),q)if(T.params===void 0)O!==void 0&&O.numberOfParams!==0&&O.parameterStructures!==re.ParameterStructures.byName&&i.error(`Notification ${T.method} defines ${O.numberOfParams} params but received none.`),q();else if(Array.isArray(T.params)){let K=T.params;T.method===Eu.type.method&&K.length===2&&Mg.is(K[0])?q({token:K[0],value:K[1]}):(O!==void 0&&(O.parameterStructures===re.ParameterStructures.byName&&i.error(`Notification ${T.method} defines parameters by name but received parameters by position`),O.numberOfParams!==T.params.length&&i.error(`Notification ${T.method} defines ${O.numberOfParams} params but received ${K.length} arguments`)),q(...K))}else O!==void 0&&O.parameterStructures===re.ParameterStructures.byPosition&&i.error(`Notification ${T.method} defines parameters by position but received parameters by name`),q(T.params);else h&&h(T.method,T.params)}catch(K){K.message?i.error(`Notification handler '${T.method}' failed with message: ${K.message}`):i.error(`Notification handler '${T.method}' failed unexpectedly.`)}else Nt.fire(T)}function Gt(T){if(!T){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
7
7
  ${JSON.stringify(T,null,4)}`);let O=T;if(st.string(O.id)||st.number(O.id)){let q=O.id,K=D.get(q);K&&K.reject(new Error("The received response has neither a result nor an error property."))}}function Tt(T){if(T!=null)switch(g){case Ce.Verbose:return JSON.stringify(T,null,4);case Ce.Compact:return JSON.stringify(T);default:return}}function ar(T){if(!(g===Ce.Off||!M))if(A===Er.Text){let O;(g===Ce.Verbose||g===Ce.Compact)&&T.params&&(O=`Params: ${Tt(T.params)}
8
8
 
@@ -28,23 +28,23 @@ ${JSON.stringify(T,null,4)}`);let O=T;if(st.string(O.id)||st.number(O.id)){let q
28
28
 
29
29
  `:T.error===void 0&&(q=`No result returned.
30
30
 
31
- `)),O){let K=T.error?` Request failed: ${T.error.message} (${T.error.code}).`:"";M.log(`Received response '${O.method} - (${T.id})' in ${Date.now()-O.timerStart}ms.${K}`,q)}else M.log(`Received response ${T.id} without active response promise.`,q)}else En("receive-response",T)}function En(T,O){if(!M||g===Ce.Off)return;let q={isLSPMessage:!0,type:T,message:O,timestamp:Date.now()};M.log(q)}function Vn(){if(B())throw new Ta(Au.Closed,"Connection is closed.");if(N())throw new Ta(Au.Disposed,"Connection is disposed.")}function Vu(){if(at())throw new Ta(Au.AlreadyListening,"Connection is already listening")}function Ku(){if(!at())throw new Error("Call listen() first.")}function tn(T){return T===void 0?null:T}function $a(T){if(T!==null)return T}function qa(T){return T!=null&&!Array.isArray(T)&&typeof T=="object"}function Co(T,O){switch(T){case re.ParameterStructures.auto:return qa(O)?$a(O):[tn(O)];case re.ParameterStructures.byName:if(!qa(O))throw new Error("Received parameters by name but param is not an object literal.");return $a(O);case re.ParameterStructures.byPosition:return[tn(O)];default:throw new Error(`Unknown parameter structure ${T.toString()}`)}}function ja(T,O){let q,K=T.numberOfParams;switch(K){case 0:q=void 0;break;case 1:q=Co(T.parameterStructures,O[0]);break;default:q=[];for(let Ne=0;Ne<O.length&&Ne<K;Ne++)q.push(tn(O[Ne]));if(O.length<K)for(let Ne=O.length;Ne<K;Ne++)q.push(null);break}return q}let An={sendNotification:(T,...O)=>{Vn();let q,K;if(st.string(T)){q=T;let Ee=O[0],He=0,Xe=re.ParameterStructures.auto;re.ParameterStructures.is(Ee)&&(He=1,Xe=Ee);let de=O.length,Ie=de-He;switch(Ie){case 0:K=void 0;break;case 1:K=Co(Xe,O[He]);break;default:if(Xe===re.ParameterStructures.byName)throw new Error(`Received ${Ie} parameters for 'by Name' notification parameter structure.`);K=O.slice(He,de).map(xe=>tn(xe));break}}else{let Ee=O;q=T.method,K=ja(T,Ee)}let Ne={jsonrpc:c,method:q,params:K};return wr(Ne),e.write(Ne).catch(Ee=>{throw i.error("Sending notification failed."),Ee})},onNotification:(T,O)=>{Vn();let q;return st.func(T)?h=T:O&&(st.string(T)?(q=T,p.set(T,{type:void 0,handler:O})):(q=T.method,p.set(T.method,{type:T,handler:O}))),{dispose:()=>{q!==void 0?p.delete(q):h=void 0}}},onProgress:(T,O,q)=>{if(y.has(O))throw new Error(`Progress handler for token ${O} already registered`);return y.set(O,q),{dispose:()=>{y.delete(O)}}},sendProgress:(T,O,q)=>An.sendNotification(Eu.type,{token:O,value:q}),onUnhandledProgress:xt.event,sendRequest:(T,...O)=>{Vn(),Ku();let q,K,Ne;if(st.string(T)){q=T;let de=O[0],Ie=O[O.length-1],xe=0,ct=re.ParameterStructures.auto;re.ParameterStructures.is(de)&&(xe=1,ct=de);let It=O.length;Lg.CancellationToken.is(Ie)&&(It=It-1,Ne=Ie);let Tr=It-xe;switch(Tr){case 0:K=void 0;break;case 1:K=Co(ct,O[xe]);break;default:if(ct===re.ParameterStructures.byName)throw new Error(`Received ${Tr} parameters for 'by Name' request parameter structure.`);K=O.slice(xe,It).map(Xu=>tn(Xu));break}}else{let de=O;q=T.method,K=ja(T,de);let Ie=T.numberOfParams;Ne=Lg.CancellationToken.is(de[Ie])?de[Ie]:void 0}let Ee=o++,He;Ne&&(He=Ne.onCancellationRequested(()=>{let de=I.sender.sendCancellation(An,Ee);return de===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${Ee}`),Promise.resolve()):de.catch(()=>{i.log(`Sending cancellation messages for id ${Ee} failed`)})}));let Xe={jsonrpc:c,id:Ee,method:q,params:K};return ar(Xe),typeof I.sender.enableCancellation=="function"&&I.sender.enableCancellation(Xe),new Promise(async(de,Ie)=>{let xe=Tr=>{de(Tr),I.sender.cleanup(Ee),He?.dispose()},ct=Tr=>{Ie(Tr),I.sender.cleanup(Ee),He?.dispose()},It={method:q,timerStart:Date.now(),resolve:xe,reject:ct};try{await e.write(Xe),D.set(Ee,It)}catch(Tr){throw i.error("Sending request failed."),It.reject(new re.ResponseError(re.ErrorCodes.MessageWriteError,Tr.message?Tr.message:"Unknown reason")),Tr}})},onRequest:(T,O)=>{Vn();let q=null;return $g.is(T)?(q=void 0,u=T):st.string(T)?(q=null,O!==void 0&&(q=T,l.set(T,{handler:O,type:void 0}))):O!==void 0&&(q=T.method,l.set(T.method,{type:T,handler:O})),{dispose:()=>{q!==null&&(q!==void 0?l.delete(q):u=void 0)}}},hasPendingResponse:()=>D.size>0,trace:async(T,O,q)=>{let K=!1,Ne=Er.Text;q!==void 0&&(st.boolean(q)?K=q:(K=q.sendNotification||!1,Ne=q.traceFormat||Er.Text)),g=T,A=Ne,g===Ce.Off?M=void 0:M=O,K&&!B()&&!N()&&await An.sendNotification(qg.type,{value:Ce.toString(T)})},onError:_e.event,onClose:Se.event,onUnhandledNotification:Nt.event,onDispose:$.event,end:()=>{e.end()},dispose:()=>{if(N())return;te=Jr.Disposed,$.fire(void 0);let T=new re.ResponseError(re.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let O of D.values())O.reject(T);D=new Map,x=new Map,w=new Set,E=new EC.LinkedMap,st.func(e.dispose)&&e.dispose(),st.func(t.dispose)&&t.dispose()},listen:()=>{Vn(),Vu(),te=Jr.Listening,t.listen(pt)},inspect:()=>{(0,kC.default)().console.log("inspect")}};return An.onNotification(nf.type,T=>{if(g===Ce.Off||!M)return;let O=g===Ce.Verbose||g===Ce.Compact;M.log(T.message,O?T.verbose:void 0)}),An.onNotification(Eu.type,T=>{let O=y.get(T.token);O?O(T.value):xt.fire(T)}),An}se.createMessageConnection=i$});var lf=G(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.ProgressType=P.ProgressToken=P.createMessageConnection=P.NullLogger=P.ConnectionOptions=P.ConnectionStrategy=P.AbstractMessageBuffer=P.WriteableStreamMessageWriter=P.AbstractMessageWriter=P.MessageWriter=P.ReadableStreamMessageReader=P.AbstractMessageReader=P.MessageReader=P.SharedArrayReceiverStrategy=P.SharedArraySenderStrategy=P.CancellationToken=P.CancellationTokenSource=P.Emitter=P.Event=P.Disposable=P.LRUCache=P.Touch=P.LinkedMap=P.ParameterStructures=P.NotificationType9=P.NotificationType8=P.NotificationType7=P.NotificationType6=P.NotificationType5=P.NotificationType4=P.NotificationType3=P.NotificationType2=P.NotificationType1=P.NotificationType0=P.NotificationType=P.ErrorCodes=P.ResponseError=P.RequestType9=P.RequestType8=P.RequestType7=P.RequestType6=P.RequestType5=P.RequestType4=P.RequestType3=P.RequestType2=P.RequestType1=P.RequestType0=P.RequestType=P.Message=P.RAL=void 0;P.MessageStrategy=P.CancellationStrategy=P.CancellationSenderStrategy=P.CancellationReceiverStrategy=P.ConnectionError=P.ConnectionErrors=P.LogTraceNotification=P.SetTraceNotification=P.TraceFormat=P.TraceValues=P.Trace=void 0;var Be=xg();Object.defineProperty(P,"Message",{enumerable:!0,get:function(){return Be.Message}});Object.defineProperty(P,"RequestType",{enumerable:!0,get:function(){return Be.RequestType}});Object.defineProperty(P,"RequestType0",{enumerable:!0,get:function(){return Be.RequestType0}});Object.defineProperty(P,"RequestType1",{enumerable:!0,get:function(){return Be.RequestType1}});Object.defineProperty(P,"RequestType2",{enumerable:!0,get:function(){return Be.RequestType2}});Object.defineProperty(P,"RequestType3",{enumerable:!0,get:function(){return Be.RequestType3}});Object.defineProperty(P,"RequestType4",{enumerable:!0,get:function(){return Be.RequestType4}});Object.defineProperty(P,"RequestType5",{enumerable:!0,get:function(){return Be.RequestType5}});Object.defineProperty(P,"RequestType6",{enumerable:!0,get:function(){return Be.RequestType6}});Object.defineProperty(P,"RequestType7",{enumerable:!0,get:function(){return Be.RequestType7}});Object.defineProperty(P,"RequestType8",{enumerable:!0,get:function(){return Be.RequestType8}});Object.defineProperty(P,"RequestType9",{enumerable:!0,get:function(){return Be.RequestType9}});Object.defineProperty(P,"ResponseError",{enumerable:!0,get:function(){return Be.ResponseError}});Object.defineProperty(P,"ErrorCodes",{enumerable:!0,get:function(){return Be.ErrorCodes}});Object.defineProperty(P,"NotificationType",{enumerable:!0,get:function(){return Be.NotificationType}});Object.defineProperty(P,"NotificationType0",{enumerable:!0,get:function(){return Be.NotificationType0}});Object.defineProperty(P,"NotificationType1",{enumerable:!0,get:function(){return Be.NotificationType1}});Object.defineProperty(P,"NotificationType2",{enumerable:!0,get:function(){return Be.NotificationType2}});Object.defineProperty(P,"NotificationType3",{enumerable:!0,get:function(){return Be.NotificationType3}});Object.defineProperty(P,"NotificationType4",{enumerable:!0,get:function(){return Be.NotificationType4}});Object.defineProperty(P,"NotificationType5",{enumerable:!0,get:function(){return Be.NotificationType5}});Object.defineProperty(P,"NotificationType6",{enumerable:!0,get:function(){return Be.NotificationType6}});Object.defineProperty(P,"NotificationType7",{enumerable:!0,get:function(){return Be.NotificationType7}});Object.defineProperty(P,"NotificationType8",{enumerable:!0,get:function(){return Be.NotificationType8}});Object.defineProperty(P,"NotificationType9",{enumerable:!0,get:function(){return Be.NotificationType9}});Object.defineProperty(P,"ParameterStructures",{enumerable:!0,get:function(){return Be.ParameterStructures}});var Wg=Rg();Object.defineProperty(P,"LinkedMap",{enumerable:!0,get:function(){return Wg.LinkedMap}});Object.defineProperty(P,"LRUCache",{enumerable:!0,get:function(){return Wg.LRUCache}});Object.defineProperty(P,"Touch",{enumerable:!0,get:function(){return Wg.Touch}});var o$=gC();Object.defineProperty(P,"Disposable",{enumerable:!0,get:function(){return o$.Disposable}});var PC=oo();Object.defineProperty(P,"Event",{enumerable:!0,get:function(){return PC.Event}});Object.defineProperty(P,"Emitter",{enumerable:!0,get:function(){return PC.Emitter}});var IC=Bc();Object.defineProperty(P,"CancellationTokenSource",{enumerable:!0,get:function(){return IC.CancellationTokenSource}});Object.defineProperty(P,"CancellationToken",{enumerable:!0,get:function(){return IC.CancellationToken}});var DC=yC();Object.defineProperty(P,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return DC.SharedArraySenderStrategy}});Object.defineProperty(P,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return DC.SharedArrayReceiverStrategy}});var Bg=xC();Object.defineProperty(P,"MessageReader",{enumerable:!0,get:function(){return Bg.MessageReader}});Object.defineProperty(P,"AbstractMessageReader",{enumerable:!0,get:function(){return Bg.AbstractMessageReader}});Object.defineProperty(P,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Bg.ReadableStreamMessageReader}});var Hg=CC();Object.defineProperty(P,"MessageWriter",{enumerable:!0,get:function(){return Hg.MessageWriter}});Object.defineProperty(P,"AbstractMessageWriter",{enumerable:!0,get:function(){return Hg.AbstractMessageWriter}});Object.defineProperty(P,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Hg.WriteableStreamMessageWriter}});var s$=SC();Object.defineProperty(P,"AbstractMessageBuffer",{enumerable:!0,get:function(){return s$.AbstractMessageBuffer}});var Ht=NC();Object.defineProperty(P,"ConnectionStrategy",{enumerable:!0,get:function(){return Ht.ConnectionStrategy}});Object.defineProperty(P,"ConnectionOptions",{enumerable:!0,get:function(){return Ht.ConnectionOptions}});Object.defineProperty(P,"NullLogger",{enumerable:!0,get:function(){return Ht.NullLogger}});Object.defineProperty(P,"createMessageConnection",{enumerable:!0,get:function(){return Ht.createMessageConnection}});Object.defineProperty(P,"ProgressToken",{enumerable:!0,get:function(){return Ht.ProgressToken}});Object.defineProperty(P,"ProgressType",{enumerable:!0,get:function(){return Ht.ProgressType}});Object.defineProperty(P,"Trace",{enumerable:!0,get:function(){return Ht.Trace}});Object.defineProperty(P,"TraceValues",{enumerable:!0,get:function(){return Ht.TraceValues}});Object.defineProperty(P,"TraceFormat",{enumerable:!0,get:function(){return Ht.TraceFormat}});Object.defineProperty(P,"SetTraceNotification",{enumerable:!0,get:function(){return Ht.SetTraceNotification}});Object.defineProperty(P,"LogTraceNotification",{enumerable:!0,get:function(){return Ht.LogTraceNotification}});Object.defineProperty(P,"ConnectionErrors",{enumerable:!0,get:function(){return Ht.ConnectionErrors}});Object.defineProperty(P,"ConnectionError",{enumerable:!0,get:function(){return Ht.ConnectionError}});Object.defineProperty(P,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Ht.CancellationReceiverStrategy}});Object.defineProperty(P,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Ht.CancellationSenderStrategy}});Object.defineProperty(P,"CancellationStrategy",{enumerable:!0,get:function(){return Ht.CancellationStrategy}});Object.defineProperty(P,"MessageStrategy",{enumerable:!0,get:function(){return Ht.MessageStrategy}});var a$=yi();P.RAL=a$.default});var MC=G(Kg=>{"use strict";Object.defineProperty(Kg,"__esModule",{value:!0});var OC=require("util"),Bn=lf(),df=class t extends Bn.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return Buffer.from(e,r)}toString(e,r){return e instanceof Buffer?e.toString(r):new OC.TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,r):Buffer.from(e,0,r)}allocNative(e){return Buffer.allocUnsafe(e)}};df.emptyBuffer=Buffer.allocUnsafe(0);var Gg=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Bn.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Bn.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Bn.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),Bn.Disposable.create(()=>this.stream.off("data",e))}},zg=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Bn.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Bn.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Bn.Disposable.create(()=>this.stream.off("end",e))}write(e,r){return new Promise((n,i)=>{let o=s=>{s==null?n():i(s)};typeof e=="string"?this.stream.write(e,r,o):this.stream.write(e,o)})}end(){this.stream.end()}},LC=Object.freeze({messageBuffer:Object.freeze({create:t=>new df(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),e.charset))}catch(r){return Promise.reject(r)}}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(e.charset))):Promise.resolve(JSON.parse(new OC.TextDecoder(e.charset).decode(t)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:t=>new Gg(t),asWritableStream:t=>new zg(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setImmediate(t,...e);return{dispose:()=>clearImmediate(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function Vg(){return LC}(function(t){function e(){Bn.RAL.install(LC)}t.install=e})(Vg||(Vg={}));Kg.default=Vg});var yo=G(ye=>{"use strict";var c$=ye&&ye.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),u$=ye&&ye.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&c$(e,t,r)};Object.defineProperty(ye,"__esModule",{value:!0});ye.createMessageConnection=ye.createServerSocketTransport=ye.createClientSocketTransport=ye.createServerPipeTransport=ye.createClientPipeTransport=ye.generateRandomPipeName=ye.StreamMessageWriter=ye.StreamMessageReader=ye.SocketMessageWriter=ye.SocketMessageReader=ye.PortMessageWriter=ye.PortMessageReader=ye.IPCMessageWriter=ye.IPCMessageReader=void 0;var Ra=MC();Ra.default.install();var FC=require("path"),l$=require("os"),d$=require("crypto"),pf=require("net"),Ar=lf();u$(lf(),ye);var Xg=class extends Ar.AbstractMessageReader{constructor(e){super(),this.process=e;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),Ar.Disposable.create(()=>this.process.off("message",e))}};ye.IPCMessageReader=Xg;var Yg=class extends Ar.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,e)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};ye.IPCMessageWriter=Yg;var Jg=class extends Ar.AbstractMessageReader{constructor(e){super(),this.onData=new Ar.Emitter,e.on("close",()=>this.fireClose),e.on("error",r=>this.fireError(r)),e.on("message",r=>{this.onData.fire(r)})}listen(e){return this.onData.event(e)}};ye.PortMessageReader=Jg;var Qg=class extends Ar.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",r=>this.fireError(r))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};ye.PortMessageWriter=Qg;var mo=class extends Ar.ReadableStreamMessageReader{constructor(e,r="utf-8"){super((0,Ra.default)().stream.asReadableStream(e),r)}};ye.SocketMessageReader=mo;var go=class extends Ar.WriteableStreamMessageWriter{constructor(e,r){super((0,Ra.default)().stream.asWritableStream(e),r),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};ye.SocketMessageWriter=go;var ff=class extends Ar.ReadableStreamMessageReader{constructor(e,r){super((0,Ra.default)().stream.asReadableStream(e),r)}};ye.StreamMessageReader=ff;var hf=class extends Ar.WriteableStreamMessageWriter{constructor(e,r){super((0,Ra.default)().stream.asWritableStream(e),r)}};ye.StreamMessageWriter=hf;var $C=process.env.XDG_RUNTIME_DIR,f$=new Map([["linux",107],["darwin",103]]);function h$(){let t=(0,d$.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;$C?e=FC.join($C,`vscode-ipc-${t}.sock`):e=FC.join(l$.tmpdir(),`vscode-${t}.sock`);let r=f$.get(process.platform);return r!==void 0&&e.length>r&&(0,Ra.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${r} characters.`),e}ye.generateRandomPipeName=h$;function p$(t,e="utf-8"){let r,n=new Promise((i,o)=>{r=i});return new Promise((i,o)=>{let s=(0,pf.createServer)(a=>{s.close(),r([new mo(a,e),new go(a,e)])});s.on("error",o),s.listen(t,()=>{s.removeListener("error",o),i({onConnected:()=>n})})})}ye.createClientPipeTransport=p$;function m$(t,e="utf-8"){let r=(0,pf.createConnection)(t);return[new mo(r,e),new go(r,e)]}ye.createServerPipeTransport=m$;function g$(t,e="utf-8"){let r,n=new Promise((i,o)=>{r=i});return new Promise((i,o)=>{let s=(0,pf.createServer)(a=>{s.close(),r([new mo(a,e),new go(a,e)])});s.on("error",o),s.listen(t,"127.0.0.1",()=>{s.removeListener("error",o),i({onConnected:()=>n})})})}ye.createClientSocketTransport=g$;function y$(t,e="utf-8"){let r=(0,pf.createConnection)(t,"127.0.0.1");return[new mo(r,e),new go(r,e)]}ye.createServerSocketTransport=y$;function v$(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function x$(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function T$(t,e,r,n){r||(r=Ar.NullLogger);let i=v$(t)?new ff(t):t,o=x$(e)?new hf(e):e;return Ar.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Ar.createMessageConnection)(i,o,r,n)}ye.createMessageConnection=T$});var Zg=G((Tee,qC)=>{"use strict";qC.exports=yo()});var gf=G((jC,mf)=>{(function(t){if(typeof mf=="object"&&typeof mf.exports=="object"){var e=t(require,jC);e!==void 0&&(mf.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],t)})(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=e.EOL=e.WorkspaceFolder=e.InlineCompletionContext=e.SelectedCompletionInfo=e.InlineCompletionTriggerKind=e.InlineCompletionList=e.InlineCompletionItem=e.StringValue=e.InlayHint=e.InlayHintLabelPart=e.InlayHintKind=e.InlineValueContext=e.InlineValueEvaluatableExpression=e.InlineValueVariableLookup=e.InlineValueText=e.SemanticTokens=e.SemanticTokenModifiers=e.SemanticTokenTypes=e.SelectionRange=e.DocumentLink=e.FormattingOptions=e.CodeLens=e.CodeAction=e.CodeActionContext=e.CodeActionTriggerKind=e.CodeActionKind=e.DocumentSymbol=e.WorkspaceSymbol=e.SymbolInformation=e.SymbolTag=e.SymbolKind=e.DocumentHighlight=e.DocumentHighlightKind=e.SignatureInformation=e.ParameterInformation=e.Hover=e.MarkedString=e.CompletionList=e.CompletionItem=e.CompletionItemLabelDetails=e.InsertTextMode=e.InsertReplaceEdit=e.CompletionItemTag=e.InsertTextFormat=e.CompletionItemKind=e.MarkupContent=e.MarkupKind=e.TextDocumentItem=e.OptionalVersionedTextDocumentIdentifier=e.VersionedTextDocumentIdentifier=e.TextDocumentIdentifier=e.WorkspaceChange=e.WorkspaceEdit=e.DeleteFile=e.RenameFile=e.CreateFile=e.TextDocumentEdit=e.AnnotatedTextEdit=e.ChangeAnnotationIdentifier=e.ChangeAnnotation=e.TextEdit=e.Command=e.Diagnostic=e.CodeDescription=e.DiagnosticTag=e.DiagnosticSeverity=e.DiagnosticRelatedInformation=e.FoldingRange=e.FoldingRangeKind=e.ColorPresentation=e.ColorInformation=e.Color=e.LocationLink=e.Location=e.Range=e.Position=e.uinteger=e.integer=e.URI=e.DocumentUri=void 0;var r;(function(f){function R(b){return typeof b=="string"}f.is=R})(r||(e.DocumentUri=r={}));var n;(function(f){function R(b){return typeof b=="string"}f.is=R})(n||(e.URI=n={}));var i;(function(f){f.MIN_VALUE=-2147483648,f.MAX_VALUE=2147483647;function R(b){return typeof b=="number"&&f.MIN_VALUE<=b&&b<=f.MAX_VALUE}f.is=R})(i||(e.integer=i={}));var o;(function(f){f.MIN_VALUE=0,f.MAX_VALUE=2147483647;function R(b){return typeof b=="number"&&f.MIN_VALUE<=b&&b<=f.MAX_VALUE}f.is=R})(o||(e.uinteger=o={}));var s;(function(f){function R(m,d){return m===Number.MAX_VALUE&&(m=o.MAX_VALUE),d===Number.MAX_VALUE&&(d=o.MAX_VALUE),{line:m,character:d}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.uinteger(d.line)&&S.uinteger(d.character)}f.is=b})(s||(e.Position=s={}));var a;(function(f){function R(m,d,C,L){if(S.uinteger(m)&&S.uinteger(d)&&S.uinteger(C)&&S.uinteger(L))return{start:s.create(m,d),end:s.create(C,L)};if(s.is(m)&&s.is(d))return{start:m,end:d};throw new Error("Range#create called with invalid arguments[".concat(m,", ").concat(d,", ").concat(C,", ").concat(L,"]"))}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&s.is(d.start)&&s.is(d.end)}f.is=b})(a||(e.Range=a={}));var c;(function(f){function R(m,d){return{uri:m,range:d}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&a.is(d.range)&&(S.string(d.uri)||S.undefined(d.uri))}f.is=b})(c||(e.Location=c={}));var u;(function(f){function R(m,d,C,L){return{targetUri:m,targetRange:d,targetSelectionRange:C,originSelectionRange:L}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&a.is(d.targetRange)&&S.string(d.targetUri)&&a.is(d.targetSelectionRange)&&(a.is(d.originSelectionRange)||S.undefined(d.originSelectionRange))}f.is=b})(u||(e.LocationLink=u={}));var l;(function(f){function R(m,d,C,L){return{red:m,green:d,blue:C,alpha:L}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.numberRange(d.red,0,1)&&S.numberRange(d.green,0,1)&&S.numberRange(d.blue,0,1)&&S.numberRange(d.alpha,0,1)}f.is=b})(l||(e.Color=l={}));var h;(function(f){function R(m,d){return{range:m,color:d}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&a.is(d.range)&&l.is(d.color)}f.is=b})(h||(e.ColorInformation=h={}));var p;(function(f){function R(m,d,C){return{label:m,textEdit:d,additionalTextEdits:C}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.string(d.label)&&(S.undefined(d.textEdit)||M.is(d))&&(S.undefined(d.additionalTextEdits)||S.typedArray(d.additionalTextEdits,M.is))}f.is=b})(p||(e.ColorPresentation=p={}));var y;(function(f){f.Comment="comment",f.Imports="imports",f.Region="region"})(y||(e.FoldingRangeKind=y={}));var _;(function(f){function R(m,d,C,L,oe,ut){var Me={startLine:m,endLine:d};return S.defined(C)&&(Me.startCharacter=C),S.defined(L)&&(Me.endCharacter=L),S.defined(oe)&&(Me.kind=oe),S.defined(ut)&&(Me.collapsedText=ut),Me}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.uinteger(d.startLine)&&S.uinteger(d.startLine)&&(S.undefined(d.startCharacter)||S.uinteger(d.startCharacter))&&(S.undefined(d.endCharacter)||S.uinteger(d.endCharacter))&&(S.undefined(d.kind)||S.string(d.kind))}f.is=b})(_||(e.FoldingRange=_={}));var E;(function(f){function R(m,d){return{location:m,message:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&c.is(d.location)&&S.string(d.message)}f.is=b})(E||(e.DiagnosticRelatedInformation=E={}));var D;(function(f){f.Error=1,f.Warning=2,f.Information=3,f.Hint=4})(D||(e.DiagnosticSeverity=D={}));var w;(function(f){f.Unnecessary=1,f.Deprecated=2})(w||(e.DiagnosticTag=w={}));var x;(function(f){function R(b){var m=b;return S.objectLiteral(m)&&S.string(m.href)}f.is=R})(x||(e.CodeDescription=x={}));var g;(function(f){function R(m,d,C,L,oe,ut){var Me={range:m,message:d};return S.defined(C)&&(Me.severity=C),S.defined(L)&&(Me.code=L),S.defined(oe)&&(Me.source=oe),S.defined(ut)&&(Me.relatedInformation=ut),Me}f.create=R;function b(m){var d,C=m;return S.defined(C)&&a.is(C.range)&&S.string(C.message)&&(S.number(C.severity)||S.undefined(C.severity))&&(S.integer(C.code)||S.string(C.code)||S.undefined(C.code))&&(S.undefined(C.codeDescription)||S.string((d=C.codeDescription)===null||d===void 0?void 0:d.href))&&(S.string(C.source)||S.undefined(C.source))&&(S.undefined(C.relatedInformation)||S.typedArray(C.relatedInformation,E.is))}f.is=b})(g||(e.Diagnostic=g={}));var A;(function(f){function R(m,d){for(var C=[],L=2;L<arguments.length;L++)C[L-2]=arguments[L];var oe={title:m,command:d};return S.defined(C)&&C.length>0&&(oe.arguments=C),oe}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.title)&&S.string(d.command)}f.is=b})(A||(e.Command=A={}));var M;(function(f){function R(C,L){return{range:C,newText:L}}f.replace=R;function b(C,L){return{range:{start:C,end:C},newText:L}}f.insert=b;function m(C){return{range:C,newText:""}}f.del=m;function d(C){var L=C;return S.objectLiteral(L)&&S.string(L.newText)&&a.is(L.range)}f.is=d})(M||(e.TextEdit=M={}));var te;(function(f){function R(m,d,C){var L={label:m};return d!==void 0&&(L.needsConfirmation=d),C!==void 0&&(L.description=C),L}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.string(d.label)&&(S.boolean(d.needsConfirmation)||d.needsConfirmation===void 0)&&(S.string(d.description)||d.description===void 0)}f.is=b})(te||(e.ChangeAnnotation=te={}));var _e;(function(f){function R(b){var m=b;return S.string(m)}f.is=R})(_e||(e.ChangeAnnotationIdentifier=_e={}));var Se;(function(f){function R(C,L,oe){return{range:C,newText:L,annotationId:oe}}f.replace=R;function b(C,L,oe){return{range:{start:C,end:C},newText:L,annotationId:oe}}f.insert=b;function m(C,L){return{range:C,newText:"",annotationId:L}}f.del=m;function d(C){var L=C;return M.is(L)&&(te.is(L.annotationId)||_e.is(L.annotationId))}f.is=d})(Se||(e.AnnotatedTextEdit=Se={}));var Nt;(function(f){function R(m,d){return{textDocument:m,edits:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&B.is(d.textDocument)&&Array.isArray(d.edits)}f.is=b})(Nt||(e.TextDocumentEdit=Nt={}));var xt;(function(f){function R(m,d,C){var L={kind:"create",uri:m};return d!==void 0&&(d.overwrite!==void 0||d.ignoreIfExists!==void 0)&&(L.options=d),C!==void 0&&(L.annotationId=C),L}f.create=R;function b(m){var d=m;return d&&d.kind==="create"&&S.string(d.uri)&&(d.options===void 0||(d.options.overwrite===void 0||S.boolean(d.options.overwrite))&&(d.options.ignoreIfExists===void 0||S.boolean(d.options.ignoreIfExists)))&&(d.annotationId===void 0||_e.is(d.annotationId))}f.is=b})(xt||(e.CreateFile=xt={}));var $;(function(f){function R(m,d,C,L){var oe={kind:"rename",oldUri:m,newUri:d};return C!==void 0&&(C.overwrite!==void 0||C.ignoreIfExists!==void 0)&&(oe.options=C),L!==void 0&&(oe.annotationId=L),oe}f.create=R;function b(m){var d=m;return d&&d.kind==="rename"&&S.string(d.oldUri)&&S.string(d.newUri)&&(d.options===void 0||(d.options.overwrite===void 0||S.boolean(d.options.overwrite))&&(d.options.ignoreIfExists===void 0||S.boolean(d.options.ignoreIfExists)))&&(d.annotationId===void 0||_e.is(d.annotationId))}f.is=b})($||(e.RenameFile=$={}));var I;(function(f){function R(m,d,C){var L={kind:"delete",uri:m};return d!==void 0&&(d.recursive!==void 0||d.ignoreIfNotExists!==void 0)&&(L.options=d),C!==void 0&&(L.annotationId=C),L}f.create=R;function b(m){var d=m;return d&&d.kind==="delete"&&S.string(d.uri)&&(d.options===void 0||(d.options.recursive===void 0||S.boolean(d.options.recursive))&&(d.options.ignoreIfNotExists===void 0||S.boolean(d.options.ignoreIfNotExists)))&&(d.annotationId===void 0||_e.is(d.annotationId))}f.is=b})(I||(e.DeleteFile=I={}));var z;(function(f){function R(b){var m=b;return m&&(m.changes!==void 0||m.documentChanges!==void 0)&&(m.documentChanges===void 0||m.documentChanges.every(function(d){return S.string(d.kind)?xt.is(d)||$.is(d)||I.is(d):Nt.is(d)}))}f.is=R})(z||(e.WorkspaceEdit=z={}));var W=(function(){function f(R,b){this.edits=R,this.changeAnnotations=b}return f.prototype.insert=function(R,b,m){var d,C;if(m===void 0?d=M.insert(R,b):_e.is(m)?(C=m,d=Se.insert(R,b,m)):(this.assertChangeAnnotations(this.changeAnnotations),C=this.changeAnnotations.manage(m),d=Se.insert(R,b,C)),this.edits.push(d),C!==void 0)return C},f.prototype.replace=function(R,b,m){var d,C;if(m===void 0?d=M.replace(R,b):_e.is(m)?(C=m,d=Se.replace(R,b,m)):(this.assertChangeAnnotations(this.changeAnnotations),C=this.changeAnnotations.manage(m),d=Se.replace(R,b,C)),this.edits.push(d),C!==void 0)return C},f.prototype.delete=function(R,b){var m,d;if(b===void 0?m=M.del(R):_e.is(b)?(d=b,m=Se.del(R,b)):(this.assertChangeAnnotations(this.changeAnnotations),d=this.changeAnnotations.manage(b),m=Se.del(R,d)),this.edits.push(m),d!==void 0)return d},f.prototype.add=function(R){this.edits.push(R)},f.prototype.all=function(){return this.edits},f.prototype.clear=function(){this.edits.splice(0,this.edits.length)},f.prototype.assertChangeAnnotations=function(R){if(R===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},f})(),le=(function(){function f(R){this._annotations=R===void 0?Object.create(null):R,this._counter=0,this._size=0}return f.prototype.all=function(){return this._annotations},Object.defineProperty(f.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),f.prototype.manage=function(R,b){var m;if(_e.is(R)?m=R:(m=this.nextId(),b=R),this._annotations[m]!==void 0)throw new Error("Id ".concat(m," is already in use."));if(b===void 0)throw new Error("No annotation provided for id ".concat(m));return this._annotations[m]=b,this._size++,m},f.prototype.nextId=function(){return this._counter++,this._counter.toString()},f})(),Z=(function(){function f(R){var b=this;this._textEditChanges=Object.create(null),R!==void 0?(this._workspaceEdit=R,R.documentChanges?(this._changeAnnotations=new le(R.changeAnnotations),R.changeAnnotations=this._changeAnnotations.all(),R.documentChanges.forEach(function(m){if(Nt.is(m)){var d=new W(m.edits,b._changeAnnotations);b._textEditChanges[m.textDocument.uri]=d}})):R.changes&&Object.keys(R.changes).forEach(function(m){var d=new W(R.changes[m]);b._textEditChanges[m]=d})):this._workspaceEdit={}}return Object.defineProperty(f.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),f.prototype.getTextEditChange=function(R){if(B.is(R)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var b={uri:R.uri,version:R.version},m=this._textEditChanges[b.uri];if(!m){var d=[],C={textDocument:b,edits:d};this._workspaceEdit.documentChanges.push(C),m=new W(d,this._changeAnnotations),this._textEditChanges[b.uri]=m}return m}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var m=this._textEditChanges[R];if(!m){var d=[];this._workspaceEdit.changes[R]=d,m=new W(d),this._textEditChanges[R]=m}return m}},f.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new le,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},f.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},f.prototype.createFile=function(R,b,m){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var d;te.is(b)||_e.is(b)?d=b:m=b;var C,L;if(d===void 0?C=xt.create(R,m):(L=_e.is(d)?d:this._changeAnnotations.manage(d),C=xt.create(R,m,L)),this._workspaceEdit.documentChanges.push(C),L!==void 0)return L},f.prototype.renameFile=function(R,b,m,d){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var C;te.is(m)||_e.is(m)?C=m:d=m;var L,oe;if(C===void 0?L=$.create(R,b,d):(oe=_e.is(C)?C:this._changeAnnotations.manage(C),L=$.create(R,b,d,oe)),this._workspaceEdit.documentChanges.push(L),oe!==void 0)return oe},f.prototype.deleteFile=function(R,b,m){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var d;te.is(b)||_e.is(b)?d=b:m=b;var C,L;if(d===void 0?C=I.create(R,m):(L=_e.is(d)?d:this._changeAnnotations.manage(d),C=I.create(R,m,L)),this._workspaceEdit.documentChanges.push(C),L!==void 0)return L},f})();e.WorkspaceChange=Z;var Q;(function(f){function R(m){return{uri:m}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.uri)}f.is=b})(Q||(e.TextDocumentIdentifier=Q={}));var at;(function(f){function R(m,d){return{uri:m,version:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.uri)&&S.integer(d.version)}f.is=b})(at||(e.VersionedTextDocumentIdentifier=at={}));var B;(function(f){function R(m,d){return{uri:m,version:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.uri)&&(d.version===null||S.integer(d.version))}f.is=b})(B||(e.OptionalVersionedTextDocumentIdentifier=B={}));var N;(function(f){function R(m,d,C,L){return{uri:m,languageId:d,version:C,text:L}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.uri)&&S.string(d.languageId)&&S.integer(d.version)&&S.string(d.text)}f.is=b})(N||(e.TextDocumentItem=N={}));var ke;(function(f){f.PlainText="plaintext",f.Markdown="markdown";function R(b){var m=b;return m===f.PlainText||m===f.Markdown}f.is=R})(ke||(e.MarkupKind=ke={}));var en;(function(f){function R(b){var m=b;return S.objectLiteral(b)&&ke.is(m.kind)&&S.string(m.value)}f.is=R})(en||(e.MarkupContent=en={}));var bo;(function(f){f.Text=1,f.Method=2,f.Function=3,f.Constructor=4,f.Field=5,f.Variable=6,f.Class=7,f.Interface=8,f.Module=9,f.Property=10,f.Unit=11,f.Value=12,f.Enum=13,f.Keyword=14,f.Snippet=15,f.Color=16,f.File=17,f.Reference=18,f.Folder=19,f.EnumMember=20,f.Constant=21,f.Struct=22,f.Event=23,f.Operator=24,f.TypeParameter=25})(bo||(e.CompletionItemKind=bo={}));var zn;(function(f){f.PlainText=1,f.Snippet=2})(zn||(e.InsertTextFormat=zn={}));var qt;(function(f){f.Deprecated=1})(qt||(e.CompletionItemTag=qt={}));var Pi;(function(f){function R(m,d,C){return{newText:m,insert:d,replace:C}}f.create=R;function b(m){var d=m;return d&&S.string(d.newText)&&a.is(d.insert)&&a.is(d.replace)}f.is=b})(Pi||(e.InsertReplaceEdit=Pi={}));var pt;(function(f){f.asIs=1,f.adjustIndentation=2})(pt||(e.InsertTextMode=pt={}));var jt;(function(f){function R(b){var m=b;return m&&(S.string(m.detail)||m.detail===void 0)&&(S.string(m.description)||m.description===void 0)}f.is=R})(jt||(e.CompletionItemLabelDetails=jt={}));var Wr;(function(f){function R(b){return{label:b}}f.create=R})(Wr||(e.CompletionItem=Wr={}));var Pt;(function(f){function R(b,m){return{items:b||[],isIncomplete:!!m}}f.create=R})(Pt||(e.CompletionList=Pt={}));var Gt;(function(f){function R(m){return m.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}f.fromPlainText=R;function b(m){var d=m;return S.string(d)||S.objectLiteral(d)&&S.string(d.language)&&S.string(d.value)}f.is=b})(Gt||(e.MarkedString=Gt={}));var Tt;(function(f){function R(b){var m=b;return!!m&&S.objectLiteral(m)&&(en.is(m.contents)||Gt.is(m.contents)||S.typedArray(m.contents,Gt.is))&&(b.range===void 0||a.is(b.range))}f.is=R})(Tt||(e.Hover=Tt={}));var ar;(function(f){function R(b,m){return m?{label:b,documentation:m}:{label:b}}f.create=R})(ar||(e.ParameterInformation=ar={}));var wr;(function(f){function R(b,m){for(var d=[],C=2;C<arguments.length;C++)d[C-2]=arguments[C];var L={label:b};return S.defined(m)&&(L.documentation=m),S.defined(d)?L.parameters=d:L.parameters=[],L}f.create=R})(wr||(e.SignatureInformation=wr={}));var Br;(function(f){f.Text=1,f.Read=2,f.Write=3})(Br||(e.DocumentHighlightKind=Br={}));var Ii;(function(f){function R(b,m){var d={range:b};return S.number(m)&&(d.kind=m),d}f.create=R})(Ii||(e.DocumentHighlight=Ii={}));var _o;(function(f){f.File=1,f.Module=2,f.Namespace=3,f.Package=4,f.Class=5,f.Method=6,f.Property=7,f.Field=8,f.Constructor=9,f.Enum=10,f.Interface=11,f.Function=12,f.Variable=13,f.Constant=14,f.String=15,f.Number=16,f.Boolean=17,f.Array=18,f.Object=19,f.Key=20,f.Null=21,f.EnumMember=22,f.Struct=23,f.Event=24,f.Operator=25,f.TypeParameter=26})(_o||(e.SymbolKind=_o={}));var zu;(function(f){f.Deprecated=1})(zu||(e.SymbolTag=zu={}));var En;(function(f){function R(b,m,d,C,L){var oe={name:b,kind:m,location:{uri:C,range:d}};return L&&(oe.containerName=L),oe}f.create=R})(En||(e.SymbolInformation=En={}));var Vn;(function(f){function R(b,m,d,C){return C!==void 0?{name:b,kind:m,location:{uri:d,range:C}}:{name:b,kind:m,location:{uri:d}}}f.create=R})(Vn||(e.WorkspaceSymbol=Vn={}));var Vu;(function(f){function R(m,d,C,L,oe,ut){var Me={name:m,detail:d,kind:C,range:L,selectionRange:oe};return ut!==void 0&&(Me.children=ut),Me}f.create=R;function b(m){var d=m;return d&&S.string(d.name)&&S.number(d.kind)&&a.is(d.range)&&a.is(d.selectionRange)&&(d.detail===void 0||S.string(d.detail))&&(d.deprecated===void 0||S.boolean(d.deprecated))&&(d.children===void 0||Array.isArray(d.children))&&(d.tags===void 0||Array.isArray(d.tags))}f.is=b})(Vu||(e.DocumentSymbol=Vu={}));var Ku;(function(f){f.Empty="",f.QuickFix="quickfix",f.Refactor="refactor",f.RefactorExtract="refactor.extract",f.RefactorInline="refactor.inline",f.RefactorRewrite="refactor.rewrite",f.Source="source",f.SourceOrganizeImports="source.organizeImports",f.SourceFixAll="source.fixAll"})(Ku||(e.CodeActionKind=Ku={}));var tn;(function(f){f.Invoked=1,f.Automatic=2})(tn||(e.CodeActionTriggerKind=tn={}));var $a;(function(f){function R(m,d,C){var L={diagnostics:m};return d!=null&&(L.only=d),C!=null&&(L.triggerKind=C),L}f.create=R;function b(m){var d=m;return S.defined(d)&&S.typedArray(d.diagnostics,g.is)&&(d.only===void 0||S.typedArray(d.only,S.string))&&(d.triggerKind===void 0||d.triggerKind===tn.Invoked||d.triggerKind===tn.Automatic)}f.is=b})($a||(e.CodeActionContext=$a={}));var qa;(function(f){function R(m,d,C){var L={title:m},oe=!0;return typeof d=="string"?(oe=!1,L.kind=d):A.is(d)?L.command=d:L.edit=d,oe&&C!==void 0&&(L.kind=C),L}f.create=R;function b(m){var d=m;return d&&S.string(d.title)&&(d.diagnostics===void 0||S.typedArray(d.diagnostics,g.is))&&(d.kind===void 0||S.string(d.kind))&&(d.edit!==void 0||d.command!==void 0)&&(d.command===void 0||A.is(d.command))&&(d.isPreferred===void 0||S.boolean(d.isPreferred))&&(d.edit===void 0||z.is(d.edit))}f.is=b})(qa||(e.CodeAction=qa={}));var Co;(function(f){function R(m,d){var C={range:m};return S.defined(d)&&(C.data=d),C}f.create=R;function b(m){var d=m;return S.defined(d)&&a.is(d.range)&&(S.undefined(d.command)||A.is(d.command))}f.is=b})(Co||(e.CodeLens=Co={}));var ja;(function(f){function R(m,d){return{tabSize:m,insertSpaces:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.uinteger(d.tabSize)&&S.boolean(d.insertSpaces)}f.is=b})(ja||(e.FormattingOptions=ja={}));var An;(function(f){function R(m,d,C){return{range:m,target:d,data:C}}f.create=R;function b(m){var d=m;return S.defined(d)&&a.is(d.range)&&(S.undefined(d.target)||S.string(d.target))}f.is=b})(An||(e.DocumentLink=An={}));var T;(function(f){function R(m,d){return{range:m,parent:d}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&a.is(d.range)&&(d.parent===void 0||f.is(d.parent))}f.is=b})(T||(e.SelectionRange=T={}));var O;(function(f){f.namespace="namespace",f.type="type",f.class="class",f.enum="enum",f.interface="interface",f.struct="struct",f.typeParameter="typeParameter",f.parameter="parameter",f.variable="variable",f.property="property",f.enumMember="enumMember",f.event="event",f.function="function",f.method="method",f.macro="macro",f.keyword="keyword",f.modifier="modifier",f.comment="comment",f.string="string",f.number="number",f.regexp="regexp",f.operator="operator",f.decorator="decorator"})(O||(e.SemanticTokenTypes=O={}));var q;(function(f){f.declaration="declaration",f.definition="definition",f.readonly="readonly",f.static="static",f.deprecated="deprecated",f.abstract="abstract",f.async="async",f.modification="modification",f.documentation="documentation",f.defaultLibrary="defaultLibrary"})(q||(e.SemanticTokenModifiers=q={}));var K;(function(f){function R(b){var m=b;return S.objectLiteral(m)&&(m.resultId===void 0||typeof m.resultId=="string")&&Array.isArray(m.data)&&(m.data.length===0||typeof m.data[0]=="number")}f.is=R})(K||(e.SemanticTokens=K={}));var Ne;(function(f){function R(m,d){return{range:m,text:d}}f.create=R;function b(m){var d=m;return d!=null&&a.is(d.range)&&S.string(d.text)}f.is=b})(Ne||(e.InlineValueText=Ne={}));var Ee;(function(f){function R(m,d,C){return{range:m,variableName:d,caseSensitiveLookup:C}}f.create=R;function b(m){var d=m;return d!=null&&a.is(d.range)&&S.boolean(d.caseSensitiveLookup)&&(S.string(d.variableName)||d.variableName===void 0)}f.is=b})(Ee||(e.InlineValueVariableLookup=Ee={}));var He;(function(f){function R(m,d){return{range:m,expression:d}}f.create=R;function b(m){var d=m;return d!=null&&a.is(d.range)&&(S.string(d.expression)||d.expression===void 0)}f.is=b})(He||(e.InlineValueEvaluatableExpression=He={}));var Xe;(function(f){function R(m,d){return{frameId:m,stoppedLocation:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&a.is(m.stoppedLocation)}f.is=b})(Xe||(e.InlineValueContext=Xe={}));var de;(function(f){f.Type=1,f.Parameter=2;function R(b){return b===1||b===2}f.is=R})(de||(e.InlayHintKind=de={}));var Ie;(function(f){function R(m){return{value:m}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&(d.tooltip===void 0||S.string(d.tooltip)||en.is(d.tooltip))&&(d.location===void 0||c.is(d.location))&&(d.command===void 0||A.is(d.command))}f.is=b})(Ie||(e.InlayHintLabelPart=Ie={}));var xe;(function(f){function R(m,d,C){var L={position:m,label:d};return C!==void 0&&(L.kind=C),L}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&s.is(d.position)&&(S.string(d.label)||S.typedArray(d.label,Ie.is))&&(d.kind===void 0||de.is(d.kind))&&d.textEdits===void 0||S.typedArray(d.textEdits,M.is)&&(d.tooltip===void 0||S.string(d.tooltip)||en.is(d.tooltip))&&(d.paddingLeft===void 0||S.boolean(d.paddingLeft))&&(d.paddingRight===void 0||S.boolean(d.paddingRight))}f.is=b})(xe||(e.InlayHint=xe={}));var ct;(function(f){function R(b){return{kind:"snippet",value:b}}f.createSnippet=R})(ct||(e.StringValue=ct={}));var It;(function(f){function R(b,m,d,C){return{insertText:b,filterText:m,range:d,command:C}}f.create=R})(It||(e.InlineCompletionItem=It={}));var Tr;(function(f){function R(b){return{items:b}}f.create=R})(Tr||(e.InlineCompletionList=Tr={}));var Xu;(function(f){f.Invoked=0,f.Automatic=1})(Xu||(e.InlineCompletionTriggerKind=Xu={}));var Zy;(function(f){function R(b,m){return{range:b,text:m}}f.create=R})(Zy||(e.SelectedCompletionInfo=Zy={}));var ev;(function(f){function R(b,m){return{triggerKind:b,selectedCompletionInfo:m}}f.create=R})(ev||(e.InlineCompletionContext=ev={}));var tv;(function(f){function R(b){var m=b;return S.objectLiteral(m)&&n.is(m.uri)&&S.string(m.name)}f.is=R})(tv||(e.WorkspaceFolder=tv={})),e.EOL=[`
31
+ `)),O){let K=T.error?` Request failed: ${T.error.message} (${T.error.code}).`:"";M.log(`Received response '${O.method} - (${T.id})' in ${Date.now()-O.timerStart}ms.${K}`,q)}else M.log(`Received response ${T.id} without active response promise.`,q)}else En("receive-response",T)}function En(T,O){if(!M||g===Ce.Off)return;let q={isLSPMessage:!0,type:T,message:O,timestamp:Date.now()};M.log(q)}function Vn(){if(B())throw new Ta(Au.Closed,"Connection is closed.");if(N())throw new Ta(Au.Disposed,"Connection is disposed.")}function Vu(){if(at())throw new Ta(Au.AlreadyListening,"Connection is already listening")}function Ku(){if(!at())throw new Error("Call listen() first.")}function tn(T){return T===void 0?null:T}function $a(T){if(T!==null)return T}function qa(T){return T!=null&&!Array.isArray(T)&&typeof T=="object"}function Co(T,O){switch(T){case re.ParameterStructures.auto:return qa(O)?$a(O):[tn(O)];case re.ParameterStructures.byName:if(!qa(O))throw new Error("Received parameters by name but param is not an object literal.");return $a(O);case re.ParameterStructures.byPosition:return[tn(O)];default:throw new Error(`Unknown parameter structure ${T.toString()}`)}}function ja(T,O){let q,K=T.numberOfParams;switch(K){case 0:q=void 0;break;case 1:q=Co(T.parameterStructures,O[0]);break;default:q=[];for(let Ne=0;Ne<O.length&&Ne<K;Ne++)q.push(tn(O[Ne]));if(O.length<K)for(let Ne=O.length;Ne<K;Ne++)q.push(null);break}return q}let An={sendNotification:(T,...O)=>{Vn();let q,K;if(st.string(T)){q=T;let Ee=O[0],He=0,Xe=re.ParameterStructures.auto;re.ParameterStructures.is(Ee)&&(He=1,Xe=Ee);let de=O.length,Ie=de-He;switch(Ie){case 0:K=void 0;break;case 1:K=Co(Xe,O[He]);break;default:if(Xe===re.ParameterStructures.byName)throw new Error(`Received ${Ie} parameters for 'by Name' notification parameter structure.`);K=O.slice(He,de).map(xe=>tn(xe));break}}else{let Ee=O;q=T.method,K=ja(T,Ee)}let Ne={jsonrpc:c,method:q,params:K};return wr(Ne),e.write(Ne).catch(Ee=>{throw i.error("Sending notification failed."),Ee})},onNotification:(T,O)=>{Vn();let q;return st.func(T)?h=T:O&&(st.string(T)?(q=T,p.set(T,{type:void 0,handler:O})):(q=T.method,p.set(T.method,{type:T,handler:O}))),{dispose:()=>{q!==void 0?p.delete(q):h=void 0}}},onProgress:(T,O,q)=>{if(y.has(O))throw new Error(`Progress handler for token ${O} already registered`);return y.set(O,q),{dispose:()=>{y.delete(O)}}},sendProgress:(T,O,q)=>An.sendNotification(Eu.type,{token:O,value:q}),onUnhandledProgress:xt.event,sendRequest:(T,...O)=>{Vn(),Ku();let q,K,Ne;if(st.string(T)){q=T;let de=O[0],Ie=O[O.length-1],xe=0,ct=re.ParameterStructures.auto;re.ParameterStructures.is(de)&&(xe=1,ct=de);let It=O.length;Lg.CancellationToken.is(Ie)&&(It=It-1,Ne=Ie);let Tr=It-xe;switch(Tr){case 0:K=void 0;break;case 1:K=Co(ct,O[xe]);break;default:if(ct===re.ParameterStructures.byName)throw new Error(`Received ${Tr} parameters for 'by Name' request parameter structure.`);K=O.slice(xe,It).map(Xu=>tn(Xu));break}}else{let de=O;q=T.method,K=ja(T,de);let Ie=T.numberOfParams;Ne=Lg.CancellationToken.is(de[Ie])?de[Ie]:void 0}let Ee=o++,He;Ne&&(He=Ne.onCancellationRequested(()=>{let de=I.sender.sendCancellation(An,Ee);return de===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${Ee}`),Promise.resolve()):de.catch(()=>{i.log(`Sending cancellation messages for id ${Ee} failed`)})}));let Xe={jsonrpc:c,id:Ee,method:q,params:K};return ar(Xe),typeof I.sender.enableCancellation=="function"&&I.sender.enableCancellation(Xe),new Promise(async(de,Ie)=>{let xe=Tr=>{de(Tr),I.sender.cleanup(Ee),He?.dispose()},ct=Tr=>{Ie(Tr),I.sender.cleanup(Ee),He?.dispose()},It={method:q,timerStart:Date.now(),resolve:xe,reject:ct};try{await e.write(Xe),D.set(Ee,It)}catch(Tr){throw i.error("Sending request failed."),It.reject(new re.ResponseError(re.ErrorCodes.MessageWriteError,Tr.message?Tr.message:"Unknown reason")),Tr}})},onRequest:(T,O)=>{Vn();let q=null;return $g.is(T)?(q=void 0,u=T):st.string(T)?(q=null,O!==void 0&&(q=T,l.set(T,{handler:O,type:void 0}))):O!==void 0&&(q=T.method,l.set(T.method,{type:T,handler:O})),{dispose:()=>{q!==null&&(q!==void 0?l.delete(q):u=void 0)}}},hasPendingResponse:()=>D.size>0,trace:async(T,O,q)=>{let K=!1,Ne=Er.Text;q!==void 0&&(st.boolean(q)?K=q:(K=q.sendNotification||!1,Ne=q.traceFormat||Er.Text)),g=T,A=Ne,g===Ce.Off?M=void 0:M=O,K&&!B()&&!N()&&await An.sendNotification(qg.type,{value:Ce.toString(T)})},onError:_e.event,onClose:Se.event,onUnhandledNotification:Nt.event,onDispose:$.event,end:()=>{e.end()},dispose:()=>{if(N())return;te=Jr.Disposed,$.fire(void 0);let T=new re.ResponseError(re.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let O of D.values())O.reject(T);D=new Map,x=new Map,w=new Set,E=new EC.LinkedMap,st.func(e.dispose)&&e.dispose(),st.func(t.dispose)&&t.dispose()},listen:()=>{Vn(),Vu(),te=Jr.Listening,t.listen(pt)},inspect:()=>{(0,kC.default)().console.log("inspect")}};return An.onNotification(nf.type,T=>{if(g===Ce.Off||!M)return;let O=g===Ce.Verbose||g===Ce.Compact;M.log(T.message,O?T.verbose:void 0)}),An.onNotification(Eu.type,T=>{let O=y.get(T.token);O?O(T.value):xt.fire(T)}),An}se.createMessageConnection=o$});var lf=G(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.ProgressType=P.ProgressToken=P.createMessageConnection=P.NullLogger=P.ConnectionOptions=P.ConnectionStrategy=P.AbstractMessageBuffer=P.WriteableStreamMessageWriter=P.AbstractMessageWriter=P.MessageWriter=P.ReadableStreamMessageReader=P.AbstractMessageReader=P.MessageReader=P.SharedArrayReceiverStrategy=P.SharedArraySenderStrategy=P.CancellationToken=P.CancellationTokenSource=P.Emitter=P.Event=P.Disposable=P.LRUCache=P.Touch=P.LinkedMap=P.ParameterStructures=P.NotificationType9=P.NotificationType8=P.NotificationType7=P.NotificationType6=P.NotificationType5=P.NotificationType4=P.NotificationType3=P.NotificationType2=P.NotificationType1=P.NotificationType0=P.NotificationType=P.ErrorCodes=P.ResponseError=P.RequestType9=P.RequestType8=P.RequestType7=P.RequestType6=P.RequestType5=P.RequestType4=P.RequestType3=P.RequestType2=P.RequestType1=P.RequestType0=P.RequestType=P.Message=P.RAL=void 0;P.MessageStrategy=P.CancellationStrategy=P.CancellationSenderStrategy=P.CancellationReceiverStrategy=P.ConnectionError=P.ConnectionErrors=P.LogTraceNotification=P.SetTraceNotification=P.TraceFormat=P.TraceValues=P.Trace=void 0;var Be=xg();Object.defineProperty(P,"Message",{enumerable:!0,get:function(){return Be.Message}});Object.defineProperty(P,"RequestType",{enumerable:!0,get:function(){return Be.RequestType}});Object.defineProperty(P,"RequestType0",{enumerable:!0,get:function(){return Be.RequestType0}});Object.defineProperty(P,"RequestType1",{enumerable:!0,get:function(){return Be.RequestType1}});Object.defineProperty(P,"RequestType2",{enumerable:!0,get:function(){return Be.RequestType2}});Object.defineProperty(P,"RequestType3",{enumerable:!0,get:function(){return Be.RequestType3}});Object.defineProperty(P,"RequestType4",{enumerable:!0,get:function(){return Be.RequestType4}});Object.defineProperty(P,"RequestType5",{enumerable:!0,get:function(){return Be.RequestType5}});Object.defineProperty(P,"RequestType6",{enumerable:!0,get:function(){return Be.RequestType6}});Object.defineProperty(P,"RequestType7",{enumerable:!0,get:function(){return Be.RequestType7}});Object.defineProperty(P,"RequestType8",{enumerable:!0,get:function(){return Be.RequestType8}});Object.defineProperty(P,"RequestType9",{enumerable:!0,get:function(){return Be.RequestType9}});Object.defineProperty(P,"ResponseError",{enumerable:!0,get:function(){return Be.ResponseError}});Object.defineProperty(P,"ErrorCodes",{enumerable:!0,get:function(){return Be.ErrorCodes}});Object.defineProperty(P,"NotificationType",{enumerable:!0,get:function(){return Be.NotificationType}});Object.defineProperty(P,"NotificationType0",{enumerable:!0,get:function(){return Be.NotificationType0}});Object.defineProperty(P,"NotificationType1",{enumerable:!0,get:function(){return Be.NotificationType1}});Object.defineProperty(P,"NotificationType2",{enumerable:!0,get:function(){return Be.NotificationType2}});Object.defineProperty(P,"NotificationType3",{enumerable:!0,get:function(){return Be.NotificationType3}});Object.defineProperty(P,"NotificationType4",{enumerable:!0,get:function(){return Be.NotificationType4}});Object.defineProperty(P,"NotificationType5",{enumerable:!0,get:function(){return Be.NotificationType5}});Object.defineProperty(P,"NotificationType6",{enumerable:!0,get:function(){return Be.NotificationType6}});Object.defineProperty(P,"NotificationType7",{enumerable:!0,get:function(){return Be.NotificationType7}});Object.defineProperty(P,"NotificationType8",{enumerable:!0,get:function(){return Be.NotificationType8}});Object.defineProperty(P,"NotificationType9",{enumerable:!0,get:function(){return Be.NotificationType9}});Object.defineProperty(P,"ParameterStructures",{enumerable:!0,get:function(){return Be.ParameterStructures}});var Wg=Rg();Object.defineProperty(P,"LinkedMap",{enumerable:!0,get:function(){return Wg.LinkedMap}});Object.defineProperty(P,"LRUCache",{enumerable:!0,get:function(){return Wg.LRUCache}});Object.defineProperty(P,"Touch",{enumerable:!0,get:function(){return Wg.Touch}});var s$=gC();Object.defineProperty(P,"Disposable",{enumerable:!0,get:function(){return s$.Disposable}});var PC=oo();Object.defineProperty(P,"Event",{enumerable:!0,get:function(){return PC.Event}});Object.defineProperty(P,"Emitter",{enumerable:!0,get:function(){return PC.Emitter}});var IC=Bc();Object.defineProperty(P,"CancellationTokenSource",{enumerable:!0,get:function(){return IC.CancellationTokenSource}});Object.defineProperty(P,"CancellationToken",{enumerable:!0,get:function(){return IC.CancellationToken}});var DC=yC();Object.defineProperty(P,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return DC.SharedArraySenderStrategy}});Object.defineProperty(P,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return DC.SharedArrayReceiverStrategy}});var Bg=xC();Object.defineProperty(P,"MessageReader",{enumerable:!0,get:function(){return Bg.MessageReader}});Object.defineProperty(P,"AbstractMessageReader",{enumerable:!0,get:function(){return Bg.AbstractMessageReader}});Object.defineProperty(P,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Bg.ReadableStreamMessageReader}});var Hg=CC();Object.defineProperty(P,"MessageWriter",{enumerable:!0,get:function(){return Hg.MessageWriter}});Object.defineProperty(P,"AbstractMessageWriter",{enumerable:!0,get:function(){return Hg.AbstractMessageWriter}});Object.defineProperty(P,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Hg.WriteableStreamMessageWriter}});var a$=SC();Object.defineProperty(P,"AbstractMessageBuffer",{enumerable:!0,get:function(){return a$.AbstractMessageBuffer}});var Ht=NC();Object.defineProperty(P,"ConnectionStrategy",{enumerable:!0,get:function(){return Ht.ConnectionStrategy}});Object.defineProperty(P,"ConnectionOptions",{enumerable:!0,get:function(){return Ht.ConnectionOptions}});Object.defineProperty(P,"NullLogger",{enumerable:!0,get:function(){return Ht.NullLogger}});Object.defineProperty(P,"createMessageConnection",{enumerable:!0,get:function(){return Ht.createMessageConnection}});Object.defineProperty(P,"ProgressToken",{enumerable:!0,get:function(){return Ht.ProgressToken}});Object.defineProperty(P,"ProgressType",{enumerable:!0,get:function(){return Ht.ProgressType}});Object.defineProperty(P,"Trace",{enumerable:!0,get:function(){return Ht.Trace}});Object.defineProperty(P,"TraceValues",{enumerable:!0,get:function(){return Ht.TraceValues}});Object.defineProperty(P,"TraceFormat",{enumerable:!0,get:function(){return Ht.TraceFormat}});Object.defineProperty(P,"SetTraceNotification",{enumerable:!0,get:function(){return Ht.SetTraceNotification}});Object.defineProperty(P,"LogTraceNotification",{enumerable:!0,get:function(){return Ht.LogTraceNotification}});Object.defineProperty(P,"ConnectionErrors",{enumerable:!0,get:function(){return Ht.ConnectionErrors}});Object.defineProperty(P,"ConnectionError",{enumerable:!0,get:function(){return Ht.ConnectionError}});Object.defineProperty(P,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Ht.CancellationReceiverStrategy}});Object.defineProperty(P,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Ht.CancellationSenderStrategy}});Object.defineProperty(P,"CancellationStrategy",{enumerable:!0,get:function(){return Ht.CancellationStrategy}});Object.defineProperty(P,"MessageStrategy",{enumerable:!0,get:function(){return Ht.MessageStrategy}});var c$=yi();P.RAL=c$.default});var MC=G(Kg=>{"use strict";Object.defineProperty(Kg,"__esModule",{value:!0});var OC=require("util"),Bn=lf(),df=class t extends Bn.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return Buffer.from(e,r)}toString(e,r){return e instanceof Buffer?e.toString(r):new OC.TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,r):Buffer.from(e,0,r)}allocNative(e){return Buffer.allocUnsafe(e)}};df.emptyBuffer=Buffer.allocUnsafe(0);var Gg=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Bn.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Bn.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Bn.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),Bn.Disposable.create(()=>this.stream.off("data",e))}},zg=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Bn.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Bn.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Bn.Disposable.create(()=>this.stream.off("end",e))}write(e,r){return new Promise((n,i)=>{let o=s=>{s==null?n():i(s)};typeof e=="string"?this.stream.write(e,r,o):this.stream.write(e,o)})}end(){this.stream.end()}},LC=Object.freeze({messageBuffer:Object.freeze({create:t=>new df(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),e.charset))}catch(r){return Promise.reject(r)}}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(e.charset))):Promise.resolve(JSON.parse(new OC.TextDecoder(e.charset).decode(t)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:t=>new Gg(t),asWritableStream:t=>new zg(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setImmediate(t,...e);return{dispose:()=>clearImmediate(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function Vg(){return LC}(function(t){function e(){Bn.RAL.install(LC)}t.install=e})(Vg||(Vg={}));Kg.default=Vg});var yo=G(ye=>{"use strict";var u$=ye&&ye.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),l$=ye&&ye.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&u$(e,t,r)};Object.defineProperty(ye,"__esModule",{value:!0});ye.createMessageConnection=ye.createServerSocketTransport=ye.createClientSocketTransport=ye.createServerPipeTransport=ye.createClientPipeTransport=ye.generateRandomPipeName=ye.StreamMessageWriter=ye.StreamMessageReader=ye.SocketMessageWriter=ye.SocketMessageReader=ye.PortMessageWriter=ye.PortMessageReader=ye.IPCMessageWriter=ye.IPCMessageReader=void 0;var Ra=MC();Ra.default.install();var FC=require("path"),d$=require("os"),f$=require("crypto"),pf=require("net"),Ar=lf();l$(lf(),ye);var Xg=class extends Ar.AbstractMessageReader{constructor(e){super(),this.process=e;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),Ar.Disposable.create(()=>this.process.off("message",e))}};ye.IPCMessageReader=Xg;var Yg=class extends Ar.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,e)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};ye.IPCMessageWriter=Yg;var Jg=class extends Ar.AbstractMessageReader{constructor(e){super(),this.onData=new Ar.Emitter,e.on("close",()=>this.fireClose),e.on("error",r=>this.fireError(r)),e.on("message",r=>{this.onData.fire(r)})}listen(e){return this.onData.event(e)}};ye.PortMessageReader=Jg;var Qg=class extends Ar.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",r=>this.fireError(r))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};ye.PortMessageWriter=Qg;var mo=class extends Ar.ReadableStreamMessageReader{constructor(e,r="utf-8"){super((0,Ra.default)().stream.asReadableStream(e),r)}};ye.SocketMessageReader=mo;var go=class extends Ar.WriteableStreamMessageWriter{constructor(e,r){super((0,Ra.default)().stream.asWritableStream(e),r),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};ye.SocketMessageWriter=go;var ff=class extends Ar.ReadableStreamMessageReader{constructor(e,r){super((0,Ra.default)().stream.asReadableStream(e),r)}};ye.StreamMessageReader=ff;var hf=class extends Ar.WriteableStreamMessageWriter{constructor(e,r){super((0,Ra.default)().stream.asWritableStream(e),r)}};ye.StreamMessageWriter=hf;var $C=process.env.XDG_RUNTIME_DIR,h$=new Map([["linux",107],["darwin",103]]);function p$(){let t=(0,f$.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;$C?e=FC.join($C,`vscode-ipc-${t}.sock`):e=FC.join(d$.tmpdir(),`vscode-${t}.sock`);let r=h$.get(process.platform);return r!==void 0&&e.length>r&&(0,Ra.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${r} characters.`),e}ye.generateRandomPipeName=p$;function m$(t,e="utf-8"){let r,n=new Promise((i,o)=>{r=i});return new Promise((i,o)=>{let s=(0,pf.createServer)(a=>{s.close(),r([new mo(a,e),new go(a,e)])});s.on("error",o),s.listen(t,()=>{s.removeListener("error",o),i({onConnected:()=>n})})})}ye.createClientPipeTransport=m$;function g$(t,e="utf-8"){let r=(0,pf.createConnection)(t);return[new mo(r,e),new go(r,e)]}ye.createServerPipeTransport=g$;function y$(t,e="utf-8"){let r,n=new Promise((i,o)=>{r=i});return new Promise((i,o)=>{let s=(0,pf.createServer)(a=>{s.close(),r([new mo(a,e),new go(a,e)])});s.on("error",o),s.listen(t,"127.0.0.1",()=>{s.removeListener("error",o),i({onConnected:()=>n})})})}ye.createClientSocketTransport=y$;function v$(t,e="utf-8"){let r=(0,pf.createConnection)(t,"127.0.0.1");return[new mo(r,e),new go(r,e)]}ye.createServerSocketTransport=v$;function x$(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function T$(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function R$(t,e,r,n){r||(r=Ar.NullLogger);let i=x$(t)?new ff(t):t,o=T$(e)?new hf(e):e;return Ar.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Ar.createMessageConnection)(i,o,r,n)}ye.createMessageConnection=R$});var Zg=G((Ree,qC)=>{"use strict";qC.exports=yo()});var gf=G((jC,mf)=>{(function(t){if(typeof mf=="object"&&typeof mf.exports=="object"){var e=t(require,jC);e!==void 0&&(mf.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],t)})(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=e.EOL=e.WorkspaceFolder=e.InlineCompletionContext=e.SelectedCompletionInfo=e.InlineCompletionTriggerKind=e.InlineCompletionList=e.InlineCompletionItem=e.StringValue=e.InlayHint=e.InlayHintLabelPart=e.InlayHintKind=e.InlineValueContext=e.InlineValueEvaluatableExpression=e.InlineValueVariableLookup=e.InlineValueText=e.SemanticTokens=e.SemanticTokenModifiers=e.SemanticTokenTypes=e.SelectionRange=e.DocumentLink=e.FormattingOptions=e.CodeLens=e.CodeAction=e.CodeActionContext=e.CodeActionTriggerKind=e.CodeActionKind=e.DocumentSymbol=e.WorkspaceSymbol=e.SymbolInformation=e.SymbolTag=e.SymbolKind=e.DocumentHighlight=e.DocumentHighlightKind=e.SignatureInformation=e.ParameterInformation=e.Hover=e.MarkedString=e.CompletionList=e.CompletionItem=e.CompletionItemLabelDetails=e.InsertTextMode=e.InsertReplaceEdit=e.CompletionItemTag=e.InsertTextFormat=e.CompletionItemKind=e.MarkupContent=e.MarkupKind=e.TextDocumentItem=e.OptionalVersionedTextDocumentIdentifier=e.VersionedTextDocumentIdentifier=e.TextDocumentIdentifier=e.WorkspaceChange=e.WorkspaceEdit=e.DeleteFile=e.RenameFile=e.CreateFile=e.TextDocumentEdit=e.AnnotatedTextEdit=e.ChangeAnnotationIdentifier=e.ChangeAnnotation=e.TextEdit=e.Command=e.Diagnostic=e.CodeDescription=e.DiagnosticTag=e.DiagnosticSeverity=e.DiagnosticRelatedInformation=e.FoldingRange=e.FoldingRangeKind=e.ColorPresentation=e.ColorInformation=e.Color=e.LocationLink=e.Location=e.Range=e.Position=e.uinteger=e.integer=e.URI=e.DocumentUri=void 0;var r;(function(f){function R(b){return typeof b=="string"}f.is=R})(r||(e.DocumentUri=r={}));var n;(function(f){function R(b){return typeof b=="string"}f.is=R})(n||(e.URI=n={}));var i;(function(f){f.MIN_VALUE=-2147483648,f.MAX_VALUE=2147483647;function R(b){return typeof b=="number"&&f.MIN_VALUE<=b&&b<=f.MAX_VALUE}f.is=R})(i||(e.integer=i={}));var o;(function(f){f.MIN_VALUE=0,f.MAX_VALUE=2147483647;function R(b){return typeof b=="number"&&f.MIN_VALUE<=b&&b<=f.MAX_VALUE}f.is=R})(o||(e.uinteger=o={}));var s;(function(f){function R(m,d){return m===Number.MAX_VALUE&&(m=o.MAX_VALUE),d===Number.MAX_VALUE&&(d=o.MAX_VALUE),{line:m,character:d}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.uinteger(d.line)&&S.uinteger(d.character)}f.is=b})(s||(e.Position=s={}));var a;(function(f){function R(m,d,C,L){if(S.uinteger(m)&&S.uinteger(d)&&S.uinteger(C)&&S.uinteger(L))return{start:s.create(m,d),end:s.create(C,L)};if(s.is(m)&&s.is(d))return{start:m,end:d};throw new Error("Range#create called with invalid arguments[".concat(m,", ").concat(d,", ").concat(C,", ").concat(L,"]"))}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&s.is(d.start)&&s.is(d.end)}f.is=b})(a||(e.Range=a={}));var c;(function(f){function R(m,d){return{uri:m,range:d}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&a.is(d.range)&&(S.string(d.uri)||S.undefined(d.uri))}f.is=b})(c||(e.Location=c={}));var u;(function(f){function R(m,d,C,L){return{targetUri:m,targetRange:d,targetSelectionRange:C,originSelectionRange:L}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&a.is(d.targetRange)&&S.string(d.targetUri)&&a.is(d.targetSelectionRange)&&(a.is(d.originSelectionRange)||S.undefined(d.originSelectionRange))}f.is=b})(u||(e.LocationLink=u={}));var l;(function(f){function R(m,d,C,L){return{red:m,green:d,blue:C,alpha:L}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.numberRange(d.red,0,1)&&S.numberRange(d.green,0,1)&&S.numberRange(d.blue,0,1)&&S.numberRange(d.alpha,0,1)}f.is=b})(l||(e.Color=l={}));var h;(function(f){function R(m,d){return{range:m,color:d}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&a.is(d.range)&&l.is(d.color)}f.is=b})(h||(e.ColorInformation=h={}));var p;(function(f){function R(m,d,C){return{label:m,textEdit:d,additionalTextEdits:C}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.string(d.label)&&(S.undefined(d.textEdit)||M.is(d))&&(S.undefined(d.additionalTextEdits)||S.typedArray(d.additionalTextEdits,M.is))}f.is=b})(p||(e.ColorPresentation=p={}));var y;(function(f){f.Comment="comment",f.Imports="imports",f.Region="region"})(y||(e.FoldingRangeKind=y={}));var _;(function(f){function R(m,d,C,L,oe,ut){var Me={startLine:m,endLine:d};return S.defined(C)&&(Me.startCharacter=C),S.defined(L)&&(Me.endCharacter=L),S.defined(oe)&&(Me.kind=oe),S.defined(ut)&&(Me.collapsedText=ut),Me}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.uinteger(d.startLine)&&S.uinteger(d.startLine)&&(S.undefined(d.startCharacter)||S.uinteger(d.startCharacter))&&(S.undefined(d.endCharacter)||S.uinteger(d.endCharacter))&&(S.undefined(d.kind)||S.string(d.kind))}f.is=b})(_||(e.FoldingRange=_={}));var E;(function(f){function R(m,d){return{location:m,message:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&c.is(d.location)&&S.string(d.message)}f.is=b})(E||(e.DiagnosticRelatedInformation=E={}));var D;(function(f){f.Error=1,f.Warning=2,f.Information=3,f.Hint=4})(D||(e.DiagnosticSeverity=D={}));var w;(function(f){f.Unnecessary=1,f.Deprecated=2})(w||(e.DiagnosticTag=w={}));var x;(function(f){function R(b){var m=b;return S.objectLiteral(m)&&S.string(m.href)}f.is=R})(x||(e.CodeDescription=x={}));var g;(function(f){function R(m,d,C,L,oe,ut){var Me={range:m,message:d};return S.defined(C)&&(Me.severity=C),S.defined(L)&&(Me.code=L),S.defined(oe)&&(Me.source=oe),S.defined(ut)&&(Me.relatedInformation=ut),Me}f.create=R;function b(m){var d,C=m;return S.defined(C)&&a.is(C.range)&&S.string(C.message)&&(S.number(C.severity)||S.undefined(C.severity))&&(S.integer(C.code)||S.string(C.code)||S.undefined(C.code))&&(S.undefined(C.codeDescription)||S.string((d=C.codeDescription)===null||d===void 0?void 0:d.href))&&(S.string(C.source)||S.undefined(C.source))&&(S.undefined(C.relatedInformation)||S.typedArray(C.relatedInformation,E.is))}f.is=b})(g||(e.Diagnostic=g={}));var A;(function(f){function R(m,d){for(var C=[],L=2;L<arguments.length;L++)C[L-2]=arguments[L];var oe={title:m,command:d};return S.defined(C)&&C.length>0&&(oe.arguments=C),oe}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.title)&&S.string(d.command)}f.is=b})(A||(e.Command=A={}));var M;(function(f){function R(C,L){return{range:C,newText:L}}f.replace=R;function b(C,L){return{range:{start:C,end:C},newText:L}}f.insert=b;function m(C){return{range:C,newText:""}}f.del=m;function d(C){var L=C;return S.objectLiteral(L)&&S.string(L.newText)&&a.is(L.range)}f.is=d})(M||(e.TextEdit=M={}));var te;(function(f){function R(m,d,C){var L={label:m};return d!==void 0&&(L.needsConfirmation=d),C!==void 0&&(L.description=C),L}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&S.string(d.label)&&(S.boolean(d.needsConfirmation)||d.needsConfirmation===void 0)&&(S.string(d.description)||d.description===void 0)}f.is=b})(te||(e.ChangeAnnotation=te={}));var _e;(function(f){function R(b){var m=b;return S.string(m)}f.is=R})(_e||(e.ChangeAnnotationIdentifier=_e={}));var Se;(function(f){function R(C,L,oe){return{range:C,newText:L,annotationId:oe}}f.replace=R;function b(C,L,oe){return{range:{start:C,end:C},newText:L,annotationId:oe}}f.insert=b;function m(C,L){return{range:C,newText:"",annotationId:L}}f.del=m;function d(C){var L=C;return M.is(L)&&(te.is(L.annotationId)||_e.is(L.annotationId))}f.is=d})(Se||(e.AnnotatedTextEdit=Se={}));var Nt;(function(f){function R(m,d){return{textDocument:m,edits:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&B.is(d.textDocument)&&Array.isArray(d.edits)}f.is=b})(Nt||(e.TextDocumentEdit=Nt={}));var xt;(function(f){function R(m,d,C){var L={kind:"create",uri:m};return d!==void 0&&(d.overwrite!==void 0||d.ignoreIfExists!==void 0)&&(L.options=d),C!==void 0&&(L.annotationId=C),L}f.create=R;function b(m){var d=m;return d&&d.kind==="create"&&S.string(d.uri)&&(d.options===void 0||(d.options.overwrite===void 0||S.boolean(d.options.overwrite))&&(d.options.ignoreIfExists===void 0||S.boolean(d.options.ignoreIfExists)))&&(d.annotationId===void 0||_e.is(d.annotationId))}f.is=b})(xt||(e.CreateFile=xt={}));var $;(function(f){function R(m,d,C,L){var oe={kind:"rename",oldUri:m,newUri:d};return C!==void 0&&(C.overwrite!==void 0||C.ignoreIfExists!==void 0)&&(oe.options=C),L!==void 0&&(oe.annotationId=L),oe}f.create=R;function b(m){var d=m;return d&&d.kind==="rename"&&S.string(d.oldUri)&&S.string(d.newUri)&&(d.options===void 0||(d.options.overwrite===void 0||S.boolean(d.options.overwrite))&&(d.options.ignoreIfExists===void 0||S.boolean(d.options.ignoreIfExists)))&&(d.annotationId===void 0||_e.is(d.annotationId))}f.is=b})($||(e.RenameFile=$={}));var I;(function(f){function R(m,d,C){var L={kind:"delete",uri:m};return d!==void 0&&(d.recursive!==void 0||d.ignoreIfNotExists!==void 0)&&(L.options=d),C!==void 0&&(L.annotationId=C),L}f.create=R;function b(m){var d=m;return d&&d.kind==="delete"&&S.string(d.uri)&&(d.options===void 0||(d.options.recursive===void 0||S.boolean(d.options.recursive))&&(d.options.ignoreIfNotExists===void 0||S.boolean(d.options.ignoreIfNotExists)))&&(d.annotationId===void 0||_e.is(d.annotationId))}f.is=b})(I||(e.DeleteFile=I={}));var z;(function(f){function R(b){var m=b;return m&&(m.changes!==void 0||m.documentChanges!==void 0)&&(m.documentChanges===void 0||m.documentChanges.every(function(d){return S.string(d.kind)?xt.is(d)||$.is(d)||I.is(d):Nt.is(d)}))}f.is=R})(z||(e.WorkspaceEdit=z={}));var W=(function(){function f(R,b){this.edits=R,this.changeAnnotations=b}return f.prototype.insert=function(R,b,m){var d,C;if(m===void 0?d=M.insert(R,b):_e.is(m)?(C=m,d=Se.insert(R,b,m)):(this.assertChangeAnnotations(this.changeAnnotations),C=this.changeAnnotations.manage(m),d=Se.insert(R,b,C)),this.edits.push(d),C!==void 0)return C},f.prototype.replace=function(R,b,m){var d,C;if(m===void 0?d=M.replace(R,b):_e.is(m)?(C=m,d=Se.replace(R,b,m)):(this.assertChangeAnnotations(this.changeAnnotations),C=this.changeAnnotations.manage(m),d=Se.replace(R,b,C)),this.edits.push(d),C!==void 0)return C},f.prototype.delete=function(R,b){var m,d;if(b===void 0?m=M.del(R):_e.is(b)?(d=b,m=Se.del(R,b)):(this.assertChangeAnnotations(this.changeAnnotations),d=this.changeAnnotations.manage(b),m=Se.del(R,d)),this.edits.push(m),d!==void 0)return d},f.prototype.add=function(R){this.edits.push(R)},f.prototype.all=function(){return this.edits},f.prototype.clear=function(){this.edits.splice(0,this.edits.length)},f.prototype.assertChangeAnnotations=function(R){if(R===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},f})(),le=(function(){function f(R){this._annotations=R===void 0?Object.create(null):R,this._counter=0,this._size=0}return f.prototype.all=function(){return this._annotations},Object.defineProperty(f.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),f.prototype.manage=function(R,b){var m;if(_e.is(R)?m=R:(m=this.nextId(),b=R),this._annotations[m]!==void 0)throw new Error("Id ".concat(m," is already in use."));if(b===void 0)throw new Error("No annotation provided for id ".concat(m));return this._annotations[m]=b,this._size++,m},f.prototype.nextId=function(){return this._counter++,this._counter.toString()},f})(),Z=(function(){function f(R){var b=this;this._textEditChanges=Object.create(null),R!==void 0?(this._workspaceEdit=R,R.documentChanges?(this._changeAnnotations=new le(R.changeAnnotations),R.changeAnnotations=this._changeAnnotations.all(),R.documentChanges.forEach(function(m){if(Nt.is(m)){var d=new W(m.edits,b._changeAnnotations);b._textEditChanges[m.textDocument.uri]=d}})):R.changes&&Object.keys(R.changes).forEach(function(m){var d=new W(R.changes[m]);b._textEditChanges[m]=d})):this._workspaceEdit={}}return Object.defineProperty(f.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),f.prototype.getTextEditChange=function(R){if(B.is(R)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var b={uri:R.uri,version:R.version},m=this._textEditChanges[b.uri];if(!m){var d=[],C={textDocument:b,edits:d};this._workspaceEdit.documentChanges.push(C),m=new W(d,this._changeAnnotations),this._textEditChanges[b.uri]=m}return m}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var m=this._textEditChanges[R];if(!m){var d=[];this._workspaceEdit.changes[R]=d,m=new W(d),this._textEditChanges[R]=m}return m}},f.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new le,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},f.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},f.prototype.createFile=function(R,b,m){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var d;te.is(b)||_e.is(b)?d=b:m=b;var C,L;if(d===void 0?C=xt.create(R,m):(L=_e.is(d)?d:this._changeAnnotations.manage(d),C=xt.create(R,m,L)),this._workspaceEdit.documentChanges.push(C),L!==void 0)return L},f.prototype.renameFile=function(R,b,m,d){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var C;te.is(m)||_e.is(m)?C=m:d=m;var L,oe;if(C===void 0?L=$.create(R,b,d):(oe=_e.is(C)?C:this._changeAnnotations.manage(C),L=$.create(R,b,d,oe)),this._workspaceEdit.documentChanges.push(L),oe!==void 0)return oe},f.prototype.deleteFile=function(R,b,m){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var d;te.is(b)||_e.is(b)?d=b:m=b;var C,L;if(d===void 0?C=I.create(R,m):(L=_e.is(d)?d:this._changeAnnotations.manage(d),C=I.create(R,m,L)),this._workspaceEdit.documentChanges.push(C),L!==void 0)return L},f})();e.WorkspaceChange=Z;var Q;(function(f){function R(m){return{uri:m}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.uri)}f.is=b})(Q||(e.TextDocumentIdentifier=Q={}));var at;(function(f){function R(m,d){return{uri:m,version:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.uri)&&S.integer(d.version)}f.is=b})(at||(e.VersionedTextDocumentIdentifier=at={}));var B;(function(f){function R(m,d){return{uri:m,version:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.uri)&&(d.version===null||S.integer(d.version))}f.is=b})(B||(e.OptionalVersionedTextDocumentIdentifier=B={}));var N;(function(f){function R(m,d,C,L){return{uri:m,languageId:d,version:C,text:L}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.string(d.uri)&&S.string(d.languageId)&&S.integer(d.version)&&S.string(d.text)}f.is=b})(N||(e.TextDocumentItem=N={}));var ke;(function(f){f.PlainText="plaintext",f.Markdown="markdown";function R(b){var m=b;return m===f.PlainText||m===f.Markdown}f.is=R})(ke||(e.MarkupKind=ke={}));var en;(function(f){function R(b){var m=b;return S.objectLiteral(b)&&ke.is(m.kind)&&S.string(m.value)}f.is=R})(en||(e.MarkupContent=en={}));var bo;(function(f){f.Text=1,f.Method=2,f.Function=3,f.Constructor=4,f.Field=5,f.Variable=6,f.Class=7,f.Interface=8,f.Module=9,f.Property=10,f.Unit=11,f.Value=12,f.Enum=13,f.Keyword=14,f.Snippet=15,f.Color=16,f.File=17,f.Reference=18,f.Folder=19,f.EnumMember=20,f.Constant=21,f.Struct=22,f.Event=23,f.Operator=24,f.TypeParameter=25})(bo||(e.CompletionItemKind=bo={}));var zn;(function(f){f.PlainText=1,f.Snippet=2})(zn||(e.InsertTextFormat=zn={}));var qt;(function(f){f.Deprecated=1})(qt||(e.CompletionItemTag=qt={}));var Pi;(function(f){function R(m,d,C){return{newText:m,insert:d,replace:C}}f.create=R;function b(m){var d=m;return d&&S.string(d.newText)&&a.is(d.insert)&&a.is(d.replace)}f.is=b})(Pi||(e.InsertReplaceEdit=Pi={}));var pt;(function(f){f.asIs=1,f.adjustIndentation=2})(pt||(e.InsertTextMode=pt={}));var jt;(function(f){function R(b){var m=b;return m&&(S.string(m.detail)||m.detail===void 0)&&(S.string(m.description)||m.description===void 0)}f.is=R})(jt||(e.CompletionItemLabelDetails=jt={}));var Wr;(function(f){function R(b){return{label:b}}f.create=R})(Wr||(e.CompletionItem=Wr={}));var Pt;(function(f){function R(b,m){return{items:b||[],isIncomplete:!!m}}f.create=R})(Pt||(e.CompletionList=Pt={}));var Gt;(function(f){function R(m){return m.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}f.fromPlainText=R;function b(m){var d=m;return S.string(d)||S.objectLiteral(d)&&S.string(d.language)&&S.string(d.value)}f.is=b})(Gt||(e.MarkedString=Gt={}));var Tt;(function(f){function R(b){var m=b;return!!m&&S.objectLiteral(m)&&(en.is(m.contents)||Gt.is(m.contents)||S.typedArray(m.contents,Gt.is))&&(b.range===void 0||a.is(b.range))}f.is=R})(Tt||(e.Hover=Tt={}));var ar;(function(f){function R(b,m){return m?{label:b,documentation:m}:{label:b}}f.create=R})(ar||(e.ParameterInformation=ar={}));var wr;(function(f){function R(b,m){for(var d=[],C=2;C<arguments.length;C++)d[C-2]=arguments[C];var L={label:b};return S.defined(m)&&(L.documentation=m),S.defined(d)?L.parameters=d:L.parameters=[],L}f.create=R})(wr||(e.SignatureInformation=wr={}));var Br;(function(f){f.Text=1,f.Read=2,f.Write=3})(Br||(e.DocumentHighlightKind=Br={}));var Ii;(function(f){function R(b,m){var d={range:b};return S.number(m)&&(d.kind=m),d}f.create=R})(Ii||(e.DocumentHighlight=Ii={}));var _o;(function(f){f.File=1,f.Module=2,f.Namespace=3,f.Package=4,f.Class=5,f.Method=6,f.Property=7,f.Field=8,f.Constructor=9,f.Enum=10,f.Interface=11,f.Function=12,f.Variable=13,f.Constant=14,f.String=15,f.Number=16,f.Boolean=17,f.Array=18,f.Object=19,f.Key=20,f.Null=21,f.EnumMember=22,f.Struct=23,f.Event=24,f.Operator=25,f.TypeParameter=26})(_o||(e.SymbolKind=_o={}));var zu;(function(f){f.Deprecated=1})(zu||(e.SymbolTag=zu={}));var En;(function(f){function R(b,m,d,C,L){var oe={name:b,kind:m,location:{uri:C,range:d}};return L&&(oe.containerName=L),oe}f.create=R})(En||(e.SymbolInformation=En={}));var Vn;(function(f){function R(b,m,d,C){return C!==void 0?{name:b,kind:m,location:{uri:d,range:C}}:{name:b,kind:m,location:{uri:d}}}f.create=R})(Vn||(e.WorkspaceSymbol=Vn={}));var Vu;(function(f){function R(m,d,C,L,oe,ut){var Me={name:m,detail:d,kind:C,range:L,selectionRange:oe};return ut!==void 0&&(Me.children=ut),Me}f.create=R;function b(m){var d=m;return d&&S.string(d.name)&&S.number(d.kind)&&a.is(d.range)&&a.is(d.selectionRange)&&(d.detail===void 0||S.string(d.detail))&&(d.deprecated===void 0||S.boolean(d.deprecated))&&(d.children===void 0||Array.isArray(d.children))&&(d.tags===void 0||Array.isArray(d.tags))}f.is=b})(Vu||(e.DocumentSymbol=Vu={}));var Ku;(function(f){f.Empty="",f.QuickFix="quickfix",f.Refactor="refactor",f.RefactorExtract="refactor.extract",f.RefactorInline="refactor.inline",f.RefactorRewrite="refactor.rewrite",f.Source="source",f.SourceOrganizeImports="source.organizeImports",f.SourceFixAll="source.fixAll"})(Ku||(e.CodeActionKind=Ku={}));var tn;(function(f){f.Invoked=1,f.Automatic=2})(tn||(e.CodeActionTriggerKind=tn={}));var $a;(function(f){function R(m,d,C){var L={diagnostics:m};return d!=null&&(L.only=d),C!=null&&(L.triggerKind=C),L}f.create=R;function b(m){var d=m;return S.defined(d)&&S.typedArray(d.diagnostics,g.is)&&(d.only===void 0||S.typedArray(d.only,S.string))&&(d.triggerKind===void 0||d.triggerKind===tn.Invoked||d.triggerKind===tn.Automatic)}f.is=b})($a||(e.CodeActionContext=$a={}));var qa;(function(f){function R(m,d,C){var L={title:m},oe=!0;return typeof d=="string"?(oe=!1,L.kind=d):A.is(d)?L.command=d:L.edit=d,oe&&C!==void 0&&(L.kind=C),L}f.create=R;function b(m){var d=m;return d&&S.string(d.title)&&(d.diagnostics===void 0||S.typedArray(d.diagnostics,g.is))&&(d.kind===void 0||S.string(d.kind))&&(d.edit!==void 0||d.command!==void 0)&&(d.command===void 0||A.is(d.command))&&(d.isPreferred===void 0||S.boolean(d.isPreferred))&&(d.edit===void 0||z.is(d.edit))}f.is=b})(qa||(e.CodeAction=qa={}));var Co;(function(f){function R(m,d){var C={range:m};return S.defined(d)&&(C.data=d),C}f.create=R;function b(m){var d=m;return S.defined(d)&&a.is(d.range)&&(S.undefined(d.command)||A.is(d.command))}f.is=b})(Co||(e.CodeLens=Co={}));var ja;(function(f){function R(m,d){return{tabSize:m,insertSpaces:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&S.uinteger(d.tabSize)&&S.boolean(d.insertSpaces)}f.is=b})(ja||(e.FormattingOptions=ja={}));var An;(function(f){function R(m,d,C){return{range:m,target:d,data:C}}f.create=R;function b(m){var d=m;return S.defined(d)&&a.is(d.range)&&(S.undefined(d.target)||S.string(d.target))}f.is=b})(An||(e.DocumentLink=An={}));var T;(function(f){function R(m,d){return{range:m,parent:d}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&a.is(d.range)&&(d.parent===void 0||f.is(d.parent))}f.is=b})(T||(e.SelectionRange=T={}));var O;(function(f){f.namespace="namespace",f.type="type",f.class="class",f.enum="enum",f.interface="interface",f.struct="struct",f.typeParameter="typeParameter",f.parameter="parameter",f.variable="variable",f.property="property",f.enumMember="enumMember",f.event="event",f.function="function",f.method="method",f.macro="macro",f.keyword="keyword",f.modifier="modifier",f.comment="comment",f.string="string",f.number="number",f.regexp="regexp",f.operator="operator",f.decorator="decorator"})(O||(e.SemanticTokenTypes=O={}));var q;(function(f){f.declaration="declaration",f.definition="definition",f.readonly="readonly",f.static="static",f.deprecated="deprecated",f.abstract="abstract",f.async="async",f.modification="modification",f.documentation="documentation",f.defaultLibrary="defaultLibrary"})(q||(e.SemanticTokenModifiers=q={}));var K;(function(f){function R(b){var m=b;return S.objectLiteral(m)&&(m.resultId===void 0||typeof m.resultId=="string")&&Array.isArray(m.data)&&(m.data.length===0||typeof m.data[0]=="number")}f.is=R})(K||(e.SemanticTokens=K={}));var Ne;(function(f){function R(m,d){return{range:m,text:d}}f.create=R;function b(m){var d=m;return d!=null&&a.is(d.range)&&S.string(d.text)}f.is=b})(Ne||(e.InlineValueText=Ne={}));var Ee;(function(f){function R(m,d,C){return{range:m,variableName:d,caseSensitiveLookup:C}}f.create=R;function b(m){var d=m;return d!=null&&a.is(d.range)&&S.boolean(d.caseSensitiveLookup)&&(S.string(d.variableName)||d.variableName===void 0)}f.is=b})(Ee||(e.InlineValueVariableLookup=Ee={}));var He;(function(f){function R(m,d){return{range:m,expression:d}}f.create=R;function b(m){var d=m;return d!=null&&a.is(d.range)&&(S.string(d.expression)||d.expression===void 0)}f.is=b})(He||(e.InlineValueEvaluatableExpression=He={}));var Xe;(function(f){function R(m,d){return{frameId:m,stoppedLocation:d}}f.create=R;function b(m){var d=m;return S.defined(d)&&a.is(m.stoppedLocation)}f.is=b})(Xe||(e.InlineValueContext=Xe={}));var de;(function(f){f.Type=1,f.Parameter=2;function R(b){return b===1||b===2}f.is=R})(de||(e.InlayHintKind=de={}));var Ie;(function(f){function R(m){return{value:m}}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&(d.tooltip===void 0||S.string(d.tooltip)||en.is(d.tooltip))&&(d.location===void 0||c.is(d.location))&&(d.command===void 0||A.is(d.command))}f.is=b})(Ie||(e.InlayHintLabelPart=Ie={}));var xe;(function(f){function R(m,d,C){var L={position:m,label:d};return C!==void 0&&(L.kind=C),L}f.create=R;function b(m){var d=m;return S.objectLiteral(d)&&s.is(d.position)&&(S.string(d.label)||S.typedArray(d.label,Ie.is))&&(d.kind===void 0||de.is(d.kind))&&d.textEdits===void 0||S.typedArray(d.textEdits,M.is)&&(d.tooltip===void 0||S.string(d.tooltip)||en.is(d.tooltip))&&(d.paddingLeft===void 0||S.boolean(d.paddingLeft))&&(d.paddingRight===void 0||S.boolean(d.paddingRight))}f.is=b})(xe||(e.InlayHint=xe={}));var ct;(function(f){function R(b){return{kind:"snippet",value:b}}f.createSnippet=R})(ct||(e.StringValue=ct={}));var It;(function(f){function R(b,m,d,C){return{insertText:b,filterText:m,range:d,command:C}}f.create=R})(It||(e.InlineCompletionItem=It={}));var Tr;(function(f){function R(b){return{items:b}}f.create=R})(Tr||(e.InlineCompletionList=Tr={}));var Xu;(function(f){f.Invoked=0,f.Automatic=1})(Xu||(e.InlineCompletionTriggerKind=Xu={}));var Zy;(function(f){function R(b,m){return{range:b,text:m}}f.create=R})(Zy||(e.SelectedCompletionInfo=Zy={}));var ev;(function(f){function R(b,m){return{triggerKind:b,selectedCompletionInfo:m}}f.create=R})(ev||(e.InlineCompletionContext=ev={}));var tv;(function(f){function R(b){var m=b;return S.objectLiteral(m)&&n.is(m.uri)&&S.string(m.name)}f.is=R})(tv||(e.WorkspaceFolder=tv={})),e.EOL=[`
32
32
  `,`\r
33
- `,"\r"];var rv;(function(f){function R(C,L,oe,ut){return new QA(C,L,oe,ut)}f.create=R;function b(C){var L=C;return!!(S.defined(L)&&S.string(L.uri)&&(S.undefined(L.languageId)||S.string(L.languageId))&&S.uinteger(L.lineCount)&&S.func(L.getText)&&S.func(L.positionAt)&&S.func(L.offsetAt))}f.is=b;function m(C,L){for(var oe=C.getText(),ut=d(L,function(So,Yu){var nv=So.range.start.line-Yu.range.start.line;return nv===0?So.range.start.character-Yu.range.start.character:nv}),Me=oe.length,Hr=ut.length-1;Hr>=0;Hr--){var Gr=ut[Hr],wn=C.offsetAt(Gr.range.start),he=C.offsetAt(Gr.range.end);if(he<=Me)oe=oe.substring(0,wn)+Gr.newText+oe.substring(he,oe.length);else throw new Error("Overlapping edit");Me=wn}return oe}f.applyEdits=m;function d(C,L){if(C.length<=1)return C;var oe=C.length/2|0,ut=C.slice(0,oe),Me=C.slice(oe);d(ut,L),d(Me,L);for(var Hr=0,Gr=0,wn=0;Hr<ut.length&&Gr<Me.length;){var he=L(ut[Hr],Me[Gr]);he<=0?C[wn++]=ut[Hr++]:C[wn++]=Me[Gr++]}for(;Hr<ut.length;)C[wn++]=ut[Hr++];for(;Gr<Me.length;)C[wn++]=Me[Gr++];return C}})(rv||(e.TextDocument=rv={}));var QA=(function(){function f(R,b,m,d){this._uri=R,this._languageId=b,this._version=m,this._content=d,this._lineOffsets=void 0}return Object.defineProperty(f.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),f.prototype.getText=function(R){if(R){var b=this.offsetAt(R.start),m=this.offsetAt(R.end);return this._content.substring(b,m)}return this._content},f.prototype.update=function(R,b){this._content=R.text,this._version=b,this._lineOffsets=void 0},f.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var R=[],b=this._content,m=!0,d=0;d<b.length;d++){m&&(R.push(d),m=!1);var C=b.charAt(d);m=C==="\r"||C===`
33
+ `,"\r"];var rv;(function(f){function R(C,L,oe,ut){return new ZA(C,L,oe,ut)}f.create=R;function b(C){var L=C;return!!(S.defined(L)&&S.string(L.uri)&&(S.undefined(L.languageId)||S.string(L.languageId))&&S.uinteger(L.lineCount)&&S.func(L.getText)&&S.func(L.positionAt)&&S.func(L.offsetAt))}f.is=b;function m(C,L){for(var oe=C.getText(),ut=d(L,function(So,Yu){var nv=So.range.start.line-Yu.range.start.line;return nv===0?So.range.start.character-Yu.range.start.character:nv}),Me=oe.length,Hr=ut.length-1;Hr>=0;Hr--){var Gr=ut[Hr],wn=C.offsetAt(Gr.range.start),he=C.offsetAt(Gr.range.end);if(he<=Me)oe=oe.substring(0,wn)+Gr.newText+oe.substring(he,oe.length);else throw new Error("Overlapping edit");Me=wn}return oe}f.applyEdits=m;function d(C,L){if(C.length<=1)return C;var oe=C.length/2|0,ut=C.slice(0,oe),Me=C.slice(oe);d(ut,L),d(Me,L);for(var Hr=0,Gr=0,wn=0;Hr<ut.length&&Gr<Me.length;){var he=L(ut[Hr],Me[Gr]);he<=0?C[wn++]=ut[Hr++]:C[wn++]=Me[Gr++]}for(;Hr<ut.length;)C[wn++]=ut[Hr++];for(;Gr<Me.length;)C[wn++]=Me[Gr++];return C}})(rv||(e.TextDocument=rv={}));var ZA=(function(){function f(R,b,m,d){this._uri=R,this._languageId=b,this._version=m,this._content=d,this._lineOffsets=void 0}return Object.defineProperty(f.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),f.prototype.getText=function(R){if(R){var b=this.offsetAt(R.start),m=this.offsetAt(R.end);return this._content.substring(b,m)}return this._content},f.prototype.update=function(R,b){this._content=R.text,this._version=b,this._lineOffsets=void 0},f.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var R=[],b=this._content,m=!0,d=0;d<b.length;d++){m&&(R.push(d),m=!1);var C=b.charAt(d);m=C==="\r"||C===`
34
34
  `,C==="\r"&&d+1<b.length&&b.charAt(d+1)===`
35
- `&&d++}m&&b.length>0&&R.push(b.length),this._lineOffsets=R}return this._lineOffsets},f.prototype.positionAt=function(R){R=Math.max(Math.min(R,this._content.length),0);var b=this.getLineOffsets(),m=0,d=b.length;if(d===0)return s.create(0,R);for(;m<d;){var C=Math.floor((m+d)/2);b[C]>R?d=C:m=C+1}var L=m-1;return s.create(L,R-b[L])},f.prototype.offsetAt=function(R){var b=this.getLineOffsets();if(R.line>=b.length)return this._content.length;if(R.line<0)return 0;var m=b[R.line],d=R.line+1<b.length?b[R.line+1]:this._content.length;return Math.max(Math.min(m+R.character,d),m)},Object.defineProperty(f.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),f})(),S;(function(f){var R=Object.prototype.toString;function b(he){return typeof he<"u"}f.defined=b;function m(he){return typeof he>"u"}f.undefined=m;function d(he){return he===!0||he===!1}f.boolean=d;function C(he){return R.call(he)==="[object String]"}f.string=C;function L(he){return R.call(he)==="[object Number]"}f.number=L;function oe(he,So,Yu){return R.call(he)==="[object Number]"&&So<=he&&he<=Yu}f.numberRange=oe;function ut(he){return R.call(he)==="[object Number]"&&-2147483648<=he&&he<=2147483647}f.integer=ut;function Me(he){return R.call(he)==="[object Number]"&&0<=he&&he<=2147483647}f.uinteger=Me;function Hr(he){return R.call(he)==="[object Function]"}f.func=Hr;function Gr(he){return he!==null&&typeof he=="object"}f.objectLiteral=Gr;function wn(he,So){return Array.isArray(he)&&he.every(So)}f.typedArray=wn})(S||(S={}))})});var tt=G(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.ProtocolNotificationType=gr.ProtocolNotificationType0=gr.ProtocolRequestType=gr.ProtocolRequestType0=gr.RegistrationType=gr.MessageDirection=void 0;var ba=yo(),UC;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(UC||(gr.MessageDirection=UC={}));var ey=class{constructor(e){this.method=e}};gr.RegistrationType=ey;var ty=class extends ba.RequestType0{constructor(e){super(e)}};gr.ProtocolRequestType0=ty;var ry=class extends ba.RequestType{constructor(e){super(e,ba.ParameterStructures.byName)}};gr.ProtocolRequestType=ry;var ny=class extends ba.NotificationType0{constructor(e){super(e)}};gr.ProtocolNotificationType0=ny;var iy=class extends ba.NotificationType{constructor(e){super(e,ba.ParameterStructures.byName)}};gr.ProtocolNotificationType=iy});var yf=G(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.objectLiteral=kt.typedArray=kt.stringArray=kt.array=kt.func=kt.error=kt.number=kt.string=kt.boolean=void 0;function R$(t){return t===!0||t===!1}kt.boolean=R$;function WC(t){return typeof t=="string"||t instanceof String}kt.string=WC;function b$(t){return typeof t=="number"||t instanceof Number}kt.number=b$;function _$(t){return t instanceof Error}kt.error=_$;function C$(t){return typeof t=="function"}kt.func=C$;function BC(t){return Array.isArray(t)}kt.array=BC;function S$(t){return BC(t)&&t.every(e=>WC(e))}kt.stringArray=S$;function k$(t,e){return Array.isArray(t)&&t.every(e)}kt.typedArray=k$;function E$(t){return t!==null&&typeof t=="object"}kt.objectLiteral=E$});var zC=G(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.ImplementationRequest=void 0;var HC=tt(),GC;(function(t){t.method="textDocument/implementation",t.messageDirection=HC.MessageDirection.clientToServer,t.type=new HC.ProtocolRequestType(t.method)})(GC||(vf.ImplementationRequest=GC={}))});var XC=G(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});xf.TypeDefinitionRequest=void 0;var VC=tt(),KC;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=VC.MessageDirection.clientToServer,t.type=new VC.ProtocolRequestType(t.method)})(KC||(xf.TypeDefinitionRequest=KC={}))});var QC=G(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.DidChangeWorkspaceFoldersNotification=_a.WorkspaceFoldersRequest=void 0;var Tf=tt(),YC;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Tf.MessageDirection.serverToClient,t.type=new Tf.ProtocolRequestType0(t.method)})(YC||(_a.WorkspaceFoldersRequest=YC={}));var JC;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Tf.MessageDirection.clientToServer,t.type=new Tf.ProtocolNotificationType(t.method)})(JC||(_a.DidChangeWorkspaceFoldersNotification=JC={}))});var tS=G(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.ConfigurationRequest=void 0;var ZC=tt(),eS;(function(t){t.method="workspace/configuration",t.messageDirection=ZC.MessageDirection.serverToClient,t.type=new ZC.ProtocolRequestType(t.method)})(eS||(Rf.ConfigurationRequest=eS={}))});var iS=G(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.ColorPresentationRequest=Ca.DocumentColorRequest=void 0;var bf=tt(),rS;(function(t){t.method="textDocument/documentColor",t.messageDirection=bf.MessageDirection.clientToServer,t.type=new bf.ProtocolRequestType(t.method)})(rS||(Ca.DocumentColorRequest=rS={}));var nS;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=bf.MessageDirection.clientToServer,t.type=new bf.ProtocolRequestType(t.method)})(nS||(Ca.ColorPresentationRequest=nS={}))});var aS=G(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.FoldingRangeRefreshRequest=Sa.FoldingRangeRequest=void 0;var _f=tt(),oS;(function(t){t.method="textDocument/foldingRange",t.messageDirection=_f.MessageDirection.clientToServer,t.type=new _f.ProtocolRequestType(t.method)})(oS||(Sa.FoldingRangeRequest=oS={}));var sS;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=_f.MessageDirection.serverToClient,t.type=new _f.ProtocolRequestType0(t.method)})(sS||(Sa.FoldingRangeRefreshRequest=sS={}))});var lS=G(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.DeclarationRequest=void 0;var cS=tt(),uS;(function(t){t.method="textDocument/declaration",t.messageDirection=cS.MessageDirection.clientToServer,t.type=new cS.ProtocolRequestType(t.method)})(uS||(Cf.DeclarationRequest=uS={}))});var hS=G(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.SelectionRangeRequest=void 0;var dS=tt(),fS;(function(t){t.method="textDocument/selectionRange",t.messageDirection=dS.MessageDirection.clientToServer,t.type=new dS.ProtocolRequestType(t.method)})(fS||(Sf.SelectionRangeRequest=fS={}))});var yS=G(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.WorkDoneProgressCancelNotification=_i.WorkDoneProgressCreateRequest=_i.WorkDoneProgress=void 0;var A$=yo(),kf=tt(),pS;(function(t){t.type=new A$.ProgressType;function e(r){return r===t.type}t.is=e})(pS||(_i.WorkDoneProgress=pS={}));var mS;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=kf.MessageDirection.serverToClient,t.type=new kf.ProtocolRequestType(t.method)})(mS||(_i.WorkDoneProgressCreateRequest=mS={}));var gS;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=kf.MessageDirection.clientToServer,t.type=new kf.ProtocolNotificationType(t.method)})(gS||(_i.WorkDoneProgressCancelNotification=gS={}))});var RS=G(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.CallHierarchyOutgoingCallsRequest=Ci.CallHierarchyIncomingCallsRequest=Ci.CallHierarchyPrepareRequest=void 0;var ka=tt(),vS;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=ka.MessageDirection.clientToServer,t.type=new ka.ProtocolRequestType(t.method)})(vS||(Ci.CallHierarchyPrepareRequest=vS={}));var xS;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=ka.MessageDirection.clientToServer,t.type=new ka.ProtocolRequestType(t.method)})(xS||(Ci.CallHierarchyIncomingCallsRequest=xS={}));var TS;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=ka.MessageDirection.clientToServer,t.type=new ka.ProtocolRequestType(t.method)})(TS||(Ci.CallHierarchyOutgoingCallsRequest=TS={}))});var ES=G(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.SemanticTokensRefreshRequest=yr.SemanticTokensRangeRequest=yr.SemanticTokensDeltaRequest=yr.SemanticTokensRequest=yr.SemanticTokensRegistrationType=yr.TokenFormat=void 0;var Hn=tt(),bS;(function(t){t.Relative="relative"})(bS||(yr.TokenFormat=bS={}));var Nu;(function(t){t.method="textDocument/semanticTokens",t.type=new Hn.RegistrationType(t.method)})(Nu||(yr.SemanticTokensRegistrationType=Nu={}));var _S;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Hn.MessageDirection.clientToServer,t.type=new Hn.ProtocolRequestType(t.method),t.registrationMethod=Nu.method})(_S||(yr.SemanticTokensRequest=_S={}));var CS;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Hn.MessageDirection.clientToServer,t.type=new Hn.ProtocolRequestType(t.method),t.registrationMethod=Nu.method})(CS||(yr.SemanticTokensDeltaRequest=CS={}));var SS;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Hn.MessageDirection.clientToServer,t.type=new Hn.ProtocolRequestType(t.method),t.registrationMethod=Nu.method})(SS||(yr.SemanticTokensRangeRequest=SS={}));var kS;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Hn.MessageDirection.serverToClient,t.type=new Hn.ProtocolRequestType0(t.method)})(kS||(yr.SemanticTokensRefreshRequest=kS={}))});var NS=G(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.ShowDocumentRequest=void 0;var AS=tt(),wS;(function(t){t.method="window/showDocument",t.messageDirection=AS.MessageDirection.serverToClient,t.type=new AS.ProtocolRequestType(t.method)})(wS||(Ef.ShowDocumentRequest=wS={}))});var DS=G(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.LinkedEditingRangeRequest=void 0;var PS=tt(),IS;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=PS.MessageDirection.clientToServer,t.type=new PS.ProtocolRequestType(t.method)})(IS||(Af.LinkedEditingRangeRequest=IS={}))});var US=G(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.WillDeleteFilesRequest=Qt.DidDeleteFilesNotification=Qt.DidRenameFilesNotification=Qt.WillRenameFilesRequest=Qt.DidCreateFilesNotification=Qt.WillCreateFilesRequest=Qt.FileOperationPatternKind=void 0;var Mr=tt(),OS;(function(t){t.file="file",t.folder="folder"})(OS||(Qt.FileOperationPatternKind=OS={}));var LS;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolRequestType(t.method)})(LS||(Qt.WillCreateFilesRequest=LS={}));var MS;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolNotificationType(t.method)})(MS||(Qt.DidCreateFilesNotification=MS={}));var FS;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolRequestType(t.method)})(FS||(Qt.WillRenameFilesRequest=FS={}));var $S;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolNotificationType(t.method)})($S||(Qt.DidRenameFilesNotification=$S={}));var qS;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolNotificationType(t.method)})(qS||(Qt.DidDeleteFilesNotification=qS={}));var jS;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolRequestType(t.method)})(jS||(Qt.WillDeleteFilesRequest=jS={}))});var zS=G(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.MonikerRequest=Si.MonikerKind=Si.UniquenessLevel=void 0;var WS=tt(),BS;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(BS||(Si.UniquenessLevel=BS={}));var HS;(function(t){t.$import="import",t.$export="export",t.local="local"})(HS||(Si.MonikerKind=HS={}));var GS;(function(t){t.method="textDocument/moniker",t.messageDirection=WS.MessageDirection.clientToServer,t.type=new WS.ProtocolRequestType(t.method)})(GS||(Si.MonikerRequest=GS={}))});var YS=G(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.TypeHierarchySubtypesRequest=ki.TypeHierarchySupertypesRequest=ki.TypeHierarchyPrepareRequest=void 0;var Ea=tt(),VS;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=Ea.MessageDirection.clientToServer,t.type=new Ea.ProtocolRequestType(t.method)})(VS||(ki.TypeHierarchyPrepareRequest=VS={}));var KS;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=Ea.MessageDirection.clientToServer,t.type=new Ea.ProtocolRequestType(t.method)})(KS||(ki.TypeHierarchySupertypesRequest=KS={}));var XS;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=Ea.MessageDirection.clientToServer,t.type=new Ea.ProtocolRequestType(t.method)})(XS||(ki.TypeHierarchySubtypesRequest=XS={}))});var ZS=G(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.InlineValueRefreshRequest=Aa.InlineValueRequest=void 0;var wf=tt(),JS;(function(t){t.method="textDocument/inlineValue",t.messageDirection=wf.MessageDirection.clientToServer,t.type=new wf.ProtocolRequestType(t.method)})(JS||(Aa.InlineValueRequest=JS={}));var QS;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=wf.MessageDirection.serverToClient,t.type=new wf.ProtocolRequestType0(t.method)})(QS||(Aa.InlineValueRefreshRequest=QS={}))});var nk=G(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.InlayHintRefreshRequest=Ei.InlayHintResolveRequest=Ei.InlayHintRequest=void 0;var wa=tt(),ek;(function(t){t.method="textDocument/inlayHint",t.messageDirection=wa.MessageDirection.clientToServer,t.type=new wa.ProtocolRequestType(t.method)})(ek||(Ei.InlayHintRequest=ek={}));var tk;(function(t){t.method="inlayHint/resolve",t.messageDirection=wa.MessageDirection.clientToServer,t.type=new wa.ProtocolRequestType(t.method)})(tk||(Ei.InlayHintResolveRequest=tk={}));var rk;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=wa.MessageDirection.serverToClient,t.type=new wa.ProtocolRequestType0(t.method)})(rk||(Ei.InlayHintRefreshRequest=rk={}))});var lk=G(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.DiagnosticRefreshRequest=Fr.WorkspaceDiagnosticRequest=Fr.DocumentDiagnosticRequest=Fr.DocumentDiagnosticReportKind=Fr.DiagnosticServerCancellationData=void 0;var uk=yo(),w$=yf(),Na=tt(),ik;(function(t){function e(r){let n=r;return n&&w$.boolean(n.retriggerRequest)}t.is=e})(ik||(Fr.DiagnosticServerCancellationData=ik={}));var ok;(function(t){t.Full="full",t.Unchanged="unchanged"})(ok||(Fr.DocumentDiagnosticReportKind=ok={}));var sk;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Na.MessageDirection.clientToServer,t.type=new Na.ProtocolRequestType(t.method),t.partialResult=new uk.ProgressType})(sk||(Fr.DocumentDiagnosticRequest=sk={}));var ak;(function(t){t.method="workspace/diagnostic",t.messageDirection=Na.MessageDirection.clientToServer,t.type=new Na.ProtocolRequestType(t.method),t.partialResult=new uk.ProgressType})(ak||(Fr.WorkspaceDiagnosticRequest=ak={}));var ck;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Na.MessageDirection.serverToClient,t.type=new Na.ProtocolRequestType0(t.method)})(ck||(Fr.DiagnosticRefreshRequest=ck={}))});var yk=G(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.DidCloseNotebookDocumentNotification=ft.DidSaveNotebookDocumentNotification=ft.DidChangeNotebookDocumentNotification=ft.NotebookCellArrayChange=ft.DidOpenNotebookDocumentNotification=ft.NotebookDocumentSyncRegistrationType=ft.NotebookDocument=ft.NotebookCell=ft.ExecutionSummary=ft.NotebookCellKind=void 0;var Pu=gf(),Qr=yf(),_n=tt(),oy;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(oy||(ft.NotebookCellKind=oy={}));var sy;(function(t){function e(i,o){let s={executionOrder:i};return(o===!0||o===!1)&&(s.success=o),s}t.create=e;function r(i){let o=i;return Qr.objectLiteral(o)&&Pu.uinteger.is(o.executionOrder)&&(o.success===void 0||Qr.boolean(o.success))}t.is=r;function n(i,o){return i===o?!0:i==null||o===null||o===void 0?!1:i.executionOrder===o.executionOrder&&i.success===o.success}t.equals=n})(sy||(ft.ExecutionSummary=sy={}));var Nf;(function(t){function e(o,s){return{kind:o,document:s}}t.create=e;function r(o){let s=o;return Qr.objectLiteral(s)&&oy.is(s.kind)&&Pu.DocumentUri.is(s.document)&&(s.metadata===void 0||Qr.objectLiteral(s.metadata))}t.is=r;function n(o,s){let a=new Set;return o.document!==s.document&&a.add("document"),o.kind!==s.kind&&a.add("kind"),o.executionSummary!==s.executionSummary&&a.add("executionSummary"),(o.metadata!==void 0||s.metadata!==void 0)&&!i(o.metadata,s.metadata)&&a.add("metadata"),(o.executionSummary!==void 0||s.executionSummary!==void 0)&&!sy.equals(o.executionSummary,s.executionSummary)&&a.add("executionSummary"),a}t.diff=n;function i(o,s){if(o===s)return!0;if(o==null||s===null||s===void 0||typeof o!=typeof s||typeof o!="object")return!1;let a=Array.isArray(o),c=Array.isArray(s);if(a!==c)return!1;if(a&&c){if(o.length!==s.length)return!1;for(let u=0;u<o.length;u++)if(!i(o[u],s[u]))return!1}if(Qr.objectLiteral(o)&&Qr.objectLiteral(s)){let u=Object.keys(o),l=Object.keys(s);if(u.length!==l.length||(u.sort(),l.sort(),!i(u,l)))return!1;for(let h=0;h<u.length;h++){let p=u[h];if(!i(o[p],s[p]))return!1}}return!0}})(Nf||(ft.NotebookCell=Nf={}));var dk;(function(t){function e(n,i,o,s){return{uri:n,notebookType:i,version:o,cells:s}}t.create=e;function r(n){let i=n;return Qr.objectLiteral(i)&&Qr.string(i.uri)&&Pu.integer.is(i.version)&&Qr.typedArray(i.cells,Nf.is)}t.is=r})(dk||(ft.NotebookDocument=dk={}));var Pa;(function(t){t.method="notebookDocument/sync",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.RegistrationType(t.method)})(Pa||(ft.NotebookDocumentSyncRegistrationType=Pa={}));var fk;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolNotificationType(t.method),t.registrationMethod=Pa.method})(fk||(ft.DidOpenNotebookDocumentNotification=fk={}));var hk;(function(t){function e(n){let i=n;return Qr.objectLiteral(i)&&Pu.uinteger.is(i.start)&&Pu.uinteger.is(i.deleteCount)&&(i.cells===void 0||Qr.typedArray(i.cells,Nf.is))}t.is=e;function r(n,i,o){let s={start:n,deleteCount:i};return o!==void 0&&(s.cells=o),s}t.create=r})(hk||(ft.NotebookCellArrayChange=hk={}));var pk;(function(t){t.method="notebookDocument/didChange",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolNotificationType(t.method),t.registrationMethod=Pa.method})(pk||(ft.DidChangeNotebookDocumentNotification=pk={}));var mk;(function(t){t.method="notebookDocument/didSave",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolNotificationType(t.method),t.registrationMethod=Pa.method})(mk||(ft.DidSaveNotebookDocumentNotification=mk={}));var gk;(function(t){t.method="notebookDocument/didClose",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolNotificationType(t.method),t.registrationMethod=Pa.method})(gk||(ft.DidCloseNotebookDocumentNotification=gk={}))});var Tk=G(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.InlineCompletionRequest=void 0;var vk=tt(),xk;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=vk.MessageDirection.clientToServer,t.type=new vk.ProtocolRequestType(t.method)})(xk||(Pf.InlineCompletionRequest=xk={}))});var DE=G(v=>{"use strict";Object.defineProperty(v,"__esModule",{value:!0});v.WorkspaceSymbolRequest=v.CodeActionResolveRequest=v.CodeActionRequest=v.DocumentSymbolRequest=v.DocumentHighlightRequest=v.ReferencesRequest=v.DefinitionRequest=v.SignatureHelpRequest=v.SignatureHelpTriggerKind=v.HoverRequest=v.CompletionResolveRequest=v.CompletionRequest=v.CompletionTriggerKind=v.PublishDiagnosticsNotification=v.WatchKind=v.RelativePattern=v.FileChangeType=v.DidChangeWatchedFilesNotification=v.WillSaveTextDocumentWaitUntilRequest=v.WillSaveTextDocumentNotification=v.TextDocumentSaveReason=v.DidSaveTextDocumentNotification=v.DidCloseTextDocumentNotification=v.DidChangeTextDocumentNotification=v.TextDocumentContentChangeEvent=v.DidOpenTextDocumentNotification=v.TextDocumentSyncKind=v.TelemetryEventNotification=v.LogMessageNotification=v.ShowMessageRequest=v.ShowMessageNotification=v.MessageType=v.DidChangeConfigurationNotification=v.ExitNotification=v.ShutdownRequest=v.InitializedNotification=v.InitializeErrorCodes=v.InitializeRequest=v.WorkDoneProgressOptions=v.TextDocumentRegistrationOptions=v.StaticRegistrationOptions=v.PositionEncodingKind=v.FailureHandlingKind=v.ResourceOperationKind=v.UnregistrationRequest=v.RegistrationRequest=v.DocumentSelector=v.NotebookCellTextDocumentFilter=v.NotebookDocumentFilter=v.TextDocumentFilter=void 0;v.MonikerRequest=v.MonikerKind=v.UniquenessLevel=v.WillDeleteFilesRequest=v.DidDeleteFilesNotification=v.WillRenameFilesRequest=v.DidRenameFilesNotification=v.WillCreateFilesRequest=v.DidCreateFilesNotification=v.FileOperationPatternKind=v.LinkedEditingRangeRequest=v.ShowDocumentRequest=v.SemanticTokensRegistrationType=v.SemanticTokensRefreshRequest=v.SemanticTokensRangeRequest=v.SemanticTokensDeltaRequest=v.SemanticTokensRequest=v.TokenFormat=v.CallHierarchyPrepareRequest=v.CallHierarchyOutgoingCallsRequest=v.CallHierarchyIncomingCallsRequest=v.WorkDoneProgressCancelNotification=v.WorkDoneProgressCreateRequest=v.WorkDoneProgress=v.SelectionRangeRequest=v.DeclarationRequest=v.FoldingRangeRefreshRequest=v.FoldingRangeRequest=v.ColorPresentationRequest=v.DocumentColorRequest=v.ConfigurationRequest=v.DidChangeWorkspaceFoldersNotification=v.WorkspaceFoldersRequest=v.TypeDefinitionRequest=v.ImplementationRequest=v.ApplyWorkspaceEditRequest=v.ExecuteCommandRequest=v.PrepareRenameRequest=v.RenameRequest=v.PrepareSupportDefaultBehavior=v.DocumentOnTypeFormattingRequest=v.DocumentRangesFormattingRequest=v.DocumentRangeFormattingRequest=v.DocumentFormattingRequest=v.DocumentLinkResolveRequest=v.DocumentLinkRequest=v.CodeLensRefreshRequest=v.CodeLensResolveRequest=v.CodeLensRequest=v.WorkspaceSymbolResolveRequest=void 0;v.InlineCompletionRequest=v.DidCloseNotebookDocumentNotification=v.DidSaveNotebookDocumentNotification=v.DidChangeNotebookDocumentNotification=v.NotebookCellArrayChange=v.DidOpenNotebookDocumentNotification=v.NotebookDocumentSyncRegistrationType=v.NotebookDocument=v.NotebookCell=v.ExecutionSummary=v.NotebookCellKind=v.DiagnosticRefreshRequest=v.WorkspaceDiagnosticRequest=v.DocumentDiagnosticRequest=v.DocumentDiagnosticReportKind=v.DiagnosticServerCancellationData=v.InlayHintRefreshRequest=v.InlayHintResolveRequest=v.InlayHintRequest=v.InlineValueRefreshRequest=v.InlineValueRequest=v.TypeHierarchySupertypesRequest=v.TypeHierarchySubtypesRequest=v.TypeHierarchyPrepareRequest=void 0;var F=tt(),Rk=gf(),Ft=yf(),N$=zC();Object.defineProperty(v,"ImplementationRequest",{enumerable:!0,get:function(){return N$.ImplementationRequest}});var P$=XC();Object.defineProperty(v,"TypeDefinitionRequest",{enumerable:!0,get:function(){return P$.TypeDefinitionRequest}});var wE=QC();Object.defineProperty(v,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return wE.WorkspaceFoldersRequest}});Object.defineProperty(v,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return wE.DidChangeWorkspaceFoldersNotification}});var I$=tS();Object.defineProperty(v,"ConfigurationRequest",{enumerable:!0,get:function(){return I$.ConfigurationRequest}});var NE=iS();Object.defineProperty(v,"DocumentColorRequest",{enumerable:!0,get:function(){return NE.DocumentColorRequest}});Object.defineProperty(v,"ColorPresentationRequest",{enumerable:!0,get:function(){return NE.ColorPresentationRequest}});var PE=aS();Object.defineProperty(v,"FoldingRangeRequest",{enumerable:!0,get:function(){return PE.FoldingRangeRequest}});Object.defineProperty(v,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return PE.FoldingRangeRefreshRequest}});var D$=lS();Object.defineProperty(v,"DeclarationRequest",{enumerable:!0,get:function(){return D$.DeclarationRequest}});var O$=hS();Object.defineProperty(v,"SelectionRangeRequest",{enumerable:!0,get:function(){return O$.SelectionRangeRequest}});var dy=yS();Object.defineProperty(v,"WorkDoneProgress",{enumerable:!0,get:function(){return dy.WorkDoneProgress}});Object.defineProperty(v,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return dy.WorkDoneProgressCreateRequest}});Object.defineProperty(v,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return dy.WorkDoneProgressCancelNotification}});var fy=RS();Object.defineProperty(v,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return fy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(v,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return fy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(v,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return fy.CallHierarchyPrepareRequest}});var Ia=ES();Object.defineProperty(v,"TokenFormat",{enumerable:!0,get:function(){return Ia.TokenFormat}});Object.defineProperty(v,"SemanticTokensRequest",{enumerable:!0,get:function(){return Ia.SemanticTokensRequest}});Object.defineProperty(v,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return Ia.SemanticTokensDeltaRequest}});Object.defineProperty(v,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return Ia.SemanticTokensRangeRequest}});Object.defineProperty(v,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return Ia.SemanticTokensRefreshRequest}});Object.defineProperty(v,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return Ia.SemanticTokensRegistrationType}});var L$=NS();Object.defineProperty(v,"ShowDocumentRequest",{enumerable:!0,get:function(){return L$.ShowDocumentRequest}});var M$=DS();Object.defineProperty(v,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return M$.LinkedEditingRangeRequest}});var vo=US();Object.defineProperty(v,"FileOperationPatternKind",{enumerable:!0,get:function(){return vo.FileOperationPatternKind}});Object.defineProperty(v,"DidCreateFilesNotification",{enumerable:!0,get:function(){return vo.DidCreateFilesNotification}});Object.defineProperty(v,"WillCreateFilesRequest",{enumerable:!0,get:function(){return vo.WillCreateFilesRequest}});Object.defineProperty(v,"DidRenameFilesNotification",{enumerable:!0,get:function(){return vo.DidRenameFilesNotification}});Object.defineProperty(v,"WillRenameFilesRequest",{enumerable:!0,get:function(){return vo.WillRenameFilesRequest}});Object.defineProperty(v,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return vo.DidDeleteFilesNotification}});Object.defineProperty(v,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return vo.WillDeleteFilesRequest}});var hy=zS();Object.defineProperty(v,"UniquenessLevel",{enumerable:!0,get:function(){return hy.UniquenessLevel}});Object.defineProperty(v,"MonikerKind",{enumerable:!0,get:function(){return hy.MonikerKind}});Object.defineProperty(v,"MonikerRequest",{enumerable:!0,get:function(){return hy.MonikerRequest}});var py=YS();Object.defineProperty(v,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return py.TypeHierarchyPrepareRequest}});Object.defineProperty(v,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return py.TypeHierarchySubtypesRequest}});Object.defineProperty(v,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return py.TypeHierarchySupertypesRequest}});var IE=ZS();Object.defineProperty(v,"InlineValueRequest",{enumerable:!0,get:function(){return IE.InlineValueRequest}});Object.defineProperty(v,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return IE.InlineValueRefreshRequest}});var my=nk();Object.defineProperty(v,"InlayHintRequest",{enumerable:!0,get:function(){return my.InlayHintRequest}});Object.defineProperty(v,"InlayHintResolveRequest",{enumerable:!0,get:function(){return my.InlayHintResolveRequest}});Object.defineProperty(v,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return my.InlayHintRefreshRequest}});var Iu=lk();Object.defineProperty(v,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Iu.DiagnosticServerCancellationData}});Object.defineProperty(v,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Iu.DocumentDiagnosticReportKind}});Object.defineProperty(v,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Iu.DocumentDiagnosticRequest}});Object.defineProperty(v,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Iu.WorkspaceDiagnosticRequest}});Object.defineProperty(v,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Iu.DiagnosticRefreshRequest}});var Cn=yk();Object.defineProperty(v,"NotebookCellKind",{enumerable:!0,get:function(){return Cn.NotebookCellKind}});Object.defineProperty(v,"ExecutionSummary",{enumerable:!0,get:function(){return Cn.ExecutionSummary}});Object.defineProperty(v,"NotebookCell",{enumerable:!0,get:function(){return Cn.NotebookCell}});Object.defineProperty(v,"NotebookDocument",{enumerable:!0,get:function(){return Cn.NotebookDocument}});Object.defineProperty(v,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return Cn.NotebookDocumentSyncRegistrationType}});Object.defineProperty(v,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return Cn.DidOpenNotebookDocumentNotification}});Object.defineProperty(v,"NotebookCellArrayChange",{enumerable:!0,get:function(){return Cn.NotebookCellArrayChange}});Object.defineProperty(v,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return Cn.DidChangeNotebookDocumentNotification}});Object.defineProperty(v,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return Cn.DidSaveNotebookDocumentNotification}});Object.defineProperty(v,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return Cn.DidCloseNotebookDocumentNotification}});var F$=Tk();Object.defineProperty(v,"InlineCompletionRequest",{enumerable:!0,get:function(){return F$.InlineCompletionRequest}});var ay;(function(t){function e(r){let n=r;return Ft.string(n)||Ft.string(n.language)||Ft.string(n.scheme)||Ft.string(n.pattern)}t.is=e})(ay||(v.TextDocumentFilter=ay={}));var cy;(function(t){function e(r){let n=r;return Ft.objectLiteral(n)&&(Ft.string(n.notebookType)||Ft.string(n.scheme)||Ft.string(n.pattern))}t.is=e})(cy||(v.NotebookDocumentFilter=cy={}));var uy;(function(t){function e(r){let n=r;return Ft.objectLiteral(n)&&(Ft.string(n.notebook)||cy.is(n.notebook))&&(n.language===void 0||Ft.string(n.language))}t.is=e})(uy||(v.NotebookCellTextDocumentFilter=uy={}));var ly;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!Ft.string(n)&&!ay.is(n)&&!uy.is(n))return!1;return!0}t.is=e})(ly||(v.DocumentSelector=ly={}));var bk;(function(t){t.method="client/registerCapability",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType(t.method)})(bk||(v.RegistrationRequest=bk={}));var _k;(function(t){t.method="client/unregisterCapability",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType(t.method)})(_k||(v.UnregistrationRequest=_k={}));var Ck;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(Ck||(v.ResourceOperationKind=Ck={}));var Sk;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(Sk||(v.FailureHandlingKind=Sk={}));var kk;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(kk||(v.PositionEncodingKind=kk={}));var Ek;(function(t){function e(r){let n=r;return n&&Ft.string(n.id)&&n.id.length>0}t.hasId=e})(Ek||(v.StaticRegistrationOptions=Ek={}));var Ak;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||ly.is(n.documentSelector))}t.is=e})(Ak||(v.TextDocumentRegistrationOptions=Ak={}));var wk;(function(t){function e(n){let i=n;return Ft.objectLiteral(i)&&(i.workDoneProgress===void 0||Ft.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&Ft.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(wk||(v.WorkDoneProgressOptions=wk={}));var Nk;(function(t){t.method="initialize",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(Nk||(v.InitializeRequest=Nk={}));var Pk;(function(t){t.unknownProtocolVersion=1})(Pk||(v.InitializeErrorCodes=Pk={}));var Ik;(function(t){t.method="initialized",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Ik||(v.InitializedNotification=Ik={}));var Dk;(function(t){t.method="shutdown",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType0(t.method)})(Dk||(v.ShutdownRequest=Dk={}));var Ok;(function(t){t.method="exit",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType0(t.method)})(Ok||(v.ExitNotification=Ok={}));var Lk;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Lk||(v.DidChangeConfigurationNotification=Lk={}));var Mk;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(Mk||(v.MessageType=Mk={}));var Fk;(function(t){t.method="window/showMessage",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolNotificationType(t.method)})(Fk||(v.ShowMessageNotification=Fk={}));var $k;(function(t){t.method="window/showMessageRequest",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType(t.method)})($k||(v.ShowMessageRequest=$k={}));var qk;(function(t){t.method="window/logMessage",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolNotificationType(t.method)})(qk||(v.LogMessageNotification=qk={}));var jk;(function(t){t.method="telemetry/event",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolNotificationType(t.method)})(jk||(v.TelemetryEventNotification=jk={}));var Uk;(function(t){t.None=0,t.Full=1,t.Incremental=2})(Uk||(v.TextDocumentSyncKind=Uk={}));var Wk;(function(t){t.method="textDocument/didOpen",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Wk||(v.DidOpenTextDocumentNotification=Wk={}));var Bk;(function(t){function e(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}t.isIncremental=e;function r(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}t.isFull=r})(Bk||(v.TextDocumentContentChangeEvent=Bk={}));var Hk;(function(t){t.method="textDocument/didChange",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Hk||(v.DidChangeTextDocumentNotification=Hk={}));var Gk;(function(t){t.method="textDocument/didClose",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Gk||(v.DidCloseTextDocumentNotification=Gk={}));var zk;(function(t){t.method="textDocument/didSave",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(zk||(v.DidSaveTextDocumentNotification=zk={}));var Vk;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(Vk||(v.TextDocumentSaveReason=Vk={}));var Kk;(function(t){t.method="textDocument/willSave",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Kk||(v.WillSaveTextDocumentNotification=Kk={}));var Xk;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(Xk||(v.WillSaveTextDocumentWaitUntilRequest=Xk={}));var Yk;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Yk||(v.DidChangeWatchedFilesNotification=Yk={}));var Jk;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(Jk||(v.FileChangeType=Jk={}));var Qk;(function(t){function e(r){let n=r;return Ft.objectLiteral(n)&&(Rk.URI.is(n.baseUri)||Rk.WorkspaceFolder.is(n.baseUri))&&Ft.string(n.pattern)}t.is=e})(Qk||(v.RelativePattern=Qk={}));var Zk;(function(t){t.Create=1,t.Change=2,t.Delete=4})(Zk||(v.WatchKind=Zk={}));var eE;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolNotificationType(t.method)})(eE||(v.PublishDiagnosticsNotification=eE={}));var tE;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(tE||(v.CompletionTriggerKind=tE={}));var rE;(function(t){t.method="textDocument/completion",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(rE||(v.CompletionRequest=rE={}));var nE;(function(t){t.method="completionItem/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(nE||(v.CompletionResolveRequest=nE={}));var iE;(function(t){t.method="textDocument/hover",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(iE||(v.HoverRequest=iE={}));var oE;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(oE||(v.SignatureHelpTriggerKind=oE={}));var sE;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(sE||(v.SignatureHelpRequest=sE={}));var aE;(function(t){t.method="textDocument/definition",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(aE||(v.DefinitionRequest=aE={}));var cE;(function(t){t.method="textDocument/references",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(cE||(v.ReferencesRequest=cE={}));var uE;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(uE||(v.DocumentHighlightRequest=uE={}));var lE;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(lE||(v.DocumentSymbolRequest=lE={}));var dE;(function(t){t.method="textDocument/codeAction",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(dE||(v.CodeActionRequest=dE={}));var fE;(function(t){t.method="codeAction/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(fE||(v.CodeActionResolveRequest=fE={}));var hE;(function(t){t.method="workspace/symbol",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(hE||(v.WorkspaceSymbolRequest=hE={}));var pE;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(pE||(v.WorkspaceSymbolResolveRequest=pE={}));var mE;(function(t){t.method="textDocument/codeLens",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(mE||(v.CodeLensRequest=mE={}));var gE;(function(t){t.method="codeLens/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(gE||(v.CodeLensResolveRequest=gE={}));var yE;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType0(t.method)})(yE||(v.CodeLensRefreshRequest=yE={}));var vE;(function(t){t.method="textDocument/documentLink",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(vE||(v.DocumentLinkRequest=vE={}));var xE;(function(t){t.method="documentLink/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(xE||(v.DocumentLinkResolveRequest=xE={}));var TE;(function(t){t.method="textDocument/formatting",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(TE||(v.DocumentFormattingRequest=TE={}));var RE;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(RE||(v.DocumentRangeFormattingRequest=RE={}));var bE;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(bE||(v.DocumentRangesFormattingRequest=bE={}));var _E;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(_E||(v.DocumentOnTypeFormattingRequest=_E={}));var CE;(function(t){t.Identifier=1})(CE||(v.PrepareSupportDefaultBehavior=CE={}));var SE;(function(t){t.method="textDocument/rename",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(SE||(v.RenameRequest=SE={}));var kE;(function(t){t.method="textDocument/prepareRename",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(kE||(v.PrepareRenameRequest=kE={}));var EE;(function(t){t.method="workspace/executeCommand",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(EE||(v.ExecuteCommandRequest=EE={}));var AE;(function(t){t.method="workspace/applyEdit",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType("workspace/applyEdit")})(AE||(v.ApplyWorkspaceEditRequest=AE={}))});var LE=G(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.createProtocolConnection=void 0;var OE=yo();function $$(t,e,r,n){return OE.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,OE.createMessageConnection)(t,e,r,n)}If.createProtocolConnection=$$});var FE=G(vr=>{"use strict";var q$=vr&&vr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Df=vr&&vr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&q$(e,t,r)};Object.defineProperty(vr,"__esModule",{value:!0});vr.LSPErrorCodes=vr.createProtocolConnection=void 0;Df(yo(),vr);Df(gf(),vr);Df(tt(),vr);Df(DE(),vr);var j$=LE();Object.defineProperty(vr,"createProtocolConnection",{enumerable:!0,get:function(){return j$.createProtocolConnection}});var ME;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(ME||(vr.LSPErrorCodes=ME={}))});var ht=G(Sn=>{"use strict";var U$=Sn&&Sn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),$E=Sn&&Sn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&U$(e,t,r)};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.createProtocolConnection=void 0;var W$=Zg();$E(Zg(),Sn);$E(FE(),Sn);function B$(t,e,r,n){return(0,W$.createMessageConnection)(t,e,r,n)}Sn.createProtocolConnection=B$});var gy=G($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.generateUuid=$r.parse=$r.isUUID=$r.v4=$r.empty=void 0;var Du=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Ou=class t extends Du{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return t._oneOf(t._chars)}constructor(){super([t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-","4",t._randomHex(),t._randomHex(),t._randomHex(),"-",t._oneOf(t._timeHighBits),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex()].join(""))}};Ou._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Ou._timeHighBits=["8","9","a","b"];$r.empty=new Du("00000000-0000-0000-0000-000000000000");function qE(){return new Ou}$r.v4=qE;var H$=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function jE(t){return H$.test(t)}$r.isUUID=jE;function G$(t){if(!jE(t))throw new Error("invalid uuid");return new Du(t)}$r.parse=G$;function z$(){return qE().asHex()}$r.generateUuid=z$});var UE=G(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.attachPartialResult=wi.ProgressFeature=wi.attachWorkDone=void 0;var Ai=ht(),V$=gy(),xo=class t{constructor(e,r){this._connection=e,this._token=r,t.Instances.set(this._token,this)}begin(e,r,n,i){let o={kind:"begin",title:e,percentage:r,message:n,cancellable:i};this._connection.sendProgress(Ai.WorkDoneProgress.type,this._token,o)}report(e,r){let n={kind:"report"};typeof e=="number"?(n.percentage=e,r!==void 0&&(n.message=r)):n.message=e,this._connection.sendProgress(Ai.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(Ai.WorkDoneProgress.type,this._token,{kind:"end"})}};xo.Instances=new Map;var Of=class extends xo{constructor(e,r){super(e,r),this._source=new Ai.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Lu=class{constructor(){}begin(){}report(){}done(){}},Lf=class extends Lu{constructor(){super(),this._source=new Ai.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function K$(t,e){if(e===void 0||e.workDoneToken===void 0)return new Lu;let r=e.workDoneToken;return delete e.workDoneToken,new xo(t,r)}wi.attachWorkDone=K$;var X$=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(Ai.WorkDoneProgressCancelNotification.type,r=>{let n=xo.Instances.get(r.token);(n instanceof Of||n instanceof Lf)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Lu:new xo(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,V$.generateUuid)();return this.connection.sendRequest(Ai.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Of(this.connection,e))}else return Promise.resolve(new Lf)}};wi.ProgressFeature=X$;var yy;(function(t){t.type=new Ai.ProgressType})(yy||(yy={}));var vy=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(yy.type,this._token,e)}};function Y$(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new vy(t,r)}wi.attachPartialResult=Y$});var WE=G(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.ConfigurationFeature=void 0;var J$=ht(),Q$=Yd(),Z$=t=>class extends t{getConfiguration(e){return e?Q$.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let r={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(J$.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};Mf.ConfigurationFeature=Z$});var BE=G($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.WorkspaceFoldersFeature=void 0;var Ff=ht(),eq=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Ff.Emitter,this.connection.onNotification(Ff.DidChangeWorkspaceFoldersNotification.type,n=>{this._onDidChangeWorkspaceFolders.fire(n.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let r=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=r===!0||typeof r=="string"}getWorkspaceFolders(){return this.connection.sendRequest(Ff.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(Ff.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};$f.WorkspaceFoldersFeature=eq});var HE=G(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});qf.CallHierarchyFeature=void 0;var xy=ht(),tq=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(xy.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=xy.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=xy.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};qf.CallHierarchyFeature=tq});var Ry=G(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.SemanticTokensBuilder=Ni.SemanticTokensDiff=Ni.SemanticTokensFeature=void 0;var jf=ht(),rq=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(jf.SemanticTokensRefreshRequest.type),on:e=>{let r=jf.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=jf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=jf.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Ni.SemanticTokensFeature=rq;var Uf=class{constructor(e,r){this.originalSequence=e,this.modifiedSequence=r}computeDiff(){let e=this.originalSequence.length,r=this.modifiedSequence.length,n=0;for(;n<r&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<r&&n<e){let i=e-1,o=r-1;for(;i>=n&&o>=n&&this.originalSequence[i]===this.modifiedSequence[o];)i--,o--;(i<n||o<n)&&(i++,o++);let s=i-n+1,a=this.modifiedSequence.slice(n,o+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:n,deleteCount:s-1}]:[{start:n,deleteCount:s,data:a}]}else return n<r?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};Ni.SemanticTokensDiff=Uf;var Ty=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,r,n,i,o){let s=e,a=r;this._dataLen>0&&(s-=this._prevLine,s===0&&(a-=this._prevChar)),this._data[this._dataLen++]=s,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=o,this._prevLine=e,this._prevChar=r}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?{resultId:this.id,edits:new Uf(this._prevData,this._data).computeDiff()}:this.build()}};Ni.SemanticTokensBuilder=Ty});var GE=G(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.ShowDocumentFeature=void 0;var nq=ht(),iq=t=>class extends t{showDocument(e){return this.connection.sendRequest(nq.ShowDocumentRequest.type,e)}};Wf.ShowDocumentFeature=iq});var zE=G(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.FileOperationsFeature=void 0;var Da=ht(),oq=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Da.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(Da.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(Da.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(Da.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(Da.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(Da.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};Bf.FileOperationsFeature=oq});var VE=G(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.LinkedEditingRangeFeature=void 0;var sq=ht(),aq=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(sq.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};Hf.LinkedEditingRangeFeature=aq});var KE=G(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.TypeHierarchyFeature=void 0;var by=ht(),cq=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(by.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=by.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=by.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Gf.TypeHierarchyFeature=cq});var YE=G(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.InlineValueFeature=void 0;var XE=ht(),uq=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(XE.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(XE.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};zf.InlineValueFeature=uq});var QE=G(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.FoldingRangeFeature=void 0;var JE=ht(),lq=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(JE.FoldingRangeRefreshRequest.type),on:e=>{let r=JE.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Vf.FoldingRangeFeature=lq});var ZE=G(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.InlayHintFeature=void 0;var _y=ht(),dq=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(_y.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(_y.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(_y.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Kf.InlayHintFeature=dq});var eA=G(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});Xf.DiagnosticFeature=void 0;var Mu=ht(),fq=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Mu.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Mu.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Mu.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(Mu.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Mu.WorkspaceDiagnosticRequest.partialResult,r)))}}};Xf.DiagnosticFeature=fq});var Sy=G(Yf=>{"use strict";Object.defineProperty(Yf,"__esModule",{value:!0});Yf.TextDocuments=void 0;var To=ht(),Cy=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new To.Emitter,this._onDidOpen=new To.Emitter,this._onDidClose=new To.Emitter,this._onDidSave=new To.Emitter,this._onWillSave=new To.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=To.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,o);let s=Object.freeze({document:o});this._onDidOpen.fire(s),this._onDidChangeContent.fire(s)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:s}=i;if(s==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=this._syncedDocuments.get(i.uri);a!==void 0&&(a=this._configuration.update(a,o,s),this._syncedDocuments.set(i.uri,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),r.push(e.onDidCloseTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(n.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(n.textDocument.uri);return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),To.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};Yf.TextDocuments=Cy});var Ey=G(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.NotebookDocuments=Oa.NotebookSyncFeature=void 0;var qr=ht(),tA=Sy(),hq=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(qr.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(qr.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(qr.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(qr.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};Oa.NotebookSyncFeature=hq;var Jf=class t{onDidOpenTextDocument(e){return this.openHandler=e,qr.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,qr.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,qr.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};Jf.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var ky=class{constructor(e){e instanceof tA.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new tA.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new qr.Emitter,this._onDidChange=new qr.Emitter,this._onDidSave=new qr.Emitter,this._onDidClose=new qr.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let r=this.notebookCellMap.get(e);return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"?e:e.document,n=this.notebookCellMap.get(r);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 r=new Jf,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let o of i.cellTextDocuments)r.openTextDocument({textDocument:o});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o===void 0)return;o.version=i.notebookDocument.version;let s=o.metadata,a=!1,c=i.change;c.metadata!==void 0&&(a=!0,o.metadata=c.metadata);let u=[],l=[],h=[],p=[];if(c.cells!==void 0){let w=c.cells;if(w.structure!==void 0){let x=w.structure.array;if(o.cells.splice(x.start,x.deleteCount,...x.cells!==void 0?x.cells:[]),w.structure.didOpen!==void 0)for(let g of w.structure.didOpen)r.openTextDocument({textDocument:g}),u.push(g.uri);if(w.structure.didClose)for(let g of w.structure.didClose)r.closeTextDocument({textDocument:g}),l.push(g.uri)}if(w.data!==void 0){let x=new Map(w.data.map(g=>[g.document,g]));for(let g=0;g<=o.cells.length;g++){let A=x.get(o.cells[g].document);if(A!==void 0){let M=o.cells.splice(g,1,A);if(h.push({old:M[0],new:A}),x.delete(A.document),x.size===0)break}}}if(w.textContent!==void 0)for(let x of w.textContent)r.changeTextDocument({textDocument:x.document,contentChanges:x.changes}),p.push(x.document.uri)}this.updateCellMap(o);let y={notebookDocument:o};a&&(y.metadata={old:s,new:o.metadata});let _=[];for(let w of u)_.push(this.getNotebookCell(w));let E=[];for(let w of l)E.push(this.getNotebookCell(w));let D=[];for(let w of p)D.push(this.getNotebookCell(w));(_.length>0||E.length>0||h.length>0||D.length>0)&&(y.cells={added:_,removed:E,changed:{data:h,textContent:D}}),(y.metadata!==void 0||y.cells!==void 0)&&this._onDidChange.fire(y)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o!==void 0){this._onDidClose.fire(o);for(let s of i.cellTextDocuments)r.closeTextDocument({textDocument:s});this.notebookDocuments.delete(i.notebookDocument.uri);for(let s of o.cells)this.notebookCellMap.delete(s.document)}})),qr.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};Oa.NotebookDocuments=ky});var rA=G(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.MonikerFeature=void 0;var pq=ht(),mq=t=>class extends t{get moniker(){return{on:e=>{let r=pq.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Qf.MonikerFeature=mq});var Dy=G(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.createConnection=be.combineFeatures=be.combineNotebooksFeatures=be.combineLanguagesFeatures=be.combineWorkspaceFeatures=be.combineWindowFeatures=be.combineClientFeatures=be.combineTracerFeatures=be.combineTelemetryFeatures=be.combineConsoleFeatures=be._NotebooksImpl=be._LanguagesImpl=be.BulkUnregistration=be.BulkRegistration=be.ErrorMessageTracker=void 0;var U=ht(),jr=Yd(),wy=gy(),ie=UE(),gq=WE(),yq=BE(),vq=HE(),xq=Ry(),Tq=GE(),Rq=zE(),bq=VE(),_q=KE(),Cq=YE(),Sq=QE(),kq=ZE(),Eq=eA(),Aq=Ey(),wq=rA();function Ay(t){if(t!==null)return t}var Ny=class{constructor(){this._messages=Object.create(null)}add(e){let r=this._messages[e];r||(r=0),r++,this._messages[e]=r}sendErrors(e){Object.keys(this._messages).forEach(r=>{e.window.showErrorMessage(r)})}};be.ErrorMessageTracker=Ny;var Zf=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(U.MessageType.Error,e)}warn(e){this.send(U.MessageType.Warning,e)}info(e){this.send(U.MessageType.Info,e)}log(e){this.send(U.MessageType.Log,e)}debug(e){this.send(U.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(U.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,U.RAL)().console.error("Sending log message failed")})}},Py=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...r){let n={type:U.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(Ay)}showWarningMessage(e,...r){let n={type:U.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(Ay)}showInformationMessage(e,...r){let n={type:U.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(Ay)}},nA=(0,Tq.ShowDocumentFeature)((0,ie.ProgressFeature)(Py)),iA;(function(t){function e(){return new eh}t.create=e})(iA||(be.BulkRegistration=iA={}));var eh=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=jr.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=wy.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},oA;(function(t){function e(){return new Fu(void 0,[])}t.create=e})(oA||(be.BulkUnregistration=oA={}));var Fu=class{constructor(e,r){this._connection=e,this._unregistrations=new Map,r.forEach(n=>{this._unregistrations.set(n.method,n)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let n of this._unregistrations.values())e.push(n);let r={unregisterations:e};this._connection.sendRequest(U.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=jr.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(U.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},o=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},th=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,r,n){return e instanceof eh?this.registerMany(e):e instanceof Fu?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=jr.string(r)?r:r.method,o=wy.generateUuid(),s={registrations:[{id:o,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(U.RegistrationRequest.type,s).then(a=>(e.add({id:o,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,r){let n=jr.string(e)?e:e.method,i=wy.generateUuid(),o={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(U.RegistrationRequest.type,o).then(s=>U.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),s=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(s)))}unregisterSingle(e,r){let n={unregisterations:[{id:e,method:r}]};return this.connection.sendRequest(U.UnregistrationRequest.type,n).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let r=e.asRegistrationParams();return this.connection.sendRequest(U.RegistrationRequest.type,r).then(()=>new Fu(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Iy=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function r(i){return i&&!!i.edit}let n=r(e)?e:{edit:e};return this.connection.sendRequest(U.ApplyWorkspaceEditRequest.type,n)}},sA=(0,Rq.FileOperationsFeature)((0,yq.WorkspaceFoldersFeature)((0,gq.ConfigurationFeature)(Iy))),rh=class{constructor(){this._trace=U.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,r){this._trace!==U.Trace.Off&&this.connection.sendNotification(U.LogTraceNotification.type,{message:e,verbose:this._trace===U.Trace.Verbose?r:void 0}).catch(()=>{})}},nh=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(U.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},ih=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,ie.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,ie.attachPartialResult)(this.connection,r)}};be._LanguagesImpl=ih;var aA=(0,Sq.FoldingRangeFeature)((0,wq.MonikerFeature)((0,Eq.DiagnosticFeature)((0,kq.InlayHintFeature)((0,Cq.InlineValueFeature)((0,_q.TypeHierarchyFeature)((0,bq.LinkedEditingRangeFeature)((0,xq.SemanticTokensFeature)((0,vq.CallHierarchyFeature)(ih))))))))),oh=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,ie.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,ie.attachPartialResult)(this.connection,r)}};be._NotebooksImpl=oh;var cA=(0,Aq.NotebookSyncFeature)(oh);function uA(t,e){return function(r){return e(t(r))}}be.combineConsoleFeatures=uA;function lA(t,e){return function(r){return e(t(r))}}be.combineTelemetryFeatures=lA;function dA(t,e){return function(r){return e(t(r))}}be.combineTracerFeatures=dA;function fA(t,e){return function(r){return e(t(r))}}be.combineClientFeatures=fA;function hA(t,e){return function(r){return e(t(r))}}be.combineWindowFeatures=hA;function pA(t,e){return function(r){return e(t(r))}}be.combineWorkspaceFeatures=pA;function mA(t,e){return function(r){return e(t(r))}}be.combineLanguagesFeatures=mA;function gA(t,e){return function(r){return e(t(r))}}be.combineNotebooksFeatures=gA;function Nq(t,e){function r(i,o,s){return i&&o?s(i,o):i||o}return{__brand:"features",console:r(t.console,e.console,uA),tracer:r(t.tracer,e.tracer,dA),telemetry:r(t.telemetry,e.telemetry,lA),client:r(t.client,e.client,fA),window:r(t.window,e.window,hA),workspace:r(t.workspace,e.workspace,pA),languages:r(t.languages,e.languages,mA),notebooks:r(t.notebooks,e.notebooks,gA)}}be.combineFeatures=Nq;function Pq(t,e,r){let n=r&&r.console?new(r.console(Zf)):new Zf,i=t(n);n.rawAttach(i);let o=r&&r.tracer?new(r.tracer(rh)):new rh,s=r&&r.telemetry?new(r.telemetry(nh)):new nh,a=r&&r.client?new(r.client(th)):new th,c=r&&r.window?new(r.window(nA)):new nA,u=r&&r.workspace?new(r.workspace(sA)):new sA,l=r&&r.languages?new(r.languages(aA)):new aA,h=r&&r.notebooks?new(r.notebooks(cA)):new cA,p=[n,o,s,a,c,u,l,h];function y(x){return x instanceof Promise?x:jr.thenable(x)?new Promise((g,A)=>{x.then(M=>g(M),M=>A(M))}):Promise.resolve(x)}let _,E,D,w={listen:()=>i.listen(),sendRequest:(x,...g)=>i.sendRequest(jr.string(x)?x:x.method,...g),onRequest:(x,g)=>i.onRequest(x,g),sendNotification:(x,g)=>{let A=jr.string(x)?x:x.method;return i.sendNotification(A,g)},onNotification:(x,g)=>i.onNotification(x,g),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:x=>(E=x,{dispose:()=>{E=void 0}}),onInitialized:x=>i.onNotification(U.InitializedNotification.type,x),onShutdown:x=>(_=x,{dispose:()=>{_=void 0}}),onExit:x=>(D=x,{dispose:()=>{D=void 0}}),get console(){return n},get telemetry(){return s},get tracer(){return o},get client(){return a},get window(){return c},get workspace(){return u},get languages(){return l},get notebooks(){return h},onDidChangeConfiguration:x=>i.onNotification(U.DidChangeConfigurationNotification.type,x),onDidChangeWatchedFiles:x=>i.onNotification(U.DidChangeWatchedFilesNotification.type,x),__textDocumentSync:void 0,onDidOpenTextDocument:x=>i.onNotification(U.DidOpenTextDocumentNotification.type,x),onDidChangeTextDocument:x=>i.onNotification(U.DidChangeTextDocumentNotification.type,x),onDidCloseTextDocument:x=>i.onNotification(U.DidCloseTextDocumentNotification.type,x),onWillSaveTextDocument:x=>i.onNotification(U.WillSaveTextDocumentNotification.type,x),onWillSaveTextDocumentWaitUntil:x=>i.onRequest(U.WillSaveTextDocumentWaitUntilRequest.type,x),onDidSaveTextDocument:x=>i.onNotification(U.DidSaveTextDocumentNotification.type,x),sendDiagnostics:x=>i.sendNotification(U.PublishDiagnosticsNotification.type,x),onHover:x=>i.onRequest(U.HoverRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onCompletion:x=>i.onRequest(U.CompletionRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onCompletionResolve:x=>i.onRequest(U.CompletionResolveRequest.type,x),onSignatureHelp:x=>i.onRequest(U.SignatureHelpRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onDeclaration:x=>i.onRequest(U.DeclarationRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onDefinition:x=>i.onRequest(U.DefinitionRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onTypeDefinition:x=>i.onRequest(U.TypeDefinitionRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onImplementation:x=>i.onRequest(U.ImplementationRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onReferences:x=>i.onRequest(U.ReferencesRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onDocumentHighlight:x=>i.onRequest(U.DocumentHighlightRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onDocumentSymbol:x=>i.onRequest(U.DocumentSymbolRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onWorkspaceSymbol:x=>i.onRequest(U.WorkspaceSymbolRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onWorkspaceSymbolResolve:x=>i.onRequest(U.WorkspaceSymbolResolveRequest.type,x),onCodeAction:x=>i.onRequest(U.CodeActionRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onCodeActionResolve:x=>i.onRequest(U.CodeActionResolveRequest.type,(g,A)=>x(g,A)),onCodeLens:x=>i.onRequest(U.CodeLensRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onCodeLensResolve:x=>i.onRequest(U.CodeLensResolveRequest.type,(g,A)=>x(g,A)),onDocumentFormatting:x=>i.onRequest(U.DocumentFormattingRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onDocumentRangeFormatting:x=>i.onRequest(U.DocumentRangeFormattingRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onDocumentOnTypeFormatting:x=>i.onRequest(U.DocumentOnTypeFormattingRequest.type,(g,A)=>x(g,A)),onRenameRequest:x=>i.onRequest(U.RenameRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onPrepareRename:x=>i.onRequest(U.PrepareRenameRequest.type,(g,A)=>x(g,A)),onDocumentLinks:x=>i.onRequest(U.DocumentLinkRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onDocumentLinkResolve:x=>i.onRequest(U.DocumentLinkResolveRequest.type,(g,A)=>x(g,A)),onDocumentColor:x=>i.onRequest(U.DocumentColorRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onColorPresentation:x=>i.onRequest(U.ColorPresentationRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onFoldingRanges:x=>i.onRequest(U.FoldingRangeRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onSelectionRanges:x=>i.onRequest(U.SelectionRangeRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onExecuteCommand:x=>i.onRequest(U.ExecuteCommandRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),dispose:()=>i.dispose()};for(let x of p)x.attach(w);return i.onRequest(U.InitializeRequest.type,x=>{e.initialize(x),jr.string(x.trace)&&(o.trace=U.Trace.fromString(x.trace));for(let g of p)g.initialize(x.capabilities);if(E){let g=E(x,new U.CancellationTokenSource().token,(0,ie.attachWorkDone)(i,x),void 0);return y(g).then(A=>{if(A instanceof U.ResponseError)return A;let M=A;M||(M={capabilities:{}});let te=M.capabilities;te||(te={},M.capabilities=te),te.textDocumentSync===void 0||te.textDocumentSync===null?te.textDocumentSync=jr.number(w.__textDocumentSync)?w.__textDocumentSync:U.TextDocumentSyncKind.None:!jr.number(te.textDocumentSync)&&!jr.number(te.textDocumentSync.change)&&(te.textDocumentSync.change=jr.number(w.__textDocumentSync)?w.__textDocumentSync:U.TextDocumentSyncKind.None);for(let _e of p)_e.fillServerCapabilities(te);return M})}else{let g={capabilities:{textDocumentSync:U.TextDocumentSyncKind.None}};for(let A of p)A.fillServerCapabilities(g.capabilities);return g}}),i.onRequest(U.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,_)return _(new U.CancellationTokenSource().token)}),i.onNotification(U.ExitNotification.type,()=>{try{D&&D()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(U.SetTraceNotification.type,x=>{o.trace=U.Trace.fromString(x.value)}),w}be.createConnection=Pq});var yA=G(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.resolveModulePath=xr.FileSystem=xr.resolveGlobalYarnPath=xr.resolveGlobalNodePath=xr.resolve=xr.uriToFilePath=void 0;var Iq=require("url"),Zr=require("path"),Oy=require("fs"),$y=require("child_process");function Dq(t){let e=Iq.parse(t);if(e.protocol!=="file:"||!e.path)return;let r=e.path.split("/");for(var n=0,i=r.length;n<i;n++)r[n]=decodeURIComponent(r[n]);if(process.platform==="win32"&&r.length>1){let o=r[0],s=r[1];o.length===0&&s.length>1&&s[1]===":"&&r.shift()}return Zr.normalize(r.join("/"))}xr.uriToFilePath=Dq;function Ly(){return process.platform==="win32"}function sh(t,e,r,n){let i="NODE_PATH",o=["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((s,a)=>{let c=process.env,u=Object.create(null);Object.keys(c).forEach(l=>u[l]=c[l]),e&&Oy.existsSync(e)&&(u[i]?u[i]=e+Zr.delimiter+u[i]:u[i]=e,n&&n(`NODE_PATH value is: ${u[i]}`)),u.ELECTRON_RUN_AS_NODE="1";try{let l=(0,$y.fork)("",[],{cwd:r,env:u,execArgv:["-e",o]});if(l.pid===void 0){a(new Error(`Starting process to resolve node module ${t} failed`));return}l.on("error",p=>{a(p)}),l.on("message",p=>{p.c==="r"&&(l.send({c:"e"}),p.s?s(p.r):a(new Error(`Failed to resolve module: ${t}`)))});let h={c:"rs",a:t};l.send(h)}catch(l){a(l)}})}xr.resolve=sh;function My(t){let e="npm",r=Object.create(null);Object.keys(process.env).forEach(o=>r[o]=process.env[o]),r.NO_UPDATE_NOTIFIER="true";let n={encoding:"utf8",env:r};Ly()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let o=(0,$y.spawnSync)(e,["config","get","prefix"],n).stdout;if(!o){t&&t("'npm config get prefix' didn't return a value.");return}let s=o.trim();return t&&t(`'npm config get prefix' value is: ${s}`),s.length>0?Ly()?Zr.join(s,"node_modules"):Zr.join(s,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}xr.resolveGlobalNodePath=My;function Oq(t){let e="yarn",r={encoding:"utf8"};Ly()&&(e="yarn.cmd",r.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,$y.spawnSync)(e,["global","dir","--json"],r),o=i.stdout;if(!o){t&&(t("'yarn global dir' didn't return a value."),i.stderr&&t(i.stderr));return}let s=o.trim().split(/\r?\n/);for(let a of s)try{let c=JSON.parse(a);if(c.type==="log")return Zr.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}xr.resolveGlobalYarnPath=Oq;var Fy;(function(t){let e;function r(){return e!==void 0||(process.platform==="win32"?e=!1:e=!Oy.existsSync(__filename.toUpperCase())||!Oy.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=r;function n(i,o){return r()?Zr.normalize(o).indexOf(Zr.normalize(i))===0:Zr.normalize(o).toLowerCase().indexOf(Zr.normalize(i).toLowerCase())===0}t.isParent=n})(Fy||(xr.FileSystem=Fy={}));function Lq(t,e,r,n){return r?(Zr.isAbsolute(r)||(r=Zr.join(t,r)),sh(e,r,r,n).then(i=>Fy.isParent(r,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>sh(e,My(n),t,n))):sh(e,My(n),t,n)}xr.resolveModulePath=Lq});var qy=G((Ate,vA)=>{"use strict";vA.exports=ht()});var xA=G(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.InlineCompletionFeature=void 0;var Mq=ht(),Fq=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(Mq.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};ah.InlineCompletionFeature=Fq});var bA=G(Zt=>{"use strict";var $q=Zt&&Zt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),RA=Zt&&Zt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$q(e,t,r)};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.ProposedFeatures=Zt.NotebookDocuments=Zt.TextDocuments=Zt.SemanticTokensBuilder=void 0;var qq=Ry();Object.defineProperty(Zt,"SemanticTokensBuilder",{enumerable:!0,get:function(){return qq.SemanticTokensBuilder}});var jq=xA();RA(ht(),Zt);var Uq=Sy();Object.defineProperty(Zt,"TextDocuments",{enumerable:!0,get:function(){return Uq.TextDocuments}});var Wq=Ey();Object.defineProperty(Zt,"NotebookDocuments",{enumerable:!0,get:function(){return Wq.NotebookDocuments}});RA(Dy(),Zt);var TA;(function(t){t.all={__brand:"features",languages:jq.InlineCompletionFeature}})(TA||(Zt.ProposedFeatures=TA={}))});var kn=G(Ur=>{"use strict";var Bq=Ur&&Ur.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),kA=Ur&&Ur.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Bq(e,t,r)};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.createConnection=Ur.Files=void 0;var _A=require("node:util"),jy=Yd(),Hq=Dy(),$u=yA(),Ro=qy();kA(qy(),Ur);kA(bA(),Ur);var CA;(function(t){t.uriToFilePath=$u.uriToFilePath,t.resolveGlobalNodePath=$u.resolveGlobalNodePath,t.resolveGlobalYarnPath=$u.resolveGlobalYarnPath,t.resolve=$u.resolve,t.resolveModulePath=$u.resolveModulePath})(CA||(Ur.Files=CA={}));var SA;function ch(){if(SA!==void 0)try{SA.end()}catch{}}var La=!1,EA;function Gq(){let t="--clientProcessId";function e(r){try{let n=parseInt(r);isNaN(n)||(EA=setInterval(()=>{try{process.kill(n,0)}catch{ch(),process.exit(La?0:1)}},3e3))}catch{}}for(let r=2;r<process.argv.length;r++){let n=process.argv[r];if(n===t&&r+1<process.argv.length){e(process.argv[r+1]);return}else{let i=n.split("=");i[0]===t&&e(i[1])}}}Gq();var zq={initialize:t=>{let e=t.processId;jy.number(e)&&EA===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(La?0:1)}},3e3)},get shutdownReceived(){return La},set shutdownReceived(t){La=t},exit:t=>{ch(),process.exit(t)}};function Vq(t,e,r,n){let i,o,s,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),Ro.ConnectionStrategy.is(t)||Ro.ConnectionOptions.is(t)?a=t:(o=t,s=e,a=r),Kq(o,s,a,i)}Ur.createConnection=Vq;function Kq(t,e,r,n){let i=!1;if(!t&&!e&&process.argv.length>2){let c,u,l=process.argv.slice(2);for(let h=0;h<l.length;h++){let p=l[h];if(p==="--node-ipc"){t=new Ro.IPCMessageReader(process),e=new Ro.IPCMessageWriter(process);break}else if(p==="--stdio"){i=!0,t=process.stdin,e=process.stdout;break}else if(p==="--socket"){c=parseInt(l[h+1]);break}else if(p==="--pipe"){u=l[h+1];break}else{var o=p.split("=");if(o[0]==="--socket"){c=parseInt(o[1]);break}else if(o[0]==="--pipe"){u=o[1];break}}}if(c){let h=(0,Ro.createServerSocketTransport)(c);t=h[0],e=h[1]}else if(u){let h=(0,Ro.createServerPipeTransport)(u);t=h[0],e=h[1]}}var s="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!t)throw new Error("Connection input stream is not set. "+s);if(!e)throw new Error("Connection output stream is not set. "+s);if(jy.func(t.read)&&jy.func(t.on)){let c=t;c.on("end",()=>{ch(),process.exit(La?0:1)}),c.on("close",()=>{ch(),process.exit(La?0:1)})}let a=c=>{let u=(0,Ro.createProtocolConnection)(t,e,c,r);return i&&Xq(c),u};return(0,Hq.createConnection)(a,zq,n)}function Xq(t){function e(n){return n.map(i=>typeof i=="string"?i:(0,_A.inspect)(i)).join(" ")}let r=new Map;console.assert=function(i,...o){if(!i)if(o.length===0)t.error("Assertion failed");else{let[s,...a]=o;t.error(`Assertion failed: ${s} ${e(a)}`)}},console.count=function(i="default"){let o=String(i),s=r.get(o)??0;s+=1,r.set(o,s),t.log(`${o}: ${o}`)},console.countReset=function(i){i===void 0?r.clear():r.delete(String(i))},console.debug=function(...i){t.log(e(i))},console.dir=function(i,o){t.log((0,_A.inspect)(i,o))},console.log=function(...i){t.log(e(i))},console.error=function(...i){t.error(e(i))},console.trace=function(...i){let o=new Error().stack.replace(/(.+\n){2}/,""),s="Trace";i.length!==0&&(s+=`: ${e(i)}`),t.log(`${s}
36
- ${o}`)},console.warn=function(...i){t.warn(e(i))}}});var fj={};Kn(fj,{getSyntaxTree:()=>dj});module.exports=iw(fj);var dt={};Kn(dt,{AbstractAstReflection:()=>Di,AbstractCstNode:()=>Fc,AbstractLangiumParser:()=>$c,AbstractParserErrorMessageProvider:()=>Pd,AbstractThreadedAsyncParser:()=>Gm,AstUtils:()=>al,BiMap:()=>so,Cancellation:()=>J,CompositeCstNodeImpl:()=>ro,ContextCache:()=>ao,CstNodeBuilder:()=>Mc,CstUtils:()=>tl,DEFAULT_TOKENIZE_OPTIONS:()=>Wd,DONE_RESULT:()=>zt,DatatypeSymbol:()=>Nd,DefaultAstNodeDescriptionProvider:()=>nu,DefaultAstNodeLocator:()=>ou,DefaultAsyncParser:()=>yu,DefaultCommentProvider:()=>gu,DefaultConfigurationProvider:()=>su,DefaultDocumentBuilder:()=>au,DefaultDocumentValidator:()=>uo,DefaultHydrator:()=>xu,DefaultIndexManager:()=>cu,DefaultJsonSerializer:()=>Zc,DefaultLangiumDocumentFactory:()=>Hc,DefaultLangiumDocuments:()=>Gc,DefaultLexer:()=>lo,DefaultLexerErrorMessageProvider:()=>lu,DefaultLinker:()=>zc,DefaultNameProvider:()=>Vc,DefaultReferenceDescriptionProvider:()=>iu,DefaultReferences:()=>Kc,DefaultScopeComputation:()=>Xc,DefaultScopeProvider:()=>Qc,DefaultServiceRegistry:()=>tu,DefaultTokenBuilder:()=>io,DefaultValueConverter:()=>Wc,DefaultWorkspaceLock:()=>vu,DefaultWorkspaceManager:()=>uu,Deferred:()=>sr,Disposable:()=>xi,DisposableCache:()=>pa,DocumentCache:()=>jd,DocumentState:()=>Le,DocumentValidator:()=>Lr,EMPTY_SCOPE:()=>AF,EMPTY_STREAM:()=>Wa,EmptyFileSystem:()=>_u,EmptyFileSystemProvider:()=>Kd,ErrorWithLocation:()=>Fi,GrammarAST:()=>ji,GrammarUtils:()=>fl,IndentationAwareLexer:()=>Km,IndentationAwareTokenBuilder:()=>Vd,JSDocDocumentationProvider:()=>mu,LangiumCompletionParser:()=>jc,LangiumParser:()=>qc,LangiumParserErrorMessageProvider:()=>ca,LeafCstNodeImpl:()=>to,LexingMode:()=>ho,MapScope:()=>Yc,Module:()=>ya,MultiMap:()=>Yr,OperationCancelled:()=>Rn,ParserWorker:()=>zm,Reduction:()=>ko,RegExpUtils:()=>ll,RootCstNodeImpl:()=>aa,SimpleCache:()=>Jc,StreamImpl:()=>Rr,StreamScope:()=>ha,TextDocument:()=>vi,TreeStreamImpl:()=>rn,URI:()=>vt,UriUtils:()=>ge,ValidationCategory:()=>ga,ValidationRegistry:()=>ru,ValueConverter:()=>Tn,WorkspaceCache:()=>ma,assertUnreachable:()=>on,createCompletionParser:()=>wm,createDefaultCoreModule:()=>Tu,createDefaultSharedCoreModule:()=>Ru,createGrammarConfig:()=>Sp,createLangiumParser:()=>Nm,createParser:()=>Uc,delayNextTick:()=>Fm,diagnosticData:()=>co,eagerLoad:()=>bu,getDiagnosticRange:()=>Q_,indentationBuilderDefaultOptions:()=>Vm,inject:()=>fo,interruptAndCheck:()=>ot,isAstNode:()=>Ge,isAstNodeDescription:()=>Fh,isAstNodeWithComment:()=>eu,isCompositeCstNode:()=>zr,isIMultiModeLexerDefinition:()=>Um,isJSDoc:()=>pu,isLeafCstNode:()=>Xn,isLinkingError:()=>Oi,isNamed:()=>qd,isOperationCancelled:()=>bn,isReference:()=>Ut,isRootCstNode:()=>Ua,isTokenTypeArray:()=>Bd,isTokenTypeDictionary:()=>jm,loadGrammarFromJson:()=>Xd,parseJSDoc:()=>hu,prepareLangiumParser:()=>U_,setInterruptionPeriod:()=>z_,startCancelableOperation:()=>Fd,stream:()=>ce,toDiagnosticData:()=>Z_,toDiagnosticSeverity:()=>Ud});var tl={};Kn(tl,{DefaultNameRegexp:()=>el,RangeComparison:()=>nn,compareRange:()=>ov,findCommentNode:()=>Ba,findDeclarationNodeAtOffset:()=>cr,findLeafNodeAtOffset:()=>Wh,findLeafNodeBeforeOffset:()=>Ha,flattenCst:()=>qh,getInteriorNodes:()=>uw,getNextNode:()=>aw,getPreviousNode:()=>av,getStartlineNode:()=>cw,inRange:()=>Uh,isChildNode:()=>jh,isCommentNode:()=>$h,streamCst:()=>Li,toDocumentSegment:()=>Mi,tokenToRange:()=>Eo});function Ge(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Ut(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function Fh(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Oi(t){return typeof t=="object"&&t!==null&&Ge(t.container)&&Ut(t.reference)&&typeof t.message=="string"}var Di=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,r){return Ge(e)&&this.isSubtype(e.$type,r)}isSubtype(e,r){if(e===r)return!0;let n=this.subtypes[e];n||(n=this.subtypes[e]={});let i=n[r];if(i!==void 0)return i;{let o=this.computeIsSubtype(e,r);return n[r]=o,o}}getAllSubTypes(e){let r=this.allSubtypes[e];if(r)return r;{let n=this.getAllTypes(),i=[];for(let o of n)this.isSubtype(o,e)&&i.push(o);return this.allSubtypes[e]=i,i}}};function zr(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Xn(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function Ua(t){return zr(t)&&typeof t.fullText=="string"}var Rr=class t{constructor(e,r){this.startFn=e,this.nextFn=r}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(),r=0,n=e.next();for(;!n.done;)r++,n=e.next();return r}toArray(){let e=[],r=this.iterator(),n;do n=r.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,r){let n=this.map(i=>[e?e(i):i,r?r(i):i]);return new Map(n)}toString(){return this.join()}concat(e){return new t(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),r=>{let n;if(!r.firstDone){do if(n=this.nextFn(r.first),!n.done)return n;while(!n.done);r.firstDone=!0}do if(n=r.iterator.next(),!n.done)return n;while(!n.done);return zt})}join(e=","){let r=this.iterator(),n="",i,o=!1;do i=r.next(),i.done||(o&&(n+=e),n+=sw(i.value)),o=!0;while(!i.done);return n}indexOf(e,r=0){let n=this.iterator(),i=0,o=n.next();for(;!o.done;){if(i>=r&&o.value===e)return i;o=n.next(),i++}return-1}every(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(!e(n.value))return!1;n=r.next()}return!0}some(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return!0;n=r.next()}return!1}forEach(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;)e(i.value,n),i=r.next(),n++}map(e){return new t(this.startFn,r=>{let{done:n,value:i}=this.nextFn(r);return n?zt:{done:!1,value:e(i)}})}filter(e){return new t(this.startFn,r=>{let n;do if(n=this.nextFn(r),!n.done&&e(n.value))return n;while(!n.done);return zt})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,r){let n=this.iterator(),i=r,o=n.next();for(;!o.done;)i===void 0?i=o.value:i=e(i,o.value),o=n.next();return i}reduceRight(e,r){return this.recursiveReduce(this.iterator(),e,r)}recursiveReduce(e,r,n){let i=e.next();if(i.done)return n;let o=this.recursiveReduce(e,r,n);return o===void 0?i.value:r(o,i.value)}find(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return n.value;n=r.next()}}findIndex(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;){if(e(i.value))return n;i=r.next(),n++}return-1}includes(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(n.value===e)return!0;n=r.next()}return!1}flatMap(e){return new t(()=>({this:this.startFn()}),r=>{do{if(r.iterator){let o=r.iterator.next();if(o.done)r.iterator=void 0;else return o}let{done:n,value:i}=this.nextFn(r.this);if(!n){let o=e(i);if(Zu(o))r.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}}while(r.iterator);return zt})}flat(e){if(e===void 0&&(e=1),e<=0)return this;let r=e>1?this.flat(e-1):this;return new t(()=>({this:r.startFn()}),n=>{do{if(n.iterator){let s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}let{done:i,value:o}=r.nextFn(n.this);if(!i)if(Zu(o))n.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}while(n.iterator);return zt})}head(){let r=this.iterator().next();if(!r.done)return r.value}tail(e=1){return new t(()=>{let r=this.startFn();for(let n=0;n<e;n++)if(this.nextFn(r).done)return r;return r},this.nextFn)}limit(e){return new t(()=>({size:0,state:this.startFn()}),r=>(r.size++,r.size>e?zt:this.nextFn(r.state)))}distinct(e){return new t(()=>({set:new Set,internalState:this.startFn()}),r=>{let n;do if(n=this.nextFn(r.internalState),!n.done){let i=e?e(n.value):n.value;if(!r.set.has(i))return r.set.add(i),n}while(!n.done);return zt})}exclude(e,r){let n=new Set;for(let i of e){let o=r?r(i):i;n.add(o)}return this.filter(i=>{let o=r?r(i):i;return!n.has(o)})}};function sw(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function Zu(t){return!!t&&typeof t[Symbol.iterator]=="function"}var Wa=new Rr(()=>{},()=>zt),zt=Object.freeze({done:!0,value:void 0});function ce(...t){if(t.length===1){let e=t[0];if(e instanceof Rr)return e;if(Zu(e))return new Rr(()=>e[Symbol.iterator](),r=>r.next());if(typeof e.length=="number")return new Rr(()=>({index:0}),r=>r.index<e.length?{done:!1,value:e[r.index++]}:zt)}return t.length>1?new Rr(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){let r=e.iterator.next();if(!r.done)return r;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){let r=t[e.collIndex++];Zu(r)?e.iterator=r[Symbol.iterator]():r&&typeof r.length=="number"&&(e.array=r)}}while(e.iterator||e.array||e.collIndex<t.length);return zt}):Wa}var rn=class extends Rr{constructor(e,r,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[r(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let s=i.iterators[i.iterators.length-1].next();if(s.done)i.iterators.pop();else return i.iterators.push(r(s.value)[Symbol.iterator]()),s}return zt})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}},ko;(function(t){function e(o){return o.reduce((s,a)=>s+a,0)}t.sum=e;function r(o){return o.reduce((s,a)=>s*a,0)}t.product=r;function n(o){return o.reduce((s,a)=>Math.min(s,a))}t.min=n;function i(o){return o.reduce((s,a)=>Math.max(s,a))}t.max=i})(ko||(ko={}));function Li(t){return new rn(t,e=>zr(e)?e.content:[],{includeRoot:!0})}function qh(t){return Li(t).filter(Xn)}function jh(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Eo(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Mi(t){if(!t)return;let{offset:e,end:r,range:n}=t;return{range:n,offset:e,end:r,length:r-e}}var nn;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside",t[t.Outside=5]="Outside"})(nn||(nn={}));function ov(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return nn.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return nn.After;let r=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,n=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return r&&n?nn.Inside:r?nn.OverlapBack:n?nn.OverlapFront:nn.Outside}function Uh(t,e){return ov(t,e)>nn.After}var el=/^[\w\p{L}]$/u;function cr(t,e,r=el){if(t){if(e>0){let n=e-t.offset,i=t.text.charAt(n);r.test(i)||e--}return Wh(t,e)}}function Ba(t,e){if(t){let r=av(t,!0);if(r&&$h(r,e))return r;if(Ua(t)){let n=t.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let o=t.content[i];if($h(o,e))return o}}}}function $h(t,e){return Xn(t)&&e.includes(t.tokenType.name)}function Wh(t,e){if(Xn(t))return t;if(zr(t)){let r=sv(t,e,!1);if(r)return Wh(r,e)}}function Ha(t,e){if(Xn(t))return t;if(zr(t)){let r=sv(t,e,!0);if(r)return Ha(r,e)}}function sv(t,e,r){let n=0,i=t.content.length-1,o;for(;n<=i;){let s=Math.floor((n+i)/2),a=t.content[s];if(a.offset<=e&&a.end>e)return a;a.end<=e?(o=r?a:void 0,n=s+1):i=s-1}return o}function av(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t);for(;n>0;){n--;let i=r.content[n];if(e||!i.hidden)return i}t=r}}function aw(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t),i=r.content.length-1;for(;n<i;){n++;let o=r.content[n];if(e||!o.hidden)return o}t=r}}function cw(t){if(t.range.start.character===0)return t;let e=t.range.start.line,r=t,n;for(;t.container;){let i=t.container,o=n??i.content.indexOf(t);if(o===0?(t=i,n=void 0):(n=o-1,t=i.content[n]),t.range.start.line!==e)break;r=t}return r}function uw(t,e){let r=lw(t,e);return r?r.parent.content.slice(r.a+1,r.b):[]}function lw(t,e){let r=iv(t),n=iv(e),i;for(let o=0;o<r.length&&o<n.length;o++){let s=r[o],a=n[o];if(s.parent===a.parent)i={parent:s.parent,a:s.index,b:a.index};else break}return i}function iv(t){let e=[];for(;t.container;){let r=t.container,n=r.content.indexOf(t);e.push({parent:r,index:n}),t=r}return e.reverse()}var fl={};Kn(fl,{findAssignment:()=>Rp,findNameAssignment:()=>dl,findNodeForKeyword:()=>xp,findNodeForProperty:()=>cc,findNodesForKeyword:()=>Iw,findNodesForKeywordInternal:()=>Tp,findNodesForProperty:()=>yp,getActionAtElement:()=>gv,getActionType:()=>vv,getAllReachableRules:()=>sc,getAllRulesUsedForCrossReferences:()=>Pw,getCrossReferenceTerminal:()=>ac,getEntryRule:()=>oc,getExplicitRuleType:()=>an,getHiddenRules:()=>hv,getRuleType:()=>_p,getRuleTypeName:()=>Lw,getTypeName:()=>zi,isArrayCardinality:()=>bp,isArrayOperator:()=>Dw,isCommentTerminal:()=>gp,isDataType:()=>Ow,isDataTypeRule:()=>uc,isOptionalCardinality:()=>Gi,terminalRegex:()=>Jn});var Fi=class extends Error{constructor(e,r){super(e?`${r} at ${e.range.start.line}:${e.range.start.character}`:r)}};function on(t){throw new Error("Error! The input value was not handled.")}var ji={};Kn(ji,{AbstractElement:()=>No,AbstractRule:()=>Ao,AbstractType:()=>wo,Action:()=>Xo,Alternatives:()=>Yo,ArrayLiteral:()=>Po,ArrayType:()=>Io,Assignment:()=>Jo,BooleanLiteral:()=>Do,CharacterRange:()=>Qo,Condition:()=>Ga,Conjunction:()=>Oo,CrossReference:()=>Zo,Disjunction:()=>Lo,EndOfFile:()=>es,Grammar:()=>Mo,GrammarImport:()=>Va,Group:()=>ts,InferredType:()=>Fo,Interface:()=>$o,Keyword:()=>rs,LangiumGrammarAstReflection:()=>fs,LangiumGrammarTerminals:()=>dw,NamedArgument:()=>Ka,NegatedToken:()=>ns,Negation:()=>qo,NumberLiteral:()=>jo,Parameter:()=>Uo,ParameterReference:()=>Wo,ParserRule:()=>Bo,ReferenceType:()=>Ho,RegexToken:()=>is,ReturnType:()=>Xa,RuleCall:()=>os,SimpleType:()=>Go,StringLiteral:()=>zo,TerminalAlternatives:()=>ss,TerminalGroup:()=>as,TerminalRule:()=>$i,TerminalRuleCall:()=>cs,Type:()=>Vo,TypeAttribute:()=>Ya,TypeDefinition:()=>rl,UnionType:()=>Ko,UnorderedGroup:()=>us,UntilToken:()=>ls,ValueLiteral:()=>za,Wildcard:()=>ds,isAbstractElement:()=>qi,isAbstractRule:()=>fw,isAbstractType:()=>hw,isAction:()=>Vr,isAlternatives:()=>hs,isArrayLiteral:()=>vw,isArrayType:()=>Bh,isAssignment:()=>Vt,isBooleanLiteral:()=>Hh,isCharacterRange:()=>Qh,isCondition:()=>pw,isConjunction:()=>Gh,isCrossReference:()=>br,isDisjunction:()=>zh,isEndOfFile:()=>Zh,isFeatureName:()=>mw,isGrammar:()=>xw,isGrammarImport:()=>Tw,isGroup:()=>Pr,isInferredType:()=>Ja,isInterface:()=>nl,isKeyword:()=>Et,isNamedArgument:()=>Rw,isNegatedToken:()=>ep,isNegation:()=>Vh,isNumberLiteral:()=>bw,isParameter:()=>_w,isParameterReference:()=>Kh,isParserRule:()=>Ye,isPrimitiveType:()=>cv,isReferenceType:()=>Xh,isRegexToken:()=>tp,isReturnType:()=>Yh,isRuleCall:()=>ur,isSimpleType:()=>il,isStringLiteral:()=>Cw,isTerminalAlternatives:()=>rp,isTerminalGroup:()=>np,isTerminalRule:()=>er,isTerminalRuleCall:()=>ol,isType:()=>Qa,isTypeAttribute:()=>Sw,isTypeDefinition:()=>gw,isUnionType:()=>Jh,isUnorderedGroup:()=>ps,isUntilToken:()=>ip,isValueLiteral:()=>yw,isWildcard:()=>op,reflection:()=>ne});var dw={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},Ao="AbstractRule";function fw(t){return ne.isInstance(t,Ao)}var wo="AbstractType";function hw(t){return ne.isInstance(t,wo)}var Ga="Condition";function pw(t){return ne.isInstance(t,Ga)}function mw(t){return cv(t)||t==="current"||t==="entry"||t==="extends"||t==="false"||t==="fragment"||t==="grammar"||t==="hidden"||t==="import"||t==="interface"||t==="returns"||t==="terminal"||t==="true"||t==="type"||t==="infer"||t==="infers"||t==="with"||typeof t=="string"&&/\^?[_a-zA-Z][\w_]*/.test(t)}function cv(t){return t==="string"||t==="number"||t==="boolean"||t==="Date"||t==="bigint"}var rl="TypeDefinition";function gw(t){return ne.isInstance(t,rl)}var za="ValueLiteral";function yw(t){return ne.isInstance(t,za)}var No="AbstractElement";function qi(t){return ne.isInstance(t,No)}var Po="ArrayLiteral";function vw(t){return ne.isInstance(t,Po)}var Io="ArrayType";function Bh(t){return ne.isInstance(t,Io)}var Do="BooleanLiteral";function Hh(t){return ne.isInstance(t,Do)}var Oo="Conjunction";function Gh(t){return ne.isInstance(t,Oo)}var Lo="Disjunction";function zh(t){return ne.isInstance(t,Lo)}var Mo="Grammar";function xw(t){return ne.isInstance(t,Mo)}var Va="GrammarImport";function Tw(t){return ne.isInstance(t,Va)}var Fo="InferredType";function Ja(t){return ne.isInstance(t,Fo)}var $o="Interface";function nl(t){return ne.isInstance(t,$o)}var Ka="NamedArgument";function Rw(t){return ne.isInstance(t,Ka)}var qo="Negation";function Vh(t){return ne.isInstance(t,qo)}var jo="NumberLiteral";function bw(t){return ne.isInstance(t,jo)}var Uo="Parameter";function _w(t){return ne.isInstance(t,Uo)}var Wo="ParameterReference";function Kh(t){return ne.isInstance(t,Wo)}var Bo="ParserRule";function Ye(t){return ne.isInstance(t,Bo)}var Ho="ReferenceType";function Xh(t){return ne.isInstance(t,Ho)}var Xa="ReturnType";function Yh(t){return ne.isInstance(t,Xa)}var Go="SimpleType";function il(t){return ne.isInstance(t,Go)}var zo="StringLiteral";function Cw(t){return ne.isInstance(t,zo)}var $i="TerminalRule";function er(t){return ne.isInstance(t,$i)}var Vo="Type";function Qa(t){return ne.isInstance(t,Vo)}var Ya="TypeAttribute";function Sw(t){return ne.isInstance(t,Ya)}var Ko="UnionType";function Jh(t){return ne.isInstance(t,Ko)}var Xo="Action";function Vr(t){return ne.isInstance(t,Xo)}var Yo="Alternatives";function hs(t){return ne.isInstance(t,Yo)}var Jo="Assignment";function Vt(t){return ne.isInstance(t,Jo)}var Qo="CharacterRange";function Qh(t){return ne.isInstance(t,Qo)}var Zo="CrossReference";function br(t){return ne.isInstance(t,Zo)}var es="EndOfFile";function Zh(t){return ne.isInstance(t,es)}var ts="Group";function Pr(t){return ne.isInstance(t,ts)}var rs="Keyword";function Et(t){return ne.isInstance(t,rs)}var ns="NegatedToken";function ep(t){return ne.isInstance(t,ns)}var is="RegexToken";function tp(t){return ne.isInstance(t,is)}var os="RuleCall";function ur(t){return ne.isInstance(t,os)}var ss="TerminalAlternatives";function rp(t){return ne.isInstance(t,ss)}var as="TerminalGroup";function np(t){return ne.isInstance(t,as)}var cs="TerminalRuleCall";function ol(t){return ne.isInstance(t,cs)}var us="UnorderedGroup";function ps(t){return ne.isInstance(t,us)}var ls="UntilToken";function ip(t){return ne.isInstance(t,ls)}var ds="Wildcard";function op(t){return ne.isInstance(t,ds)}var fs=class extends Di{getAllTypes(){return[No,Ao,wo,Xo,Yo,Po,Io,Jo,Do,Qo,Ga,Oo,Zo,Lo,es,Mo,Va,ts,Fo,$o,rs,Ka,ns,qo,jo,Uo,Wo,Bo,Ho,is,Xa,os,Go,zo,ss,as,$i,cs,Vo,Ya,rl,Ko,us,ls,za,ds]}computeIsSubtype(e,r){switch(e){case Xo:case Yo:case Jo:case Qo:case Zo:case es:case ts:case rs:case ns:case is:case os:case ss:case as:case cs:case us:case ls:case ds:return this.isSubtype(No,r);case Po:case jo:case zo:return this.isSubtype(za,r);case Io:case Ho:case Go:case Ko:return this.isSubtype(rl,r);case Do:return this.isSubtype(Ga,r)||this.isSubtype(za,r);case Oo:case Lo:case qo:case Wo:return this.isSubtype(Ga,r);case Fo:case $o:case Vo:return this.isSubtype(wo,r);case Bo:return this.isSubtype(Ao,r)||this.isSubtype(wo,r);case $i:return this.isSubtype(Ao,r);default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;switch(r){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return wo;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Ao;case"Grammar:usedGrammars":return Mo;case"NamedArgument:parameter":case"ParameterReference:parameter":return Uo;case"TerminalRuleCall:rule":return $i;default:throw new Error(`${r} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case No:return{name:No,properties:[{name:"cardinality"},{name:"lookahead"}]};case Po:return{name:Po,properties:[{name:"elements",defaultValue:[]}]};case Io:return{name:Io,properties:[{name:"elementType"}]};case Do:return{name:Do,properties:[{name:"true",defaultValue:!1}]};case Oo:return{name:Oo,properties:[{name:"left"},{name:"right"}]};case Lo:return{name:Lo,properties:[{name:"left"},{name:"right"}]};case Mo:return{name:Mo,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 Va:return{name:Va,properties:[{name:"path"}]};case Fo:return{name:Fo,properties:[{name:"name"}]};case $o:return{name:$o,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case Ka:return{name:Ka,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case qo:return{name:qo,properties:[{name:"value"}]};case jo:return{name:jo,properties:[{name:"value"}]};case Uo:return{name:Uo,properties:[{name:"name"}]};case Wo:return{name:Wo,properties:[{name:"parameter"}]};case Bo:return{name:Bo,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 Ho:return{name:Ho,properties:[{name:"referenceType"}]};case Xa:return{name:Xa,properties:[{name:"name"}]};case Go:return{name:Go,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case zo:return{name:zo,properties:[{name:"value"}]};case $i:return{name:$i,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case Vo:return{name:Vo,properties:[{name:"name"},{name:"type"}]};case Ya:return{name:Ya,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case Ko:return{name:Ko,properties:[{name:"types",defaultValue:[]}]};case Xo:return{name:Xo,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case Yo:return{name:Yo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Jo:return{name:Jo,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case Qo:return{name:Qo,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case Zo:return{name:Zo,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case es:return{name:es,properties:[{name:"cardinality"},{name:"lookahead"}]};case ts:return{name:ts,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case rs:return{name:rs,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case ns:return{name:ns,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case is:return{name:is,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case os:return{name:os,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case ss:return{name:ss,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case as:return{name:as,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case cs:return{name:cs,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case us:return{name:us,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case ls:return{name:ls,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case ds:return{name:ds,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}},ne=new fs;var al={};Kn(al,{assignMandatoryProperties:()=>ec,copyAstNode:()=>ap,findLocalReferences:()=>Ew,findRootNode:()=>Za,getContainerOfType:()=>_r,getDocument:()=>Rt,hasContainerOfType:()=>kw,linkContentToContainer:()=>sl,streamAllContents:()=>Cr,streamAst:()=>Ir,streamContents:()=>Ui,streamReferences:()=>ms});function sl(t){for(let[e,r]of Object.entries(t))e.startsWith("$")||(Array.isArray(r)?r.forEach((n,i)=>{Ge(n)&&(n.$container=t,n.$containerProperty=e,n.$containerIndex=i)}):Ge(r)&&(r.$container=t,r.$containerProperty=e))}function _r(t,e){let r=t;for(;r;){if(e(r))return r;r=r.$container}}function kw(t,e){let r=t;for(;r;){if(e(r))return!0;r=r.$container}return!1}function Rt(t){let r=Za(t).$document;if(!r)throw new Error("AST node has no document.");return r}function Za(t){for(;t.$container;)t=t.$container;return t}function Ui(t,e){if(!t)throw new Error("Node must be an AstNode.");let r=e?.range;return new Rr(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndex<n.keys.length;){let i=n.keys[n.keyIndex];if(!i.startsWith("$")){let o=t[i];if(Ge(o)){if(n.keyIndex++,sp(o,r))return{done:!1,value:o}}else if(Array.isArray(o)){for(;n.arrayIndex<o.length;){let s=n.arrayIndex++,a=o[s];if(Ge(a)&&sp(a,r))return{done:!1,value:a}}n.arrayIndex=0}}n.keyIndex++}return zt})}function Cr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new rn(t,r=>Ui(r,e))}function Ir(t,e){if(t){if(e?.range&&!sp(t,e.range))return new rn(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new rn(t,r=>Ui(r,e),{includeRoot:!0})}function sp(t,e){var r;if(!e)return!0;let n=(r=t.$cstNode)===null||r===void 0?void 0:r.range;return n?Uh(n,e):!1}function ms(t){return new Rr(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){let r=e.keys[e.keyIndex];if(!r.startsWith("$")){let n=t[r];if(Ut(n))return e.keyIndex++,{done:!1,value:{reference:n,container:t,property:r}};if(Array.isArray(n)){for(;e.arrayIndex<n.length;){let i=e.arrayIndex++,o=n[i];if(Ut(o))return{done:!1,value:{reference:o,container:t,property:r,index:i}}}e.arrayIndex=0}}e.keyIndex++}return zt})}function Ew(t,e=Rt(t).parseResult.value){let r=[];return Ir(e).forEach(n=>{ms(n).forEach(i=>{i.reference.ref===t&&r.push(i.reference)})}),ce(r)}function ec(t,e){let r=t.getTypeMetaData(e.$type),n=e;for(let i of r.properties)i.defaultValue!==void 0&&n[i.name]===void 0&&(n[i.name]=uv(i.defaultValue))}function uv(t){return Array.isArray(t)?[...t.map(uv)]:t}function ap(t,e){let r={$type:t.$type};for(let[n,i]of Object.entries(t))if(!n.startsWith("$"))if(Ge(i))r[n]=ap(i,e);else if(Ut(i))r[n]=e(r,n,i.$refNode,i.$refText);else if(Array.isArray(i)){let o=[];for(let s of i)Ge(s)?o.push(ap(s,e)):Ut(s)?o.push(e(r,n,s.$refNode,s.$refText)):o.push(s);r[n]=o}else r[n]=i;return sl(r),r}var ll={};Kn(ll,{NEWLINE_REGEXP:()=>dp,escapeRegExp:()=>Yn,getTerminalParts:()=>Nw,isMultilineComment:()=>fp,isWhitespace:()=>ic,partialMatches:()=>hp,partialRegExp:()=>fv,whitespaceCharacters:()=>dv});function ee(t){return t.charCodeAt(0)}function cl(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function gs(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function Wi(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function tc(){throw Error("Internal Error - Should never get here!")}function cp(t){return t.type==="Character"}var rc=[];for(let t=ee("0");t<=ee("9");t++)rc.push(t);var nc=[ee("_")].concat(rc);for(let t=ee("a");t<=ee("z");t++)nc.push(t);for(let t=ee("A");t<=ee("Z");t++)nc.push(t);var up=[ee(" "),ee("\f"),ee(`
37
- `),ee("\r"),ee(" "),ee("\v"),ee(" "),ee("\xA0"),ee("\u1680"),ee("\u2000"),ee("\u2001"),ee("\u2002"),ee("\u2003"),ee("\u2004"),ee("\u2005"),ee("\u2006"),ee("\u2007"),ee("\u2008"),ee("\u2009"),ee("\u200A"),ee("\u2028"),ee("\u2029"),ee("\u202F"),ee("\u205F"),ee("\u3000"),ee("\uFEFF")];var Aw=/[0-9a-fA-F]/,ul=/[0-9]/,ww=/[1-9]/,Bi=class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let r=this.disjunction();this.consumeChar("/");let n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":gs(n,"global");break;case"i":gs(n,"ignoreCase");break;case"m":gs(n,"multiLine");break;case"u":gs(n,"unicode");break;case"y":gs(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:r,loc:this.loc(0)}}disjunction(){let e=[],r=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(r)}}alternative(){let e=[],r=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(r)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break}Wi(r);let n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return tc()}quantifier(e=!1){let r,n=this.idx;switch(this.popChar()){case"*":r={atLeast:0,atMost:1/0};break;case"+":r={atLeast:1,atMost:1/0};break;case"?":r={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:i,atMost:i};break;case",":let o;this.isDigit()?(o=this.integerIncludingZero(),r={atLeast:i,atMost:o}):r={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;Wi(r);break}if(!(e===!0&&r===void 0)&&Wi(r))return this.peekChar(0)==="?"?(this.consumeChar("?"),r.greedy=!1):r.greedy=!0,r.type="Quantifier",r.loc=this.loc(n),r}atom(){let e,r=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Wi(e)?(e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):tc()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[ee(`
35
+ `&&d++}m&&b.length>0&&R.push(b.length),this._lineOffsets=R}return this._lineOffsets},f.prototype.positionAt=function(R){R=Math.max(Math.min(R,this._content.length),0);var b=this.getLineOffsets(),m=0,d=b.length;if(d===0)return s.create(0,R);for(;m<d;){var C=Math.floor((m+d)/2);b[C]>R?d=C:m=C+1}var L=m-1;return s.create(L,R-b[L])},f.prototype.offsetAt=function(R){var b=this.getLineOffsets();if(R.line>=b.length)return this._content.length;if(R.line<0)return 0;var m=b[R.line],d=R.line+1<b.length?b[R.line+1]:this._content.length;return Math.max(Math.min(m+R.character,d),m)},Object.defineProperty(f.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),f})(),S;(function(f){var R=Object.prototype.toString;function b(he){return typeof he<"u"}f.defined=b;function m(he){return typeof he>"u"}f.undefined=m;function d(he){return he===!0||he===!1}f.boolean=d;function C(he){return R.call(he)==="[object String]"}f.string=C;function L(he){return R.call(he)==="[object Number]"}f.number=L;function oe(he,So,Yu){return R.call(he)==="[object Number]"&&So<=he&&he<=Yu}f.numberRange=oe;function ut(he){return R.call(he)==="[object Number]"&&-2147483648<=he&&he<=2147483647}f.integer=ut;function Me(he){return R.call(he)==="[object Number]"&&0<=he&&he<=2147483647}f.uinteger=Me;function Hr(he){return R.call(he)==="[object Function]"}f.func=Hr;function Gr(he){return he!==null&&typeof he=="object"}f.objectLiteral=Gr;function wn(he,So){return Array.isArray(he)&&he.every(So)}f.typedArray=wn})(S||(S={}))})});var tt=G(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.ProtocolNotificationType=gr.ProtocolNotificationType0=gr.ProtocolRequestType=gr.ProtocolRequestType0=gr.RegistrationType=gr.MessageDirection=void 0;var ba=yo(),UC;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(UC||(gr.MessageDirection=UC={}));var ey=class{constructor(e){this.method=e}};gr.RegistrationType=ey;var ty=class extends ba.RequestType0{constructor(e){super(e)}};gr.ProtocolRequestType0=ty;var ry=class extends ba.RequestType{constructor(e){super(e,ba.ParameterStructures.byName)}};gr.ProtocolRequestType=ry;var ny=class extends ba.NotificationType0{constructor(e){super(e)}};gr.ProtocolNotificationType0=ny;var iy=class extends ba.NotificationType{constructor(e){super(e,ba.ParameterStructures.byName)}};gr.ProtocolNotificationType=iy});var yf=G(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.objectLiteral=kt.typedArray=kt.stringArray=kt.array=kt.func=kt.error=kt.number=kt.string=kt.boolean=void 0;function b$(t){return t===!0||t===!1}kt.boolean=b$;function WC(t){return typeof t=="string"||t instanceof String}kt.string=WC;function _$(t){return typeof t=="number"||t instanceof Number}kt.number=_$;function C$(t){return t instanceof Error}kt.error=C$;function S$(t){return typeof t=="function"}kt.func=S$;function BC(t){return Array.isArray(t)}kt.array=BC;function k$(t){return BC(t)&&t.every(e=>WC(e))}kt.stringArray=k$;function E$(t,e){return Array.isArray(t)&&t.every(e)}kt.typedArray=E$;function A$(t){return t!==null&&typeof t=="object"}kt.objectLiteral=A$});var zC=G(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.ImplementationRequest=void 0;var HC=tt(),GC;(function(t){t.method="textDocument/implementation",t.messageDirection=HC.MessageDirection.clientToServer,t.type=new HC.ProtocolRequestType(t.method)})(GC||(vf.ImplementationRequest=GC={}))});var XC=G(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});xf.TypeDefinitionRequest=void 0;var VC=tt(),KC;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=VC.MessageDirection.clientToServer,t.type=new VC.ProtocolRequestType(t.method)})(KC||(xf.TypeDefinitionRequest=KC={}))});var QC=G(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.DidChangeWorkspaceFoldersNotification=_a.WorkspaceFoldersRequest=void 0;var Tf=tt(),YC;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Tf.MessageDirection.serverToClient,t.type=new Tf.ProtocolRequestType0(t.method)})(YC||(_a.WorkspaceFoldersRequest=YC={}));var JC;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Tf.MessageDirection.clientToServer,t.type=new Tf.ProtocolNotificationType(t.method)})(JC||(_a.DidChangeWorkspaceFoldersNotification=JC={}))});var tS=G(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.ConfigurationRequest=void 0;var ZC=tt(),eS;(function(t){t.method="workspace/configuration",t.messageDirection=ZC.MessageDirection.serverToClient,t.type=new ZC.ProtocolRequestType(t.method)})(eS||(Rf.ConfigurationRequest=eS={}))});var iS=G(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.ColorPresentationRequest=Ca.DocumentColorRequest=void 0;var bf=tt(),rS;(function(t){t.method="textDocument/documentColor",t.messageDirection=bf.MessageDirection.clientToServer,t.type=new bf.ProtocolRequestType(t.method)})(rS||(Ca.DocumentColorRequest=rS={}));var nS;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=bf.MessageDirection.clientToServer,t.type=new bf.ProtocolRequestType(t.method)})(nS||(Ca.ColorPresentationRequest=nS={}))});var aS=G(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.FoldingRangeRefreshRequest=Sa.FoldingRangeRequest=void 0;var _f=tt(),oS;(function(t){t.method="textDocument/foldingRange",t.messageDirection=_f.MessageDirection.clientToServer,t.type=new _f.ProtocolRequestType(t.method)})(oS||(Sa.FoldingRangeRequest=oS={}));var sS;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=_f.MessageDirection.serverToClient,t.type=new _f.ProtocolRequestType0(t.method)})(sS||(Sa.FoldingRangeRefreshRequest=sS={}))});var lS=G(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.DeclarationRequest=void 0;var cS=tt(),uS;(function(t){t.method="textDocument/declaration",t.messageDirection=cS.MessageDirection.clientToServer,t.type=new cS.ProtocolRequestType(t.method)})(uS||(Cf.DeclarationRequest=uS={}))});var hS=G(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.SelectionRangeRequest=void 0;var dS=tt(),fS;(function(t){t.method="textDocument/selectionRange",t.messageDirection=dS.MessageDirection.clientToServer,t.type=new dS.ProtocolRequestType(t.method)})(fS||(Sf.SelectionRangeRequest=fS={}))});var yS=G(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.WorkDoneProgressCancelNotification=_i.WorkDoneProgressCreateRequest=_i.WorkDoneProgress=void 0;var w$=yo(),kf=tt(),pS;(function(t){t.type=new w$.ProgressType;function e(r){return r===t.type}t.is=e})(pS||(_i.WorkDoneProgress=pS={}));var mS;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=kf.MessageDirection.serverToClient,t.type=new kf.ProtocolRequestType(t.method)})(mS||(_i.WorkDoneProgressCreateRequest=mS={}));var gS;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=kf.MessageDirection.clientToServer,t.type=new kf.ProtocolNotificationType(t.method)})(gS||(_i.WorkDoneProgressCancelNotification=gS={}))});var RS=G(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.CallHierarchyOutgoingCallsRequest=Ci.CallHierarchyIncomingCallsRequest=Ci.CallHierarchyPrepareRequest=void 0;var ka=tt(),vS;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=ka.MessageDirection.clientToServer,t.type=new ka.ProtocolRequestType(t.method)})(vS||(Ci.CallHierarchyPrepareRequest=vS={}));var xS;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=ka.MessageDirection.clientToServer,t.type=new ka.ProtocolRequestType(t.method)})(xS||(Ci.CallHierarchyIncomingCallsRequest=xS={}));var TS;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=ka.MessageDirection.clientToServer,t.type=new ka.ProtocolRequestType(t.method)})(TS||(Ci.CallHierarchyOutgoingCallsRequest=TS={}))});var ES=G(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.SemanticTokensRefreshRequest=yr.SemanticTokensRangeRequest=yr.SemanticTokensDeltaRequest=yr.SemanticTokensRequest=yr.SemanticTokensRegistrationType=yr.TokenFormat=void 0;var Hn=tt(),bS;(function(t){t.Relative="relative"})(bS||(yr.TokenFormat=bS={}));var Nu;(function(t){t.method="textDocument/semanticTokens",t.type=new Hn.RegistrationType(t.method)})(Nu||(yr.SemanticTokensRegistrationType=Nu={}));var _S;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Hn.MessageDirection.clientToServer,t.type=new Hn.ProtocolRequestType(t.method),t.registrationMethod=Nu.method})(_S||(yr.SemanticTokensRequest=_S={}));var CS;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Hn.MessageDirection.clientToServer,t.type=new Hn.ProtocolRequestType(t.method),t.registrationMethod=Nu.method})(CS||(yr.SemanticTokensDeltaRequest=CS={}));var SS;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Hn.MessageDirection.clientToServer,t.type=new Hn.ProtocolRequestType(t.method),t.registrationMethod=Nu.method})(SS||(yr.SemanticTokensRangeRequest=SS={}));var kS;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Hn.MessageDirection.serverToClient,t.type=new Hn.ProtocolRequestType0(t.method)})(kS||(yr.SemanticTokensRefreshRequest=kS={}))});var NS=G(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.ShowDocumentRequest=void 0;var AS=tt(),wS;(function(t){t.method="window/showDocument",t.messageDirection=AS.MessageDirection.serverToClient,t.type=new AS.ProtocolRequestType(t.method)})(wS||(Ef.ShowDocumentRequest=wS={}))});var DS=G(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.LinkedEditingRangeRequest=void 0;var PS=tt(),IS;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=PS.MessageDirection.clientToServer,t.type=new PS.ProtocolRequestType(t.method)})(IS||(Af.LinkedEditingRangeRequest=IS={}))});var US=G(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.WillDeleteFilesRequest=Qt.DidDeleteFilesNotification=Qt.DidRenameFilesNotification=Qt.WillRenameFilesRequest=Qt.DidCreateFilesNotification=Qt.WillCreateFilesRequest=Qt.FileOperationPatternKind=void 0;var Mr=tt(),OS;(function(t){t.file="file",t.folder="folder"})(OS||(Qt.FileOperationPatternKind=OS={}));var LS;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolRequestType(t.method)})(LS||(Qt.WillCreateFilesRequest=LS={}));var MS;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolNotificationType(t.method)})(MS||(Qt.DidCreateFilesNotification=MS={}));var FS;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolRequestType(t.method)})(FS||(Qt.WillRenameFilesRequest=FS={}));var $S;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolNotificationType(t.method)})($S||(Qt.DidRenameFilesNotification=$S={}));var qS;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolNotificationType(t.method)})(qS||(Qt.DidDeleteFilesNotification=qS={}));var jS;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Mr.MessageDirection.clientToServer,t.type=new Mr.ProtocolRequestType(t.method)})(jS||(Qt.WillDeleteFilesRequest=jS={}))});var zS=G(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.MonikerRequest=Si.MonikerKind=Si.UniquenessLevel=void 0;var WS=tt(),BS;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(BS||(Si.UniquenessLevel=BS={}));var HS;(function(t){t.$import="import",t.$export="export",t.local="local"})(HS||(Si.MonikerKind=HS={}));var GS;(function(t){t.method="textDocument/moniker",t.messageDirection=WS.MessageDirection.clientToServer,t.type=new WS.ProtocolRequestType(t.method)})(GS||(Si.MonikerRequest=GS={}))});var YS=G(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.TypeHierarchySubtypesRequest=ki.TypeHierarchySupertypesRequest=ki.TypeHierarchyPrepareRequest=void 0;var Ea=tt(),VS;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=Ea.MessageDirection.clientToServer,t.type=new Ea.ProtocolRequestType(t.method)})(VS||(ki.TypeHierarchyPrepareRequest=VS={}));var KS;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=Ea.MessageDirection.clientToServer,t.type=new Ea.ProtocolRequestType(t.method)})(KS||(ki.TypeHierarchySupertypesRequest=KS={}));var XS;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=Ea.MessageDirection.clientToServer,t.type=new Ea.ProtocolRequestType(t.method)})(XS||(ki.TypeHierarchySubtypesRequest=XS={}))});var ZS=G(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.InlineValueRefreshRequest=Aa.InlineValueRequest=void 0;var wf=tt(),JS;(function(t){t.method="textDocument/inlineValue",t.messageDirection=wf.MessageDirection.clientToServer,t.type=new wf.ProtocolRequestType(t.method)})(JS||(Aa.InlineValueRequest=JS={}));var QS;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=wf.MessageDirection.serverToClient,t.type=new wf.ProtocolRequestType0(t.method)})(QS||(Aa.InlineValueRefreshRequest=QS={}))});var nk=G(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.InlayHintRefreshRequest=Ei.InlayHintResolveRequest=Ei.InlayHintRequest=void 0;var wa=tt(),ek;(function(t){t.method="textDocument/inlayHint",t.messageDirection=wa.MessageDirection.clientToServer,t.type=new wa.ProtocolRequestType(t.method)})(ek||(Ei.InlayHintRequest=ek={}));var tk;(function(t){t.method="inlayHint/resolve",t.messageDirection=wa.MessageDirection.clientToServer,t.type=new wa.ProtocolRequestType(t.method)})(tk||(Ei.InlayHintResolveRequest=tk={}));var rk;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=wa.MessageDirection.serverToClient,t.type=new wa.ProtocolRequestType0(t.method)})(rk||(Ei.InlayHintRefreshRequest=rk={}))});var lk=G(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.DiagnosticRefreshRequest=Fr.WorkspaceDiagnosticRequest=Fr.DocumentDiagnosticRequest=Fr.DocumentDiagnosticReportKind=Fr.DiagnosticServerCancellationData=void 0;var uk=yo(),N$=yf(),Na=tt(),ik;(function(t){function e(r){let n=r;return n&&N$.boolean(n.retriggerRequest)}t.is=e})(ik||(Fr.DiagnosticServerCancellationData=ik={}));var ok;(function(t){t.Full="full",t.Unchanged="unchanged"})(ok||(Fr.DocumentDiagnosticReportKind=ok={}));var sk;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Na.MessageDirection.clientToServer,t.type=new Na.ProtocolRequestType(t.method),t.partialResult=new uk.ProgressType})(sk||(Fr.DocumentDiagnosticRequest=sk={}));var ak;(function(t){t.method="workspace/diagnostic",t.messageDirection=Na.MessageDirection.clientToServer,t.type=new Na.ProtocolRequestType(t.method),t.partialResult=new uk.ProgressType})(ak||(Fr.WorkspaceDiagnosticRequest=ak={}));var ck;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Na.MessageDirection.serverToClient,t.type=new Na.ProtocolRequestType0(t.method)})(ck||(Fr.DiagnosticRefreshRequest=ck={}))});var yk=G(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.DidCloseNotebookDocumentNotification=ft.DidSaveNotebookDocumentNotification=ft.DidChangeNotebookDocumentNotification=ft.NotebookCellArrayChange=ft.DidOpenNotebookDocumentNotification=ft.NotebookDocumentSyncRegistrationType=ft.NotebookDocument=ft.NotebookCell=ft.ExecutionSummary=ft.NotebookCellKind=void 0;var Pu=gf(),Qr=yf(),_n=tt(),oy;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(oy||(ft.NotebookCellKind=oy={}));var sy;(function(t){function e(i,o){let s={executionOrder:i};return(o===!0||o===!1)&&(s.success=o),s}t.create=e;function r(i){let o=i;return Qr.objectLiteral(o)&&Pu.uinteger.is(o.executionOrder)&&(o.success===void 0||Qr.boolean(o.success))}t.is=r;function n(i,o){return i===o?!0:i==null||o===null||o===void 0?!1:i.executionOrder===o.executionOrder&&i.success===o.success}t.equals=n})(sy||(ft.ExecutionSummary=sy={}));var Nf;(function(t){function e(o,s){return{kind:o,document:s}}t.create=e;function r(o){let s=o;return Qr.objectLiteral(s)&&oy.is(s.kind)&&Pu.DocumentUri.is(s.document)&&(s.metadata===void 0||Qr.objectLiteral(s.metadata))}t.is=r;function n(o,s){let a=new Set;return o.document!==s.document&&a.add("document"),o.kind!==s.kind&&a.add("kind"),o.executionSummary!==s.executionSummary&&a.add("executionSummary"),(o.metadata!==void 0||s.metadata!==void 0)&&!i(o.metadata,s.metadata)&&a.add("metadata"),(o.executionSummary!==void 0||s.executionSummary!==void 0)&&!sy.equals(o.executionSummary,s.executionSummary)&&a.add("executionSummary"),a}t.diff=n;function i(o,s){if(o===s)return!0;if(o==null||s===null||s===void 0||typeof o!=typeof s||typeof o!="object")return!1;let a=Array.isArray(o),c=Array.isArray(s);if(a!==c)return!1;if(a&&c){if(o.length!==s.length)return!1;for(let u=0;u<o.length;u++)if(!i(o[u],s[u]))return!1}if(Qr.objectLiteral(o)&&Qr.objectLiteral(s)){let u=Object.keys(o),l=Object.keys(s);if(u.length!==l.length||(u.sort(),l.sort(),!i(u,l)))return!1;for(let h=0;h<u.length;h++){let p=u[h];if(!i(o[p],s[p]))return!1}}return!0}})(Nf||(ft.NotebookCell=Nf={}));var dk;(function(t){function e(n,i,o,s){return{uri:n,notebookType:i,version:o,cells:s}}t.create=e;function r(n){let i=n;return Qr.objectLiteral(i)&&Qr.string(i.uri)&&Pu.integer.is(i.version)&&Qr.typedArray(i.cells,Nf.is)}t.is=r})(dk||(ft.NotebookDocument=dk={}));var Pa;(function(t){t.method="notebookDocument/sync",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.RegistrationType(t.method)})(Pa||(ft.NotebookDocumentSyncRegistrationType=Pa={}));var fk;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolNotificationType(t.method),t.registrationMethod=Pa.method})(fk||(ft.DidOpenNotebookDocumentNotification=fk={}));var hk;(function(t){function e(n){let i=n;return Qr.objectLiteral(i)&&Pu.uinteger.is(i.start)&&Pu.uinteger.is(i.deleteCount)&&(i.cells===void 0||Qr.typedArray(i.cells,Nf.is))}t.is=e;function r(n,i,o){let s={start:n,deleteCount:i};return o!==void 0&&(s.cells=o),s}t.create=r})(hk||(ft.NotebookCellArrayChange=hk={}));var pk;(function(t){t.method="notebookDocument/didChange",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolNotificationType(t.method),t.registrationMethod=Pa.method})(pk||(ft.DidChangeNotebookDocumentNotification=pk={}));var mk;(function(t){t.method="notebookDocument/didSave",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolNotificationType(t.method),t.registrationMethod=Pa.method})(mk||(ft.DidSaveNotebookDocumentNotification=mk={}));var gk;(function(t){t.method="notebookDocument/didClose",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolNotificationType(t.method),t.registrationMethod=Pa.method})(gk||(ft.DidCloseNotebookDocumentNotification=gk={}))});var Tk=G(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.InlineCompletionRequest=void 0;var vk=tt(),xk;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=vk.MessageDirection.clientToServer,t.type=new vk.ProtocolRequestType(t.method)})(xk||(Pf.InlineCompletionRequest=xk={}))});var DE=G(v=>{"use strict";Object.defineProperty(v,"__esModule",{value:!0});v.WorkspaceSymbolRequest=v.CodeActionResolveRequest=v.CodeActionRequest=v.DocumentSymbolRequest=v.DocumentHighlightRequest=v.ReferencesRequest=v.DefinitionRequest=v.SignatureHelpRequest=v.SignatureHelpTriggerKind=v.HoverRequest=v.CompletionResolveRequest=v.CompletionRequest=v.CompletionTriggerKind=v.PublishDiagnosticsNotification=v.WatchKind=v.RelativePattern=v.FileChangeType=v.DidChangeWatchedFilesNotification=v.WillSaveTextDocumentWaitUntilRequest=v.WillSaveTextDocumentNotification=v.TextDocumentSaveReason=v.DidSaveTextDocumentNotification=v.DidCloseTextDocumentNotification=v.DidChangeTextDocumentNotification=v.TextDocumentContentChangeEvent=v.DidOpenTextDocumentNotification=v.TextDocumentSyncKind=v.TelemetryEventNotification=v.LogMessageNotification=v.ShowMessageRequest=v.ShowMessageNotification=v.MessageType=v.DidChangeConfigurationNotification=v.ExitNotification=v.ShutdownRequest=v.InitializedNotification=v.InitializeErrorCodes=v.InitializeRequest=v.WorkDoneProgressOptions=v.TextDocumentRegistrationOptions=v.StaticRegistrationOptions=v.PositionEncodingKind=v.FailureHandlingKind=v.ResourceOperationKind=v.UnregistrationRequest=v.RegistrationRequest=v.DocumentSelector=v.NotebookCellTextDocumentFilter=v.NotebookDocumentFilter=v.TextDocumentFilter=void 0;v.MonikerRequest=v.MonikerKind=v.UniquenessLevel=v.WillDeleteFilesRequest=v.DidDeleteFilesNotification=v.WillRenameFilesRequest=v.DidRenameFilesNotification=v.WillCreateFilesRequest=v.DidCreateFilesNotification=v.FileOperationPatternKind=v.LinkedEditingRangeRequest=v.ShowDocumentRequest=v.SemanticTokensRegistrationType=v.SemanticTokensRefreshRequest=v.SemanticTokensRangeRequest=v.SemanticTokensDeltaRequest=v.SemanticTokensRequest=v.TokenFormat=v.CallHierarchyPrepareRequest=v.CallHierarchyOutgoingCallsRequest=v.CallHierarchyIncomingCallsRequest=v.WorkDoneProgressCancelNotification=v.WorkDoneProgressCreateRequest=v.WorkDoneProgress=v.SelectionRangeRequest=v.DeclarationRequest=v.FoldingRangeRefreshRequest=v.FoldingRangeRequest=v.ColorPresentationRequest=v.DocumentColorRequest=v.ConfigurationRequest=v.DidChangeWorkspaceFoldersNotification=v.WorkspaceFoldersRequest=v.TypeDefinitionRequest=v.ImplementationRequest=v.ApplyWorkspaceEditRequest=v.ExecuteCommandRequest=v.PrepareRenameRequest=v.RenameRequest=v.PrepareSupportDefaultBehavior=v.DocumentOnTypeFormattingRequest=v.DocumentRangesFormattingRequest=v.DocumentRangeFormattingRequest=v.DocumentFormattingRequest=v.DocumentLinkResolveRequest=v.DocumentLinkRequest=v.CodeLensRefreshRequest=v.CodeLensResolveRequest=v.CodeLensRequest=v.WorkspaceSymbolResolveRequest=void 0;v.InlineCompletionRequest=v.DidCloseNotebookDocumentNotification=v.DidSaveNotebookDocumentNotification=v.DidChangeNotebookDocumentNotification=v.NotebookCellArrayChange=v.DidOpenNotebookDocumentNotification=v.NotebookDocumentSyncRegistrationType=v.NotebookDocument=v.NotebookCell=v.ExecutionSummary=v.NotebookCellKind=v.DiagnosticRefreshRequest=v.WorkspaceDiagnosticRequest=v.DocumentDiagnosticRequest=v.DocumentDiagnosticReportKind=v.DiagnosticServerCancellationData=v.InlayHintRefreshRequest=v.InlayHintResolveRequest=v.InlayHintRequest=v.InlineValueRefreshRequest=v.InlineValueRequest=v.TypeHierarchySupertypesRequest=v.TypeHierarchySubtypesRequest=v.TypeHierarchyPrepareRequest=void 0;var F=tt(),Rk=gf(),Ft=yf(),P$=zC();Object.defineProperty(v,"ImplementationRequest",{enumerable:!0,get:function(){return P$.ImplementationRequest}});var I$=XC();Object.defineProperty(v,"TypeDefinitionRequest",{enumerable:!0,get:function(){return I$.TypeDefinitionRequest}});var wE=QC();Object.defineProperty(v,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return wE.WorkspaceFoldersRequest}});Object.defineProperty(v,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return wE.DidChangeWorkspaceFoldersNotification}});var D$=tS();Object.defineProperty(v,"ConfigurationRequest",{enumerable:!0,get:function(){return D$.ConfigurationRequest}});var NE=iS();Object.defineProperty(v,"DocumentColorRequest",{enumerable:!0,get:function(){return NE.DocumentColorRequest}});Object.defineProperty(v,"ColorPresentationRequest",{enumerable:!0,get:function(){return NE.ColorPresentationRequest}});var PE=aS();Object.defineProperty(v,"FoldingRangeRequest",{enumerable:!0,get:function(){return PE.FoldingRangeRequest}});Object.defineProperty(v,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return PE.FoldingRangeRefreshRequest}});var O$=lS();Object.defineProperty(v,"DeclarationRequest",{enumerable:!0,get:function(){return O$.DeclarationRequest}});var L$=hS();Object.defineProperty(v,"SelectionRangeRequest",{enumerable:!0,get:function(){return L$.SelectionRangeRequest}});var dy=yS();Object.defineProperty(v,"WorkDoneProgress",{enumerable:!0,get:function(){return dy.WorkDoneProgress}});Object.defineProperty(v,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return dy.WorkDoneProgressCreateRequest}});Object.defineProperty(v,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return dy.WorkDoneProgressCancelNotification}});var fy=RS();Object.defineProperty(v,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return fy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(v,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return fy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(v,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return fy.CallHierarchyPrepareRequest}});var Ia=ES();Object.defineProperty(v,"TokenFormat",{enumerable:!0,get:function(){return Ia.TokenFormat}});Object.defineProperty(v,"SemanticTokensRequest",{enumerable:!0,get:function(){return Ia.SemanticTokensRequest}});Object.defineProperty(v,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return Ia.SemanticTokensDeltaRequest}});Object.defineProperty(v,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return Ia.SemanticTokensRangeRequest}});Object.defineProperty(v,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return Ia.SemanticTokensRefreshRequest}});Object.defineProperty(v,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return Ia.SemanticTokensRegistrationType}});var M$=NS();Object.defineProperty(v,"ShowDocumentRequest",{enumerable:!0,get:function(){return M$.ShowDocumentRequest}});var F$=DS();Object.defineProperty(v,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return F$.LinkedEditingRangeRequest}});var vo=US();Object.defineProperty(v,"FileOperationPatternKind",{enumerable:!0,get:function(){return vo.FileOperationPatternKind}});Object.defineProperty(v,"DidCreateFilesNotification",{enumerable:!0,get:function(){return vo.DidCreateFilesNotification}});Object.defineProperty(v,"WillCreateFilesRequest",{enumerable:!0,get:function(){return vo.WillCreateFilesRequest}});Object.defineProperty(v,"DidRenameFilesNotification",{enumerable:!0,get:function(){return vo.DidRenameFilesNotification}});Object.defineProperty(v,"WillRenameFilesRequest",{enumerable:!0,get:function(){return vo.WillRenameFilesRequest}});Object.defineProperty(v,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return vo.DidDeleteFilesNotification}});Object.defineProperty(v,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return vo.WillDeleteFilesRequest}});var hy=zS();Object.defineProperty(v,"UniquenessLevel",{enumerable:!0,get:function(){return hy.UniquenessLevel}});Object.defineProperty(v,"MonikerKind",{enumerable:!0,get:function(){return hy.MonikerKind}});Object.defineProperty(v,"MonikerRequest",{enumerable:!0,get:function(){return hy.MonikerRequest}});var py=YS();Object.defineProperty(v,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return py.TypeHierarchyPrepareRequest}});Object.defineProperty(v,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return py.TypeHierarchySubtypesRequest}});Object.defineProperty(v,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return py.TypeHierarchySupertypesRequest}});var IE=ZS();Object.defineProperty(v,"InlineValueRequest",{enumerable:!0,get:function(){return IE.InlineValueRequest}});Object.defineProperty(v,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return IE.InlineValueRefreshRequest}});var my=nk();Object.defineProperty(v,"InlayHintRequest",{enumerable:!0,get:function(){return my.InlayHintRequest}});Object.defineProperty(v,"InlayHintResolveRequest",{enumerable:!0,get:function(){return my.InlayHintResolveRequest}});Object.defineProperty(v,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return my.InlayHintRefreshRequest}});var Iu=lk();Object.defineProperty(v,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Iu.DiagnosticServerCancellationData}});Object.defineProperty(v,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Iu.DocumentDiagnosticReportKind}});Object.defineProperty(v,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Iu.DocumentDiagnosticRequest}});Object.defineProperty(v,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Iu.WorkspaceDiagnosticRequest}});Object.defineProperty(v,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Iu.DiagnosticRefreshRequest}});var Cn=yk();Object.defineProperty(v,"NotebookCellKind",{enumerable:!0,get:function(){return Cn.NotebookCellKind}});Object.defineProperty(v,"ExecutionSummary",{enumerable:!0,get:function(){return Cn.ExecutionSummary}});Object.defineProperty(v,"NotebookCell",{enumerable:!0,get:function(){return Cn.NotebookCell}});Object.defineProperty(v,"NotebookDocument",{enumerable:!0,get:function(){return Cn.NotebookDocument}});Object.defineProperty(v,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return Cn.NotebookDocumentSyncRegistrationType}});Object.defineProperty(v,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return Cn.DidOpenNotebookDocumentNotification}});Object.defineProperty(v,"NotebookCellArrayChange",{enumerable:!0,get:function(){return Cn.NotebookCellArrayChange}});Object.defineProperty(v,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return Cn.DidChangeNotebookDocumentNotification}});Object.defineProperty(v,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return Cn.DidSaveNotebookDocumentNotification}});Object.defineProperty(v,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return Cn.DidCloseNotebookDocumentNotification}});var $$=Tk();Object.defineProperty(v,"InlineCompletionRequest",{enumerable:!0,get:function(){return $$.InlineCompletionRequest}});var ay;(function(t){function e(r){let n=r;return Ft.string(n)||Ft.string(n.language)||Ft.string(n.scheme)||Ft.string(n.pattern)}t.is=e})(ay||(v.TextDocumentFilter=ay={}));var cy;(function(t){function e(r){let n=r;return Ft.objectLiteral(n)&&(Ft.string(n.notebookType)||Ft.string(n.scheme)||Ft.string(n.pattern))}t.is=e})(cy||(v.NotebookDocumentFilter=cy={}));var uy;(function(t){function e(r){let n=r;return Ft.objectLiteral(n)&&(Ft.string(n.notebook)||cy.is(n.notebook))&&(n.language===void 0||Ft.string(n.language))}t.is=e})(uy||(v.NotebookCellTextDocumentFilter=uy={}));var ly;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!Ft.string(n)&&!ay.is(n)&&!uy.is(n))return!1;return!0}t.is=e})(ly||(v.DocumentSelector=ly={}));var bk;(function(t){t.method="client/registerCapability",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType(t.method)})(bk||(v.RegistrationRequest=bk={}));var _k;(function(t){t.method="client/unregisterCapability",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType(t.method)})(_k||(v.UnregistrationRequest=_k={}));var Ck;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(Ck||(v.ResourceOperationKind=Ck={}));var Sk;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(Sk||(v.FailureHandlingKind=Sk={}));var kk;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(kk||(v.PositionEncodingKind=kk={}));var Ek;(function(t){function e(r){let n=r;return n&&Ft.string(n.id)&&n.id.length>0}t.hasId=e})(Ek||(v.StaticRegistrationOptions=Ek={}));var Ak;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||ly.is(n.documentSelector))}t.is=e})(Ak||(v.TextDocumentRegistrationOptions=Ak={}));var wk;(function(t){function e(n){let i=n;return Ft.objectLiteral(i)&&(i.workDoneProgress===void 0||Ft.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&Ft.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(wk||(v.WorkDoneProgressOptions=wk={}));var Nk;(function(t){t.method="initialize",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(Nk||(v.InitializeRequest=Nk={}));var Pk;(function(t){t.unknownProtocolVersion=1})(Pk||(v.InitializeErrorCodes=Pk={}));var Ik;(function(t){t.method="initialized",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Ik||(v.InitializedNotification=Ik={}));var Dk;(function(t){t.method="shutdown",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType0(t.method)})(Dk||(v.ShutdownRequest=Dk={}));var Ok;(function(t){t.method="exit",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType0(t.method)})(Ok||(v.ExitNotification=Ok={}));var Lk;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Lk||(v.DidChangeConfigurationNotification=Lk={}));var Mk;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(Mk||(v.MessageType=Mk={}));var Fk;(function(t){t.method="window/showMessage",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolNotificationType(t.method)})(Fk||(v.ShowMessageNotification=Fk={}));var $k;(function(t){t.method="window/showMessageRequest",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType(t.method)})($k||(v.ShowMessageRequest=$k={}));var qk;(function(t){t.method="window/logMessage",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolNotificationType(t.method)})(qk||(v.LogMessageNotification=qk={}));var jk;(function(t){t.method="telemetry/event",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolNotificationType(t.method)})(jk||(v.TelemetryEventNotification=jk={}));var Uk;(function(t){t.None=0,t.Full=1,t.Incremental=2})(Uk||(v.TextDocumentSyncKind=Uk={}));var Wk;(function(t){t.method="textDocument/didOpen",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Wk||(v.DidOpenTextDocumentNotification=Wk={}));var Bk;(function(t){function e(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}t.isIncremental=e;function r(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}t.isFull=r})(Bk||(v.TextDocumentContentChangeEvent=Bk={}));var Hk;(function(t){t.method="textDocument/didChange",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Hk||(v.DidChangeTextDocumentNotification=Hk={}));var Gk;(function(t){t.method="textDocument/didClose",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Gk||(v.DidCloseTextDocumentNotification=Gk={}));var zk;(function(t){t.method="textDocument/didSave",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(zk||(v.DidSaveTextDocumentNotification=zk={}));var Vk;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(Vk||(v.TextDocumentSaveReason=Vk={}));var Kk;(function(t){t.method="textDocument/willSave",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Kk||(v.WillSaveTextDocumentNotification=Kk={}));var Xk;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(Xk||(v.WillSaveTextDocumentWaitUntilRequest=Xk={}));var Yk;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolNotificationType(t.method)})(Yk||(v.DidChangeWatchedFilesNotification=Yk={}));var Jk;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(Jk||(v.FileChangeType=Jk={}));var Qk;(function(t){function e(r){let n=r;return Ft.objectLiteral(n)&&(Rk.URI.is(n.baseUri)||Rk.WorkspaceFolder.is(n.baseUri))&&Ft.string(n.pattern)}t.is=e})(Qk||(v.RelativePattern=Qk={}));var Zk;(function(t){t.Create=1,t.Change=2,t.Delete=4})(Zk||(v.WatchKind=Zk={}));var eE;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolNotificationType(t.method)})(eE||(v.PublishDiagnosticsNotification=eE={}));var tE;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(tE||(v.CompletionTriggerKind=tE={}));var rE;(function(t){t.method="textDocument/completion",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(rE||(v.CompletionRequest=rE={}));var nE;(function(t){t.method="completionItem/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(nE||(v.CompletionResolveRequest=nE={}));var iE;(function(t){t.method="textDocument/hover",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(iE||(v.HoverRequest=iE={}));var oE;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(oE||(v.SignatureHelpTriggerKind=oE={}));var sE;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(sE||(v.SignatureHelpRequest=sE={}));var aE;(function(t){t.method="textDocument/definition",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(aE||(v.DefinitionRequest=aE={}));var cE;(function(t){t.method="textDocument/references",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(cE||(v.ReferencesRequest=cE={}));var uE;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(uE||(v.DocumentHighlightRequest=uE={}));var lE;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(lE||(v.DocumentSymbolRequest=lE={}));var dE;(function(t){t.method="textDocument/codeAction",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(dE||(v.CodeActionRequest=dE={}));var fE;(function(t){t.method="codeAction/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(fE||(v.CodeActionResolveRequest=fE={}));var hE;(function(t){t.method="workspace/symbol",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(hE||(v.WorkspaceSymbolRequest=hE={}));var pE;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(pE||(v.WorkspaceSymbolResolveRequest=pE={}));var mE;(function(t){t.method="textDocument/codeLens",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(mE||(v.CodeLensRequest=mE={}));var gE;(function(t){t.method="codeLens/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(gE||(v.CodeLensResolveRequest=gE={}));var yE;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType0(t.method)})(yE||(v.CodeLensRefreshRequest=yE={}));var vE;(function(t){t.method="textDocument/documentLink",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(vE||(v.DocumentLinkRequest=vE={}));var xE;(function(t){t.method="documentLink/resolve",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(xE||(v.DocumentLinkResolveRequest=xE={}));var TE;(function(t){t.method="textDocument/formatting",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(TE||(v.DocumentFormattingRequest=TE={}));var RE;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(RE||(v.DocumentRangeFormattingRequest=RE={}));var bE;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(bE||(v.DocumentRangesFormattingRequest=bE={}));var _E;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(_E||(v.DocumentOnTypeFormattingRequest=_E={}));var CE;(function(t){t.Identifier=1})(CE||(v.PrepareSupportDefaultBehavior=CE={}));var SE;(function(t){t.method="textDocument/rename",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(SE||(v.RenameRequest=SE={}));var kE;(function(t){t.method="textDocument/prepareRename",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(kE||(v.PrepareRenameRequest=kE={}));var EE;(function(t){t.method="workspace/executeCommand",t.messageDirection=F.MessageDirection.clientToServer,t.type=new F.ProtocolRequestType(t.method)})(EE||(v.ExecuteCommandRequest=EE={}));var AE;(function(t){t.method="workspace/applyEdit",t.messageDirection=F.MessageDirection.serverToClient,t.type=new F.ProtocolRequestType("workspace/applyEdit")})(AE||(v.ApplyWorkspaceEditRequest=AE={}))});var LE=G(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.createProtocolConnection=void 0;var OE=yo();function q$(t,e,r,n){return OE.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,OE.createMessageConnection)(t,e,r,n)}If.createProtocolConnection=q$});var FE=G(vr=>{"use strict";var j$=vr&&vr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Df=vr&&vr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&j$(e,t,r)};Object.defineProperty(vr,"__esModule",{value:!0});vr.LSPErrorCodes=vr.createProtocolConnection=void 0;Df(yo(),vr);Df(gf(),vr);Df(tt(),vr);Df(DE(),vr);var U$=LE();Object.defineProperty(vr,"createProtocolConnection",{enumerable:!0,get:function(){return U$.createProtocolConnection}});var ME;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(ME||(vr.LSPErrorCodes=ME={}))});var ht=G(Sn=>{"use strict";var W$=Sn&&Sn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),$E=Sn&&Sn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&W$(e,t,r)};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.createProtocolConnection=void 0;var B$=Zg();$E(Zg(),Sn);$E(FE(),Sn);function H$(t,e,r,n){return(0,B$.createMessageConnection)(t,e,r,n)}Sn.createProtocolConnection=H$});var gy=G($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.generateUuid=$r.parse=$r.isUUID=$r.v4=$r.empty=void 0;var Du=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Ou=class t extends Du{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return t._oneOf(t._chars)}constructor(){super([t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-","4",t._randomHex(),t._randomHex(),t._randomHex(),"-",t._oneOf(t._timeHighBits),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex()].join(""))}};Ou._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Ou._timeHighBits=["8","9","a","b"];$r.empty=new Du("00000000-0000-0000-0000-000000000000");function qE(){return new Ou}$r.v4=qE;var G$=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function jE(t){return G$.test(t)}$r.isUUID=jE;function z$(t){if(!jE(t))throw new Error("invalid uuid");return new Du(t)}$r.parse=z$;function V$(){return qE().asHex()}$r.generateUuid=V$});var UE=G(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.attachPartialResult=wi.ProgressFeature=wi.attachWorkDone=void 0;var Ai=ht(),K$=gy(),xo=class t{constructor(e,r){this._connection=e,this._token=r,t.Instances.set(this._token,this)}begin(e,r,n,i){let o={kind:"begin",title:e,percentage:r,message:n,cancellable:i};this._connection.sendProgress(Ai.WorkDoneProgress.type,this._token,o)}report(e,r){let n={kind:"report"};typeof e=="number"?(n.percentage=e,r!==void 0&&(n.message=r)):n.message=e,this._connection.sendProgress(Ai.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(Ai.WorkDoneProgress.type,this._token,{kind:"end"})}};xo.Instances=new Map;var Of=class extends xo{constructor(e,r){super(e,r),this._source=new Ai.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Lu=class{constructor(){}begin(){}report(){}done(){}},Lf=class extends Lu{constructor(){super(),this._source=new Ai.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function X$(t,e){if(e===void 0||e.workDoneToken===void 0)return new Lu;let r=e.workDoneToken;return delete e.workDoneToken,new xo(t,r)}wi.attachWorkDone=X$;var Y$=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(Ai.WorkDoneProgressCancelNotification.type,r=>{let n=xo.Instances.get(r.token);(n instanceof Of||n instanceof Lf)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Lu:new xo(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,K$.generateUuid)();return this.connection.sendRequest(Ai.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Of(this.connection,e))}else return Promise.resolve(new Lf)}};wi.ProgressFeature=Y$;var yy;(function(t){t.type=new Ai.ProgressType})(yy||(yy={}));var vy=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(yy.type,this._token,e)}};function J$(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new vy(t,r)}wi.attachPartialResult=J$});var WE=G(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.ConfigurationFeature=void 0;var Q$=ht(),Z$=Yd(),eq=t=>class extends t{getConfiguration(e){return e?Z$.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let r={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(Q$.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};Mf.ConfigurationFeature=eq});var BE=G($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.WorkspaceFoldersFeature=void 0;var Ff=ht(),tq=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Ff.Emitter,this.connection.onNotification(Ff.DidChangeWorkspaceFoldersNotification.type,n=>{this._onDidChangeWorkspaceFolders.fire(n.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let r=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=r===!0||typeof r=="string"}getWorkspaceFolders(){return this.connection.sendRequest(Ff.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(Ff.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};$f.WorkspaceFoldersFeature=tq});var HE=G(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});qf.CallHierarchyFeature=void 0;var xy=ht(),rq=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(xy.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=xy.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=xy.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};qf.CallHierarchyFeature=rq});var Ry=G(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.SemanticTokensBuilder=Ni.SemanticTokensDiff=Ni.SemanticTokensFeature=void 0;var jf=ht(),nq=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(jf.SemanticTokensRefreshRequest.type),on:e=>{let r=jf.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=jf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=jf.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Ni.SemanticTokensFeature=nq;var Uf=class{constructor(e,r){this.originalSequence=e,this.modifiedSequence=r}computeDiff(){let e=this.originalSequence.length,r=this.modifiedSequence.length,n=0;for(;n<r&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<r&&n<e){let i=e-1,o=r-1;for(;i>=n&&o>=n&&this.originalSequence[i]===this.modifiedSequence[o];)i--,o--;(i<n||o<n)&&(i++,o++);let s=i-n+1,a=this.modifiedSequence.slice(n,o+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:n,deleteCount:s-1}]:[{start:n,deleteCount:s,data:a}]}else return n<r?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};Ni.SemanticTokensDiff=Uf;var Ty=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,r,n,i,o){let s=e,a=r;this._dataLen>0&&(s-=this._prevLine,s===0&&(a-=this._prevChar)),this._data[this._dataLen++]=s,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=o,this._prevLine=e,this._prevChar=r}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?{resultId:this.id,edits:new Uf(this._prevData,this._data).computeDiff()}:this.build()}};Ni.SemanticTokensBuilder=Ty});var GE=G(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.ShowDocumentFeature=void 0;var iq=ht(),oq=t=>class extends t{showDocument(e){return this.connection.sendRequest(iq.ShowDocumentRequest.type,e)}};Wf.ShowDocumentFeature=oq});var zE=G(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.FileOperationsFeature=void 0;var Da=ht(),sq=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Da.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(Da.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(Da.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(Da.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(Da.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(Da.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};Bf.FileOperationsFeature=sq});var VE=G(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.LinkedEditingRangeFeature=void 0;var aq=ht(),cq=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(aq.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};Hf.LinkedEditingRangeFeature=cq});var KE=G(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.TypeHierarchyFeature=void 0;var by=ht(),uq=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(by.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=by.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=by.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Gf.TypeHierarchyFeature=uq});var YE=G(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.InlineValueFeature=void 0;var XE=ht(),lq=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(XE.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(XE.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};zf.InlineValueFeature=lq});var QE=G(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.FoldingRangeFeature=void 0;var JE=ht(),dq=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(JE.FoldingRangeRefreshRequest.type),on:e=>{let r=JE.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Vf.FoldingRangeFeature=dq});var ZE=G(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.InlayHintFeature=void 0;var _y=ht(),fq=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(_y.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(_y.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(_y.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Kf.InlayHintFeature=fq});var eA=G(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});Xf.DiagnosticFeature=void 0;var Mu=ht(),hq=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Mu.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Mu.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Mu.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(Mu.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Mu.WorkspaceDiagnosticRequest.partialResult,r)))}}};Xf.DiagnosticFeature=hq});var Sy=G(Yf=>{"use strict";Object.defineProperty(Yf,"__esModule",{value:!0});Yf.TextDocuments=void 0;var To=ht(),Cy=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new To.Emitter,this._onDidOpen=new To.Emitter,this._onDidClose=new To.Emitter,this._onDidSave=new To.Emitter,this._onWillSave=new To.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=To.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,o);let s=Object.freeze({document:o});this._onDidOpen.fire(s),this._onDidChangeContent.fire(s)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:s}=i;if(s==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=this._syncedDocuments.get(i.uri);a!==void 0&&(a=this._configuration.update(a,o,s),this._syncedDocuments.set(i.uri,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),r.push(e.onDidCloseTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(n.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(n.textDocument.uri);return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),To.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};Yf.TextDocuments=Cy});var Ey=G(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.NotebookDocuments=Oa.NotebookSyncFeature=void 0;var qr=ht(),tA=Sy(),pq=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(qr.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(qr.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(qr.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(qr.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};Oa.NotebookSyncFeature=pq;var Jf=class t{onDidOpenTextDocument(e){return this.openHandler=e,qr.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,qr.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,qr.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};Jf.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var ky=class{constructor(e){e instanceof tA.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new tA.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new qr.Emitter,this._onDidChange=new qr.Emitter,this._onDidSave=new qr.Emitter,this._onDidClose=new qr.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let r=this.notebookCellMap.get(e);return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"?e:e.document,n=this.notebookCellMap.get(r);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 r=new Jf,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let o of i.cellTextDocuments)r.openTextDocument({textDocument:o});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o===void 0)return;o.version=i.notebookDocument.version;let s=o.metadata,a=!1,c=i.change;c.metadata!==void 0&&(a=!0,o.metadata=c.metadata);let u=[],l=[],h=[],p=[];if(c.cells!==void 0){let w=c.cells;if(w.structure!==void 0){let x=w.structure.array;if(o.cells.splice(x.start,x.deleteCount,...x.cells!==void 0?x.cells:[]),w.structure.didOpen!==void 0)for(let g of w.structure.didOpen)r.openTextDocument({textDocument:g}),u.push(g.uri);if(w.structure.didClose)for(let g of w.structure.didClose)r.closeTextDocument({textDocument:g}),l.push(g.uri)}if(w.data!==void 0){let x=new Map(w.data.map(g=>[g.document,g]));for(let g=0;g<=o.cells.length;g++){let A=x.get(o.cells[g].document);if(A!==void 0){let M=o.cells.splice(g,1,A);if(h.push({old:M[0],new:A}),x.delete(A.document),x.size===0)break}}}if(w.textContent!==void 0)for(let x of w.textContent)r.changeTextDocument({textDocument:x.document,contentChanges:x.changes}),p.push(x.document.uri)}this.updateCellMap(o);let y={notebookDocument:o};a&&(y.metadata={old:s,new:o.metadata});let _=[];for(let w of u)_.push(this.getNotebookCell(w));let E=[];for(let w of l)E.push(this.getNotebookCell(w));let D=[];for(let w of p)D.push(this.getNotebookCell(w));(_.length>0||E.length>0||h.length>0||D.length>0)&&(y.cells={added:_,removed:E,changed:{data:h,textContent:D}}),(y.metadata!==void 0||y.cells!==void 0)&&this._onDidChange.fire(y)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o!==void 0){this._onDidClose.fire(o);for(let s of i.cellTextDocuments)r.closeTextDocument({textDocument:s});this.notebookDocuments.delete(i.notebookDocument.uri);for(let s of o.cells)this.notebookCellMap.delete(s.document)}})),qr.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};Oa.NotebookDocuments=ky});var rA=G(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.MonikerFeature=void 0;var mq=ht(),gq=t=>class extends t{get moniker(){return{on:e=>{let r=mq.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Qf.MonikerFeature=gq});var Dy=G(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.createConnection=be.combineFeatures=be.combineNotebooksFeatures=be.combineLanguagesFeatures=be.combineWorkspaceFeatures=be.combineWindowFeatures=be.combineClientFeatures=be.combineTracerFeatures=be.combineTelemetryFeatures=be.combineConsoleFeatures=be._NotebooksImpl=be._LanguagesImpl=be.BulkUnregistration=be.BulkRegistration=be.ErrorMessageTracker=void 0;var U=ht(),jr=Yd(),wy=gy(),ie=UE(),yq=WE(),vq=BE(),xq=HE(),Tq=Ry(),Rq=GE(),bq=zE(),_q=VE(),Cq=KE(),Sq=YE(),kq=QE(),Eq=ZE(),Aq=eA(),wq=Ey(),Nq=rA();function Ay(t){if(t!==null)return t}var Ny=class{constructor(){this._messages=Object.create(null)}add(e){let r=this._messages[e];r||(r=0),r++,this._messages[e]=r}sendErrors(e){Object.keys(this._messages).forEach(r=>{e.window.showErrorMessage(r)})}};be.ErrorMessageTracker=Ny;var Zf=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(U.MessageType.Error,e)}warn(e){this.send(U.MessageType.Warning,e)}info(e){this.send(U.MessageType.Info,e)}log(e){this.send(U.MessageType.Log,e)}debug(e){this.send(U.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(U.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,U.RAL)().console.error("Sending log message failed")})}},Py=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...r){let n={type:U.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(Ay)}showWarningMessage(e,...r){let n={type:U.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(Ay)}showInformationMessage(e,...r){let n={type:U.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(Ay)}},nA=(0,Rq.ShowDocumentFeature)((0,ie.ProgressFeature)(Py)),iA;(function(t){function e(){return new eh}t.create=e})(iA||(be.BulkRegistration=iA={}));var eh=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=jr.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=wy.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},oA;(function(t){function e(){return new Fu(void 0,[])}t.create=e})(oA||(be.BulkUnregistration=oA={}));var Fu=class{constructor(e,r){this._connection=e,this._unregistrations=new Map,r.forEach(n=>{this._unregistrations.set(n.method,n)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let n of this._unregistrations.values())e.push(n);let r={unregisterations:e};this._connection.sendRequest(U.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=jr.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(U.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},o=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},th=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,r,n){return e instanceof eh?this.registerMany(e):e instanceof Fu?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=jr.string(r)?r:r.method,o=wy.generateUuid(),s={registrations:[{id:o,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(U.RegistrationRequest.type,s).then(a=>(e.add({id:o,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,r){let n=jr.string(e)?e:e.method,i=wy.generateUuid(),o={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(U.RegistrationRequest.type,o).then(s=>U.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),s=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(s)))}unregisterSingle(e,r){let n={unregisterations:[{id:e,method:r}]};return this.connection.sendRequest(U.UnregistrationRequest.type,n).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let r=e.asRegistrationParams();return this.connection.sendRequest(U.RegistrationRequest.type,r).then(()=>new Fu(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Iy=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function r(i){return i&&!!i.edit}let n=r(e)?e:{edit:e};return this.connection.sendRequest(U.ApplyWorkspaceEditRequest.type,n)}},sA=(0,bq.FileOperationsFeature)((0,vq.WorkspaceFoldersFeature)((0,yq.ConfigurationFeature)(Iy))),rh=class{constructor(){this._trace=U.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,r){this._trace!==U.Trace.Off&&this.connection.sendNotification(U.LogTraceNotification.type,{message:e,verbose:this._trace===U.Trace.Verbose?r:void 0}).catch(()=>{})}},nh=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(U.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},ih=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,ie.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,ie.attachPartialResult)(this.connection,r)}};be._LanguagesImpl=ih;var aA=(0,kq.FoldingRangeFeature)((0,Nq.MonikerFeature)((0,Aq.DiagnosticFeature)((0,Eq.InlayHintFeature)((0,Sq.InlineValueFeature)((0,Cq.TypeHierarchyFeature)((0,_q.LinkedEditingRangeFeature)((0,Tq.SemanticTokensFeature)((0,xq.CallHierarchyFeature)(ih))))))))),oh=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,ie.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,ie.attachPartialResult)(this.connection,r)}};be._NotebooksImpl=oh;var cA=(0,wq.NotebookSyncFeature)(oh);function uA(t,e){return function(r){return e(t(r))}}be.combineConsoleFeatures=uA;function lA(t,e){return function(r){return e(t(r))}}be.combineTelemetryFeatures=lA;function dA(t,e){return function(r){return e(t(r))}}be.combineTracerFeatures=dA;function fA(t,e){return function(r){return e(t(r))}}be.combineClientFeatures=fA;function hA(t,e){return function(r){return e(t(r))}}be.combineWindowFeatures=hA;function pA(t,e){return function(r){return e(t(r))}}be.combineWorkspaceFeatures=pA;function mA(t,e){return function(r){return e(t(r))}}be.combineLanguagesFeatures=mA;function gA(t,e){return function(r){return e(t(r))}}be.combineNotebooksFeatures=gA;function Pq(t,e){function r(i,o,s){return i&&o?s(i,o):i||o}return{__brand:"features",console:r(t.console,e.console,uA),tracer:r(t.tracer,e.tracer,dA),telemetry:r(t.telemetry,e.telemetry,lA),client:r(t.client,e.client,fA),window:r(t.window,e.window,hA),workspace:r(t.workspace,e.workspace,pA),languages:r(t.languages,e.languages,mA),notebooks:r(t.notebooks,e.notebooks,gA)}}be.combineFeatures=Pq;function Iq(t,e,r){let n=r&&r.console?new(r.console(Zf)):new Zf,i=t(n);n.rawAttach(i);let o=r&&r.tracer?new(r.tracer(rh)):new rh,s=r&&r.telemetry?new(r.telemetry(nh)):new nh,a=r&&r.client?new(r.client(th)):new th,c=r&&r.window?new(r.window(nA)):new nA,u=r&&r.workspace?new(r.workspace(sA)):new sA,l=r&&r.languages?new(r.languages(aA)):new aA,h=r&&r.notebooks?new(r.notebooks(cA)):new cA,p=[n,o,s,a,c,u,l,h];function y(x){return x instanceof Promise?x:jr.thenable(x)?new Promise((g,A)=>{x.then(M=>g(M),M=>A(M))}):Promise.resolve(x)}let _,E,D,w={listen:()=>i.listen(),sendRequest:(x,...g)=>i.sendRequest(jr.string(x)?x:x.method,...g),onRequest:(x,g)=>i.onRequest(x,g),sendNotification:(x,g)=>{let A=jr.string(x)?x:x.method;return i.sendNotification(A,g)},onNotification:(x,g)=>i.onNotification(x,g),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:x=>(E=x,{dispose:()=>{E=void 0}}),onInitialized:x=>i.onNotification(U.InitializedNotification.type,x),onShutdown:x=>(_=x,{dispose:()=>{_=void 0}}),onExit:x=>(D=x,{dispose:()=>{D=void 0}}),get console(){return n},get telemetry(){return s},get tracer(){return o},get client(){return a},get window(){return c},get workspace(){return u},get languages(){return l},get notebooks(){return h},onDidChangeConfiguration:x=>i.onNotification(U.DidChangeConfigurationNotification.type,x),onDidChangeWatchedFiles:x=>i.onNotification(U.DidChangeWatchedFilesNotification.type,x),__textDocumentSync:void 0,onDidOpenTextDocument:x=>i.onNotification(U.DidOpenTextDocumentNotification.type,x),onDidChangeTextDocument:x=>i.onNotification(U.DidChangeTextDocumentNotification.type,x),onDidCloseTextDocument:x=>i.onNotification(U.DidCloseTextDocumentNotification.type,x),onWillSaveTextDocument:x=>i.onNotification(U.WillSaveTextDocumentNotification.type,x),onWillSaveTextDocumentWaitUntil:x=>i.onRequest(U.WillSaveTextDocumentWaitUntilRequest.type,x),onDidSaveTextDocument:x=>i.onNotification(U.DidSaveTextDocumentNotification.type,x),sendDiagnostics:x=>i.sendNotification(U.PublishDiagnosticsNotification.type,x),onHover:x=>i.onRequest(U.HoverRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onCompletion:x=>i.onRequest(U.CompletionRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onCompletionResolve:x=>i.onRequest(U.CompletionResolveRequest.type,x),onSignatureHelp:x=>i.onRequest(U.SignatureHelpRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onDeclaration:x=>i.onRequest(U.DeclarationRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onDefinition:x=>i.onRequest(U.DefinitionRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onTypeDefinition:x=>i.onRequest(U.TypeDefinitionRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onImplementation:x=>i.onRequest(U.ImplementationRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onReferences:x=>i.onRequest(U.ReferencesRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onDocumentHighlight:x=>i.onRequest(U.DocumentHighlightRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onDocumentSymbol:x=>i.onRequest(U.DocumentSymbolRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onWorkspaceSymbol:x=>i.onRequest(U.WorkspaceSymbolRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onWorkspaceSymbolResolve:x=>i.onRequest(U.WorkspaceSymbolResolveRequest.type,x),onCodeAction:x=>i.onRequest(U.CodeActionRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onCodeActionResolve:x=>i.onRequest(U.CodeActionResolveRequest.type,(g,A)=>x(g,A)),onCodeLens:x=>i.onRequest(U.CodeLensRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onCodeLensResolve:x=>i.onRequest(U.CodeLensResolveRequest.type,(g,A)=>x(g,A)),onDocumentFormatting:x=>i.onRequest(U.DocumentFormattingRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onDocumentRangeFormatting:x=>i.onRequest(U.DocumentRangeFormattingRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onDocumentOnTypeFormatting:x=>i.onRequest(U.DocumentOnTypeFormattingRequest.type,(g,A)=>x(g,A)),onRenameRequest:x=>i.onRequest(U.RenameRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),onPrepareRename:x=>i.onRequest(U.PrepareRenameRequest.type,(g,A)=>x(g,A)),onDocumentLinks:x=>i.onRequest(U.DocumentLinkRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onDocumentLinkResolve:x=>i.onRequest(U.DocumentLinkResolveRequest.type,(g,A)=>x(g,A)),onDocumentColor:x=>i.onRequest(U.DocumentColorRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onColorPresentation:x=>i.onRequest(U.ColorPresentationRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onFoldingRanges:x=>i.onRequest(U.FoldingRangeRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onSelectionRanges:x=>i.onRequest(U.SelectionRangeRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),(0,ie.attachPartialResult)(i,g))),onExecuteCommand:x=>i.onRequest(U.ExecuteCommandRequest.type,(g,A)=>x(g,A,(0,ie.attachWorkDone)(i,g),void 0)),dispose:()=>i.dispose()};for(let x of p)x.attach(w);return i.onRequest(U.InitializeRequest.type,x=>{e.initialize(x),jr.string(x.trace)&&(o.trace=U.Trace.fromString(x.trace));for(let g of p)g.initialize(x.capabilities);if(E){let g=E(x,new U.CancellationTokenSource().token,(0,ie.attachWorkDone)(i,x),void 0);return y(g).then(A=>{if(A instanceof U.ResponseError)return A;let M=A;M||(M={capabilities:{}});let te=M.capabilities;te||(te={},M.capabilities=te),te.textDocumentSync===void 0||te.textDocumentSync===null?te.textDocumentSync=jr.number(w.__textDocumentSync)?w.__textDocumentSync:U.TextDocumentSyncKind.None:!jr.number(te.textDocumentSync)&&!jr.number(te.textDocumentSync.change)&&(te.textDocumentSync.change=jr.number(w.__textDocumentSync)?w.__textDocumentSync:U.TextDocumentSyncKind.None);for(let _e of p)_e.fillServerCapabilities(te);return M})}else{let g={capabilities:{textDocumentSync:U.TextDocumentSyncKind.None}};for(let A of p)A.fillServerCapabilities(g.capabilities);return g}}),i.onRequest(U.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,_)return _(new U.CancellationTokenSource().token)}),i.onNotification(U.ExitNotification.type,()=>{try{D&&D()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(U.SetTraceNotification.type,x=>{o.trace=U.Trace.fromString(x.value)}),w}be.createConnection=Iq});var yA=G(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.resolveModulePath=xr.FileSystem=xr.resolveGlobalYarnPath=xr.resolveGlobalNodePath=xr.resolve=xr.uriToFilePath=void 0;var Dq=require("url"),Zr=require("path"),Oy=require("fs"),$y=require("child_process");function Oq(t){let e=Dq.parse(t);if(e.protocol!=="file:"||!e.path)return;let r=e.path.split("/");for(var n=0,i=r.length;n<i;n++)r[n]=decodeURIComponent(r[n]);if(process.platform==="win32"&&r.length>1){let o=r[0],s=r[1];o.length===0&&s.length>1&&s[1]===":"&&r.shift()}return Zr.normalize(r.join("/"))}xr.uriToFilePath=Oq;function Ly(){return process.platform==="win32"}function sh(t,e,r,n){let i="NODE_PATH",o=["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((s,a)=>{let c=process.env,u=Object.create(null);Object.keys(c).forEach(l=>u[l]=c[l]),e&&Oy.existsSync(e)&&(u[i]?u[i]=e+Zr.delimiter+u[i]:u[i]=e,n&&n(`NODE_PATH value is: ${u[i]}`)),u.ELECTRON_RUN_AS_NODE="1";try{let l=(0,$y.fork)("",[],{cwd:r,env:u,execArgv:["-e",o]});if(l.pid===void 0){a(new Error(`Starting process to resolve node module ${t} failed`));return}l.on("error",p=>{a(p)}),l.on("message",p=>{p.c==="r"&&(l.send({c:"e"}),p.s?s(p.r):a(new Error(`Failed to resolve module: ${t}`)))});let h={c:"rs",a:t};l.send(h)}catch(l){a(l)}})}xr.resolve=sh;function My(t){let e="npm",r=Object.create(null);Object.keys(process.env).forEach(o=>r[o]=process.env[o]),r.NO_UPDATE_NOTIFIER="true";let n={encoding:"utf8",env:r};Ly()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let o=(0,$y.spawnSync)(e,["config","get","prefix"],n).stdout;if(!o){t&&t("'npm config get prefix' didn't return a value.");return}let s=o.trim();return t&&t(`'npm config get prefix' value is: ${s}`),s.length>0?Ly()?Zr.join(s,"node_modules"):Zr.join(s,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}xr.resolveGlobalNodePath=My;function Lq(t){let e="yarn",r={encoding:"utf8"};Ly()&&(e="yarn.cmd",r.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,$y.spawnSync)(e,["global","dir","--json"],r),o=i.stdout;if(!o){t&&(t("'yarn global dir' didn't return a value."),i.stderr&&t(i.stderr));return}let s=o.trim().split(/\r?\n/);for(let a of s)try{let c=JSON.parse(a);if(c.type==="log")return Zr.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}xr.resolveGlobalYarnPath=Lq;var Fy;(function(t){let e;function r(){return e!==void 0||(process.platform==="win32"?e=!1:e=!Oy.existsSync(__filename.toUpperCase())||!Oy.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=r;function n(i,o){return r()?Zr.normalize(o).indexOf(Zr.normalize(i))===0:Zr.normalize(o).toLowerCase().indexOf(Zr.normalize(i).toLowerCase())===0}t.isParent=n})(Fy||(xr.FileSystem=Fy={}));function Mq(t,e,r,n){return r?(Zr.isAbsolute(r)||(r=Zr.join(t,r)),sh(e,r,r,n).then(i=>Fy.isParent(r,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>sh(e,My(n),t,n))):sh(e,My(n),t,n)}xr.resolveModulePath=Mq});var qy=G((wte,vA)=>{"use strict";vA.exports=ht()});var xA=G(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.InlineCompletionFeature=void 0;var Fq=ht(),$q=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(Fq.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};ah.InlineCompletionFeature=$q});var bA=G(Zt=>{"use strict";var qq=Zt&&Zt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),RA=Zt&&Zt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qq(e,t,r)};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.ProposedFeatures=Zt.NotebookDocuments=Zt.TextDocuments=Zt.SemanticTokensBuilder=void 0;var jq=Ry();Object.defineProperty(Zt,"SemanticTokensBuilder",{enumerable:!0,get:function(){return jq.SemanticTokensBuilder}});var Uq=xA();RA(ht(),Zt);var Wq=Sy();Object.defineProperty(Zt,"TextDocuments",{enumerable:!0,get:function(){return Wq.TextDocuments}});var Bq=Ey();Object.defineProperty(Zt,"NotebookDocuments",{enumerable:!0,get:function(){return Bq.NotebookDocuments}});RA(Dy(),Zt);var TA;(function(t){t.all={__brand:"features",languages:Uq.InlineCompletionFeature}})(TA||(Zt.ProposedFeatures=TA={}))});var kn=G(Ur=>{"use strict";var Hq=Ur&&Ur.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),kA=Ur&&Ur.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hq(e,t,r)};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.createConnection=Ur.Files=void 0;var _A=require("node:util"),jy=Yd(),Gq=Dy(),$u=yA(),Ro=qy();kA(qy(),Ur);kA(bA(),Ur);var CA;(function(t){t.uriToFilePath=$u.uriToFilePath,t.resolveGlobalNodePath=$u.resolveGlobalNodePath,t.resolveGlobalYarnPath=$u.resolveGlobalYarnPath,t.resolve=$u.resolve,t.resolveModulePath=$u.resolveModulePath})(CA||(Ur.Files=CA={}));var SA;function ch(){if(SA!==void 0)try{SA.end()}catch{}}var La=!1,EA;function zq(){let t="--clientProcessId";function e(r){try{let n=parseInt(r);isNaN(n)||(EA=setInterval(()=>{try{process.kill(n,0)}catch{ch(),process.exit(La?0:1)}},3e3))}catch{}}for(let r=2;r<process.argv.length;r++){let n=process.argv[r];if(n===t&&r+1<process.argv.length){e(process.argv[r+1]);return}else{let i=n.split("=");i[0]===t&&e(i[1])}}}zq();var Vq={initialize:t=>{let e=t.processId;jy.number(e)&&EA===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(La?0:1)}},3e3)},get shutdownReceived(){return La},set shutdownReceived(t){La=t},exit:t=>{ch(),process.exit(t)}};function Kq(t,e,r,n){let i,o,s,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),Ro.ConnectionStrategy.is(t)||Ro.ConnectionOptions.is(t)?a=t:(o=t,s=e,a=r),Xq(o,s,a,i)}Ur.createConnection=Kq;function Xq(t,e,r,n){let i=!1;if(!t&&!e&&process.argv.length>2){let c,u,l=process.argv.slice(2);for(let h=0;h<l.length;h++){let p=l[h];if(p==="--node-ipc"){t=new Ro.IPCMessageReader(process),e=new Ro.IPCMessageWriter(process);break}else if(p==="--stdio"){i=!0,t=process.stdin,e=process.stdout;break}else if(p==="--socket"){c=parseInt(l[h+1]);break}else if(p==="--pipe"){u=l[h+1];break}else{var o=p.split("=");if(o[0]==="--socket"){c=parseInt(o[1]);break}else if(o[0]==="--pipe"){u=o[1];break}}}if(c){let h=(0,Ro.createServerSocketTransport)(c);t=h[0],e=h[1]}else if(u){let h=(0,Ro.createServerPipeTransport)(u);t=h[0],e=h[1]}}var s="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!t)throw new Error("Connection input stream is not set. "+s);if(!e)throw new Error("Connection output stream is not set. "+s);if(jy.func(t.read)&&jy.func(t.on)){let c=t;c.on("end",()=>{ch(),process.exit(La?0:1)}),c.on("close",()=>{ch(),process.exit(La?0:1)})}let a=c=>{let u=(0,Ro.createProtocolConnection)(t,e,c,r);return i&&Yq(c),u};return(0,Gq.createConnection)(a,Vq,n)}function Yq(t){function e(n){return n.map(i=>typeof i=="string"?i:(0,_A.inspect)(i)).join(" ")}let r=new Map;console.assert=function(i,...o){if(!i)if(o.length===0)t.error("Assertion failed");else{let[s,...a]=o;t.error(`Assertion failed: ${s} ${e(a)}`)}},console.count=function(i="default"){let o=String(i),s=r.get(o)??0;s+=1,r.set(o,s),t.log(`${o}: ${o}`)},console.countReset=function(i){i===void 0?r.clear():r.delete(String(i))},console.debug=function(...i){t.log(e(i))},console.dir=function(i,o){t.log((0,_A.inspect)(i,o))},console.log=function(...i){t.log(e(i))},console.error=function(...i){t.error(e(i))},console.trace=function(...i){let o=new Error().stack.replace(/(.+\n){2}/,""),s="Trace";i.length!==0&&(s+=`: ${e(i)}`),t.log(`${s}
36
+ ${o}`)},console.warn=function(...i){t.warn(e(i))}}});var hj={};Kn(hj,{getSyntaxTree:()=>fj});module.exports=ow(hj);var dt={};Kn(dt,{AbstractAstReflection:()=>Di,AbstractCstNode:()=>Fc,AbstractLangiumParser:()=>$c,AbstractParserErrorMessageProvider:()=>Pd,AbstractThreadedAsyncParser:()=>Gm,AstUtils:()=>al,BiMap:()=>so,Cancellation:()=>J,CompositeCstNodeImpl:()=>ro,ContextCache:()=>ao,CstNodeBuilder:()=>Mc,CstUtils:()=>tl,DEFAULT_TOKENIZE_OPTIONS:()=>Wd,DONE_RESULT:()=>zt,DatatypeSymbol:()=>Nd,DefaultAstNodeDescriptionProvider:()=>nu,DefaultAstNodeLocator:()=>ou,DefaultAsyncParser:()=>yu,DefaultCommentProvider:()=>gu,DefaultConfigurationProvider:()=>su,DefaultDocumentBuilder:()=>au,DefaultDocumentValidator:()=>uo,DefaultHydrator:()=>xu,DefaultIndexManager:()=>cu,DefaultJsonSerializer:()=>Zc,DefaultLangiumDocumentFactory:()=>Hc,DefaultLangiumDocuments:()=>Gc,DefaultLexer:()=>lo,DefaultLexerErrorMessageProvider:()=>lu,DefaultLinker:()=>zc,DefaultNameProvider:()=>Vc,DefaultReferenceDescriptionProvider:()=>iu,DefaultReferences:()=>Kc,DefaultScopeComputation:()=>Xc,DefaultScopeProvider:()=>Qc,DefaultServiceRegistry:()=>tu,DefaultTokenBuilder:()=>io,DefaultValueConverter:()=>Wc,DefaultWorkspaceLock:()=>vu,DefaultWorkspaceManager:()=>uu,Deferred:()=>sr,Disposable:()=>xi,DisposableCache:()=>pa,DocumentCache:()=>jd,DocumentState:()=>Le,DocumentValidator:()=>Lr,EMPTY_SCOPE:()=>wF,EMPTY_STREAM:()=>Wa,EmptyFileSystem:()=>_u,EmptyFileSystemProvider:()=>Kd,ErrorWithLocation:()=>Fi,GrammarAST:()=>ji,GrammarUtils:()=>fl,IndentationAwareLexer:()=>Km,IndentationAwareTokenBuilder:()=>Vd,JSDocDocumentationProvider:()=>mu,LangiumCompletionParser:()=>jc,LangiumParser:()=>qc,LangiumParserErrorMessageProvider:()=>ca,LeafCstNodeImpl:()=>to,LexingMode:()=>ho,MapScope:()=>Yc,Module:()=>ya,MultiMap:()=>Yr,OperationCancelled:()=>Rn,ParserWorker:()=>zm,Reduction:()=>ko,RegExpUtils:()=>ll,RootCstNodeImpl:()=>aa,SimpleCache:()=>Jc,StreamImpl:()=>Rr,StreamScope:()=>ha,TextDocument:()=>vi,TreeStreamImpl:()=>rn,URI:()=>vt,UriUtils:()=>ge,ValidationCategory:()=>ga,ValidationRegistry:()=>ru,ValueConverter:()=>Tn,WorkspaceCache:()=>ma,assertUnreachable:()=>on,createCompletionParser:()=>wm,createDefaultCoreModule:()=>Tu,createDefaultSharedCoreModule:()=>Ru,createGrammarConfig:()=>Sp,createLangiumParser:()=>Nm,createParser:()=>Uc,delayNextTick:()=>Fm,diagnosticData:()=>co,eagerLoad:()=>bu,getDiagnosticRange:()=>Q_,indentationBuilderDefaultOptions:()=>Vm,inject:()=>fo,interruptAndCheck:()=>ot,isAstNode:()=>Ge,isAstNodeDescription:()=>Fh,isAstNodeWithComment:()=>eu,isCompositeCstNode:()=>zr,isIMultiModeLexerDefinition:()=>Um,isJSDoc:()=>pu,isLeafCstNode:()=>Xn,isLinkingError:()=>Oi,isNamed:()=>qd,isOperationCancelled:()=>bn,isReference:()=>Ut,isRootCstNode:()=>Ua,isTokenTypeArray:()=>Bd,isTokenTypeDictionary:()=>jm,loadGrammarFromJson:()=>Xd,parseJSDoc:()=>hu,prepareLangiumParser:()=>U_,setInterruptionPeriod:()=>z_,startCancelableOperation:()=>Fd,stream:()=>ce,toDiagnosticData:()=>Z_,toDiagnosticSeverity:()=>Ud});var tl={};Kn(tl,{DefaultNameRegexp:()=>el,RangeComparison:()=>nn,compareRange:()=>ov,findCommentNode:()=>Ba,findDeclarationNodeAtOffset:()=>cr,findLeafNodeAtOffset:()=>Wh,findLeafNodeBeforeOffset:()=>Ha,flattenCst:()=>qh,getInteriorNodes:()=>lw,getNextNode:()=>cw,getPreviousNode:()=>av,getStartlineNode:()=>uw,inRange:()=>Uh,isChildNode:()=>jh,isCommentNode:()=>$h,streamCst:()=>Li,toDocumentSegment:()=>Mi,tokenToRange:()=>Eo});function Ge(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Ut(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function Fh(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Oi(t){return typeof t=="object"&&t!==null&&Ge(t.container)&&Ut(t.reference)&&typeof t.message=="string"}var Di=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,r){return Ge(e)&&this.isSubtype(e.$type,r)}isSubtype(e,r){if(e===r)return!0;let n=this.subtypes[e];n||(n=this.subtypes[e]={});let i=n[r];if(i!==void 0)return i;{let o=this.computeIsSubtype(e,r);return n[r]=o,o}}getAllSubTypes(e){let r=this.allSubtypes[e];if(r)return r;{let n=this.getAllTypes(),i=[];for(let o of n)this.isSubtype(o,e)&&i.push(o);return this.allSubtypes[e]=i,i}}};function zr(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Xn(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function Ua(t){return zr(t)&&typeof t.fullText=="string"}var Rr=class t{constructor(e,r){this.startFn=e,this.nextFn=r}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(),r=0,n=e.next();for(;!n.done;)r++,n=e.next();return r}toArray(){let e=[],r=this.iterator(),n;do n=r.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,r){let n=this.map(i=>[e?e(i):i,r?r(i):i]);return new Map(n)}toString(){return this.join()}concat(e){return new t(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),r=>{let n;if(!r.firstDone){do if(n=this.nextFn(r.first),!n.done)return n;while(!n.done);r.firstDone=!0}do if(n=r.iterator.next(),!n.done)return n;while(!n.done);return zt})}join(e=","){let r=this.iterator(),n="",i,o=!1;do i=r.next(),i.done||(o&&(n+=e),n+=aw(i.value)),o=!0;while(!i.done);return n}indexOf(e,r=0){let n=this.iterator(),i=0,o=n.next();for(;!o.done;){if(i>=r&&o.value===e)return i;o=n.next(),i++}return-1}every(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(!e(n.value))return!1;n=r.next()}return!0}some(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return!0;n=r.next()}return!1}forEach(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;)e(i.value,n),i=r.next(),n++}map(e){return new t(this.startFn,r=>{let{done:n,value:i}=this.nextFn(r);return n?zt:{done:!1,value:e(i)}})}filter(e){return new t(this.startFn,r=>{let n;do if(n=this.nextFn(r),!n.done&&e(n.value))return n;while(!n.done);return zt})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,r){let n=this.iterator(),i=r,o=n.next();for(;!o.done;)i===void 0?i=o.value:i=e(i,o.value),o=n.next();return i}reduceRight(e,r){return this.recursiveReduce(this.iterator(),e,r)}recursiveReduce(e,r,n){let i=e.next();if(i.done)return n;let o=this.recursiveReduce(e,r,n);return o===void 0?i.value:r(o,i.value)}find(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return n.value;n=r.next()}}findIndex(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;){if(e(i.value))return n;i=r.next(),n++}return-1}includes(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(n.value===e)return!0;n=r.next()}return!1}flatMap(e){return new t(()=>({this:this.startFn()}),r=>{do{if(r.iterator){let o=r.iterator.next();if(o.done)r.iterator=void 0;else return o}let{done:n,value:i}=this.nextFn(r.this);if(!n){let o=e(i);if(Zu(o))r.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}}while(r.iterator);return zt})}flat(e){if(e===void 0&&(e=1),e<=0)return this;let r=e>1?this.flat(e-1):this;return new t(()=>({this:r.startFn()}),n=>{do{if(n.iterator){let s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}let{done:i,value:o}=r.nextFn(n.this);if(!i)if(Zu(o))n.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}while(n.iterator);return zt})}head(){let r=this.iterator().next();if(!r.done)return r.value}tail(e=1){return new t(()=>{let r=this.startFn();for(let n=0;n<e;n++)if(this.nextFn(r).done)return r;return r},this.nextFn)}limit(e){return new t(()=>({size:0,state:this.startFn()}),r=>(r.size++,r.size>e?zt:this.nextFn(r.state)))}distinct(e){return new t(()=>({set:new Set,internalState:this.startFn()}),r=>{let n;do if(n=this.nextFn(r.internalState),!n.done){let i=e?e(n.value):n.value;if(!r.set.has(i))return r.set.add(i),n}while(!n.done);return zt})}exclude(e,r){let n=new Set;for(let i of e){let o=r?r(i):i;n.add(o)}return this.filter(i=>{let o=r?r(i):i;return!n.has(o)})}};function aw(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function Zu(t){return!!t&&typeof t[Symbol.iterator]=="function"}var Wa=new Rr(()=>{},()=>zt),zt=Object.freeze({done:!0,value:void 0});function ce(...t){if(t.length===1){let e=t[0];if(e instanceof Rr)return e;if(Zu(e))return new Rr(()=>e[Symbol.iterator](),r=>r.next());if(typeof e.length=="number")return new Rr(()=>({index:0}),r=>r.index<e.length?{done:!1,value:e[r.index++]}:zt)}return t.length>1?new Rr(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){let r=e.iterator.next();if(!r.done)return r;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){let r=t[e.collIndex++];Zu(r)?e.iterator=r[Symbol.iterator]():r&&typeof r.length=="number"&&(e.array=r)}}while(e.iterator||e.array||e.collIndex<t.length);return zt}):Wa}var rn=class extends Rr{constructor(e,r,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[r(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let s=i.iterators[i.iterators.length-1].next();if(s.done)i.iterators.pop();else return i.iterators.push(r(s.value)[Symbol.iterator]()),s}return zt})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}},ko;(function(t){function e(o){return o.reduce((s,a)=>s+a,0)}t.sum=e;function r(o){return o.reduce((s,a)=>s*a,0)}t.product=r;function n(o){return o.reduce((s,a)=>Math.min(s,a))}t.min=n;function i(o){return o.reduce((s,a)=>Math.max(s,a))}t.max=i})(ko||(ko={}));function Li(t){return new rn(t,e=>zr(e)?e.content:[],{includeRoot:!0})}function qh(t){return Li(t).filter(Xn)}function jh(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Eo(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Mi(t){if(!t)return;let{offset:e,end:r,range:n}=t;return{range:n,offset:e,end:r,length:r-e}}var nn;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside",t[t.Outside=5]="Outside"})(nn||(nn={}));function ov(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return nn.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return nn.After;let r=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,n=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return r&&n?nn.Inside:r?nn.OverlapBack:n?nn.OverlapFront:nn.Outside}function Uh(t,e){return ov(t,e)>nn.After}var el=/^[\w\p{L}]$/u;function cr(t,e,r=el){if(t){if(e>0){let n=e-t.offset,i=t.text.charAt(n);r.test(i)||e--}return Wh(t,e)}}function Ba(t,e){if(t){let r=av(t,!0);if(r&&$h(r,e))return r;if(Ua(t)){let n=t.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let o=t.content[i];if($h(o,e))return o}}}}function $h(t,e){return Xn(t)&&e.includes(t.tokenType.name)}function Wh(t,e){if(Xn(t))return t;if(zr(t)){let r=sv(t,e,!1);if(r)return Wh(r,e)}}function Ha(t,e){if(Xn(t))return t;if(zr(t)){let r=sv(t,e,!0);if(r)return Ha(r,e)}}function sv(t,e,r){let n=0,i=t.content.length-1,o;for(;n<=i;){let s=Math.floor((n+i)/2),a=t.content[s];if(a.offset<=e&&a.end>e)return a;a.end<=e?(o=r?a:void 0,n=s+1):i=s-1}return o}function av(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t);for(;n>0;){n--;let i=r.content[n];if(e||!i.hidden)return i}t=r}}function cw(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t),i=r.content.length-1;for(;n<i;){n++;let o=r.content[n];if(e||!o.hidden)return o}t=r}}function uw(t){if(t.range.start.character===0)return t;let e=t.range.start.line,r=t,n;for(;t.container;){let i=t.container,o=n??i.content.indexOf(t);if(o===0?(t=i,n=void 0):(n=o-1,t=i.content[n]),t.range.start.line!==e)break;r=t}return r}function lw(t,e){let r=dw(t,e);return r?r.parent.content.slice(r.a+1,r.b):[]}function dw(t,e){let r=iv(t),n=iv(e),i;for(let o=0;o<r.length&&o<n.length;o++){let s=r[o],a=n[o];if(s.parent===a.parent)i={parent:s.parent,a:s.index,b:a.index};else break}return i}function iv(t){let e=[];for(;t.container;){let r=t.container,n=r.content.indexOf(t);e.push({parent:r,index:n}),t=r}return e.reverse()}var fl={};Kn(fl,{findAssignment:()=>Rp,findNameAssignment:()=>dl,findNodeForKeyword:()=>xp,findNodeForProperty:()=>cc,findNodesForKeyword:()=>Dw,findNodesForKeywordInternal:()=>Tp,findNodesForProperty:()=>yp,getActionAtElement:()=>gv,getActionType:()=>vv,getAllReachableRules:()=>sc,getAllRulesUsedForCrossReferences:()=>Iw,getCrossReferenceTerminal:()=>ac,getEntryRule:()=>oc,getExplicitRuleType:()=>an,getHiddenRules:()=>hv,getRuleType:()=>_p,getRuleTypeName:()=>Mw,getTypeName:()=>zi,isArrayCardinality:()=>bp,isArrayOperator:()=>Ow,isCommentTerminal:()=>gp,isDataType:()=>Lw,isDataTypeRule:()=>uc,isOptionalCardinality:()=>Gi,terminalRegex:()=>Jn});var Fi=class extends Error{constructor(e,r){super(e?`${r} at ${e.range.start.line}:${e.range.start.character}`:r)}};function on(t){throw new Error("Error! The input value was not handled.")}var ji={};Kn(ji,{AbstractElement:()=>No,AbstractRule:()=>Ao,AbstractType:()=>wo,Action:()=>Xo,Alternatives:()=>Yo,ArrayLiteral:()=>Po,ArrayType:()=>Io,Assignment:()=>Jo,BooleanLiteral:()=>Do,CharacterRange:()=>Qo,Condition:()=>Ga,Conjunction:()=>Oo,CrossReference:()=>Zo,Disjunction:()=>Lo,EndOfFile:()=>es,Grammar:()=>Mo,GrammarImport:()=>Va,Group:()=>ts,InferredType:()=>Fo,Interface:()=>$o,Keyword:()=>rs,LangiumGrammarAstReflection:()=>fs,LangiumGrammarTerminals:()=>fw,NamedArgument:()=>Ka,NegatedToken:()=>ns,Negation:()=>qo,NumberLiteral:()=>jo,Parameter:()=>Uo,ParameterReference:()=>Wo,ParserRule:()=>Bo,ReferenceType:()=>Ho,RegexToken:()=>is,ReturnType:()=>Xa,RuleCall:()=>os,SimpleType:()=>Go,StringLiteral:()=>zo,TerminalAlternatives:()=>ss,TerminalGroup:()=>as,TerminalRule:()=>$i,TerminalRuleCall:()=>cs,Type:()=>Vo,TypeAttribute:()=>Ya,TypeDefinition:()=>rl,UnionType:()=>Ko,UnorderedGroup:()=>us,UntilToken:()=>ls,ValueLiteral:()=>za,Wildcard:()=>ds,isAbstractElement:()=>qi,isAbstractRule:()=>hw,isAbstractType:()=>pw,isAction:()=>Vr,isAlternatives:()=>hs,isArrayLiteral:()=>xw,isArrayType:()=>Bh,isAssignment:()=>Vt,isBooleanLiteral:()=>Hh,isCharacterRange:()=>Qh,isCondition:()=>mw,isConjunction:()=>Gh,isCrossReference:()=>br,isDisjunction:()=>zh,isEndOfFile:()=>Zh,isFeatureName:()=>gw,isGrammar:()=>Tw,isGrammarImport:()=>Rw,isGroup:()=>Pr,isInferredType:()=>Ja,isInterface:()=>nl,isKeyword:()=>Et,isNamedArgument:()=>bw,isNegatedToken:()=>ep,isNegation:()=>Vh,isNumberLiteral:()=>_w,isParameter:()=>Cw,isParameterReference:()=>Kh,isParserRule:()=>Ye,isPrimitiveType:()=>cv,isReferenceType:()=>Xh,isRegexToken:()=>tp,isReturnType:()=>Yh,isRuleCall:()=>ur,isSimpleType:()=>il,isStringLiteral:()=>Sw,isTerminalAlternatives:()=>rp,isTerminalGroup:()=>np,isTerminalRule:()=>er,isTerminalRuleCall:()=>ol,isType:()=>Qa,isTypeAttribute:()=>kw,isTypeDefinition:()=>yw,isUnionType:()=>Jh,isUnorderedGroup:()=>ps,isUntilToken:()=>ip,isValueLiteral:()=>vw,isWildcard:()=>op,reflection:()=>ne});var fw={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},Ao="AbstractRule";function hw(t){return ne.isInstance(t,Ao)}var wo="AbstractType";function pw(t){return ne.isInstance(t,wo)}var Ga="Condition";function mw(t){return ne.isInstance(t,Ga)}function gw(t){return cv(t)||t==="current"||t==="entry"||t==="extends"||t==="false"||t==="fragment"||t==="grammar"||t==="hidden"||t==="import"||t==="interface"||t==="returns"||t==="terminal"||t==="true"||t==="type"||t==="infer"||t==="infers"||t==="with"||typeof t=="string"&&/\^?[_a-zA-Z][\w_]*/.test(t)}function cv(t){return t==="string"||t==="number"||t==="boolean"||t==="Date"||t==="bigint"}var rl="TypeDefinition";function yw(t){return ne.isInstance(t,rl)}var za="ValueLiteral";function vw(t){return ne.isInstance(t,za)}var No="AbstractElement";function qi(t){return ne.isInstance(t,No)}var Po="ArrayLiteral";function xw(t){return ne.isInstance(t,Po)}var Io="ArrayType";function Bh(t){return ne.isInstance(t,Io)}var Do="BooleanLiteral";function Hh(t){return ne.isInstance(t,Do)}var Oo="Conjunction";function Gh(t){return ne.isInstance(t,Oo)}var Lo="Disjunction";function zh(t){return ne.isInstance(t,Lo)}var Mo="Grammar";function Tw(t){return ne.isInstance(t,Mo)}var Va="GrammarImport";function Rw(t){return ne.isInstance(t,Va)}var Fo="InferredType";function Ja(t){return ne.isInstance(t,Fo)}var $o="Interface";function nl(t){return ne.isInstance(t,$o)}var Ka="NamedArgument";function bw(t){return ne.isInstance(t,Ka)}var qo="Negation";function Vh(t){return ne.isInstance(t,qo)}var jo="NumberLiteral";function _w(t){return ne.isInstance(t,jo)}var Uo="Parameter";function Cw(t){return ne.isInstance(t,Uo)}var Wo="ParameterReference";function Kh(t){return ne.isInstance(t,Wo)}var Bo="ParserRule";function Ye(t){return ne.isInstance(t,Bo)}var Ho="ReferenceType";function Xh(t){return ne.isInstance(t,Ho)}var Xa="ReturnType";function Yh(t){return ne.isInstance(t,Xa)}var Go="SimpleType";function il(t){return ne.isInstance(t,Go)}var zo="StringLiteral";function Sw(t){return ne.isInstance(t,zo)}var $i="TerminalRule";function er(t){return ne.isInstance(t,$i)}var Vo="Type";function Qa(t){return ne.isInstance(t,Vo)}var Ya="TypeAttribute";function kw(t){return ne.isInstance(t,Ya)}var Ko="UnionType";function Jh(t){return ne.isInstance(t,Ko)}var Xo="Action";function Vr(t){return ne.isInstance(t,Xo)}var Yo="Alternatives";function hs(t){return ne.isInstance(t,Yo)}var Jo="Assignment";function Vt(t){return ne.isInstance(t,Jo)}var Qo="CharacterRange";function Qh(t){return ne.isInstance(t,Qo)}var Zo="CrossReference";function br(t){return ne.isInstance(t,Zo)}var es="EndOfFile";function Zh(t){return ne.isInstance(t,es)}var ts="Group";function Pr(t){return ne.isInstance(t,ts)}var rs="Keyword";function Et(t){return ne.isInstance(t,rs)}var ns="NegatedToken";function ep(t){return ne.isInstance(t,ns)}var is="RegexToken";function tp(t){return ne.isInstance(t,is)}var os="RuleCall";function ur(t){return ne.isInstance(t,os)}var ss="TerminalAlternatives";function rp(t){return ne.isInstance(t,ss)}var as="TerminalGroup";function np(t){return ne.isInstance(t,as)}var cs="TerminalRuleCall";function ol(t){return ne.isInstance(t,cs)}var us="UnorderedGroup";function ps(t){return ne.isInstance(t,us)}var ls="UntilToken";function ip(t){return ne.isInstance(t,ls)}var ds="Wildcard";function op(t){return ne.isInstance(t,ds)}var fs=class extends Di{getAllTypes(){return[No,Ao,wo,Xo,Yo,Po,Io,Jo,Do,Qo,Ga,Oo,Zo,Lo,es,Mo,Va,ts,Fo,$o,rs,Ka,ns,qo,jo,Uo,Wo,Bo,Ho,is,Xa,os,Go,zo,ss,as,$i,cs,Vo,Ya,rl,Ko,us,ls,za,ds]}computeIsSubtype(e,r){switch(e){case Xo:case Yo:case Jo:case Qo:case Zo:case es:case ts:case rs:case ns:case is:case os:case ss:case as:case cs:case us:case ls:case ds:return this.isSubtype(No,r);case Po:case jo:case zo:return this.isSubtype(za,r);case Io:case Ho:case Go:case Ko:return this.isSubtype(rl,r);case Do:return this.isSubtype(Ga,r)||this.isSubtype(za,r);case Oo:case Lo:case qo:case Wo:return this.isSubtype(Ga,r);case Fo:case $o:case Vo:return this.isSubtype(wo,r);case Bo:return this.isSubtype(Ao,r)||this.isSubtype(wo,r);case $i:return this.isSubtype(Ao,r);default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;switch(r){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return wo;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Ao;case"Grammar:usedGrammars":return Mo;case"NamedArgument:parameter":case"ParameterReference:parameter":return Uo;case"TerminalRuleCall:rule":return $i;default:throw new Error(`${r} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case No:return{name:No,properties:[{name:"cardinality"},{name:"lookahead"}]};case Po:return{name:Po,properties:[{name:"elements",defaultValue:[]}]};case Io:return{name:Io,properties:[{name:"elementType"}]};case Do:return{name:Do,properties:[{name:"true",defaultValue:!1}]};case Oo:return{name:Oo,properties:[{name:"left"},{name:"right"}]};case Lo:return{name:Lo,properties:[{name:"left"},{name:"right"}]};case Mo:return{name:Mo,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 Va:return{name:Va,properties:[{name:"path"}]};case Fo:return{name:Fo,properties:[{name:"name"}]};case $o:return{name:$o,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case Ka:return{name:Ka,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case qo:return{name:qo,properties:[{name:"value"}]};case jo:return{name:jo,properties:[{name:"value"}]};case Uo:return{name:Uo,properties:[{name:"name"}]};case Wo:return{name:Wo,properties:[{name:"parameter"}]};case Bo:return{name:Bo,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 Ho:return{name:Ho,properties:[{name:"referenceType"}]};case Xa:return{name:Xa,properties:[{name:"name"}]};case Go:return{name:Go,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case zo:return{name:zo,properties:[{name:"value"}]};case $i:return{name:$i,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case Vo:return{name:Vo,properties:[{name:"name"},{name:"type"}]};case Ya:return{name:Ya,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case Ko:return{name:Ko,properties:[{name:"types",defaultValue:[]}]};case Xo:return{name:Xo,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case Yo:return{name:Yo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Jo:return{name:Jo,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case Qo:return{name:Qo,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case Zo:return{name:Zo,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case es:return{name:es,properties:[{name:"cardinality"},{name:"lookahead"}]};case ts:return{name:ts,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case rs:return{name:rs,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case ns:return{name:ns,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case is:return{name:is,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case os:return{name:os,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case ss:return{name:ss,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case as:return{name:as,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case cs:return{name:cs,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case us:return{name:us,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case ls:return{name:ls,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case ds:return{name:ds,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}},ne=new fs;var al={};Kn(al,{assignMandatoryProperties:()=>ec,copyAstNode:()=>ap,findLocalReferences:()=>Aw,findRootNode:()=>Za,getContainerOfType:()=>_r,getDocument:()=>Rt,hasContainerOfType:()=>Ew,linkContentToContainer:()=>sl,streamAllContents:()=>Cr,streamAst:()=>Ir,streamContents:()=>Ui,streamReferences:()=>ms});function sl(t){for(let[e,r]of Object.entries(t))e.startsWith("$")||(Array.isArray(r)?r.forEach((n,i)=>{Ge(n)&&(n.$container=t,n.$containerProperty=e,n.$containerIndex=i)}):Ge(r)&&(r.$container=t,r.$containerProperty=e))}function _r(t,e){let r=t;for(;r;){if(e(r))return r;r=r.$container}}function Ew(t,e){let r=t;for(;r;){if(e(r))return!0;r=r.$container}return!1}function Rt(t){let r=Za(t).$document;if(!r)throw new Error("AST node has no document.");return r}function Za(t){for(;t.$container;)t=t.$container;return t}function Ui(t,e){if(!t)throw new Error("Node must be an AstNode.");let r=e?.range;return new Rr(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndex<n.keys.length;){let i=n.keys[n.keyIndex];if(!i.startsWith("$")){let o=t[i];if(Ge(o)){if(n.keyIndex++,sp(o,r))return{done:!1,value:o}}else if(Array.isArray(o)){for(;n.arrayIndex<o.length;){let s=n.arrayIndex++,a=o[s];if(Ge(a)&&sp(a,r))return{done:!1,value:a}}n.arrayIndex=0}}n.keyIndex++}return zt})}function Cr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new rn(t,r=>Ui(r,e))}function Ir(t,e){if(t){if(e?.range&&!sp(t,e.range))return new rn(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new rn(t,r=>Ui(r,e),{includeRoot:!0})}function sp(t,e){var r;if(!e)return!0;let n=(r=t.$cstNode)===null||r===void 0?void 0:r.range;return n?Uh(n,e):!1}function ms(t){return new Rr(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){let r=e.keys[e.keyIndex];if(!r.startsWith("$")){let n=t[r];if(Ut(n))return e.keyIndex++,{done:!1,value:{reference:n,container:t,property:r}};if(Array.isArray(n)){for(;e.arrayIndex<n.length;){let i=e.arrayIndex++,o=n[i];if(Ut(o))return{done:!1,value:{reference:o,container:t,property:r,index:i}}}e.arrayIndex=0}}e.keyIndex++}return zt})}function Aw(t,e=Rt(t).parseResult.value){let r=[];return Ir(e).forEach(n=>{ms(n).forEach(i=>{i.reference.ref===t&&r.push(i.reference)})}),ce(r)}function ec(t,e){let r=t.getTypeMetaData(e.$type),n=e;for(let i of r.properties)i.defaultValue!==void 0&&n[i.name]===void 0&&(n[i.name]=uv(i.defaultValue))}function uv(t){return Array.isArray(t)?[...t.map(uv)]:t}function ap(t,e){let r={$type:t.$type};for(let[n,i]of Object.entries(t))if(!n.startsWith("$"))if(Ge(i))r[n]=ap(i,e);else if(Ut(i))r[n]=e(r,n,i.$refNode,i.$refText);else if(Array.isArray(i)){let o=[];for(let s of i)Ge(s)?o.push(ap(s,e)):Ut(s)?o.push(e(r,n,s.$refNode,s.$refText)):o.push(s);r[n]=o}else r[n]=i;return sl(r),r}var ll={};Kn(ll,{NEWLINE_REGEXP:()=>dp,escapeRegExp:()=>Yn,getTerminalParts:()=>Pw,isMultilineComment:()=>fp,isWhitespace:()=>ic,partialMatches:()=>hp,partialRegExp:()=>fv,whitespaceCharacters:()=>dv});function ee(t){return t.charCodeAt(0)}function cl(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function gs(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function Wi(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function tc(){throw Error("Internal Error - Should never get here!")}function cp(t){return t.type==="Character"}var rc=[];for(let t=ee("0");t<=ee("9");t++)rc.push(t);var nc=[ee("_")].concat(rc);for(let t=ee("a");t<=ee("z");t++)nc.push(t);for(let t=ee("A");t<=ee("Z");t++)nc.push(t);var up=[ee(" "),ee("\f"),ee(`
37
+ `),ee("\r"),ee(" "),ee("\v"),ee(" "),ee("\xA0"),ee("\u1680"),ee("\u2000"),ee("\u2001"),ee("\u2002"),ee("\u2003"),ee("\u2004"),ee("\u2005"),ee("\u2006"),ee("\u2007"),ee("\u2008"),ee("\u2009"),ee("\u200A"),ee("\u2028"),ee("\u2029"),ee("\u202F"),ee("\u205F"),ee("\u3000"),ee("\uFEFF")];var ww=/[0-9a-fA-F]/,ul=/[0-9]/,Nw=/[1-9]/,Bi=class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let r=this.disjunction();this.consumeChar("/");let n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":gs(n,"global");break;case"i":gs(n,"ignoreCase");break;case"m":gs(n,"multiLine");break;case"u":gs(n,"unicode");break;case"y":gs(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:r,loc:this.loc(0)}}disjunction(){let e=[],r=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(r)}}alternative(){let e=[],r=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(r)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break}Wi(r);let n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return tc()}quantifier(e=!1){let r,n=this.idx;switch(this.popChar()){case"*":r={atLeast:0,atMost:1/0};break;case"+":r={atLeast:1,atMost:1/0};break;case"?":r={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:i,atMost:i};break;case",":let o;this.isDigit()?(o=this.integerIncludingZero(),r={atLeast:i,atMost:o}):r={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;Wi(r);break}if(!(e===!0&&r===void 0)&&Wi(r))return this.peekChar(0)==="?"?(this.consumeChar("?"),r.greedy=!1):r.greedy=!0,r.type="Quantifier",r.loc=this.loc(n),r}atom(){let e,r=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Wi(e)?(e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):tc()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[ee(`
38
38
  `),ee("\r"),ee("\u2028"),ee("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,r=!1;switch(this.popChar()){case"d":e=rc;break;case"D":e=rc,r=!0;break;case"s":e=up;break;case"S":e=up,r=!0;break;case"w":e=nc;break;case"W":e=nc,r=!0;break}return Wi(e)?{type:"Set",value:e,complement:r}:tc()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=ee("\f");break;case"n":e=ee(`
39
39
  `);break;case"r":e=ee("\r");break;case"t":e=ee(" ");break;case"v":e=ee("\v");break}return Wi(e)?{type:"Character",value:e}:tc()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:ee("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:ee(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
40
40
  `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:ee(e)}}}characterClass(){let e=[],r=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),r=!0);this.isClassAtom();){let n=this.classAtom(),i=n.type==="Character";if(cp(n)&&this.isRangeDash()){this.consumeChar("-");let o=this.classAtom(),s=o.type==="Character";if(cp(o)){if(o.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:o.value})}else cl(n.value,e),e.push(ee("-")),cl(o.value,e)}else cl(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:r,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
41
- `:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:ee("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}let r=this.disjunction();this.consumeChar(")");let n={type:"Group",capturing:e,value:r};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(ww.test(e)===!1)throw Error("Expecting a positive integer");for(;ul.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(ul.test(e)===!1)throw Error("Expecting an integer");for(;ul.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
41
+ `:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:ee("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}let r=this.disjunction();this.consumeChar(")");let n={type:"Group",capturing:e,value:r};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(Nw.test(e)===!1)throw Error("Expecting a positive integer");for(;ul.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(ul.test(e)===!1)throw Error("Expecting an integer");for(;ul.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
42
42
  `:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:ee(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return ul.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
43
43
  `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
44
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let r="";for(let i=0;i<e;i++){let o=this.popChar();if(Aw.test(o)===!1)throw Error("Expecting a HexDecimal digits");r+=o}return{type:"Character",value:parseInt(r,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}};var sn=class{visitChildren(e){for(let r in e){let n=e[r];e.hasOwnProperty(r)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}};var dp=/\r?\n/gm,lv=new Bi,lp=class extends sn{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 r=String.fromCharCode(e.value);if(!this.multiline&&r===`
44
+ `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let r="";for(let i=0;i<e;i++){let o=this.popChar();if(ww.test(o)===!1)throw Error("Expecting a HexDecimal digits");r+=o}return{type:"Character",value:parseInt(r,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}};var sn=class{visitChildren(e){for(let r in e){let n=e[r];e.hasOwnProperty(r)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}};var dp=/\r?\n/gm,lv=new Bi,lp=class extends sn{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 r=String.fromCharCode(e.value);if(!this.multiline&&r===`
45
45
  `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let n=Yn(r);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitSet(e){if(!this.multiline){let r=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(r);this.multiline=!!`
46
- `.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let r=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},Hi=new lp;function Nw(t){try{typeof t!="string"&&(t=t.source),t=`/${t}/`;let e=lv.pattern(t),r=[];for(let n of e.value.value)Hi.reset(t),Hi.visit(n),r.push({start:Hi.startRegexp,end:Hi.endRegex});return r}catch{return[]}}function fp(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Hi.reset(t),Hi.visit(lv.pattern(t)),Hi.multiline}catch{return!1}}var dv=`\f
47
- \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function ic(t){let e=typeof t=="string"?new RegExp(t):t;return dv.some(r=>e.test(r))}function Yn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hp(t,e){let r=fv(t),n=e.match(r);return!!n&&n[0].length>0}function fv(t){typeof t=="string"&&(t=new RegExp(t));let e=t,r=t.source,n=0;function i(){let o="",s;function a(u){o+=r.substr(n,u),n+=u}function c(u){o+="(?:"+r.substr(n,u)+"|$)",n+=u}for(;n<r.length;)switch(r[n]){case"\\":switch(r[n+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?r[n+2]==="{"?c(r.indexOf("}",n)-n+1):c(6):c(2);break;case"p":case"P":e.unicode?c(r.indexOf("}",n)-n+1):c(2);break;case"k":c(r.indexOf(">",n)-n+1);break;default:c(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=n,s=s.exec(r)||[],c(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=n,s=s.exec(r),s?a(s[0].length):c(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":o+="(?:",n+=3,o+=i()+"|$)";break;case"=":o+="(?=",n+=3,o+=i()+")";break;case"!":s=n,n+=3,i(),o+=r.substr(s,n-s);break;case"<":switch(r[n+3]){case"=":case"!":s=n,n+=4,i(),o+=r.substr(s,n-s);break;default:a(r.indexOf(">",n)-n+1),o+=i()+"|$)";break}break}else a(1),o+=i()+"|$)";break;case")":return++n,o;default:c(1);break}return o}return new RegExp(i(),t.flags)}function oc(t){return t.rules.find(e=>Ye(e)&&e.entry)}function hv(t){return t.rules.filter(e=>er(e)&&e.hidden)}function sc(t,e){let r=new Set,n=oc(t);if(!n)return new Set(t.rules);let i=[n].concat(hv(t));for(let s of i)pv(s,r,e);let o=new Set;for(let s of t.rules)(r.has(s.name)||er(s)&&s.hidden)&&o.add(s);return o}function pv(t,e,r){e.add(t.name),Cr(t).forEach(n=>{if(ur(n)||r&&ol(n)){let i=n.rule.ref;i&&!e.has(i.name)&&pv(i,e,r)}})}function Pw(t){let e=new Set;return Cr(t).forEach(r=>{br(r)&&(Ye(r.type.ref)&&e.add(r.type.ref),Ja(r.type.ref)&&Ye(r.type.ref.$container)&&e.add(r.type.ref.$container))}),e}function ac(t){if(t.terminal)return t.terminal;if(t.type.ref){let e=dl(t.type.ref);return e?.terminal}}function gp(t){return t.hidden&&!ic(Jn(t))}function yp(t,e){return!t||!e?[]:vp(t,e,t.astNode,!0)}function cc(t,e,r){if(!t||!e)return;let n=vp(t,e,t.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function vp(t,e,r,n){if(!n){let i=_r(t.grammarSource,Vt);if(i&&i.feature===e)return[t]}return zr(t)&&t.astNode===r?t.content.flatMap(i=>vp(i,e,r,!1)):[]}function Iw(t,e){return t?Tp(t,e,t?.astNode):[]}function xp(t,e,r){if(!t)return;let n=Tp(t,e,t?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function Tp(t,e,r){if(t.astNode!==r)return[];if(Et(t.grammarSource)&&t.grammarSource.value===e)return[t];let n=Li(t).iterator(),i,o=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?Et(s.grammarSource)&&s.grammarSource.value===e&&o.push(s):n.prune()}while(!i.done);return o}function Rp(t){var e;let r=t.astNode;for(;r===((e=t.container)===null||e===void 0?void 0:e.astNode);){let n=_r(t.grammarSource,Vt);if(n)return n;t=t.container}}function dl(t){let e=t;return Ja(e)&&(Vr(e.$container)?e=e.$container.$container:Ye(e.$container)?e=e.$container:on(e.$container)),mv(t,e,new Map)}function mv(t,e,r){var n;function i(o,s){let a;return _r(o,Vt)||(a=mv(s,s,r)),r.set(t,a),a}if(r.has(t))return r.get(t);r.set(t,void 0);for(let o of Cr(e)){if(Vt(o)&&o.feature.toLowerCase()==="name")return r.set(t,o),o;if(ur(o)&&Ye(o.rule.ref))return i(o,o.rule.ref);if(il(o)&&(!((n=o.typeRef)===null||n===void 0)&&n.ref))return i(o,o.typeRef.ref)}}function gv(t){let e=t.$container;if(Pr(e)){let r=e.elements,n=r.indexOf(t);for(let i=n-1;i>=0;i--){let o=r[i];if(Vr(o))return o;{let s=Cr(r[i]).find(Vr);if(s)return s}}}if(qi(e))return gv(e)}function Gi(t,e){return t==="?"||t==="*"||Pr(e)&&!!e.guardCondition}function bp(t){return t==="*"||t==="+"}function Dw(t){return t==="+="}function uc(t){return yv(t,new Set)}function yv(t,e){if(e.has(t))return!0;e.add(t);for(let r of Cr(t))if(ur(r)){if(!r.rule.ref||Ye(r.rule.ref)&&!yv(r.rule.ref,e))return!1}else{if(Vt(r))return!1;if(Vr(r))return!1}return!!t.definition}function Ow(t){return mp(t.type,new Set)}function mp(t,e){if(e.has(t))return!0;if(e.add(t),Bh(t))return!1;if(Xh(t))return!1;if(Jh(t))return t.types.every(r=>mp(r,e));if(il(t)){if(t.primitiveType!==void 0)return!0;if(t.stringType!==void 0)return!0;if(t.typeRef!==void 0){let r=t.typeRef.ref;return Qa(r)?mp(r.type,e):!1}else return!1}else return!1}function an(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){let e=t.returnType.ref;if(e){if(Ye(e))return e.name;if(nl(e)||Qa(e))return e.name}}}function zi(t){var e;if(Ye(t))return uc(t)?t.name:(e=an(t))!==null&&e!==void 0?e:t.name;if(nl(t)||Qa(t)||Yh(t))return t.name;if(Vr(t)){let r=vv(t);if(r)return r}else if(Ja(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function vv(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return zi(t.type.ref)}function Lw(t){var e,r,n;return er(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":uc(t)?t.name:(n=an(t))!==null&&n!==void 0?n:t.name}function _p(t){var e,r,n;return er(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":(n=an(t))!==null&&n!==void 0?n:t.name}function Jn(t){let e={s:!1,i:!1,u:!1},r=ys(t.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(r,n)}var Cp=/[\s\S]/.source;function ys(t,e){if(rp(t))return Mw(t);if(np(t))return Fw(t);if(Qh(t))return jw(t);if(ol(t)){let r=t.rule.ref;if(!r)throw new Error("Missing rule reference.");return Nn(ys(r.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(ep(t))return qw(t);if(ip(t))return $w(t);if(tp(t)){let r=t.regex.lastIndexOf("/"),n=t.regex.substring(1,r),i=t.regex.substring(r+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),Nn(n,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(op(t))return Nn(Cp,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function Mw(t){return Nn(t.elements.map(e=>ys(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function Fw(t){return Nn(t.elements.map(e=>ys(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function $w(t){return Nn(`${Cp}*?${ys(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function qw(t){return Nn(`(?!${ys(t.terminal)})${Cp}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function jw(t){return t.right?Nn(`[${pp(t.left)}-${pp(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):Nn(pp(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function pp(t){return Yn(t.value)}function Nn(t,e){var r;return(e.wrap!==!1||e.lookahead)&&(t=`(${(r=e.lookahead)!==null&&r!==void 0?r:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}function Sp(t){let e=[],r=t.Grammar;for(let n of r.rules)er(n)&&gp(n)&&fp(Jn(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:el}}var Uw=typeof global=="object"&&global&&global.Object===Object&&global,hl=Uw;var Ww=typeof self=="object"&&self&&self.Object===Object&&self,Bw=hl||Ww||Function("return this")(),bt=Bw;var Hw=bt.Symbol,Dt=Hw;var xv=Object.prototype,Gw=xv.hasOwnProperty,zw=xv.toString,lc=Dt?Dt.toStringTag:void 0;function Vw(t){var e=Gw.call(t,lc),r=t[lc];try{t[lc]=void 0;var n=!0}catch{}var i=zw.call(t);return n&&(e?t[lc]=r:delete t[lc]),i}var Tv=Vw;var Kw=Object.prototype,Xw=Kw.toString;function Yw(t){return Xw.call(t)}var Rv=Yw;var Jw="[object Null]",Qw="[object Undefined]",bv=Dt?Dt.toStringTag:void 0;function Zw(t){return t==null?t===void 0?Qw:Jw:bv&&bv in Object(t)?Tv(t):Rv(t)}var tr=Zw;function eN(t){return t!=null&&typeof t=="object"}var mt=eN;var tN="[object Symbol]";function rN(t){return typeof t=="symbol"||mt(t)&&tr(t)==tN}var cn=rN;function nN(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var un=nN;var iN=Array.isArray,X=iN;var oN=1/0,_v=Dt?Dt.prototype:void 0,Cv=_v?_v.toString:void 0;function Sv(t){if(typeof t=="string")return t;if(X(t))return un(t,Sv)+"";if(cn(t))return Cv?Cv.call(t):"";var e=t+"";return e=="0"&&1/t==-oN?"-0":e}var kv=Sv;var sN=/\s/;function aN(t){for(var e=t.length;e--&&sN.test(t.charAt(e)););return e}var Ev=aN;var cN=/^\s+/;function uN(t){return t&&t.slice(0,Ev(t)+1).replace(cN,"")}var Av=uN;function lN(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var rt=lN;var wv=NaN,dN=/^[-+]0x[0-9a-f]+$/i,fN=/^0b[01]+$/i,hN=/^0o[0-7]+$/i,pN=parseInt;function mN(t){if(typeof t=="number")return t;if(cn(t))return wv;if(rt(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=rt(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Av(t);var r=fN.test(t);return r||hN.test(t)?pN(t.slice(2),r?2:8):dN.test(t)?wv:+t}var Nv=mN;var Pv=1/0,gN=17976931348623157e292;function yN(t){if(!t)return t===0?t:0;if(t=Nv(t),t===Pv||t===-Pv){var e=t<0?-1:1;return e*gN}return t===t?t:0}var Iv=yN;function vN(t){var e=Iv(t),r=e%1;return e===e?r?e-r:e:0}var ln=vN;function xN(t){return t}var lr=xN;var TN="[object AsyncFunction]",RN="[object Function]",bN="[object GeneratorFunction]",_N="[object Proxy]";function CN(t){if(!rt(t))return!1;var e=tr(t);return e==RN||e==bN||e==TN||e==_N}var rr=CN;var SN=bt["__core-js_shared__"],pl=SN;var Dv=(function(){var t=/[^.]+$/.exec(pl&&pl.keys&&pl.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function kN(t){return!!Dv&&Dv in t}var Ov=kN;var EN=Function.prototype,AN=EN.toString;function wN(t){if(t!=null){try{return AN.call(t)}catch{}try{return t+""}catch{}}return""}var Pn=wN;var NN=/[\\^$.*+?()[\]{}|]/g,PN=/^\[object .+?Constructor\]$/,IN=Function.prototype,DN=Object.prototype,ON=IN.toString,LN=DN.hasOwnProperty,MN=RegExp("^"+ON.call(LN).replace(NN,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function FN(t){if(!rt(t)||Ov(t))return!1;var e=rr(t)?MN:PN;return e.test(Pn(t))}var Lv=FN;function $N(t,e){return t?.[e]}var Mv=$N;function qN(t,e){var r=Mv(t,e);return Lv(r)?r:void 0}var dr=qN;var jN=dr(bt,"WeakMap"),ml=jN;var Fv=Object.create,UN=(function(){function t(){}return function(e){if(!rt(e))return{};if(Fv)return Fv(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),$v=UN;function WN(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var qv=WN;function BN(){}var nt=BN;function HN(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var jv=HN;var GN=800,zN=16,VN=Date.now;function KN(t){var e=0,r=0;return function(){var n=VN(),i=zN-(n-r);if(r=n,i>0){if(++e>=GN)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Uv=KN;function XN(t){return function(){return t}}var Wv=XN;var YN=(function(){try{var t=dr(Object,"defineProperty");return t({},"",{}),t}catch{}})(),vs=YN;var JN=vs?function(t,e){return vs(t,"toString",{configurable:!0,enumerable:!1,value:Wv(e),writable:!0})}:lr,Bv=JN;var QN=Uv(Bv),Hv=QN;function ZN(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var gl=ZN;function eP(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}var yl=eP;function tP(t){return t!==t}var Gv=tP;function rP(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var zv=rP;function nP(t,e,r){return e===e?zv(t,e,r):yl(t,Gv,r)}var xs=nP;function iP(t,e){var r=t==null?0:t.length;return!!r&&xs(t,e,0)>-1}var vl=iP;var oP=9007199254740991,sP=/^(?:0|[1-9]\d*)$/;function aP(t,e){var r=typeof t;return e=e??oP,!!e&&(r=="number"||r!="symbol"&&sP.test(t))&&t>-1&&t%1==0&&t<e}var Qn=aP;function cP(t,e,r){e=="__proto__"&&vs?vs(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Ts=cP;function uP(t,e){return t===e||t!==t&&e!==e}var dn=uP;var lP=Object.prototype,dP=lP.hasOwnProperty;function fP(t,e,r){var n=t[e];(!(dP.call(t,e)&&dn(n,r))||r===void 0&&!(e in t))&&Ts(t,e,r)}var Zn=fP;function hP(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;c===void 0&&(c=t[a]),i?Ts(r,a,c):Zn(r,a,c)}return r}var fn=hP;var Vv=Math.max;function pP(t,e,r){return e=Vv(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=Vv(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),qv(t,this,a)}}var Kv=pP;function mP(t,e){return Hv(Kv(t,e,lr),t+"")}var Rs=mP;var gP=9007199254740991;function yP(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=gP}var bs=yP;function vP(t){return t!=null&&bs(t.length)&&!rr(t)}var _t=vP;function xP(t,e,r){if(!rt(r))return!1;var n=typeof e;return(n=="number"?_t(r)&&Qn(e,r.length):n=="string"&&e in r)?dn(r[e],t):!1}var ei=xP;function TP(t){return Rs(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&ei(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,o)}return e})}var Xv=TP;var RP=Object.prototype;function bP(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||RP;return t===r}var hn=bP;function _P(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Yv=_P;var CP="[object Arguments]";function SP(t){return mt(t)&&tr(t)==CP}var kp=SP;var Jv=Object.prototype,kP=Jv.hasOwnProperty,EP=Jv.propertyIsEnumerable,AP=kp((function(){return arguments})())?kp:function(t){return mt(t)&&kP.call(t,"callee")&&!EP.call(t,"callee")},ti=AP;function wP(){return!1}var Qv=wP;var tx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zv=tx&&typeof module=="object"&&module&&!module.nodeType&&module,NP=Zv&&Zv.exports===tx,ex=NP?bt.Buffer:void 0,PP=ex?ex.isBuffer:void 0,IP=PP||Qv,In=IP;var DP="[object Arguments]",OP="[object Array]",LP="[object Boolean]",MP="[object Date]",FP="[object Error]",$P="[object Function]",qP="[object Map]",jP="[object Number]",UP="[object Object]",WP="[object RegExp]",BP="[object Set]",HP="[object String]",GP="[object WeakMap]",zP="[object ArrayBuffer]",VP="[object DataView]",KP="[object Float32Array]",XP="[object Float64Array]",YP="[object Int8Array]",JP="[object Int16Array]",QP="[object Int32Array]",ZP="[object Uint8Array]",eI="[object Uint8ClampedArray]",tI="[object Uint16Array]",rI="[object Uint32Array]",ze={};ze[KP]=ze[XP]=ze[YP]=ze[JP]=ze[QP]=ze[ZP]=ze[eI]=ze[tI]=ze[rI]=!0;ze[DP]=ze[OP]=ze[zP]=ze[LP]=ze[VP]=ze[MP]=ze[FP]=ze[$P]=ze[qP]=ze[jP]=ze[UP]=ze[WP]=ze[BP]=ze[HP]=ze[GP]=!1;function nI(t){return mt(t)&&bs(t.length)&&!!ze[tr(t)]}var rx=nI;function iI(t){return function(e){return t(e)}}var pn=iI;var nx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,dc=nx&&typeof module=="object"&&module&&!module.nodeType&&module,oI=dc&&dc.exports===nx,Ep=oI&&hl.process,sI=(function(){try{var t=dc&&dc.require&&dc.require("util").types;return t||Ep&&Ep.binding&&Ep.binding("util")}catch{}})(),Dr=sI;var ix=Dr&&Dr.isTypedArray,aI=ix?pn(ix):rx,_s=aI;var cI=Object.prototype,uI=cI.hasOwnProperty;function lI(t,e){var r=X(t),n=!r&&ti(t),i=!r&&!n&&In(t),o=!r&&!n&&!i&&_s(t),s=r||n||i||o,a=s?Yv(t.length,String):[],c=a.length;for(var u in t)(e||uI.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Qn(u,c)))&&a.push(u);return a}var xl=lI;function dI(t,e){return function(r){return t(e(r))}}var Tl=dI;var fI=Tl(Object.keys,Object),ox=fI;var hI=Object.prototype,pI=hI.hasOwnProperty;function mI(t){if(!hn(t))return ox(t);var e=[];for(var r in Object(t))pI.call(t,r)&&r!="constructor"&&e.push(r);return e}var Rl=mI;function gI(t){return _t(t)?xl(t):Rl(t)}var Fe=gI;var yI=Object.prototype,vI=yI.hasOwnProperty,xI=Xv(function(t,e){if(hn(e)||_t(e)){fn(e,Fe(e),t);return}for(var r in e)vI.call(e,r)&&Zn(t,r,e[r])}),Wt=xI;function TI(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var sx=TI;var RI=Object.prototype,bI=RI.hasOwnProperty;function _I(t){if(!rt(t))return sx(t);var e=hn(t),r=[];for(var n in t)n=="constructor"&&(e||!bI.call(t,n))||r.push(n);return r}var ax=_I;function CI(t){return _t(t)?xl(t,!0):ax(t)}var ri=CI;var SI=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kI=/^\w*$/;function EI(t,e){if(X(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||cn(t)?!0:kI.test(t)||!SI.test(t)||e!=null&&t in Object(e)}var Cs=EI;var AI=dr(Object,"create"),Dn=AI;function wI(){this.__data__=Dn?Dn(null):{},this.size=0}var cx=wI;function NI(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ux=NI;var PI="__lodash_hash_undefined__",II=Object.prototype,DI=II.hasOwnProperty;function OI(t){var e=this.__data__;if(Dn){var r=e[t];return r===PI?void 0:r}return DI.call(e,t)?e[t]:void 0}var lx=OI;var LI=Object.prototype,MI=LI.hasOwnProperty;function FI(t){var e=this.__data__;return Dn?e[t]!==void 0:MI.call(e,t)}var dx=FI;var $I="__lodash_hash_undefined__";function qI(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Dn&&e===void 0?$I:e,this}var fx=qI;function Ss(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ss.prototype.clear=cx;Ss.prototype.delete=ux;Ss.prototype.get=lx;Ss.prototype.has=dx;Ss.prototype.set=fx;var Ap=Ss;function jI(){this.__data__=[],this.size=0}var hx=jI;function UI(t,e){for(var r=t.length;r--;)if(dn(t[r][0],e))return r;return-1}var ni=UI;var WI=Array.prototype,BI=WI.splice;function HI(t){var e=this.__data__,r=ni(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():BI.call(e,r,1),--this.size,!0}var px=HI;function GI(t){var e=this.__data__,r=ni(e,t);return r<0?void 0:e[r][1]}var mx=GI;function zI(t){return ni(this.__data__,t)>-1}var gx=zI;function VI(t,e){var r=this.__data__,n=ni(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var yx=VI;function ks(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ks.prototype.clear=hx;ks.prototype.delete=px;ks.prototype.get=mx;ks.prototype.has=gx;ks.prototype.set=yx;var ii=ks;var KI=dr(bt,"Map"),oi=KI;function XI(){this.size=0,this.__data__={hash:new Ap,map:new(oi||ii),string:new Ap}}var vx=XI;function YI(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var xx=YI;function JI(t,e){var r=t.__data__;return xx(e)?r[typeof e=="string"?"string":"hash"]:r.map}var si=JI;function QI(t){var e=si(this,t).delete(t);return this.size-=e?1:0,e}var Tx=QI;function ZI(t){return si(this,t).get(t)}var Rx=ZI;function eD(t){return si(this,t).has(t)}var bx=eD;function tD(t,e){var r=si(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var _x=tD;function Es(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Es.prototype.clear=vx;Es.prototype.delete=Tx;Es.prototype.get=Rx;Es.prototype.has=bx;Es.prototype.set=_x;var Vi=Es;var rD="Expected a function";function wp(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(rD);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(wp.Cache||Vi),r}wp.Cache=Vi;var Cx=wp;var nD=500;function iD(t){var e=Cx(t,function(n){return r.size===nD&&r.clear(),n}),r=e.cache;return e}var Sx=iD;var oD=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,sD=/\\(\\)?/g,aD=Sx(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(oD,function(r,n,i,o){e.push(i?o.replace(sD,"$1"):n||r)}),e}),kx=aD;function cD(t){return t==null?"":kv(t)}var Ex=cD;function uD(t,e){return X(t)?t:Cs(t,e)?[t]:kx(Ex(t))}var ai=uD;var lD=1/0;function dD(t){if(typeof t=="string"||cn(t))return t;var e=t+"";return e=="0"&&1/t==-lD?"-0":e}var mn=dD;function fD(t,e){e=ai(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[mn(e[r++])];return r&&r==n?t:void 0}var As=fD;function hD(t,e,r){var n=t==null?void 0:As(t,e);return n===void 0?r:n}var Ax=hD;function pD(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var ws=pD;var wx=Dt?Dt.isConcatSpreadable:void 0;function mD(t){return X(t)||ti(t)||!!(wx&&t&&t[wx])}var Nx=mD;function Px(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=Nx),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?Px(a,e-1,r,n,i):ws(i,a):n||(i[i.length]=a)}return i}var Ns=Px;function gD(t){var e=t==null?0:t.length;return e?Ns(t,1):[]}var gt=gD;var yD=Tl(Object.getPrototypeOf,Object),bl=yD;function vD(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}var _l=vD;function xD(t,e,r,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}var Ix=xD;function TD(){this.__data__=new ii,this.size=0}var Dx=TD;function RD(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Ox=RD;function bD(t){return this.__data__.get(t)}var Lx=bD;function _D(t){return this.__data__.has(t)}var Mx=_D;var CD=200;function SD(t,e){var r=this.__data__;if(r instanceof ii){var n=r.__data__;if(!oi||n.length<CD-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Vi(n)}return r.set(t,e),this.size=r.size,this}var Fx=SD;function Ps(t){var e=this.__data__=new ii(t);this.size=e.size}Ps.prototype.clear=Dx;Ps.prototype.delete=Ox;Ps.prototype.get=Lx;Ps.prototype.has=Mx;Ps.prototype.set=Fx;var ci=Ps;function kD(t,e){return t&&fn(e,Fe(e),t)}var $x=kD;function ED(t,e){return t&&fn(e,ri(e),t)}var qx=ED;var Bx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,jx=Bx&&typeof module=="object"&&module&&!module.nodeType&&module,AD=jx&&jx.exports===Bx,Ux=AD?bt.Buffer:void 0,Wx=Ux?Ux.allocUnsafe:void 0;function wD(t,e){if(e)return t.slice();var r=t.length,n=Wx?Wx(r):new t.constructor(r);return t.copy(n),n}var Hx=wD;function ND(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}var Is=ND;function PD(){return[]}var Cl=PD;var ID=Object.prototype,DD=ID.propertyIsEnumerable,Gx=Object.getOwnPropertySymbols,OD=Gx?function(t){return t==null?[]:(t=Object(t),Is(Gx(t),function(e){return DD.call(t,e)}))}:Cl,Ds=OD;function LD(t,e){return fn(t,Ds(t),e)}var zx=LD;var MD=Object.getOwnPropertySymbols,FD=MD?function(t){for(var e=[];t;)ws(e,Ds(t)),t=bl(t);return e}:Cl,Sl=FD;function $D(t,e){return fn(t,Sl(t),e)}var Vx=$D;function qD(t,e,r){var n=e(t);return X(t)?n:ws(n,r(t))}var kl=qD;function jD(t){return kl(t,Fe,Ds)}var fc=jD;function UD(t){return kl(t,ri,Sl)}var El=UD;var WD=dr(bt,"DataView"),Al=WD;var BD=dr(bt,"Promise"),wl=BD;var HD=dr(bt,"Set"),ui=HD;var Kx="[object Map]",GD="[object Object]",Xx="[object Promise]",Yx="[object Set]",Jx="[object WeakMap]",Qx="[object DataView]",zD=Pn(Al),VD=Pn(oi),KD=Pn(wl),XD=Pn(ui),YD=Pn(ml),Ki=tr;(Al&&Ki(new Al(new ArrayBuffer(1)))!=Qx||oi&&Ki(new oi)!=Kx||wl&&Ki(wl.resolve())!=Xx||ui&&Ki(new ui)!=Yx||ml&&Ki(new ml)!=Jx)&&(Ki=function(t){var e=tr(t),r=e==GD?t.constructor:void 0,n=r?Pn(r):"";if(n)switch(n){case zD:return Qx;case VD:return Kx;case KD:return Xx;case XD:return Yx;case YD:return Jx}return e});var Kr=Ki;var JD=Object.prototype,QD=JD.hasOwnProperty;function ZD(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&QD.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Zx=ZD;var eO=bt.Uint8Array,Os=eO;function tO(t){var e=new t.constructor(t.byteLength);return new Os(e).set(new Os(t)),e}var Ls=tO;function rO(t,e){var r=e?Ls(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var eT=rO;var nO=/\w*$/;function iO(t){var e=new t.constructor(t.source,nO.exec(t));return e.lastIndex=t.lastIndex,e}var tT=iO;var rT=Dt?Dt.prototype:void 0,nT=rT?rT.valueOf:void 0;function oO(t){return nT?Object(nT.call(t)):{}}var iT=oO;function sO(t,e){var r=e?Ls(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var oT=sO;var aO="[object Boolean]",cO="[object Date]",uO="[object Map]",lO="[object Number]",dO="[object RegExp]",fO="[object Set]",hO="[object String]",pO="[object Symbol]",mO="[object ArrayBuffer]",gO="[object DataView]",yO="[object Float32Array]",vO="[object Float64Array]",xO="[object Int8Array]",TO="[object Int16Array]",RO="[object Int32Array]",bO="[object Uint8Array]",_O="[object Uint8ClampedArray]",CO="[object Uint16Array]",SO="[object Uint32Array]";function kO(t,e,r){var n=t.constructor;switch(e){case mO:return Ls(t);case aO:case cO:return new n(+t);case gO:return eT(t,r);case yO:case vO:case xO:case TO:case RO:case bO:case _O:case CO:case SO:return oT(t,r);case uO:return new n;case lO:case hO:return new n(t);case dO:return tT(t);case fO:return new n;case pO:return iT(t)}}var sT=kO;function EO(t){return typeof t.constructor=="function"&&!hn(t)?$v(bl(t)):{}}var aT=EO;var AO="[object Map]";function wO(t){return mt(t)&&Kr(t)==AO}var cT=wO;var uT=Dr&&Dr.isMap,NO=uT?pn(uT):cT,lT=NO;var PO="[object Set]";function IO(t){return mt(t)&&Kr(t)==PO}var dT=IO;var fT=Dr&&Dr.isSet,DO=fT?pn(fT):dT,hT=DO;var OO=1,LO=2,MO=4,pT="[object Arguments]",FO="[object Array]",$O="[object Boolean]",qO="[object Date]",jO="[object Error]",mT="[object Function]",UO="[object GeneratorFunction]",WO="[object Map]",BO="[object Number]",gT="[object Object]",HO="[object RegExp]",GO="[object Set]",zO="[object String]",VO="[object Symbol]",KO="[object WeakMap]",XO="[object ArrayBuffer]",YO="[object DataView]",JO="[object Float32Array]",QO="[object Float64Array]",ZO="[object Int8Array]",e0="[object Int16Array]",t0="[object Int32Array]",r0="[object Uint8Array]",n0="[object Uint8ClampedArray]",i0="[object Uint16Array]",o0="[object Uint32Array]",$e={};$e[pT]=$e[FO]=$e[XO]=$e[YO]=$e[$O]=$e[qO]=$e[JO]=$e[QO]=$e[ZO]=$e[e0]=$e[t0]=$e[WO]=$e[BO]=$e[gT]=$e[HO]=$e[GO]=$e[zO]=$e[VO]=$e[r0]=$e[n0]=$e[i0]=$e[o0]=!0;$e[jO]=$e[mT]=$e[KO]=!1;function Nl(t,e,r,n,i,o){var s,a=e&OO,c=e&LO,u=e&MO;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!rt(t))return t;var l=X(t);if(l){if(s=Zx(t),!a)return jv(t,s)}else{var h=Kr(t),p=h==mT||h==UO;if(In(t))return Hx(t,a);if(h==gT||h==pT||p&&!i){if(s=c||p?{}:aT(t),!a)return c?Vx(t,qx(s,t)):zx(t,$x(s,t))}else{if(!$e[h])return i?t:{};s=sT(t,h,a)}}o||(o=new ci);var y=o.get(t);if(y)return y;o.set(t,s),hT(t)?t.forEach(function(D){s.add(Nl(D,e,r,D,t,o))}):lT(t)&&t.forEach(function(D,w){s.set(w,Nl(D,e,r,w,t,o))});var _=u?c?El:fc:c?ri:Fe,E=l?void 0:_(t);return gl(E||t,function(D,w){E&&(w=D,D=t[w]),Zn(s,w,Nl(D,e,r,w,t,o))}),s}var yT=Nl;var s0=4;function a0(t){return yT(t,s0)}var qe=a0;function c0(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i}var gn=c0;var u0="__lodash_hash_undefined__";function l0(t){return this.__data__.set(t,u0),this}var vT=l0;function d0(t){return this.__data__.has(t)}var xT=d0;function Pl(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Vi;++e<r;)this.add(t[e])}Pl.prototype.add=Pl.prototype.push=vT;Pl.prototype.has=xT;var Ms=Pl;function f0(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Il=f0;function h0(t,e){return t.has(e)}var Fs=h0;var p0=1,m0=2;function g0(t,e,r,n,i,o){var s=r&p0,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(t),l=o.get(e);if(u&&l)return u==e&&l==t;var h=-1,p=!0,y=r&m0?new Ms:void 0;for(o.set(t,e),o.set(e,t);++h<a;){var _=t[h],E=e[h];if(n)var D=s?n(E,_,h,e,t,o):n(_,E,h,t,e,o);if(D!==void 0){if(D)continue;p=!1;break}if(y){if(!Il(e,function(w,x){if(!Fs(y,x)&&(_===w||i(_,w,r,n,o)))return y.push(x)})){p=!1;break}}else if(!(_===E||i(_,E,r,n,o))){p=!1;break}}return o.delete(t),o.delete(e),p}var Dl=g0;function y0(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var TT=y0;function v0(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var $s=v0;var x0=1,T0=2,R0="[object Boolean]",b0="[object Date]",_0="[object Error]",C0="[object Map]",S0="[object Number]",k0="[object RegExp]",E0="[object Set]",A0="[object String]",w0="[object Symbol]",N0="[object ArrayBuffer]",P0="[object DataView]",RT=Dt?Dt.prototype:void 0,Np=RT?RT.valueOf:void 0;function I0(t,e,r,n,i,o,s){switch(r){case P0:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case N0:return!(t.byteLength!=e.byteLength||!o(new Os(t),new Os(e)));case R0:case b0:case S0:return dn(+t,+e);case _0:return t.name==e.name&&t.message==e.message;case k0:case A0:return t==e+"";case C0:var a=TT;case E0:var c=n&x0;if(a||(a=$s),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;n|=T0,s.set(t,e);var l=Dl(a(t),a(e),n,i,o,s);return s.delete(t),l;case w0:if(Np)return Np.call(t)==Np.call(e)}return!1}var bT=I0;var D0=1,O0=Object.prototype,L0=O0.hasOwnProperty;function M0(t,e,r,n,i,o){var s=r&D0,a=fc(t),c=a.length,u=fc(e),l=u.length;if(c!=l&&!s)return!1;for(var h=c;h--;){var p=a[h];if(!(s?p in e:L0.call(e,p)))return!1}var y=o.get(t),_=o.get(e);if(y&&_)return y==e&&_==t;var E=!0;o.set(t,e),o.set(e,t);for(var D=s;++h<c;){p=a[h];var w=t[p],x=e[p];if(n)var g=s?n(x,w,p,e,t,o):n(w,x,p,t,e,o);if(!(g===void 0?w===x||i(w,x,r,n,o):g)){E=!1;break}D||(D=p=="constructor")}if(E&&!D){var A=t.constructor,M=e.constructor;A!=M&&"constructor"in t&&"constructor"in e&&!(typeof A=="function"&&A instanceof A&&typeof M=="function"&&M instanceof M)&&(E=!1)}return o.delete(t),o.delete(e),E}var _T=M0;var F0=1,CT="[object Arguments]",ST="[object Array]",Ol="[object Object]",$0=Object.prototype,kT=$0.hasOwnProperty;function q0(t,e,r,n,i,o){var s=X(t),a=X(e),c=s?ST:Kr(t),u=a?ST:Kr(e);c=c==CT?Ol:c,u=u==CT?Ol:u;var l=c==Ol,h=u==Ol,p=c==u;if(p&&In(t)){if(!In(e))return!1;s=!0,l=!1}if(p&&!l)return o||(o=new ci),s||_s(t)?Dl(t,e,r,n,i,o):bT(t,e,c,r,n,i,o);if(!(r&F0)){var y=l&&kT.call(t,"__wrapped__"),_=h&&kT.call(e,"__wrapped__");if(y||_){var E=y?t.value():t,D=_?e.value():e;return o||(o=new ci),i(E,D,r,n,o)}}return p?(o||(o=new ci),_T(t,e,r,n,i,o)):!1}var ET=q0;function AT(t,e,r,n,i){return t===e?!0:t==null||e==null||!mt(t)&&!mt(e)?t!==t&&e!==e:ET(t,e,r,n,AT,i)}var Ll=AT;var j0=1,U0=2;function W0(t,e,r,n){var i=r.length,o=i,s=!n;if(t==null)return!o;for(t=Object(t);i--;){var a=r[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){a=r[i];var c=a[0],u=t[c],l=a[1];if(s&&a[2]){if(u===void 0&&!(c in t))return!1}else{var h=new ci;if(n)var p=n(u,l,c,t,e,h);if(!(p===void 0?Ll(l,u,j0|U0,n,h):p))return!1}}return!0}var wT=W0;function B0(t){return t===t&&!rt(t)}var Ml=B0;function H0(t){for(var e=Fe(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Ml(i)]}return e}var NT=H0;function G0(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Fl=G0;function z0(t){var e=NT(t);return e.length==1&&e[0][2]?Fl(e[0][0],e[0][1]):function(r){return r===t||wT(r,t,e)}}var PT=z0;function V0(t,e){return t!=null&&e in Object(t)}var IT=V0;function K0(t,e,r){e=ai(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=mn(e[n]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&bs(i)&&Qn(s,i)&&(X(t)||ti(t)))}var $l=K0;function X0(t,e){return t!=null&&$l(t,e,IT)}var DT=X0;var Y0=1,J0=2;function Q0(t,e){return Cs(t)&&Ml(e)?Fl(mn(t),e):function(r){var n=Ax(r,t);return n===void 0&&n===e?DT(r,t):Ll(e,n,Y0|J0)}}var OT=Q0;function Z0(t){return function(e){return e?.[t]}}var LT=Z0;function eL(t){return function(e){return As(e,t)}}var MT=eL;function tL(t){return Cs(t)?LT(mn(t)):MT(t)}var FT=tL;function rL(t){return typeof t=="function"?t:t==null?lr:typeof t=="object"?X(t)?OT(t[0],t[1]):PT(t):FT(t)}var lt=rL;function nL(t,e,r,n){for(var i=-1,o=t==null?0:t.length;++i<o;){var s=t[i];e(n,s,r(s),t)}return n}var $T=nL;function iL(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++i];if(r(o[c],c,o)===!1)break}return e}}var qT=iL;var oL=qT(),jT=oL;function sL(t,e){return t&&jT(t,e,Fe)}var UT=sL;function aL(t,e){return function(r,n){if(r==null)return r;if(!_t(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var WT=aL;var cL=WT(UT),fr=cL;function uL(t,e,r,n){return fr(t,function(i,o,s){e(n,i,r(i),s)}),n}var BT=uL;function lL(t,e){return function(r,n){var i=X(r)?$T:BT,o=e?e():{};return i(r,t,lt(n,2),o)}}var HT=lL;var GT=Object.prototype,dL=GT.hasOwnProperty,fL=Rs(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&ei(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],s=ri(o),a=-1,c=s.length;++a<c;){var u=s[a],l=t[u];(l===void 0||dn(l,GT[u])&&!dL.call(t,u))&&(t[u]=o[u])}return t}),qs=fL;function hL(t){return mt(t)&&_t(t)}var Pp=hL;function pL(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var ql=pL;var mL=200;function gL(t,e,r,n){var i=-1,o=vl,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;r&&(e=un(e,pn(r))),n?(o=ql,s=!1):e.length>=mL&&(o=Fs,s=!1,e=new Ms(e));e:for(;++i<a;){var l=t[i],h=r==null?l:r(l);if(l=n||l!==0?l:0,s&&h===h){for(var p=u;p--;)if(e[p]===h)continue e;c.push(l)}else o(e,h,n)||c.push(l)}return c}var zT=gL;var yL=Rs(function(t,e){return Pp(t)?zT(t,Ns(e,1,Pp,!0)):[]}),li=yL;function vL(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var yn=vL;function xL(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:ln(e),_l(t,e<0?0:e,n)):[]}var yt=xL;function TL(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:ln(e),e=n-e,_l(t,0,e<0?0:e)):[]}var On=TL;function RL(t){return typeof t=="function"?t:lr}var VT=RL;function bL(t,e){var r=X(t)?gl:fr;return r(t,VT(e))}var H=bL;function _L(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var KT=_L;function CL(t,e){var r=!0;return fr(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var XT=CL;function SL(t,e,r){var n=X(t)?KT:XT;return r&&ei(t,e,r)&&(e=void 0),n(t,lt(e,3))}var Kt=SL;function kL(t,e){var r=[];return fr(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var jl=kL;function EL(t,e){var r=X(t)?Is:jl;return r(t,lt(e,3))}var Ot=EL;function AL(t){return function(e,r,n){var i=Object(e);if(!_t(e)){var o=lt(r,3);e=Fe(e),r=function(a){return o(i[a],a,i)}}var s=t(e,r,n);return s>-1?i[o?e[s]:s]:void 0}}var YT=AL;var wL=Math.max;function NL(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:ln(r);return i<0&&(i=wL(n+i,0)),yl(t,lt(e,3),i)}var JT=NL;var PL=YT(JT),vn=PL;function IL(t){return t&&t.length?t[0]:void 0}var Lt=IL;function DL(t,e){var r=-1,n=_t(t)?Array(t.length):[];return fr(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var QT=DL;function OL(t,e){var r=X(t)?un:QT;return r(t,lt(e,3))}var j=OL;function LL(t,e){return Ns(j(t,e),1)}var Bt=LL;var ML=Object.prototype,FL=ML.hasOwnProperty,$L=HT(function(t,e,r){FL.call(t,r)?t[r].push(e):Ts(t,r,[e])}),Ip=$L;var qL=Object.prototype,jL=qL.hasOwnProperty;function UL(t,e){return t!=null&&jL.call(t,e)}var ZT=UL;function WL(t,e){return t!=null&&$l(t,e,ZT)}var V=WL;var BL="[object String]";function HL(t){return typeof t=="string"||!X(t)&&mt(t)&&tr(t)==BL}var At=HL;function GL(t,e){return un(e,function(r){return t[r]})}var eR=GL;function zL(t){return t==null?[]:eR(t,Fe(t))}var Pe=zL;var VL=Math.max;function KL(t,e,r,n){t=_t(t)?t:Pe(t),r=r&&!n?ln(r):0;var i=t.length;return r<0&&(r=VL(i+r,0)),At(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&xs(t,e,r)>-1}var Je=KL;var XL=Math.max;function YL(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:ln(r);return i<0&&(i=XL(n+i,0)),xs(t,e,i)}var Ul=YL;var JL="[object Map]",QL="[object Set]",ZL=Object.prototype,eM=ZL.hasOwnProperty;function tM(t){if(t==null)return!0;if(_t(t)&&(X(t)||typeof t=="string"||typeof t.splice=="function"||In(t)||_s(t)||ti(t)))return!t.length;var e=Kr(t);if(e==JL||e==QL)return!t.size;if(hn(t))return!Rl(t).length;for(var r in t)if(eM.call(t,r))return!1;return!0}var ae=tM;var rM="[object RegExp]";function nM(t){return mt(t)&&tr(t)==rM}var tR=nM;var rR=Dr&&Dr.isRegExp,iM=rR?pn(rR):tR,Or=iM;function oM(t){return t===void 0}var Xt=oM;function sM(t,e){return t<e}var nR=sM;function aM(t,e,r){for(var n=-1,i=t.length;++n<i;){var o=t[n],s=e(o);if(s!=null&&(a===void 0?s===s&&!cn(s):r(s,a)))var a=s,c=o}return c}var iR=aM;function cM(t){return t&&t.length?iR(t,lr,nR):void 0}var oR=cM;var uM="Expected a function";function lM(t){if(typeof t!="function")throw new TypeError(uM);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var sR=lM;function dM(t,e,r,n){if(!rt(t))return t;e=ai(e,t);for(var i=-1,o=e.length,s=o-1,a=t;a!=null&&++i<o;){var c=mn(e[i]),u=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var l=a[c];u=n?n(l,c,a):void 0,u===void 0&&(u=rt(l)?l:Qn(e[i+1])?[]:{})}Zn(a,c,u),a=a[c]}return t}var aR=dM;function fM(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var s=e[n],a=As(t,s);r(a,s)&&aR(o,ai(s,t),a)}return o}var cR=fM;function hM(t,e){if(t==null)return{};var r=un(El(t),function(n){return[n]});return e=lt(e),cR(t,r,function(n,i){return e(n,i[0])})}var hr=hM;function pM(t,e,r,n,i){return i(t,function(o,s,a){r=n?(n=!1,o):e(r,o,s,a)}),r}var uR=pM;function mM(t,e,r){var n=X(t)?Ix:uR,i=arguments.length<3;return n(t,lt(e,4),r,i,fr)}var it=mM;function gM(t,e){var r=X(t)?Is:jl;return r(t,sR(lt(e,3)))}var di=gM;function yM(t,e){var r;return fr(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var lR=yM;function vM(t,e,r){var n=X(t)?Il:lR;return r&&ei(t,e,r)&&(e=void 0),n(t,lt(e,3))}var hc=vM;var xM=1/0,TM=ui&&1/$s(new ui([,-0]))[1]==xM?function(t){return new ui(t)}:nt,dR=TM;var RM=200;function bM(t,e,r){var n=-1,i=vl,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=ql;else if(o>=RM){var u=e?null:dR(t);if(u)return $s(u);s=!1,i=Fs,c=new Ms}else c=e?[]:a;e:for(;++n<o;){var l=t[n],h=e?e(l):l;if(l=r||l!==0?l:0,s&&h===h){for(var p=c.length;p--;)if(c[p]===h)continue e;e&&c.push(h),a.push(l)}else i(c,h,r)||(c!==a&&c.push(h),a.push(l))}return a}var Wl=bM;function _M(t){return t&&t.length?Wl(t):[]}var js=_M;function CM(t,e){return t&&t.length?Wl(t,lt(e,2)):[]}var fR=CM;function Us(t){console&&console.error&&console.error(`Error: ${t}`)}function pc(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function mc(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function gc(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function SM(t){return kM(t)?t.LABEL:t.name}function kM(t){return At(t.LABEL)&&t.LABEL!==""}var Sr=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),H(this.definition,r=>{r.accept(e)})}},Ae=class extends Sr{constructor(e){super([]),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},nr=class extends Sr{constructor(e){super(e.definition),this.orgText="",Wt(this,hr(e,r=>r!==void 0))}},je=class extends Sr{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Wt(this,hr(e,r=>r!==void 0))}},we=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},Ue=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},We=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},pe=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},De=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},Oe=class extends Sr{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Wt(this,hr(e,r=>r!==void 0))}},ue=class{constructor(e){this.idx=1,Wt(this,hr(e,r=>r!==void 0))}accept(e){e.visit(this)}};function Bl(t){return j(t,Ws)}function Ws(t){function e(r){return j(r,Ws)}if(t instanceof Ae){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return At(t.label)&&(r.label=t.label),r}else{if(t instanceof je)return{type:"Alternative",definition:e(t.definition)};if(t instanceof we)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Ue)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof We)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Ws(new ue({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof De)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Ws(new ue({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof pe)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Oe)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof ue){let r={type:"Terminal",name:t.terminalType.name,label:SM(t.terminalType),idx:t.idx};At(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=Or(n)?n.source:n),r}else{if(t instanceof nr)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var ir=class{visit(e){let r=e;switch(r.constructor){case Ae:return this.visitNonTerminal(r);case je:return this.visitAlternative(r);case we:return this.visitOption(r);case Ue:return this.visitRepetitionMandatory(r);case We:return this.visitRepetitionMandatoryWithSeparator(r);case De:return this.visitRepetitionWithSeparator(r);case pe:return this.visitRepetition(r);case Oe:return this.visitAlternation(r);case ue:return this.visitTerminal(r);case nr:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function Dp(t){return t instanceof je||t instanceof we||t instanceof pe||t instanceof Ue||t instanceof We||t instanceof De||t instanceof ue||t instanceof nr}function Xi(t,e=[]){return t instanceof we||t instanceof pe||t instanceof De?!0:t instanceof Oe?hc(t.definition,n=>Xi(n,e)):t instanceof Ae&&Je(e,t)?!1:t instanceof Sr?(t instanceof Ae&&e.push(t),Kt(t.definition,n=>Xi(n,e))):!1}function Op(t){return t instanceof Oe}function pr(t){if(t instanceof Ae)return"SUBRULE";if(t instanceof we)return"OPTION";if(t instanceof Oe)return"OR";if(t instanceof Ue)return"AT_LEAST_ONE";if(t instanceof We)return"AT_LEAST_ONE_SEP";if(t instanceof De)return"MANY_SEP";if(t instanceof pe)return"MANY";if(t instanceof ue)return"CONSUME";throw Error("non exhaustive match")}var Ln=class{walk(e,r=[]){H(e.definition,(n,i)=>{let o=yt(e.definition,i+1);if(n instanceof Ae)this.walkProdRef(n,o,r);else if(n instanceof ue)this.walkTerminal(n,o,r);else if(n instanceof je)this.walkFlat(n,o,r);else if(n instanceof we)this.walkOption(n,o,r);else if(n instanceof Ue)this.walkAtLeastOne(n,o,r);else if(n instanceof We)this.walkAtLeastOneSep(n,o,r);else if(n instanceof De)this.walkManySep(n,o,r);else if(n instanceof pe)this.walkMany(n,o,r);else if(n instanceof Oe)this.walkOr(n,o,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new we({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=hR(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new we({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=hR(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);H(e.definition,o=>{let s=new je({definition:[o]});this.walk(s,i)})}};function hR(t,e,r){return[new we({definition:[new ue({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function Yi(t){if(t instanceof Ae)return Yi(t.referencedRule);if(t instanceof ue)return wM(t);if(Dp(t))return EM(t);if(Op(t))return AM(t);throw Error("non exhaustive match")}function EM(t){let e=[],r=t.definition,n=0,i=r.length>n,o,s=!0;for(;i&&s;)o=r[n],s=Xi(o),e=e.concat(Yi(o)),n=n+1,i=r.length>n;return js(e)}function AM(t){let e=j(t.definition,r=>Yi(r));return js(gt(e))}function wM(t){return[t.terminalType]}var Hl="_~IN~_";var Lp=class extends Ln{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=NM(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),s=new je({definition:o}),a=Yi(s);this.follows[i]=a}};function pR(t){let e={};return H(t,r=>{let n=new Lp(r).startWalking();Wt(e,n)}),e}function NM(t,e){return t.name+e+Hl}var Gl={},PM=new Bi;function Bs(t){let e=t.toString();if(Gl.hasOwnProperty(e))return Gl[e];{let r=PM.pattern(e);return Gl[e]=r,r}}function mR(){Gl={}}var yR="Complement Sets are not supported for first char optimization",yc=`Unable to use "first char" lexer optimizations:
46
+ `.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let r=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},Hi=new lp;function Pw(t){try{typeof t!="string"&&(t=t.source),t=`/${t}/`;let e=lv.pattern(t),r=[];for(let n of e.value.value)Hi.reset(t),Hi.visit(n),r.push({start:Hi.startRegexp,end:Hi.endRegex});return r}catch{return[]}}function fp(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Hi.reset(t),Hi.visit(lv.pattern(t)),Hi.multiline}catch{return!1}}var dv=`\f
47
+ \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function ic(t){let e=typeof t=="string"?new RegExp(t):t;return dv.some(r=>e.test(r))}function Yn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hp(t,e){let r=fv(t),n=e.match(r);return!!n&&n[0].length>0}function fv(t){typeof t=="string"&&(t=new RegExp(t));let e=t,r=t.source,n=0;function i(){let o="",s;function a(u){o+=r.substr(n,u),n+=u}function c(u){o+="(?:"+r.substr(n,u)+"|$)",n+=u}for(;n<r.length;)switch(r[n]){case"\\":switch(r[n+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?r[n+2]==="{"?c(r.indexOf("}",n)-n+1):c(6):c(2);break;case"p":case"P":e.unicode?c(r.indexOf("}",n)-n+1):c(2);break;case"k":c(r.indexOf(">",n)-n+1);break;default:c(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=n,s=s.exec(r)||[],c(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=n,s=s.exec(r),s?a(s[0].length):c(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":o+="(?:",n+=3,o+=i()+"|$)";break;case"=":o+="(?=",n+=3,o+=i()+")";break;case"!":s=n,n+=3,i(),o+=r.substr(s,n-s);break;case"<":switch(r[n+3]){case"=":case"!":s=n,n+=4,i(),o+=r.substr(s,n-s);break;default:a(r.indexOf(">",n)-n+1),o+=i()+"|$)";break}break}else a(1),o+=i()+"|$)";break;case")":return++n,o;default:c(1);break}return o}return new RegExp(i(),t.flags)}function oc(t){return t.rules.find(e=>Ye(e)&&e.entry)}function hv(t){return t.rules.filter(e=>er(e)&&e.hidden)}function sc(t,e){let r=new Set,n=oc(t);if(!n)return new Set(t.rules);let i=[n].concat(hv(t));for(let s of i)pv(s,r,e);let o=new Set;for(let s of t.rules)(r.has(s.name)||er(s)&&s.hidden)&&o.add(s);return o}function pv(t,e,r){e.add(t.name),Cr(t).forEach(n=>{if(ur(n)||r&&ol(n)){let i=n.rule.ref;i&&!e.has(i.name)&&pv(i,e,r)}})}function Iw(t){let e=new Set;return Cr(t).forEach(r=>{br(r)&&(Ye(r.type.ref)&&e.add(r.type.ref),Ja(r.type.ref)&&Ye(r.type.ref.$container)&&e.add(r.type.ref.$container))}),e}function ac(t){if(t.terminal)return t.terminal;if(t.type.ref){let e=dl(t.type.ref);return e?.terminal}}function gp(t){return t.hidden&&!ic(Jn(t))}function yp(t,e){return!t||!e?[]:vp(t,e,t.astNode,!0)}function cc(t,e,r){if(!t||!e)return;let n=vp(t,e,t.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function vp(t,e,r,n){if(!n){let i=_r(t.grammarSource,Vt);if(i&&i.feature===e)return[t]}return zr(t)&&t.astNode===r?t.content.flatMap(i=>vp(i,e,r,!1)):[]}function Dw(t,e){return t?Tp(t,e,t?.astNode):[]}function xp(t,e,r){if(!t)return;let n=Tp(t,e,t?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function Tp(t,e,r){if(t.astNode!==r)return[];if(Et(t.grammarSource)&&t.grammarSource.value===e)return[t];let n=Li(t).iterator(),i,o=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?Et(s.grammarSource)&&s.grammarSource.value===e&&o.push(s):n.prune()}while(!i.done);return o}function Rp(t){var e;let r=t.astNode;for(;r===((e=t.container)===null||e===void 0?void 0:e.astNode);){let n=_r(t.grammarSource,Vt);if(n)return n;t=t.container}}function dl(t){let e=t;return Ja(e)&&(Vr(e.$container)?e=e.$container.$container:Ye(e.$container)?e=e.$container:on(e.$container)),mv(t,e,new Map)}function mv(t,e,r){var n;function i(o,s){let a;return _r(o,Vt)||(a=mv(s,s,r)),r.set(t,a),a}if(r.has(t))return r.get(t);r.set(t,void 0);for(let o of Cr(e)){if(Vt(o)&&o.feature.toLowerCase()==="name")return r.set(t,o),o;if(ur(o)&&Ye(o.rule.ref))return i(o,o.rule.ref);if(il(o)&&(!((n=o.typeRef)===null||n===void 0)&&n.ref))return i(o,o.typeRef.ref)}}function gv(t){let e=t.$container;if(Pr(e)){let r=e.elements,n=r.indexOf(t);for(let i=n-1;i>=0;i--){let o=r[i];if(Vr(o))return o;{let s=Cr(r[i]).find(Vr);if(s)return s}}}if(qi(e))return gv(e)}function Gi(t,e){return t==="?"||t==="*"||Pr(e)&&!!e.guardCondition}function bp(t){return t==="*"||t==="+"}function Ow(t){return t==="+="}function uc(t){return yv(t,new Set)}function yv(t,e){if(e.has(t))return!0;e.add(t);for(let r of Cr(t))if(ur(r)){if(!r.rule.ref||Ye(r.rule.ref)&&!yv(r.rule.ref,e))return!1}else{if(Vt(r))return!1;if(Vr(r))return!1}return!!t.definition}function Lw(t){return mp(t.type,new Set)}function mp(t,e){if(e.has(t))return!0;if(e.add(t),Bh(t))return!1;if(Xh(t))return!1;if(Jh(t))return t.types.every(r=>mp(r,e));if(il(t)){if(t.primitiveType!==void 0)return!0;if(t.stringType!==void 0)return!0;if(t.typeRef!==void 0){let r=t.typeRef.ref;return Qa(r)?mp(r.type,e):!1}else return!1}else return!1}function an(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){let e=t.returnType.ref;if(e){if(Ye(e))return e.name;if(nl(e)||Qa(e))return e.name}}}function zi(t){var e;if(Ye(t))return uc(t)?t.name:(e=an(t))!==null&&e!==void 0?e:t.name;if(nl(t)||Qa(t)||Yh(t))return t.name;if(Vr(t)){let r=vv(t);if(r)return r}else if(Ja(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function vv(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return zi(t.type.ref)}function Mw(t){var e,r,n;return er(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":uc(t)?t.name:(n=an(t))!==null&&n!==void 0?n:t.name}function _p(t){var e,r,n;return er(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":(n=an(t))!==null&&n!==void 0?n:t.name}function Jn(t){let e={s:!1,i:!1,u:!1},r=ys(t.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(r,n)}var Cp=/[\s\S]/.source;function ys(t,e){if(rp(t))return Fw(t);if(np(t))return $w(t);if(Qh(t))return Uw(t);if(ol(t)){let r=t.rule.ref;if(!r)throw new Error("Missing rule reference.");return Nn(ys(r.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(ep(t))return jw(t);if(ip(t))return qw(t);if(tp(t)){let r=t.regex.lastIndexOf("/"),n=t.regex.substring(1,r),i=t.regex.substring(r+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),Nn(n,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(op(t))return Nn(Cp,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function Fw(t){return Nn(t.elements.map(e=>ys(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function $w(t){return Nn(t.elements.map(e=>ys(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function qw(t){return Nn(`${Cp}*?${ys(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function jw(t){return Nn(`(?!${ys(t.terminal)})${Cp}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function Uw(t){return t.right?Nn(`[${pp(t.left)}-${pp(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):Nn(pp(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function pp(t){return Yn(t.value)}function Nn(t,e){var r;return(e.wrap!==!1||e.lookahead)&&(t=`(${(r=e.lookahead)!==null&&r!==void 0?r:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}function Sp(t){let e=[],r=t.Grammar;for(let n of r.rules)er(n)&&gp(n)&&fp(Jn(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:el}}var Ww=typeof global=="object"&&global&&global.Object===Object&&global,hl=Ww;var Bw=typeof self=="object"&&self&&self.Object===Object&&self,Hw=hl||Bw||Function("return this")(),bt=Hw;var Gw=bt.Symbol,Dt=Gw;var xv=Object.prototype,zw=xv.hasOwnProperty,Vw=xv.toString,lc=Dt?Dt.toStringTag:void 0;function Kw(t){var e=zw.call(t,lc),r=t[lc];try{t[lc]=void 0;var n=!0}catch{}var i=Vw.call(t);return n&&(e?t[lc]=r:delete t[lc]),i}var Tv=Kw;var Xw=Object.prototype,Yw=Xw.toString;function Jw(t){return Yw.call(t)}var Rv=Jw;var Qw="[object Null]",Zw="[object Undefined]",bv=Dt?Dt.toStringTag:void 0;function eN(t){return t==null?t===void 0?Zw:Qw:bv&&bv in Object(t)?Tv(t):Rv(t)}var tr=eN;function tN(t){return t!=null&&typeof t=="object"}var mt=tN;var rN="[object Symbol]";function nN(t){return typeof t=="symbol"||mt(t)&&tr(t)==rN}var cn=nN;function iN(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var un=iN;var oN=Array.isArray,X=oN;var sN=1/0,_v=Dt?Dt.prototype:void 0,Cv=_v?_v.toString:void 0;function Sv(t){if(typeof t=="string")return t;if(X(t))return un(t,Sv)+"";if(cn(t))return Cv?Cv.call(t):"";var e=t+"";return e=="0"&&1/t==-sN?"-0":e}var kv=Sv;var aN=/\s/;function cN(t){for(var e=t.length;e--&&aN.test(t.charAt(e)););return e}var Ev=cN;var uN=/^\s+/;function lN(t){return t&&t.slice(0,Ev(t)+1).replace(uN,"")}var Av=lN;function dN(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var rt=dN;var wv=NaN,fN=/^[-+]0x[0-9a-f]+$/i,hN=/^0b[01]+$/i,pN=/^0o[0-7]+$/i,mN=parseInt;function gN(t){if(typeof t=="number")return t;if(cn(t))return wv;if(rt(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=rt(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Av(t);var r=hN.test(t);return r||pN.test(t)?mN(t.slice(2),r?2:8):fN.test(t)?wv:+t}var Nv=gN;var Pv=1/0,yN=17976931348623157e292;function vN(t){if(!t)return t===0?t:0;if(t=Nv(t),t===Pv||t===-Pv){var e=t<0?-1:1;return e*yN}return t===t?t:0}var Iv=vN;function xN(t){var e=Iv(t),r=e%1;return e===e?r?e-r:e:0}var ln=xN;function TN(t){return t}var lr=TN;var RN="[object AsyncFunction]",bN="[object Function]",_N="[object GeneratorFunction]",CN="[object Proxy]";function SN(t){if(!rt(t))return!1;var e=tr(t);return e==bN||e==_N||e==RN||e==CN}var rr=SN;var kN=bt["__core-js_shared__"],pl=kN;var Dv=(function(){var t=/[^.]+$/.exec(pl&&pl.keys&&pl.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function EN(t){return!!Dv&&Dv in t}var Ov=EN;var AN=Function.prototype,wN=AN.toString;function NN(t){if(t!=null){try{return wN.call(t)}catch{}try{return t+""}catch{}}return""}var Pn=NN;var PN=/[\\^$.*+?()[\]{}|]/g,IN=/^\[object .+?Constructor\]$/,DN=Function.prototype,ON=Object.prototype,LN=DN.toString,MN=ON.hasOwnProperty,FN=RegExp("^"+LN.call(MN).replace(PN,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function $N(t){if(!rt(t)||Ov(t))return!1;var e=rr(t)?FN:IN;return e.test(Pn(t))}var Lv=$N;function qN(t,e){return t?.[e]}var Mv=qN;function jN(t,e){var r=Mv(t,e);return Lv(r)?r:void 0}var dr=jN;var UN=dr(bt,"WeakMap"),ml=UN;var Fv=Object.create,WN=(function(){function t(){}return function(e){if(!rt(e))return{};if(Fv)return Fv(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),$v=WN;function BN(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var qv=BN;function HN(){}var nt=HN;function GN(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var jv=GN;var zN=800,VN=16,KN=Date.now;function XN(t){var e=0,r=0;return function(){var n=KN(),i=VN-(n-r);if(r=n,i>0){if(++e>=zN)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Uv=XN;function YN(t){return function(){return t}}var Wv=YN;var JN=(function(){try{var t=dr(Object,"defineProperty");return t({},"",{}),t}catch{}})(),vs=JN;var QN=vs?function(t,e){return vs(t,"toString",{configurable:!0,enumerable:!1,value:Wv(e),writable:!0})}:lr,Bv=QN;var ZN=Uv(Bv),Hv=ZN;function eP(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var gl=eP;function tP(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}var yl=tP;function rP(t){return t!==t}var Gv=rP;function nP(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var zv=nP;function iP(t,e,r){return e===e?zv(t,e,r):yl(t,Gv,r)}var xs=iP;function oP(t,e){var r=t==null?0:t.length;return!!r&&xs(t,e,0)>-1}var vl=oP;var sP=9007199254740991,aP=/^(?:0|[1-9]\d*)$/;function cP(t,e){var r=typeof t;return e=e??sP,!!e&&(r=="number"||r!="symbol"&&aP.test(t))&&t>-1&&t%1==0&&t<e}var Qn=cP;function uP(t,e,r){e=="__proto__"&&vs?vs(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Ts=uP;function lP(t,e){return t===e||t!==t&&e!==e}var dn=lP;var dP=Object.prototype,fP=dP.hasOwnProperty;function hP(t,e,r){var n=t[e];(!(fP.call(t,e)&&dn(n,r))||r===void 0&&!(e in t))&&Ts(t,e,r)}var Zn=hP;function pP(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;c===void 0&&(c=t[a]),i?Ts(r,a,c):Zn(r,a,c)}return r}var fn=pP;var Vv=Math.max;function mP(t,e,r){return e=Vv(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=Vv(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),qv(t,this,a)}}var Kv=mP;function gP(t,e){return Hv(Kv(t,e,lr),t+"")}var Rs=gP;var yP=9007199254740991;function vP(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=yP}var bs=vP;function xP(t){return t!=null&&bs(t.length)&&!rr(t)}var _t=xP;function TP(t,e,r){if(!rt(r))return!1;var n=typeof e;return(n=="number"?_t(r)&&Qn(e,r.length):n=="string"&&e in r)?dn(r[e],t):!1}var ei=TP;function RP(t){return Rs(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&ei(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,o)}return e})}var Xv=RP;var bP=Object.prototype;function _P(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||bP;return t===r}var hn=_P;function CP(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Yv=CP;var SP="[object Arguments]";function kP(t){return mt(t)&&tr(t)==SP}var kp=kP;var Jv=Object.prototype,EP=Jv.hasOwnProperty,AP=Jv.propertyIsEnumerable,wP=kp((function(){return arguments})())?kp:function(t){return mt(t)&&EP.call(t,"callee")&&!AP.call(t,"callee")},ti=wP;function NP(){return!1}var Qv=NP;var tx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zv=tx&&typeof module=="object"&&module&&!module.nodeType&&module,PP=Zv&&Zv.exports===tx,ex=PP?bt.Buffer:void 0,IP=ex?ex.isBuffer:void 0,DP=IP||Qv,In=DP;var OP="[object Arguments]",LP="[object Array]",MP="[object Boolean]",FP="[object Date]",$P="[object Error]",qP="[object Function]",jP="[object Map]",UP="[object Number]",WP="[object Object]",BP="[object RegExp]",HP="[object Set]",GP="[object String]",zP="[object WeakMap]",VP="[object ArrayBuffer]",KP="[object DataView]",XP="[object Float32Array]",YP="[object Float64Array]",JP="[object Int8Array]",QP="[object Int16Array]",ZP="[object Int32Array]",eI="[object Uint8Array]",tI="[object Uint8ClampedArray]",rI="[object Uint16Array]",nI="[object Uint32Array]",ze={};ze[XP]=ze[YP]=ze[JP]=ze[QP]=ze[ZP]=ze[eI]=ze[tI]=ze[rI]=ze[nI]=!0;ze[OP]=ze[LP]=ze[VP]=ze[MP]=ze[KP]=ze[FP]=ze[$P]=ze[qP]=ze[jP]=ze[UP]=ze[WP]=ze[BP]=ze[HP]=ze[GP]=ze[zP]=!1;function iI(t){return mt(t)&&bs(t.length)&&!!ze[tr(t)]}var rx=iI;function oI(t){return function(e){return t(e)}}var pn=oI;var nx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,dc=nx&&typeof module=="object"&&module&&!module.nodeType&&module,sI=dc&&dc.exports===nx,Ep=sI&&hl.process,aI=(function(){try{var t=dc&&dc.require&&dc.require("util").types;return t||Ep&&Ep.binding&&Ep.binding("util")}catch{}})(),Dr=aI;var ix=Dr&&Dr.isTypedArray,cI=ix?pn(ix):rx,_s=cI;var uI=Object.prototype,lI=uI.hasOwnProperty;function dI(t,e){var r=X(t),n=!r&&ti(t),i=!r&&!n&&In(t),o=!r&&!n&&!i&&_s(t),s=r||n||i||o,a=s?Yv(t.length,String):[],c=a.length;for(var u in t)(e||lI.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Qn(u,c)))&&a.push(u);return a}var xl=dI;function fI(t,e){return function(r){return t(e(r))}}var Tl=fI;var hI=Tl(Object.keys,Object),ox=hI;var pI=Object.prototype,mI=pI.hasOwnProperty;function gI(t){if(!hn(t))return ox(t);var e=[];for(var r in Object(t))mI.call(t,r)&&r!="constructor"&&e.push(r);return e}var Rl=gI;function yI(t){return _t(t)?xl(t):Rl(t)}var Fe=yI;var vI=Object.prototype,xI=vI.hasOwnProperty,TI=Xv(function(t,e){if(hn(e)||_t(e)){fn(e,Fe(e),t);return}for(var r in e)xI.call(e,r)&&Zn(t,r,e[r])}),Wt=TI;function RI(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var sx=RI;var bI=Object.prototype,_I=bI.hasOwnProperty;function CI(t){if(!rt(t))return sx(t);var e=hn(t),r=[];for(var n in t)n=="constructor"&&(e||!_I.call(t,n))||r.push(n);return r}var ax=CI;function SI(t){return _t(t)?xl(t,!0):ax(t)}var ri=SI;var kI=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,EI=/^\w*$/;function AI(t,e){if(X(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||cn(t)?!0:EI.test(t)||!kI.test(t)||e!=null&&t in Object(e)}var Cs=AI;var wI=dr(Object,"create"),Dn=wI;function NI(){this.__data__=Dn?Dn(null):{},this.size=0}var cx=NI;function PI(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ux=PI;var II="__lodash_hash_undefined__",DI=Object.prototype,OI=DI.hasOwnProperty;function LI(t){var e=this.__data__;if(Dn){var r=e[t];return r===II?void 0:r}return OI.call(e,t)?e[t]:void 0}var lx=LI;var MI=Object.prototype,FI=MI.hasOwnProperty;function $I(t){var e=this.__data__;return Dn?e[t]!==void 0:FI.call(e,t)}var dx=$I;var qI="__lodash_hash_undefined__";function jI(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Dn&&e===void 0?qI:e,this}var fx=jI;function Ss(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ss.prototype.clear=cx;Ss.prototype.delete=ux;Ss.prototype.get=lx;Ss.prototype.has=dx;Ss.prototype.set=fx;var Ap=Ss;function UI(){this.__data__=[],this.size=0}var hx=UI;function WI(t,e){for(var r=t.length;r--;)if(dn(t[r][0],e))return r;return-1}var ni=WI;var BI=Array.prototype,HI=BI.splice;function GI(t){var e=this.__data__,r=ni(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():HI.call(e,r,1),--this.size,!0}var px=GI;function zI(t){var e=this.__data__,r=ni(e,t);return r<0?void 0:e[r][1]}var mx=zI;function VI(t){return ni(this.__data__,t)>-1}var gx=VI;function KI(t,e){var r=this.__data__,n=ni(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var yx=KI;function ks(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ks.prototype.clear=hx;ks.prototype.delete=px;ks.prototype.get=mx;ks.prototype.has=gx;ks.prototype.set=yx;var ii=ks;var XI=dr(bt,"Map"),oi=XI;function YI(){this.size=0,this.__data__={hash:new Ap,map:new(oi||ii),string:new Ap}}var vx=YI;function JI(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var xx=JI;function QI(t,e){var r=t.__data__;return xx(e)?r[typeof e=="string"?"string":"hash"]:r.map}var si=QI;function ZI(t){var e=si(this,t).delete(t);return this.size-=e?1:0,e}var Tx=ZI;function eD(t){return si(this,t).get(t)}var Rx=eD;function tD(t){return si(this,t).has(t)}var bx=tD;function rD(t,e){var r=si(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var _x=rD;function Es(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Es.prototype.clear=vx;Es.prototype.delete=Tx;Es.prototype.get=Rx;Es.prototype.has=bx;Es.prototype.set=_x;var Vi=Es;var nD="Expected a function";function wp(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(nD);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(wp.Cache||Vi),r}wp.Cache=Vi;var Cx=wp;var iD=500;function oD(t){var e=Cx(t,function(n){return r.size===iD&&r.clear(),n}),r=e.cache;return e}var Sx=oD;var sD=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,aD=/\\(\\)?/g,cD=Sx(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(sD,function(r,n,i,o){e.push(i?o.replace(aD,"$1"):n||r)}),e}),kx=cD;function uD(t){return t==null?"":kv(t)}var Ex=uD;function lD(t,e){return X(t)?t:Cs(t,e)?[t]:kx(Ex(t))}var ai=lD;var dD=1/0;function fD(t){if(typeof t=="string"||cn(t))return t;var e=t+"";return e=="0"&&1/t==-dD?"-0":e}var mn=fD;function hD(t,e){e=ai(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[mn(e[r++])];return r&&r==n?t:void 0}var As=hD;function pD(t,e,r){var n=t==null?void 0:As(t,e);return n===void 0?r:n}var Ax=pD;function mD(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var ws=mD;var wx=Dt?Dt.isConcatSpreadable:void 0;function gD(t){return X(t)||ti(t)||!!(wx&&t&&t[wx])}var Nx=gD;function Px(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=Nx),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?Px(a,e-1,r,n,i):ws(i,a):n||(i[i.length]=a)}return i}var Ns=Px;function yD(t){var e=t==null?0:t.length;return e?Ns(t,1):[]}var gt=yD;var vD=Tl(Object.getPrototypeOf,Object),bl=vD;function xD(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}var _l=xD;function TD(t,e,r,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}var Ix=TD;function RD(){this.__data__=new ii,this.size=0}var Dx=RD;function bD(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Ox=bD;function _D(t){return this.__data__.get(t)}var Lx=_D;function CD(t){return this.__data__.has(t)}var Mx=CD;var SD=200;function kD(t,e){var r=this.__data__;if(r instanceof ii){var n=r.__data__;if(!oi||n.length<SD-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Vi(n)}return r.set(t,e),this.size=r.size,this}var Fx=kD;function Ps(t){var e=this.__data__=new ii(t);this.size=e.size}Ps.prototype.clear=Dx;Ps.prototype.delete=Ox;Ps.prototype.get=Lx;Ps.prototype.has=Mx;Ps.prototype.set=Fx;var ci=Ps;function ED(t,e){return t&&fn(e,Fe(e),t)}var $x=ED;function AD(t,e){return t&&fn(e,ri(e),t)}var qx=AD;var Bx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,jx=Bx&&typeof module=="object"&&module&&!module.nodeType&&module,wD=jx&&jx.exports===Bx,Ux=wD?bt.Buffer:void 0,Wx=Ux?Ux.allocUnsafe:void 0;function ND(t,e){if(e)return t.slice();var r=t.length,n=Wx?Wx(r):new t.constructor(r);return t.copy(n),n}var Hx=ND;function PD(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}var Is=PD;function ID(){return[]}var Cl=ID;var DD=Object.prototype,OD=DD.propertyIsEnumerable,Gx=Object.getOwnPropertySymbols,LD=Gx?function(t){return t==null?[]:(t=Object(t),Is(Gx(t),function(e){return OD.call(t,e)}))}:Cl,Ds=LD;function MD(t,e){return fn(t,Ds(t),e)}var zx=MD;var FD=Object.getOwnPropertySymbols,$D=FD?function(t){for(var e=[];t;)ws(e,Ds(t)),t=bl(t);return e}:Cl,Sl=$D;function qD(t,e){return fn(t,Sl(t),e)}var Vx=qD;function jD(t,e,r){var n=e(t);return X(t)?n:ws(n,r(t))}var kl=jD;function UD(t){return kl(t,Fe,Ds)}var fc=UD;function WD(t){return kl(t,ri,Sl)}var El=WD;var BD=dr(bt,"DataView"),Al=BD;var HD=dr(bt,"Promise"),wl=HD;var GD=dr(bt,"Set"),ui=GD;var Kx="[object Map]",zD="[object Object]",Xx="[object Promise]",Yx="[object Set]",Jx="[object WeakMap]",Qx="[object DataView]",VD=Pn(Al),KD=Pn(oi),XD=Pn(wl),YD=Pn(ui),JD=Pn(ml),Ki=tr;(Al&&Ki(new Al(new ArrayBuffer(1)))!=Qx||oi&&Ki(new oi)!=Kx||wl&&Ki(wl.resolve())!=Xx||ui&&Ki(new ui)!=Yx||ml&&Ki(new ml)!=Jx)&&(Ki=function(t){var e=tr(t),r=e==zD?t.constructor:void 0,n=r?Pn(r):"";if(n)switch(n){case VD:return Qx;case KD:return Kx;case XD:return Xx;case YD:return Yx;case JD:return Jx}return e});var Kr=Ki;var QD=Object.prototype,ZD=QD.hasOwnProperty;function eO(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&ZD.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Zx=eO;var tO=bt.Uint8Array,Os=tO;function rO(t){var e=new t.constructor(t.byteLength);return new Os(e).set(new Os(t)),e}var Ls=rO;function nO(t,e){var r=e?Ls(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var eT=nO;var iO=/\w*$/;function oO(t){var e=new t.constructor(t.source,iO.exec(t));return e.lastIndex=t.lastIndex,e}var tT=oO;var rT=Dt?Dt.prototype:void 0,nT=rT?rT.valueOf:void 0;function sO(t){return nT?Object(nT.call(t)):{}}var iT=sO;function aO(t,e){var r=e?Ls(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var oT=aO;var cO="[object Boolean]",uO="[object Date]",lO="[object Map]",dO="[object Number]",fO="[object RegExp]",hO="[object Set]",pO="[object String]",mO="[object Symbol]",gO="[object ArrayBuffer]",yO="[object DataView]",vO="[object Float32Array]",xO="[object Float64Array]",TO="[object Int8Array]",RO="[object Int16Array]",bO="[object Int32Array]",_O="[object Uint8Array]",CO="[object Uint8ClampedArray]",SO="[object Uint16Array]",kO="[object Uint32Array]";function EO(t,e,r){var n=t.constructor;switch(e){case gO:return Ls(t);case cO:case uO:return new n(+t);case yO:return eT(t,r);case vO:case xO:case TO:case RO:case bO:case _O:case CO:case SO:case kO:return oT(t,r);case lO:return new n;case dO:case pO:return new n(t);case fO:return tT(t);case hO:return new n;case mO:return iT(t)}}var sT=EO;function AO(t){return typeof t.constructor=="function"&&!hn(t)?$v(bl(t)):{}}var aT=AO;var wO="[object Map]";function NO(t){return mt(t)&&Kr(t)==wO}var cT=NO;var uT=Dr&&Dr.isMap,PO=uT?pn(uT):cT,lT=PO;var IO="[object Set]";function DO(t){return mt(t)&&Kr(t)==IO}var dT=DO;var fT=Dr&&Dr.isSet,OO=fT?pn(fT):dT,hT=OO;var LO=1,MO=2,FO=4,pT="[object Arguments]",$O="[object Array]",qO="[object Boolean]",jO="[object Date]",UO="[object Error]",mT="[object Function]",WO="[object GeneratorFunction]",BO="[object Map]",HO="[object Number]",gT="[object Object]",GO="[object RegExp]",zO="[object Set]",VO="[object String]",KO="[object Symbol]",XO="[object WeakMap]",YO="[object ArrayBuffer]",JO="[object DataView]",QO="[object Float32Array]",ZO="[object Float64Array]",e0="[object Int8Array]",t0="[object Int16Array]",r0="[object Int32Array]",n0="[object Uint8Array]",i0="[object Uint8ClampedArray]",o0="[object Uint16Array]",s0="[object Uint32Array]",$e={};$e[pT]=$e[$O]=$e[YO]=$e[JO]=$e[qO]=$e[jO]=$e[QO]=$e[ZO]=$e[e0]=$e[t0]=$e[r0]=$e[BO]=$e[HO]=$e[gT]=$e[GO]=$e[zO]=$e[VO]=$e[KO]=$e[n0]=$e[i0]=$e[o0]=$e[s0]=!0;$e[UO]=$e[mT]=$e[XO]=!1;function Nl(t,e,r,n,i,o){var s,a=e&LO,c=e&MO,u=e&FO;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!rt(t))return t;var l=X(t);if(l){if(s=Zx(t),!a)return jv(t,s)}else{var h=Kr(t),p=h==mT||h==WO;if(In(t))return Hx(t,a);if(h==gT||h==pT||p&&!i){if(s=c||p?{}:aT(t),!a)return c?Vx(t,qx(s,t)):zx(t,$x(s,t))}else{if(!$e[h])return i?t:{};s=sT(t,h,a)}}o||(o=new ci);var y=o.get(t);if(y)return y;o.set(t,s),hT(t)?t.forEach(function(D){s.add(Nl(D,e,r,D,t,o))}):lT(t)&&t.forEach(function(D,w){s.set(w,Nl(D,e,r,w,t,o))});var _=u?c?El:fc:c?ri:Fe,E=l?void 0:_(t);return gl(E||t,function(D,w){E&&(w=D,D=t[w]),Zn(s,w,Nl(D,e,r,w,t,o))}),s}var yT=Nl;var a0=4;function c0(t){return yT(t,a0)}var qe=c0;function u0(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i}var gn=u0;var l0="__lodash_hash_undefined__";function d0(t){return this.__data__.set(t,l0),this}var vT=d0;function f0(t){return this.__data__.has(t)}var xT=f0;function Pl(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Vi;++e<r;)this.add(t[e])}Pl.prototype.add=Pl.prototype.push=vT;Pl.prototype.has=xT;var Ms=Pl;function h0(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Il=h0;function p0(t,e){return t.has(e)}var Fs=p0;var m0=1,g0=2;function y0(t,e,r,n,i,o){var s=r&m0,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(t),l=o.get(e);if(u&&l)return u==e&&l==t;var h=-1,p=!0,y=r&g0?new Ms:void 0;for(o.set(t,e),o.set(e,t);++h<a;){var _=t[h],E=e[h];if(n)var D=s?n(E,_,h,e,t,o):n(_,E,h,t,e,o);if(D!==void 0){if(D)continue;p=!1;break}if(y){if(!Il(e,function(w,x){if(!Fs(y,x)&&(_===w||i(_,w,r,n,o)))return y.push(x)})){p=!1;break}}else if(!(_===E||i(_,E,r,n,o))){p=!1;break}}return o.delete(t),o.delete(e),p}var Dl=y0;function v0(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var TT=v0;function x0(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var $s=x0;var T0=1,R0=2,b0="[object Boolean]",_0="[object Date]",C0="[object Error]",S0="[object Map]",k0="[object Number]",E0="[object RegExp]",A0="[object Set]",w0="[object String]",N0="[object Symbol]",P0="[object ArrayBuffer]",I0="[object DataView]",RT=Dt?Dt.prototype:void 0,Np=RT?RT.valueOf:void 0;function D0(t,e,r,n,i,o,s){switch(r){case I0:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case P0:return!(t.byteLength!=e.byteLength||!o(new Os(t),new Os(e)));case b0:case _0:case k0:return dn(+t,+e);case C0:return t.name==e.name&&t.message==e.message;case E0:case w0:return t==e+"";case S0:var a=TT;case A0:var c=n&T0;if(a||(a=$s),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;n|=R0,s.set(t,e);var l=Dl(a(t),a(e),n,i,o,s);return s.delete(t),l;case N0:if(Np)return Np.call(t)==Np.call(e)}return!1}var bT=D0;var O0=1,L0=Object.prototype,M0=L0.hasOwnProperty;function F0(t,e,r,n,i,o){var s=r&O0,a=fc(t),c=a.length,u=fc(e),l=u.length;if(c!=l&&!s)return!1;for(var h=c;h--;){var p=a[h];if(!(s?p in e:M0.call(e,p)))return!1}var y=o.get(t),_=o.get(e);if(y&&_)return y==e&&_==t;var E=!0;o.set(t,e),o.set(e,t);for(var D=s;++h<c;){p=a[h];var w=t[p],x=e[p];if(n)var g=s?n(x,w,p,e,t,o):n(w,x,p,t,e,o);if(!(g===void 0?w===x||i(w,x,r,n,o):g)){E=!1;break}D||(D=p=="constructor")}if(E&&!D){var A=t.constructor,M=e.constructor;A!=M&&"constructor"in t&&"constructor"in e&&!(typeof A=="function"&&A instanceof A&&typeof M=="function"&&M instanceof M)&&(E=!1)}return o.delete(t),o.delete(e),E}var _T=F0;var $0=1,CT="[object Arguments]",ST="[object Array]",Ol="[object Object]",q0=Object.prototype,kT=q0.hasOwnProperty;function j0(t,e,r,n,i,o){var s=X(t),a=X(e),c=s?ST:Kr(t),u=a?ST:Kr(e);c=c==CT?Ol:c,u=u==CT?Ol:u;var l=c==Ol,h=u==Ol,p=c==u;if(p&&In(t)){if(!In(e))return!1;s=!0,l=!1}if(p&&!l)return o||(o=new ci),s||_s(t)?Dl(t,e,r,n,i,o):bT(t,e,c,r,n,i,o);if(!(r&$0)){var y=l&&kT.call(t,"__wrapped__"),_=h&&kT.call(e,"__wrapped__");if(y||_){var E=y?t.value():t,D=_?e.value():e;return o||(o=new ci),i(E,D,r,n,o)}}return p?(o||(o=new ci),_T(t,e,r,n,i,o)):!1}var ET=j0;function AT(t,e,r,n,i){return t===e?!0:t==null||e==null||!mt(t)&&!mt(e)?t!==t&&e!==e:ET(t,e,r,n,AT,i)}var Ll=AT;var U0=1,W0=2;function B0(t,e,r,n){var i=r.length,o=i,s=!n;if(t==null)return!o;for(t=Object(t);i--;){var a=r[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){a=r[i];var c=a[0],u=t[c],l=a[1];if(s&&a[2]){if(u===void 0&&!(c in t))return!1}else{var h=new ci;if(n)var p=n(u,l,c,t,e,h);if(!(p===void 0?Ll(l,u,U0|W0,n,h):p))return!1}}return!0}var wT=B0;function H0(t){return t===t&&!rt(t)}var Ml=H0;function G0(t){for(var e=Fe(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Ml(i)]}return e}var NT=G0;function z0(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Fl=z0;function V0(t){var e=NT(t);return e.length==1&&e[0][2]?Fl(e[0][0],e[0][1]):function(r){return r===t||wT(r,t,e)}}var PT=V0;function K0(t,e){return t!=null&&e in Object(t)}var IT=K0;function X0(t,e,r){e=ai(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=mn(e[n]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&bs(i)&&Qn(s,i)&&(X(t)||ti(t)))}var $l=X0;function Y0(t,e){return t!=null&&$l(t,e,IT)}var DT=Y0;var J0=1,Q0=2;function Z0(t,e){return Cs(t)&&Ml(e)?Fl(mn(t),e):function(r){var n=Ax(r,t);return n===void 0&&n===e?DT(r,t):Ll(e,n,J0|Q0)}}var OT=Z0;function eL(t){return function(e){return e?.[t]}}var LT=eL;function tL(t){return function(e){return As(e,t)}}var MT=tL;function rL(t){return Cs(t)?LT(mn(t)):MT(t)}var FT=rL;function nL(t){return typeof t=="function"?t:t==null?lr:typeof t=="object"?X(t)?OT(t[0],t[1]):PT(t):FT(t)}var lt=nL;function iL(t,e,r,n){for(var i=-1,o=t==null?0:t.length;++i<o;){var s=t[i];e(n,s,r(s),t)}return n}var $T=iL;function oL(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++i];if(r(o[c],c,o)===!1)break}return e}}var qT=oL;var sL=qT(),jT=sL;function aL(t,e){return t&&jT(t,e,Fe)}var UT=aL;function cL(t,e){return function(r,n){if(r==null)return r;if(!_t(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var WT=cL;var uL=WT(UT),fr=uL;function lL(t,e,r,n){return fr(t,function(i,o,s){e(n,i,r(i),s)}),n}var BT=lL;function dL(t,e){return function(r,n){var i=X(r)?$T:BT,o=e?e():{};return i(r,t,lt(n,2),o)}}var HT=dL;var GT=Object.prototype,fL=GT.hasOwnProperty,hL=Rs(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&ei(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],s=ri(o),a=-1,c=s.length;++a<c;){var u=s[a],l=t[u];(l===void 0||dn(l,GT[u])&&!fL.call(t,u))&&(t[u]=o[u])}return t}),qs=hL;function pL(t){return mt(t)&&_t(t)}var Pp=pL;function mL(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var ql=mL;var gL=200;function yL(t,e,r,n){var i=-1,o=vl,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;r&&(e=un(e,pn(r))),n?(o=ql,s=!1):e.length>=gL&&(o=Fs,s=!1,e=new Ms(e));e:for(;++i<a;){var l=t[i],h=r==null?l:r(l);if(l=n||l!==0?l:0,s&&h===h){for(var p=u;p--;)if(e[p]===h)continue e;c.push(l)}else o(e,h,n)||c.push(l)}return c}var zT=yL;var vL=Rs(function(t,e){return Pp(t)?zT(t,Ns(e,1,Pp,!0)):[]}),li=vL;function xL(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var yn=xL;function TL(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:ln(e),_l(t,e<0?0:e,n)):[]}var yt=TL;function RL(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:ln(e),e=n-e,_l(t,0,e<0?0:e)):[]}var On=RL;function bL(t){return typeof t=="function"?t:lr}var VT=bL;function _L(t,e){var r=X(t)?gl:fr;return r(t,VT(e))}var H=_L;function CL(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var KT=CL;function SL(t,e){var r=!0;return fr(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var XT=SL;function kL(t,e,r){var n=X(t)?KT:XT;return r&&ei(t,e,r)&&(e=void 0),n(t,lt(e,3))}var Kt=kL;function EL(t,e){var r=[];return fr(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var jl=EL;function AL(t,e){var r=X(t)?Is:jl;return r(t,lt(e,3))}var Ot=AL;function wL(t){return function(e,r,n){var i=Object(e);if(!_t(e)){var o=lt(r,3);e=Fe(e),r=function(a){return o(i[a],a,i)}}var s=t(e,r,n);return s>-1?i[o?e[s]:s]:void 0}}var YT=wL;var NL=Math.max;function PL(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:ln(r);return i<0&&(i=NL(n+i,0)),yl(t,lt(e,3),i)}var JT=PL;var IL=YT(JT),vn=IL;function DL(t){return t&&t.length?t[0]:void 0}var Lt=DL;function OL(t,e){var r=-1,n=_t(t)?Array(t.length):[];return fr(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var QT=OL;function LL(t,e){var r=X(t)?un:QT;return r(t,lt(e,3))}var j=LL;function ML(t,e){return Ns(j(t,e),1)}var Bt=ML;var FL=Object.prototype,$L=FL.hasOwnProperty,qL=HT(function(t,e,r){$L.call(t,r)?t[r].push(e):Ts(t,r,[e])}),Ip=qL;var jL=Object.prototype,UL=jL.hasOwnProperty;function WL(t,e){return t!=null&&UL.call(t,e)}var ZT=WL;function BL(t,e){return t!=null&&$l(t,e,ZT)}var V=BL;var HL="[object String]";function GL(t){return typeof t=="string"||!X(t)&&mt(t)&&tr(t)==HL}var At=GL;function zL(t,e){return un(e,function(r){return t[r]})}var eR=zL;function VL(t){return t==null?[]:eR(t,Fe(t))}var Pe=VL;var KL=Math.max;function XL(t,e,r,n){t=_t(t)?t:Pe(t),r=r&&!n?ln(r):0;var i=t.length;return r<0&&(r=KL(i+r,0)),At(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&xs(t,e,r)>-1}var Je=XL;var YL=Math.max;function JL(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:ln(r);return i<0&&(i=YL(n+i,0)),xs(t,e,i)}var Ul=JL;var QL="[object Map]",ZL="[object Set]",eM=Object.prototype,tM=eM.hasOwnProperty;function rM(t){if(t==null)return!0;if(_t(t)&&(X(t)||typeof t=="string"||typeof t.splice=="function"||In(t)||_s(t)||ti(t)))return!t.length;var e=Kr(t);if(e==QL||e==ZL)return!t.size;if(hn(t))return!Rl(t).length;for(var r in t)if(tM.call(t,r))return!1;return!0}var ae=rM;var nM="[object RegExp]";function iM(t){return mt(t)&&tr(t)==nM}var tR=iM;var rR=Dr&&Dr.isRegExp,oM=rR?pn(rR):tR,Or=oM;function sM(t){return t===void 0}var Xt=sM;function aM(t,e){return t<e}var nR=aM;function cM(t,e,r){for(var n=-1,i=t.length;++n<i;){var o=t[n],s=e(o);if(s!=null&&(a===void 0?s===s&&!cn(s):r(s,a)))var a=s,c=o}return c}var iR=cM;function uM(t){return t&&t.length?iR(t,lr,nR):void 0}var oR=uM;var lM="Expected a function";function dM(t){if(typeof t!="function")throw new TypeError(lM);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var sR=dM;function fM(t,e,r,n){if(!rt(t))return t;e=ai(e,t);for(var i=-1,o=e.length,s=o-1,a=t;a!=null&&++i<o;){var c=mn(e[i]),u=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var l=a[c];u=n?n(l,c,a):void 0,u===void 0&&(u=rt(l)?l:Qn(e[i+1])?[]:{})}Zn(a,c,u),a=a[c]}return t}var aR=fM;function hM(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var s=e[n],a=As(t,s);r(a,s)&&aR(o,ai(s,t),a)}return o}var cR=hM;function pM(t,e){if(t==null)return{};var r=un(El(t),function(n){return[n]});return e=lt(e),cR(t,r,function(n,i){return e(n,i[0])})}var hr=pM;function mM(t,e,r,n,i){return i(t,function(o,s,a){r=n?(n=!1,o):e(r,o,s,a)}),r}var uR=mM;function gM(t,e,r){var n=X(t)?Ix:uR,i=arguments.length<3;return n(t,lt(e,4),r,i,fr)}var it=gM;function yM(t,e){var r=X(t)?Is:jl;return r(t,sR(lt(e,3)))}var di=yM;function vM(t,e){var r;return fr(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var lR=vM;function xM(t,e,r){var n=X(t)?Il:lR;return r&&ei(t,e,r)&&(e=void 0),n(t,lt(e,3))}var hc=xM;var TM=1/0,RM=ui&&1/$s(new ui([,-0]))[1]==TM?function(t){return new ui(t)}:nt,dR=RM;var bM=200;function _M(t,e,r){var n=-1,i=vl,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=ql;else if(o>=bM){var u=e?null:dR(t);if(u)return $s(u);s=!1,i=Fs,c=new Ms}else c=e?[]:a;e:for(;++n<o;){var l=t[n],h=e?e(l):l;if(l=r||l!==0?l:0,s&&h===h){for(var p=c.length;p--;)if(c[p]===h)continue e;e&&c.push(h),a.push(l)}else i(c,h,r)||(c!==a&&c.push(h),a.push(l))}return a}var Wl=_M;function CM(t){return t&&t.length?Wl(t):[]}var js=CM;function SM(t,e){return t&&t.length?Wl(t,lt(e,2)):[]}var fR=SM;function Us(t){console&&console.error&&console.error(`Error: ${t}`)}function pc(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function mc(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function gc(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function kM(t){return EM(t)?t.LABEL:t.name}function EM(t){return At(t.LABEL)&&t.LABEL!==""}var Sr=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),H(this.definition,r=>{r.accept(e)})}},Ae=class extends Sr{constructor(e){super([]),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},nr=class extends Sr{constructor(e){super(e.definition),this.orgText="",Wt(this,hr(e,r=>r!==void 0))}},je=class extends Sr{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Wt(this,hr(e,r=>r!==void 0))}},we=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},Ue=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},We=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},pe=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},De=class extends Sr{constructor(e){super(e.definition),this.idx=1,Wt(this,hr(e,r=>r!==void 0))}},Oe=class extends Sr{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Wt(this,hr(e,r=>r!==void 0))}},ue=class{constructor(e){this.idx=1,Wt(this,hr(e,r=>r!==void 0))}accept(e){e.visit(this)}};function Bl(t){return j(t,Ws)}function Ws(t){function e(r){return j(r,Ws)}if(t instanceof Ae){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return At(t.label)&&(r.label=t.label),r}else{if(t instanceof je)return{type:"Alternative",definition:e(t.definition)};if(t instanceof we)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Ue)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof We)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Ws(new ue({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof De)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Ws(new ue({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof pe)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Oe)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof ue){let r={type:"Terminal",name:t.terminalType.name,label:kM(t.terminalType),idx:t.idx};At(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=Or(n)?n.source:n),r}else{if(t instanceof nr)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var ir=class{visit(e){let r=e;switch(r.constructor){case Ae:return this.visitNonTerminal(r);case je:return this.visitAlternative(r);case we:return this.visitOption(r);case Ue:return this.visitRepetitionMandatory(r);case We:return this.visitRepetitionMandatoryWithSeparator(r);case De:return this.visitRepetitionWithSeparator(r);case pe:return this.visitRepetition(r);case Oe:return this.visitAlternation(r);case ue:return this.visitTerminal(r);case nr:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function Dp(t){return t instanceof je||t instanceof we||t instanceof pe||t instanceof Ue||t instanceof We||t instanceof De||t instanceof ue||t instanceof nr}function Xi(t,e=[]){return t instanceof we||t instanceof pe||t instanceof De?!0:t instanceof Oe?hc(t.definition,n=>Xi(n,e)):t instanceof Ae&&Je(e,t)?!1:t instanceof Sr?(t instanceof Ae&&e.push(t),Kt(t.definition,n=>Xi(n,e))):!1}function Op(t){return t instanceof Oe}function pr(t){if(t instanceof Ae)return"SUBRULE";if(t instanceof we)return"OPTION";if(t instanceof Oe)return"OR";if(t instanceof Ue)return"AT_LEAST_ONE";if(t instanceof We)return"AT_LEAST_ONE_SEP";if(t instanceof De)return"MANY_SEP";if(t instanceof pe)return"MANY";if(t instanceof ue)return"CONSUME";throw Error("non exhaustive match")}var Ln=class{walk(e,r=[]){H(e.definition,(n,i)=>{let o=yt(e.definition,i+1);if(n instanceof Ae)this.walkProdRef(n,o,r);else if(n instanceof ue)this.walkTerminal(n,o,r);else if(n instanceof je)this.walkFlat(n,o,r);else if(n instanceof we)this.walkOption(n,o,r);else if(n instanceof Ue)this.walkAtLeastOne(n,o,r);else if(n instanceof We)this.walkAtLeastOneSep(n,o,r);else if(n instanceof De)this.walkManySep(n,o,r);else if(n instanceof pe)this.walkMany(n,o,r);else if(n instanceof Oe)this.walkOr(n,o,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new we({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=hR(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new we({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=hR(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);H(e.definition,o=>{let s=new je({definition:[o]});this.walk(s,i)})}};function hR(t,e,r){return[new we({definition:[new ue({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function Yi(t){if(t instanceof Ae)return Yi(t.referencedRule);if(t instanceof ue)return NM(t);if(Dp(t))return AM(t);if(Op(t))return wM(t);throw Error("non exhaustive match")}function AM(t){let e=[],r=t.definition,n=0,i=r.length>n,o,s=!0;for(;i&&s;)o=r[n],s=Xi(o),e=e.concat(Yi(o)),n=n+1,i=r.length>n;return js(e)}function wM(t){let e=j(t.definition,r=>Yi(r));return js(gt(e))}function NM(t){return[t.terminalType]}var Hl="_~IN~_";var Lp=class extends Ln{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=PM(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),s=new je({definition:o}),a=Yi(s);this.follows[i]=a}};function pR(t){let e={};return H(t,r=>{let n=new Lp(r).startWalking();Wt(e,n)}),e}function PM(t,e){return t.name+e+Hl}var Gl={},IM=new Bi;function Bs(t){let e=t.toString();if(Gl.hasOwnProperty(e))return Gl[e];{let r=IM.pattern(e);return Gl[e]=r,r}}function mR(){Gl={}}var yR="Complement Sets are not supported for first char optimization",yc=`Unable to use "first char" lexer optimizations:
48
48
  `;function vR(t,e=!1){try{let r=Bs(t);return Mp(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===yR)e&&pc(`${yc} Unable to optimize: < ${t.toString()} >
49
49
  Complement Sets cannot be automatically optimized.
50
50
  This will disable the lexer's first char optimizations.
@@ -53,33 +53,33 @@ ${o}`)},console.warn=function(...i){t.warn(e(i))}}});var fj={};Kn(fj,{getSyntaxT
53
53
  See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Us(`${yc}
54
54
  Failed parsing: < ${t.toString()} >
55
55
  Using the @chevrotain/regexp-to-ast library
56
- Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Mp(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Mp(t.value[i],e,r);break;case"Alternative":let n=t.value;for(let i=0;i<n.length;i++){let o=n[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let s=o;switch(s.type){case"Character":zl(s.value,e,r);break;case"Set":if(s.complement===!0)throw Error(yR);H(s.value,c=>{if(typeof c=="number")zl(c,e,r);else{let u=c;if(r===!0)for(let l=u.from;l<=u.to;l++)zl(l,e,r);else{for(let l=u.from;l<=u.to&&l<Hs;l++)zl(l,e,r);if(u.to>=Hs){let l=u.from>=Hs?u.from:Hs,h=u.to,p=xn(l),y=xn(h);for(let _=p;_<=y;_++)e[_]=_}}}});break;case"Group":Mp(s.value,e,r);break;default:throw Error("Non Exhaustive Match")}let a=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&Fp(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return Pe(e)}function zl(t,e,r){let n=xn(t);e[n]=n,r===!0&&IM(t,e)}function IM(t,e){let r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){let i=xn(n.charCodeAt(0));e[i]=i}else{let i=r.toLowerCase();if(i!==r){let o=xn(i.charCodeAt(0));e[o]=o}}}function gR(t,e){return vn(t.value,r=>{if(typeof r=="number")return Je(e,r);{let n=r;return vn(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function Fp(t){let e=t.quantifier;return e&&e.atLeast===0?!0:t.value?X(t.value)?Kt(t.value,Fp):Fp(t.value):!1}var $p=class extends sn{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){Je(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?gR(e,this.targetCharCodes)===void 0&&(this.found=!0):gR(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Vl(t,e){if(e instanceof RegExp){let r=Bs(e),n=new $p(t);return n.visit(r),n.found}else return vn(e,r=>Je(t,r.charCodeAt(0)))!==void 0}var Ji="PATTERN",Gs="defaultMode",Kl="modes",jp=typeof new RegExp("(?:)").sticky=="boolean";function RR(t,e){e=qs(e,{useSticky:jp,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
57
- `],tracer:(x,g)=>g()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{YM()});let n;r("Reject Lexer.NA",()=>{n=di(t,x=>x[Ji]===Ze.NA)});let i=!1,o;r("Transform Patterns",()=>{i=!1,o=j(n,x=>{let g=x[Ji];if(Or(g)){let A=g.source;return A.length===1&&A!=="^"&&A!=="$"&&A!=="."&&!g.ignoreCase?A:A.length===2&&A[0]==="\\"&&!Je(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],A[1])?A[1]:e.useSticky?TR(g):xR(g)}else{if(rr(g))return i=!0,{exec:g};if(typeof g=="object")return i=!0,g;if(typeof g=="string"){if(g.length===1)return g;{let A=g.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),M=new RegExp(A);return e.useSticky?TR(M):xR(M)}}else throw Error("non exhaustive match")}})});let s,a,c,u,l;r("misc mapping",()=>{s=j(n,x=>x.tokenTypeIdx),a=j(n,x=>{let g=x.GROUP;if(g!==Ze.SKIPPED){if(At(g))return g;if(Xt(g))return!1;throw Error("non exhaustive match")}}),c=j(n,x=>{let g=x.LONGER_ALT;if(g)return X(g)?j(g,M=>Ul(n,M)):[Ul(n,g)]}),u=j(n,x=>x.PUSH_MODE),l=j(n,x=>V(x,"POP_MODE"))});let h;r("Line Terminator Handling",()=>{let x=wR(e.lineTerminatorCharacters);h=j(n,g=>!1),e.positionTracking!=="onlyOffset"&&(h=j(n,g=>V(g,"LINE_BREAKS")?!!g.LINE_BREAKS:AR(g,x)===!1&&Vl(x,g.PATTERN)))});let p,y,_,E;r("Misc Mapping #2",()=>{p=j(n,kR),y=j(o,KM),_=it(n,(x,g)=>{let A=g.GROUP;return At(A)&&A!==Ze.SKIPPED&&(x[A]=[]),x},{}),E=j(o,(x,g)=>({pattern:o[g],longerAlt:c[g],canLineTerminator:h[g],isCustom:p[g],short:y[g],group:a[g],push:u[g],pop:l[g],tokenTypeIdx:s[g],tokenType:n[g]}))});let D=!0,w=[];return e.safeMode||r("First Char Optimization",()=>{w=it(n,(x,g,A)=>{if(typeof g.PATTERN=="string"){let M=g.PATTERN.charCodeAt(0),te=xn(M);qp(x,te,E[A])}else if(X(g.START_CHARS_HINT)){let M;H(g.START_CHARS_HINT,te=>{let _e=typeof te=="string"?te.charCodeAt(0):te,Se=xn(_e);M!==Se&&(M=Se,qp(x,Se,E[A]))})}else if(Or(g.PATTERN))if(g.PATTERN.unicode)D=!1,e.ensureOptimizations&&Us(`${yc} Unable to analyze < ${g.PATTERN.toString()} > pattern.
56
+ Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Mp(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Mp(t.value[i],e,r);break;case"Alternative":let n=t.value;for(let i=0;i<n.length;i++){let o=n[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let s=o;switch(s.type){case"Character":zl(s.value,e,r);break;case"Set":if(s.complement===!0)throw Error(yR);H(s.value,c=>{if(typeof c=="number")zl(c,e,r);else{let u=c;if(r===!0)for(let l=u.from;l<=u.to;l++)zl(l,e,r);else{for(let l=u.from;l<=u.to&&l<Hs;l++)zl(l,e,r);if(u.to>=Hs){let l=u.from>=Hs?u.from:Hs,h=u.to,p=xn(l),y=xn(h);for(let _=p;_<=y;_++)e[_]=_}}}});break;case"Group":Mp(s.value,e,r);break;default:throw Error("Non Exhaustive Match")}let a=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&Fp(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return Pe(e)}function zl(t,e,r){let n=xn(t);e[n]=n,r===!0&&DM(t,e)}function DM(t,e){let r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){let i=xn(n.charCodeAt(0));e[i]=i}else{let i=r.toLowerCase();if(i!==r){let o=xn(i.charCodeAt(0));e[o]=o}}}function gR(t,e){return vn(t.value,r=>{if(typeof r=="number")return Je(e,r);{let n=r;return vn(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function Fp(t){let e=t.quantifier;return e&&e.atLeast===0?!0:t.value?X(t.value)?Kt(t.value,Fp):Fp(t.value):!1}var $p=class extends sn{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){Je(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?gR(e,this.targetCharCodes)===void 0&&(this.found=!0):gR(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Vl(t,e){if(e instanceof RegExp){let r=Bs(e),n=new $p(t);return n.visit(r),n.found}else return vn(e,r=>Je(t,r.charCodeAt(0)))!==void 0}var Ji="PATTERN",Gs="defaultMode",Kl="modes",jp=typeof new RegExp("(?:)").sticky=="boolean";function RR(t,e){e=qs(e,{useSticky:jp,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
57
+ `],tracer:(x,g)=>g()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{JM()});let n;r("Reject Lexer.NA",()=>{n=di(t,x=>x[Ji]===Ze.NA)});let i=!1,o;r("Transform Patterns",()=>{i=!1,o=j(n,x=>{let g=x[Ji];if(Or(g)){let A=g.source;return A.length===1&&A!=="^"&&A!=="$"&&A!=="."&&!g.ignoreCase?A:A.length===2&&A[0]==="\\"&&!Je(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],A[1])?A[1]:e.useSticky?TR(g):xR(g)}else{if(rr(g))return i=!0,{exec:g};if(typeof g=="object")return i=!0,g;if(typeof g=="string"){if(g.length===1)return g;{let A=g.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),M=new RegExp(A);return e.useSticky?TR(M):xR(M)}}else throw Error("non exhaustive match")}})});let s,a,c,u,l;r("misc mapping",()=>{s=j(n,x=>x.tokenTypeIdx),a=j(n,x=>{let g=x.GROUP;if(g!==Ze.SKIPPED){if(At(g))return g;if(Xt(g))return!1;throw Error("non exhaustive match")}}),c=j(n,x=>{let g=x.LONGER_ALT;if(g)return X(g)?j(g,M=>Ul(n,M)):[Ul(n,g)]}),u=j(n,x=>x.PUSH_MODE),l=j(n,x=>V(x,"POP_MODE"))});let h;r("Line Terminator Handling",()=>{let x=wR(e.lineTerminatorCharacters);h=j(n,g=>!1),e.positionTracking!=="onlyOffset"&&(h=j(n,g=>V(g,"LINE_BREAKS")?!!g.LINE_BREAKS:AR(g,x)===!1&&Vl(x,g.PATTERN)))});let p,y,_,E;r("Misc Mapping #2",()=>{p=j(n,kR),y=j(o,XM),_=it(n,(x,g)=>{let A=g.GROUP;return At(A)&&A!==Ze.SKIPPED&&(x[A]=[]),x},{}),E=j(o,(x,g)=>({pattern:o[g],longerAlt:c[g],canLineTerminator:h[g],isCustom:p[g],short:y[g],group:a[g],push:u[g],pop:l[g],tokenTypeIdx:s[g],tokenType:n[g]}))});let D=!0,w=[];return e.safeMode||r("First Char Optimization",()=>{w=it(n,(x,g,A)=>{if(typeof g.PATTERN=="string"){let M=g.PATTERN.charCodeAt(0),te=xn(M);qp(x,te,E[A])}else if(X(g.START_CHARS_HINT)){let M;H(g.START_CHARS_HINT,te=>{let _e=typeof te=="string"?te.charCodeAt(0):te,Se=xn(_e);M!==Se&&(M=Se,qp(x,Se,E[A]))})}else if(Or(g.PATTERN))if(g.PATTERN.unicode)D=!1,e.ensureOptimizations&&Us(`${yc} Unable to analyze < ${g.PATTERN.toString()} > pattern.
58
58
  The regexp unicode flag is not currently supported by the regexp-to-ast library.
59
59
  This will disable the lexer's first char optimizations.
60
60
  For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let M=vR(g.PATTERN,e.ensureOptimizations);ae(M)&&(D=!1),H(M,te=>{qp(x,te,E[A])})}else e.ensureOptimizations&&Us(`${yc} TokenType: <${g.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
61
61
  This will disable the lexer's first char optimizations.
62
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),D=!1;return x},[])}),{emptyGroups:_,patternIdxToConfig:E,charCodeToPatternIdxToConfig:w,hasCustom:i,canBeOptimized:D}}function bR(t,e){let r=[],n=OM(t);r=r.concat(n.errors);let i=LM(n.valid),o=i.valid;return r=r.concat(i.errors),r=r.concat(DM(o)),r=r.concat(BM(o)),r=r.concat(HM(o,e)),r=r.concat(GM(o)),r}function DM(t){let e=[],r=Ot(t,n=>Or(n[Ji]));return e=e.concat(FM(r)),e=e.concat(jM(r)),e=e.concat(UM(r)),e=e.concat(WM(r)),e=e.concat($M(r)),e}function OM(t){let e=Ot(t,i=>!V(i,Ji)),r=j(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Qe.MISSING_PATTERN,tokenTypes:[i]})),n=li(t,e);return{errors:r,valid:n}}function LM(t){let e=Ot(t,i=>{let o=i[Ji];return!Or(o)&&!rr(o)&&!V(o,"exec")&&!At(o)}),r=j(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Qe.INVALID_PATTERN,tokenTypes:[i]})),n=li(t,e);return{errors:r,valid:n}}var MM=/[^\\][$]/;function FM(t){class e extends sn{constructor(){super(...arguments),this.found=!1}visitEndAnchor(o){this.found=!0}}let r=Ot(t,i=>{let o=i.PATTERN;try{let s=Bs(o),a=new e;return a.visit(s),a.found}catch{return MM.test(o.source)}});return j(r,i=>({message:`Unexpected RegExp Anchor Error:
62
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),D=!1;return x},[])}),{emptyGroups:_,patternIdxToConfig:E,charCodeToPatternIdxToConfig:w,hasCustom:i,canBeOptimized:D}}function bR(t,e){let r=[],n=LM(t);r=r.concat(n.errors);let i=MM(n.valid),o=i.valid;return r=r.concat(i.errors),r=r.concat(OM(o)),r=r.concat(HM(o)),r=r.concat(GM(o,e)),r=r.concat(zM(o)),r}function OM(t){let e=[],r=Ot(t,n=>Or(n[Ji]));return e=e.concat($M(r)),e=e.concat(UM(r)),e=e.concat(WM(r)),e=e.concat(BM(r)),e=e.concat(qM(r)),e}function LM(t){let e=Ot(t,i=>!V(i,Ji)),r=j(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Qe.MISSING_PATTERN,tokenTypes:[i]})),n=li(t,e);return{errors:r,valid:n}}function MM(t){let e=Ot(t,i=>{let o=i[Ji];return!Or(o)&&!rr(o)&&!V(o,"exec")&&!At(o)}),r=j(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Qe.INVALID_PATTERN,tokenTypes:[i]})),n=li(t,e);return{errors:r,valid:n}}var FM=/[^\\][$]/;function $M(t){class e extends sn{constructor(){super(...arguments),this.found=!1}visitEndAnchor(o){this.found=!0}}let r=Ot(t,i=>{let o=i.PATTERN;try{let s=Bs(o),a=new e;return a.visit(s),a.found}catch{return FM.test(o.source)}});return j(r,i=>({message:`Unexpected RegExp Anchor Error:
63
63
  Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
64
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Qe.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function $M(t){let e=Ot(t,n=>n.PATTERN.test(""));return j(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Qe.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var qM=/[^\\[][\^]|^\^/;function jM(t){class e extends sn{constructor(){super(...arguments),this.found=!1}visitStartAnchor(o){this.found=!0}}let r=Ot(t,i=>{let o=i.PATTERN;try{let s=Bs(o),a=new e;return a.visit(s),a.found}catch{return qM.test(o.source)}});return j(r,i=>({message:`Unexpected RegExp Anchor Error:
64
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Qe.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function qM(t){let e=Ot(t,n=>n.PATTERN.test(""));return j(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Qe.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var jM=/[^\\[][\^]|^\^/;function UM(t){class e extends sn{constructor(){super(...arguments),this.found=!1}visitStartAnchor(o){this.found=!0}}let r=Ot(t,i=>{let o=i.PATTERN;try{let s=Bs(o),a=new e;return a.visit(s),a.found}catch{return jM.test(o.source)}});return j(r,i=>({message:`Unexpected RegExp Anchor Error:
65
65
  Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
66
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Qe.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function UM(t){let e=Ot(t,n=>{let i=n[Ji];return i instanceof RegExp&&(i.multiline||i.global)});return j(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Qe.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function WM(t){let e=[],r=j(t,o=>it(t,(s,a)=>(o.PATTERN.source===a.PATTERN.source&&!Je(e,a)&&a.PATTERN!==Ze.NA&&(e.push(a),s.push(a)),s),[]));r=gn(r);let n=Ot(r,o=>o.length>1);return j(n,o=>{let s=j(o,c=>c.name);return{message:`The same RegExp pattern ->${Lt(o).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:Qe.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}})}function BM(t){let e=Ot(t,n=>{if(!V(n,"GROUP"))return!1;let i=n.GROUP;return i!==Ze.SKIPPED&&i!==Ze.NA&&!At(i)});return j(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Qe.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function HM(t,e){let r=Ot(t,i=>i.PUSH_MODE!==void 0&&!Je(e,i.PUSH_MODE));return j(r,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Qe.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function GM(t){let e=[],r=it(t,(n,i,o)=>{let s=i.PATTERN;return s===Ze.NA||(At(s)?n.push({str:s,idx:o,tokenType:i}):Or(s)&&VM(s)&&n.push({str:s.source,idx:o,tokenType:i})),n},[]);return H(t,(n,i)=>{H(r,({str:o,idx:s,tokenType:a})=>{if(i<s&&zM(o,n.PATTERN)){let c=`Token: ->${a.name}<- can never be matched.
66
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Qe.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function WM(t){let e=Ot(t,n=>{let i=n[Ji];return i instanceof RegExp&&(i.multiline||i.global)});return j(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Qe.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function BM(t){let e=[],r=j(t,o=>it(t,(s,a)=>(o.PATTERN.source===a.PATTERN.source&&!Je(e,a)&&a.PATTERN!==Ze.NA&&(e.push(a),s.push(a)),s),[]));r=gn(r);let n=Ot(r,o=>o.length>1);return j(n,o=>{let s=j(o,c=>c.name);return{message:`The same RegExp pattern ->${Lt(o).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:Qe.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}})}function HM(t){let e=Ot(t,n=>{if(!V(n,"GROUP"))return!1;let i=n.GROUP;return i!==Ze.SKIPPED&&i!==Ze.NA&&!At(i)});return j(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Qe.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function GM(t,e){let r=Ot(t,i=>i.PUSH_MODE!==void 0&&!Je(e,i.PUSH_MODE));return j(r,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Qe.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function zM(t){let e=[],r=it(t,(n,i,o)=>{let s=i.PATTERN;return s===Ze.NA||(At(s)?n.push({str:s,idx:o,tokenType:i}):Or(s)&&KM(s)&&n.push({str:s.source,idx:o,tokenType:i})),n},[]);return H(t,(n,i)=>{H(r,({str:o,idx:s,tokenType:a})=>{if(i<s&&VM(o,n.PATTERN)){let c=`Token: ->${a.name}<- can never be matched.
67
67
  Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
68
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:Qe.UNREACHABLE_PATTERN,tokenTypes:[n,a]})}})}),e}function zM(t,e){if(Or(e)){let r=e.exec(t);return r!==null&&r.index===0}else{if(rr(e))return e(t,0,[],{});if(V(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function VM(t){return vn([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>t.source.indexOf(r)!==-1)===void 0}function xR(t){let e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function TR(t){let e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function _R(t,e,r){let n=[];return V(t,Gs)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Gs+`> property in its definition
68
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:Qe.UNREACHABLE_PATTERN,tokenTypes:[n,a]})}})}),e}function VM(t,e){if(Or(e)){let r=e.exec(t);return r!==null&&r.index===0}else{if(rr(e))return e(t,0,[],{});if(V(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function KM(t){return vn([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>t.source.indexOf(r)!==-1)===void 0}function xR(t){let e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function TR(t){let e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function _R(t,e,r){let n=[];return V(t,Gs)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Gs+`> property in its definition
69
69
  `,type:Qe.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),V(t,Kl)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Kl+`> property in its definition
70
70
  `,type:Qe.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),V(t,Kl)&&V(t,Gs)&&!V(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Gs}: <${t.defaultMode}>which does not exist
71
71
  `,type:Qe.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),V(t,Kl)&&H(t.modes,(i,o)=>{H(i,(s,a)=>{if(Xt(s))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${o}> at index: <${a}>
72
72
  `,type:Qe.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(V(s,"LONGER_ALT")){let c=X(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT];H(c,u=>{!Xt(u)&&!Je(i,u)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${s.name}> outside of mode <${o}>
73
- `,type:Qe.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function CR(t,e,r){let n=[],i=!1,o=gn(gt(Pe(t.modes))),s=di(o,c=>c[Ji]===Ze.NA),a=wR(r);return e&&H(s,c=>{let u=AR(c,a);if(u!==!1){let h={message:XM(c,u),type:u.issue,tokenType:c};n.push(h)}else V(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):Vl(a,c.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
73
+ `,type:Qe.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function CR(t,e,r){let n=[],i=!1,o=gn(gt(Pe(t.modes))),s=di(o,c=>c[Ji]===Ze.NA),a=wR(r);return e&&H(s,c=>{let u=AR(c,a);if(u!==!1){let h={message:YM(c,u),type:u.issue,tokenType:c};n.push(h)}else V(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):Vl(a,c.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
74
74
  This Lexer has been defined to track line and column information,
75
75
  But none of the Token Types can be identified as matching a line terminator.
76
76
  See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
77
- for details.`,type:Qe.NO_LINE_BREAKS_FLAGS}),n}function SR(t){let e={},r=Fe(t);return H(r,n=>{let i=t[n];if(X(i))e[n]=[];else throw Error("non exhaustive match")}),e}function kR(t){let e=t.PATTERN;if(Or(e))return!1;if(rr(e))return!0;if(V(e,"exec"))return!0;if(At(e))return!1;throw Error("non exhaustive match")}function KM(t){return At(t)&&t.length===1?t.charCodeAt(0):!1}var ER={test:function(t){let e=t.length;for(let r=this.lastIndex;r<e;r++){let n=t.charCodeAt(r);if(n===10)return this.lastIndex=r+1,!0;if(n===13)return t.charCodeAt(r+1)===10?this.lastIndex=r+2:this.lastIndex=r+1,!0}return!1},lastIndex:0};function AR(t,e){if(V(t,"LINE_BREAKS"))return!1;if(Or(t.PATTERN)){try{Vl(e,t.PATTERN)}catch(r){return{issue:Qe.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(At(t.PATTERN))return!1;if(kR(t))return{issue:Qe.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function XM(t,e){if(e.issue===Qe.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
77
+ for details.`,type:Qe.NO_LINE_BREAKS_FLAGS}),n}function SR(t){let e={},r=Fe(t);return H(r,n=>{let i=t[n];if(X(i))e[n]=[];else throw Error("non exhaustive match")}),e}function kR(t){let e=t.PATTERN;if(Or(e))return!1;if(rr(e))return!0;if(V(e,"exec"))return!0;if(At(e))return!1;throw Error("non exhaustive match")}function XM(t){return At(t)&&t.length===1?t.charCodeAt(0):!1}var ER={test:function(t){let e=t.length;for(let r=this.lastIndex;r<e;r++){let n=t.charCodeAt(r);if(n===10)return this.lastIndex=r+1,!0;if(n===13)return t.charCodeAt(r+1)===10?this.lastIndex=r+2:this.lastIndex=r+1,!0}return!1},lastIndex:0};function AR(t,e){if(V(t,"LINE_BREAKS"))return!1;if(Or(t.PATTERN)){try{Vl(e,t.PATTERN)}catch(r){return{issue:Qe.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(At(t.PATTERN))return!1;if(kR(t))return{issue:Qe.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function YM(t,e){if(e.issue===Qe.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
78
78
  The problem is in the <${t.name}> Token Type
79
79
  Root cause: ${e.errMsg}.
80
80
  For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===Qe.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
81
81
  The problem is in the <${t.name}> Token Type
82
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function wR(t){return j(t,r=>At(r)?r.charCodeAt(0):r)}function qp(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}var Hs=256,Xl=[];function xn(t){return t<Hs?t:Xl[t]}function YM(){if(ae(Xl)){Xl=new Array(65536);for(let t=0;t<65536;t++)Xl[t]=t>255?255+~~(t/255):t}}function Mn(t,e){let r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}function zs(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}var NR=1,IR={};function Fn(t){let e=JM(t);QM(e),e1(e),ZM(e),H(e,r=>{r.isParent=r.categoryMatches.length>0})}function JM(t){let e=qe(t),r=t,n=!0;for(;n;){r=gn(gt(j(r,o=>o.CATEGORIES)));let i=li(r,e);e=e.concat(i),ae(i)?n=!1:r=i}return e}function QM(t){H(t,e=>{Up(e)||(IR[NR]=e,e.tokenTypeIdx=NR++),PR(e)&&!X(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),PR(e)||(e.CATEGORIES=[]),t1(e)||(e.categoryMatches=[]),r1(e)||(e.categoryMatchesMap={})})}function ZM(t){H(t,e=>{e.categoryMatches=[],H(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(IR[n].tokenTypeIdx)})})}function e1(t){H(t,e=>{DR([],e)})}function DR(t,e){H(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),H(e.CATEGORIES,r=>{let n=t.concat(e);Je(n,r)||DR(n,r)})}function Up(t){return V(t,"tokenTypeIdx")}function PR(t){return V(t,"CATEGORIES")}function t1(t){return V(t,"categoryMatches")}function r1(t){return V(t,"categoryMatchesMap")}function OR(t){return V(t,"tokenTypeIdx")}var Vs={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}};var Qe;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(Qe||(Qe={}));var vc={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
82
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function wR(t){return j(t,r=>At(r)?r.charCodeAt(0):r)}function qp(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}var Hs=256,Xl=[];function xn(t){return t<Hs?t:Xl[t]}function JM(){if(ae(Xl)){Xl=new Array(65536);for(let t=0;t<65536;t++)Xl[t]=t>255?255+~~(t/255):t}}function Mn(t,e){let r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}function zs(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}var NR=1,IR={};function Fn(t){let e=QM(t);ZM(e),t1(e),e1(e),H(e,r=>{r.isParent=r.categoryMatches.length>0})}function QM(t){let e=qe(t),r=t,n=!0;for(;n;){r=gn(gt(j(r,o=>o.CATEGORIES)));let i=li(r,e);e=e.concat(i),ae(i)?n=!1:r=i}return e}function ZM(t){H(t,e=>{Up(e)||(IR[NR]=e,e.tokenTypeIdx=NR++),PR(e)&&!X(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),PR(e)||(e.CATEGORIES=[]),r1(e)||(e.categoryMatches=[]),n1(e)||(e.categoryMatchesMap={})})}function e1(t){H(t,e=>{e.categoryMatches=[],H(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(IR[n].tokenTypeIdx)})})}function t1(t){H(t,e=>{DR([],e)})}function DR(t,e){H(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),H(e.CATEGORIES,r=>{let n=t.concat(e);Je(n,r)||DR(n,r)})}function Up(t){return V(t,"tokenTypeIdx")}function PR(t){return V(t,"CATEGORIES")}function r1(t){return V(t,"categoryMatches")}function n1(t){return V(t,"categoryMatchesMap")}function OR(t){return V(t,"tokenTypeIdx")}var Vs={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}};var Qe;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(Qe||(Qe={}));var vc={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
83
83
  `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Vs,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(vc);var Ze=class{constructor(e,r=vc){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,o)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${i}>`);let{time:a,value:c}=mc(o),u=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${s}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,c}else return o()},typeof r=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
84
84
  a boolean 2nd argument is no longer supported`);this.config=Wt({},vc,r);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,o=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===vc.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ER;else if(this.config.lineTerminatorCharacters===vc.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
85
85
  For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(r.safeMode&&r.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),X(e)?i={modes:{defaultMode:qe(e)},defaultMode:Gs}:(o=!1,i=qe(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(_R(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(CR(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},H(i.modes,(a,c)=>{i.modes[c]=di(a,u=>Xt(u))});let s=Fe(i.modes);if(H(i.modes,(a,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(bR(a,s))}),ae(this.lexerDefinitionErrors)){Fn(a);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=RR(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=u.charCodeToPatternIdxToConfig,this.emptyGroups=Wt({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!ae(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let c=j(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
@@ -88,7 +88,7 @@ a boolean 2nd argument is no longer supported`);this.config=Wt({},vc,r);let n=th
88
88
  Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
89
89
  Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{mR()}),this.TRACE_INIT("toFastProperties",()=>{gc(this)})})}tokenize(e,r=this.defaultMode){if(!ae(this.lexerDefinitionErrors)){let i=j(this.lexerDefinitionErrors,o=>o.message).join(`-----------------------
90
90
  `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
91
- `+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,o,s,a,c,u,l,h,p,y,_,E,D,w,x,g=e,A=g.length,M=0,te=0,_e=this.hasCustom?0:Math.floor(e.length/10),Se=new Array(_e),Nt=[],xt=this.trackStartLines?1:void 0,$=this.trackStartLines?1:void 0,I=SR(this.emptyGroups),z=this.trackStartLines,W=this.config.lineTerminatorsPattern,le=0,Z=[],Q=[],at=[],B=[];Object.freeze(B);let N;function ke(){return Z}function en(pt){let jt=xn(pt),Wr=Q[jt];return Wr===void 0?B:Wr}let bo=pt=>{if(at.length===1&&pt.tokenType.PUSH_MODE===void 0){let jt=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(pt);Nt.push({offset:pt.startOffset,line:pt.startLine,column:pt.startColumn,length:pt.image.length,message:jt})}else{at.pop();let jt=yn(at);Z=this.patternIdxToConfig[jt],Q=this.charCodeToPatternIdxToConfig[jt],le=Z.length;let Wr=this.canModeBeOptimized[jt]&&this.config.safeMode===!1;Q&&Wr?N=en:N=ke}};function zn(pt){at.push(pt),Q=this.charCodeToPatternIdxToConfig[pt],Z=this.patternIdxToConfig[pt],le=Z.length,le=Z.length;let jt=this.canModeBeOptimized[pt]&&this.config.safeMode===!1;Q&&jt?N=en:N=ke}zn.call(this,r);let qt,Pi=this.config.recoveryEnabled;for(;M<A;){c=null;let pt=g.charCodeAt(M),jt=N(pt),Wr=jt.length;for(n=0;n<Wr;n++){qt=jt[n];let Pt=qt.pattern;u=null;let Gt=qt.short;if(Gt!==!1?pt===Gt&&(c=Pt):qt.isCustom===!0?(x=Pt.exec(g,M,Se,I),x!==null?(c=x[0],x.payload!==void 0&&(u=x.payload)):c=null):(this.updateLastIndex(Pt,M),c=this.match(Pt,e,M)),c!==null){if(a=qt.longerAlt,a!==void 0){let Tt=a.length;for(o=0;o<Tt;o++){let ar=Z[a[o]],wr=ar.pattern;if(l=null,ar.isCustom===!0?(x=wr.exec(g,M,Se,I),x!==null?(s=x[0],x.payload!==void 0&&(l=x.payload)):s=null):(this.updateLastIndex(wr,M),s=this.match(wr,e,M)),s&&s.length>c.length){c=s,u=l,qt=ar;break}}}break}}if(c!==null){if(h=c.length,p=qt.group,p!==void 0&&(y=qt.tokenTypeIdx,_=this.createTokenInstance(c,M,y,qt.tokenType,xt,$,h),this.handlePayload(_,u),p===!1?te=this.addToken(Se,te,_):I[p].push(_)),e=this.chopInput(e,h),M=M+h,$=this.computeNewColumn($,h),z===!0&&qt.canLineTerminator===!0){let Pt=0,Gt,Tt;W.lastIndex=0;do Gt=W.test(c),Gt===!0&&(Tt=W.lastIndex-1,Pt++);while(Gt===!0);Pt!==0&&(xt=xt+Pt,$=h-Tt,this.updateTokenEndLineColumnLocation(_,p,Tt,Pt,xt,$,h))}this.handleModes(qt,bo,zn,_)}else{let Pt=M,Gt=xt,Tt=$,ar=Pi===!1;for(;ar===!1&&M<A;)for(e=this.chopInput(e,1),M++,i=0;i<le;i++){let wr=Z[i],Br=wr.pattern,Ii=wr.short;if(Ii!==!1?g.charCodeAt(M)===Ii&&(ar=!0):wr.isCustom===!0?ar=Br.exec(g,M,Se,I)!==null:(this.updateLastIndex(Br,M),ar=Br.exec(e)!==null),ar===!0)break}if(E=M-Pt,$=this.computeNewColumn($,E),w=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(g,Pt,E,Gt,Tt),Nt.push({offset:Pt,line:Gt,column:Tt,length:E,message:w}),Pi===!1)break}}return this.hasCustom||(Se.length=te),{tokens:Se,groups:I,errors:Nt}}handleModes(e,r,n,i){if(e.pop===!0){let o=e.push;r(i),o!==void 0&&n.call(this,o)}else e.push!==void 0&&n.call(this,e.push)}chopInput(e,r){return e.substring(r)}updateLastIndex(e,r){e.lastIndex=r}updateTokenEndLineColumnLocation(e,r,n,i,o,s,a){let c,u;r!==void 0&&(c=n===a-1,u=c?-1:0,i===1&&c===!0||(e.endLine=o+u,e.endColumn=s-1+-u))}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,n,i){return{image:e,startOffset:r,tokenTypeIdx:n,tokenType:i}}createStartOnlyToken(e,r,n,i,o,s){return{image:e,startOffset:r,startLine:o,startColumn:s,tokenTypeIdx:n,tokenType:i}}createFullToken(e,r,n,i,o,s,a){return{image:e,startOffset:r,endOffset:r+a-1,startLine:o,endLine:o,startColumn:s,endColumn:s+a-1,tokenTypeIdx:n,tokenType:i}}addTokenUsingPush(e,r,n){return e.push(n),r}addTokenUsingMemberAccess(e,r,n){return e[r]=n,r++,r}handlePayloadNoCustom(e,r){}handlePayloadWithCustom(e,r){r!==null&&(e.payload=r)}matchWithTest(e,r,n){return e.test(r)===!0?r.substring(n,e.lastIndex):null}matchWithExec(e,r){let n=e.exec(r);return n!==null?n[0]:null}};Ze.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";Ze.NA=/NOT_APPLICABLE/;function $n(t){return Wp(t)?t.LABEL:t.name}function Wp(t){return At(t.LABEL)&&t.LABEL!==""}var n1="parent",LR="categories",MR="label",FR="group",$R="push_mode",qR="pop_mode",jR="longer_alt",UR="line_breaks",WR="start_chars_hint";function fi(t){return i1(t)}function i1(t){let e=t.pattern,r={};if(r.name=t.name,Xt(e)||(r.PATTERN=e),V(t,n1))throw`The parent property is no longer supported.
91
+ `+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,o,s,a,c,u,l,h,p,y,_,E,D,w,x,g=e,A=g.length,M=0,te=0,_e=this.hasCustom?0:Math.floor(e.length/10),Se=new Array(_e),Nt=[],xt=this.trackStartLines?1:void 0,$=this.trackStartLines?1:void 0,I=SR(this.emptyGroups),z=this.trackStartLines,W=this.config.lineTerminatorsPattern,le=0,Z=[],Q=[],at=[],B=[];Object.freeze(B);let N;function ke(){return Z}function en(pt){let jt=xn(pt),Wr=Q[jt];return Wr===void 0?B:Wr}let bo=pt=>{if(at.length===1&&pt.tokenType.PUSH_MODE===void 0){let jt=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(pt);Nt.push({offset:pt.startOffset,line:pt.startLine,column:pt.startColumn,length:pt.image.length,message:jt})}else{at.pop();let jt=yn(at);Z=this.patternIdxToConfig[jt],Q=this.charCodeToPatternIdxToConfig[jt],le=Z.length;let Wr=this.canModeBeOptimized[jt]&&this.config.safeMode===!1;Q&&Wr?N=en:N=ke}};function zn(pt){at.push(pt),Q=this.charCodeToPatternIdxToConfig[pt],Z=this.patternIdxToConfig[pt],le=Z.length,le=Z.length;let jt=this.canModeBeOptimized[pt]&&this.config.safeMode===!1;Q&&jt?N=en:N=ke}zn.call(this,r);let qt,Pi=this.config.recoveryEnabled;for(;M<A;){c=null;let pt=g.charCodeAt(M),jt=N(pt),Wr=jt.length;for(n=0;n<Wr;n++){qt=jt[n];let Pt=qt.pattern;u=null;let Gt=qt.short;if(Gt!==!1?pt===Gt&&(c=Pt):qt.isCustom===!0?(x=Pt.exec(g,M,Se,I),x!==null?(c=x[0],x.payload!==void 0&&(u=x.payload)):c=null):(this.updateLastIndex(Pt,M),c=this.match(Pt,e,M)),c!==null){if(a=qt.longerAlt,a!==void 0){let Tt=a.length;for(o=0;o<Tt;o++){let ar=Z[a[o]],wr=ar.pattern;if(l=null,ar.isCustom===!0?(x=wr.exec(g,M,Se,I),x!==null?(s=x[0],x.payload!==void 0&&(l=x.payload)):s=null):(this.updateLastIndex(wr,M),s=this.match(wr,e,M)),s&&s.length>c.length){c=s,u=l,qt=ar;break}}}break}}if(c!==null){if(h=c.length,p=qt.group,p!==void 0&&(y=qt.tokenTypeIdx,_=this.createTokenInstance(c,M,y,qt.tokenType,xt,$,h),this.handlePayload(_,u),p===!1?te=this.addToken(Se,te,_):I[p].push(_)),e=this.chopInput(e,h),M=M+h,$=this.computeNewColumn($,h),z===!0&&qt.canLineTerminator===!0){let Pt=0,Gt,Tt;W.lastIndex=0;do Gt=W.test(c),Gt===!0&&(Tt=W.lastIndex-1,Pt++);while(Gt===!0);Pt!==0&&(xt=xt+Pt,$=h-Tt,this.updateTokenEndLineColumnLocation(_,p,Tt,Pt,xt,$,h))}this.handleModes(qt,bo,zn,_)}else{let Pt=M,Gt=xt,Tt=$,ar=Pi===!1;for(;ar===!1&&M<A;)for(e=this.chopInput(e,1),M++,i=0;i<le;i++){let wr=Z[i],Br=wr.pattern,Ii=wr.short;if(Ii!==!1?g.charCodeAt(M)===Ii&&(ar=!0):wr.isCustom===!0?ar=Br.exec(g,M,Se,I)!==null:(this.updateLastIndex(Br,M),ar=Br.exec(e)!==null),ar===!0)break}if(E=M-Pt,$=this.computeNewColumn($,E),w=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(g,Pt,E,Gt,Tt),Nt.push({offset:Pt,line:Gt,column:Tt,length:E,message:w}),Pi===!1)break}}return this.hasCustom||(Se.length=te),{tokens:Se,groups:I,errors:Nt}}handleModes(e,r,n,i){if(e.pop===!0){let o=e.push;r(i),o!==void 0&&n.call(this,o)}else e.push!==void 0&&n.call(this,e.push)}chopInput(e,r){return e.substring(r)}updateLastIndex(e,r){e.lastIndex=r}updateTokenEndLineColumnLocation(e,r,n,i,o,s,a){let c,u;r!==void 0&&(c=n===a-1,u=c?-1:0,i===1&&c===!0||(e.endLine=o+u,e.endColumn=s-1+-u))}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,n,i){return{image:e,startOffset:r,tokenTypeIdx:n,tokenType:i}}createStartOnlyToken(e,r,n,i,o,s){return{image:e,startOffset:r,startLine:o,startColumn:s,tokenTypeIdx:n,tokenType:i}}createFullToken(e,r,n,i,o,s,a){return{image:e,startOffset:r,endOffset:r+a-1,startLine:o,endLine:o,startColumn:s,endColumn:s+a-1,tokenTypeIdx:n,tokenType:i}}addTokenUsingPush(e,r,n){return e.push(n),r}addTokenUsingMemberAccess(e,r,n){return e[r]=n,r++,r}handlePayloadNoCustom(e,r){}handlePayloadWithCustom(e,r){r!==null&&(e.payload=r)}matchWithTest(e,r,n){return e.test(r)===!0?r.substring(n,e.lastIndex):null}matchWithExec(e,r){let n=e.exec(r);return n!==null?n[0]:null}};Ze.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";Ze.NA=/NOT_APPLICABLE/;function $n(t){return Wp(t)?t.LABEL:t.name}function Wp(t){return At(t.LABEL)&&t.LABEL!==""}var i1="parent",LR="categories",MR="label",FR="group",$R="push_mode",qR="pop_mode",jR="longer_alt",UR="line_breaks",WR="start_chars_hint";function fi(t){return o1(t)}function o1(t){let e=t.pattern,r={};if(r.name=t.name,Xt(e)||(r.PATTERN=e),V(t,i1))throw`The parent property is no longer supported.
92
92
  See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return V(t,LR)&&(r.CATEGORIES=t[LR]),Fn([r]),V(t,MR)&&(r.LABEL=t[MR]),V(t,FR)&&(r.GROUP=t[FR]),V(t,qR)&&(r.POP_MODE=t[qR]),V(t,$R)&&(r.PUSH_MODE=t[$R]),V(t,jR)&&(r.LONGER_ALT=t[jR]),V(t,UR)&&(r.LINE_BREAKS=t[UR]),V(t,WR)&&(r.START_CHARS_HINT=t[WR]),r}var kr=fi({name:"EOF",pattern:Ze.NA});Fn([kr]);function qn(t,e,r,n,i,o,s,a){return{image:e,startOffset:r,endOffset:n,startLine:i,endLine:o,startColumn:s,endColumn:a,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function xc(t,e){return Mn(t,e)}var jn={buildMismatchTokenMessage({expected:t,actual:e,previous:r,ruleName:n}){return`Expecting ${Wp(t)?`--> ${$n(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:r,customUserDescription:n,ruleName:i}){let o="Expecting: ",a=`
93
93
  but found: '`+Lt(e).image+"'";if(n)return o+n+a;{let c=it(t,(p,y)=>p.concat(y),[]),u=j(c,p=>`[${j(p,y=>$n(y)).join(", ")}]`),h=`one of these possible Token sequences:
94
94
  ${j(u,(p,y)=>` ${y+1}. ${p}`).join(`
@@ -119,11 +119,11 @@ rule: <${e}> can be invoked from itself (directly or indirectly)
119
119
  without consuming any Tokens. The grammar path that causes this is:
120
120
  ${n}
121
121
  To fix this refactor your grammar to remove the left recursion.
122
- see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof nr?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function HR(t,e){let r=new Bp(t,e);return r.resolveRefs(),r.errors}var Bp=class extends ir{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){H(Pe(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:wt.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var Hp=class extends Ln{constructor(e,r){super(),this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=qe(this.path.ruleStack).reverse(),this.occurrenceStack=qe(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){this.found||super.walk(e,r)}walkProdRef(e,r,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){ae(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},Yl=class extends Hp{constructor(e,r){super(e,r),this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=r.concat(n),o=new je({definition:i});this.possibleTokTypes=Yi(o),this.found=!0}}},Ks=class extends Ln{constructor(e,r){super(),this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Jl=class extends Ks{walkMany(e,r,n){if(e.idx===this.occurrence){let i=Lt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}},Tc=class extends Ks{walkManySep(e,r,n){if(e.idx===this.occurrence){let i=Lt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}},Ql=class extends Ks{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let i=Lt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}},Rc=class extends Ks{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let i=Lt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}};function Zl(t,e,r=[]){r=qe(r);let n=[],i=0;function o(a){return a.concat(yt(t,i+1))}function s(a){let c=Zl(o(a),e,r);return n.concat(c)}for(;r.length<e&&i<t.length;){let a=t[i];if(a instanceof je)return s(a.definition);if(a instanceof Ae)return s(a.definition);if(a instanceof we)n=s(a.definition);else if(a instanceof Ue){let c=a.definition.concat([new pe({definition:a.definition})]);return s(c)}else if(a instanceof We){let c=[new je({definition:a.definition}),new pe({definition:[new ue({terminalType:a.separator})].concat(a.definition)})];return s(c)}else if(a instanceof De){let c=a.definition.concat([new pe({definition:[new ue({terminalType:a.separator})].concat(a.definition)})]);n=s(c)}else if(a instanceof pe){let c=a.definition.concat([new pe({definition:a.definition})]);n=s(c)}else{if(a instanceof Oe)return H(a.definition,c=>{ae(c.definition)===!1&&(n=s(c.definition))}),n;if(a instanceof ue)r.push(a.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:yt(t,i)}),n}function ed(t,e,r,n){let i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE",a=!1,c=e.length,u=c-n-1,l=[],h=[];for(h.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!ae(h);){let p=h.pop();if(p===s){a&&yn(h).idx<=u&&h.pop();continue}let y=p.def,_=p.idx,E=p.ruleStack,D=p.occurrenceStack;if(ae(y))continue;let w=y[0];if(w===i){let x={idx:_,def:yt(y),ruleStack:On(E),occurrenceStack:On(D)};h.push(x)}else if(w instanceof ue)if(_<c-1){let x=_+1,g=e[x];if(r(g,w.terminalType)){let A={idx:x,def:yt(y),ruleStack:E,occurrenceStack:D};h.push(A)}}else if(_===c-1)l.push({nextTokenType:w.terminalType,nextTokenOccurrence:w.idx,ruleStack:E,occurrenceStack:D}),a=!0;else throw Error("non exhaustive match");else if(w instanceof Ae){let x=qe(E);x.push(w.nonTerminalName);let g=qe(D);g.push(w.idx);let A={idx:_,def:w.definition.concat(o,yt(y)),ruleStack:x,occurrenceStack:g};h.push(A)}else if(w instanceof we){let x={idx:_,def:yt(y),ruleStack:E,occurrenceStack:D};h.push(x),h.push(s);let g={idx:_,def:w.definition.concat(yt(y)),ruleStack:E,occurrenceStack:D};h.push(g)}else if(w instanceof Ue){let x=new pe({definition:w.definition,idx:w.idx}),g=w.definition.concat([x],yt(y)),A={idx:_,def:g,ruleStack:E,occurrenceStack:D};h.push(A)}else if(w instanceof We){let x=new ue({terminalType:w.separator}),g=new pe({definition:[x].concat(w.definition),idx:w.idx}),A=w.definition.concat([g],yt(y)),M={idx:_,def:A,ruleStack:E,occurrenceStack:D};h.push(M)}else if(w instanceof De){let x={idx:_,def:yt(y),ruleStack:E,occurrenceStack:D};h.push(x),h.push(s);let g=new ue({terminalType:w.separator}),A=new pe({definition:[g].concat(w.definition),idx:w.idx}),M=w.definition.concat([A],yt(y)),te={idx:_,def:M,ruleStack:E,occurrenceStack:D};h.push(te)}else if(w instanceof pe){let x={idx:_,def:yt(y),ruleStack:E,occurrenceStack:D};h.push(x),h.push(s);let g=new pe({definition:w.definition,idx:w.idx}),A=w.definition.concat([g],yt(y)),M={idx:_,def:A,ruleStack:E,occurrenceStack:D};h.push(M)}else if(w instanceof Oe)for(let x=w.definition.length-1;x>=0;x--){let g=w.definition[x],A={idx:_,def:g.definition.concat(yt(y)),ruleStack:E,occurrenceStack:D};h.push(A),h.push(s)}else if(w instanceof je)h.push({idx:_,def:w.definition.concat(yt(y)),ruleStack:E,occurrenceStack:D});else if(w instanceof nr)h.push(o1(w,_,E,D));else throw Error("non exhaustive match")}return l}function o1(t,e,r,n){let i=qe(r);i.push(t.name);let o=qe(n);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var et;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(et||(et={}));function bc(t){if(t instanceof we||t==="Option")return et.OPTION;if(t instanceof pe||t==="Repetition")return et.REPETITION;if(t instanceof Ue||t==="RepetitionMandatory")return et.REPETITION_MANDATORY;if(t instanceof We||t==="RepetitionMandatoryWithSeparator")return et.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof De||t==="RepetitionWithSeparator")return et.REPETITION_WITH_SEPARATOR;if(t instanceof Oe||t==="Alternation")return et.ALTERNATION;throw Error("non exhaustive match")}function rd(t){let{occurrence:e,rule:r,prodType:n,maxLookahead:i}=t,o=bc(n);return o===et.ALTERNATION?Xs(e,r,i):Ys(e,r,o,i)}function zR(t,e,r,n,i,o){let s=Xs(t,e,r),a=QR(s)?zs:Mn;return o(s,n,a,i)}function VR(t,e,r,n,i,o){let s=Ys(t,e,i,r),a=QR(s)?zs:Mn;return o(s[0],a,n)}function KR(t,e,r,n){let i=t.length,o=Kt(t,s=>Kt(s,a=>a.length===1));if(e)return function(s){let a=j(s,c=>c.GATE);for(let c=0;c<i;c++){let u=t[c],l=u.length,h=a[c];if(!(h!==void 0&&h.call(this)===!1))e:for(let p=0;p<l;p++){let y=u[p],_=y.length;for(let E=0;E<_;E++){let D=this.LA(E+1);if(r(D,y[E])===!1)continue e}return c}}};if(o&&!n){let s=j(t,c=>gt(c)),a=it(s,(c,u,l)=>(H(u,h=>{V(c,h.tokenTypeIdx)||(c[h.tokenTypeIdx]=l),H(h.categoryMatches,p=>{V(c,p)||(c[p]=l)})}),c),{});return function(){let c=this.LA(1);return a[c.tokenTypeIdx]}}else return function(){for(let s=0;s<i;s++){let a=t[s],c=a.length;e:for(let u=0;u<c;u++){let l=a[u],h=l.length;for(let p=0;p<h;p++){let y=this.LA(p+1);if(r(y,l[p])===!1)continue e}return s}}}}function XR(t,e,r){let n=Kt(t,o=>o.length===1),i=t.length;if(n&&!r){let o=gt(t);if(o.length===1&&ae(o[0].categoryMatches)){let a=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{let s=it(o,(a,c,u)=>(a[c.tokenTypeIdx]=!0,H(c.categoryMatches,l=>{a[l]=!0}),a),[]);return function(){let a=this.LA(1);return s[a.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let s=t[o],a=s.length;for(let c=0;c<a;c++){let u=this.LA(c+1);if(e(u,s[c])===!1)continue e}return!0}return!1}}var zp=class extends Ln{constructor(e,r,n){super(),this.topProd=e,this.targetOccurrence=r,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===r?(this.restDef=n.concat(i),!0):!1}walkOption(e,r,n){this.checkIsTarget(e,et.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,et.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,et.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,et.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,et.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},td=class extends ir{constructor(e,r,n){super(),this.targetOccurrence=e,this.targetProdType=r,this.targetRef=n,this.result=[]}checkIsTarget(e,r){e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,et.OPTION)}visitRepetition(e){this.checkIsTarget(e,et.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,et.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,et.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,et.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,et.ALTERNATION)}};function GR(t){let e=new Array(t);for(let r=0;r<t;r++)e[r]=[];return e}function Gp(t){let e=[""];for(let r=0;r<t.length;r++){let n=t[r],i=[];for(let o=0;o<e.length;o++){let s=e[o];i.push(s+"_"+n.tokenTypeIdx);for(let a=0;a<n.categoryMatches.length;a++){let c="_"+n.categoryMatches[a];i.push(s+c)}}e=i}return e}function s1(t,e,r){for(let n=0;n<t.length;n++){if(n===r)continue;let i=t[n];for(let o=0;o<e.length;o++){let s=e[o];if(i[s]===!0)return!1}}return!0}function YR(t,e){let r=j(t,s=>Zl([s],1)),n=GR(r.length),i=j(r,s=>{let a={};return H(s,c=>{let u=Gp(c.partialPath);H(u,l=>{a[l]=!0})}),a}),o=r;for(let s=1;s<=e;s++){let a=o;o=GR(a.length);for(let c=0;c<a.length;c++){let u=a[c];for(let l=0;l<u.length;l++){let h=u[l].partialPath,p=u[l].suffixDef,y=Gp(h);if(s1(i,y,c)||ae(p)||h.length===e){let E=n[c];if(nd(E,h)===!1){E.push(h);for(let D=0;D<y.length;D++){let w=y[D];i[c][w]=!0}}}else{let E=Zl(p,s+1,h);o[c]=o[c].concat(E),H(E,D=>{let w=Gp(D.partialPath);H(w,x=>{i[c][x]=!0})})}}}}return n}function Xs(t,e,r,n){let i=new td(t,et.ALTERNATION,n);return e.accept(i),YR(i.result,r)}function Ys(t,e,r,n){let i=new td(t,r);e.accept(i);let o=i.result,a=new zp(e,t,r).startWalking(),c=new je({definition:o}),u=new je({definition:a});return YR([c,u],n)}function nd(t,e){e:for(let r=0;r<t.length;r++){let n=t[r];if(n.length===e.length){for(let i=0;i<n.length;i++){let o=e[i],s=n[i];if((o===s||s.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function JR(t,e){return t.length<e.length&&Kt(t,(r,n)=>{let i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function QR(t){return Kt(t,e=>Kt(e,r=>Kt(r,n=>ae(n.categoryMatches))))}function ZR(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return j(e,r=>Object.assign({type:wt.CUSTOM_LOOKAHEAD_VALIDATION},r))}function eb(t,e,r,n){let i=Bt(t,c=>a1(c,r)),o=h1(t,e,r),s=Bt(t,c=>l1(c,r)),a=Bt(t,c=>u1(c,t,n,r));return i.concat(o,s,a)}function a1(t,e){let r=new Vp;t.accept(r);let n=r.allProductions,i=Ip(n,c1),o=hr(i,a=>a.length>1);return j(Pe(o),a=>{let c=Lt(a),u=e.buildDuplicateFoundError(t,a),l=pr(c),h={message:u,type:wt.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:c.idx},p=tb(c);return p&&(h.parameter=p),h})}function c1(t){return`${pr(t)}_#_${t.idx}_#_${tb(t)}`}function tb(t){return t instanceof ue?t.terminalType.name:t instanceof Ae?t.nonTerminalName:""}var Vp=class extends ir{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function u1(t,e,r,n){let i=[];if(it(e,(s,a)=>a.name===t.name?s+1:s,0)>1){let s=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});i.push({message:s,type:wt.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function rb(t,e,r){let n=[],i;return Je(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:wt.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Xp(t,e,r,n=[]){let i=[],o=id(e.definition);if(ae(o))return[];{let s=t.name;Je(o,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:wt.LEFT_RECURSION,ruleName:s});let c=li(o,n.concat([t])),u=Bt(c,l=>{let h=qe(n);return h.push(l),Xp(t,l,r,h)});return i.concat(u)}}function id(t){let e=[];if(ae(t))return e;let r=Lt(t);if(r instanceof Ae)e.push(r.referencedRule);else if(r instanceof je||r instanceof we||r instanceof Ue||r instanceof We||r instanceof De||r instanceof pe)e=e.concat(id(r.definition));else if(r instanceof Oe)e=gt(j(r.definition,o=>id(o.definition)));else if(!(r instanceof ue))throw Error("non exhaustive match");let n=Xi(r),i=t.length>1;if(n&&i){let o=yt(t);return e.concat(id(o))}else return e}var _c=class extends ir{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function nb(t,e){let r=new _c;t.accept(r);let n=r.alternations;return Bt(n,o=>{let s=On(o.definition);return Bt(s,(a,c)=>{let u=ed([a],[],Mn,1);return ae(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:o,emptyChoiceIdx:c}),type:wt.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:o.idx,alternative:c+1}]:[]})})}function ib(t,e,r){let n=new _c;t.accept(n);let i=n.alternations;return i=di(i,s=>s.ignoreAmbiguities===!0),Bt(i,s=>{let a=s.idx,c=s.maxLookahead||e,u=Xs(a,t,c,s),l=d1(u,s,t,r),h=f1(u,s,t,r);return l.concat(h)})}var Kp=class extends ir{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function l1(t,e){let r=new _c;t.accept(r);let n=r.alternations;return Bt(n,o=>o.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:o}),type:wt.TOO_MANY_ALTS,ruleName:t.name,occurrence:o.idx}]:[])}function ob(t,e,r){let n=[];return H(t,i=>{let o=new Kp;i.accept(o);let s=o.allProductions;H(s,a=>{let c=bc(a),u=a.maxLookahead||e,l=a.idx,p=Ys(l,i,c,u)[0];if(ae(gt(p))){let y=r.buildEmptyRepetitionError({topLevelRule:i,repetition:a});n.push({message:y,type:wt.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function d1(t,e,r,n){let i=[],o=it(t,(a,c,u)=>(e.definition[u].ignoreAmbiguities===!0||H(c,l=>{let h=[u];H(t,(p,y)=>{u!==y&&nd(p,l)&&e.definition[y].ignoreAmbiguities!==!0&&h.push(y)}),h.length>1&&!nd(i,l)&&(i.push(l),a.push({alts:h,path:l}))}),a),[]);return j(o,a=>{let c=j(a.alts,l=>l+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:wt.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:a.alts}})}function f1(t,e,r,n){let i=it(t,(s,a,c)=>{let u=j(a,l=>({idx:c,path:l}));return s.concat(u)},[]);return gn(Bt(i,s=>{if(e.definition[s.idx].ignoreAmbiguities===!0)return[];let c=s.idx,u=s.path,l=Ot(i,p=>e.definition[p.idx].ignoreAmbiguities!==!0&&p.idx<c&&JR(p.path,u));return j(l,p=>{let y=[p.idx+1,c+1],_=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:y,prefixPath:p.path}),type:wt.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:_,alternatives:y}})}))}function h1(t,e,r){let n=[],i=j(e,o=>o.name);return H(t,o=>{let s=o.name;if(Je(i,s)){let a=r.buildNamespaceConflictError(o);n.push({message:a,type:wt.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),n}function sb(t){let e=qs(t,{errMsgProvider:BR}),r={};return H(t.rules,n=>{r[n.name]=n}),HR(r,e.errMsgProvider)}function ab(t){return t=qs(t,{errMsgProvider:Xr}),eb(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var cb="MismatchedTokenException",ub="NoViableAltException",lb="EarlyExitException",db="NotAllInputParsedException",fb=[cb,ub,lb,db];Object.freeze(fb);function hi(t){return Je(fb,t.name)}var Js=class extends Error{constructor(e,r){super(e),this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},Qi=class extends Js{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=cb}},Cc=class extends Js{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=ub}},Sc=class extends Js{constructor(e,r){super(e,r),this.name=db}},kc=class extends Js{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=lb}};var Yp={},Qp="InRuleRecoveryException",Jp=class extends Error{constructor(e){super(e),this.name=Qp}},od=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=V(e,"recoveryEnabled")?e.recoveryEnabled:or.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=p1)}getTokenToInsert(e){let r=qn(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,n,i){let o=this.findReSyncTokenType(),s=this.exportLexerState(),a=[],c=!1,u=this.LA(1),l=this.LA(1),h=()=>{let p=this.LA(0),y=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:p,ruleName:this.getCurrRuleFullName()}),_=new Qi(y,u,this.LA(0));_.resyncedTokens=On(a),this.SAVE_ERROR(_)};for(;!c;)if(this.tokenMatcher(l,i)){h();return}else if(n.call(this)){h(),e.apply(this,r);return}else this.tokenMatcher(l,o)?c=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,a));this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,r,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))}getFollowsForInRuleRecovery(e,r){let n=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Jp("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||ae(r))return!1;let n=this.LA(1);return vn(r,o=>this.tokenMatcher(n,o))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(r);return Je(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let i=vn(e,o=>xc(r,o));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Yp;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return j(e,(n,i)=>i===0?Yp:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=j(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return gt(e)}getFollowSetFromFollowKey(e){if(e===Yp)return[kr];let r=e.ruleName+e.idxInCallingRule+Hl+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,kr)||r.push(e),r}reSyncTo(e){let r=[],n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,r);return On(r)}attemptInRepetitionRecovery(e,r,n,i,o,s,a){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),i=qe(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return j(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function p1(t,e,r,n,i,o,s){let a=this.getKeyForAutomaticLookahead(n,i),c=this.firstAfterRepMap[a];if(c===void 0){let p=this.getCurrRuleFullName(),y=this.getGAstProductions()[p];c=new o(y,i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence,h=c.isEndOfRule;this.RULE_STACK.length===1&&h&&u===void 0&&(u=kr,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(t,e,r,u)}function sd(t,e,r){return r|e|t}var Un=class{constructor(e){var r;this.maxLookahead=(r=e?.maxLookahead)!==null&&r!==void 0?r:or.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(ae(r)){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...n,...i,...o]}return r}validateNoLeftRecursion(e){return Bt(e,r=>Xp(r,r,Xr))}validateEmptyOrAlternatives(e){return Bt(e,r=>nb(r,Xr))}validateAmbiguousAlternationAlternatives(e,r){return Bt(e,n=>ib(n,r,Xr))}validateSomeNonEmptyLookaheadPath(e,r){return ob(e,r,Xr)}buildLookaheadForAlternation(e){return zR(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,KR)}buildLookaheadForOptional(e){return VR(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,bc(e.prodType),XR)}};var cd=class{initLooksAhead(e){this.dynamicTokensEnabled=V(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:or.dynamicTokensEnabled,this.maxLookahead=V(e,"maxLookahead")?e.maxLookahead:or.maxLookahead,this.lookaheadStrategy=V(e,"lookaheadStrategy")?e.lookaheadStrategy:new Un({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){H(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:o,repetitionMandatory:s,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=m1(r);H(n,u=>{let l=u.idx===0?"":u.idx;this.TRACE_INIT(`${pr(u)}${l}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:r,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),p=sd(this.fullRuleNameToShort[r.name],256,u.idx);this.setLaFuncCache(p,h)})}),H(i,u=>{this.computeLookaheadFunc(r,u.idx,768,"Repetition",u.maxLookahead,pr(u))}),H(o,u=>{this.computeLookaheadFunc(r,u.idx,512,"Option",u.maxLookahead,pr(u))}),H(s,u=>{this.computeLookaheadFunc(r,u.idx,1024,"RepetitionMandatory",u.maxLookahead,pr(u))}),H(a,u=>{this.computeLookaheadFunc(r,u.idx,1536,"RepetitionMandatoryWithSeparator",u.maxLookahead,pr(u))}),H(c,u=>{this.computeLookaheadFunc(r,u.idx,1280,"RepetitionWithSeparator",u.maxLookahead,pr(u))})})})}computeLookaheadFunc(e,r,n,i,o,s){this.TRACE_INIT(`${s}${r===0?"":r}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:o||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),c=sd(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(c,a)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return sd(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},Zp=class extends ir{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},ad=new Zp;function m1(t){ad.reset(),t.accept(ad);let e=ad.dslMethods;return ad.reset(),e}function rm(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function nm(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function hb(t,e,r){t.children[r]===void 0?t.children[r]=[e]:t.children[r].push(e)}function pb(t,e,r){t.children[e]===void 0?t.children[e]=[r]:t.children[e].push(r)}var g1="name";function im(t,e){Object.defineProperty(t,g1,{enumerable:!1,configurable:!0,writable:!1,value:e})}function y1(t,e){let r=Fe(t),n=r.length;for(let i=0;i<n;i++){let o=r[i],s=t[o],a=s.length;for(let c=0;c<a;c++){let u=s[c];u.tokenTypeIdx===void 0&&this[u.name](u.children,e)}}}function mb(t,e){let r=function(){};im(r,t+"BaseSemantics");let n={visit:function(i,o){if(X(i)&&(i=i[0]),!Xt(i))return this[i.name](i.children,o)},validateVisitor:function(){let i=v1(this,e);if(!ae(i)){let o=j(i,s=>s.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
122
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof nr?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function HR(t,e){let r=new Bp(t,e);return r.resolveRefs(),r.errors}var Bp=class extends ir{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){H(Pe(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:wt.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var Hp=class extends Ln{constructor(e,r){super(),this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=qe(this.path.ruleStack).reverse(),this.occurrenceStack=qe(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){this.found||super.walk(e,r)}walkProdRef(e,r,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){ae(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},Yl=class extends Hp{constructor(e,r){super(e,r),this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=r.concat(n),o=new je({definition:i});this.possibleTokTypes=Yi(o),this.found=!0}}},Ks=class extends Ln{constructor(e,r){super(),this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Jl=class extends Ks{walkMany(e,r,n){if(e.idx===this.occurrence){let i=Lt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}},Tc=class extends Ks{walkManySep(e,r,n){if(e.idx===this.occurrence){let i=Lt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}},Ql=class extends Ks{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let i=Lt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}},Rc=class extends Ks{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let i=Lt(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}};function Zl(t,e,r=[]){r=qe(r);let n=[],i=0;function o(a){return a.concat(yt(t,i+1))}function s(a){let c=Zl(o(a),e,r);return n.concat(c)}for(;r.length<e&&i<t.length;){let a=t[i];if(a instanceof je)return s(a.definition);if(a instanceof Ae)return s(a.definition);if(a instanceof we)n=s(a.definition);else if(a instanceof Ue){let c=a.definition.concat([new pe({definition:a.definition})]);return s(c)}else if(a instanceof We){let c=[new je({definition:a.definition}),new pe({definition:[new ue({terminalType:a.separator})].concat(a.definition)})];return s(c)}else if(a instanceof De){let c=a.definition.concat([new pe({definition:[new ue({terminalType:a.separator})].concat(a.definition)})]);n=s(c)}else if(a instanceof pe){let c=a.definition.concat([new pe({definition:a.definition})]);n=s(c)}else{if(a instanceof Oe)return H(a.definition,c=>{ae(c.definition)===!1&&(n=s(c.definition))}),n;if(a instanceof ue)r.push(a.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:yt(t,i)}),n}function ed(t,e,r,n){let i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE",a=!1,c=e.length,u=c-n-1,l=[],h=[];for(h.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!ae(h);){let p=h.pop();if(p===s){a&&yn(h).idx<=u&&h.pop();continue}let y=p.def,_=p.idx,E=p.ruleStack,D=p.occurrenceStack;if(ae(y))continue;let w=y[0];if(w===i){let x={idx:_,def:yt(y),ruleStack:On(E),occurrenceStack:On(D)};h.push(x)}else if(w instanceof ue)if(_<c-1){let x=_+1,g=e[x];if(r(g,w.terminalType)){let A={idx:x,def:yt(y),ruleStack:E,occurrenceStack:D};h.push(A)}}else if(_===c-1)l.push({nextTokenType:w.terminalType,nextTokenOccurrence:w.idx,ruleStack:E,occurrenceStack:D}),a=!0;else throw Error("non exhaustive match");else if(w instanceof Ae){let x=qe(E);x.push(w.nonTerminalName);let g=qe(D);g.push(w.idx);let A={idx:_,def:w.definition.concat(o,yt(y)),ruleStack:x,occurrenceStack:g};h.push(A)}else if(w instanceof we){let x={idx:_,def:yt(y),ruleStack:E,occurrenceStack:D};h.push(x),h.push(s);let g={idx:_,def:w.definition.concat(yt(y)),ruleStack:E,occurrenceStack:D};h.push(g)}else if(w instanceof Ue){let x=new pe({definition:w.definition,idx:w.idx}),g=w.definition.concat([x],yt(y)),A={idx:_,def:g,ruleStack:E,occurrenceStack:D};h.push(A)}else if(w instanceof We){let x=new ue({terminalType:w.separator}),g=new pe({definition:[x].concat(w.definition),idx:w.idx}),A=w.definition.concat([g],yt(y)),M={idx:_,def:A,ruleStack:E,occurrenceStack:D};h.push(M)}else if(w instanceof De){let x={idx:_,def:yt(y),ruleStack:E,occurrenceStack:D};h.push(x),h.push(s);let g=new ue({terminalType:w.separator}),A=new pe({definition:[g].concat(w.definition),idx:w.idx}),M=w.definition.concat([A],yt(y)),te={idx:_,def:M,ruleStack:E,occurrenceStack:D};h.push(te)}else if(w instanceof pe){let x={idx:_,def:yt(y),ruleStack:E,occurrenceStack:D};h.push(x),h.push(s);let g=new pe({definition:w.definition,idx:w.idx}),A=w.definition.concat([g],yt(y)),M={idx:_,def:A,ruleStack:E,occurrenceStack:D};h.push(M)}else if(w instanceof Oe)for(let x=w.definition.length-1;x>=0;x--){let g=w.definition[x],A={idx:_,def:g.definition.concat(yt(y)),ruleStack:E,occurrenceStack:D};h.push(A),h.push(s)}else if(w instanceof je)h.push({idx:_,def:w.definition.concat(yt(y)),ruleStack:E,occurrenceStack:D});else if(w instanceof nr)h.push(s1(w,_,E,D));else throw Error("non exhaustive match")}return l}function s1(t,e,r,n){let i=qe(r);i.push(t.name);let o=qe(n);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var et;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(et||(et={}));function bc(t){if(t instanceof we||t==="Option")return et.OPTION;if(t instanceof pe||t==="Repetition")return et.REPETITION;if(t instanceof Ue||t==="RepetitionMandatory")return et.REPETITION_MANDATORY;if(t instanceof We||t==="RepetitionMandatoryWithSeparator")return et.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof De||t==="RepetitionWithSeparator")return et.REPETITION_WITH_SEPARATOR;if(t instanceof Oe||t==="Alternation")return et.ALTERNATION;throw Error("non exhaustive match")}function rd(t){let{occurrence:e,rule:r,prodType:n,maxLookahead:i}=t,o=bc(n);return o===et.ALTERNATION?Xs(e,r,i):Ys(e,r,o,i)}function zR(t,e,r,n,i,o){let s=Xs(t,e,r),a=QR(s)?zs:Mn;return o(s,n,a,i)}function VR(t,e,r,n,i,o){let s=Ys(t,e,i,r),a=QR(s)?zs:Mn;return o(s[0],a,n)}function KR(t,e,r,n){let i=t.length,o=Kt(t,s=>Kt(s,a=>a.length===1));if(e)return function(s){let a=j(s,c=>c.GATE);for(let c=0;c<i;c++){let u=t[c],l=u.length,h=a[c];if(!(h!==void 0&&h.call(this)===!1))e:for(let p=0;p<l;p++){let y=u[p],_=y.length;for(let E=0;E<_;E++){let D=this.LA(E+1);if(r(D,y[E])===!1)continue e}return c}}};if(o&&!n){let s=j(t,c=>gt(c)),a=it(s,(c,u,l)=>(H(u,h=>{V(c,h.tokenTypeIdx)||(c[h.tokenTypeIdx]=l),H(h.categoryMatches,p=>{V(c,p)||(c[p]=l)})}),c),{});return function(){let c=this.LA(1);return a[c.tokenTypeIdx]}}else return function(){for(let s=0;s<i;s++){let a=t[s],c=a.length;e:for(let u=0;u<c;u++){let l=a[u],h=l.length;for(let p=0;p<h;p++){let y=this.LA(p+1);if(r(y,l[p])===!1)continue e}return s}}}}function XR(t,e,r){let n=Kt(t,o=>o.length===1),i=t.length;if(n&&!r){let o=gt(t);if(o.length===1&&ae(o[0].categoryMatches)){let a=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{let s=it(o,(a,c,u)=>(a[c.tokenTypeIdx]=!0,H(c.categoryMatches,l=>{a[l]=!0}),a),[]);return function(){let a=this.LA(1);return s[a.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let s=t[o],a=s.length;for(let c=0;c<a;c++){let u=this.LA(c+1);if(e(u,s[c])===!1)continue e}return!0}return!1}}var zp=class extends Ln{constructor(e,r,n){super(),this.topProd=e,this.targetOccurrence=r,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===r?(this.restDef=n.concat(i),!0):!1}walkOption(e,r,n){this.checkIsTarget(e,et.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,et.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,et.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,et.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,et.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},td=class extends ir{constructor(e,r,n){super(),this.targetOccurrence=e,this.targetProdType=r,this.targetRef=n,this.result=[]}checkIsTarget(e,r){e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,et.OPTION)}visitRepetition(e){this.checkIsTarget(e,et.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,et.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,et.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,et.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,et.ALTERNATION)}};function GR(t){let e=new Array(t);for(let r=0;r<t;r++)e[r]=[];return e}function Gp(t){let e=[""];for(let r=0;r<t.length;r++){let n=t[r],i=[];for(let o=0;o<e.length;o++){let s=e[o];i.push(s+"_"+n.tokenTypeIdx);for(let a=0;a<n.categoryMatches.length;a++){let c="_"+n.categoryMatches[a];i.push(s+c)}}e=i}return e}function a1(t,e,r){for(let n=0;n<t.length;n++){if(n===r)continue;let i=t[n];for(let o=0;o<e.length;o++){let s=e[o];if(i[s]===!0)return!1}}return!0}function YR(t,e){let r=j(t,s=>Zl([s],1)),n=GR(r.length),i=j(r,s=>{let a={};return H(s,c=>{let u=Gp(c.partialPath);H(u,l=>{a[l]=!0})}),a}),o=r;for(let s=1;s<=e;s++){let a=o;o=GR(a.length);for(let c=0;c<a.length;c++){let u=a[c];for(let l=0;l<u.length;l++){let h=u[l].partialPath,p=u[l].suffixDef,y=Gp(h);if(a1(i,y,c)||ae(p)||h.length===e){let E=n[c];if(nd(E,h)===!1){E.push(h);for(let D=0;D<y.length;D++){let w=y[D];i[c][w]=!0}}}else{let E=Zl(p,s+1,h);o[c]=o[c].concat(E),H(E,D=>{let w=Gp(D.partialPath);H(w,x=>{i[c][x]=!0})})}}}}return n}function Xs(t,e,r,n){let i=new td(t,et.ALTERNATION,n);return e.accept(i),YR(i.result,r)}function Ys(t,e,r,n){let i=new td(t,r);e.accept(i);let o=i.result,a=new zp(e,t,r).startWalking(),c=new je({definition:o}),u=new je({definition:a});return YR([c,u],n)}function nd(t,e){e:for(let r=0;r<t.length;r++){let n=t[r];if(n.length===e.length){for(let i=0;i<n.length;i++){let o=e[i],s=n[i];if((o===s||s.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function JR(t,e){return t.length<e.length&&Kt(t,(r,n)=>{let i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function QR(t){return Kt(t,e=>Kt(e,r=>Kt(r,n=>ae(n.categoryMatches))))}function ZR(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return j(e,r=>Object.assign({type:wt.CUSTOM_LOOKAHEAD_VALIDATION},r))}function eb(t,e,r,n){let i=Bt(t,c=>c1(c,r)),o=p1(t,e,r),s=Bt(t,c=>d1(c,r)),a=Bt(t,c=>l1(c,t,n,r));return i.concat(o,s,a)}function c1(t,e){let r=new Vp;t.accept(r);let n=r.allProductions,i=Ip(n,u1),o=hr(i,a=>a.length>1);return j(Pe(o),a=>{let c=Lt(a),u=e.buildDuplicateFoundError(t,a),l=pr(c),h={message:u,type:wt.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:c.idx},p=tb(c);return p&&(h.parameter=p),h})}function u1(t){return`${pr(t)}_#_${t.idx}_#_${tb(t)}`}function tb(t){return t instanceof ue?t.terminalType.name:t instanceof Ae?t.nonTerminalName:""}var Vp=class extends ir{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function l1(t,e,r,n){let i=[];if(it(e,(s,a)=>a.name===t.name?s+1:s,0)>1){let s=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});i.push({message:s,type:wt.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function rb(t,e,r){let n=[],i;return Je(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:wt.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Xp(t,e,r,n=[]){let i=[],o=id(e.definition);if(ae(o))return[];{let s=t.name;Je(o,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:wt.LEFT_RECURSION,ruleName:s});let c=li(o,n.concat([t])),u=Bt(c,l=>{let h=qe(n);return h.push(l),Xp(t,l,r,h)});return i.concat(u)}}function id(t){let e=[];if(ae(t))return e;let r=Lt(t);if(r instanceof Ae)e.push(r.referencedRule);else if(r instanceof je||r instanceof we||r instanceof Ue||r instanceof We||r instanceof De||r instanceof pe)e=e.concat(id(r.definition));else if(r instanceof Oe)e=gt(j(r.definition,o=>id(o.definition)));else if(!(r instanceof ue))throw Error("non exhaustive match");let n=Xi(r),i=t.length>1;if(n&&i){let o=yt(t);return e.concat(id(o))}else return e}var _c=class extends ir{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function nb(t,e){let r=new _c;t.accept(r);let n=r.alternations;return Bt(n,o=>{let s=On(o.definition);return Bt(s,(a,c)=>{let u=ed([a],[],Mn,1);return ae(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:o,emptyChoiceIdx:c}),type:wt.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:o.idx,alternative:c+1}]:[]})})}function ib(t,e,r){let n=new _c;t.accept(n);let i=n.alternations;return i=di(i,s=>s.ignoreAmbiguities===!0),Bt(i,s=>{let a=s.idx,c=s.maxLookahead||e,u=Xs(a,t,c,s),l=f1(u,s,t,r),h=h1(u,s,t,r);return l.concat(h)})}var Kp=class extends ir{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function d1(t,e){let r=new _c;t.accept(r);let n=r.alternations;return Bt(n,o=>o.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:o}),type:wt.TOO_MANY_ALTS,ruleName:t.name,occurrence:o.idx}]:[])}function ob(t,e,r){let n=[];return H(t,i=>{let o=new Kp;i.accept(o);let s=o.allProductions;H(s,a=>{let c=bc(a),u=a.maxLookahead||e,l=a.idx,p=Ys(l,i,c,u)[0];if(ae(gt(p))){let y=r.buildEmptyRepetitionError({topLevelRule:i,repetition:a});n.push({message:y,type:wt.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function f1(t,e,r,n){let i=[],o=it(t,(a,c,u)=>(e.definition[u].ignoreAmbiguities===!0||H(c,l=>{let h=[u];H(t,(p,y)=>{u!==y&&nd(p,l)&&e.definition[y].ignoreAmbiguities!==!0&&h.push(y)}),h.length>1&&!nd(i,l)&&(i.push(l),a.push({alts:h,path:l}))}),a),[]);return j(o,a=>{let c=j(a.alts,l=>l+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:wt.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:a.alts}})}function h1(t,e,r,n){let i=it(t,(s,a,c)=>{let u=j(a,l=>({idx:c,path:l}));return s.concat(u)},[]);return gn(Bt(i,s=>{if(e.definition[s.idx].ignoreAmbiguities===!0)return[];let c=s.idx,u=s.path,l=Ot(i,p=>e.definition[p.idx].ignoreAmbiguities!==!0&&p.idx<c&&JR(p.path,u));return j(l,p=>{let y=[p.idx+1,c+1],_=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:y,prefixPath:p.path}),type:wt.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:_,alternatives:y}})}))}function p1(t,e,r){let n=[],i=j(e,o=>o.name);return H(t,o=>{let s=o.name;if(Je(i,s)){let a=r.buildNamespaceConflictError(o);n.push({message:a,type:wt.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),n}function sb(t){let e=qs(t,{errMsgProvider:BR}),r={};return H(t.rules,n=>{r[n.name]=n}),HR(r,e.errMsgProvider)}function ab(t){return t=qs(t,{errMsgProvider:Xr}),eb(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var cb="MismatchedTokenException",ub="NoViableAltException",lb="EarlyExitException",db="NotAllInputParsedException",fb=[cb,ub,lb,db];Object.freeze(fb);function hi(t){return Je(fb,t.name)}var Js=class extends Error{constructor(e,r){super(e),this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},Qi=class extends Js{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=cb}},Cc=class extends Js{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=ub}},Sc=class extends Js{constructor(e,r){super(e,r),this.name=db}},kc=class extends Js{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=lb}};var Yp={},Qp="InRuleRecoveryException",Jp=class extends Error{constructor(e){super(e),this.name=Qp}},od=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=V(e,"recoveryEnabled")?e.recoveryEnabled:or.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=m1)}getTokenToInsert(e){let r=qn(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,n,i){let o=this.findReSyncTokenType(),s=this.exportLexerState(),a=[],c=!1,u=this.LA(1),l=this.LA(1),h=()=>{let p=this.LA(0),y=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:p,ruleName:this.getCurrRuleFullName()}),_=new Qi(y,u,this.LA(0));_.resyncedTokens=On(a),this.SAVE_ERROR(_)};for(;!c;)if(this.tokenMatcher(l,i)){h();return}else if(n.call(this)){h(),e.apply(this,r);return}else this.tokenMatcher(l,o)?c=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,a));this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,r,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))}getFollowsForInRuleRecovery(e,r){let n=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Jp("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||ae(r))return!1;let n=this.LA(1);return vn(r,o=>this.tokenMatcher(n,o))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(r);return Je(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let i=vn(e,o=>xc(r,o));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Yp;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return j(e,(n,i)=>i===0?Yp:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=j(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return gt(e)}getFollowSetFromFollowKey(e){if(e===Yp)return[kr];let r=e.ruleName+e.idxInCallingRule+Hl+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,kr)||r.push(e),r}reSyncTo(e){let r=[],n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,r);return On(r)}attemptInRepetitionRecovery(e,r,n,i,o,s,a){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),i=qe(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return j(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function m1(t,e,r,n,i,o,s){let a=this.getKeyForAutomaticLookahead(n,i),c=this.firstAfterRepMap[a];if(c===void 0){let p=this.getCurrRuleFullName(),y=this.getGAstProductions()[p];c=new o(y,i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence,h=c.isEndOfRule;this.RULE_STACK.length===1&&h&&u===void 0&&(u=kr,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(t,e,r,u)}function sd(t,e,r){return r|e|t}var Un=class{constructor(e){var r;this.maxLookahead=(r=e?.maxLookahead)!==null&&r!==void 0?r:or.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(ae(r)){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...n,...i,...o]}return r}validateNoLeftRecursion(e){return Bt(e,r=>Xp(r,r,Xr))}validateEmptyOrAlternatives(e){return Bt(e,r=>nb(r,Xr))}validateAmbiguousAlternationAlternatives(e,r){return Bt(e,n=>ib(n,r,Xr))}validateSomeNonEmptyLookaheadPath(e,r){return ob(e,r,Xr)}buildLookaheadForAlternation(e){return zR(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,KR)}buildLookaheadForOptional(e){return VR(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,bc(e.prodType),XR)}};var cd=class{initLooksAhead(e){this.dynamicTokensEnabled=V(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:or.dynamicTokensEnabled,this.maxLookahead=V(e,"maxLookahead")?e.maxLookahead:or.maxLookahead,this.lookaheadStrategy=V(e,"lookaheadStrategy")?e.lookaheadStrategy:new Un({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){H(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:o,repetitionMandatory:s,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=g1(r);H(n,u=>{let l=u.idx===0?"":u.idx;this.TRACE_INIT(`${pr(u)}${l}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:r,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),p=sd(this.fullRuleNameToShort[r.name],256,u.idx);this.setLaFuncCache(p,h)})}),H(i,u=>{this.computeLookaheadFunc(r,u.idx,768,"Repetition",u.maxLookahead,pr(u))}),H(o,u=>{this.computeLookaheadFunc(r,u.idx,512,"Option",u.maxLookahead,pr(u))}),H(s,u=>{this.computeLookaheadFunc(r,u.idx,1024,"RepetitionMandatory",u.maxLookahead,pr(u))}),H(a,u=>{this.computeLookaheadFunc(r,u.idx,1536,"RepetitionMandatoryWithSeparator",u.maxLookahead,pr(u))}),H(c,u=>{this.computeLookaheadFunc(r,u.idx,1280,"RepetitionWithSeparator",u.maxLookahead,pr(u))})})})}computeLookaheadFunc(e,r,n,i,o,s){this.TRACE_INIT(`${s}${r===0?"":r}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:o||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),c=sd(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(c,a)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return sd(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},Zp=class extends ir{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},ad=new Zp;function g1(t){ad.reset(),t.accept(ad);let e=ad.dslMethods;return ad.reset(),e}function rm(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function nm(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function hb(t,e,r){t.children[r]===void 0?t.children[r]=[e]:t.children[r].push(e)}function pb(t,e,r){t.children[e]===void 0?t.children[e]=[r]:t.children[e].push(r)}var y1="name";function im(t,e){Object.defineProperty(t,y1,{enumerable:!1,configurable:!0,writable:!1,value:e})}function v1(t,e){let r=Fe(t),n=r.length;for(let i=0;i<n;i++){let o=r[i],s=t[o],a=s.length;for(let c=0;c<a;c++){let u=s[c];u.tokenTypeIdx===void 0&&this[u.name](u.children,e)}}}function mb(t,e){let r=function(){};im(r,t+"BaseSemantics");let n={visit:function(i,o){if(X(i)&&(i=i[0]),!Xt(i))return this[i.name](i.children,o)},validateVisitor:function(){let i=x1(this,e);if(!ae(i)){let o=j(i,s=>s.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
123
123
  ${o.join(`
124
124
 
125
125
  `).replace(/\n/g,`
126
- `)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function gb(t,e,r){let n=function(){};im(n,t+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return H(e,o=>{i[o]=y1}),n.prototype=i,n.prototype.constructor=n,n}var om;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(om||(om={}));function v1(t,e){return x1(t,e)}function x1(t,e){let r=Ot(e,i=>rr(t[i])===!1),n=j(r,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:om.MISSING_METHOD,methodName:i}));return gn(n)}var fd=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=V(e,"nodeLocationTracking")?e.nodeLocationTracking:or.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=nt,this.cstFinallyStateUpdate=nt,this.cstPostTerminal=nt,this.cstPostNonTerminal=nt,this.cstPostRule=nt;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=nm,this.setNodeLocationFromNode=nm,this.cstPostRule=nt,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=nt,this.setNodeLocationFromNode=nt,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=rm,this.setNodeLocationFromNode=rm,this.cstPostRule=nt,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=nt,this.setNodeLocationFromNode=nt,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=nt,this.setNodeLocationFromNode=nt,this.cstPostRule=nt,this.setInitialNodeLocation=nt;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?(n.endOffset=r.endOffset,n.endLine=r.endLine,n.endColumn=r.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];hb(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];pb(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(Xt(this.baseCstVisitorConstructor)){let e=mb(this.className,Fe(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Xt(this.baseCstVisitorWithDefaultsConstructor)){let e=gb(this.className,Fe(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}};var hd=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Qs}LA(e){let r=this.currIdx+e;return r<0||this.tokVectorLength<=r?Qs:this.tokVector[r]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}};var pd=class{ACTION(e){return e.call(this)}consume(e,r,n){return this.consumeInternal(r,e,n)}subrule(e,r,n){return this.subruleInternal(r,e,n)}option(e,r){return this.optionInternal(r,e)}or(e,r){return this.orInternal(r,e)}many(e,r){return this.manyInternal(e,r)}atLeastOne(e,r){return this.atLeastOneInternal(e,r)}CONSUME(e,r){return this.consumeInternal(e,0,r)}CONSUME1(e,r){return this.consumeInternal(e,1,r)}CONSUME2(e,r){return this.consumeInternal(e,2,r)}CONSUME3(e,r){return this.consumeInternal(e,3,r)}CONSUME4(e,r){return this.consumeInternal(e,4,r)}CONSUME5(e,r){return this.consumeInternal(e,5,r)}CONSUME6(e,r){return this.consumeInternal(e,6,r)}CONSUME7(e,r){return this.consumeInternal(e,7,r)}CONSUME8(e,r){return this.consumeInternal(e,8,r)}CONSUME9(e,r){return this.consumeInternal(e,9,r)}SUBRULE(e,r){return this.subruleInternal(e,0,r)}SUBRULE1(e,r){return this.subruleInternal(e,1,r)}SUBRULE2(e,r){return this.subruleInternal(e,2,r)}SUBRULE3(e,r){return this.subruleInternal(e,3,r)}SUBRULE4(e,r){return this.subruleInternal(e,4,r)}SUBRULE5(e,r){return this.subruleInternal(e,5,r)}SUBRULE6(e,r){return this.subruleInternal(e,6,r)}SUBRULE7(e,r){return this.subruleInternal(e,7,r)}SUBRULE8(e,r){return this.subruleInternal(e,8,r)}SUBRULE9(e,r){return this.subruleInternal(e,9,r)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,r,n=Zs){if(Je(this.definedRulesNames,e)){let s={message:Xr.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:wt.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);let i=this.defineRule(e,r,n);return this[e]=i,i}OVERRIDE_RULE(e,r,n=Zs){let i=rb(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let o=this.defineRule(e,r,n);return this[e]=o,o}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);let n=this.saveRecogState();try{return e.apply(this,r),!0}catch(i){if(hi(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Bl(Pe(this.gastProductionsCache))}};var md=class{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=zs,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},V(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
126
+ `)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function gb(t,e,r){let n=function(){};im(n,t+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return H(e,o=>{i[o]=v1}),n.prototype=i,n.prototype.constructor=n,n}var om;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(om||(om={}));function x1(t,e){return T1(t,e)}function T1(t,e){let r=Ot(e,i=>rr(t[i])===!1),n=j(r,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:om.MISSING_METHOD,methodName:i}));return gn(n)}var fd=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=V(e,"nodeLocationTracking")?e.nodeLocationTracking:or.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=nt,this.cstFinallyStateUpdate=nt,this.cstPostTerminal=nt,this.cstPostNonTerminal=nt,this.cstPostRule=nt;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=nm,this.setNodeLocationFromNode=nm,this.cstPostRule=nt,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=nt,this.setNodeLocationFromNode=nt,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=rm,this.setNodeLocationFromNode=rm,this.cstPostRule=nt,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=nt,this.setNodeLocationFromNode=nt,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=nt,this.setNodeLocationFromNode=nt,this.cstPostRule=nt,this.setInitialNodeLocation=nt;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?(n.endOffset=r.endOffset,n.endLine=r.endLine,n.endColumn=r.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];hb(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];pb(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(Xt(this.baseCstVisitorConstructor)){let e=mb(this.className,Fe(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Xt(this.baseCstVisitorWithDefaultsConstructor)){let e=gb(this.className,Fe(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}};var hd=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Qs}LA(e){let r=this.currIdx+e;return r<0||this.tokVectorLength<=r?Qs:this.tokVector[r]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}};var pd=class{ACTION(e){return e.call(this)}consume(e,r,n){return this.consumeInternal(r,e,n)}subrule(e,r,n){return this.subruleInternal(r,e,n)}option(e,r){return this.optionInternal(r,e)}or(e,r){return this.orInternal(r,e)}many(e,r){return this.manyInternal(e,r)}atLeastOne(e,r){return this.atLeastOneInternal(e,r)}CONSUME(e,r){return this.consumeInternal(e,0,r)}CONSUME1(e,r){return this.consumeInternal(e,1,r)}CONSUME2(e,r){return this.consumeInternal(e,2,r)}CONSUME3(e,r){return this.consumeInternal(e,3,r)}CONSUME4(e,r){return this.consumeInternal(e,4,r)}CONSUME5(e,r){return this.consumeInternal(e,5,r)}CONSUME6(e,r){return this.consumeInternal(e,6,r)}CONSUME7(e,r){return this.consumeInternal(e,7,r)}CONSUME8(e,r){return this.consumeInternal(e,8,r)}CONSUME9(e,r){return this.consumeInternal(e,9,r)}SUBRULE(e,r){return this.subruleInternal(e,0,r)}SUBRULE1(e,r){return this.subruleInternal(e,1,r)}SUBRULE2(e,r){return this.subruleInternal(e,2,r)}SUBRULE3(e,r){return this.subruleInternal(e,3,r)}SUBRULE4(e,r){return this.subruleInternal(e,4,r)}SUBRULE5(e,r){return this.subruleInternal(e,5,r)}SUBRULE6(e,r){return this.subruleInternal(e,6,r)}SUBRULE7(e,r){return this.subruleInternal(e,7,r)}SUBRULE8(e,r){return this.subruleInternal(e,8,r)}SUBRULE9(e,r){return this.subruleInternal(e,9,r)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,r,n=Zs){if(Je(this.definedRulesNames,e)){let s={message:Xr.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:wt.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);let i=this.defineRule(e,r,n);return this[e]=i,i}OVERRIDE_RULE(e,r,n=Zs){let i=rb(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let o=this.defineRule(e,r,n);return this[e]=o,o}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);let n=this.saveRecogState();try{return e.apply(this,r),!0}catch(i){if(hi(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Bl(Pe(this.gastProductionsCache))}};var md=class{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=zs,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},V(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
127
127
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
128
128
  For Further details.`);if(X(e)){if(ae(e))throw Error(`A Token Vocabulary cannot be empty.
129
129
  Note that the first argument for the parser constructor
@@ -131,34 +131,34 @@ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleN
131
131
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
132
132
  For Further details.`)}if(X(e))this.tokensMap=it(e,(o,s)=>(o[s.name]=s,o),{});else if(V(e,"modes")&&Kt(gt(Pe(e.modes)),OR)){let o=gt(Pe(e.modes)),s=js(o);this.tokensMap=it(s,(a,c)=>(a[c.name]=c,a),{})}else if(rt(e))this.tokensMap=qe(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=kr;let n=V(e,"modes")?gt(Pe(e.modes)):Pe(e),i=Kt(n,o=>ae(o.categoryMatches));this.tokenMatcher=i?zs:Mn,Fn(Pe(this.tokensMap))}defineRule(e,r,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
133
133
  Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=V(n,"resyncEnabled")?n.resyncEnabled:Zs.resyncEnabled,o=V(n,"recoveryValueFunc")?n.recoveryValueFunc:Zs.recoveryValueFunc,s=this.ruleShortNameIdx<<12;this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s;let a;return this.outputCst===!0?a=function(...l){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,l);let h=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(h),h}catch(h){return this.invokeRuleCatch(h,i,o)}finally{this.ruleFinallyStateUpdate()}}:a=function(...l){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,l)}catch(h){return this.invokeRuleCatch(h,i,o)}finally{this.ruleFinallyStateUpdate()}},Object.assign(a,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,n){let i=this.RULE_STACK.length===1,o=r&&!this.isBackTracking()&&this.recoveryEnabled;if(hi(e)){let s=e;if(o){let a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(s.resyncedTokens=this.reSyncTo(a),this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return n(e);else{if(this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,s.partialCstResult=c}throw s}}else{if(i)return this.moveToTerminatedState(),n(e);throw s}}else throw e}optionInternal(e,r){let n=this.getKeyForAutomaticLookahead(512,r);return this.optionInternalLogic(e,r,n)}optionInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),o;if(typeof e!="function"){o=e.DEF;let s=e.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=e;if(i.call(this)===!0)return o.call(this)}atLeastOneInternal(e,r){let n=this.getKeyForAutomaticLookahead(1024,e);return this.atLeastOneInternalLogic(e,r,n)}atLeastOneInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),o;if(typeof r!="function"){o=r.DEF;let s=r.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=r;if(i.call(this)===!0){let s=this.doSingleRepetition(o);for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o)}else throw this.raiseEarlyExitException(e,et.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],i,1024,e,Ql)}atLeastOneSepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,r,n)}atLeastOneSepFirstInternalLogic(e,r,n){let i=r.DEF,o=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA(1),o);for(;this.tokenMatcher(this.LA(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,o,a,i,Rc],a,1536,e,Rc)}else throw this.raiseEarlyExitException(e,et.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){let n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,r,n)}manyInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),o;if(typeof r!="function"){o=r.DEF;let a=r.GATE;if(a!==void 0){let c=i;i=()=>a.call(this)&&c.call(this)}}else o=r;let s=!0;for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],i,768,e,Jl,s)}manySepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,r,n)}manySepFirstInternalLogic(e,r,n){let i=r.DEF,o=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA(1),o);for(;this.tokenMatcher(this.LA(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,o,a,i,Tc],a,1280,e,Tc)}}repetitionSepSecondInternal(e,r,n,i,o){for(;n();)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,n,i,o],n,1536,e,o)}doSingleRepetition(e){let r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){let n=this.getKeyForAutomaticLookahead(256,r),i=X(e)?e:e.DEF,s=this.getLaFuncFromCache(n).call(this,i);if(s!==void 0)return i[s].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Sc(r,e))}}subruleInternal(e,r,n){let i;try{let o=n!==void 0?n.ARGS:void 0;return this.subruleIdx=r,i=e.apply(this,o),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(o){throw this.subruleInternalError(o,n,e.ruleName)}}subruleInternalError(e,r,n){throw hi(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,r!==void 0&&r.LABEL!==void 0?r.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,r,n){let i;try{let o=this.LA(1);this.tokenMatcher(o,e)===!0?(this.consumeToken(),i=o):this.consumeInternalError(e,o,n)}catch(o){i=this.consumeInternalRecovery(e,r,o)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i}consumeInternalError(e,r,n){let i,o=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:r,previous:o,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Qi(i,r,o))}consumeInternalRecovery(e,r,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,r);try{return this.tryInRuleRecovery(e,i)}catch(o){throw o.name===Qp?n:o}}else throw n}saveRecogState(){let e=this.errors,r=qe(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:r,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,r,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(r)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),kr)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}};var gd=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=V(e,"errorMessageProvider")?e.errorMessageProvider:or.errorMessageProvider}SAVE_ERROR(e){if(hi(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:qe(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return qe(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,n){let i=this.getCurrRuleFullName(),o=this.getGAstProductions()[i],a=Ys(e,o,r,this.maxLookahead)[0],c=[];for(let l=1;l<=this.maxLookahead;l++)c.push(this.LA(l));let u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:c,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new kc(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],o=Xs(e,i,this.maxLookahead),s=[];for(let u=1;u<=this.maxLookahead;u++)s.push(this.LA(u));let a=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:o,actual:s,previous:a,customUserDescription:r,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Cc(c,this.LA(1),a))}};var yd=class{initContentAssist(){}computeContentAssist(e,r){let n=this.gastProductionsCache[e];if(Xt(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return ed([n],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=Lt(e.ruleStack),i=this.getGAstProductions()[r];return new Yl(i,e).startWalking()}};var Td={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Td);var yb=!0,vb=Math.pow(2,8)-1,Tb=fi({name:"RECORDING_PHASE_TOKEN",pattern:Ze.NA});Fn([Tb]);var Rb=qn(Tb,`This IToken indicates the Parser is in Recording Phase
134
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Rb);var R1={name:`This CSTNode indicates the Parser is in Recording Phase
134
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Rb);var b1={name:`This CSTNode indicates the Parser is in Recording Phase
135
135
  See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},vd=class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let r=e>0?e:"";this[`CONSUME${r}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${r}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},this[`OPTION${r}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${r}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${r}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${r}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${r}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${r}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,r,n){return this.consumeInternalRecord(r,e,n)},this.subrule=function(e,r,n){return this.subruleInternalRecord(r,e,n)},this.option=function(e,r){return this.optionInternalRecord(r,e)},this.or=function(e,r){return this.orInternalRecord(r,e)},this.many=function(e,r){this.manyInternalRecord(e,r)},this.atLeastOne=function(e,r){this.atLeastOneInternalRecord(e,r)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let r=0;r<10;r++){let n=r>0?r:"";delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,r){return()=>!0}LA_RECORD(e){return Qs}topLevelRuleRecord(e,r){try{let n=new nr({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),r.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
136
136
  This error was thrown during the "grammar recording phase" For more info see:
137
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return Ac.call(this,we,e,r)}atLeastOneInternalRecord(e,r){Ac.call(this,Ue,r,e)}atLeastOneSepFirstInternalRecord(e,r){Ac.call(this,We,r,e,yb)}manyInternalRecord(e,r){Ac.call(this,pe,r,e)}manySepFirstInternalRecord(e,r){Ac.call(this,De,r,e,yb)}orInternalRecord(e,r){return b1.call(this,e,r)}subruleInternalRecord(e,r,n){if(xd(r),!e||V(e,"ruleName")===!1){let a=new Error(`<SUBRULE${xb(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
138
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=yn(this.recordingProdStack),o=e.ruleName,s=new Ae({idx:r,nonTerminalName:o,label:n?.LABEL,referencedRule:void 0});return i.definition.push(s),this.outputCst?R1:Td}consumeInternalRecord(e,r,n){if(xd(r),!Up(e)){let s=new Error(`<CONSUME${xb(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
139
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=yn(this.recordingProdStack),o=new ue({idx:r,terminalType:e,label:n?.LABEL});return i.definition.push(o),Rb}};function Ac(t,e,r,n=!1){xd(r);let i=yn(this.recordingProdStack),o=rr(e)?e:e.DEF,s=new t({definition:[],idx:r});return n&&(s.separator=e.SEP),V(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),Td}function b1(t,e){xd(e);let r=yn(this.recordingProdStack),n=X(t)===!1,i=n===!1?t:t.DEF,o=new Oe({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});V(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD);let s=hc(i,a=>rr(a.GATE));return o.hasPredicates=s,r.definition.push(o),H(i,a=>{let c=new je({definition:[]});o.definition.push(c),V(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:V(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),Td}function xb(t){return t===0?"":`${t}`}function xd(t){if(t<0||t>vb){let e=new Error(`Invalid DSL Method idx value: <${t}>
137
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return Ac.call(this,we,e,r)}atLeastOneInternalRecord(e,r){Ac.call(this,Ue,r,e)}atLeastOneSepFirstInternalRecord(e,r){Ac.call(this,We,r,e,yb)}manyInternalRecord(e,r){Ac.call(this,pe,r,e)}manySepFirstInternalRecord(e,r){Ac.call(this,De,r,e,yb)}orInternalRecord(e,r){return _1.call(this,e,r)}subruleInternalRecord(e,r,n){if(xd(r),!e||V(e,"ruleName")===!1){let a=new Error(`<SUBRULE${xb(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
138
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=yn(this.recordingProdStack),o=e.ruleName,s=new Ae({idx:r,nonTerminalName:o,label:n?.LABEL,referencedRule:void 0});return i.definition.push(s),this.outputCst?b1:Td}consumeInternalRecord(e,r,n){if(xd(r),!Up(e)){let s=new Error(`<CONSUME${xb(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
139
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=yn(this.recordingProdStack),o=new ue({idx:r,terminalType:e,label:n?.LABEL});return i.definition.push(o),Rb}};function Ac(t,e,r,n=!1){xd(r);let i=yn(this.recordingProdStack),o=rr(e)?e:e.DEF,s=new t({definition:[],idx:r});return n&&(s.separator=e.SEP),V(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),Td}function _1(t,e){xd(e);let r=yn(this.recordingProdStack),n=X(t)===!1,i=n===!1?t:t.DEF,o=new Oe({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});V(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD);let s=hc(i,a=>rr(a.GATE));return o.hasPredicates=s,r.definition.push(o),H(i,a=>{let c=new je({definition:[]});o.definition.push(c),V(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:V(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),Td}function xb(t){return t===0?"":`${t}`}function xd(t){if(t<0||t>vb){let e=new Error(`Invalid DSL Method idx value: <${t}>
140
140
  Idx value must be a none negative value smaller than ${vb+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var Rd=class{initPerformanceTracer(e){if(V(e,"traceInitPerf")){let r=e.traceInitPerf,n=typeof r=="number";this.traceInitMaxIdent=n?r:1/0,this.traceInitPerf=n?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=or.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:i,value:o}=mc(r),s=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,o}else return r()}};function bb(t,e){e.forEach(r=>{let n=r.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let o=Object.getOwnPropertyDescriptor(n,i);o&&(o.get||o.set)?Object.defineProperty(t.prototype,i,o):t.prototype[i]=r.prototype[i]})})}var Qs=qn(kr,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Qs);var or=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:jn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Zs=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),wt;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(wt||(wt={}));function bd(t=void 0){return function(){return t}}var wc=class t{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{gc(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),H(this.definedRulesNames,i=>{let s=this[i].originalGrammarAction,a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=sb({rules:Pe(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(ae(n)&&this.skipValidations===!1){let i=ab({rules:Pe(this.gastProductionsCache),tokenTypes:Pe(this.tokensMap),errMsgProvider:Xr,grammarName:r}),o=ZR({lookaheadStrategy:this.lookaheadStrategy,rules:Pe(this.gastProductionsCache),tokenTypes:Pe(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,o)}}),ae(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=pR(Pe(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,o;(o=(i=this.lookaheadStrategy).initialize)===null||o===void 0||o.call(i,{rules:Pe(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Pe(this.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!ae(this.definitionErrors))throw e=j(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
141
141
  ${e.join(`
142
142
  -------------------------------
143
143
  `)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(r),n.initLexerAdapter(),n.initLooksAhead(r),n.initRecognizerEngine(e,r),n.initRecoverable(r),n.initTreeBuilder(r),n.initContentAssist(),n.initGastRecorder(r),n.initPerformanceTracer(r),V(r,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
144
144
  Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
145
145
  See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
146
- For further details.`);this.skipValidations=V(r,"skipValidations")?r.skipValidations:or.skipValidations}};wc.DEFER_DEFINITION_ERRORS_HANDLING=!1;bb(wc,[od,cd,fd,hd,md,pd,gd,yd,vd,Rd]);var Nc=class extends wc{constructor(e,r=or){let n=qe(r);n.outputCst=!1,super(e,n)}};function Zi(t,e,r){return`${t.name}_${e}_${r}`}var pi=1,C1=2,_b=4,Cb=5;var ra=7,S1=8,k1=9,E1=10,A1=11,Sb=12,Pc=class{constructor(e){this.target=e}isEpsilon(){return!1}},ea=class extends Pc{constructor(e,r){super(e),this.tokenType=r}},Ic=class extends Pc{constructor(e){super(e)}isEpsilon(){return!0}},ta=class extends Pc{constructor(e,r,n){super(e),this.rule=r,this.followState=n}isEpsilon(){return!0}};function kb(t){let e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};w1(e,t);let r=t.length;for(let n=0;n<r;n++){let i=t[n],o=eo(e,i,i);o!==void 0&&j1(e,i,o)}return e}function w1(t,e){let r=e.length;for(let n=0;n<r;n++){let i=e[n],o=Mt(t,i,void 0,{type:C1}),s=Mt(t,i,void 0,{type:ra});o.stop=s,t.ruleToStartState.set(i,o),t.ruleToStopState.set(i,s)}}function Eb(t,e,r){return r instanceof ue?am(t,e,r.terminalType,r):r instanceof Ae?q1(t,e,r):r instanceof Oe?O1(t,e,r):r instanceof we?L1(t,e,r):r instanceof pe?N1(t,e,r):r instanceof De?P1(t,e,r):r instanceof Ue?I1(t,e,r):r instanceof We?D1(t,e,r):eo(t,e,r)}function N1(t,e,r){let n=Mt(t,e,r,{type:Cb});mi(t,n);let i=na(t,e,n,r,eo(t,e,r));return wb(t,e,r,i)}function P1(t,e,r){let n=Mt(t,e,r,{type:Cb});mi(t,n);let i=na(t,e,n,r,eo(t,e,r)),o=am(t,e,r.separator,r);return wb(t,e,r,i,o)}function I1(t,e,r){let n=Mt(t,e,r,{type:_b});mi(t,n);let i=na(t,e,n,r,eo(t,e,r));return Ab(t,e,r,i)}function D1(t,e,r){let n=Mt(t,e,r,{type:_b});mi(t,n);let i=na(t,e,n,r,eo(t,e,r)),o=am(t,e,r.separator,r);return Ab(t,e,r,i,o)}function O1(t,e,r){let n=Mt(t,e,r,{type:pi});mi(t,n);let i=j(r.definition,s=>Eb(t,e,s));return na(t,e,n,r,...i)}function L1(t,e,r){let n=Mt(t,e,r,{type:pi});mi(t,n);let i=na(t,e,n,r,eo(t,e,r));return M1(t,e,r,i)}function eo(t,e,r){let n=Ot(j(r.definition,i=>Eb(t,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:$1(t,n)}function Ab(t,e,r,n,i){let o=n.left,s=n.right,a=Mt(t,e,r,{type:A1});mi(t,a);let c=Mt(t,e,r,{type:Sb});return o.loopback=a,c.loopback=a,t.decisionMap[Zi(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=a,Ct(s,a),i===void 0?(Ct(a,o),Ct(a,c)):(Ct(a,c),Ct(a,i.left),Ct(i.right,o)),{left:o,right:c}}function wb(t,e,r,n,i){let o=n.left,s=n.right,a=Mt(t,e,r,{type:E1});mi(t,a);let c=Mt(t,e,r,{type:Sb}),u=Mt(t,e,r,{type:k1});return a.loopback=u,c.loopback=u,Ct(a,o),Ct(a,c),Ct(s,u),i!==void 0?(Ct(u,c),Ct(u,i.left),Ct(i.right,o)):Ct(u,a),t.decisionMap[Zi(e,i?"RepetitionWithSeparator":"Repetition",r.idx)]=a,{left:a,right:c}}function M1(t,e,r,n){let i=n.left,o=n.right;return Ct(i,o),t.decisionMap[Zi(e,"Option",r.idx)]=i,n}function mi(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function na(t,e,r,n,...i){let o=Mt(t,e,n,{type:S1,start:r});r.end=o;for(let a of i)a!==void 0?(Ct(r,a.left),Ct(a.right,o)):Ct(r,o);let s={left:r,right:o};return t.decisionMap[Zi(e,F1(n),n.idx)]=r,s}function F1(t){if(t instanceof Oe)return"Alternation";if(t instanceof we)return"Option";if(t instanceof pe)return"Repetition";if(t instanceof De)return"RepetitionWithSeparator";if(t instanceof Ue)return"RepetitionMandatory";if(t instanceof We)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function $1(t,e){let r=e.length;for(let o=0;o<r-1;o++){let s=e[o],a;s.left.transitions.length===1&&(a=s.left.transitions[0]);let c=a instanceof ta,u=a,l=e[o+1].left;s.left.type===pi&&s.right.type===pi&&a!==void 0&&(c&&u.followState===s.right||a.target===s.right)?(c?u.followState=l:a.target=l,U1(t,s.right)):Ct(s.right,l)}let n=e[0],i=e[r-1];return{left:n.left,right:i.right}}function am(t,e,r,n){let i=Mt(t,e,n,{type:pi}),o=Mt(t,e,n,{type:pi});return cm(i,new ea(o,r)),{left:i,right:o}}function q1(t,e,r){let n=r.referencedRule,i=t.ruleToStartState.get(n),o=Mt(t,e,r,{type:pi}),s=Mt(t,e,r,{type:pi}),a=new ta(i,n,s);return cm(o,a),{left:o,right:s}}function j1(t,e,r){let n=t.ruleToStartState.get(e);Ct(n,r.left);let i=t.ruleToStopState.get(e);return Ct(r.right,i),{left:n,right:i}}function Ct(t,e){let r=new Ic(e);cm(t,r)}function Mt(t,e,r,n){let i=Object.assign({atn:t,production:r,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:t.states.length},n);return t.states.push(i),i}function cm(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function U1(t,e){t.states.splice(t.states.indexOf(e),1)}var Dc={},ia=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let r=um(e);r in this.map||(this.map[r]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return j(this.configs,e=>e.alt)}get key(){let e="";for(let r in this.map)e+=r+":";return e}};function um(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(r=>r.stateNumber.toString()).join("_")}`}function W1(t,e){let r={};return n=>{let i=n.toString(),o=r[i];return o!==void 0||(o={atnStartState:t,decision:e,states:{}},r[i]=o),o}}var _d=class{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,r){this.predicates[e]=r}toString(){let e="",r=this.predicates.length;for(let n=0;n<r;n++)e+=this.predicates[n]===!0?"1":"0";return e}},Nb=new _d,Oc=class extends Un{constructor(e){var r;super(),this.logging=(r=e?.logging)!==null&&r!==void 0?r:(n=>console.log(n))}initialize(e){this.atn=kb(e.rules),this.dfas=B1(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){let{prodOccurrence:r,rule:n,hasPredicates:i,dynamicTokensEnabled:o}=e,s=this.dfas,a=this.logging,c=Zi(n,"Alternation",r),l=this.atn.decisionMap[c].decision,h=j(rd({maxLookahead:1,occurrence:r,prodType:"Alternation",rule:n}),p=>j(p,y=>y[0]));if(Pb(h,!1)&&!o){let p=it(h,(y,_,E)=>(H(_,D=>{D&&(y[D.tokenTypeIdx]=E,H(D.categoryMatches,w=>{y[w]=E}))}),y),{});return i?function(y){var _;let E=this.LA(1),D=p[E.tokenTypeIdx];if(y!==void 0&&D!==void 0){let w=(_=y[D])===null||_===void 0?void 0:_.GATE;if(w!==void 0&&w.call(this)===!1)return}return D}:function(){let y=this.LA(1);return p[y.tokenTypeIdx]}}else return i?function(p){let y=new _d,_=p===void 0?0:p.length;for(let D=0;D<_;D++){let w=p?.[D].GATE;y.set(D,w===void 0||w.call(this))}let E=lm.call(this,s,l,y,a);return typeof E=="number"?E:void 0}:function(){let p=lm.call(this,s,l,Nb,a);return typeof p=="number"?p:void 0}}buildLookaheadForOptional(e){let{prodOccurrence:r,rule:n,prodType:i,dynamicTokensEnabled:o}=e,s=this.dfas,a=this.logging,c=Zi(n,i,r),l=this.atn.decisionMap[c].decision,h=j(rd({maxLookahead:1,occurrence:r,prodType:i,rule:n}),p=>j(p,y=>y[0]));if(Pb(h)&&h[0][0]&&!o){let p=h[0],y=gt(p);if(y.length===1&&ae(y[0].categoryMatches)){let E=y[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===E}}else{let _=it(y,(E,D)=>(D!==void 0&&(E[D.tokenTypeIdx]=!0,H(D.categoryMatches,w=>{E[w]=!0})),E),{});return function(){let E=this.LA(1);return _[E.tokenTypeIdx]===!0}}}return function(){let p=lm.call(this,s,l,Nb,a);return typeof p=="object"?!1:p===0}}};function Pb(t,e=!0){let r=new Set;for(let n of t){let i=new Set;for(let o of n){if(o===void 0){if(e)break;return!1}let s=[o.tokenTypeIdx].concat(o.categoryMatches);for(let a of s)if(r.has(a)){if(!i.has(a))return!1}else r.add(a),i.add(a)}}return!0}function B1(t){let e=t.decisionStates.length,r=Array(e);for(let n=0;n<e;n++)r[n]=W1(t.decisionStates[n],n);return r}function lm(t,e,r,n){let i=t[e](r),o=i.start;if(o===void 0){let a=eF(i.atnStartState);o=Ob(i,Db(a)),i.start=o}return H1.apply(this,[i,o,r,n])}function H1(t,e,r,n){let i=e,o=1,s=[],a=this.LA(o++);for(;;){let c=Y1(i,a);if(c===void 0&&(c=G1.apply(this,[t,i,a,o,r,n])),c===Dc)return X1(s,i,a);if(c.isAcceptState===!0)return c.prediction;i=c,s.push(a),a=this.LA(o++)}}function G1(t,e,r,n,i,o){let s=J1(e.configs,r,i);if(s.size===0)return Ib(t,e,r,Dc),Dc;let a=Db(s),c=Z1(s,i);if(c!==void 0)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;else if(iF(s)){let u=oR(s.alts);a.isAcceptState=!0,a.prediction=u,a.configs.uniqueAlt=u,z1.apply(this,[t,n,s.alts,o])}return a=Ib(t,e,r,a),a}function z1(t,e,r,n){let i=[];for(let u=1;u<=e;u++)i.push(this.LA(u).tokenType);let o=t.atnStartState,s=o.rule,a=o.production,c=V1({topLevelRule:s,ambiguityIndices:r,production:a,prefixPath:i});n(c)}function V1(t){let e=j(t.prefixPath,i=>$n(i)).join(", "),r=t.production.idx===0?"":t.production.idx,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${K1(t.production)}${r}> inside <${t.topLevelRule.name}> Rule,
146
+ For further details.`);this.skipValidations=V(r,"skipValidations")?r.skipValidations:or.skipValidations}};wc.DEFER_DEFINITION_ERRORS_HANDLING=!1;bb(wc,[od,cd,fd,hd,md,pd,gd,yd,vd,Rd]);var Nc=class extends wc{constructor(e,r=or){let n=qe(r);n.outputCst=!1,super(e,n)}};function Zi(t,e,r){return`${t.name}_${e}_${r}`}var pi=1,S1=2,_b=4,Cb=5;var ra=7,k1=8,E1=9,A1=10,w1=11,Sb=12,Pc=class{constructor(e){this.target=e}isEpsilon(){return!1}},ea=class extends Pc{constructor(e,r){super(e),this.tokenType=r}},Ic=class extends Pc{constructor(e){super(e)}isEpsilon(){return!0}},ta=class extends Pc{constructor(e,r,n){super(e),this.rule=r,this.followState=n}isEpsilon(){return!0}};function kb(t){let e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};N1(e,t);let r=t.length;for(let n=0;n<r;n++){let i=t[n],o=eo(e,i,i);o!==void 0&&U1(e,i,o)}return e}function N1(t,e){let r=e.length;for(let n=0;n<r;n++){let i=e[n],o=Mt(t,i,void 0,{type:S1}),s=Mt(t,i,void 0,{type:ra});o.stop=s,t.ruleToStartState.set(i,o),t.ruleToStopState.set(i,s)}}function Eb(t,e,r){return r instanceof ue?am(t,e,r.terminalType,r):r instanceof Ae?j1(t,e,r):r instanceof Oe?L1(t,e,r):r instanceof we?M1(t,e,r):r instanceof pe?P1(t,e,r):r instanceof De?I1(t,e,r):r instanceof Ue?D1(t,e,r):r instanceof We?O1(t,e,r):eo(t,e,r)}function P1(t,e,r){let n=Mt(t,e,r,{type:Cb});mi(t,n);let i=na(t,e,n,r,eo(t,e,r));return wb(t,e,r,i)}function I1(t,e,r){let n=Mt(t,e,r,{type:Cb});mi(t,n);let i=na(t,e,n,r,eo(t,e,r)),o=am(t,e,r.separator,r);return wb(t,e,r,i,o)}function D1(t,e,r){let n=Mt(t,e,r,{type:_b});mi(t,n);let i=na(t,e,n,r,eo(t,e,r));return Ab(t,e,r,i)}function O1(t,e,r){let n=Mt(t,e,r,{type:_b});mi(t,n);let i=na(t,e,n,r,eo(t,e,r)),o=am(t,e,r.separator,r);return Ab(t,e,r,i,o)}function L1(t,e,r){let n=Mt(t,e,r,{type:pi});mi(t,n);let i=j(r.definition,s=>Eb(t,e,s));return na(t,e,n,r,...i)}function M1(t,e,r){let n=Mt(t,e,r,{type:pi});mi(t,n);let i=na(t,e,n,r,eo(t,e,r));return F1(t,e,r,i)}function eo(t,e,r){let n=Ot(j(r.definition,i=>Eb(t,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:q1(t,n)}function Ab(t,e,r,n,i){let o=n.left,s=n.right,a=Mt(t,e,r,{type:w1});mi(t,a);let c=Mt(t,e,r,{type:Sb});return o.loopback=a,c.loopback=a,t.decisionMap[Zi(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=a,Ct(s,a),i===void 0?(Ct(a,o),Ct(a,c)):(Ct(a,c),Ct(a,i.left),Ct(i.right,o)),{left:o,right:c}}function wb(t,e,r,n,i){let o=n.left,s=n.right,a=Mt(t,e,r,{type:A1});mi(t,a);let c=Mt(t,e,r,{type:Sb}),u=Mt(t,e,r,{type:E1});return a.loopback=u,c.loopback=u,Ct(a,o),Ct(a,c),Ct(s,u),i!==void 0?(Ct(u,c),Ct(u,i.left),Ct(i.right,o)):Ct(u,a),t.decisionMap[Zi(e,i?"RepetitionWithSeparator":"Repetition",r.idx)]=a,{left:a,right:c}}function F1(t,e,r,n){let i=n.left,o=n.right;return Ct(i,o),t.decisionMap[Zi(e,"Option",r.idx)]=i,n}function mi(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function na(t,e,r,n,...i){let o=Mt(t,e,n,{type:k1,start:r});r.end=o;for(let a of i)a!==void 0?(Ct(r,a.left),Ct(a.right,o)):Ct(r,o);let s={left:r,right:o};return t.decisionMap[Zi(e,$1(n),n.idx)]=r,s}function $1(t){if(t instanceof Oe)return"Alternation";if(t instanceof we)return"Option";if(t instanceof pe)return"Repetition";if(t instanceof De)return"RepetitionWithSeparator";if(t instanceof Ue)return"RepetitionMandatory";if(t instanceof We)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function q1(t,e){let r=e.length;for(let o=0;o<r-1;o++){let s=e[o],a;s.left.transitions.length===1&&(a=s.left.transitions[0]);let c=a instanceof ta,u=a,l=e[o+1].left;s.left.type===pi&&s.right.type===pi&&a!==void 0&&(c&&u.followState===s.right||a.target===s.right)?(c?u.followState=l:a.target=l,W1(t,s.right)):Ct(s.right,l)}let n=e[0],i=e[r-1];return{left:n.left,right:i.right}}function am(t,e,r,n){let i=Mt(t,e,n,{type:pi}),o=Mt(t,e,n,{type:pi});return cm(i,new ea(o,r)),{left:i,right:o}}function j1(t,e,r){let n=r.referencedRule,i=t.ruleToStartState.get(n),o=Mt(t,e,r,{type:pi}),s=Mt(t,e,r,{type:pi}),a=new ta(i,n,s);return cm(o,a),{left:o,right:s}}function U1(t,e,r){let n=t.ruleToStartState.get(e);Ct(n,r.left);let i=t.ruleToStopState.get(e);return Ct(r.right,i),{left:n,right:i}}function Ct(t,e){let r=new Ic(e);cm(t,r)}function Mt(t,e,r,n){let i=Object.assign({atn:t,production:r,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:t.states.length},n);return t.states.push(i),i}function cm(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function W1(t,e){t.states.splice(t.states.indexOf(e),1)}var Dc={},ia=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let r=um(e);r in this.map||(this.map[r]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return j(this.configs,e=>e.alt)}get key(){let e="";for(let r in this.map)e+=r+":";return e}};function um(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(r=>r.stateNumber.toString()).join("_")}`}function B1(t,e){let r={};return n=>{let i=n.toString(),o=r[i];return o!==void 0||(o={atnStartState:t,decision:e,states:{}},r[i]=o),o}}var _d=class{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,r){this.predicates[e]=r}toString(){let e="",r=this.predicates.length;for(let n=0;n<r;n++)e+=this.predicates[n]===!0?"1":"0";return e}},Nb=new _d,Oc=class extends Un{constructor(e){var r;super(),this.logging=(r=e?.logging)!==null&&r!==void 0?r:(n=>console.log(n))}initialize(e){this.atn=kb(e.rules),this.dfas=H1(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){let{prodOccurrence:r,rule:n,hasPredicates:i,dynamicTokensEnabled:o}=e,s=this.dfas,a=this.logging,c=Zi(n,"Alternation",r),l=this.atn.decisionMap[c].decision,h=j(rd({maxLookahead:1,occurrence:r,prodType:"Alternation",rule:n}),p=>j(p,y=>y[0]));if(Pb(h,!1)&&!o){let p=it(h,(y,_,E)=>(H(_,D=>{D&&(y[D.tokenTypeIdx]=E,H(D.categoryMatches,w=>{y[w]=E}))}),y),{});return i?function(y){var _;let E=this.LA(1),D=p[E.tokenTypeIdx];if(y!==void 0&&D!==void 0){let w=(_=y[D])===null||_===void 0?void 0:_.GATE;if(w!==void 0&&w.call(this)===!1)return}return D}:function(){let y=this.LA(1);return p[y.tokenTypeIdx]}}else return i?function(p){let y=new _d,_=p===void 0?0:p.length;for(let D=0;D<_;D++){let w=p?.[D].GATE;y.set(D,w===void 0||w.call(this))}let E=lm.call(this,s,l,y,a);return typeof E=="number"?E:void 0}:function(){let p=lm.call(this,s,l,Nb,a);return typeof p=="number"?p:void 0}}buildLookaheadForOptional(e){let{prodOccurrence:r,rule:n,prodType:i,dynamicTokensEnabled:o}=e,s=this.dfas,a=this.logging,c=Zi(n,i,r),l=this.atn.decisionMap[c].decision,h=j(rd({maxLookahead:1,occurrence:r,prodType:i,rule:n}),p=>j(p,y=>y[0]));if(Pb(h)&&h[0][0]&&!o){let p=h[0],y=gt(p);if(y.length===1&&ae(y[0].categoryMatches)){let E=y[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===E}}else{let _=it(y,(E,D)=>(D!==void 0&&(E[D.tokenTypeIdx]=!0,H(D.categoryMatches,w=>{E[w]=!0})),E),{});return function(){let E=this.LA(1);return _[E.tokenTypeIdx]===!0}}}return function(){let p=lm.call(this,s,l,Nb,a);return typeof p=="object"?!1:p===0}}};function Pb(t,e=!0){let r=new Set;for(let n of t){let i=new Set;for(let o of n){if(o===void 0){if(e)break;return!1}let s=[o.tokenTypeIdx].concat(o.categoryMatches);for(let a of s)if(r.has(a)){if(!i.has(a))return!1}else r.add(a),i.add(a)}}return!0}function H1(t){let e=t.decisionStates.length,r=Array(e);for(let n=0;n<e;n++)r[n]=B1(t.decisionStates[n],n);return r}function lm(t,e,r,n){let i=t[e](r),o=i.start;if(o===void 0){let a=tF(i.atnStartState);o=Ob(i,Db(a)),i.start=o}return G1.apply(this,[i,o,r,n])}function G1(t,e,r,n){let i=e,o=1,s=[],a=this.LA(o++);for(;;){let c=J1(i,a);if(c===void 0&&(c=z1.apply(this,[t,i,a,o,r,n])),c===Dc)return Y1(s,i,a);if(c.isAcceptState===!0)return c.prediction;i=c,s.push(a),a=this.LA(o++)}}function z1(t,e,r,n,i,o){let s=Q1(e.configs,r,i);if(s.size===0)return Ib(t,e,r,Dc),Dc;let a=Db(s),c=eF(s,i);if(c!==void 0)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;else if(oF(s)){let u=oR(s.alts);a.isAcceptState=!0,a.prediction=u,a.configs.uniqueAlt=u,V1.apply(this,[t,n,s.alts,o])}return a=Ib(t,e,r,a),a}function V1(t,e,r,n){let i=[];for(let u=1;u<=e;u++)i.push(this.LA(u).tokenType);let o=t.atnStartState,s=o.rule,a=o.production,c=K1({topLevelRule:s,ambiguityIndices:r,production:a,prefixPath:i});n(c)}function K1(t){let e=j(t.prefixPath,i=>$n(i)).join(", "),r=t.production.idx===0?"":t.production.idx,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${X1(t.production)}${r}> inside <${t.topLevelRule.name}> Rule,
147
147
  <${e}> may appears as a prefix path in all these alternatives.
148
148
  `;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
149
- For Further details.`,n}function K1(t){if(t instanceof Ae)return"SUBRULE";if(t instanceof we)return"OPTION";if(t instanceof Oe)return"OR";if(t instanceof Ue)return"AT_LEAST_ONE";if(t instanceof We)return"AT_LEAST_ONE_SEP";if(t instanceof De)return"MANY_SEP";if(t instanceof pe)return"MANY";if(t instanceof ue)return"CONSUME";throw Error("non exhaustive match")}function X1(t,e,r){let n=Bt(e.configs.elements,o=>o.state.transitions),i=fR(n.filter(o=>o instanceof ea).map(o=>o.tokenType),o=>o.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:t}}function Y1(t,e){return t.edges[e.tokenTypeIdx]}function J1(t,e,r){let n=new ia,i=[];for(let s of t.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===ra){i.push(s);continue}let a=s.state.transitions.length;for(let c=0;c<a;c++){let u=s.state.transitions[c],l=Q1(u,e);l!==void 0&&n.add({state:l,alt:s.alt,stack:s.stack})}}let o;if(i.length===0&&n.size===1&&(o=n),o===void 0){o=new ia;for(let s of n.elements)Cd(s,o)}if(i.length>0&&!rF(o))for(let s of i)o.add(s);return o}function Q1(t,e){if(t instanceof ea&&xc(e,t.tokenType))return t.target}function Z1(t,e){let r;for(let n of t.elements)if(e.is(n.alt)===!0){if(r===void 0)r=n.alt;else if(r!==n.alt)return}return r}function Db(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function Ib(t,e,r,n){return n=Ob(t,n),e.edges[r.tokenTypeIdx]=n,n}function Ob(t,e){if(e===Dc)return e;let r=e.configs.key,n=t.states[r];return n!==void 0?n:(e.configs.finalize(),t.states[r]=e,e)}function eF(t){let e=new ia,r=t.transitions.length;for(let n=0;n<r;n++){let o={state:t.transitions[n].target,alt:n,stack:[]};Cd(o,e)}return e}function Cd(t,e){let r=t.state;if(r.type===ra){if(t.stack.length>0){let i=[...t.stack],s={state:i.pop(),alt:t.alt,stack:i};Cd(s,e)}else e.add(t);return}r.epsilonOnlyTransitions||e.add(t);let n=r.transitions.length;for(let i=0;i<n;i++){let o=r.transitions[i],s=tF(t,o);s!==void 0&&Cd(s,e)}}function tF(t,e){if(e instanceof Ic)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof ta){let r=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:r}}}function rF(t){for(let e of t.elements)if(e.state.type===ra)return!0;return!1}function nF(t){for(let e of t.elements)if(e.state.type!==ra)return!1;return!0}function iF(t){if(nF(t))return!0;let e=oF(t.elements);return sF(e)&&!aF(e)}function oF(t){let e=new Map;for(let r of t){let n=um(r,!1),i=e.get(n);i===void 0&&(i={},e.set(n,i)),i[r.alt]=!0}return e}function sF(t){for(let e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function aF(t){for(let e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var Lb;(function(t){function e(r){return typeof r=="string"}t.is=e})(Lb||(Lb={}));var dm;(function(t){function e(r){return typeof r=="string"}t.is=e})(dm||(dm={}));var Mb;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Mb||(Mb={}));var Sd;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Sd||(Sd={}));var Te;(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=Sd.MAX_VALUE),i===Number.MAX_VALUE&&(i=Sd.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.uinteger(i.line)&&k.uinteger(i.character)}t.is=r})(Te||(Te={}));var me;(function(t){function e(n,i,o,s){if(k.uinteger(n)&&k.uinteger(i)&&k.uinteger(o)&&k.uinteger(s))return{start:Te.create(n,i),end:Te.create(o,s)};if(Te.is(n)&&Te.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${o}, ${s}]`)}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&Te.is(i.start)&&Te.is(i.end)}t.is=r})(me||(me={}));var kd;(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&me.is(i.range)&&(k.string(i.uri)||k.undefined(i.uri))}t.is=r})(kd||(kd={}));var Fb;(function(t){function e(n,i,o,s){return{targetUri:n,targetRange:i,targetSelectionRange:o,originSelectionRange:s}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&me.is(i.targetRange)&&k.string(i.targetUri)&&me.is(i.targetSelectionRange)&&(me.is(i.originSelectionRange)||k.undefined(i.originSelectionRange))}t.is=r})(Fb||(Fb={}));var fm;(function(t){function e(n,i,o,s){return{red:n,green:i,blue:o,alpha:s}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.numberRange(i.red,0,1)&&k.numberRange(i.green,0,1)&&k.numberRange(i.blue,0,1)&&k.numberRange(i.alpha,0,1)}t.is=r})(fm||(fm={}));var $b;(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&me.is(i.range)&&fm.is(i.color)}t.is=r})($b||($b={}));var qb;(function(t){function e(n,i,o){return{label:n,textEdit:i,additionalTextEdits:o}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.string(i.label)&&(k.undefined(i.textEdit)||gi.is(i))&&(k.undefined(i.additionalTextEdits)||k.typedArray(i.additionalTextEdits,gi.is))}t.is=r})(qb||(qb={}));var jb;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(jb||(jb={}));var Ub;(function(t){function e(n,i,o,s,a,c){let u={startLine:n,endLine:i};return k.defined(o)&&(u.startCharacter=o),k.defined(s)&&(u.endCharacter=s),k.defined(a)&&(u.kind=a),k.defined(c)&&(u.collapsedText=c),u}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.uinteger(i.startLine)&&k.uinteger(i.startLine)&&(k.undefined(i.startCharacter)||k.uinteger(i.startCharacter))&&(k.undefined(i.endCharacter)||k.uinteger(i.endCharacter))&&(k.undefined(i.kind)||k.string(i.kind))}t.is=r})(Ub||(Ub={}));var hm;(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&kd.is(i.location)&&k.string(i.message)}t.is=r})(hm||(hm={}));var Wb;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Wb||(Wb={}));var Bb;(function(t){t.Unnecessary=1,t.Deprecated=2})(Bb||(Bb={}));var Hb;(function(t){function e(r){let n=r;return k.objectLiteral(n)&&k.string(n.href)}t.is=e})(Hb||(Hb={}));var Ed;(function(t){function e(n,i,o,s,a,c){let u={range:n,message:i};return k.defined(o)&&(u.severity=o),k.defined(s)&&(u.code=s),k.defined(a)&&(u.source=a),k.defined(c)&&(u.relatedInformation=c),u}t.create=e;function r(n){var i;let o=n;return k.defined(o)&&me.is(o.range)&&k.string(o.message)&&(k.number(o.severity)||k.undefined(o.severity))&&(k.integer(o.code)||k.string(o.code)||k.undefined(o.code))&&(k.undefined(o.codeDescription)||k.string((i=o.codeDescription)===null||i===void 0?void 0:i.href))&&(k.string(o.source)||k.undefined(o.source))&&(k.undefined(o.relatedInformation)||k.typedArray(o.relatedInformation,hm.is))}t.is=r})(Ed||(Ed={}));var oa;(function(t){function e(n,i,...o){let s={title:n,command:i};return k.defined(o)&&o.length>0&&(s.arguments=o),s}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.title)&&k.string(i.command)}t.is=r})(oa||(oa={}));var gi;(function(t){function e(o,s){return{range:o,newText:s}}t.replace=e;function r(o,s){return{range:{start:o,end:o},newText:s}}t.insert=r;function n(o){return{range:o,newText:""}}t.del=n;function i(o){let s=o;return k.objectLiteral(s)&&k.string(s.newText)&&me.is(s.range)}t.is=i})(gi||(gi={}));var pm;(function(t){function e(n,i,o){let s={label:n};return i!==void 0&&(s.needsConfirmation=i),o!==void 0&&(s.description=o),s}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.string(i.label)&&(k.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(k.string(i.description)||i.description===void 0)}t.is=r})(pm||(pm={}));var sa;(function(t){function e(r){let n=r;return k.string(n)}t.is=e})(sa||(sa={}));var Gb;(function(t){function e(o,s,a){return{range:o,newText:s,annotationId:a}}t.replace=e;function r(o,s,a){return{range:{start:o,end:o},newText:s,annotationId:a}}t.insert=r;function n(o,s){return{range:o,newText:"",annotationId:s}}t.del=n;function i(o){let s=o;return gi.is(s)&&(pm.is(s.annotationId)||sa.is(s.annotationId))}t.is=i})(Gb||(Gb={}));var mm;(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&Tm.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(mm||(mm={}));var gm;(function(t){function e(n,i,o){let s={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}t.create=e;function r(n){let i=n;return i&&i.kind==="create"&&k.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||k.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||k.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||sa.is(i.annotationId))}t.is=r})(gm||(gm={}));var ym;(function(t){function e(n,i,o,s){let a={kind:"rename",oldUri:n,newUri:i};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}t.create=e;function r(n){let i=n;return i&&i.kind==="rename"&&k.string(i.oldUri)&&k.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||k.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||k.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||sa.is(i.annotationId))}t.is=r})(ym||(ym={}));var vm;(function(t){function e(n,i,o){let s={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}t.create=e;function r(n){let i=n;return i&&i.kind==="delete"&&k.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||k.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||k.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||sa.is(i.annotationId))}t.is=r})(vm||(vm={}));var xm;(function(t){function e(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>k.string(i.kind)?gm.is(i)||ym.is(i)||vm.is(i):mm.is(i)))}t.is=e})(xm||(xm={}));var zb;(function(t){function e(n){return{uri:n}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.uri)}t.is=r})(zb||(zb={}));var Vb;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.uri)&&k.integer(i.version)}t.is=r})(Vb||(Vb={}));var Tm;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.uri)&&(i.version===null||k.integer(i.version))}t.is=r})(Tm||(Tm={}));var Kb;(function(t){function e(n,i,o,s){return{uri:n,languageId:i,version:o,text:s}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.uri)&&k.string(i.languageId)&&k.integer(i.version)&&k.string(i.text)}t.is=r})(Kb||(Kb={}));var Rm;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){let n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(Rm||(Rm={}));var Lc;(function(t){function e(r){let n=r;return k.objectLiteral(r)&&Rm.is(n.kind)&&k.string(n.value)}t.is=e})(Lc||(Lc={}));var Xb;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Xb||(Xb={}));var Yb;(function(t){t.PlainText=1,t.Snippet=2})(Yb||(Yb={}));var Jb;(function(t){t.Deprecated=1})(Jb||(Jb={}));var Qb;(function(t){function e(n,i,o){return{newText:n,insert:i,replace:o}}t.create=e;function r(n){let i=n;return i&&k.string(i.newText)&&me.is(i.insert)&&me.is(i.replace)}t.is=r})(Qb||(Qb={}));var Zb;(function(t){t.asIs=1,t.adjustIndentation=2})(Zb||(Zb={}));var e_;(function(t){function e(r){let n=r;return n&&(k.string(n.detail)||n.detail===void 0)&&(k.string(n.description)||n.description===void 0)}t.is=e})(e_||(e_={}));var t_;(function(t){function e(r){return{label:r}}t.create=e})(t_||(t_={}));var r_;(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(r_||(r_={}));var Ad;(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){let i=n;return k.string(i)||k.objectLiteral(i)&&k.string(i.language)&&k.string(i.value)}t.is=r})(Ad||(Ad={}));var n_;(function(t){function e(r){let n=r;return!!n&&k.objectLiteral(n)&&(Lc.is(n.contents)||Ad.is(n.contents)||k.typedArray(n.contents,Ad.is))&&(r.range===void 0||me.is(r.range))}t.is=e})(n_||(n_={}));var i_;(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(i_||(i_={}));var o_;(function(t){function e(r,n,...i){let o={label:r};return k.defined(n)&&(o.documentation=n),k.defined(i)?o.parameters=i:o.parameters=[],o}t.create=e})(o_||(o_={}));var s_;(function(t){t.Text=1,t.Read=2,t.Write=3})(s_||(s_={}));var a_;(function(t){function e(r,n){let i={range:r};return k.number(n)&&(i.kind=n),i}t.create=e})(a_||(a_={}));var c_;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(c_||(c_={}));var u_;(function(t){t.Deprecated=1})(u_||(u_={}));var l_;(function(t){function e(r,n,i,o,s){let a={name:r,kind:n,location:{uri:o,range:i}};return s&&(a.containerName=s),a}t.create=e})(l_||(l_={}));var d_;(function(t){function e(r,n,i,o){return o!==void 0?{name:r,kind:n,location:{uri:i,range:o}}:{name:r,kind:n,location:{uri:i}}}t.create=e})(d_||(d_={}));var f_;(function(t){function e(n,i,o,s,a,c){let u={name:n,detail:i,kind:o,range:s,selectionRange:a};return c!==void 0&&(u.children=c),u}t.create=e;function r(n){let i=n;return i&&k.string(i.name)&&k.number(i.kind)&&me.is(i.range)&&me.is(i.selectionRange)&&(i.detail===void 0||k.string(i.detail))&&(i.deprecated===void 0||k.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(f_||(f_={}));var h_;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(h_||(h_={}));var wd;(function(t){t.Invoked=1,t.Automatic=2})(wd||(wd={}));var p_;(function(t){function e(n,i,o){let s={diagnostics:n};return i!=null&&(s.only=i),o!=null&&(s.triggerKind=o),s}t.create=e;function r(n){let i=n;return k.defined(i)&&k.typedArray(i.diagnostics,Ed.is)&&(i.only===void 0||k.typedArray(i.only,k.string))&&(i.triggerKind===void 0||i.triggerKind===wd.Invoked||i.triggerKind===wd.Automatic)}t.is=r})(p_||(p_={}));var m_;(function(t){function e(n,i,o){let s={title:n},a=!0;return typeof i=="string"?(a=!1,s.kind=i):oa.is(i)?s.command=i:s.edit=i,a&&o!==void 0&&(s.kind=o),s}t.create=e;function r(n){let i=n;return i&&k.string(i.title)&&(i.diagnostics===void 0||k.typedArray(i.diagnostics,Ed.is))&&(i.kind===void 0||k.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||oa.is(i.command))&&(i.isPreferred===void 0||k.boolean(i.isPreferred))&&(i.edit===void 0||xm.is(i.edit))}t.is=r})(m_||(m_={}));var g_;(function(t){function e(n,i){let o={range:n};return k.defined(i)&&(o.data=i),o}t.create=e;function r(n){let i=n;return k.defined(i)&&me.is(i.range)&&(k.undefined(i.command)||oa.is(i.command))}t.is=r})(g_||(g_={}));var y_;(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.uinteger(i.tabSize)&&k.boolean(i.insertSpaces)}t.is=r})(y_||(y_={}));var v_;(function(t){function e(n,i,o){return{range:n,target:i,data:o}}t.create=e;function r(n){let i=n;return k.defined(i)&&me.is(i.range)&&(k.undefined(i.target)||k.string(i.target))}t.is=r})(v_||(v_={}));var x_;(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&me.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(x_||(x_={}));var T_;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(T_||(T_={}));var R_;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(R_||(R_={}));var b_;(function(t){function e(r){let n=r;return k.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}t.is=e})(b_||(b_={}));var __;(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){let i=n;return i!=null&&me.is(i.range)&&k.string(i.text)}t.is=r})(__||(__={}));var C_;(function(t){function e(n,i,o){return{range:n,variableName:i,caseSensitiveLookup:o}}t.create=e;function r(n){let i=n;return i!=null&&me.is(i.range)&&k.boolean(i.caseSensitiveLookup)&&(k.string(i.variableName)||i.variableName===void 0)}t.is=r})(C_||(C_={}));var S_;(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){let i=n;return i!=null&&me.is(i.range)&&(k.string(i.expression)||i.expression===void 0)}t.is=r})(S_||(S_={}));var k_;(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&me.is(n.stoppedLocation)}t.is=r})(k_||(k_={}));var bm;(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(bm||(bm={}));var _m;(function(t){function e(n){return{value:n}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&(i.tooltip===void 0||k.string(i.tooltip)||Lc.is(i.tooltip))&&(i.location===void 0||kd.is(i.location))&&(i.command===void 0||oa.is(i.command))}t.is=r})(_m||(_m={}));var E_;(function(t){function e(n,i,o){let s={position:n,label:i};return o!==void 0&&(s.kind=o),s}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&Te.is(i.position)&&(k.string(i.label)||k.typedArray(i.label,_m.is))&&(i.kind===void 0||bm.is(i.kind))&&i.textEdits===void 0||k.typedArray(i.textEdits,gi.is)&&(i.tooltip===void 0||k.string(i.tooltip)||Lc.is(i.tooltip))&&(i.paddingLeft===void 0||k.boolean(i.paddingLeft))&&(i.paddingRight===void 0||k.boolean(i.paddingRight))}t.is=r})(E_||(E_={}));var A_;(function(t){function e(r){return{kind:"snippet",value:r}}t.createSnippet=e})(A_||(A_={}));var w_;(function(t){function e(r,n,i,o){return{insertText:r,filterText:n,range:i,command:o}}t.create=e})(w_||(w_={}));var N_;(function(t){function e(r){return{items:r}}t.create=e})(N_||(N_={}));var P_;(function(t){t.Invoked=0,t.Automatic=1})(P_||(P_={}));var I_;(function(t){function e(r,n){return{range:r,text:n}}t.create=e})(I_||(I_={}));var D_;(function(t){function e(r,n){return{triggerKind:r,selectedCompletionInfo:n}}t.create=e})(D_||(D_={}));var O_;(function(t){function e(r){let n=r;return k.objectLiteral(n)&&dm.is(n.uri)&&k.string(n.name)}t.is=e})(O_||(O_={}));var L_;(function(t){function e(o,s,a,c){return new Cm(o,s,a,c)}t.create=e;function r(o){let s=o;return!!(k.defined(s)&&k.string(s.uri)&&(k.undefined(s.languageId)||k.string(s.languageId))&&k.uinteger(s.lineCount)&&k.func(s.getText)&&k.func(s.positionAt)&&k.func(s.offsetAt))}t.is=r;function n(o,s){let a=o.getText(),c=i(s,(l,h)=>{let p=l.range.start.line-h.range.start.line;return p===0?l.range.start.character-h.range.start.character:p}),u=a.length;for(let l=c.length-1;l>=0;l--){let h=c[l],p=o.offsetAt(h.range.start),y=o.offsetAt(h.range.end);if(y<=u)a=a.substring(0,p)+h.newText+a.substring(y,a.length);else throw new Error("Overlapping edit");u=p}return a}t.applyEdits=n;function i(o,s){if(o.length<=1)return o;let a=o.length/2|0,c=o.slice(0,a),u=o.slice(a);i(c,s),i(u,s);let l=0,h=0,p=0;for(;l<c.length&&h<u.length;)s(c[l],u[h])<=0?o[p++]=c[l++]:o[p++]=u[h++];for(;l<c.length;)o[p++]=c[l++];for(;h<u.length;)o[p++]=u[h++];return o}})(L_||(L_={}));var Cm=class{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){this._content=e.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],r=this._content,n=!0;for(let i=0;i<r.length;i++){n&&(e.push(i),n=!1);let o=r.charAt(i);n=o==="\r"||o===`
149
+ For Further details.`,n}function X1(t){if(t instanceof Ae)return"SUBRULE";if(t instanceof we)return"OPTION";if(t instanceof Oe)return"OR";if(t instanceof Ue)return"AT_LEAST_ONE";if(t instanceof We)return"AT_LEAST_ONE_SEP";if(t instanceof De)return"MANY_SEP";if(t instanceof pe)return"MANY";if(t instanceof ue)return"CONSUME";throw Error("non exhaustive match")}function Y1(t,e,r){let n=Bt(e.configs.elements,o=>o.state.transitions),i=fR(n.filter(o=>o instanceof ea).map(o=>o.tokenType),o=>o.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:t}}function J1(t,e){return t.edges[e.tokenTypeIdx]}function Q1(t,e,r){let n=new ia,i=[];for(let s of t.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===ra){i.push(s);continue}let a=s.state.transitions.length;for(let c=0;c<a;c++){let u=s.state.transitions[c],l=Z1(u,e);l!==void 0&&n.add({state:l,alt:s.alt,stack:s.stack})}}let o;if(i.length===0&&n.size===1&&(o=n),o===void 0){o=new ia;for(let s of n.elements)Cd(s,o)}if(i.length>0&&!nF(o))for(let s of i)o.add(s);return o}function Z1(t,e){if(t instanceof ea&&xc(e,t.tokenType))return t.target}function eF(t,e){let r;for(let n of t.elements)if(e.is(n.alt)===!0){if(r===void 0)r=n.alt;else if(r!==n.alt)return}return r}function Db(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function Ib(t,e,r,n){return n=Ob(t,n),e.edges[r.tokenTypeIdx]=n,n}function Ob(t,e){if(e===Dc)return e;let r=e.configs.key,n=t.states[r];return n!==void 0?n:(e.configs.finalize(),t.states[r]=e,e)}function tF(t){let e=new ia,r=t.transitions.length;for(let n=0;n<r;n++){let o={state:t.transitions[n].target,alt:n,stack:[]};Cd(o,e)}return e}function Cd(t,e){let r=t.state;if(r.type===ra){if(t.stack.length>0){let i=[...t.stack],s={state:i.pop(),alt:t.alt,stack:i};Cd(s,e)}else e.add(t);return}r.epsilonOnlyTransitions||e.add(t);let n=r.transitions.length;for(let i=0;i<n;i++){let o=r.transitions[i],s=rF(t,o);s!==void 0&&Cd(s,e)}}function rF(t,e){if(e instanceof Ic)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof ta){let r=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:r}}}function nF(t){for(let e of t.elements)if(e.state.type===ra)return!0;return!1}function iF(t){for(let e of t.elements)if(e.state.type!==ra)return!1;return!0}function oF(t){if(iF(t))return!0;let e=sF(t.elements);return aF(e)&&!cF(e)}function sF(t){let e=new Map;for(let r of t){let n=um(r,!1),i=e.get(n);i===void 0&&(i={},e.set(n,i)),i[r.alt]=!0}return e}function aF(t){for(let e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function cF(t){for(let e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var Lb;(function(t){function e(r){return typeof r=="string"}t.is=e})(Lb||(Lb={}));var dm;(function(t){function e(r){return typeof r=="string"}t.is=e})(dm||(dm={}));var Mb;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Mb||(Mb={}));var Sd;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Sd||(Sd={}));var Te;(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=Sd.MAX_VALUE),i===Number.MAX_VALUE&&(i=Sd.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.uinteger(i.line)&&k.uinteger(i.character)}t.is=r})(Te||(Te={}));var me;(function(t){function e(n,i,o,s){if(k.uinteger(n)&&k.uinteger(i)&&k.uinteger(o)&&k.uinteger(s))return{start:Te.create(n,i),end:Te.create(o,s)};if(Te.is(n)&&Te.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${o}, ${s}]`)}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&Te.is(i.start)&&Te.is(i.end)}t.is=r})(me||(me={}));var kd;(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&me.is(i.range)&&(k.string(i.uri)||k.undefined(i.uri))}t.is=r})(kd||(kd={}));var Fb;(function(t){function e(n,i,o,s){return{targetUri:n,targetRange:i,targetSelectionRange:o,originSelectionRange:s}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&me.is(i.targetRange)&&k.string(i.targetUri)&&me.is(i.targetSelectionRange)&&(me.is(i.originSelectionRange)||k.undefined(i.originSelectionRange))}t.is=r})(Fb||(Fb={}));var fm;(function(t){function e(n,i,o,s){return{red:n,green:i,blue:o,alpha:s}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.numberRange(i.red,0,1)&&k.numberRange(i.green,0,1)&&k.numberRange(i.blue,0,1)&&k.numberRange(i.alpha,0,1)}t.is=r})(fm||(fm={}));var $b;(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&me.is(i.range)&&fm.is(i.color)}t.is=r})($b||($b={}));var qb;(function(t){function e(n,i,o){return{label:n,textEdit:i,additionalTextEdits:o}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.string(i.label)&&(k.undefined(i.textEdit)||gi.is(i))&&(k.undefined(i.additionalTextEdits)||k.typedArray(i.additionalTextEdits,gi.is))}t.is=r})(qb||(qb={}));var jb;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(jb||(jb={}));var Ub;(function(t){function e(n,i,o,s,a,c){let u={startLine:n,endLine:i};return k.defined(o)&&(u.startCharacter=o),k.defined(s)&&(u.endCharacter=s),k.defined(a)&&(u.kind=a),k.defined(c)&&(u.collapsedText=c),u}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.uinteger(i.startLine)&&k.uinteger(i.startLine)&&(k.undefined(i.startCharacter)||k.uinteger(i.startCharacter))&&(k.undefined(i.endCharacter)||k.uinteger(i.endCharacter))&&(k.undefined(i.kind)||k.string(i.kind))}t.is=r})(Ub||(Ub={}));var hm;(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&kd.is(i.location)&&k.string(i.message)}t.is=r})(hm||(hm={}));var Wb;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Wb||(Wb={}));var Bb;(function(t){t.Unnecessary=1,t.Deprecated=2})(Bb||(Bb={}));var Hb;(function(t){function e(r){let n=r;return k.objectLiteral(n)&&k.string(n.href)}t.is=e})(Hb||(Hb={}));var Ed;(function(t){function e(n,i,o,s,a,c){let u={range:n,message:i};return k.defined(o)&&(u.severity=o),k.defined(s)&&(u.code=s),k.defined(a)&&(u.source=a),k.defined(c)&&(u.relatedInformation=c),u}t.create=e;function r(n){var i;let o=n;return k.defined(o)&&me.is(o.range)&&k.string(o.message)&&(k.number(o.severity)||k.undefined(o.severity))&&(k.integer(o.code)||k.string(o.code)||k.undefined(o.code))&&(k.undefined(o.codeDescription)||k.string((i=o.codeDescription)===null||i===void 0?void 0:i.href))&&(k.string(o.source)||k.undefined(o.source))&&(k.undefined(o.relatedInformation)||k.typedArray(o.relatedInformation,hm.is))}t.is=r})(Ed||(Ed={}));var oa;(function(t){function e(n,i,...o){let s={title:n,command:i};return k.defined(o)&&o.length>0&&(s.arguments=o),s}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.title)&&k.string(i.command)}t.is=r})(oa||(oa={}));var gi;(function(t){function e(o,s){return{range:o,newText:s}}t.replace=e;function r(o,s){return{range:{start:o,end:o},newText:s}}t.insert=r;function n(o){return{range:o,newText:""}}t.del=n;function i(o){let s=o;return k.objectLiteral(s)&&k.string(s.newText)&&me.is(s.range)}t.is=i})(gi||(gi={}));var pm;(function(t){function e(n,i,o){let s={label:n};return i!==void 0&&(s.needsConfirmation=i),o!==void 0&&(s.description=o),s}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&k.string(i.label)&&(k.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(k.string(i.description)||i.description===void 0)}t.is=r})(pm||(pm={}));var sa;(function(t){function e(r){let n=r;return k.string(n)}t.is=e})(sa||(sa={}));var Gb;(function(t){function e(o,s,a){return{range:o,newText:s,annotationId:a}}t.replace=e;function r(o,s,a){return{range:{start:o,end:o},newText:s,annotationId:a}}t.insert=r;function n(o,s){return{range:o,newText:"",annotationId:s}}t.del=n;function i(o){let s=o;return gi.is(s)&&(pm.is(s.annotationId)||sa.is(s.annotationId))}t.is=i})(Gb||(Gb={}));var mm;(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&Tm.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(mm||(mm={}));var gm;(function(t){function e(n,i,o){let s={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}t.create=e;function r(n){let i=n;return i&&i.kind==="create"&&k.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||k.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||k.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||sa.is(i.annotationId))}t.is=r})(gm||(gm={}));var ym;(function(t){function e(n,i,o,s){let a={kind:"rename",oldUri:n,newUri:i};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}t.create=e;function r(n){let i=n;return i&&i.kind==="rename"&&k.string(i.oldUri)&&k.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||k.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||k.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||sa.is(i.annotationId))}t.is=r})(ym||(ym={}));var vm;(function(t){function e(n,i,o){let s={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}t.create=e;function r(n){let i=n;return i&&i.kind==="delete"&&k.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||k.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||k.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||sa.is(i.annotationId))}t.is=r})(vm||(vm={}));var xm;(function(t){function e(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>k.string(i.kind)?gm.is(i)||ym.is(i)||vm.is(i):mm.is(i)))}t.is=e})(xm||(xm={}));var zb;(function(t){function e(n){return{uri:n}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.uri)}t.is=r})(zb||(zb={}));var Vb;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.uri)&&k.integer(i.version)}t.is=r})(Vb||(Vb={}));var Tm;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.uri)&&(i.version===null||k.integer(i.version))}t.is=r})(Tm||(Tm={}));var Kb;(function(t){function e(n,i,o,s){return{uri:n,languageId:i,version:o,text:s}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.string(i.uri)&&k.string(i.languageId)&&k.integer(i.version)&&k.string(i.text)}t.is=r})(Kb||(Kb={}));var Rm;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){let n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(Rm||(Rm={}));var Lc;(function(t){function e(r){let n=r;return k.objectLiteral(r)&&Rm.is(n.kind)&&k.string(n.value)}t.is=e})(Lc||(Lc={}));var Xb;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Xb||(Xb={}));var Yb;(function(t){t.PlainText=1,t.Snippet=2})(Yb||(Yb={}));var Jb;(function(t){t.Deprecated=1})(Jb||(Jb={}));var Qb;(function(t){function e(n,i,o){return{newText:n,insert:i,replace:o}}t.create=e;function r(n){let i=n;return i&&k.string(i.newText)&&me.is(i.insert)&&me.is(i.replace)}t.is=r})(Qb||(Qb={}));var Zb;(function(t){t.asIs=1,t.adjustIndentation=2})(Zb||(Zb={}));var e_;(function(t){function e(r){let n=r;return n&&(k.string(n.detail)||n.detail===void 0)&&(k.string(n.description)||n.description===void 0)}t.is=e})(e_||(e_={}));var t_;(function(t){function e(r){return{label:r}}t.create=e})(t_||(t_={}));var r_;(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(r_||(r_={}));var Ad;(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){let i=n;return k.string(i)||k.objectLiteral(i)&&k.string(i.language)&&k.string(i.value)}t.is=r})(Ad||(Ad={}));var n_;(function(t){function e(r){let n=r;return!!n&&k.objectLiteral(n)&&(Lc.is(n.contents)||Ad.is(n.contents)||k.typedArray(n.contents,Ad.is))&&(r.range===void 0||me.is(r.range))}t.is=e})(n_||(n_={}));var i_;(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(i_||(i_={}));var o_;(function(t){function e(r,n,...i){let o={label:r};return k.defined(n)&&(o.documentation=n),k.defined(i)?o.parameters=i:o.parameters=[],o}t.create=e})(o_||(o_={}));var s_;(function(t){t.Text=1,t.Read=2,t.Write=3})(s_||(s_={}));var a_;(function(t){function e(r,n){let i={range:r};return k.number(n)&&(i.kind=n),i}t.create=e})(a_||(a_={}));var c_;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(c_||(c_={}));var u_;(function(t){t.Deprecated=1})(u_||(u_={}));var l_;(function(t){function e(r,n,i,o,s){let a={name:r,kind:n,location:{uri:o,range:i}};return s&&(a.containerName=s),a}t.create=e})(l_||(l_={}));var d_;(function(t){function e(r,n,i,o){return o!==void 0?{name:r,kind:n,location:{uri:i,range:o}}:{name:r,kind:n,location:{uri:i}}}t.create=e})(d_||(d_={}));var f_;(function(t){function e(n,i,o,s,a,c){let u={name:n,detail:i,kind:o,range:s,selectionRange:a};return c!==void 0&&(u.children=c),u}t.create=e;function r(n){let i=n;return i&&k.string(i.name)&&k.number(i.kind)&&me.is(i.range)&&me.is(i.selectionRange)&&(i.detail===void 0||k.string(i.detail))&&(i.deprecated===void 0||k.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(f_||(f_={}));var h_;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(h_||(h_={}));var wd;(function(t){t.Invoked=1,t.Automatic=2})(wd||(wd={}));var p_;(function(t){function e(n,i,o){let s={diagnostics:n};return i!=null&&(s.only=i),o!=null&&(s.triggerKind=o),s}t.create=e;function r(n){let i=n;return k.defined(i)&&k.typedArray(i.diagnostics,Ed.is)&&(i.only===void 0||k.typedArray(i.only,k.string))&&(i.triggerKind===void 0||i.triggerKind===wd.Invoked||i.triggerKind===wd.Automatic)}t.is=r})(p_||(p_={}));var m_;(function(t){function e(n,i,o){let s={title:n},a=!0;return typeof i=="string"?(a=!1,s.kind=i):oa.is(i)?s.command=i:s.edit=i,a&&o!==void 0&&(s.kind=o),s}t.create=e;function r(n){let i=n;return i&&k.string(i.title)&&(i.diagnostics===void 0||k.typedArray(i.diagnostics,Ed.is))&&(i.kind===void 0||k.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||oa.is(i.command))&&(i.isPreferred===void 0||k.boolean(i.isPreferred))&&(i.edit===void 0||xm.is(i.edit))}t.is=r})(m_||(m_={}));var g_;(function(t){function e(n,i){let o={range:n};return k.defined(i)&&(o.data=i),o}t.create=e;function r(n){let i=n;return k.defined(i)&&me.is(i.range)&&(k.undefined(i.command)||oa.is(i.command))}t.is=r})(g_||(g_={}));var y_;(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&k.uinteger(i.tabSize)&&k.boolean(i.insertSpaces)}t.is=r})(y_||(y_={}));var v_;(function(t){function e(n,i,o){return{range:n,target:i,data:o}}t.create=e;function r(n){let i=n;return k.defined(i)&&me.is(i.range)&&(k.undefined(i.target)||k.string(i.target))}t.is=r})(v_||(v_={}));var x_;(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&me.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(x_||(x_={}));var T_;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(T_||(T_={}));var R_;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(R_||(R_={}));var b_;(function(t){function e(r){let n=r;return k.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}t.is=e})(b_||(b_={}));var __;(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){let i=n;return i!=null&&me.is(i.range)&&k.string(i.text)}t.is=r})(__||(__={}));var C_;(function(t){function e(n,i,o){return{range:n,variableName:i,caseSensitiveLookup:o}}t.create=e;function r(n){let i=n;return i!=null&&me.is(i.range)&&k.boolean(i.caseSensitiveLookup)&&(k.string(i.variableName)||i.variableName===void 0)}t.is=r})(C_||(C_={}));var S_;(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){let i=n;return i!=null&&me.is(i.range)&&(k.string(i.expression)||i.expression===void 0)}t.is=r})(S_||(S_={}));var k_;(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){let i=n;return k.defined(i)&&me.is(n.stoppedLocation)}t.is=r})(k_||(k_={}));var bm;(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(bm||(bm={}));var _m;(function(t){function e(n){return{value:n}}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&(i.tooltip===void 0||k.string(i.tooltip)||Lc.is(i.tooltip))&&(i.location===void 0||kd.is(i.location))&&(i.command===void 0||oa.is(i.command))}t.is=r})(_m||(_m={}));var E_;(function(t){function e(n,i,o){let s={position:n,label:i};return o!==void 0&&(s.kind=o),s}t.create=e;function r(n){let i=n;return k.objectLiteral(i)&&Te.is(i.position)&&(k.string(i.label)||k.typedArray(i.label,_m.is))&&(i.kind===void 0||bm.is(i.kind))&&i.textEdits===void 0||k.typedArray(i.textEdits,gi.is)&&(i.tooltip===void 0||k.string(i.tooltip)||Lc.is(i.tooltip))&&(i.paddingLeft===void 0||k.boolean(i.paddingLeft))&&(i.paddingRight===void 0||k.boolean(i.paddingRight))}t.is=r})(E_||(E_={}));var A_;(function(t){function e(r){return{kind:"snippet",value:r}}t.createSnippet=e})(A_||(A_={}));var w_;(function(t){function e(r,n,i,o){return{insertText:r,filterText:n,range:i,command:o}}t.create=e})(w_||(w_={}));var N_;(function(t){function e(r){return{items:r}}t.create=e})(N_||(N_={}));var P_;(function(t){t.Invoked=0,t.Automatic=1})(P_||(P_={}));var I_;(function(t){function e(r,n){return{range:r,text:n}}t.create=e})(I_||(I_={}));var D_;(function(t){function e(r,n){return{triggerKind:r,selectedCompletionInfo:n}}t.create=e})(D_||(D_={}));var O_;(function(t){function e(r){let n=r;return k.objectLiteral(n)&&dm.is(n.uri)&&k.string(n.name)}t.is=e})(O_||(O_={}));var L_;(function(t){function e(o,s,a,c){return new Cm(o,s,a,c)}t.create=e;function r(o){let s=o;return!!(k.defined(s)&&k.string(s.uri)&&(k.undefined(s.languageId)||k.string(s.languageId))&&k.uinteger(s.lineCount)&&k.func(s.getText)&&k.func(s.positionAt)&&k.func(s.offsetAt))}t.is=r;function n(o,s){let a=o.getText(),c=i(s,(l,h)=>{let p=l.range.start.line-h.range.start.line;return p===0?l.range.start.character-h.range.start.character:p}),u=a.length;for(let l=c.length-1;l>=0;l--){let h=c[l],p=o.offsetAt(h.range.start),y=o.offsetAt(h.range.end);if(y<=u)a=a.substring(0,p)+h.newText+a.substring(y,a.length);else throw new Error("Overlapping edit");u=p}return a}t.applyEdits=n;function i(o,s){if(o.length<=1)return o;let a=o.length/2|0,c=o.slice(0,a),u=o.slice(a);i(c,s),i(u,s);let l=0,h=0,p=0;for(;l<c.length&&h<u.length;)s(c[l],u[h])<=0?o[p++]=c[l++]:o[p++]=u[h++];for(;l<c.length;)o[p++]=c[l++];for(;h<u.length;)o[p++]=u[h++];return o}})(L_||(L_={}));var Cm=class{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){this._content=e.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],r=this._content,n=!0;for(let i=0;i<r.length;i++){n&&(e.push(i),n=!1);let o=r.charAt(i);n=o==="\r"||o===`
150
150
  `,o==="\r"&&i+1<r.length&&r.charAt(i+1)===`
151
- `&&i++}n&&r.length>0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return Te.create(0,e);for(;n<i;){let s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}let o=n-1;return Te.create(o,e-r[o])}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}},k;(function(t){let e=Object.prototype.toString;function r(y){return typeof y<"u"}t.defined=r;function n(y){return typeof y>"u"}t.undefined=n;function i(y){return y===!0||y===!1}t.boolean=i;function o(y){return e.call(y)==="[object String]"}t.string=o;function s(y){return e.call(y)==="[object Number]"}t.number=s;function a(y,_,E){return e.call(y)==="[object Number]"&&_<=y&&y<=E}t.numberRange=a;function c(y){return e.call(y)==="[object Number]"&&-2147483648<=y&&y<=2147483647}t.integer=c;function u(y){return e.call(y)==="[object Number]"&&0<=y&&y<=2147483647}t.uinteger=u;function l(y){return e.call(y)==="[object Function]"}t.func=l;function h(y){return y!==null&&typeof y=="object"}t.objectLiteral=h;function p(y,_){return Array.isArray(y)&&y.every(_)}t.typedArray=p})(k||(k={}));var Mc=class{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?e:this.rootNode}buildRootNode(e){return this.rootNode=new aa(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let r=new ro;return r.grammarSource=e,r.root=this.rootNode,this.current.content.push(r),this.nodeStack.push(r),r}buildLeafNode(e,r){let n=new to(e.startOffset,e.image.length,Eo(e),e.tokenType,!r);return n.grammarSource=r,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){let r=e.container;if(r){let n=r.content.indexOf(e);n>=0&&r.content.splice(n,1)}}addHiddenNodes(e){let r=[];for(let o of e){let s=new to(o.startOffset,o.image.length,Eo(o),o.tokenType,!0);s.root=this.rootNode,r.push(s)}let n=this.current,i=!1;if(n.content.length>0){n.content.push(...r);return}for(;n.container;){let o=n.container.content.indexOf(n);if(o>0){n.container.content.splice(o,0,...r),i=!0;break}n=n.container}i||this.rootNode.content.unshift(...r)}construct(e){let r=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=r;let n=this.nodeStack.pop();n?.content.length===0&&this.removeNode(n)}},Fc=class{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,r;let n=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(r=this.container)===null||r===void 0?void 0:r.astNode;if(!n)throw new Error("This node has no associated AST element");return n}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}},to=class extends Fc{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,r,n,i,o=!1){super(),this._hidden=o,this._offset=e,this._tokenType=i,this._length=r,this._range=n}},ro=class extends Fc{constructor(){super(...arguments),this.content=new Sm(this)}get children(){return this.content}get offset(){var e,r;return(r=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&r!==void 0?r:0}get length(){return this.end-this.offset}get end(){var e,r;return(r=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&r!==void 0?r:0}get range(){let e=this.firstNonHiddenNode,r=this.lastNonHiddenNode;if(e&&r){if(this._rangeCache===void 0){let{range:n}=e,{range:i}=r;this._rangeCache={start:n.start,end:i.end.line<n.start.line?n.start:i.end}}return this._rangeCache}else return{start:Te.create(0,0),end:Te.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 r=this.content[e];if(!r.hidden)return r}return this.content[this.content.length-1]}},Sm=class t extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,t.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,r,...n){return this.addParents(n),super.splice(e,r,...n)}addParents(e){for(let r of e)r.container=this.parent}},aa=class extends ro{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}};var Nd=Symbol("Datatype");function km(t){return t.$type===Nd}var M_="\u200B",F_=t=>t.endsWith(M_)?t:t+M_,$c=class{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;let r=this.lexer.definition,n=e.LanguageMetaData.mode==="production";this.wrapper=new Em(r,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:n,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,r){this.wrapper.wrapOr(e,r)}optional(e,r){this.wrapper.wrapOption(e,r)}many(e,r){this.wrapper.wrapMany(e,r)}atLeastOne(e,r){this.wrapper.wrapAtLeastOne(e,r)}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()}},qc=class extends $c{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Mc,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,r){let n=this.computeRuleType(e),i=this.wrapper.DEFINE_RULE(F_(e.name),this.startImplementation(n,r).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment){if(uc(e))return Nd;{let r=an(e);return r??e.name}}}parse(e,r={}){this.nodeBuilder.buildRootNode(e);let n=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=n.tokens;let i=r.rule?this.allRules.get(r.rule):this.mainRule;if(!i)throw new Error(r.rule?`No rule found with name '${r.rule}'`:"No main rule available.");let o=this.doParse(i);return this.nodeBuilder.addHiddenNodes(n.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:o,lexerErrors:n.errors,lexerReport:n.report,parserErrors:this.wrapper.errors}}doParse(e){let r=e.call(this.wrapper,{});if(this.stack.length>0&&(r=this.construct()),r===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return r}startImplementation(e,r){return n=>{let i=!this.isRecording()&&e!==void 0;if(i){let o={$type:e};this.stack.push(o),e===Nd&&(o.value="")}return r(n),i?this.construct():void 0}}extractHiddenTokens(e){let r=this.lexerResult.hidden;if(!r.length)return[];let n=e.startOffset;for(let i=0;i<r.length;i++)if(r[i].startOffset>n)return r.splice(0,i);return r.splice(0,r.length)}consume(e,r,n){let i=this.wrapper.wrapConsume(e,r);if(!this.isRecording()&&this.isValidToken(i)){let o=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(o);let s=this.nodeBuilder.buildLeafNode(i,n),{assignment:a,isCrossRef:c}=this.getAssignment(n),u=this.current;if(a){let l=Et(n)?i.image:this.converter.convert(i.image,s);this.assign(a.operator,a.feature,l,s,c)}else if(km(u)){let l=i.image;Et(n)||(l=this.converter.convert(l,s).toString()),u.value+=l}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,r,n,i,o){let s;!this.isRecording()&&!n&&(s=this.nodeBuilder.buildCompositeNode(i));let a;try{a=this.wrapper.wrapSubrule(e,r,o)}finally{this.isRecording()||(a===void 0&&!n&&(a=this.construct()),a!==void 0&&s&&s.length>0&&this.performSubruleAssignment(a,i,s))}}performSubruleAssignment(e,r,n){let{assignment:i,isCrossRef:o}=this.getAssignment(r);if(i)this.assign(i.operator,i.feature,e,n,o);else if(!i){let s=this.current;if(km(s))s.value+=e.toString();else if(typeof e=="object"&&e){let c=this.assignWithoutOverride(e,s);this.stack.pop(),this.stack.push(c)}}}action(e,r){if(!this.isRecording()){let n=this.current;if(r.feature&&r.operator){n=this.construct(),this.nodeBuilder.removeNode(n.$cstNode),this.nodeBuilder.buildCompositeNode(r).content.push(n.$cstNode);let o={$type:e};this.stack.push(o),this.assign(r.operator,r.feature,n,n.$cstNode,!1)}else n.$type=e}}construct(){if(this.isRecording())return;let e=this.current;return sl(e),this.nodeBuilder.construct(e),this.stack.pop(),km(e)?this.converter.convert(e.value,e.$cstNode):(ec(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){let r=_r(e,Vt);this.assignmentMap.set(e,{assignment:r,isCrossRef:r?br(r.terminal):!1})}return this.assignmentMap.get(e)}assign(e,r,n,i,o){let s=this.current,a;switch(o&&typeof n=="string"?a=this.linker.buildReference(s,r,i,n):a=n,e){case"=":{s[r]=a;break}case"?=":{s[r]=!0;break}case"+=":Array.isArray(s[r])||(s[r]=[]),s[r].push(a)}}assignWithoutOverride(e,r){for(let[i,o]of Object.entries(r)){let s=e[i];s===void 0?e[i]=o:Array.isArray(s)&&Array.isArray(o)&&(o.push(...s),e[i]=o)}let n=e.$cstNode;return n&&(n.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}},Pd=class{buildMismatchTokenMessage(e){return jn.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return jn.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return jn.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return jn.buildEarlyExitMessage(e)}},ca=class extends Pd{buildMismatchTokenMessage({expected:e,actual:r}){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 \`${r.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},jc=class extends $c{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let r=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=r.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,r){let n=this.wrapper.DEFINE_RULE(F_(e.name),this.startImplementation(r).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 r=>{let n=this.keepStackSize();try{e(r)}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,r,n){this.wrapper.wrapConsume(e,r),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,r,n,i,o){this.before(i),this.wrapper.wrapSubrule(e,r,o),this.after(i)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let r=this.elementStack.lastIndexOf(e);r>=0&&this.elementStack.splice(r)}}get currIdx(){return this.wrapper.currIdx}},cF={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new ca},Em=class extends Nc{constructor(e,r){let n=r&&"maxLookahead"in r;super(e,Object.assign(Object.assign(Object.assign({},cF),{lookaheadStrategy:n?new Un({maxLookahead:r.maxLookahead}):new Oc({logging:r.skipValidations?()=>{}:void 0})}),r))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,r,n){return this.RULE(e,r,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,r){return this.consume(e,r,void 0)}wrapSubrule(e,r,n){return this.subrule(e,r,{ARGS:[n]})}wrapOr(e,r){this.or(e,r)}wrapOption(e,r){this.option(e,r)}wrapMany(e,r){this.many(e,r)}wrapAtLeastOne(e,r){this.atLeastOne(e,r)}};function Uc(t,e,r){return uF({parser:e,tokens:r,ruleNames:new Map},t),e}function uF(t,e){let r=sc(e,!1),n=ce(e.rules).filter(Ye).filter(i=>r.has(i));for(let i of n){let o=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(i,no(o,i.definition))}}function no(t,e,r=!1){let n;if(Et(e))n=gF(t,e);else if(Vr(e))n=lF(t,e);else if(Vt(e))n=no(t,e.terminal);else if(br(e))n=$_(t,e);else if(ur(e))n=dF(t,e);else if(hs(e))n=hF(t,e);else if(ps(e))n=pF(t,e);else if(Pr(e))n=mF(t,e);else if(Zh(e)){let i=t.consume++;n=()=>t.parser.consume(i,kr,e)}else throw new Fi(e.$cstNode,`Unexpected element type: ${e.$type}`);return q_(t,r?void 0:Id(e),n,e.cardinality)}function lF(t,e){let r=zi(e);return()=>t.parser.action(r,e)}function dF(t,e){let r=e.rule.ref;if(Ye(r)){let n=t.subrule++,i=r.fragment,o=e.arguments.length>0?fF(r,e.arguments):()=>({});return s=>t.parser.subrule(n,j_(t,r),i,e,o(s))}else if(er(r)){let n=t.consume++,i=Am(t,r.name);return()=>t.parser.consume(n,i,e)}else if(r)on(r);else throw new Fi(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function fF(t,e){let r=e.map(n=>Wn(n.value));return n=>{let i={};for(let o=0;o<r.length;o++){let s=t.parameters[o],a=r[o];i[s.name]=a(n)}return i}}function Wn(t){if(zh(t)){let e=Wn(t.left),r=Wn(t.right);return n=>e(n)||r(n)}else if(Gh(t)){let e=Wn(t.left),r=Wn(t.right);return n=>e(n)&&r(n)}else if(Vh(t)){let e=Wn(t.value);return r=>!e(r)}else if(Kh(t)){let e=t.parameter.ref.name;return r=>r!==void 0&&r[e]===!0}else if(Hh(t)){let e=!!t.true;return()=>e}on(t)}function hF(t,e){if(e.elements.length===1)return no(t,e.elements[0]);{let r=[];for(let i of e.elements){let o={ALT:no(t,i,!0)},s=Id(i);s&&(o.GATE=Wn(s)),r.push(o)}let n=t.or++;return i=>t.parser.alternatives(n,r.map(o=>{let s={ALT:()=>o.ALT(i)},a=o.GATE;return a&&(s.GATE=()=>a(i)),s}))}}function pF(t,e){if(e.elements.length===1)return no(t,e.elements[0]);let r=[];for(let a of e.elements){let c={ALT:no(t,a,!0)},u=Id(a);u&&(c.GATE=Wn(u)),r.push(c)}let n=t.or++,i=(a,c)=>{let u=c.getRuleStack().join("-");return`uGroup_${a}_${u}`},o=a=>t.parser.alternatives(n,r.map((c,u)=>{let l={ALT:()=>!0},h=t.parser;l.ALT=()=>{if(c.ALT(a),!h.isRecording()){let y=i(n,h);h.unorderedGroups.get(y)||h.unorderedGroups.set(y,[]);let _=h.unorderedGroups.get(y);typeof _?.[u]>"u"&&(_[u]=!0)}};let p=c.GATE;return p?l.GATE=()=>p(a):l.GATE=()=>{let y=h.unorderedGroups.get(i(n,h));return!y?.[u]},l})),s=q_(t,Id(e),o,"*");return a=>{s(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(n,t.parser))}}function mF(t,e){let r=e.elements.map(n=>no(t,n));return n=>r.forEach(i=>i(n))}function Id(t){if(Pr(t))return t.guardCondition}function $_(t,e,r=e.terminal){if(r)if(ur(r)&&Ye(r.rule.ref)){let n=r.rule.ref,i=t.subrule++;return o=>t.parser.subrule(i,j_(t,n),!1,e,o)}else if(ur(r)&&er(r.rule.ref)){let n=t.consume++,i=Am(t,r.rule.ref.name);return()=>t.parser.consume(n,i,e)}else if(Et(r)){let n=t.consume++,i=Am(t,r.value);return()=>t.parser.consume(n,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);let n=dl(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+zi(e.type.ref));return $_(t,e,i)}}function gF(t,e){let r=t.consume++,n=t.tokens[e.value];if(!n)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(r,n,e)}function q_(t,e,r,n){let i=e&&Wn(e);if(!n)if(i){let o=t.or++;return s=>t.parser.alternatives(o,[{ALT:()=>r(s),GATE:()=>i(s)},{ALT:bd(),GATE:()=>!i(s)}])}else return r;if(n==="*"){let o=t.many++;return s=>t.parser.many(o,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else if(n==="+"){let o=t.many++;if(i){let s=t.or++;return a=>t.parser.alternatives(s,[{ALT:()=>t.parser.atLeastOne(o,{DEF:()=>r(a)}),GATE:()=>i(a)},{ALT:bd(),GATE:()=>!i(a)}])}else return s=>t.parser.atLeastOne(o,{DEF:()=>r(s)})}else if(n==="?"){let o=t.optional++;return s=>t.parser.optional(o,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else on(n)}function j_(t,e){let r=yF(t,e),n=t.parser.getRule(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function yF(t,e){if(Ye(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let r=e,n=r.$container,i=e.$type;for(;!Ye(n);)(Pr(n)||hs(n)||ps(n))&&(i=n.elements.indexOf(r).toString()+":"+i),r=n,n=n.$container;return i=n.name+":"+i,t.ruleNames.set(e,i),i}}function Am(t,e){let r=t.tokens[e];if(!r)throw new Error(`Token "${e}" not found."`);return r}function wm(t){let e=t.Grammar,r=t.parser.Lexer,n=new jc(t);return Uc(e,n,r.definition),n.finalize(),n}function Nm(t){let e=U_(t);return e.finalize(),e}function U_(t){let e=t.Grammar,r=t.parser.Lexer,n=new qc(t);return Uc(e,n,r.definition)}var io=class{constructor(){this.diagnostics=[]}buildTokens(e,r){let n=ce(sc(e,!1)),i=this.buildTerminalTokens(n),o=this.buildKeywordTokens(n,i,r);return o.push(...i),o}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(er).filter(r=>!r.fragment).map(r=>this.buildTerminalToken(r)).toArray()}buildTerminalToken(e){let r=Jn(e),n=this.requiresCustomPattern(r)?this.regexPatternFunction(r):r,i={name:e.name,PATTERN:n};return typeof n=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=ic(r)?Ze.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")||e.flags.includes("s")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){let r=new RegExp(e,e.flags+"y");return(n,i)=>(r.lastIndex=i,r.exec(n))}buildKeywordTokens(e,r,n){return e.filter(Ye).flatMap(i=>Cr(i).filter(Et)).distinct(i=>i.value).toArray().sort((i,o)=>o.value.length-i.value.length).map(i=>this.buildKeywordToken(i,r,!!n?.caseInsensitive))}buildKeywordToken(e,r,n){let i=this.buildKeywordPattern(e,n),o={name:e.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(e,r)};return typeof i=="function"&&(o.LINE_BREAKS=!0),o}buildKeywordPattern(e,r){return r?new RegExp(Yn(e.value),"i"):e.value}findLongerAlt(e,r){return r.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&hp("^"+o.source+"$",e.value)&&n.push(i),n},[])}};var Wc=class{convert(e,r){let n=r.grammarSource;if(br(n)&&(n=ac(n)),ur(n)){let i=n.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,r)}return e}runConverter(e,r,n){var i;switch(e.name.toUpperCase()){case"INT":return Tn.convertInt(r);case"STRING":return Tn.convertString(r);case"ID":return Tn.convertID(r)}switch((i=_p(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Tn.convertNumber(r);case"boolean":return Tn.convertBoolean(r);case"bigint":return Tn.convertBigint(r);case"date":return Tn.convertDate(r);default:return r}}},Tn;(function(t){function e(u){let l="";for(let h=1;h<u.length-1;h++){let p=u.charAt(h);if(p==="\\"){let y=u.charAt(++h);l+=r(y)}else l+=p}return l}t.convertString=e;function r(u){switch(u){case"b":return"\b";case"f":return"\f";case"n":return`
152
- `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return u}}function n(u){return u.charAt(0)==="^"?u.substring(1):u}t.convertID=n;function i(u){return parseInt(u)}t.convertInt=i;function o(u){return BigInt(u)}t.convertBigint=o;function s(u){return new Date(u)}t.convertDate=s;function a(u){return Number(u)}t.convertNumber=a;function c(u){return u.toLowerCase()==="true"}t.convertBoolean=c})(Tn||(Tn={}));var J={};ve(J,Nr(Bc(),1));function Fm(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}var Md=0,G_=10;function Fd(){return Md=performance.now(),new J.CancellationTokenSource}function z_(t){G_=t}var Rn=Symbol("OperationCancelled");function bn(t){return t===Rn}async function ot(t){if(t===J.CancellationToken.None)return;let e=performance.now();if(e-Md>=G_&&(Md=e,await Fm(),Md=performance.now()),t.isCancellationRequested)throw Rn}var sr=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=n=>(e(n),this),this.reject=n=>(r(n),this)})}};var $d=class t{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){for(let n of e)if(t.isIncremental(n)){let i=X_(n.range),o=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,o)+n.text+this._content.substring(s,this._content.length);let a=Math.max(i.start.line,0),c=Math.max(i.end.line,0),u=this._lineOffsets,l=V_(n.text,!1,o);if(c-a===l.length)for(let p=0,y=l.length;p<y;p++)u[p+a+1]=l[p];else l.length<1e4?u.splice(a+1,c-a,...l):this._lineOffsets=u=u.slice(0,a+1).concat(l,u.slice(c+1));let h=n.text.length-(s-o);if(h!==0)for(let p=a+1+l.length,y=u.length;p<y;p++)u[p]=u[p]+h}else if(t.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=r}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=V_(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:e};for(;n<i;){let s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}let o=n-1;return e=this.ensureBeforeEOL(e,r[o]),{line:o,character:e-r[o]}}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line];if(e.character<=0)return n;let i=e.line+1<r.length?r[e.line+1]:this._content.length,o=Math.min(n+e.character,i);return this.ensureBeforeEOL(o,n)}ensureBeforeEOL(e,r){for(;e>r&&K_(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},vi;(function(t){function e(i,o,s,a){return new $d(i,o,s,a)}t.create=e;function r(i,o,s){if(i instanceof $d)return i.update(o,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,o){let s=i.getText(),a=$m(o.map(EF),(l,h)=>{let p=l.range.start.line-h.range.start.line;return p===0?l.range.start.character-h.range.start.character:p}),c=0,u=[];for(let l of a){let h=i.offsetAt(l.range.start);if(h<c)throw new Error("Overlapping edit");h>c&&u.push(s.substring(c,h)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(s.substr(c)),u.join("")}t.applyEdits=n})(vi||(vi={}));function $m(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);$m(n,e),$m(i,e);let o=0,s=0,a=0;for(;o<n.length&&s<i.length;)e(n[o],i[s])<=0?t[a++]=n[o++]:t[a++]=i[s++];for(;o<n.length;)t[a++]=n[o++];for(;s<i.length;)t[a++]=i[s++];return t}function V_(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);K_(o)&&(o===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function K_(t){return t===13||t===10}function X_(t){let e=t.start,r=t.end;return e.line>r.line||e.line===r.line&&e.character>r.character?{start:r,end:e}:t}function EF(t){let e=X_(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var Y_;(()=>{"use strict";var t={470:i=>{function o(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}function s(c,u){for(var l,h="",p=0,y=-1,_=0,E=0;E<=c.length;++E){if(E<c.length)l=c.charCodeAt(E);else{if(l===47)break;l=47}if(l===47){if(!(y===E-1||_===1))if(y!==E-1&&_===2){if(h.length<2||p!==2||h.charCodeAt(h.length-1)!==46||h.charCodeAt(h.length-2)!==46){if(h.length>2){var D=h.lastIndexOf("/");if(D!==h.length-1){D===-1?(h="",p=0):p=(h=h.slice(0,D)).length-1-h.lastIndexOf("/"),y=E,_=0;continue}}else if(h.length===2||h.length===1){h="",p=0,y=E,_=0;continue}}u&&(h.length>0?h+="/..":h="..",p=2)}else h.length>0?h+="/"+c.slice(y+1,E):h=c.slice(y+1,E),p=E-y-1;y=E,_=0}else l===46&&_!==-1?++_:_=-1}return h}var a={resolve:function(){for(var c,u="",l=!1,h=arguments.length-1;h>=-1&&!l;h--){var p;h>=0?p=arguments[h]:(c===void 0&&(c=process.cwd()),p=c),o(p),p.length!==0&&(u=p+"/"+u,l=p.charCodeAt(0)===47)}return u=s(u,!l),l?u.length>0?"/"+u:"/":u.length>0?u:"."},normalize:function(c){if(o(c),c.length===0)return".";var u=c.charCodeAt(0)===47,l=c.charCodeAt(c.length-1)===47;return(c=s(c,!u)).length!==0||u||(c="."),c.length>0&&l&&(c+="/"),u?"/"+c:c},isAbsolute:function(c){return o(c),c.length>0&&c.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var c,u=0;u<arguments.length;++u){var l=arguments[u];o(l),l.length>0&&(c===void 0?c=l:c+="/"+l)}return c===void 0?".":a.normalize(c)},relative:function(c,u){if(o(c),o(u),c===u||(c=a.resolve(c))===(u=a.resolve(u)))return"";for(var l=1;l<c.length&&c.charCodeAt(l)===47;++l);for(var h=c.length,p=h-l,y=1;y<u.length&&u.charCodeAt(y)===47;++y);for(var _=u.length-y,E=p<_?p:_,D=-1,w=0;w<=E;++w){if(w===E){if(_>E){if(u.charCodeAt(y+w)===47)return u.slice(y+w+1);if(w===0)return u.slice(y+w)}else p>E&&(c.charCodeAt(l+w)===47?D=w:w===0&&(D=0));break}var x=c.charCodeAt(l+w);if(x!==u.charCodeAt(y+w))break;x===47&&(D=w)}var g="";for(w=l+D+1;w<=h;++w)w!==h&&c.charCodeAt(w)!==47||(g.length===0?g+="..":g+="/..");return g.length>0?g+u.slice(y+D):(y+=D,u.charCodeAt(y)===47&&++y,u.slice(y))},_makeLong:function(c){return c},dirname:function(c){if(o(c),c.length===0)return".";for(var u=c.charCodeAt(0),l=u===47,h=-1,p=!0,y=c.length-1;y>=1;--y)if((u=c.charCodeAt(y))===47){if(!p){h=y;break}}else p=!1;return h===-1?l?"/":".":l&&h===1?"//":c.slice(0,h)},basename:function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');o(c);var l,h=0,p=-1,y=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var _=u.length-1,E=-1;for(l=c.length-1;l>=0;--l){var D=c.charCodeAt(l);if(D===47){if(!y){h=l+1;break}}else E===-1&&(y=!1,E=l+1),_>=0&&(D===u.charCodeAt(_)?--_==-1&&(p=l):(_=-1,p=E))}return h===p?p=E:p===-1&&(p=c.length),c.slice(h,p)}for(l=c.length-1;l>=0;--l)if(c.charCodeAt(l)===47){if(!y){h=l+1;break}}else p===-1&&(y=!1,p=l+1);return p===-1?"":c.slice(h,p)},extname:function(c){o(c);for(var u=-1,l=0,h=-1,p=!0,y=0,_=c.length-1;_>=0;--_){var E=c.charCodeAt(_);if(E!==47)h===-1&&(p=!1,h=_+1),E===46?u===-1?u=_:y!==1&&(y=1):u!==-1&&(y=-1);else if(!p){l=_+1;break}}return u===-1||h===-1||y===0||y===1&&u===h-1&&u===l+1?"":c.slice(u,h)},format:function(c){if(c===null||typeof c!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof c);return(function(u,l){var h=l.dir||l.root,p=l.base||(l.name||"")+(l.ext||"");return h?h===l.root?h+p:h+"/"+p:p})(0,c)},parse:function(c){o(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var l,h=c.charCodeAt(0),p=h===47;p?(u.root="/",l=1):l=0;for(var y=-1,_=0,E=-1,D=!0,w=c.length-1,x=0;w>=l;--w)if((h=c.charCodeAt(w))!==47)E===-1&&(D=!1,E=w+1),h===46?y===-1?y=w:x!==1&&(x=1):y!==-1&&(x=-1);else if(!D){_=w+1;break}return y===-1||E===-1||x===0||x===1&&y===E-1&&y===_+1?E!==-1&&(u.base=u.name=_===0&&p?c.slice(1,E):c.slice(_,E)):(_===0&&p?(u.name=c.slice(1,y),u.base=c.slice(1,E)):(u.name=c.slice(_,y),u.base=c.slice(_,E)),u.ext=c.slice(y,E)),_>0?u.dir=c.slice(0,_-1):p&&(u.dir="/"),u},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,i.exports=a}},e={};function r(i){var o=e[i];if(o!==void 0)return o.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.d=(i,o)=>{for(var s in o)r.o(o,s)&&!r.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:o[s]})},r.o=(i,o)=>Object.prototype.hasOwnProperty.call(i,o),r.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var n={};(()=>{let i;r.r(n),r.d(n,{URI:()=>p,Utils:()=>xt}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let o=/^\w[\w\d+.-]*$/,s=/^\//,a=/^\/\//;function c($,I){if(!$.scheme&&I)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${$.authority}", path: "${$.path}", query: "${$.query}", fragment: "${$.fragment}"}`);if($.scheme&&!o.test($.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if($.path){if($.authority){if(!s.test($.path))throw new 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(a.test($.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}let u="",l="/",h=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class p{static isUri(I){return I instanceof p||!!I&&typeof I.authority=="string"&&typeof I.fragment=="string"&&typeof I.path=="string"&&typeof I.query=="string"&&typeof I.scheme=="string"&&typeof I.fsPath=="string"&&typeof I.with=="function"&&typeof I.toString=="function"}scheme;authority;path;query;fragment;constructor(I,z,W,le,Z,Q=!1){typeof I=="object"?(this.scheme=I.scheme||u,this.authority=I.authority||u,this.path=I.path||u,this.query=I.query||u,this.fragment=I.fragment||u):(this.scheme=(function(at,B){return at||B?at:"file"})(I,Q),this.authority=z||u,this.path=(function(at,B){switch(at){case"https":case"http":case"file":B?B[0]!==l&&(B=l+B):B=l}return B})(this.scheme,W||u),this.query=le||u,this.fragment=Z||u,c(this,Q))}get fsPath(){return x(this,!1)}with(I){if(!I)return this;let{scheme:z,authority:W,path:le,query:Z,fragment:Q}=I;return z===void 0?z=this.scheme:z===null&&(z=u),W===void 0?W=this.authority:W===null&&(W=u),le===void 0?le=this.path:le===null&&(le=u),Z===void 0?Z=this.query:Z===null&&(Z=u),Q===void 0?Q=this.fragment:Q===null&&(Q=u),z===this.scheme&&W===this.authority&&le===this.path&&Z===this.query&&Q===this.fragment?this:new _(z,W,le,Z,Q)}static parse(I,z=!1){let W=h.exec(I);return W?new _(W[2]||u,te(W[4]||u),te(W[5]||u),te(W[7]||u),te(W[9]||u),z):new _(u,u,u,u,u)}static file(I){let z=u;if(i&&(I=I.replace(/\\/g,l)),I[0]===l&&I[1]===l){let W=I.indexOf(l,2);W===-1?(z=I.substring(2),I=l):(z=I.substring(2,W),I=I.substring(W)||l)}return new _("file",z,I,u,u)}static from(I){let z=new _(I.scheme,I.authority,I.path,I.query,I.fragment);return c(z,!0),z}toString(I=!1){return g(this,I)}toJSON(){return this}static revive(I){if(I){if(I instanceof p)return I;{let z=new _(I);return z._formatted=I.external,z._fsPath=I._sep===y?I.fsPath:null,z}}return I}}let y=i?1:void 0;class _ extends p{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=x(this,!1)),this._fsPath}toString(I=!1){return I?g(this,!0):(this._formatted||(this._formatted=g(this,!1)),this._formatted)}toJSON(){let I={$mid:1};return this._fsPath&&(I.fsPath=this._fsPath,I._sep=y),this._formatted&&(I.external=this._formatted),this.path&&(I.path=this.path),this.scheme&&(I.scheme=this.scheme),this.authority&&(I.authority=this.authority),this.query&&(I.query=this.query),this.fragment&&(I.fragment=this.fragment),I}}let E={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 D($,I,z){let W,le=-1;for(let Z=0;Z<$.length;Z++){let Q=$.charCodeAt(Z);if(Q>=97&&Q<=122||Q>=65&&Q<=90||Q>=48&&Q<=57||Q===45||Q===46||Q===95||Q===126||I&&Q===47||z&&Q===91||z&&Q===93||z&&Q===58)le!==-1&&(W+=encodeURIComponent($.substring(le,Z)),le=-1),W!==void 0&&(W+=$.charAt(Z));else{W===void 0&&(W=$.substr(0,Z));let at=E[Q];at!==void 0?(le!==-1&&(W+=encodeURIComponent($.substring(le,Z)),le=-1),W+=at):le===-1&&(le=Z)}}return le!==-1&&(W+=encodeURIComponent($.substring(le))),W!==void 0?W:$}function w($){let I;for(let z=0;z<$.length;z++){let W=$.charCodeAt(z);W===35||W===63?(I===void 0&&(I=$.substr(0,z)),I+=E[W]):I!==void 0&&(I+=$[z])}return I!==void 0?I:$}function x($,I){let z;return z=$.authority&&$.path.length>1&&$.scheme==="file"?`//${$.authority}${$.path}`:$.path.charCodeAt(0)===47&&($.path.charCodeAt(1)>=65&&$.path.charCodeAt(1)<=90||$.path.charCodeAt(1)>=97&&$.path.charCodeAt(1)<=122)&&$.path.charCodeAt(2)===58?I?$.path.substr(1):$.path[1].toLowerCase()+$.path.substr(2):$.path,i&&(z=z.replace(/\//g,"\\")),z}function g($,I){let z=I?w:D,W="",{scheme:le,authority:Z,path:Q,query:at,fragment:B}=$;if(le&&(W+=le,W+=":"),(Z||le==="file")&&(W+=l,W+=l),Z){let N=Z.indexOf("@");if(N!==-1){let ke=Z.substr(0,N);Z=Z.substr(N+1),N=ke.lastIndexOf(":"),N===-1?W+=z(ke,!1,!1):(W+=z(ke.substr(0,N),!1,!1),W+=":",W+=z(ke.substr(N+1),!1,!0)),W+="@"}Z=Z.toLowerCase(),N=Z.lastIndexOf(":"),N===-1?W+=z(Z,!1,!0):(W+=z(Z.substr(0,N),!1,!0),W+=Z.substr(N))}if(Q){if(Q.length>=3&&Q.charCodeAt(0)===47&&Q.charCodeAt(2)===58){let N=Q.charCodeAt(1);N>=65&&N<=90&&(Q=`/${String.fromCharCode(N+32)}:${Q.substr(3)}`)}else if(Q.length>=2&&Q.charCodeAt(1)===58){let N=Q.charCodeAt(0);N>=65&&N<=90&&(Q=`${String.fromCharCode(N+32)}:${Q.substr(2)}`)}W+=z(Q,!0,!1)}return at&&(W+="?",W+=z(at,!1,!1)),B&&(W+="#",W+=I?B:D(B,!1,!1)),W}function A($){try{return decodeURIComponent($)}catch{return $.length>3?$.substr(0,3)+A($.substr(3)):$}}let M=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function te($){return $.match(M)?$.replace(M,(I=>A(I))):$}var _e=r(470);let Se=_e.posix||_e,Nt="/";var xt;(function($){$.joinPath=function(I,...z){return I.with({path:Se.join(I.path,...z)})},$.resolvePath=function(I,...z){let W=I.path,le=!1;W[0]!==Nt&&(W=Nt+W,le=!0);let Z=Se.resolve(W,...z);return le&&Z[0]===Nt&&!I.authority&&(Z=Z.substring(1)),I.with({path:Z})},$.dirname=function(I){if(I.path.length===0||I.path===Nt)return I;let z=Se.dirname(I.path);return z.length===1&&z.charCodeAt(0)===46&&(z=""),I.with({path:z})},$.basename=function(I){return Se.basename(I.path)},$.extname=function(I){return Se.extname(I.path)}})(xt||(xt={}))})(),Y_=n})();var{URI:vt,Utils:fa}=Y_;var ge;(function(t){t.basename=fa.basename,t.dirname=fa.dirname,t.extname=fa.extname,t.joinPath=fa.joinPath,t.resolvePath=fa.resolvePath;let e=typeof process=="object"&&(process==null?void 0:process.platform)==="win32";function r(o,s){return o?.toString()===s?.toString()}t.equals=r;function n(o,s){let a=typeof o=="string"?vt.parse(o).path:o.path,c=typeof s=="string"?vt.parse(s).path:s.path,u=a.split("/").filter(_=>_.length>0),l=c.split("/").filter(_=>_.length>0);if(e){let _=/^[A-Z]:$/;if(u[0]&&_.test(u[0])&&(u[0]=u[0].toLowerCase()),l[0]&&_.test(l[0])&&(l[0]=l[0].toLowerCase()),u[0]!==l[0])return c.substring(1)}let h=0;for(;h<u.length&&u[h]===l[h];h++);let p="../".repeat(u.length-h),y=l.slice(h).join("/");return p+y}t.relative=n;function i(o){return vt.parse(o.toString()).toString()}t.normalize=i})(ge||(ge={}));var Le;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(Le||(Le={}));var Hc=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,r=J.CancellationToken.None){let n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,r)}fromTextDocument(e,r,n){return r=r??vt.parse(e.uri),J.CancellationToken.is(n)?this.createAsync(r,e,n):this.create(r,e,n)}fromString(e,r,n){return J.CancellationToken.is(n)?this.createAsync(r,e,n):this.create(r,e,n)}fromModel(e,r){return this.create(r,{$model:e})}create(e,r,n){if(typeof r=="string"){let i=this.parse(e,r,n);return this.createLangiumDocument(i,e,void 0,r)}else if("$model"in r){let i={value:r.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,e)}else{let i=this.parse(e,r.getText(),n);return this.createLangiumDocument(i,e,r)}}async createAsync(e,r,n){if(typeof r=="string"){let i=await this.parseAsync(e,r,n);return this.createLangiumDocument(i,e,void 0,r)}else{let i=await this.parseAsync(e,r.getText(),n);return this.createLangiumDocument(i,e,r)}}createLangiumDocument(e,r,n,i){let o;if(n)o={parseResult:e,uri:r,state:Le.Parsed,references:[],textDocument:n};else{let s=this.createTextDocumentGetter(r,i);o={parseResult:e,uri:r,state:Le.Parsed,references:[],get textDocument(){return s()}}}return e.value.$document=o,o}async update(e,r){var n,i;let o=(n=e.parseResult.value.$cstNode)===null||n===void 0?void 0:n.root.fullText,s=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),a=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{let c=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:c})}return o!==a&&(e.parseResult=await this.parseAsync(e.uri,a,r),e.parseResult.value.$document=e),e.state=Le.Parsed,e}parse(e,r,n){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r,n)}parseAsync(e,r,n){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(r,n)}createTextDocumentGetter(e,r){let n=this.serviceRegistry,i;return()=>i??(i=vi.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,r??""))}},Gc=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return ce(this.documentMap.values())}addDocument(e){let r=e.uri.toString();if(this.documentMap.has(r))throw new Error(`A document with the URI '${r}' is already present.`);this.documentMap.set(r,e)}getDocument(e){let r=e.toString();return this.documentMap.get(r)}async getOrCreateDocument(e,r){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,r),this.addDocument(n),n)}createDocument(e,r,n){if(n)return this.langiumDocumentFactory.fromString(r,e,n).then(i=>(this.addDocument(i),i));{let i=this.langiumDocumentFactory.fromString(r,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(this.serviceRegistry.getServices(e).references.Linker.unlink(n),n.state=Le.Changed,n.precomputedScopes=void 0,n.diagnostics=void 0),n}deleteDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=Le.Changed,this.documentMap.delete(r)),n}};var qm=Symbol("ref_resolving"),zc=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,r=J.CancellationToken.None){for(let n of Ir(e.parseResult.value))await ot(r),ms(n).forEach(i=>this.doLink(i,e))}doLink(e,r){var n;let i=e.reference;if(i._ref===void 0){i._ref=qm;try{let o=this.getCandidate(e);if(Oi(o))i._ref=o;else if(i._nodeDescription=o,this.langiumDocuments().hasDocument(o.documentUri)){let s=this.loadAstNode(o);i._ref=s??this.createLinkingError(e,o)}else i._ref=void 0}catch(o){console.error(`An error occurred while resolving reference to '${i.$refText}':`,o);let s=(n=o.message)!==null&&n!==void 0?n:String(o);i._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${i.$refText}': ${s}`})}r.references.push(i)}}unlink(e){for(let r of e.references)delete r._ref,delete r._nodeDescription;e.references=[]}getCandidate(e){let n=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return n??this.createLinkingError(e)}buildReference(e,r,n,i){let o=this,s={$refNode:n,$refText:i,get ref(){var a;if(Ge(this._ref))return this._ref;if(Fh(this._nodeDescription)){let c=o.loadAstNode(this._nodeDescription);this._ref=c??o.createLinkingError({reference:s,container:e,property:r},this._nodeDescription)}else if(this._ref===void 0){this._ref=qm;let c=Za(e).$document,u=o.getLinkedNode({reference:s,container:e,property:r});if(u.error&&c&&c.state<Le.ComputedScopes)return this._ref=void 0;this._ref=(a=u.node)!==null&&a!==void 0?a:u.error,this._nodeDescription=u.descr,c?.references.push(this)}else if(this._ref===qm)throw new Error(`Cyclic reference resolution detected: ${o.astNodeLocator.getAstNodePath(e)}/${r} (symbol '${i}')`);return Ge(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return Oi(this._ref)?this._ref:void 0}};return s}getLinkedNode(e){var r;try{let n=this.getCandidate(e);if(Oi(n))return{error:n};let i=this.loadAstNode(n);return i?{node:i,descr:n}:{descr:n,error:this.createLinkingError(e,n)}}catch(n){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,n);let i=(r=n.message)!==null&&r!==void 0?r:String(n);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${i}`})}}}loadAstNode(e){if(e.node)return e.node;let r=this.langiumDocuments().getDocument(e.documentUri);if(r)return this.astNodeLocator.getAstNode(r.parseResult.value,e.path)}createLinkingError(e,r){let n=Za(e.container).$document;n&&n.state<Le.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);let i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:r})}};function qd(t){return typeof t.name=="string"}var Vc=class{getName(e){if(qd(e))return e.name}getNameNode(e){return cc(e.$cstNode,"name")}};var Kc=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let r=Rp(e),n=e.astNode;if(r&&n){let i=n[r.feature];if(Ut(i))return i.ref;if(Array.isArray(i)){for(let o of i)if(Ut(o)&&o.$refNode&&o.$refNode.offset<=e.offset&&o.$refNode.end>=e.end)return o.ref}}if(n){let i=this.nameProvider.getNameNode(n);if(i&&(i===e||jh(e,i)))return n}}}findDeclarationNode(e){let r=this.findDeclaration(e);if(r?.$cstNode){let n=this.nameProvider.getNameNode(r);return n??r.$cstNode}}findReferences(e,r){let n=[];if(r.includeDeclaration){let o=this.getReferenceToSelf(e);o&&n.push(o)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return r.documentUri&&(i=i.filter(o=>ge.equals(o.sourceUri,r.documentUri))),n.push(...i),ce(n)}getReferenceToSelf(e){let r=this.nameProvider.getNameNode(e);if(r){let n=Rt(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:Mi(r),local:!0}}}};var Yr=class{constructor(e){if(this.map=new Map,e)for(let[r,n]of e)this.add(r,n)}get size(){return ko.sum(ce(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,r){if(r===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let i=n.indexOf(r);if(i>=0)return n.length===1?this.map.delete(e):n.splice(i,1),!0}return!1}}get(e){var r;return(r=this.map.get(e))!==null&&r!==void 0?r:[]}has(e,r){if(r===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(r)>=0:!1}}add(e,r){return this.map.has(e)?this.map.get(e).push(r):this.map.set(e,[r]),this}addAll(e,r){return this.map.has(e)?this.map.get(e).push(...r):this.map.set(e,Array.from(r)),this}forEach(e){this.map.forEach((r,n)=>r.forEach(i=>e(i,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return ce(this.map.entries()).flatMap(([e,r])=>r.map(n=>[e,n]))}keys(){return ce(this.map.keys())}values(){return ce(this.map.values()).flat()}entriesGroupedByKey(){return ce(this.map.entries())}},so=class{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[r,n]of e)this.set(r,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,r){return this.map.set(e,r),this.inverse.set(r,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let r=this.map.get(e);return r!==void 0?(this.map.delete(e),this.inverse.delete(r),!0):!1}};var Xc=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,r=J.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,r)}async computeExportsForNode(e,r,n=Ui,i=J.CancellationToken.None){let o=[];this.exportNode(e,o,r);for(let s of n(e))await ot(i),this.exportNode(s,o,r);return o}exportNode(e,r,n){let i=this.nameProvider.getName(e);i&&r.push(this.descriptions.createDescription(e,i,n))}async computeLocalScopes(e,r=J.CancellationToken.None){let n=e.parseResult.value,i=new Yr;for(let o of Cr(n))await ot(r),this.processNode(o,e,i);return i}processNode(e,r,n){let i=e.$container;if(i){let o=this.nameProvider.getName(e);o&&n.add(i,this.descriptions.createDescription(e,o,r))}}};var ha=class{constructor(e,r,n){var i;this.elements=e,this.outerScope=r,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let r=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===e.toLowerCase()):this.elements.find(n=>n.name===e);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}},Yc=class{constructor(e,r,n){var i;this.elements=new Map,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1;for(let o of e){let s=this.caseInsensitive?o.name.toLowerCase():o.name;this.elements.set(s,o)}this.outerScope=r}getElement(e){let r=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(r);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=ce(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},AF={getElement(){},getAllElements(){return Wa}};var pa=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 new Error("This cache has already been disposed")}},Jc=class extends pa{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,r){this.throwIfDisposed(),this.cache.set(e,r)}get(e,r){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(r){let n=r();return this.cache.set(e,n),n}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},ao=class extends pa{constructor(e){super(),this.cache=new Map,this.converter=e??(r=>r)}has(e,r){return this.throwIfDisposed(),this.cacheForContext(e).has(r)}set(e,r,n){this.throwIfDisposed(),this.cacheForContext(e).set(r,n)}get(e,r,n){this.throwIfDisposed();let i=this.cacheForContext(e);if(i.has(r))return i.get(r);if(n){let o=n();return i.set(r,o),o}else return}delete(e,r){return this.throwIfDisposed(),this.cacheForContext(e).delete(r)}clear(e){if(this.throwIfDisposed(),e){let r=this.converter(e);this.cache.delete(r)}else this.cache.clear()}cacheForContext(e){let r=this.converter(e),n=this.cache.get(r);return n||(n=new Map,this.cache.set(r,n)),n}},jd=class extends ao{constructor(e,r){super(n=>n.toString()),r?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(r,n=>{this.clear(n.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{for(let o of i)this.clear(o)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{let o=n.concat(i);for(let s of o)this.clear(s)}))}},ma=class extends Jc{constructor(e,r){super(),r?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(r,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}};var Qc=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 ma(e.shared)}getScope(e){let r=[],n=this.reflection.getReferenceType(e),i=Rt(e.container).precomputedScopes;if(i){let s=e.container;do{let a=i.get(s);a.length>0&&r.push(ce(a).filter(c=>this.reflection.isSubtype(c.type,n))),s=s.$container}while(s)}let o=this.getGlobalScope(n,e);for(let s=r.length-1;s>=0;s--)o=this.createScope(r[s],o);return o}createScope(e,r,n){return new ha(ce(e),r,n)}createScopeForNodes(e,r,n){let i=ce(e).map(o=>{let s=this.nameProvider.getName(o);if(s)return this.descriptions.createDescription(o,s)}).nonNullable();return new ha(i,r,n)}getGlobalScope(e,r){return this.globalScopeCache.get(e,()=>new Yc(this.indexManager.allElements(e)))}};function eu(t){return typeof t.$comment=="string"}function J_(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}var Zc=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,r){let n=r??{},i=r?.replacer,o=(a,c)=>this.replacer(a,c,n),s=i?(a,c)=>i(a,c,o):o;try{return this.currentDocument=Rt(e),JSON.stringify(e,s,r?.space)}finally{this.currentDocument=void 0}}deserialize(e,r){let n=r??{},i=JSON.parse(e);return this.linkNode(i,i,n),i}replacer(e,r,{refText:n,sourceText:i,textRegions:o,comments:s,uriConverter:a}){var c,u,l,h;if(!this.ignoreProperties.has(e))if(Ut(r)){let p=r.ref,y=n?r.$refText:void 0;if(p){let _=Rt(p),E="";this.currentDocument&&this.currentDocument!==_&&(a?E=a(_.uri,r):E=_.uri.toString());let D=this.astNodeLocator.getAstNodePath(p);return{$ref:`${E}#${D}`,$refText:y}}else return{$error:(u=(c=r.error)===null||c===void 0?void 0:c.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:y}}else if(Ge(r)){let p;if(o&&(p=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},r)),(!e||r.$document)&&p?.$textRegion&&(p.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(p??(p=Object.assign({},r)),p.$sourceText=(h=r.$cstNode)===null||h===void 0?void 0:h.text),s){p??(p=Object.assign({},r));let y=this.commentProvider.getComment(r);y&&(p.$comment=y.replace(/\r/g,""))}return p??r}else return r}addAstNodeRegionWithAssignmentsTo(e){let r=n=>({offset:n.offset,end:n.end,length:n.length,range:n.range});if(e.$cstNode){let n=e.$textRegion=r(e.$cstNode),i=n.assignments={};return Object.keys(e).filter(o=>!o.startsWith("$")).forEach(o=>{let s=yp(e.$cstNode,o).map(r);s.length!==0&&(i[o]=s)}),e}}linkNode(e,r,n,i,o,s){for(let[c,u]of Object.entries(e))if(Array.isArray(u))for(let l=0;l<u.length;l++){let h=u[l];J_(h)?u[l]=this.reviveReference(e,c,r,h,n):Ge(h)&&this.linkNode(h,r,n,e,c,l)}else J_(u)?e[c]=this.reviveReference(e,c,r,u,n):Ge(u)&&this.linkNode(u,r,n,e,c);let a=e;a.$container=i,a.$containerProperty=o,a.$containerIndex=s}reviveReference(e,r,n,i,o){let s=i.$refText,a=i.$error;if(i.$ref){let c=this.getRefNode(n,i.$ref,o.uriConverter);if(Ge(c))return s||(s=this.nameProvider.getName(c)),{$refText:s??"",ref:c};a=c}if(a){let c={$refText:s??""};return c.error={container:e,property:r,message:a,reference:c},c}else return}getRefNode(e,r,n){try{let i=r.indexOf("#");if(i===0){let c=this.astNodeLocator.getAstNode(e,r.substring(1));return c||"Could not resolve path: "+r}if(i<0){let c=n?n(r):vt.parse(r),u=this.langiumDocuments.getDocument(c);return u?u.parseResult.value:"Could not find document for URI: "+r}let o=n?n(r.substring(0,i)):vt.parse(r.substring(0,i)),s=this.langiumDocuments.getDocument(o);if(!s)return"Could not find document for URI: "+r;if(i===r.length-1)return s.parseResult.value;let a=this.astNodeLocator.getAstNode(s.parseResult.value,r.substring(i+1));return a||"Could not resolve URI: "+r}catch(i){return String(i)}}};var tu=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 r=e.LanguageMetaData;for(let n of r.fileExtensions)this.fileExtensionMap.has(n)&&console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${r.languageId}'.`),this.fileExtensionMap.set(n,e);if(r.fileNames)for(let n of r.fileNames)this.fileNameMap.has(n)&&console.warn(`The file name ${n} is used by multiple languages. It is now assigned to '${r.languageId}'.`),this.fileNameMap.set(n,e);this.languageIdMap.set(r.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){var r,n,i;if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let o=(n=(r=this.textDocuments)===null||r===void 0?void 0:r.get(e))===null||n===void 0?void 0:n.languageId;if(o!==void 0){let u=this.languageIdMap.get(o);if(u)return u}let s=ge.extname(e),a=ge.basename(e),c=(i=this.fileNameMap.get(a))!==null&&i!==void 0?i:this.fileExtensionMap.get(s);if(!c)throw o?new Error(`The service registry contains no services for the extension '${s}' for language '${o}'.`):new Error(`The service registry contains no services for the extension '${s}'.`);return c}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}};function co(t){return{code:t}}var ga;(function(t){t.all=["fast","slow","built-in"]})(ga||(ga={}));var ru=class{constructor(e){this.entries=new Yr,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,r=this,n="fast"){if(n==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(let[i,o]of Object.entries(e)){let s=o;if(Array.isArray(s))for(let a of s){let c={check:this.wrapValidationException(a,r),category:n};this.addEntry(i,c)}else if(typeof s=="function"){let a={check:this.wrapValidationException(s,r),category:n};this.addEntry(i,a)}else on(s)}}wrapValidationException(e,r){return async(n,i,o)=>{await this.handleException(()=>e.call(r,n,i,o),"An error occurred during validation",i,n)}}async handleException(e,r,n,i){try{await e()}catch(o){if(bn(o))throw o;console.error(`${r}:`,o),o instanceof Error&&o.stack&&console.error(o.stack);let s=o instanceof Error?o.message:String(o);n("error",`${r}: ${s}`,{node:i})}}addEntry(e,r){if(e==="AstNode"){this.entries.add("AstNode",r);return}for(let n of this.reflection.getAllSubTypes(e))this.entries.add(n,r)}getChecks(e,r){let n=ce(this.entries.get(e)).concat(this.entries.get("AstNode"));return r&&(n=n.filter(i=>r.includes(i.category))),n.map(i=>i.check)}registerBeforeDocument(e,r=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",r))}registerAfterDocument(e,r=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",r))}wrapPreparationException(e,r,n){return async(i,o,s,a)=>{await this.handleException(()=>e.call(n,i,o,s,a),r,o,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}};var uo=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,r={},n=J.CancellationToken.None){let i=e.parseResult,o=[];if(await ot(n),(!r.categories||r.categories.includes("built-in"))&&(this.processLexingErrors(i,o,r),r.stopAfterLexingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===Lr.LexingError})||(this.processParsingErrors(i,o,r),r.stopAfterParsingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===Lr.ParsingError}))||(this.processLinkingErrors(e,o,r),r.stopAfterLinkingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===Lr.LinkingError}))))return o;try{o.push(...await this.validateAst(i.value,r,n))}catch(s){if(bn(s))throw s;console.error("An error occurred during validation:",s)}return await ot(n),o}processLexingErrors(e,r,n){var i,o,s;let a=[...e.lexerErrors,...(o=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&o!==void 0?o:[]];for(let c of a){let u=(s=c.severity)!==null&&s!==void 0?s:"error",l={severity:Ud(u),range:{start:{line:c.line-1,character:c.column-1},end:{line:c.line-1,character:c.column+c.length-1}},message:c.message,data:Z_(u),source:this.getSource()};r.push(l)}}processParsingErrors(e,r,n){for(let i of e.parserErrors){let o;if(isNaN(i.token.startOffset)){if("previousToken"in i){let s=i.previousToken;if(isNaN(s.startOffset)){let a={line:0,character:0};o={start:a,end:a}}else{let a={line:s.endLine-1,character:s.endColumn};o={start:a,end:a}}}}else o=Eo(i.token);if(o){let s={severity:Ud("error"),range:o,message:i.message,data:co(Lr.ParsingError),source:this.getSource()};r.push(s)}}}processLinkingErrors(e,r,n){for(let i of e.references){let o=i.error;if(o){let s={node:o.container,property:o.property,index:o.index,data:{code:Lr.LinkingError,containerType:o.container.$type,property:o.property,refText:o.reference.$refText}};r.push(this.toDiagnostic("error",o.message,s))}}}async validateAst(e,r,n=J.CancellationToken.None){let i=[],o=(s,a,c)=>{i.push(this.toDiagnostic(s,a,c))};return await this.validateAstBefore(e,r,o,n),await this.validateAstNodes(e,r,o,n),await this.validateAstAfter(e,r,o,n),i}async validateAstBefore(e,r,n,i=J.CancellationToken.None){var o;let s=this.validationRegistry.checksBefore;for(let a of s)await ot(i),await a(e,n,(o=r.categories)!==null&&o!==void 0?o:[],i)}async validateAstNodes(e,r,n,i=J.CancellationToken.None){await Promise.all(Ir(e).map(async o=>{await ot(i);let s=this.validationRegistry.getChecks(o.$type,r.categories);for(let a of s)await a(o,n,i)}))}async validateAstAfter(e,r,n,i=J.CancellationToken.None){var o;let s=this.validationRegistry.checksAfter;for(let a of s)await ot(i),await a(e,n,(o=r.categories)!==null&&o!==void 0?o:[],i)}toDiagnostic(e,r,n){return{message:r,range:Q_(n),severity:Ud(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 Q_(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=cc(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=xp(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Ud(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}function Z_(t){switch(t){case"error":return co(Lr.LexingError);case"warning":return co(Lr.LexingWarning);case"info":return co(Lr.LexingInfo);case"hint":return co(Lr.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var Lr;(function(t){t.LexingError="lexing-error",t.LexingWarning="lexing-warning",t.LexingInfo="lexing-info",t.LexingHint="lexing-hint",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(Lr||(Lr={}));var nu=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,r,n){let i=n??Rt(e);r??(r=this.nameProvider.getName(e));let o=this.astNodeLocator.getAstNodePath(e);if(!r)throw new Error(`Node at path ${o} has no name.`);let s,a=()=>{var c;return s??(s=Mi((c=this.nameProvider.getNameNode(e))!==null&&c!==void 0?c:e.$cstNode))};return{node:e,name:r,get nameSegment(){return a()},selectionSegment:Mi(e.$cstNode),type:e.$type,documentUri:i.uri,path:o}}},iu=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,r=J.CancellationToken.None){let n=[],i=e.parseResult.value;for(let o of Ir(i))await ot(r),ms(o).filter(s=>!Oi(s)).forEach(s=>{let a=this.createDescription(s);a&&n.push(a)});return n}createDescription(e){let r=e.reference.$nodeDescription,n=e.reference.$refNode;if(!r||!n)return;let i=Rt(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:r.documentUri,targetPath:r.path,segment:Mi(n),local:ge.equals(r.documentUri,i)}}};var ou=class{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let r=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return r+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:r}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return r!==void 0?e+this.indexSeparator+r:e}getAstNode(e,r){return r.split(this.segmentSeparator).reduce((i,o)=>{if(!i||o.length===0)return i;let s=o.indexOf(this.indexSeparator);if(s>0){let a=o.substring(0,s),c=parseInt(o.substring(s+1)),u=i[a];return u?.[c]}return i[o]},e)}};var Ve={};ve(Ve,Nr(oo(),1));var su=class{constructor(e){this._ready=new sr,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new Ve.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var r,n;this.workspaceConfig=(n=(r=e.capabilities.workspace)===null||r===void 0?void 0:r.configuration)!==null&&n!==void 0?n:!1}async initialized(e){if(this.workspaceConfig){if(e.register){let r=this.serviceRegistry.all;e.register({section:r.map(n=>this.toSectionName(n.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let r=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await e.fetchConfiguration(r);r.forEach((i,o)=>{this.updateSectionConfiguration(i.section,n[o])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(r=>{let n=e.settings[r];this.updateSectionConfiguration(r,n),this.onConfigurationSectionUpdateEmitter.fire({section:r,configuration:n})})}updateSectionConfiguration(e,r){this.settings[e]=r}async getConfiguration(e,r){await this.ready;let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][r]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}};var xi;(function(t){function e(r){return{dispose:async()=>await r()}}t.create=e})(xi||(xi={}));var au=class{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Yr,this.documentPhaseListeners=new Yr,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=Le.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,r={},n=J.CancellationToken.None){var i,o;for(let s of e){let a=s.uri.toString();if(s.state===Le.Validated){if(typeof r.validation=="boolean"&&r.validation)s.state=Le.IndexedReferences,s.diagnostics=void 0,this.buildState.delete(a);else if(typeof r.validation=="object"){let c=this.buildState.get(a),u=(i=c?.result)===null||i===void 0?void 0:i.validationChecks;if(u){let h=((o=r.validation.categories)!==null&&o!==void 0?o:ga.all).filter(p=>!u.includes(p));h.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},r.validation),{categories:h})},result:c.result}),s.state=Le.IndexedReferences)}}}else this.buildState.delete(a)}this.currentState=Le.Changed,await this.emitUpdate(e.map(s=>s.uri),[]),await this.buildDocuments(e,r,n)}async update(e,r,n=J.CancellationToken.None){this.currentState=Le.Changed;for(let s of r)this.langiumDocuments.deleteDocument(s),this.buildState.delete(s.toString()),this.indexManager.remove(s);for(let s of e){if(!this.langiumDocuments.invalidateDocument(s)){let c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},s);c.state=Le.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(s.toString())}let i=ce(e).concat(r).map(s=>s.toString()).toSet();this.langiumDocuments.all.filter(s=>!i.has(s.uri.toString())&&this.shouldRelink(s,i)).forEach(s=>{this.serviceRegistry.getServices(s.uri).references.Linker.unlink(s),s.state=Math.min(s.state,Le.ComputedScopes),s.diagnostics=void 0}),await this.emitUpdate(e,r),await ot(n);let o=this.sortDocuments(this.langiumDocuments.all.filter(s=>{var a;return s.state<Le.Linked||!(!((a=this.buildState.get(s.uri.toString()))===null||a===void 0)&&a.completed)}).toArray());await this.buildDocuments(o,this.updateBuildOptions,n)}async emitUpdate(e,r){await Promise.all(this.updateListeners.map(n=>n(e,r)))}sortDocuments(e){let r=0,n=e.length-1;for(;r<n;){for(;r<e.length&&this.hasTextDocument(e[r]);)r++;for(;n>=0&&!this.hasTextDocument(e[n]);)n--;r<n&&([e[r],e[n]]=[e[n],e[r]])}return e}hasTextDocument(e){var r;return!!(!((r=this.textDocuments)===null||r===void 0)&&r.get(e.uri))}shouldRelink(e,r){return e.references.some(n=>n.error!==void 0)?!0:this.indexManager.isAffected(e,r)}onUpdate(e){return this.updateListeners.push(e),xi.create(()=>{let r=this.updateListeners.indexOf(e);r>=0&&this.updateListeners.splice(r,1)})}async buildDocuments(e,r,n){this.prepareBuild(e,r),await this.runCancelable(e,Le.Parsed,n,s=>this.langiumDocumentFactory.update(s,n)),await this.runCancelable(e,Le.IndexedContent,n,s=>this.indexManager.updateContent(s,n)),await this.runCancelable(e,Le.ComputedScopes,n,async s=>{let a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await a.computeLocalScopes(s,n)});let i=e.filter(s=>this.shouldLink(s));await this.runCancelable(i,Le.Linked,n,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,n)),await this.runCancelable(i,Le.IndexedReferences,n,s=>this.indexManager.updateReferences(s,n));let o=e.filter(s=>this.shouldValidate(s));await this.runCancelable(o,Le.Validated,n,s=>this.validate(s,n));for(let s of e){let a=this.buildState.get(s.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,r){for(let n of e){let i=n.uri.toString(),o=this.buildState.get(i);(!o||o.completed)&&this.buildState.set(i,{completed:!1,options:r,result:o?.result})}}async runCancelable(e,r,n,i){let o=e.filter(a=>a.state<r);for(let a of o)await ot(n),await i(a),a.state=r,await this.notifyDocumentPhase(a,r,n);let s=e.filter(a=>a.state===r);await this.notifyBuildPhase(s,r,n),this.currentState=r}onBuildPhase(e,r){return this.buildPhaseListeners.add(e,r),xi.create(()=>{this.buildPhaseListeners.delete(e,r)})}onDocumentPhase(e,r){return this.documentPhaseListeners.add(e,r),xi.create(()=>{this.documentPhaseListeners.delete(e,r)})}waitUntil(e,r,n){let i;if(r&&"path"in r?i=r:n=r,n??(n=J.CancellationToken.None),i){let o=this.langiumDocuments.getDocument(i);if(o&&o.state>=e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Rn):new Promise((o,s)=>{let a=this.onBuildPhase(e,()=>{if(a.dispose(),c.dispose(),i){let u=this.langiumDocuments.getDocument(i);o(u?.uri)}else o(void 0)}),c=n.onCancellationRequested(()=>{a.dispose(),c.dispose(),s(Rn)})})}async notifyDocumentPhase(e,r,n){let o=this.documentPhaseListeners.get(r).slice();for(let s of o)try{await s(e,n)}catch(a){if(!bn(a))throw a}}async notifyBuildPhase(e,r,n){if(e.length===0)return;let o=this.buildPhaseListeners.get(r).slice();for(let s of o)await ot(n),await s(e,n)}shouldLink(e){var r;return(r=this.getBuildOptions(e).eagerLinking)!==null&&r!==void 0?r:!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,r){var n,i;let o=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,s=this.getBuildOptions(e).validation,a=typeof s=="object"?s:void 0,c=await o.validateDocument(e,a,r);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;let u=this.buildState.get(e.uri.toString());if(u){(n=u.result)!==null&&n!==void 0||(u.result={});let l=(i=a?.categories)!==null&&i!==void 0?i:ga.all;u.result.validationChecks?u.result.validationChecks.push(...l):u.result.validationChecks=[...l]}}getBuildOptions(e){var r,n;return(n=(r=this.buildState.get(e.uri.toString()))===null||r===void 0?void 0:r.options)!==null&&n!==void 0?n:{}}};var cu=class{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new ao,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,r){let n=Rt(e).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(s=>{ge.equals(s.targetUri,n)&&s.targetPath===r&&i.push(s)})}),ce(i)}allElements(e,r){let n=ce(this.symbolIndex.keys());return r&&(n=n.filter(i=>!r||r.has(i))),n.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,r){var n;return r?this.symbolByTypeIndex.get(e,r,()=>{var o;return((o=this.symbolIndex.get(e))!==null&&o!==void 0?o:[]).filter(a=>this.astReflection.isSubtype(a.type,r))}):(n=this.symbolIndex.get(e))!==null&&n!==void 0?n:[]}remove(e){let r=e.toString();this.symbolIndex.delete(r),this.symbolByTypeIndex.clear(r),this.referenceIndex.delete(r)}async updateContent(e,r=J.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,r),o=e.uri.toString();this.symbolIndex.set(o,i),this.symbolByTypeIndex.clear(o)}async updateReferences(e,r=J.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,r);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,r){let n=this.referenceIndex.get(e.uri.toString());return n?n.some(i=>!i.local&&r.has(i.targetUri.toString())):!1}};var uu=class{constructor(e){this.initialBuildOptions={},this._ready=new sr,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){var r;this.folders=(r=e.workspaceFolders)!==null&&r!==void 0?r:void 0}initialized(e){return this.mutex.write(r=>{var n;return this.initializeWorkspace((n=this.folders)!==null&&n!==void 0?n:[],r)})}async initializeWorkspace(e,r=J.CancellationToken.None){let n=await this.performStartup(e);await ot(r),await this.documentBuilder.build(n,this.initialBuildOptions,r)}async performStartup(e){let r=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),n=this.serviceRegistry.all.flatMap(s=>{var a;return(a=s.LanguageMetaData.fileNames)!==null&&a!==void 0?a:[]}),i=[],o=s=>{i.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,o),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,{fileExtensions:r,fileNames:n},o))),this._ready.resolve(),i}loadAdditionalDocuments(e,r){return Promise.resolve()}getRootFolder(e){return vt.parse(e.uri)}async traverseFolder(e,r,n,i){let o=await this.fileSystemProvider.readDirectory(r);await Promise.all(o.map(async s=>{if(this.includeEntry(e,s,n)){if(s.isDirectory)await this.traverseFolder(e,s.uri,n,i);else if(s.isFile){let a=await this.langiumDocuments.getOrCreateDocument(s.uri);i(a)}}}))}includeEntry(e,r,n){let i=ge.basename(r.uri);return i.startsWith(".")?!1:r.isDirectory?i!=="node_modules"&&i!=="out":r.isFile?n.fileExtensions.includes(ge.extname(r.uri))||n.fileNames.includes(ge.basename(r.uri)):!1}};var lu=class{buildUnexpectedCharactersMessage(e,r,n,i,o){return Vs.buildUnexpectedCharactersMessage(e,r,n,i,o)}buildUnableToPopLexerModeMessage(e){return Vs.buildUnableToPopLexerModeMessage(e)}},Wd={mode:"full"},lo=class{constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;let r=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(r);let n=jm(r)?Object.values(r):r,i=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new Ze(n,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,r=Wd){var n,i,o;let s=this.chevrotainLexer.tokenize(e);return{tokens:s.tokens,errors:s.errors,hidden:(n=s.groups.hidden)!==null&&n!==void 0?n:[],report:(o=(i=this.tokenBuilder).flushLexingReport)===null||o===void 0?void 0:o.call(i,e)}}toTokenTypeDictionary(e){if(jm(e))return e;let r=Um(e)?Object.values(e.modes).flat():e,n={};return r.forEach(i=>n[i.name]=i),n}};function Bd(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function Um(t){return t&&"modes"in t&&"defaultMode"in t}function jm(t){return!Bd(t)&&!Um(t)}function hu(t,e,r){let n,i;typeof t=="string"?(i=e,n=r):(i=t.range.start,n=e),i||(i=Te.create(0,0));let o=rC(t),s=Hm(n),a=NF({lines:o,position:i,options:s});return LF({index:0,tokens:a,position:i})}function pu(t,e){let r=Hm(e),n=rC(t);if(n.length===0)return!1;let i=n[0],o=n[n.length-1],s=r.start,a=r.end;return!!s?.exec(i)&&!!a?.exec(o)}function rC(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(dp)}var eC=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,wF=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function NF(t){var e,r,n;let i=[],o=t.position.line,s=t.position.character;for(let a=0;a<t.lines.length;a++){let c=a===0,u=a===t.lines.length-1,l=t.lines[a],h=0;if(c&&t.options.start){let y=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);y&&(h=y.index+y[0].length)}else{let y=(r=t.options.line)===null||r===void 0?void 0:r.exec(l);y&&(h=y.index+y[0].length)}if(u){let y=(n=t.options.end)===null||n===void 0?void 0:n.exec(l);y&&(l=l.substring(0,y.index))}if(l=l.substring(0,OF(l)),Bm(l,h)>=l.length){if(i.length>0){let y=Te.create(o,s);i.push({type:"break",content:"",range:me.create(y,y)})}}else{eC.lastIndex=h;let y=eC.exec(l);if(y){let _=y[0],E=y[1],D=Te.create(o,s+h),w=Te.create(o,s+h+_.length);i.push({type:"tag",content:E,range:me.create(D,w)}),h+=_.length,h=Bm(l,h)}if(h<l.length){let _=l.substring(h),E=Array.from(_.matchAll(wF));i.push(...PF(E,_,o,s+h))}}o++,s=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function PF(t,e,r,n){let i=[];if(t.length===0){let o=Te.create(r,n),s=Te.create(r,n+e.length);i.push({type:"text",content:e,range:me.create(o,s)})}else{let o=0;for(let a of t){let c=a.index,u=e.substring(o,c);u.length>0&&i.push({type:"text",content:e.substring(o,c),range:me.create(Te.create(r,o+n),Te.create(r,c+n))});let l=u.length+1,h=a[1];if(i.push({type:"inline-tag",content:h,range:me.create(Te.create(r,o+l+n),Te.create(r,o+l+h.length+n))}),l+=h.length,a.length===4){l+=a[2].length;let p=a[3];i.push({type:"text",content:p,range:me.create(Te.create(r,o+l+n),Te.create(r,o+l+p.length+n))})}else i.push({type:"text",content:"",range:me.create(Te.create(r,o+l+n),Te.create(r,o+l+n))});o=c+a[0].length}let s=e.substring(o);s.length>0&&i.push({type:"text",content:s,range:me.create(Te.create(r,o+n),Te.create(r,o+n+s.length))})}return i}var IF=/\S/,DF=/\s*$/;function Bm(t,e){let r=t.substring(e).match(IF);return r?e+r.index:t.length}function OF(t){let e=t.match(DF);if(e&&typeof e.index=="number")return e.index}function LF(t){var e,r,n,i;let o=Te.create(t.position.line,t.position.character);if(t.tokens.length===0)return new Hd([],me.create(o,o));let s=[];for(;t.index<t.tokens.length;){let u=MF(t,s[s.length-1]);u&&s.push(u)}let a=(r=(e=s[0])===null||e===void 0?void 0:e.range.start)!==null&&r!==void 0?r:o,c=(i=(n=s[s.length-1])===null||n===void 0?void 0:n.range.end)!==null&&i!==void 0?i:o;return new Hd(s,me.create(a,c))}function MF(t,e){let r=t.tokens[t.index];if(r.type==="tag")return iC(t,!1);if(r.type==="text"||r.type==="inline-tag")return nC(t);FF(r,e),t.index++}function FF(t,e){if(e){let r=new Gd("",t.range);"inlines"in e?e.inlines.push(r):e.content.inlines.push(r)}}function nC(t){let e=t.tokens[t.index],r=e,n=e,i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push($F(t)),n=e,e=t.tokens[t.index];return new fu(i,me.create(r.range.start,n.range.end))}function $F(t){return t.tokens[t.index].type==="inline-tag"?iC(t,!0):oC(t)}function iC(t,e){let r=t.tokens[t.index++],n=r.content.substring(1),i=t.tokens[t.index];if(i?.type==="text")if(e){let o=oC(t);return new du(n,new fu([o],o.range),e,me.create(r.range.start,o.range.end))}else{let o=nC(t);return new du(n,o,e,me.create(r.range.start,o.range.end))}else{let o=r.range;return new du(n,new fu([],o),e,o)}}function oC(t){let e=t.tokens[t.index++];return new Gd(e.content,e.range)}function Hm(t){if(!t)return Hm({start:"/**",end:"*/",line:"*"});let{start:e,end:r,line:n}=t;return{start:Wm(e,!0),end:Wm(r,!1),line:Wm(n,!0)}}function Wm(t,e){if(typeof t=="string"||typeof t=="object"){let r=typeof t=="string"?Yn(t):t.source;return e?new RegExp(`^\\s*${r}`):new RegExp(`\\s*${r}\\s*$`)}else return t}var Hd=class{constructor(e,r){this.elements=e,this.range=r}getTag(e){return this.getAllTags().find(r=>r.name===e)}getTags(e){return this.getAllTags().filter(r=>r.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(let r of this.elements)if(e.length===0)e=r.toString();else{let n=r.toString();e+=tC(e)+n}return e.trim()}toMarkdown(e){let r="";for(let n of this.elements)if(r.length===0)r=n.toMarkdown(e);else{let i=n.toMarkdown(e);r+=tC(r)+i}return r.trim()}},du=class{constructor(e,r,n,i){this.name=e,this.content=r,this.inline=n,this.range=i}toString(){let e=`@${this.name}`,r=this.content.toString();return this.content.inlines.length===1?e=`${e} ${r}`:this.content.inlines.length>1&&(e=`${e}
153
- ${r}`),this.inline?`{${e}}`:e}toMarkdown(e){var r,n;return(n=(r=e?.renderTag)===null||r===void 0?void 0:r.call(e,this))!==null&&n!==void 0?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){let r=this.content.toMarkdown(e);if(this.inline){let o=qF(this.name,r,e??{});if(typeof o=="string")return o}let n="";e?.tag==="italic"||e?.tag===void 0?n="*":e?.tag==="bold"?n="**":e?.tag==="bold-italic"&&(n="***");let i=`${n}@${this.name}${n}`;return this.content.inlines.length===1?i=`${i} \u2014 ${r}`:this.content.inlines.length>1&&(i=`${i}
154
- ${r}`),this.inline?`{${i}}`:i}};function qF(t,e,r){var n,i;if(t==="linkplain"||t==="linkcode"||t==="link"){let o=e.indexOf(" "),s=e;if(o>0){let c=Bm(e,o);s=e.substring(c),e=e.substring(0,o)}return(t==="linkcode"||t==="link"&&r.link==="code")&&(s=`\`${s}\``),(i=(n=r.renderLink)===null||n===void 0?void 0:n.call(r,e,s))!==null&&i!==void 0?i:jF(e,s)}}function jF(t,e){try{return vt.parse(t,!0),`[${e}](${t})`}catch{return t}}var fu=class{constructor(e,r){this.inlines=e,this.range=r}toString(){let e="";for(let r=0;r<this.inlines.length;r++){let n=this.inlines[r],i=this.inlines[r+1];e+=n.toString(),i&&i.range.start.line>n.range.start.line&&(e+=`
151
+ `&&i++}n&&r.length>0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return Te.create(0,e);for(;n<i;){let s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}let o=n-1;return Te.create(o,e-r[o])}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}},k;(function(t){let e=Object.prototype.toString;function r(y){return typeof y<"u"}t.defined=r;function n(y){return typeof y>"u"}t.undefined=n;function i(y){return y===!0||y===!1}t.boolean=i;function o(y){return e.call(y)==="[object String]"}t.string=o;function s(y){return e.call(y)==="[object Number]"}t.number=s;function a(y,_,E){return e.call(y)==="[object Number]"&&_<=y&&y<=E}t.numberRange=a;function c(y){return e.call(y)==="[object Number]"&&-2147483648<=y&&y<=2147483647}t.integer=c;function u(y){return e.call(y)==="[object Number]"&&0<=y&&y<=2147483647}t.uinteger=u;function l(y){return e.call(y)==="[object Function]"}t.func=l;function h(y){return y!==null&&typeof y=="object"}t.objectLiteral=h;function p(y,_){return Array.isArray(y)&&y.every(_)}t.typedArray=p})(k||(k={}));var Mc=class{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?e:this.rootNode}buildRootNode(e){return this.rootNode=new aa(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let r=new ro;return r.grammarSource=e,r.root=this.rootNode,this.current.content.push(r),this.nodeStack.push(r),r}buildLeafNode(e,r){let n=new to(e.startOffset,e.image.length,Eo(e),e.tokenType,!r);return n.grammarSource=r,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){let r=e.container;if(r){let n=r.content.indexOf(e);n>=0&&r.content.splice(n,1)}}addHiddenNodes(e){let r=[];for(let o of e){let s=new to(o.startOffset,o.image.length,Eo(o),o.tokenType,!0);s.root=this.rootNode,r.push(s)}let n=this.current,i=!1;if(n.content.length>0){n.content.push(...r);return}for(;n.container;){let o=n.container.content.indexOf(n);if(o>0){n.container.content.splice(o,0,...r),i=!0;break}n=n.container}i||this.rootNode.content.unshift(...r)}construct(e){let r=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=r;let n=this.nodeStack.pop();n?.content.length===0&&this.removeNode(n)}},Fc=class{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,r;let n=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(r=this.container)===null||r===void 0?void 0:r.astNode;if(!n)throw new Error("This node has no associated AST element");return n}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}},to=class extends Fc{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,r,n,i,o=!1){super(),this._hidden=o,this._offset=e,this._tokenType=i,this._length=r,this._range=n}},ro=class extends Fc{constructor(){super(...arguments),this.content=new Sm(this)}get children(){return this.content}get offset(){var e,r;return(r=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&r!==void 0?r:0}get length(){return this.end-this.offset}get end(){var e,r;return(r=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&r!==void 0?r:0}get range(){let e=this.firstNonHiddenNode,r=this.lastNonHiddenNode;if(e&&r){if(this._rangeCache===void 0){let{range:n}=e,{range:i}=r;this._rangeCache={start:n.start,end:i.end.line<n.start.line?n.start:i.end}}return this._rangeCache}else return{start:Te.create(0,0),end:Te.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 r=this.content[e];if(!r.hidden)return r}return this.content[this.content.length-1]}},Sm=class t extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,t.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,r,...n){return this.addParents(n),super.splice(e,r,...n)}addParents(e){for(let r of e)r.container=this.parent}},aa=class extends ro{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}};var Nd=Symbol("Datatype");function km(t){return t.$type===Nd}var M_="\u200B",F_=t=>t.endsWith(M_)?t:t+M_,$c=class{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;let r=this.lexer.definition,n=e.LanguageMetaData.mode==="production";this.wrapper=new Em(r,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:n,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,r){this.wrapper.wrapOr(e,r)}optional(e,r){this.wrapper.wrapOption(e,r)}many(e,r){this.wrapper.wrapMany(e,r)}atLeastOne(e,r){this.wrapper.wrapAtLeastOne(e,r)}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()}},qc=class extends $c{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Mc,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,r){let n=this.computeRuleType(e),i=this.wrapper.DEFINE_RULE(F_(e.name),this.startImplementation(n,r).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment){if(uc(e))return Nd;{let r=an(e);return r??e.name}}}parse(e,r={}){this.nodeBuilder.buildRootNode(e);let n=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=n.tokens;let i=r.rule?this.allRules.get(r.rule):this.mainRule;if(!i)throw new Error(r.rule?`No rule found with name '${r.rule}'`:"No main rule available.");let o=this.doParse(i);return this.nodeBuilder.addHiddenNodes(n.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:o,lexerErrors:n.errors,lexerReport:n.report,parserErrors:this.wrapper.errors}}doParse(e){let r=e.call(this.wrapper,{});if(this.stack.length>0&&(r=this.construct()),r===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return r}startImplementation(e,r){return n=>{let i=!this.isRecording()&&e!==void 0;if(i){let o={$type:e};this.stack.push(o),e===Nd&&(o.value="")}return r(n),i?this.construct():void 0}}extractHiddenTokens(e){let r=this.lexerResult.hidden;if(!r.length)return[];let n=e.startOffset;for(let i=0;i<r.length;i++)if(r[i].startOffset>n)return r.splice(0,i);return r.splice(0,r.length)}consume(e,r,n){let i=this.wrapper.wrapConsume(e,r);if(!this.isRecording()&&this.isValidToken(i)){let o=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(o);let s=this.nodeBuilder.buildLeafNode(i,n),{assignment:a,isCrossRef:c}=this.getAssignment(n),u=this.current;if(a){let l=Et(n)?i.image:this.converter.convert(i.image,s);this.assign(a.operator,a.feature,l,s,c)}else if(km(u)){let l=i.image;Et(n)||(l=this.converter.convert(l,s).toString()),u.value+=l}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,r,n,i,o){let s;!this.isRecording()&&!n&&(s=this.nodeBuilder.buildCompositeNode(i));let a;try{a=this.wrapper.wrapSubrule(e,r,o)}finally{this.isRecording()||(a===void 0&&!n&&(a=this.construct()),a!==void 0&&s&&s.length>0&&this.performSubruleAssignment(a,i,s))}}performSubruleAssignment(e,r,n){let{assignment:i,isCrossRef:o}=this.getAssignment(r);if(i)this.assign(i.operator,i.feature,e,n,o);else if(!i){let s=this.current;if(km(s))s.value+=e.toString();else if(typeof e=="object"&&e){let c=this.assignWithoutOverride(e,s);this.stack.pop(),this.stack.push(c)}}}action(e,r){if(!this.isRecording()){let n=this.current;if(r.feature&&r.operator){n=this.construct(),this.nodeBuilder.removeNode(n.$cstNode),this.nodeBuilder.buildCompositeNode(r).content.push(n.$cstNode);let o={$type:e};this.stack.push(o),this.assign(r.operator,r.feature,n,n.$cstNode,!1)}else n.$type=e}}construct(){if(this.isRecording())return;let e=this.current;return sl(e),this.nodeBuilder.construct(e),this.stack.pop(),km(e)?this.converter.convert(e.value,e.$cstNode):(ec(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){let r=_r(e,Vt);this.assignmentMap.set(e,{assignment:r,isCrossRef:r?br(r.terminal):!1})}return this.assignmentMap.get(e)}assign(e,r,n,i,o){let s=this.current,a;switch(o&&typeof n=="string"?a=this.linker.buildReference(s,r,i,n):a=n,e){case"=":{s[r]=a;break}case"?=":{s[r]=!0;break}case"+=":Array.isArray(s[r])||(s[r]=[]),s[r].push(a)}}assignWithoutOverride(e,r){for(let[i,o]of Object.entries(r)){let s=e[i];s===void 0?e[i]=o:Array.isArray(s)&&Array.isArray(o)&&(o.push(...s),e[i]=o)}let n=e.$cstNode;return n&&(n.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}},Pd=class{buildMismatchTokenMessage(e){return jn.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return jn.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return jn.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return jn.buildEarlyExitMessage(e)}},ca=class extends Pd{buildMismatchTokenMessage({expected:e,actual:r}){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 \`${r.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},jc=class extends $c{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let r=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=r.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,r){let n=this.wrapper.DEFINE_RULE(F_(e.name),this.startImplementation(r).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 r=>{let n=this.keepStackSize();try{e(r)}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,r,n){this.wrapper.wrapConsume(e,r),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,r,n,i,o){this.before(i),this.wrapper.wrapSubrule(e,r,o),this.after(i)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let r=this.elementStack.lastIndexOf(e);r>=0&&this.elementStack.splice(r)}}get currIdx(){return this.wrapper.currIdx}},uF={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new ca},Em=class extends Nc{constructor(e,r){let n=r&&"maxLookahead"in r;super(e,Object.assign(Object.assign(Object.assign({},uF),{lookaheadStrategy:n?new Un({maxLookahead:r.maxLookahead}):new Oc({logging:r.skipValidations?()=>{}:void 0})}),r))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,r,n){return this.RULE(e,r,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,r){return this.consume(e,r,void 0)}wrapSubrule(e,r,n){return this.subrule(e,r,{ARGS:[n]})}wrapOr(e,r){this.or(e,r)}wrapOption(e,r){this.option(e,r)}wrapMany(e,r){this.many(e,r)}wrapAtLeastOne(e,r){this.atLeastOne(e,r)}};function Uc(t,e,r){return lF({parser:e,tokens:r,ruleNames:new Map},t),e}function lF(t,e){let r=sc(e,!1),n=ce(e.rules).filter(Ye).filter(i=>r.has(i));for(let i of n){let o=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(i,no(o,i.definition))}}function no(t,e,r=!1){let n;if(Et(e))n=yF(t,e);else if(Vr(e))n=dF(t,e);else if(Vt(e))n=no(t,e.terminal);else if(br(e))n=$_(t,e);else if(ur(e))n=fF(t,e);else if(hs(e))n=pF(t,e);else if(ps(e))n=mF(t,e);else if(Pr(e))n=gF(t,e);else if(Zh(e)){let i=t.consume++;n=()=>t.parser.consume(i,kr,e)}else throw new Fi(e.$cstNode,`Unexpected element type: ${e.$type}`);return q_(t,r?void 0:Id(e),n,e.cardinality)}function dF(t,e){let r=zi(e);return()=>t.parser.action(r,e)}function fF(t,e){let r=e.rule.ref;if(Ye(r)){let n=t.subrule++,i=r.fragment,o=e.arguments.length>0?hF(r,e.arguments):()=>({});return s=>t.parser.subrule(n,j_(t,r),i,e,o(s))}else if(er(r)){let n=t.consume++,i=Am(t,r.name);return()=>t.parser.consume(n,i,e)}else if(r)on(r);else throw new Fi(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function hF(t,e){let r=e.map(n=>Wn(n.value));return n=>{let i={};for(let o=0;o<r.length;o++){let s=t.parameters[o],a=r[o];i[s.name]=a(n)}return i}}function Wn(t){if(zh(t)){let e=Wn(t.left),r=Wn(t.right);return n=>e(n)||r(n)}else if(Gh(t)){let e=Wn(t.left),r=Wn(t.right);return n=>e(n)&&r(n)}else if(Vh(t)){let e=Wn(t.value);return r=>!e(r)}else if(Kh(t)){let e=t.parameter.ref.name;return r=>r!==void 0&&r[e]===!0}else if(Hh(t)){let e=!!t.true;return()=>e}on(t)}function pF(t,e){if(e.elements.length===1)return no(t,e.elements[0]);{let r=[];for(let i of e.elements){let o={ALT:no(t,i,!0)},s=Id(i);s&&(o.GATE=Wn(s)),r.push(o)}let n=t.or++;return i=>t.parser.alternatives(n,r.map(o=>{let s={ALT:()=>o.ALT(i)},a=o.GATE;return a&&(s.GATE=()=>a(i)),s}))}}function mF(t,e){if(e.elements.length===1)return no(t,e.elements[0]);let r=[];for(let a of e.elements){let c={ALT:no(t,a,!0)},u=Id(a);u&&(c.GATE=Wn(u)),r.push(c)}let n=t.or++,i=(a,c)=>{let u=c.getRuleStack().join("-");return`uGroup_${a}_${u}`},o=a=>t.parser.alternatives(n,r.map((c,u)=>{let l={ALT:()=>!0},h=t.parser;l.ALT=()=>{if(c.ALT(a),!h.isRecording()){let y=i(n,h);h.unorderedGroups.get(y)||h.unorderedGroups.set(y,[]);let _=h.unorderedGroups.get(y);typeof _?.[u]>"u"&&(_[u]=!0)}};let p=c.GATE;return p?l.GATE=()=>p(a):l.GATE=()=>{let y=h.unorderedGroups.get(i(n,h));return!y?.[u]},l})),s=q_(t,Id(e),o,"*");return a=>{s(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(n,t.parser))}}function gF(t,e){let r=e.elements.map(n=>no(t,n));return n=>r.forEach(i=>i(n))}function Id(t){if(Pr(t))return t.guardCondition}function $_(t,e,r=e.terminal){if(r)if(ur(r)&&Ye(r.rule.ref)){let n=r.rule.ref,i=t.subrule++;return o=>t.parser.subrule(i,j_(t,n),!1,e,o)}else if(ur(r)&&er(r.rule.ref)){let n=t.consume++,i=Am(t,r.rule.ref.name);return()=>t.parser.consume(n,i,e)}else if(Et(r)){let n=t.consume++,i=Am(t,r.value);return()=>t.parser.consume(n,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);let n=dl(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+zi(e.type.ref));return $_(t,e,i)}}function yF(t,e){let r=t.consume++,n=t.tokens[e.value];if(!n)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(r,n,e)}function q_(t,e,r,n){let i=e&&Wn(e);if(!n)if(i){let o=t.or++;return s=>t.parser.alternatives(o,[{ALT:()=>r(s),GATE:()=>i(s)},{ALT:bd(),GATE:()=>!i(s)}])}else return r;if(n==="*"){let o=t.many++;return s=>t.parser.many(o,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else if(n==="+"){let o=t.many++;if(i){let s=t.or++;return a=>t.parser.alternatives(s,[{ALT:()=>t.parser.atLeastOne(o,{DEF:()=>r(a)}),GATE:()=>i(a)},{ALT:bd(),GATE:()=>!i(a)}])}else return s=>t.parser.atLeastOne(o,{DEF:()=>r(s)})}else if(n==="?"){let o=t.optional++;return s=>t.parser.optional(o,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else on(n)}function j_(t,e){let r=vF(t,e),n=t.parser.getRule(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function vF(t,e){if(Ye(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let r=e,n=r.$container,i=e.$type;for(;!Ye(n);)(Pr(n)||hs(n)||ps(n))&&(i=n.elements.indexOf(r).toString()+":"+i),r=n,n=n.$container;return i=n.name+":"+i,t.ruleNames.set(e,i),i}}function Am(t,e){let r=t.tokens[e];if(!r)throw new Error(`Token "${e}" not found."`);return r}function wm(t){let e=t.Grammar,r=t.parser.Lexer,n=new jc(t);return Uc(e,n,r.definition),n.finalize(),n}function Nm(t){let e=U_(t);return e.finalize(),e}function U_(t){let e=t.Grammar,r=t.parser.Lexer,n=new qc(t);return Uc(e,n,r.definition)}var io=class{constructor(){this.diagnostics=[]}buildTokens(e,r){let n=ce(sc(e,!1)),i=this.buildTerminalTokens(n),o=this.buildKeywordTokens(n,i,r);return o.push(...i),o}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(er).filter(r=>!r.fragment).map(r=>this.buildTerminalToken(r)).toArray()}buildTerminalToken(e){let r=Jn(e),n=this.requiresCustomPattern(r)?this.regexPatternFunction(r):r,i={name:e.name,PATTERN:n};return typeof n=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=ic(r)?Ze.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")||e.flags.includes("s")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){let r=new RegExp(e,e.flags+"y");return(n,i)=>(r.lastIndex=i,r.exec(n))}buildKeywordTokens(e,r,n){return e.filter(Ye).flatMap(i=>Cr(i).filter(Et)).distinct(i=>i.value).toArray().sort((i,o)=>o.value.length-i.value.length).map(i=>this.buildKeywordToken(i,r,!!n?.caseInsensitive))}buildKeywordToken(e,r,n){let i=this.buildKeywordPattern(e,n),o={name:e.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(e,r)};return typeof i=="function"&&(o.LINE_BREAKS=!0),o}buildKeywordPattern(e,r){return r?new RegExp(Yn(e.value),"i"):e.value}findLongerAlt(e,r){return r.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&hp("^"+o.source+"$",e.value)&&n.push(i),n},[])}};var Wc=class{convert(e,r){let n=r.grammarSource;if(br(n)&&(n=ac(n)),ur(n)){let i=n.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,r)}return e}runConverter(e,r,n){var i;switch(e.name.toUpperCase()){case"INT":return Tn.convertInt(r);case"STRING":return Tn.convertString(r);case"ID":return Tn.convertID(r)}switch((i=_p(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Tn.convertNumber(r);case"boolean":return Tn.convertBoolean(r);case"bigint":return Tn.convertBigint(r);case"date":return Tn.convertDate(r);default:return r}}},Tn;(function(t){function e(u){let l="";for(let h=1;h<u.length-1;h++){let p=u.charAt(h);if(p==="\\"){let y=u.charAt(++h);l+=r(y)}else l+=p}return l}t.convertString=e;function r(u){switch(u){case"b":return"\b";case"f":return"\f";case"n":return`
152
+ `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return u}}function n(u){return u.charAt(0)==="^"?u.substring(1):u}t.convertID=n;function i(u){return parseInt(u)}t.convertInt=i;function o(u){return BigInt(u)}t.convertBigint=o;function s(u){return new Date(u)}t.convertDate=s;function a(u){return Number(u)}t.convertNumber=a;function c(u){return u.toLowerCase()==="true"}t.convertBoolean=c})(Tn||(Tn={}));var J={};ve(J,Nr(Bc(),1));function Fm(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}var Md=0,G_=10;function Fd(){return Md=performance.now(),new J.CancellationTokenSource}function z_(t){G_=t}var Rn=Symbol("OperationCancelled");function bn(t){return t===Rn}async function ot(t){if(t===J.CancellationToken.None)return;let e=performance.now();if(e-Md>=G_&&(Md=e,await Fm(),Md=performance.now()),t.isCancellationRequested)throw Rn}var sr=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=n=>(e(n),this),this.reject=n=>(r(n),this)})}};var $d=class t{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){for(let n of e)if(t.isIncremental(n)){let i=X_(n.range),o=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,o)+n.text+this._content.substring(s,this._content.length);let a=Math.max(i.start.line,0),c=Math.max(i.end.line,0),u=this._lineOffsets,l=V_(n.text,!1,o);if(c-a===l.length)for(let p=0,y=l.length;p<y;p++)u[p+a+1]=l[p];else l.length<1e4?u.splice(a+1,c-a,...l):this._lineOffsets=u=u.slice(0,a+1).concat(l,u.slice(c+1));let h=n.text.length-(s-o);if(h!==0)for(let p=a+1+l.length,y=u.length;p<y;p++)u[p]=u[p]+h}else if(t.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=r}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=V_(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:e};for(;n<i;){let s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}let o=n-1;return e=this.ensureBeforeEOL(e,r[o]),{line:o,character:e-r[o]}}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line];if(e.character<=0)return n;let i=e.line+1<r.length?r[e.line+1]:this._content.length,o=Math.min(n+e.character,i);return this.ensureBeforeEOL(o,n)}ensureBeforeEOL(e,r){for(;e>r&&K_(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},vi;(function(t){function e(i,o,s,a){return new $d(i,o,s,a)}t.create=e;function r(i,o,s){if(i instanceof $d)return i.update(o,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,o){let s=i.getText(),a=$m(o.map(AF),(l,h)=>{let p=l.range.start.line-h.range.start.line;return p===0?l.range.start.character-h.range.start.character:p}),c=0,u=[];for(let l of a){let h=i.offsetAt(l.range.start);if(h<c)throw new Error("Overlapping edit");h>c&&u.push(s.substring(c,h)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(s.substr(c)),u.join("")}t.applyEdits=n})(vi||(vi={}));function $m(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);$m(n,e),$m(i,e);let o=0,s=0,a=0;for(;o<n.length&&s<i.length;)e(n[o],i[s])<=0?t[a++]=n[o++]:t[a++]=i[s++];for(;o<n.length;)t[a++]=n[o++];for(;s<i.length;)t[a++]=i[s++];return t}function V_(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);K_(o)&&(o===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function K_(t){return t===13||t===10}function X_(t){let e=t.start,r=t.end;return e.line>r.line||e.line===r.line&&e.character>r.character?{start:r,end:e}:t}function AF(t){let e=X_(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var Y_;(()=>{"use strict";var t={470:i=>{function o(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}function s(c,u){for(var l,h="",p=0,y=-1,_=0,E=0;E<=c.length;++E){if(E<c.length)l=c.charCodeAt(E);else{if(l===47)break;l=47}if(l===47){if(!(y===E-1||_===1))if(y!==E-1&&_===2){if(h.length<2||p!==2||h.charCodeAt(h.length-1)!==46||h.charCodeAt(h.length-2)!==46){if(h.length>2){var D=h.lastIndexOf("/");if(D!==h.length-1){D===-1?(h="",p=0):p=(h=h.slice(0,D)).length-1-h.lastIndexOf("/"),y=E,_=0;continue}}else if(h.length===2||h.length===1){h="",p=0,y=E,_=0;continue}}u&&(h.length>0?h+="/..":h="..",p=2)}else h.length>0?h+="/"+c.slice(y+1,E):h=c.slice(y+1,E),p=E-y-1;y=E,_=0}else l===46&&_!==-1?++_:_=-1}return h}var a={resolve:function(){for(var c,u="",l=!1,h=arguments.length-1;h>=-1&&!l;h--){var p;h>=0?p=arguments[h]:(c===void 0&&(c=process.cwd()),p=c),o(p),p.length!==0&&(u=p+"/"+u,l=p.charCodeAt(0)===47)}return u=s(u,!l),l?u.length>0?"/"+u:"/":u.length>0?u:"."},normalize:function(c){if(o(c),c.length===0)return".";var u=c.charCodeAt(0)===47,l=c.charCodeAt(c.length-1)===47;return(c=s(c,!u)).length!==0||u||(c="."),c.length>0&&l&&(c+="/"),u?"/"+c:c},isAbsolute:function(c){return o(c),c.length>0&&c.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var c,u=0;u<arguments.length;++u){var l=arguments[u];o(l),l.length>0&&(c===void 0?c=l:c+="/"+l)}return c===void 0?".":a.normalize(c)},relative:function(c,u){if(o(c),o(u),c===u||(c=a.resolve(c))===(u=a.resolve(u)))return"";for(var l=1;l<c.length&&c.charCodeAt(l)===47;++l);for(var h=c.length,p=h-l,y=1;y<u.length&&u.charCodeAt(y)===47;++y);for(var _=u.length-y,E=p<_?p:_,D=-1,w=0;w<=E;++w){if(w===E){if(_>E){if(u.charCodeAt(y+w)===47)return u.slice(y+w+1);if(w===0)return u.slice(y+w)}else p>E&&(c.charCodeAt(l+w)===47?D=w:w===0&&(D=0));break}var x=c.charCodeAt(l+w);if(x!==u.charCodeAt(y+w))break;x===47&&(D=w)}var g="";for(w=l+D+1;w<=h;++w)w!==h&&c.charCodeAt(w)!==47||(g.length===0?g+="..":g+="/..");return g.length>0?g+u.slice(y+D):(y+=D,u.charCodeAt(y)===47&&++y,u.slice(y))},_makeLong:function(c){return c},dirname:function(c){if(o(c),c.length===0)return".";for(var u=c.charCodeAt(0),l=u===47,h=-1,p=!0,y=c.length-1;y>=1;--y)if((u=c.charCodeAt(y))===47){if(!p){h=y;break}}else p=!1;return h===-1?l?"/":".":l&&h===1?"//":c.slice(0,h)},basename:function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');o(c);var l,h=0,p=-1,y=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var _=u.length-1,E=-1;for(l=c.length-1;l>=0;--l){var D=c.charCodeAt(l);if(D===47){if(!y){h=l+1;break}}else E===-1&&(y=!1,E=l+1),_>=0&&(D===u.charCodeAt(_)?--_==-1&&(p=l):(_=-1,p=E))}return h===p?p=E:p===-1&&(p=c.length),c.slice(h,p)}for(l=c.length-1;l>=0;--l)if(c.charCodeAt(l)===47){if(!y){h=l+1;break}}else p===-1&&(y=!1,p=l+1);return p===-1?"":c.slice(h,p)},extname:function(c){o(c);for(var u=-1,l=0,h=-1,p=!0,y=0,_=c.length-1;_>=0;--_){var E=c.charCodeAt(_);if(E!==47)h===-1&&(p=!1,h=_+1),E===46?u===-1?u=_:y!==1&&(y=1):u!==-1&&(y=-1);else if(!p){l=_+1;break}}return u===-1||h===-1||y===0||y===1&&u===h-1&&u===l+1?"":c.slice(u,h)},format:function(c){if(c===null||typeof c!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof c);return(function(u,l){var h=l.dir||l.root,p=l.base||(l.name||"")+(l.ext||"");return h?h===l.root?h+p:h+"/"+p:p})(0,c)},parse:function(c){o(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var l,h=c.charCodeAt(0),p=h===47;p?(u.root="/",l=1):l=0;for(var y=-1,_=0,E=-1,D=!0,w=c.length-1,x=0;w>=l;--w)if((h=c.charCodeAt(w))!==47)E===-1&&(D=!1,E=w+1),h===46?y===-1?y=w:x!==1&&(x=1):y!==-1&&(x=-1);else if(!D){_=w+1;break}return y===-1||E===-1||x===0||x===1&&y===E-1&&y===_+1?E!==-1&&(u.base=u.name=_===0&&p?c.slice(1,E):c.slice(_,E)):(_===0&&p?(u.name=c.slice(1,y),u.base=c.slice(1,E)):(u.name=c.slice(_,y),u.base=c.slice(_,E)),u.ext=c.slice(y,E)),_>0?u.dir=c.slice(0,_-1):p&&(u.dir="/"),u},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,i.exports=a}},e={};function r(i){var o=e[i];if(o!==void 0)return o.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.d=(i,o)=>{for(var s in o)r.o(o,s)&&!r.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:o[s]})},r.o=(i,o)=>Object.prototype.hasOwnProperty.call(i,o),r.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var n={};(()=>{let i;r.r(n),r.d(n,{URI:()=>p,Utils:()=>xt}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let o=/^\w[\w\d+.-]*$/,s=/^\//,a=/^\/\//;function c($,I){if(!$.scheme&&I)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${$.authority}", path: "${$.path}", query: "${$.query}", fragment: "${$.fragment}"}`);if($.scheme&&!o.test($.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if($.path){if($.authority){if(!s.test($.path))throw new 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(a.test($.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}let u="",l="/",h=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class p{static isUri(I){return I instanceof p||!!I&&typeof I.authority=="string"&&typeof I.fragment=="string"&&typeof I.path=="string"&&typeof I.query=="string"&&typeof I.scheme=="string"&&typeof I.fsPath=="string"&&typeof I.with=="function"&&typeof I.toString=="function"}scheme;authority;path;query;fragment;constructor(I,z,W,le,Z,Q=!1){typeof I=="object"?(this.scheme=I.scheme||u,this.authority=I.authority||u,this.path=I.path||u,this.query=I.query||u,this.fragment=I.fragment||u):(this.scheme=(function(at,B){return at||B?at:"file"})(I,Q),this.authority=z||u,this.path=(function(at,B){switch(at){case"https":case"http":case"file":B?B[0]!==l&&(B=l+B):B=l}return B})(this.scheme,W||u),this.query=le||u,this.fragment=Z||u,c(this,Q))}get fsPath(){return x(this,!1)}with(I){if(!I)return this;let{scheme:z,authority:W,path:le,query:Z,fragment:Q}=I;return z===void 0?z=this.scheme:z===null&&(z=u),W===void 0?W=this.authority:W===null&&(W=u),le===void 0?le=this.path:le===null&&(le=u),Z===void 0?Z=this.query:Z===null&&(Z=u),Q===void 0?Q=this.fragment:Q===null&&(Q=u),z===this.scheme&&W===this.authority&&le===this.path&&Z===this.query&&Q===this.fragment?this:new _(z,W,le,Z,Q)}static parse(I,z=!1){let W=h.exec(I);return W?new _(W[2]||u,te(W[4]||u),te(W[5]||u),te(W[7]||u),te(W[9]||u),z):new _(u,u,u,u,u)}static file(I){let z=u;if(i&&(I=I.replace(/\\/g,l)),I[0]===l&&I[1]===l){let W=I.indexOf(l,2);W===-1?(z=I.substring(2),I=l):(z=I.substring(2,W),I=I.substring(W)||l)}return new _("file",z,I,u,u)}static from(I){let z=new _(I.scheme,I.authority,I.path,I.query,I.fragment);return c(z,!0),z}toString(I=!1){return g(this,I)}toJSON(){return this}static revive(I){if(I){if(I instanceof p)return I;{let z=new _(I);return z._formatted=I.external,z._fsPath=I._sep===y?I.fsPath:null,z}}return I}}let y=i?1:void 0;class _ extends p{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=x(this,!1)),this._fsPath}toString(I=!1){return I?g(this,!0):(this._formatted||(this._formatted=g(this,!1)),this._formatted)}toJSON(){let I={$mid:1};return this._fsPath&&(I.fsPath=this._fsPath,I._sep=y),this._formatted&&(I.external=this._formatted),this.path&&(I.path=this.path),this.scheme&&(I.scheme=this.scheme),this.authority&&(I.authority=this.authority),this.query&&(I.query=this.query),this.fragment&&(I.fragment=this.fragment),I}}let E={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 D($,I,z){let W,le=-1;for(let Z=0;Z<$.length;Z++){let Q=$.charCodeAt(Z);if(Q>=97&&Q<=122||Q>=65&&Q<=90||Q>=48&&Q<=57||Q===45||Q===46||Q===95||Q===126||I&&Q===47||z&&Q===91||z&&Q===93||z&&Q===58)le!==-1&&(W+=encodeURIComponent($.substring(le,Z)),le=-1),W!==void 0&&(W+=$.charAt(Z));else{W===void 0&&(W=$.substr(0,Z));let at=E[Q];at!==void 0?(le!==-1&&(W+=encodeURIComponent($.substring(le,Z)),le=-1),W+=at):le===-1&&(le=Z)}}return le!==-1&&(W+=encodeURIComponent($.substring(le))),W!==void 0?W:$}function w($){let I;for(let z=0;z<$.length;z++){let W=$.charCodeAt(z);W===35||W===63?(I===void 0&&(I=$.substr(0,z)),I+=E[W]):I!==void 0&&(I+=$[z])}return I!==void 0?I:$}function x($,I){let z;return z=$.authority&&$.path.length>1&&$.scheme==="file"?`//${$.authority}${$.path}`:$.path.charCodeAt(0)===47&&($.path.charCodeAt(1)>=65&&$.path.charCodeAt(1)<=90||$.path.charCodeAt(1)>=97&&$.path.charCodeAt(1)<=122)&&$.path.charCodeAt(2)===58?I?$.path.substr(1):$.path[1].toLowerCase()+$.path.substr(2):$.path,i&&(z=z.replace(/\//g,"\\")),z}function g($,I){let z=I?w:D,W="",{scheme:le,authority:Z,path:Q,query:at,fragment:B}=$;if(le&&(W+=le,W+=":"),(Z||le==="file")&&(W+=l,W+=l),Z){let N=Z.indexOf("@");if(N!==-1){let ke=Z.substr(0,N);Z=Z.substr(N+1),N=ke.lastIndexOf(":"),N===-1?W+=z(ke,!1,!1):(W+=z(ke.substr(0,N),!1,!1),W+=":",W+=z(ke.substr(N+1),!1,!0)),W+="@"}Z=Z.toLowerCase(),N=Z.lastIndexOf(":"),N===-1?W+=z(Z,!1,!0):(W+=z(Z.substr(0,N),!1,!0),W+=Z.substr(N))}if(Q){if(Q.length>=3&&Q.charCodeAt(0)===47&&Q.charCodeAt(2)===58){let N=Q.charCodeAt(1);N>=65&&N<=90&&(Q=`/${String.fromCharCode(N+32)}:${Q.substr(3)}`)}else if(Q.length>=2&&Q.charCodeAt(1)===58){let N=Q.charCodeAt(0);N>=65&&N<=90&&(Q=`${String.fromCharCode(N+32)}:${Q.substr(2)}`)}W+=z(Q,!0,!1)}return at&&(W+="?",W+=z(at,!1,!1)),B&&(W+="#",W+=I?B:D(B,!1,!1)),W}function A($){try{return decodeURIComponent($)}catch{return $.length>3?$.substr(0,3)+A($.substr(3)):$}}let M=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function te($){return $.match(M)?$.replace(M,(I=>A(I))):$}var _e=r(470);let Se=_e.posix||_e,Nt="/";var xt;(function($){$.joinPath=function(I,...z){return I.with({path:Se.join(I.path,...z)})},$.resolvePath=function(I,...z){let W=I.path,le=!1;W[0]!==Nt&&(W=Nt+W,le=!0);let Z=Se.resolve(W,...z);return le&&Z[0]===Nt&&!I.authority&&(Z=Z.substring(1)),I.with({path:Z})},$.dirname=function(I){if(I.path.length===0||I.path===Nt)return I;let z=Se.dirname(I.path);return z.length===1&&z.charCodeAt(0)===46&&(z=""),I.with({path:z})},$.basename=function(I){return Se.basename(I.path)},$.extname=function(I){return Se.extname(I.path)}})(xt||(xt={}))})(),Y_=n})();var{URI:vt,Utils:fa}=Y_;var ge;(function(t){t.basename=fa.basename,t.dirname=fa.dirname,t.extname=fa.extname,t.joinPath=fa.joinPath,t.resolvePath=fa.resolvePath;let e=typeof process=="object"&&(process==null?void 0:process.platform)==="win32";function r(o,s){return o?.toString()===s?.toString()}t.equals=r;function n(o,s){let a=typeof o=="string"?vt.parse(o).path:o.path,c=typeof s=="string"?vt.parse(s).path:s.path,u=a.split("/").filter(_=>_.length>0),l=c.split("/").filter(_=>_.length>0);if(e){let _=/^[A-Z]:$/;if(u[0]&&_.test(u[0])&&(u[0]=u[0].toLowerCase()),l[0]&&_.test(l[0])&&(l[0]=l[0].toLowerCase()),u[0]!==l[0])return c.substring(1)}let h=0;for(;h<u.length&&u[h]===l[h];h++);let p="../".repeat(u.length-h),y=l.slice(h).join("/");return p+y}t.relative=n;function i(o){return vt.parse(o.toString()).toString()}t.normalize=i})(ge||(ge={}));var Le;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(Le||(Le={}));var Hc=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,r=J.CancellationToken.None){let n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,r)}fromTextDocument(e,r,n){return r=r??vt.parse(e.uri),J.CancellationToken.is(n)?this.createAsync(r,e,n):this.create(r,e,n)}fromString(e,r,n){return J.CancellationToken.is(n)?this.createAsync(r,e,n):this.create(r,e,n)}fromModel(e,r){return this.create(r,{$model:e})}create(e,r,n){if(typeof r=="string"){let i=this.parse(e,r,n);return this.createLangiumDocument(i,e,void 0,r)}else if("$model"in r){let i={value:r.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,e)}else{let i=this.parse(e,r.getText(),n);return this.createLangiumDocument(i,e,r)}}async createAsync(e,r,n){if(typeof r=="string"){let i=await this.parseAsync(e,r,n);return this.createLangiumDocument(i,e,void 0,r)}else{let i=await this.parseAsync(e,r.getText(),n);return this.createLangiumDocument(i,e,r)}}createLangiumDocument(e,r,n,i){let o;if(n)o={parseResult:e,uri:r,state:Le.Parsed,references:[],textDocument:n};else{let s=this.createTextDocumentGetter(r,i);o={parseResult:e,uri:r,state:Le.Parsed,references:[],get textDocument(){return s()}}}return e.value.$document=o,o}async update(e,r){var n,i;let o=(n=e.parseResult.value.$cstNode)===null||n===void 0?void 0:n.root.fullText,s=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),a=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{let c=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:c})}return o!==a&&(e.parseResult=await this.parseAsync(e.uri,a,r),e.parseResult.value.$document=e),e.state=Le.Parsed,e}parse(e,r,n){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r,n)}parseAsync(e,r,n){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(r,n)}createTextDocumentGetter(e,r){let n=this.serviceRegistry,i;return()=>i??(i=vi.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,r??""))}},Gc=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return ce(this.documentMap.values())}addDocument(e){let r=e.uri.toString();if(this.documentMap.has(r))throw new Error(`A document with the URI '${r}' is already present.`);this.documentMap.set(r,e)}getDocument(e){let r=e.toString();return this.documentMap.get(r)}async getOrCreateDocument(e,r){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,r),this.addDocument(n),n)}createDocument(e,r,n){if(n)return this.langiumDocumentFactory.fromString(r,e,n).then(i=>(this.addDocument(i),i));{let i=this.langiumDocumentFactory.fromString(r,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(this.serviceRegistry.getServices(e).references.Linker.unlink(n),n.state=Le.Changed,n.precomputedScopes=void 0,n.diagnostics=void 0),n}deleteDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=Le.Changed,this.documentMap.delete(r)),n}};var qm=Symbol("ref_resolving"),zc=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,r=J.CancellationToken.None){for(let n of Ir(e.parseResult.value))await ot(r),ms(n).forEach(i=>this.doLink(i,e))}doLink(e,r){var n;let i=e.reference;if(i._ref===void 0){i._ref=qm;try{let o=this.getCandidate(e);if(Oi(o))i._ref=o;else if(i._nodeDescription=o,this.langiumDocuments().hasDocument(o.documentUri)){let s=this.loadAstNode(o);i._ref=s??this.createLinkingError(e,o)}else i._ref=void 0}catch(o){console.error(`An error occurred while resolving reference to '${i.$refText}':`,o);let s=(n=o.message)!==null&&n!==void 0?n:String(o);i._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${i.$refText}': ${s}`})}r.references.push(i)}}unlink(e){for(let r of e.references)delete r._ref,delete r._nodeDescription;e.references=[]}getCandidate(e){let n=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return n??this.createLinkingError(e)}buildReference(e,r,n,i){let o=this,s={$refNode:n,$refText:i,get ref(){var a;if(Ge(this._ref))return this._ref;if(Fh(this._nodeDescription)){let c=o.loadAstNode(this._nodeDescription);this._ref=c??o.createLinkingError({reference:s,container:e,property:r},this._nodeDescription)}else if(this._ref===void 0){this._ref=qm;let c=Za(e).$document,u=o.getLinkedNode({reference:s,container:e,property:r});if(u.error&&c&&c.state<Le.ComputedScopes)return this._ref=void 0;this._ref=(a=u.node)!==null&&a!==void 0?a:u.error,this._nodeDescription=u.descr,c?.references.push(this)}else if(this._ref===qm)throw new Error(`Cyclic reference resolution detected: ${o.astNodeLocator.getAstNodePath(e)}/${r} (symbol '${i}')`);return Ge(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return Oi(this._ref)?this._ref:void 0}};return s}getLinkedNode(e){var r;try{let n=this.getCandidate(e);if(Oi(n))return{error:n};let i=this.loadAstNode(n);return i?{node:i,descr:n}:{descr:n,error:this.createLinkingError(e,n)}}catch(n){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,n);let i=(r=n.message)!==null&&r!==void 0?r:String(n);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${i}`})}}}loadAstNode(e){if(e.node)return e.node;let r=this.langiumDocuments().getDocument(e.documentUri);if(r)return this.astNodeLocator.getAstNode(r.parseResult.value,e.path)}createLinkingError(e,r){let n=Za(e.container).$document;n&&n.state<Le.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);let i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:r})}};function qd(t){return typeof t.name=="string"}var Vc=class{getName(e){if(qd(e))return e.name}getNameNode(e){return cc(e.$cstNode,"name")}};var Kc=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let r=Rp(e),n=e.astNode;if(r&&n){let i=n[r.feature];if(Ut(i))return i.ref;if(Array.isArray(i)){for(let o of i)if(Ut(o)&&o.$refNode&&o.$refNode.offset<=e.offset&&o.$refNode.end>=e.end)return o.ref}}if(n){let i=this.nameProvider.getNameNode(n);if(i&&(i===e||jh(e,i)))return n}}}findDeclarationNode(e){let r=this.findDeclaration(e);if(r?.$cstNode){let n=this.nameProvider.getNameNode(r);return n??r.$cstNode}}findReferences(e,r){let n=[];if(r.includeDeclaration){let o=this.getReferenceToSelf(e);o&&n.push(o)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return r.documentUri&&(i=i.filter(o=>ge.equals(o.sourceUri,r.documentUri))),n.push(...i),ce(n)}getReferenceToSelf(e){let r=this.nameProvider.getNameNode(e);if(r){let n=Rt(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:Mi(r),local:!0}}}};var Yr=class{constructor(e){if(this.map=new Map,e)for(let[r,n]of e)this.add(r,n)}get size(){return ko.sum(ce(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,r){if(r===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let i=n.indexOf(r);if(i>=0)return n.length===1?this.map.delete(e):n.splice(i,1),!0}return!1}}get(e){var r;return(r=this.map.get(e))!==null&&r!==void 0?r:[]}has(e,r){if(r===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(r)>=0:!1}}add(e,r){return this.map.has(e)?this.map.get(e).push(r):this.map.set(e,[r]),this}addAll(e,r){return this.map.has(e)?this.map.get(e).push(...r):this.map.set(e,Array.from(r)),this}forEach(e){this.map.forEach((r,n)=>r.forEach(i=>e(i,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return ce(this.map.entries()).flatMap(([e,r])=>r.map(n=>[e,n]))}keys(){return ce(this.map.keys())}values(){return ce(this.map.values()).flat()}entriesGroupedByKey(){return ce(this.map.entries())}},so=class{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[r,n]of e)this.set(r,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,r){return this.map.set(e,r),this.inverse.set(r,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let r=this.map.get(e);return r!==void 0?(this.map.delete(e),this.inverse.delete(r),!0):!1}};var Xc=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,r=J.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,r)}async computeExportsForNode(e,r,n=Ui,i=J.CancellationToken.None){let o=[];this.exportNode(e,o,r);for(let s of n(e))await ot(i),this.exportNode(s,o,r);return o}exportNode(e,r,n){let i=this.nameProvider.getName(e);i&&r.push(this.descriptions.createDescription(e,i,n))}async computeLocalScopes(e,r=J.CancellationToken.None){let n=e.parseResult.value,i=new Yr;for(let o of Cr(n))await ot(r),this.processNode(o,e,i);return i}processNode(e,r,n){let i=e.$container;if(i){let o=this.nameProvider.getName(e);o&&n.add(i,this.descriptions.createDescription(e,o,r))}}};var ha=class{constructor(e,r,n){var i;this.elements=e,this.outerScope=r,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let r=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===e.toLowerCase()):this.elements.find(n=>n.name===e);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}},Yc=class{constructor(e,r,n){var i;this.elements=new Map,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1;for(let o of e){let s=this.caseInsensitive?o.name.toLowerCase():o.name;this.elements.set(s,o)}this.outerScope=r}getElement(e){let r=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(r);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=ce(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},wF={getElement(){},getAllElements(){return Wa}};var pa=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 new Error("This cache has already been disposed")}},Jc=class extends pa{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,r){this.throwIfDisposed(),this.cache.set(e,r)}get(e,r){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(r){let n=r();return this.cache.set(e,n),n}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},ao=class extends pa{constructor(e){super(),this.cache=new Map,this.converter=e??(r=>r)}has(e,r){return this.throwIfDisposed(),this.cacheForContext(e).has(r)}set(e,r,n){this.throwIfDisposed(),this.cacheForContext(e).set(r,n)}get(e,r,n){this.throwIfDisposed();let i=this.cacheForContext(e);if(i.has(r))return i.get(r);if(n){let o=n();return i.set(r,o),o}else return}delete(e,r){return this.throwIfDisposed(),this.cacheForContext(e).delete(r)}clear(e){if(this.throwIfDisposed(),e){let r=this.converter(e);this.cache.delete(r)}else this.cache.clear()}cacheForContext(e){let r=this.converter(e),n=this.cache.get(r);return n||(n=new Map,this.cache.set(r,n)),n}},jd=class extends ao{constructor(e,r){super(n=>n.toString()),r?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(r,n=>{this.clear(n.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{for(let o of i)this.clear(o)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{let o=n.concat(i);for(let s of o)this.clear(s)}))}},ma=class extends Jc{constructor(e,r){super(),r?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(r,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}};var Qc=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 ma(e.shared)}getScope(e){let r=[],n=this.reflection.getReferenceType(e),i=Rt(e.container).precomputedScopes;if(i){let s=e.container;do{let a=i.get(s);a.length>0&&r.push(ce(a).filter(c=>this.reflection.isSubtype(c.type,n))),s=s.$container}while(s)}let o=this.getGlobalScope(n,e);for(let s=r.length-1;s>=0;s--)o=this.createScope(r[s],o);return o}createScope(e,r,n){return new ha(ce(e),r,n)}createScopeForNodes(e,r,n){let i=ce(e).map(o=>{let s=this.nameProvider.getName(o);if(s)return this.descriptions.createDescription(o,s)}).nonNullable();return new ha(i,r,n)}getGlobalScope(e,r){return this.globalScopeCache.get(e,()=>new Yc(this.indexManager.allElements(e)))}};function eu(t){return typeof t.$comment=="string"}function J_(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}var Zc=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,r){let n=r??{},i=r?.replacer,o=(a,c)=>this.replacer(a,c,n),s=i?(a,c)=>i(a,c,o):o;try{return this.currentDocument=Rt(e),JSON.stringify(e,s,r?.space)}finally{this.currentDocument=void 0}}deserialize(e,r){let n=r??{},i=JSON.parse(e);return this.linkNode(i,i,n),i}replacer(e,r,{refText:n,sourceText:i,textRegions:o,comments:s,uriConverter:a}){var c,u,l,h;if(!this.ignoreProperties.has(e))if(Ut(r)){let p=r.ref,y=n?r.$refText:void 0;if(p){let _=Rt(p),E="";this.currentDocument&&this.currentDocument!==_&&(a?E=a(_.uri,r):E=_.uri.toString());let D=this.astNodeLocator.getAstNodePath(p);return{$ref:`${E}#${D}`,$refText:y}}else return{$error:(u=(c=r.error)===null||c===void 0?void 0:c.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:y}}else if(Ge(r)){let p;if(o&&(p=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},r)),(!e||r.$document)&&p?.$textRegion&&(p.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(p??(p=Object.assign({},r)),p.$sourceText=(h=r.$cstNode)===null||h===void 0?void 0:h.text),s){p??(p=Object.assign({},r));let y=this.commentProvider.getComment(r);y&&(p.$comment=y.replace(/\r/g,""))}return p??r}else return r}addAstNodeRegionWithAssignmentsTo(e){let r=n=>({offset:n.offset,end:n.end,length:n.length,range:n.range});if(e.$cstNode){let n=e.$textRegion=r(e.$cstNode),i=n.assignments={};return Object.keys(e).filter(o=>!o.startsWith("$")).forEach(o=>{let s=yp(e.$cstNode,o).map(r);s.length!==0&&(i[o]=s)}),e}}linkNode(e,r,n,i,o,s){for(let[c,u]of Object.entries(e))if(Array.isArray(u))for(let l=0;l<u.length;l++){let h=u[l];J_(h)?u[l]=this.reviveReference(e,c,r,h,n):Ge(h)&&this.linkNode(h,r,n,e,c,l)}else J_(u)?e[c]=this.reviveReference(e,c,r,u,n):Ge(u)&&this.linkNode(u,r,n,e,c);let a=e;a.$container=i,a.$containerProperty=o,a.$containerIndex=s}reviveReference(e,r,n,i,o){let s=i.$refText,a=i.$error;if(i.$ref){let c=this.getRefNode(n,i.$ref,o.uriConverter);if(Ge(c))return s||(s=this.nameProvider.getName(c)),{$refText:s??"",ref:c};a=c}if(a){let c={$refText:s??""};return c.error={container:e,property:r,message:a,reference:c},c}else return}getRefNode(e,r,n){try{let i=r.indexOf("#");if(i===0){let c=this.astNodeLocator.getAstNode(e,r.substring(1));return c||"Could not resolve path: "+r}if(i<0){let c=n?n(r):vt.parse(r),u=this.langiumDocuments.getDocument(c);return u?u.parseResult.value:"Could not find document for URI: "+r}let o=n?n(r.substring(0,i)):vt.parse(r.substring(0,i)),s=this.langiumDocuments.getDocument(o);if(!s)return"Could not find document for URI: "+r;if(i===r.length-1)return s.parseResult.value;let a=this.astNodeLocator.getAstNode(s.parseResult.value,r.substring(i+1));return a||"Could not resolve URI: "+r}catch(i){return String(i)}}};var tu=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 r=e.LanguageMetaData;for(let n of r.fileExtensions)this.fileExtensionMap.has(n)&&console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${r.languageId}'.`),this.fileExtensionMap.set(n,e);if(r.fileNames)for(let n of r.fileNames)this.fileNameMap.has(n)&&console.warn(`The file name ${n} is used by multiple languages. It is now assigned to '${r.languageId}'.`),this.fileNameMap.set(n,e);this.languageIdMap.set(r.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){var r,n,i;if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let o=(n=(r=this.textDocuments)===null||r===void 0?void 0:r.get(e))===null||n===void 0?void 0:n.languageId;if(o!==void 0){let u=this.languageIdMap.get(o);if(u)return u}let s=ge.extname(e),a=ge.basename(e),c=(i=this.fileNameMap.get(a))!==null&&i!==void 0?i:this.fileExtensionMap.get(s);if(!c)throw o?new Error(`The service registry contains no services for the extension '${s}' for language '${o}'.`):new Error(`The service registry contains no services for the extension '${s}'.`);return c}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}};function co(t){return{code:t}}var ga;(function(t){t.all=["fast","slow","built-in"]})(ga||(ga={}));var ru=class{constructor(e){this.entries=new Yr,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,r=this,n="fast"){if(n==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(let[i,o]of Object.entries(e)){let s=o;if(Array.isArray(s))for(let a of s){let c={check:this.wrapValidationException(a,r),category:n};this.addEntry(i,c)}else if(typeof s=="function"){let a={check:this.wrapValidationException(s,r),category:n};this.addEntry(i,a)}else on(s)}}wrapValidationException(e,r){return async(n,i,o)=>{await this.handleException(()=>e.call(r,n,i,o),"An error occurred during validation",i,n)}}async handleException(e,r,n,i){try{await e()}catch(o){if(bn(o))throw o;console.error(`${r}:`,o),o instanceof Error&&o.stack&&console.error(o.stack);let s=o instanceof Error?o.message:String(o);n("error",`${r}: ${s}`,{node:i})}}addEntry(e,r){if(e==="AstNode"){this.entries.add("AstNode",r);return}for(let n of this.reflection.getAllSubTypes(e))this.entries.add(n,r)}getChecks(e,r){let n=ce(this.entries.get(e)).concat(this.entries.get("AstNode"));return r&&(n=n.filter(i=>r.includes(i.category))),n.map(i=>i.check)}registerBeforeDocument(e,r=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",r))}registerAfterDocument(e,r=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",r))}wrapPreparationException(e,r,n){return async(i,o,s,a)=>{await this.handleException(()=>e.call(n,i,o,s,a),r,o,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}};var uo=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,r={},n=J.CancellationToken.None){let i=e.parseResult,o=[];if(await ot(n),(!r.categories||r.categories.includes("built-in"))&&(this.processLexingErrors(i,o,r),r.stopAfterLexingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===Lr.LexingError})||(this.processParsingErrors(i,o,r),r.stopAfterParsingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===Lr.ParsingError}))||(this.processLinkingErrors(e,o,r),r.stopAfterLinkingErrors&&o.some(s=>{var a;return((a=s.data)===null||a===void 0?void 0:a.code)===Lr.LinkingError}))))return o;try{o.push(...await this.validateAst(i.value,r,n))}catch(s){if(bn(s))throw s;console.error("An error occurred during validation:",s)}return await ot(n),o}processLexingErrors(e,r,n){var i,o,s;let a=[...e.lexerErrors,...(o=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&o!==void 0?o:[]];for(let c of a){let u=(s=c.severity)!==null&&s!==void 0?s:"error",l={severity:Ud(u),range:{start:{line:c.line-1,character:c.column-1},end:{line:c.line-1,character:c.column+c.length-1}},message:c.message,data:Z_(u),source:this.getSource()};r.push(l)}}processParsingErrors(e,r,n){for(let i of e.parserErrors){let o;if(isNaN(i.token.startOffset)){if("previousToken"in i){let s=i.previousToken;if(isNaN(s.startOffset)){let a={line:0,character:0};o={start:a,end:a}}else{let a={line:s.endLine-1,character:s.endColumn};o={start:a,end:a}}}}else o=Eo(i.token);if(o){let s={severity:Ud("error"),range:o,message:i.message,data:co(Lr.ParsingError),source:this.getSource()};r.push(s)}}}processLinkingErrors(e,r,n){for(let i of e.references){let o=i.error;if(o){let s={node:o.container,property:o.property,index:o.index,data:{code:Lr.LinkingError,containerType:o.container.$type,property:o.property,refText:o.reference.$refText}};r.push(this.toDiagnostic("error",o.message,s))}}}async validateAst(e,r,n=J.CancellationToken.None){let i=[],o=(s,a,c)=>{i.push(this.toDiagnostic(s,a,c))};return await this.validateAstBefore(e,r,o,n),await this.validateAstNodes(e,r,o,n),await this.validateAstAfter(e,r,o,n),i}async validateAstBefore(e,r,n,i=J.CancellationToken.None){var o;let s=this.validationRegistry.checksBefore;for(let a of s)await ot(i),await a(e,n,(o=r.categories)!==null&&o!==void 0?o:[],i)}async validateAstNodes(e,r,n,i=J.CancellationToken.None){await Promise.all(Ir(e).map(async o=>{await ot(i);let s=this.validationRegistry.getChecks(o.$type,r.categories);for(let a of s)await a(o,n,i)}))}async validateAstAfter(e,r,n,i=J.CancellationToken.None){var o;let s=this.validationRegistry.checksAfter;for(let a of s)await ot(i),await a(e,n,(o=r.categories)!==null&&o!==void 0?o:[],i)}toDiagnostic(e,r,n){return{message:r,range:Q_(n),severity:Ud(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 Q_(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=cc(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=xp(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Ud(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}function Z_(t){switch(t){case"error":return co(Lr.LexingError);case"warning":return co(Lr.LexingWarning);case"info":return co(Lr.LexingInfo);case"hint":return co(Lr.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var Lr;(function(t){t.LexingError="lexing-error",t.LexingWarning="lexing-warning",t.LexingInfo="lexing-info",t.LexingHint="lexing-hint",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(Lr||(Lr={}));var nu=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,r,n){let i=n??Rt(e);r??(r=this.nameProvider.getName(e));let o=this.astNodeLocator.getAstNodePath(e);if(!r)throw new Error(`Node at path ${o} has no name.`);let s,a=()=>{var c;return s??(s=Mi((c=this.nameProvider.getNameNode(e))!==null&&c!==void 0?c:e.$cstNode))};return{node:e,name:r,get nameSegment(){return a()},selectionSegment:Mi(e.$cstNode),type:e.$type,documentUri:i.uri,path:o}}},iu=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,r=J.CancellationToken.None){let n=[],i=e.parseResult.value;for(let o of Ir(i))await ot(r),ms(o).filter(s=>!Oi(s)).forEach(s=>{let a=this.createDescription(s);a&&n.push(a)});return n}createDescription(e){let r=e.reference.$nodeDescription,n=e.reference.$refNode;if(!r||!n)return;let i=Rt(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:r.documentUri,targetPath:r.path,segment:Mi(n),local:ge.equals(r.documentUri,i)}}};var ou=class{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let r=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return r+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:r}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return r!==void 0?e+this.indexSeparator+r:e}getAstNode(e,r){return r.split(this.segmentSeparator).reduce((i,o)=>{if(!i||o.length===0)return i;let s=o.indexOf(this.indexSeparator);if(s>0){let a=o.substring(0,s),c=parseInt(o.substring(s+1)),u=i[a];return u?.[c]}return i[o]},e)}};var Ve={};ve(Ve,Nr(oo(),1));var su=class{constructor(e){this._ready=new sr,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new Ve.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var r,n;this.workspaceConfig=(n=(r=e.capabilities.workspace)===null||r===void 0?void 0:r.configuration)!==null&&n!==void 0?n:!1}async initialized(e){if(this.workspaceConfig){if(e.register){let r=this.serviceRegistry.all;e.register({section:r.map(n=>this.toSectionName(n.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let r=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await e.fetchConfiguration(r);r.forEach((i,o)=>{this.updateSectionConfiguration(i.section,n[o])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(r=>{let n=e.settings[r];this.updateSectionConfiguration(r,n),this.onConfigurationSectionUpdateEmitter.fire({section:r,configuration:n})})}updateSectionConfiguration(e,r){this.settings[e]=r}async getConfiguration(e,r){await this.ready;let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][r]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}};var xi;(function(t){function e(r){return{dispose:async()=>await r()}}t.create=e})(xi||(xi={}));var au=class{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Yr,this.documentPhaseListeners=new Yr,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=Le.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,r={},n=J.CancellationToken.None){var i,o;for(let s of e){let a=s.uri.toString();if(s.state===Le.Validated){if(typeof r.validation=="boolean"&&r.validation)s.state=Le.IndexedReferences,s.diagnostics=void 0,this.buildState.delete(a);else if(typeof r.validation=="object"){let c=this.buildState.get(a),u=(i=c?.result)===null||i===void 0?void 0:i.validationChecks;if(u){let h=((o=r.validation.categories)!==null&&o!==void 0?o:ga.all).filter(p=>!u.includes(p));h.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},r.validation),{categories:h})},result:c.result}),s.state=Le.IndexedReferences)}}}else this.buildState.delete(a)}this.currentState=Le.Changed,await this.emitUpdate(e.map(s=>s.uri),[]),await this.buildDocuments(e,r,n)}async update(e,r,n=J.CancellationToken.None){this.currentState=Le.Changed;for(let s of r)this.langiumDocuments.deleteDocument(s),this.buildState.delete(s.toString()),this.indexManager.remove(s);for(let s of e){if(!this.langiumDocuments.invalidateDocument(s)){let c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},s);c.state=Le.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(s.toString())}let i=ce(e).concat(r).map(s=>s.toString()).toSet();this.langiumDocuments.all.filter(s=>!i.has(s.uri.toString())&&this.shouldRelink(s,i)).forEach(s=>{this.serviceRegistry.getServices(s.uri).references.Linker.unlink(s),s.state=Math.min(s.state,Le.ComputedScopes),s.diagnostics=void 0}),await this.emitUpdate(e,r),await ot(n);let o=this.sortDocuments(this.langiumDocuments.all.filter(s=>{var a;return s.state<Le.Linked||!(!((a=this.buildState.get(s.uri.toString()))===null||a===void 0)&&a.completed)}).toArray());await this.buildDocuments(o,this.updateBuildOptions,n)}async emitUpdate(e,r){await Promise.all(this.updateListeners.map(n=>n(e,r)))}sortDocuments(e){let r=0,n=e.length-1;for(;r<n;){for(;r<e.length&&this.hasTextDocument(e[r]);)r++;for(;n>=0&&!this.hasTextDocument(e[n]);)n--;r<n&&([e[r],e[n]]=[e[n],e[r]])}return e}hasTextDocument(e){var r;return!!(!((r=this.textDocuments)===null||r===void 0)&&r.get(e.uri))}shouldRelink(e,r){return e.references.some(n=>n.error!==void 0)?!0:this.indexManager.isAffected(e,r)}onUpdate(e){return this.updateListeners.push(e),xi.create(()=>{let r=this.updateListeners.indexOf(e);r>=0&&this.updateListeners.splice(r,1)})}async buildDocuments(e,r,n){this.prepareBuild(e,r),await this.runCancelable(e,Le.Parsed,n,s=>this.langiumDocumentFactory.update(s,n)),await this.runCancelable(e,Le.IndexedContent,n,s=>this.indexManager.updateContent(s,n)),await this.runCancelable(e,Le.ComputedScopes,n,async s=>{let a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await a.computeLocalScopes(s,n)});let i=e.filter(s=>this.shouldLink(s));await this.runCancelable(i,Le.Linked,n,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,n)),await this.runCancelable(i,Le.IndexedReferences,n,s=>this.indexManager.updateReferences(s,n));let o=e.filter(s=>this.shouldValidate(s));await this.runCancelable(o,Le.Validated,n,s=>this.validate(s,n));for(let s of e){let a=this.buildState.get(s.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,r){for(let n of e){let i=n.uri.toString(),o=this.buildState.get(i);(!o||o.completed)&&this.buildState.set(i,{completed:!1,options:r,result:o?.result})}}async runCancelable(e,r,n,i){let o=e.filter(a=>a.state<r);for(let a of o)await ot(n),await i(a),a.state=r,await this.notifyDocumentPhase(a,r,n);let s=e.filter(a=>a.state===r);await this.notifyBuildPhase(s,r,n),this.currentState=r}onBuildPhase(e,r){return this.buildPhaseListeners.add(e,r),xi.create(()=>{this.buildPhaseListeners.delete(e,r)})}onDocumentPhase(e,r){return this.documentPhaseListeners.add(e,r),xi.create(()=>{this.documentPhaseListeners.delete(e,r)})}waitUntil(e,r,n){let i;if(r&&"path"in r?i=r:n=r,n??(n=J.CancellationToken.None),i){let o=this.langiumDocuments.getDocument(i);if(o&&o.state>=e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Rn):new Promise((o,s)=>{let a=this.onBuildPhase(e,()=>{if(a.dispose(),c.dispose(),i){let u=this.langiumDocuments.getDocument(i);o(u?.uri)}else o(void 0)}),c=n.onCancellationRequested(()=>{a.dispose(),c.dispose(),s(Rn)})})}async notifyDocumentPhase(e,r,n){let o=this.documentPhaseListeners.get(r).slice();for(let s of o)try{await s(e,n)}catch(a){if(!bn(a))throw a}}async notifyBuildPhase(e,r,n){if(e.length===0)return;let o=this.buildPhaseListeners.get(r).slice();for(let s of o)await ot(n),await s(e,n)}shouldLink(e){var r;return(r=this.getBuildOptions(e).eagerLinking)!==null&&r!==void 0?r:!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,r){var n,i;let o=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,s=this.getBuildOptions(e).validation,a=typeof s=="object"?s:void 0,c=await o.validateDocument(e,a,r);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;let u=this.buildState.get(e.uri.toString());if(u){(n=u.result)!==null&&n!==void 0||(u.result={});let l=(i=a?.categories)!==null&&i!==void 0?i:ga.all;u.result.validationChecks?u.result.validationChecks.push(...l):u.result.validationChecks=[...l]}}getBuildOptions(e){var r,n;return(n=(r=this.buildState.get(e.uri.toString()))===null||r===void 0?void 0:r.options)!==null&&n!==void 0?n:{}}};var cu=class{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new ao,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,r){let n=Rt(e).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(s=>{ge.equals(s.targetUri,n)&&s.targetPath===r&&i.push(s)})}),ce(i)}allElements(e,r){let n=ce(this.symbolIndex.keys());return r&&(n=n.filter(i=>!r||r.has(i))),n.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,r){var n;return r?this.symbolByTypeIndex.get(e,r,()=>{var o;return((o=this.symbolIndex.get(e))!==null&&o!==void 0?o:[]).filter(a=>this.astReflection.isSubtype(a.type,r))}):(n=this.symbolIndex.get(e))!==null&&n!==void 0?n:[]}remove(e){let r=e.toString();this.symbolIndex.delete(r),this.symbolByTypeIndex.clear(r),this.referenceIndex.delete(r)}async updateContent(e,r=J.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,r),o=e.uri.toString();this.symbolIndex.set(o,i),this.symbolByTypeIndex.clear(o)}async updateReferences(e,r=J.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,r);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,r){let n=this.referenceIndex.get(e.uri.toString());return n?n.some(i=>!i.local&&r.has(i.targetUri.toString())):!1}};var uu=class{constructor(e){this.initialBuildOptions={},this._ready=new sr,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){var r;this.folders=(r=e.workspaceFolders)!==null&&r!==void 0?r:void 0}initialized(e){return this.mutex.write(r=>{var n;return this.initializeWorkspace((n=this.folders)!==null&&n!==void 0?n:[],r)})}async initializeWorkspace(e,r=J.CancellationToken.None){let n=await this.performStartup(e);await ot(r),await this.documentBuilder.build(n,this.initialBuildOptions,r)}async performStartup(e){let r=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),n=this.serviceRegistry.all.flatMap(s=>{var a;return(a=s.LanguageMetaData.fileNames)!==null&&a!==void 0?a:[]}),i=[],o=s=>{i.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,o),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,{fileExtensions:r,fileNames:n},o))),this._ready.resolve(),i}loadAdditionalDocuments(e,r){return Promise.resolve()}getRootFolder(e){return vt.parse(e.uri)}async traverseFolder(e,r,n,i){let o=await this.fileSystemProvider.readDirectory(r);await Promise.all(o.map(async s=>{if(this.includeEntry(e,s,n)){if(s.isDirectory)await this.traverseFolder(e,s.uri,n,i);else if(s.isFile){let a=await this.langiumDocuments.getOrCreateDocument(s.uri);i(a)}}}))}includeEntry(e,r,n){let i=ge.basename(r.uri);return i.startsWith(".")?!1:r.isDirectory?i!=="node_modules"&&i!=="out":r.isFile?n.fileExtensions.includes(ge.extname(r.uri))||n.fileNames.includes(ge.basename(r.uri)):!1}};var lu=class{buildUnexpectedCharactersMessage(e,r,n,i,o){return Vs.buildUnexpectedCharactersMessage(e,r,n,i,o)}buildUnableToPopLexerModeMessage(e){return Vs.buildUnableToPopLexerModeMessage(e)}},Wd={mode:"full"},lo=class{constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;let r=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(r);let n=jm(r)?Object.values(r):r,i=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new Ze(n,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,r=Wd){var n,i,o;let s=this.chevrotainLexer.tokenize(e);return{tokens:s.tokens,errors:s.errors,hidden:(n=s.groups.hidden)!==null&&n!==void 0?n:[],report:(o=(i=this.tokenBuilder).flushLexingReport)===null||o===void 0?void 0:o.call(i,e)}}toTokenTypeDictionary(e){if(jm(e))return e;let r=Um(e)?Object.values(e.modes).flat():e,n={};return r.forEach(i=>n[i.name]=i),n}};function Bd(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function Um(t){return t&&"modes"in t&&"defaultMode"in t}function jm(t){return!Bd(t)&&!Um(t)}function hu(t,e,r){let n,i;typeof t=="string"?(i=e,n=r):(i=t.range.start,n=e),i||(i=Te.create(0,0));let o=rC(t),s=Hm(n),a=PF({lines:o,position:i,options:s});return MF({index:0,tokens:a,position:i})}function pu(t,e){let r=Hm(e),n=rC(t);if(n.length===0)return!1;let i=n[0],o=n[n.length-1],s=r.start,a=r.end;return!!s?.exec(i)&&!!a?.exec(o)}function rC(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(dp)}var eC=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,NF=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function PF(t){var e,r,n;let i=[],o=t.position.line,s=t.position.character;for(let a=0;a<t.lines.length;a++){let c=a===0,u=a===t.lines.length-1,l=t.lines[a],h=0;if(c&&t.options.start){let y=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);y&&(h=y.index+y[0].length)}else{let y=(r=t.options.line)===null||r===void 0?void 0:r.exec(l);y&&(h=y.index+y[0].length)}if(u){let y=(n=t.options.end)===null||n===void 0?void 0:n.exec(l);y&&(l=l.substring(0,y.index))}if(l=l.substring(0,LF(l)),Bm(l,h)>=l.length){if(i.length>0){let y=Te.create(o,s);i.push({type:"break",content:"",range:me.create(y,y)})}}else{eC.lastIndex=h;let y=eC.exec(l);if(y){let _=y[0],E=y[1],D=Te.create(o,s+h),w=Te.create(o,s+h+_.length);i.push({type:"tag",content:E,range:me.create(D,w)}),h+=_.length,h=Bm(l,h)}if(h<l.length){let _=l.substring(h),E=Array.from(_.matchAll(NF));i.push(...IF(E,_,o,s+h))}}o++,s=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function IF(t,e,r,n){let i=[];if(t.length===0){let o=Te.create(r,n),s=Te.create(r,n+e.length);i.push({type:"text",content:e,range:me.create(o,s)})}else{let o=0;for(let a of t){let c=a.index,u=e.substring(o,c);u.length>0&&i.push({type:"text",content:e.substring(o,c),range:me.create(Te.create(r,o+n),Te.create(r,c+n))});let l=u.length+1,h=a[1];if(i.push({type:"inline-tag",content:h,range:me.create(Te.create(r,o+l+n),Te.create(r,o+l+h.length+n))}),l+=h.length,a.length===4){l+=a[2].length;let p=a[3];i.push({type:"text",content:p,range:me.create(Te.create(r,o+l+n),Te.create(r,o+l+p.length+n))})}else i.push({type:"text",content:"",range:me.create(Te.create(r,o+l+n),Te.create(r,o+l+n))});o=c+a[0].length}let s=e.substring(o);s.length>0&&i.push({type:"text",content:s,range:me.create(Te.create(r,o+n),Te.create(r,o+n+s.length))})}return i}var DF=/\S/,OF=/\s*$/;function Bm(t,e){let r=t.substring(e).match(DF);return r?e+r.index:t.length}function LF(t){let e=t.match(OF);if(e&&typeof e.index=="number")return e.index}function MF(t){var e,r,n,i;let o=Te.create(t.position.line,t.position.character);if(t.tokens.length===0)return new Hd([],me.create(o,o));let s=[];for(;t.index<t.tokens.length;){let u=FF(t,s[s.length-1]);u&&s.push(u)}let a=(r=(e=s[0])===null||e===void 0?void 0:e.range.start)!==null&&r!==void 0?r:o,c=(i=(n=s[s.length-1])===null||n===void 0?void 0:n.range.end)!==null&&i!==void 0?i:o;return new Hd(s,me.create(a,c))}function FF(t,e){let r=t.tokens[t.index];if(r.type==="tag")return iC(t,!1);if(r.type==="text"||r.type==="inline-tag")return nC(t);$F(r,e),t.index++}function $F(t,e){if(e){let r=new Gd("",t.range);"inlines"in e?e.inlines.push(r):e.content.inlines.push(r)}}function nC(t){let e=t.tokens[t.index],r=e,n=e,i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(qF(t)),n=e,e=t.tokens[t.index];return new fu(i,me.create(r.range.start,n.range.end))}function qF(t){return t.tokens[t.index].type==="inline-tag"?iC(t,!0):oC(t)}function iC(t,e){let r=t.tokens[t.index++],n=r.content.substring(1),i=t.tokens[t.index];if(i?.type==="text")if(e){let o=oC(t);return new du(n,new fu([o],o.range),e,me.create(r.range.start,o.range.end))}else{let o=nC(t);return new du(n,o,e,me.create(r.range.start,o.range.end))}else{let o=r.range;return new du(n,new fu([],o),e,o)}}function oC(t){let e=t.tokens[t.index++];return new Gd(e.content,e.range)}function Hm(t){if(!t)return Hm({start:"/**",end:"*/",line:"*"});let{start:e,end:r,line:n}=t;return{start:Wm(e,!0),end:Wm(r,!1),line:Wm(n,!0)}}function Wm(t,e){if(typeof t=="string"||typeof t=="object"){let r=typeof t=="string"?Yn(t):t.source;return e?new RegExp(`^\\s*${r}`):new RegExp(`\\s*${r}\\s*$`)}else return t}var Hd=class{constructor(e,r){this.elements=e,this.range=r}getTag(e){return this.getAllTags().find(r=>r.name===e)}getTags(e){return this.getAllTags().filter(r=>r.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(let r of this.elements)if(e.length===0)e=r.toString();else{let n=r.toString();e+=tC(e)+n}return e.trim()}toMarkdown(e){let r="";for(let n of this.elements)if(r.length===0)r=n.toMarkdown(e);else{let i=n.toMarkdown(e);r+=tC(r)+i}return r.trim()}},du=class{constructor(e,r,n,i){this.name=e,this.content=r,this.inline=n,this.range=i}toString(){let e=`@${this.name}`,r=this.content.toString();return this.content.inlines.length===1?e=`${e} ${r}`:this.content.inlines.length>1&&(e=`${e}
153
+ ${r}`),this.inline?`{${e}}`:e}toMarkdown(e){var r,n;return(n=(r=e?.renderTag)===null||r===void 0?void 0:r.call(e,this))!==null&&n!==void 0?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){let r=this.content.toMarkdown(e);if(this.inline){let o=jF(this.name,r,e??{});if(typeof o=="string")return o}let n="";e?.tag==="italic"||e?.tag===void 0?n="*":e?.tag==="bold"?n="**":e?.tag==="bold-italic"&&(n="***");let i=`${n}@${this.name}${n}`;return this.content.inlines.length===1?i=`${i} \u2014 ${r}`:this.content.inlines.length>1&&(i=`${i}
154
+ ${r}`),this.inline?`{${i}}`:i}};function jF(t,e,r){var n,i;if(t==="linkplain"||t==="linkcode"||t==="link"){let o=e.indexOf(" "),s=e;if(o>0){let c=Bm(e,o);s=e.substring(c),e=e.substring(0,o)}return(t==="linkcode"||t==="link"&&r.link==="code")&&(s=`\`${s}\``),(i=(n=r.renderLink)===null||n===void 0?void 0:n.call(r,e,s))!==null&&i!==void 0?i:UF(e,s)}}function UF(t,e){try{return vt.parse(t,!0),`[${e}](${t})`}catch{return t}}var fu=class{constructor(e,r){this.inlines=e,this.range=r}toString(){let e="";for(let r=0;r<this.inlines.length;r++){let n=this.inlines[r],i=this.inlines[r+1];e+=n.toString(),i&&i.range.start.line>n.range.start.line&&(e+=`
155
155
  `)}return e}toMarkdown(e){let r="";for(let n=0;n<this.inlines.length;n++){let i=this.inlines[n],o=this.inlines[n+1];r+=i.toMarkdown(e),o&&o.range.start.line>i.range.start.line&&(r+=`
156
156
  `)}return r}},Gd=class{constructor(e,r){this.text=e,this.range=r}toString(){return this.text}toMarkdown(){return this.text}};function tC(t){return t.endsWith(`
157
157
  `)?`
158
158
  `:`
159
159
 
160
160
  `}var mu=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let r=this.commentProvider.getComment(e);if(r&&pu(r))return hu(r).toMarkdown({renderLink:(i,o)=>this.documentationLinkRenderer(e,i,o),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,r,n){var i;let o=(i=this.findNameInPrecomputedScopes(e,r))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,r);if(o&&o.nameSegment){let s=o.nameSegment.range.start.line+1,a=o.nameSegment.range.start.character+1,c=o.documentUri.with({fragment:`L${s},${a}`});return`[${n}](${c.toString()})`}else return}documentationTagRenderer(e,r){}findNameInPrecomputedScopes(e,r){let i=Rt(e).precomputedScopes;if(!i)return;let o=e;do{let a=i.get(o).find(c=>c.name===r);if(a)return a;o=o.$container}while(o)}findNameInGlobalScope(e,r){return this.indexManager.allElements().find(i=>i.name===r)}};var gu=class{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var r;return eu(e)?e.$comment:(r=Ba(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||r===void 0?void 0:r.text}};var yu=class{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,r){return Promise.resolve(this.syncParser.parse(e))}},Gm=class{constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length<this.threadCount;){let e=this.createWorker();e.onReady(()=>{if(this.queue.length>0){let r=this.queue.shift();r&&(e.lock(),r.resolve(e))}}),this.workerPool.push(e)}}async parse(e,r){let n=await this.acquireParserWorker(r),i=new sr,o,s=r.onCancellationRequested(()=>{o=setTimeout(()=>{this.terminateWorker(n)},this.terminationDelay)});return n.parse(e).then(a=>{let c=this.hydrator.hydrate(a);i.resolve(c)}).catch(a=>{i.reject(a)}).finally(()=>{s.dispose(),clearTimeout(o)}),i.promise}terminateWorker(e){e.terminate();let r=this.workerPool.indexOf(e);r>=0&&this.workerPool.splice(r,1)}async acquireParserWorker(e){this.initializeWorkers();for(let n of this.workerPool)if(n.ready)return n.lock(),n;let r=new sr;return e.onCancellationRequested(()=>{let n=this.queue.indexOf(r);n>=0&&this.queue.splice(n,1),r.reject(Rn)}),this.queue.push(r),r.promise}},zm=class{get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,r,n,i){this.onReadyEmitter=new Ve.Emitter,this.deferred=new sr,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=i,r(o=>{let s=o;this.deferred.resolve(s),this.unlock()}),n(o=>{this.deferred.reject(o),this.unlock()})}terminate(){this.deferred.reject(Rn),this._terminate()}lock(){this._ready=!1}unlock(){this._parsing=!1,this._ready=!0,this.onReadyEmitter.fire()}parse(e){if(this._parsing)throw new Error("Parser worker is busy");return this._parsing=!0,this.deferred=new sr,this.sendMessage(e),this.deferred.promise}};var vu=class{constructor(){this.previousTokenSource=new J.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let r=Fd();return this.previousTokenSource=r,this.enqueue(this.writeQueue,e,r.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,r,n=J.CancellationToken.None){let i=new sr,o={action:r,deferred:i,cancellationToken:n};return e.push(o),this.performNextOperation(),i.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:r,deferred:n,cancellationToken:i})=>{try{let o=await Promise.resolve().then(()=>r(i));n.resolve(o)}catch(o){bn(o)?n.resolve(void 0):n.reject(o)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}};var xu=class{constructor(e){this.grammarElementIdMap=new so,this.tokenTypeIdMap=new so,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(r=>Object.assign(Object.assign({},r),{message:r.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){let r=new Map,n=new Map;for(let i of Ir(e))r.set(i,{});if(e.$cstNode)for(let i of Li(e.$cstNode))n.set(i,{});return{astNodes:r,cstNodes:n}}dehydrateAstNode(e,r){let n=r.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,r));for(let[i,o]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];n[i]=s;for(let a of o)Ge(a)?s.push(this.dehydrateAstNode(a,r)):Ut(a)?s.push(this.dehydrateReference(a,r)):s.push(a)}else Ge(o)?n[i]=this.dehydrateAstNode(o,r):Ut(o)?n[i]=this.dehydrateReference(o,r):o!==void 0&&(n[i]=o);return n}dehydrateReference(e,r){let n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=r.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,r){let n=r.cstNodes.get(e);return Ua(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=r.astNodes.get(e.astNode),zr(e)?n.content=e.content.map(i=>this.dehydrateCstNode(i,r)):Xn(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 r=e.value,n=this.createHydrationContext(r);return"$cstNode"in r&&this.hydrateCstNode(r.$cstNode,n),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(r,n)}}createHydrationContext(e){let r=new Map,n=new Map;for(let o of Ir(e))r.set(o,{});let i;if(e.$cstNode)for(let o of Li(e.$cstNode)){let s;"fullText"in o?(s=new aa(o.fullText),i=s):"content"in o?s=new ro:"tokenType"in o&&(s=this.hydrateCstLeafNode(o)),s&&(n.set(o,s),s.root=i)}return{astNodes:r,cstNodes:n}}hydrateAstNode(e,r){let n=r.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode&&(n.$cstNode=r.cstNodes.get(e.$cstNode));for(let[i,o]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];n[i]=s;for(let a of o)Ge(a)?s.push(this.setParent(this.hydrateAstNode(a,r),n)):Ut(a)?s.push(this.hydrateReference(a,n,i,r)):s.push(a)}else Ge(o)?n[i]=this.setParent(this.hydrateAstNode(o,r),n):Ut(o)?n[i]=this.hydrateReference(o,n,i,r):o!==void 0&&(n[i]=o);return n}setParent(e,r){return e.$container=r,e}hydrateReference(e,r,n,i){return this.linker.buildReference(r,n,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,r,n=0){let i=r.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=r.astNodes.get(e.astNode),zr(i))for(let o of e.content){let s=this.hydrateCstNode(o,r,n++);i.content.push(s)}return i}hydrateCstLeafNode(e){let r=this.getTokenType(e.tokenType),n=e.offset,i=e.length,o=e.startLine,s=e.startColumn,a=e.endLine,c=e.endColumn,u=e.hidden;return new to(n,i,{start:{line:o,character:s},end:{line:a,character:c}},r,u)}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 r of Ir(this.grammar))qi(r)&&this.grammarElementIdMap.set(r,e++)}};function Tu(t){return{documentation:{CommentProvider:e=>new gu(e),DocumentationProvider:e=>new mu(e)},parser:{AsyncParser:e=>new yu(e),GrammarConfig:e=>Sp(e),LangiumParser:e=>Nm(e),CompletionParser:e=>wm(e),ValueConverter:()=>new Wc,TokenBuilder:()=>new io,Lexer:e=>new lo(e),ParserErrorMessageProvider:()=>new ca,LexerErrorMessageProvider:()=>new lu},workspace:{AstNodeLocator:()=>new ou,AstNodeDescriptionProvider:e=>new nu(e),ReferenceDescriptionProvider:e=>new iu(e)},references:{Linker:e=>new zc(e),NameProvider:()=>new Vc,ScopeProvider:e=>new Qc(e),ScopeComputation:e=>new Xc(e),References:e=>new Kc(e)},serializer:{Hydrator:e=>new xu(e),JsonSerializer:e=>new Zc(e)},validation:{DocumentValidator:e=>new uo(e),ValidationRegistry:e=>new ru(e)},shared:()=>t.shared}}function Ru(t){return{ServiceRegistry:e=>new tu(e),workspace:{LangiumDocuments:e=>new Gc(e),LangiumDocumentFactory:e=>new Hc(e),DocumentBuilder:e=>new au(e),IndexManager:e=>new cu(e),WorkspaceManager:e=>new uu(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new vu,ConfigurationProvider:e=>new su(e)}}}var ya;(function(t){t.merge=(e,r)=>zd(zd({},e),r)})(ya||(ya={}));function fo(t,e,r,n,i,o,s,a,c){let u=[t,e,r,n,i,o,s,a,c].reduce(zd,{});return uC(u)}var cC=Symbol("isProxy");function bu(t){if(t&&t[cC])for(let e of Object.values(t))bu(e);return t}function uC(t,e){let r=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(n,i)=>i===cC?!0:aC(n,i,t,e||r),getOwnPropertyDescriptor:(n,i)=>(aC(n,i,t,e||r),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return r}var sC=Symbol();function aC(t,e,r,n){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===sC)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in r){let i=r[e];t[e]=sC;try{t[e]=typeof i=="function"?i(n):uC(i,n)}catch(o){throw t[e]=o instanceof Error?o:void 0,o}return t[e]}else return}function zd(t,e){if(e){for(let[r,n]of Object.entries(e))if(n!==void 0){let i=t[r];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?t[r]=zd(i,n):t[r]=n}}return t}var Vm={indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[]},ho;(function(t){t.REGULAR="indentation-sensitive",t.IGNORE_INDENTATION="ignore-indentation"})(ho||(ho={}));var Vd=class extends io{constructor(e=Vm){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options=Object.assign(Object.assign({},Vm),e),this.indentTokenType=fi({name:this.options.indentTokenName,pattern:this.indentMatcher.bind(this),line_breaks:!1}),this.dedentTokenType=fi({name:this.options.dedentTokenName,pattern:this.dedentMatcher.bind(this),line_breaks:!1})}buildTokens(e,r){let n=super.buildTokens(e,r);if(!Bd(n))throw new Error("Invalid tokens built by default builder");let{indentTokenName:i,dedentTokenName:o,whitespaceTokenName:s,ignoreIndentationDelimiters:a}=this.options,c,u,l,h=[];for(let p of n){for(let[y,_]of a)p.name===y?p.PUSH_MODE=ho.IGNORE_INDENTATION:p.name===_&&(p.POP_MODE=!0);p.name===o?c=p:p.name===i?u=p:p.name===s?l=p:h.push(p)}if(!c||!u||!l)throw new Error("Some indentation/whitespace tokens not found!");return a.length>0?{modes:{[ho.REGULAR]:[c,u,...h,l],[ho.IGNORE_INDENTATION]:[...h,l]},defaultMode:ho.REGULAR}:[c,u,l,...h]}flushLexingReport(e){let r=super.flushLexingReport(e);return Object.assign(Object.assign({},r),{remainingDedents:this.flushRemainingDedents(e)})}isStartOfLine(e,r){return r===0||`\r
161
- `.includes(e[r-1])}matchWhitespace(e,r,n,i){var o;this.whitespaceRegExp.lastIndex=r;let s=this.whitespaceRegExp.exec(e);return{currIndentLevel:(o=s?.[0].length)!==null&&o!==void 0?o:0,prevIndentLevel:this.indentationStack.at(-1),match:s}}createIndentationTokenInstance(e,r,n,i){let o=this.getLineNumber(r,i);return qn(e,n,i,i+n.length,o,o,1,n.length)}getLineNumber(e,r){return e.substring(0,r).split(/\r\n|\r|\n/).length}indentMatcher(e,r,n,i){if(!this.isStartOfLine(e,r))return null;let{currIndentLevel:o,prevIndentLevel:s,match:a}=this.matchWhitespace(e,r,n,i);return o<=s?null:(this.indentationStack.push(o),a)}dedentMatcher(e,r,n,i){var o,s,a,c;if(!this.isStartOfLine(e,r))return null;let{currIndentLevel:u,prevIndentLevel:l,match:h}=this.matchWhitespace(e,r,n,i);if(u>=l)return null;let p=this.indentationStack.lastIndexOf(u);if(p===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${u} at offset: ${r}. Current indentation stack: ${this.indentationStack}`,offset:r,length:(s=(o=h?.[0])===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0,line:this.getLineNumber(e,r),column:1}),null;let y=this.indentationStack.length-p-1,_=(c=(a=e.substring(0,r).match(/[\r\n]+$/))===null||a===void 0?void 0:a[0].length)!==null&&c!==void 0?c:1;for(let E=0;E<y;E++){let D=this.createIndentationTokenInstance(this.dedentTokenType,e,"",r-(_-1));n.push(D),this.indentationStack.pop()}return null}buildTerminalToken(e){let r=super.buildTerminalToken(e),{indentTokenName:n,dedentTokenName:i,whitespaceTokenName:o}=this.options;return r.name===n?this.indentTokenType:r.name===i?this.dedentTokenType:r.name===o?fi({name:o,pattern:this.whitespaceRegExp,group:Ze.SKIPPED}):r}flushRemainingDedents(e){let r=[];for(;this.indentationStack.length>1;)r.push(this.createIndentationTokenInstance(this.dedentTokenType,e,"",e.length)),this.indentationStack.pop();return this.indentationStack=[0],r}},Km=class extends lo{constructor(e){if(super(e),e.parser.TokenBuilder instanceof Vd)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(e,r=Wd){let n=super.tokenize(e),i=n.report;r?.mode==="full"&&n.tokens.push(...i.remainingDedents),i.remainingDedents=[];let{indentTokenType:o,dedentTokenType:s}=this.indentationTokenBuilder,a=o.tokenTypeIdx,c=s.tokenTypeIdx,u=[],l=n.tokens.length-1;for(let h=0;h<l;h++){let p=n.tokens[h],y=n.tokens[h+1];if(p.tokenTypeIdx===a&&y.tokenTypeIdx===c){h++;continue}u.push(p)}return l>=0&&u.push(n.tokens[l]),n.tokens=u,n}};var Re={};Kn(Re,{AstUtils:()=>al,BiMap:()=>so,Cancellation:()=>J,ContextCache:()=>ao,CstUtils:()=>tl,DONE_RESULT:()=>zt,Deferred:()=>sr,Disposable:()=>xi,DisposableCache:()=>pa,DocumentCache:()=>jd,EMPTY_STREAM:()=>Wa,ErrorWithLocation:()=>Fi,GrammarUtils:()=>fl,MultiMap:()=>Yr,OperationCancelled:()=>Rn,Reduction:()=>ko,RegExpUtils:()=>ll,SimpleCache:()=>Jc,StreamImpl:()=>Rr,TreeStreamImpl:()=>rn,URI:()=>vt,UriUtils:()=>ge,WorkspaceCache:()=>ma,assertUnreachable:()=>on,delayNextTick:()=>Fm,interruptAndCheck:()=>ot,isOperationCancelled:()=>bn,loadGrammarFromJson:()=>Xd,setInterruptionPeriod:()=>z_,startCancelableOperation:()=>Fd,stream:()=>ce});ve(Re,Ve);var Kd=class{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}},_u={fileSystemProvider:()=>new Kd};var UF={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},WF={AstReflection:()=>new fs};function BF(){let t=fo(Ru(_u),WF),e=fo(Tu({shared:t}),UF);return t.ServiceRegistry.register(e),e}function Xd(t){var e;let r=BF(),n=r.serializer.JsonSerializer.deserialize(t);return r.shared.workspace.LangiumDocumentFactory.fromModel(n,vt.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}ve(dt,Re);var Fa=Nr(kn(),1);function Uy(t,e){let r={stacks:t,tokens:e};return Yq(r),r.stacks.flat().forEach(i=>{i.property=void 0}),wA(r.stacks).map(i=>i[i.length-1])}function Wy(t){let{next:e,cardinalities:r,visited:n,plus:i}=t,o=[],s=e.feature;if(n.has(s))return[];Pr(s)||n.add(s);let a,c=s;for(;c.$container;)if(Pr(c.$container)){a=c.$container;break}else if(qi(c.$container))c=c.$container;else break;if(bp(c.cardinality)){let u=Ma({next:{feature:c,type:e.type},cardinalities:r,visited:n,plus:i});for(let l of u)i.add(l.feature);o.push(...u)}if(a){let u=a.elements.indexOf(c);u!==void 0&&u<a.elements.length-1&&o.push(...AA({feature:a,type:e.type},u+1,r,n,i)),o.every(l=>Gi(l.feature.cardinality,l.feature)||Gi(r.get(l.feature))||i.has(l.feature))&&o.push(...Wy({next:{feature:a,type:e.type},cardinalities:r,visited:n,plus:i}))}return o}function lh(t){return Ge(t)&&(t={feature:t}),Ma({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function Ma(t){var e,r,n;let{next:i,cardinalities:o,visited:s,plus:a}=t;if(i===void 0)return[];let{feature:c,type:u}=i;if(Pr(c))return s.has(c)?[]:(s.add(c),AA(i,0,o,s,a).map(l=>uh(l,c.cardinality,o)));if(hs(c)||ps(c))return c.elements.flatMap(l=>Ma({next:{feature:l,type:u,property:i.property},cardinalities:o,visited:s,plus:a})).map(l=>uh(l,c.cardinality,o));if(Vt(c)){let l={feature:c.terminal,type:u,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return Ma({next:l,cardinalities:o,visited:s,plus:a}).map(h=>uh(h,c.cardinality,o))}else{if(Vr(c))return Wy({next:{feature:c,type:zi(c),property:(r=i.property)!==null&&r!==void 0?r:c.feature},cardinalities:o,visited:s,plus:a});if(ur(c)&&Ye(c.rule.ref)){let l=c.rule.ref,h={feature:l.definition,type:l.fragment||l.dataType?void 0:(n=an(l))!==null&&n!==void 0?n:l.name,property:i.property};return Ma({next:h,cardinalities:o,visited:s,plus:a}).map(p=>uh(p,c.cardinality,o))}else return[i]}}function uh(t,e,r){return r.set(t.feature,e),t}function AA(t,e,r,n,i){var o;let s=[],a;for(;e<t.feature.elements.length&&(a={feature:t.feature.elements[e++],type:t.type},s.push(...Ma({next:a,cardinalities:r,visited:n,plus:i})),!!Gi((o=a.feature.cardinality)!==null&&o!==void 0?o:r.get(a.feature),a.feature)););return s}function Yq(t){for(let e of t.tokens){let r=wA(t.stacks,e);t.stacks=r}}function wA(t,e){let r=[];for(let n of t)r.push(...Jq(n,e));return r}function Jq(t,e){let r=new Map,n=new Set(t.map(o=>o.feature).filter(Qq)),i=[];for(;t.length>0;){let o=t.pop(),s=Wy({next:o,cardinalities:r,plus:n,visited:new Set}).filter(a=>e?By(a.feature,e):!0);for(let a of s)i.push([...t,a]);if(!s.every(a=>Gi(a.feature.cardinality,a.feature)||Gi(r.get(a.feature))))break}return i}function Qq(t){if(t.cardinality==="+")return!0;let e=_r(t,Vt);return!!(e&&e.cardinality==="+")}function By(t,e){if(Et(t))return t.value===e.image;if(ur(t))return Zq(t.rule.ref,e);if(br(t)){let r=ac(t);if(r)return By(r,e)}return!1}function Zq(t,e){return Ye(t)?lh(t.definition).some(n=>By(n.feature,e)):er(t)?Jn(t).test(e.image):!1}function NA(t){let e=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.triggerCharacters)!==null&&i!==void 0?i:[]}))),r=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.allCommitCharacters)!==null&&i!==void 0?i:[]})));return{triggerCharacters:e.length>0?e:void 0,allCommitCharacters:r.length>0?r:void 0}}var dh=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,r,n){let i=[],o=this.buildContexts(e,r.position),s=(u,l)=>{let h=this.fillCompletionItem(u,l);h&&i.push(h)},a=u=>Et(u.feature)?u.feature.value:u.feature,c=[];for(let u of o)if(await Promise.all(ce(u.features).distinct(a).exclude(c).map(l=>this.completionFor(u,l,s))),c.push(...u.features),!this.continueCompletion(i))break;return Fa.CompletionList.create(this.deduplicateItems(i),!0)}deduplicateItems(e){return ce(e).distinct(r=>`${r.kind}_${r.label}_${r.detail}`).toArray()}findFeaturesAt(e,r){let n=e.getText({start:Fa.Position.create(0,0),end:e.positionAt(r)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let c=oc(this.grammar),u=lh({feature:c.definition,type:an(c)});return o.length>0?(o.shift(),Uy(u.map(l=>[l]),o)):u}let s=[...o].splice(i.tokenIndex);return Uy([i.elementStack.map(c=>({feature:c}))],s)}*buildContexts(e,r){var n,i;let o=e.parseResult.value.$cstNode;if(!o)return;let s=e.textDocument,a=s.getText(),c=s.offsetAt(r),u={document:e,textDocument:s,offset:c,position:r},l=this.findDataTypeRuleStart(o,c);if(l){let[x,g]=l,A=(n=Ha(o,x))===null||n===void 0?void 0:n.astNode;yield Object.assign(Object.assign({},u),{node:A,tokenOffset:x,tokenEndOffset:g,features:this.findFeaturesAt(s,x)})}let{nextTokenStart:h,nextTokenEnd:p,previousTokenStart:y,previousTokenEnd:_}=this.backtrackToAnyToken(a,c),E=h;c<=h&&y!==void 0&&(E=y);let D=(i=Ha(o,E))===null||i===void 0?void 0:i.astNode,w=!0;if(y!==void 0&&_!==void 0&&_===c&&(yield Object.assign(Object.assign({},u),{node:D,tokenOffset:y,tokenEndOffset:_,features:this.findFeaturesAt(s,y)}),w=this.performNextTokenCompletion(e,a.substring(y,_),y,_),w&&(yield Object.assign(Object.assign({},u),{node:D,tokenOffset:_,tokenEndOffset:_,features:this.findFeaturesAt(s,_)}))),D)w&&(yield Object.assign(Object.assign({},u),{node:D,tokenOffset:h,tokenEndOffset:p,features:this.findFeaturesAt(s,h)}));else{let x=oc(this.grammar);if(!x)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},u),{tokenOffset:h,tokenEndOffset:p,features:lh(x.definition)})}}performNextTokenCompletion(e,r,n,i){return/\P{L}$/u.test(r)}findDataTypeRuleStart(e,r){var n,i;let o=cr(e,r,this.grammarConfig.nameRegexp),s=!!(!((n=_r(o?.grammarSource,Ye))===null||n===void 0)&&n.dataType);if(s){for(;s;)o=o?.container,s=!!(!((i=_r(o?.grammarSource,Ye))===null||i===void 0)&&i.dataType);if(o)return[o.offset,o.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,r){let n=this.lexer.tokenize(e).tokens;if(n.length===0)return{nextTokenStart:r,nextTokenEnd:r};let i;for(let o of n){if(o.startOffset>=r)return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};if(o.endOffset>=r)return{nextTokenStart:o.startOffset,nextTokenEnd:o.endOffset+1,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};i=o}return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0}}completionFor(e,r,n){if(Et(r.feature))return this.completionForKeyword(e,r.feature,n);if(br(r.feature)&&e.node)return this.completionForCrossReference(e,r,n)}completionForCrossReference(e,r,n){let i=_r(r.feature,Vt),o=e.node;if(i&&o){r.type&&(o={$type:r.type,$container:o,$containerProperty:r.property},ec(this.astReflection,o));let s={reference:{$refText:""},container:o,property:i.feature};try{for(let a of this.getReferenceCandidates(s,e))n(e,this.createReferenceCompletionItem(a))}catch(a){console.error(a)}}}getReferenceCandidates(e,r){return this.scopeProvider.getScope(e).getAllElements()}createReferenceCompletionItem(e){let r=this.nodeKindProvider.getCompletionItemKind(e),n=this.getReferenceDocumentation(e);return{nodeDescription:e,kind:r,documentation:n,detail:e.type,sortText:"0"}}getReferenceDocumentation(e){if(!e.node)return;let r=this.documentationProvider.getDocumentation(e.node);if(r)return{kind:"markdown",value:r}}completionForKeyword(e,r,n){this.filterKeyword(e,r)&&n(e,{label:r.value,kind:this.getKeywordCompletionItemKind(r),detail:"Keyword",sortText:"1"})}getKeywordCompletionItemKind(e){return Fa.CompletionItemKind.Keyword}filterKeyword(e,r){return/\p{L}/u.test(r.value)}fillCompletionItem(e,r){var n,i;let o;if(typeof r.label=="string")o=r.label;else if("node"in r){let u=this.nameProvider.getName(r.node);if(!u)return;o=u}else if("nodeDescription"in r)o=r.nodeDescription.name;else return;let s;typeof((n=r.textEdit)===null||n===void 0?void 0:n.newText)=="string"?s=r.textEdit.newText:typeof r.insertText=="string"?s=r.insertText:s=o;let a=(i=r.textEdit)!==null&&i!==void 0?i:this.buildCompletionTextEdit(e,o,s);return a?{additionalTextEdits:r.additionalTextEdits,command:r.command,commitCharacters:r.commitCharacters,data:r.data,detail:r.detail,documentation:r.documentation,filterText:r.filterText,insertText:r.insertText,insertTextFormat:r.insertTextFormat,insertTextMode:r.insertTextMode,kind:r.kind,labelDetails:r.labelDetails,preselect:r.preselect,sortText:r.sortText,tags:r.tags,textEditText:r.textEditText,textEdit:a,label:o}:void 0}buildCompletionTextEdit(e,r,n){let o=e.textDocument.getText().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(o,r)){let s=e.textDocument.positionAt(e.tokenOffset),a=e.position;return{newText:n,range:{start:s,end:a}}}else return}};var PA=Nr(kn(),1);var fh=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,r,n){let i=e.parseResult.value;if(i.$cstNode){let o=i.$cstNode,s=cr(o,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(s)return this.collectLocationLinks(s,r)}}collectLocationLinks(e,r){var n;let i=this.findLink(e);if(i)return[PA.LocationLink.create(i.targetDocument.textDocument.uri,((n=i.target.astNode.$cstNode)!==null&&n!==void 0?n:i.target).range,i.target.range,i.source.range)]}findLink(e){let r=this.references.findDeclarationNode(e);if(r?.astNode){let n=Rt(r.astNode);if(r&&n)return{source:e,target:r,targetDocument:n}}}};var IA=Nr(kn(),1);var hh=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,r,n){let i=e.parseResult.value.$cstNode;if(!i)return;let o=cr(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!o)return;let s=this.references.findDeclaration(o);if(s){let a=ge.equals(Rt(s).uri,e.uri),c={documentUri:e.uri,includeDeclaration:a};return this.references.findReferences(s,c).map(l=>this.createDocumentHighlight(l)).toArray()}}createDocumentHighlight(e){return IA.DocumentHighlight.create(e.segment.range)}};var ph=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e,r,n){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,r){let n=r.$cstNode,i=this.nameProvider.getNameNode(r);if(i&&n){let o=this.nameProvider.getName(r);return[{kind:this.nodeKindProvider.getSymbolKind(r),name:o||i.text,range:n.range,selectionRange:i.range,children:this.getChildSymbols(e,r)}]}else return this.getChildSymbols(e,r)||[]}getChildSymbols(e,r){let n=[];for(let i of Ui(r)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}};var qu=Nr(kn(),1);var mh=class{constructor(e){this.workspaceManager=e.workspace.WorkspaceManager,this.documentBuilder=e.workspace.DocumentBuilder,this.workspaceLock=e.workspace.WorkspaceLock,this.serviceRegistry=e.ServiceRegistry;let r=!1;e.lsp.LanguageServer.onInitialize(n=>{var i,o;r=!!(!((o=(i=n.capabilities.workspace)===null||i===void 0?void 0:i.didChangeWatchedFiles)===null||o===void 0)&&o.dynamicRegistration)}),e.lsp.LanguageServer.onInitialized(n=>{r&&this.registerFileWatcher(e)})}registerFileWatcher(e){let r=[],n=ce(e.ServiceRegistry.all).flatMap(o=>o.LanguageMetaData.fileExtensions).map(o=>o.startsWith(".")?o.substring(1):o).distinct().toArray();n.length>0&&r.push({globPattern:n.length===1?`**/*.${n[0]}`:`**/*.{${n.join(",")}}`});let i=ce(e.ServiceRegistry.all).flatMap(o=>{var s;return(s=o.LanguageMetaData.fileNames)!==null&&s!==void 0?s:[]}).distinct().toArray();if(i.length>0&&r.push({globPattern:i.length===1?`**/${i[0]}`:`**/{${i.join(",")}}`}),r.length>0){let o=e.lsp.Connection,s={watchers:r};o?.client.register(qu.DidChangeWatchedFilesNotification.type,s)}}fireDocumentUpdate(e,r){e=e.filter(n=>this.serviceRegistry.hasServices(n)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(n=>this.documentBuilder.update(e,r,n))}).catch(n=>{console.error("Workspace initialization failed. Could not perform document update.",n)})}didChangeContent(e){this.fireDocumentUpdate([vt.parse(e.document.uri)],[])}didChangeWatchedFiles(e){let r=ce(e.changes).filter(i=>i.type!==qu.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>vt.parse(i.uri)).toArray(),n=ce(e.changes).filter(i=>i.type===qu.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>vt.parse(i.uri)).toArray();this.fireDocumentUpdate(r,n)}};var ju=Nr(kn(),1);var gh=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,r,n){let i=[],o=s=>i.push(s);return this.collectFolding(e,o),i}collectFolding(e,r){var n;let i=(n=e.parseResult)===null||n===void 0?void 0:n.value;if(i){if(this.shouldProcessContent(i)){let o=Cr(i).iterator(),s;do if(s=o.next(),!s.done){let a=s.value;this.shouldProcess(a)&&this.collectObjectFolding(e,a,r),this.shouldProcessContent(a)||o.prune()}while(!s.done)}this.collectCommentFolding(e,i,r)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,r,n){let i=r.$cstNode;if(i){let o=this.toFoldingRange(e,i);o&&n(o)}}collectCommentFolding(e,r,n){let i=r.$cstNode;if(i){for(let o of qh(i))if(this.commentNames.includes(o.tokenType.name)){let s=this.toFoldingRange(e,o,ju.FoldingRangeKind.Comment);s&&n(s)}}}toFoldingRange(e,r,n){let i=r.range,o=i.start,s=i.end;if(!(s.line-o.line<2))return this.includeLastFoldingLine(r,n)||(s=e.textDocument.positionAt(e.textDocument.offsetAt({line:s.line,character:0})-1)),ju.FoldingRange.create(o.line,s.line,o.character,s.character,n)}includeLastFoldingLine(e,r){if(r===ju.FoldingRangeKind.Comment)return!1;let n=e.text,i=n.charAt(n.length-1);return!(i==="}"||i===")"||i==="]")}};var yh=class{match(e,r){if(e.length===0)return!0;let n=!1,i,o=0,s=r.length;for(let a=0;a<s;a++){let c=r.charCodeAt(a),u=e.charCodeAt(o);if((c===u||this.toUpperCharCode(c)===this.toUpperCharCode(u))&&(n||(n=i===void 0||this.isWordTransition(i,c)),n&&o++,o===e.length))return!0;i=c}return!1}isWordTransition(e,r){return DA<=e&&e<=OA&&ej<=r&&r<=tj||e===LA&&r!==LA}toUpperCharCode(e){return DA<=e&&e<=OA?e-32:e}},DA=97,OA=122,ej=65,tj=90,LA=95;var Hy=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,r){var n,i;let o=(i=(n=e.parseResult)===null||n===void 0?void 0:n.value)===null||i===void 0?void 0:i.$cstNode;if(o){let s=e.textDocument.offsetAt(r.position),a=cr(o,s,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>s){let c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c);if(Et(a.grammarSource))return this.getKeywordHoverContent(a.grammarSource)}}}getKeywordHoverContent(e){var r;let n=eu(e)?e.$comment:void 0;if(n||(n=(r=Ba(e.$cstNode,["ML_COMMENT"]))===null||r===void 0?void 0:r.text),n&&pu(n)){let i=hu(n).toMarkdown();if(i)return{contents:{kind:"markdown",value:i}}}}},vh=class extends Hy{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){let r=this.documentationProvider.getDocumentation(e);if(r)return{contents:{kind:"markdown",value:r}}}};var Gn=Nr(ht(),1);var fe=Nr(kn(),1);var rj={[fe.SemanticTokenTypes.class]:0,[fe.SemanticTokenTypes.comment]:1,[fe.SemanticTokenTypes.enum]:2,[fe.SemanticTokenTypes.enumMember]:3,[fe.SemanticTokenTypes.event]:4,[fe.SemanticTokenTypes.function]:5,[fe.SemanticTokenTypes.interface]:6,[fe.SemanticTokenTypes.keyword]:7,[fe.SemanticTokenTypes.macro]:8,[fe.SemanticTokenTypes.method]:9,[fe.SemanticTokenTypes.modifier]:10,[fe.SemanticTokenTypes.namespace]:11,[fe.SemanticTokenTypes.number]:12,[fe.SemanticTokenTypes.operator]:13,[fe.SemanticTokenTypes.parameter]:14,[fe.SemanticTokenTypes.property]:15,[fe.SemanticTokenTypes.regexp]:16,[fe.SemanticTokenTypes.string]:17,[fe.SemanticTokenTypes.struct]:18,[fe.SemanticTokenTypes.type]:19,[fe.SemanticTokenTypes.typeParameter]:20,[fe.SemanticTokenTypes.variable]:21,[fe.SemanticTokenTypes.decorator]:22},nj={[fe.SemanticTokenModifiers.abstract]:1,[fe.SemanticTokenModifiers.async]:2,[fe.SemanticTokenModifiers.declaration]:4,[fe.SemanticTokenModifiers.defaultLibrary]:8,[fe.SemanticTokenModifiers.definition]:16,[fe.SemanticTokenModifiers.deprecated]:32,[fe.SemanticTokenModifiers.documentation]:64,[fe.SemanticTokenModifiers.modification]:128,[fe.SemanticTokenModifiers.readonly]:256,[fe.SemanticTokenModifiers.static]:512},lre={legend:{tokenTypes:Object.keys(rj),tokenModifiers:Object.keys(nj)},full:{delta:!0},range:!0};function FA(t){let e=[],r=[],n=!0,i=!0,o=!0;for(let s of t)s&&(s.legend.tokenTypes.forEach((a,c)=>{let u=e[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token types. They use the same index ${c}.`);e[c]=a}),s.legend.tokenModifiers.forEach((a,c)=>{let u=r[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token modifier. They use the same index ${c}.`);r[c]=a}),s.full?typeof s.full=="object"&&!s.full.delta&&(i=!1):n=!1,s.range||(o=!1));return{legend:{tokenTypes:e,tokenModifiers:r},full:n&&{delta:i},range:o}}var MA;(function(t){function e(n,i,o){let s=new Map;Object.entries(i).forEach(([u,l])=>s.set(l,u));let a=0,c=0;return r(n.data,5).map(u=>{a+=u[0],u[0]!==0&&(c=0),c+=u[1];let l=u[2];return{offset:o.textDocument.offsetAt({line:a,character:c}),tokenType:s.get(u[3]),tokenModifiers:u[4],text:o.textDocument.getText({start:{line:a,character:c},end:{line:a,character:c+l}})}})}t.decode=e;function r(n,i){let o=[];for(let s=0;s<n.length;s+=i){let a=n.slice(s,s+i);o.push(a)}return o}})(MA||(MA={}));function $A(t){let e=[],r=[];t.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&r.push(...i.retriggerCharacters)});let n={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:r.length>0?Array.from(new Set(r)).sort():void 0};return n.triggerCharacters?n:void 0}var xh=class{constructor(e){this.onInitializeEmitter=new Gn.Emitter,this.onInitializedEmitter=new Gn.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(){bu(this.services),this.services.ServiceRegistry.all.forEach(e=>bu(e))}hasService(e){return this.services.ServiceRegistry.all.some(n=>e(n)!==void 0)}buildInitializeResult(e){var r,n,i,o;let s=this.services.lsp.DocumentUpdateHandler,a=(r=this.services.lsp.FileOperationHandler)===null||r===void 0?void 0:r.fileOperationOptions,c=this.services.ServiceRegistry.all,u=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.Formatter}),l=c.map(B=>{var N,ke;return(ke=(N=B.lsp)===null||N===void 0?void 0:N.Formatter)===null||ke===void 0?void 0:ke.formatOnTypeOptions}).find(B=>!!B),h=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.CodeActionProvider}),p=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.SemanticTokenProvider}),y=FA(c.map(B=>{var N,ke;return(ke=(N=B.lsp)===null||N===void 0?void 0:N.SemanticTokenProvider)===null||ke===void 0?void 0:ke.semanticTokensOptions})),_=(i=(n=this.services.lsp)===null||n===void 0?void 0:n.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,E=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DocumentLinkProvider}),D=$A(c.map(B=>{var N,ke;return(ke=(N=B.lsp)===null||N===void 0?void 0:N.SignatureHelp)===null||ke===void 0?void 0:ke.signatureHelpOptions})),w=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.TypeProvider}),x=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.ImplementationProvider}),g=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.CompletionProvider}),A=NA(c.map(B=>{var N,ke;return(ke=(N=B.lsp)===null||N===void 0?void 0:N.CompletionProvider)===null||ke===void 0?void 0:ke.completionOptions})),M=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.ReferencesProvider}),te=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DocumentSymbolProvider}),_e=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DefinitionProvider}),Se=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DocumentHighlightProvider}),Nt=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.FoldingRangeProvider}),xt=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.HoverProvider}),$=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.RenameProvider}),I=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.CallHierarchyProvider}),z=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.TypeHierarchyProvider}),W=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.CodeLensProvider}),le=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DeclarationProvider}),Z=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.InlayHintProvider}),Q=(o=this.services.lsp)===null||o===void 0?void 0:o.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:a},executeCommandProvider:_&&{commands:_},textDocumentSync:{change:Gn.TextDocumentSyncKind.Incremental,openClose:!0,save:!!s.didSaveDocument,willSave:!!s.willSaveDocument,willSaveWaitUntil:!!s.willSaveDocumentWaitUntil},completionProvider:g?A:void 0,referencesProvider:M,documentSymbolProvider:te,definitionProvider:_e,typeDefinitionProvider:w,documentHighlightProvider:Se,codeActionProvider:h,documentFormattingProvider:u,documentRangeFormattingProvider:u,documentOnTypeFormattingProvider:l,foldingRangeProvider:Nt,hoverProvider:xt,renameProvider:$?{prepareProvider:!0}:void 0,semanticTokensProvider:p?y:void 0,signatureHelpProvider:D,implementationProvider:x,callHierarchyProvider:I?{}:void 0,typeHierarchyProvider:z?{}:void 0,documentLinkProvider:E?{resolveProvider:!1}:void 0,codeLensProvider:W?{resolveProvider:!1}:void 0,declarationProvider:le,inlayHintProvider:Z?{resolveProvider:!1}:void 0,workspaceSymbolProvider:Q?{resolveProvider:!!Q.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 r=this.services.lsp.Connection,n=r?Object.assign(Object.assign({},e),{register:i=>r.client.register(Gn.DidChangeConfigurationNotification.type,i),fetchConfiguration:i=>r.workspace.getConfiguration(i)}):e;this.services.workspace.ConfigurationProvider.initialized(n).catch(i=>console.error("Error in ConfigurationProvider initialization:",i)),this.services.workspace.WorkspaceManager.initialized(e).catch(i=>console.error("Error in WorkspaceManager initialization:",i))}};var Rh=Nr(kn(),1),Th=class{getSymbolKind(e){return Rh.SymbolKind.Field}getCompletionItemKind(e){return Rh.CompletionItemKind.Reference}};var qA=Nr(kn(),1);var bh=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,r,n){let i=e.parseResult.value.$cstNode;if(!i)return[];let o=cr(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);return o?this.getReferences(o,r,e):[]}getReferences(e,r,n){let i=[],o=this.references.findDeclaration(e);if(o){let s={includeDeclaration:r.context.includeDeclaration};this.references.findReferences(o,s).forEach(a=>{i.push(qA.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}};var _h=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,r,n){let i={},o=e.parseResult.value.$cstNode;if(!o)return;let s=e.textDocument.offsetAt(r.position),a=cr(o,s,this.grammarConfig.nameRegexp);if(!a)return;let c=this.references.findDeclaration(a);if(!c)return;let u={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(c,u).forEach(h=>{let p=gi.replace(h.segment.range,r.newName),y=h.sourceUri.toString();i[y]?i[y].push(p):i[y]=[p]}),{changes:i}}prepareRename(e,r,n){return this.renameNodeRange(e,r.position)}renameNodeRange(e,r){let n=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(r);if(n&&i){let o=cr(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.astNode&&qd(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}};var Ch=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,r=J.CancellationToken.None){let n=[],i=e.query.toLowerCase();for(let o of this.indexManager.allElements())if(await ot(r),this.fuzzyMatcher.match(i,o.name)){let s=this.getWorkspaceSymbol(o);s&&n.push(s)}return n}getWorkspaceSymbol(e){let r=e.nameSegment;if(r)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:r.range,uri:e.documentUri.toString()}}}};var $t=Nr(kn(),1);var Uu=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(ge.normalize(e))}set(e){let r=ge.normalize(e.uri),n=!0;this._syncedDocuments.has(r)&&(n=!1),this._syncedDocuments.set(r,e);let i=Object.freeze({document:e});return this._onDidOpen.fire(i),this._onDidChangeContent.fire(i),n}delete(e){let r=ge.normalize(typeof e=="object"&&"uri"in e?e.uri:e),n=this._syncedDocuments.get(r);n!==void 0&&(this._syncedDocuments.delete(r),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=$t.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=ge.normalize(i.uri),s=this._configuration.create(o,i.languageId,i.version,i.text);this._syncedDocuments.set(o,s);let a=Object.freeze({document:s});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:s}=i;if(s==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=ge.normalize(i.uri),c=this._syncedDocuments.get(a);c!==void 0&&(c=this._configuration.update(c,o,s),this._syncedDocuments.set(a,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),r.push(e.onDidCloseTextDocument(n=>{let i=ge.normalize(n.textDocument.uri),o=this._syncedDocuments.get(i);o!==void 0&&(this._syncedDocuments.delete(i),this._onDidClose.fire(Object.freeze({document:o})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(ge.normalize(n.textDocument.uri));i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(ge.normalize(n.textDocument.uri));return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(ge.normalize(n.textDocument.uri));i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),$t.Disposable.create(()=>{r.forEach(n=>n.dispose())})}},Sh=class{constructor(e){this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new $t.Emitter,this._onDidSave=new $t.Emitter,this._onDidChange=new $t.Emitter,this._onDidClose=new $t.Emitter,"listen"in e?this._cellTextDocuments=e:this._cellTextDocuments=new Uu(e)}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(ge.normalize(e))}getNotebookCell(e){let r=this.notebookCellMap.get(ge.normalize(e));return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"||"scheme"in e?e:e.document,n=this.notebookCellMap.get(ge.normalize(r));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 r=new kh,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{let o=ge.normalize(i.notebookDocument.uri);this.notebookDocuments.set(o,i.notebookDocument);for(let s of i.cellTextDocuments)r.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=ge.normalize(i.notebookDocument.uri),s=this.notebookDocuments.get(o);if(s===void 0)return;s.version=i.notebookDocument.version;let a=s.metadata,c=!1,u=i.change;u.metadata!==void 0&&(c=!0,s.metadata=u.metadata);let l=[],h=[],p=[],y=[];if(u.cells!==void 0){let x=u.cells;if(x.structure!==void 0){let g=x.structure.array;if(s.cells.splice(g.start,g.deleteCount,...g.cells!==void 0?g.cells:[]),x.structure.didOpen!==void 0)for(let A of x.structure.didOpen)r.openTextDocument({textDocument:A}),l.push(A.uri);if(x.structure.didClose)for(let A of x.structure.didClose)r.closeTextDocument({textDocument:A}),h.push(A.uri)}if(x.data!==void 0){let g=new Map(x.data.map(A=>[A.document,A]));for(let A=0;A<=s.cells.length;A++){let M=g.get(s.cells[A].document);if(M!==void 0){let te=s.cells.splice(A,1,M);if(p.push({old:te[0],new:M}),g.delete(M.document),g.size===0)break}}}if(x.textContent!==void 0)for(let g of x.textContent)r.changeTextDocument({textDocument:g.document,contentChanges:g.changes}),y.push(g.document.uri)}this.updateCellMap(s);let _={notebookDocument:s};c&&(_.metadata={old:a,new:s.metadata});let E=[];for(let x of l)E.push(this.getNotebookCell(x));let D=[];for(let x of h)D.push(this.getNotebookCell(x));let w=[];for(let x of y)w.push(this.getNotebookCell(x));(E.length>0||D.length>0||p.length>0||w.length>0)&&(_.cells={added:E,removed:D,changed:{data:p,textContent:w}}),(_.metadata!==void 0||_.cells!==void 0)&&this._onDidChange.fire(_)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.getNotebookDocument(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=ge.normalize(i.notebookDocument.uri),s=this.notebookDocuments.get(o);if(s!==void 0){this._onDidClose.fire(s);for(let a of i.cellTextDocuments)r.closeTextDocument({textDocument:a});this.notebookDocuments.delete(o);for(let a of s.cells)this.notebookCellMap.delete(a.document)}})),$t.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}},kh=class t{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 t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};kh.NULL_DISPOSE=Object.freeze({dispose:()=>{}});function jA(t){return ya.merge(Tu(t),ij(t))}function ij(t){return{lsp:{CompletionProvider:e=>new dh(e),DocumentSymbolProvider:e=>new ph(e),HoverProvider:e=>new vh(e),FoldingRangeProvider:e=>new gh(e),ReferencesProvider:e=>new bh(e),DefinitionProvider:e=>new fh(e),DocumentHighlightProvider:e=>new hh(e),RenameProvider:e=>new _h(e)},shared:()=>t.shared}}function UA(t){return ya.merge(Ru(t),oj(t))}function oj(t){return{lsp:{Connection:()=>t.connection,LanguageServer:e=>new xh(e),DocumentUpdateHandler:e=>new mh(e),WorkspaceSymbolProvider:e=>new Ch(e),NodeKindProvider:()=>new Th,FuzzyMatcher:()=>new yh},workspace:{TextDocuments:()=>new Uu(vi),NotebookDocuments:e=>new Sh(e.workspace.TextDocuments)}}}var WA="BlockCommand";var BA="LineCommand";var Gy="AddressParam";var Eh="CheckActionCommand";var Ah="CheckAlarmCommand";var wh="CheckCommand";var zy="CodeParam";var Wu="CountCommand";function Xy(t){return Qy.isInstance(t,Wu)}var Nh="DelayCommand";var Bu="LoopCommand";function Yy(t){return Qy.isInstance(t,Bu)}var Ph="Model";var Hu="ScheduleCommand";function Jy(t){return Qy.isInstance(t,Hu)}var Vy="TimeParam";var Ih="UnwatchCommand";var Ky="ValueParam";var Dh="WatchCommand";var Oh="WriteCommand";var Lh="TypeDeclare";var Gu=class extends Di{getAllTypes(){return[Gy,WA,Eh,Ah,wh,zy,Wu,Nh,BA,Bu,Ph,Hu,Vy,Lh,Ih,Ky,Dh,Oh]}computeIsSubtype(e,r){switch(e){case Eh:case Ah:case wh:case Nh:case Ih:case Dh:case Oh:return this.isSubtype(BA,r);case Wu:case Bu:case Hu:return this.isSubtype(WA,r);case Lh:return this.isSubtype(Ph,r);default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;throw new Error(`${r} is not a valid reference id.`)}getTypeMetaData(e){switch(e){case Gy:return{name:Gy,properties:[{name:"value"}]};case Eh:return{name:Eh,properties:[{name:"code"}]};case Ah:return{name:Ah,properties:[{name:"codes",defaultValue:[]},{name:"codes2",defaultValue:[]}]};case wh:return{name:wh,properties:[{name:"address"},{name:"address2"},{name:"value"},{name:"value2"}]};case zy:return{name:zy,properties:[{name:"value"}]};case Wu:return{name:Wu,properties:[{name:"commands",defaultValue:[]},{name:"times"}]};case Nh:return{name:Nh,properties:[{name:"time"}]};case Bu:return{name:Bu,properties:[{name:"commands",defaultValue:[]},{name:"time"}]};case Ph:return{name:Ph,properties:[{name:"commands",defaultValue:[]}]};case Hu:return{name:Hu,properties:[{name:"commands",defaultValue:[]},{name:"time"}]};case Vy:return{name:Vy,properties:[{name:"value"}]};case Ih:return{name:Ih,properties:[{name:"address"}]};case Ky:return{name:Ky,properties:[{name:"value"}]};case Dh:return{name:Dh,properties:[{name:"address"},{name:"value"},{name:"value2"}]};case Oh:return{name:Oh,properties:[{name:"address"},{name:"address2"},{name:"value"}]};case Lh:return{name:Lh,properties:[{name:"commands",defaultValue:[]},{name:"value"}]};default:return{name:e,properties:[]}}}},Qy=new Gu;var HA,GA=()=>HA??(HA=Xd('{"$type":"Grammar","isDeclared":true,"name":"Acspec","rules":[{"$type":"ParserRule","entry":true,"name":"Model","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TypeDeclare","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"use"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"unit"},{"$type":"Keyword","value":"init"}]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineCommand","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BlockCommand","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WriteCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"write"},{"$type":"Keyword","value":"write!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"address2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check"},{"$type":"Keyword","value":"check!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Assignment","feature":"address2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckAlarmCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check_alarm"},{"$type":"Keyword","value":"check_alarm!"}]},{"$type":"Assignment","feature":"codes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"codes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"codes2","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"codes2","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckActionCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check_action"},{"$type":"Keyword","value":"check_action!"}]},{"$type":"Assignment","feature":"code","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WatchCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"watch"},{"$type":"Keyword","value":"watch!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UnwatchCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"unwatch"},{"$type":"Keyword","value":"unwatch!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DelayCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"delay"},{"$type":"Keyword","value":"delay!"}]},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ScheduleCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"schedule"},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LoopCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"loop"},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CountCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"count"},{"$type":"Assignment","feature":"times","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AddressParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ValueParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CodeParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TimeParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/"},"fragment":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[_a-zA-Z][\\\\w_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?\\\\d+(\\\\.\\\\d+)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SL_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"types":[],"usedGrammars":[]}'));var aj={languageId:"acspec",fileExtensions:[".tsc"],caseInsensitive:!1,mode:"production"},zA={AstReflection:()=>new Gu},VA={Grammar:()=>GA(),LanguageMetaData:()=>aj,parser:{}};function KA(t){let e=t.validation.ValidationRegistry,r=t.validation.AcspecValidator,n={WriteCommand:r.checkWriteCommand,CheckCommand:r.checkCheckCommand,DelayCommand:r.checkDelayCommand,CheckAlarmCommand:r.checkAlarmCommand,CheckActionCommand:r.checkActionCommand,WatchCommand:r.checkWatchCommand,UnwatchCommand:r.checkUnwatchCommand,ScheduleCommand:r.checkScheduleCommand,LoopCommand:r.checkLoopCommand,CountCommand:r.checkCountCommand};e.register(n,r)}var Mh=class{validateAddress(e){return e?/^[A-Z]+[0-9]+$/.test(e):!1}checkWriteCommand(e,r){e.address&&!this.validateAddress(e.address.value)&&r("error","\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5BC4\u5B58\u5668\u5730\u5740\uFF0C\u4F8B\u5982\uFF1AM0100",{node:e.address,property:"value"}),e.address2&&!this.validateAddress(e.address2.value)&&r("error","\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5BC4\u5B58\u5668\u5730\u5740\uFF0C\u4F8B\u5982\uFF1AM0100",{node:e.address2,property:"value"})}checkCheckCommand(e,r){e.address&&!this.validateAddress(e.address.value)&&r("error","\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5BC4\u5B58\u5668\u5730\u5740\uFF0C\u4F8B\u5982\uFF1AM0100",{node:e.address,property:"value"}),e.address2&&!this.validateAddress(e.address2.value)&&r("error","\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5BC4\u5B58\u5668\u5730\u5740\uFF0C\u4F8B\u5982\uFF1AM0100",{node:e.address2,property:"value"}),e.value&&e.value2&&e.value2.value<=e.value.value&&r("error","\u6700\u5927\u503C\u5FC5\u987B\u5927\u4E8E\u6700\u5C0F\u503C",{node:e.value2,property:"value"})}checkAlarmCommand(e,r){Array.isArray(e.codes)&&(e.codes.forEach(n=>{(!Number.isInteger(n.value)||n.value<0)&&r("error","\u544A\u8B66\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:n,property:"value"})}),Array.isArray(e.codes2)&&e.codes2.forEach(n=>{(!Number.isInteger(n.value)||n.value<0)&&r("error","\u544A\u8B66\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:n,property:"value"})}))}checkActionCommand(e,r){e.code&&(!Number.isInteger(e.code.value)||e.code.value<0)&&r("error","\u52A8\u4F5C\u72B6\u6001\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:e.code,property:"value"})}checkWatchCommand(e,r){e.address&&!this.validateAddress(e.address.value)&&r("error","\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5BC4\u5B58\u5668\u5730\u5740\uFF0C\u4F8B\u5982\uFF1AM0100",{node:e.address,property:"value"}),e.value&&e.value2&&e.value2.value<=e.value.value&&r("error","\u6700\u5927\u503C\u5FC5\u987B\u5927\u4E8E\u6700\u5C0F\u503C",{node:e.value2,property:"value"})}checkUnwatchCommand(e,r){e.address&&!this.validateAddress(e.address.value)&&r("error","\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5BC4\u5B58\u5668\u5730\u5740\uFF0C\u4F8B\u5982\uFF1AM0100",{node:e.address,property:"value"})}checkDelayCommand(e,r){e.time&&(typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5EF6\u8FDF\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"})}checkScheduleCommand(e,r){e.time&&((typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5B9A\u65F6\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757\uFF0C\u53EF\u4EE5\u4F7F\u7528\u66F4\u7B80\u6D01\u7684delay\u547D\u4EE4\u66FF\u4EE3\uFF0C\u4F8B\u5982\uFF1Adelay "+e.time.value,{node:e}))}checkLoopCommand(e,r){e.time&&((typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5B9A\u65F6\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757\uFF0C\u53EF\u4EE5\u4F7F\u7528\u66F4\u7B80\u6D01\u7684delay\u547D\u4EE4\u66FF\u4EE3\uFF0C\u4F8B\u5982\uFF1Adelay "+e.time.value,{node:e}))}checkCountCommand(e,r){e.times&&((!Number.isInteger(e.times.value)||e.times.value<=0)&&r("error","\u91CD\u590D\u6B21\u6570\u5FC5\u987B\u662F\u6B63\u6574\u6570",{node:e.times,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757",{node:e}))}};var cj={validation:{AcspecValidator:()=>new Mh}};function XA(t){let e=fo(UA(t),zA),r=fo(jA({shared:e}),VA,cj);return e.ServiceRegistry.register(r),KA(r),{shared:e,Acspec:r}}var{shared:YA,Acspec:uj}=XA(_u),lj=new uo(uj),JA=new Set(["address","address2","value","value2","time","times","code","codes","codes2"]);async function dj(t,e="file:///example.tcs"){let r={},n,i=YA.workspace.LangiumDocuments.createDocument(e,t),o=await lj.validateDocument(i),s=i.parseResult.value;if(!Array.isArray(o)||o.length===0){r.$type=s.$type,r.value=s.value,r.commands=[];for(let a of s.commands){let c={};if(Jy(a)||Yy(a)||Xy(a)){c.$type=a.$type,Jy(a)||Yy(a)?c.time=a.time.value:Xy(a)&&(c.times=a.times.value),c.commands=[];for(let u of a.commands){let l={};Object.keys(u).forEach(h=>{JA.has(h)&&(h==="codes"||h==="codes2"?l[h]=u[h].map(p=>p.value):l[h]=u[h].value)}),l.$type=u.$type,l.text=u.$cstNode.text,l.important=u.$cstNode.text.includes("!"),l.range=u.$cstNode.range,c.commands.push(l)}}else Object.keys(a).forEach(u=>{JA.has(u)&&(u==="codes"||u==="codes2"?c[u]=a[u].map(l=>l.value):c[u]=a[u].value)}),c.$type=a.$type,c.text=a.$cstNode.text,c.important=a.$cstNode.text.includes("!"),c.range=a.$cstNode.range;r.commands.push(c)}}return YA.workspace.LangiumDocuments.deleteDocument(e),Object.keys(r).length>0&&(n=JSON.stringify(r)),{syntaxTree:n,diagnostics:o}}0&&(module.exports={getSyntaxTree});
161
+ `.includes(e[r-1])}matchWhitespace(e,r,n,i){var o;this.whitespaceRegExp.lastIndex=r;let s=this.whitespaceRegExp.exec(e);return{currIndentLevel:(o=s?.[0].length)!==null&&o!==void 0?o:0,prevIndentLevel:this.indentationStack.at(-1),match:s}}createIndentationTokenInstance(e,r,n,i){let o=this.getLineNumber(r,i);return qn(e,n,i,i+n.length,o,o,1,n.length)}getLineNumber(e,r){return e.substring(0,r).split(/\r\n|\r|\n/).length}indentMatcher(e,r,n,i){if(!this.isStartOfLine(e,r))return null;let{currIndentLevel:o,prevIndentLevel:s,match:a}=this.matchWhitespace(e,r,n,i);return o<=s?null:(this.indentationStack.push(o),a)}dedentMatcher(e,r,n,i){var o,s,a,c;if(!this.isStartOfLine(e,r))return null;let{currIndentLevel:u,prevIndentLevel:l,match:h}=this.matchWhitespace(e,r,n,i);if(u>=l)return null;let p=this.indentationStack.lastIndexOf(u);if(p===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${u} at offset: ${r}. Current indentation stack: ${this.indentationStack}`,offset:r,length:(s=(o=h?.[0])===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0,line:this.getLineNumber(e,r),column:1}),null;let y=this.indentationStack.length-p-1,_=(c=(a=e.substring(0,r).match(/[\r\n]+$/))===null||a===void 0?void 0:a[0].length)!==null&&c!==void 0?c:1;for(let E=0;E<y;E++){let D=this.createIndentationTokenInstance(this.dedentTokenType,e,"",r-(_-1));n.push(D),this.indentationStack.pop()}return null}buildTerminalToken(e){let r=super.buildTerminalToken(e),{indentTokenName:n,dedentTokenName:i,whitespaceTokenName:o}=this.options;return r.name===n?this.indentTokenType:r.name===i?this.dedentTokenType:r.name===o?fi({name:o,pattern:this.whitespaceRegExp,group:Ze.SKIPPED}):r}flushRemainingDedents(e){let r=[];for(;this.indentationStack.length>1;)r.push(this.createIndentationTokenInstance(this.dedentTokenType,e,"",e.length)),this.indentationStack.pop();return this.indentationStack=[0],r}},Km=class extends lo{constructor(e){if(super(e),e.parser.TokenBuilder instanceof Vd)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(e,r=Wd){let n=super.tokenize(e),i=n.report;r?.mode==="full"&&n.tokens.push(...i.remainingDedents),i.remainingDedents=[];let{indentTokenType:o,dedentTokenType:s}=this.indentationTokenBuilder,a=o.tokenTypeIdx,c=s.tokenTypeIdx,u=[],l=n.tokens.length-1;for(let h=0;h<l;h++){let p=n.tokens[h],y=n.tokens[h+1];if(p.tokenTypeIdx===a&&y.tokenTypeIdx===c){h++;continue}u.push(p)}return l>=0&&u.push(n.tokens[l]),n.tokens=u,n}};var Re={};Kn(Re,{AstUtils:()=>al,BiMap:()=>so,Cancellation:()=>J,ContextCache:()=>ao,CstUtils:()=>tl,DONE_RESULT:()=>zt,Deferred:()=>sr,Disposable:()=>xi,DisposableCache:()=>pa,DocumentCache:()=>jd,EMPTY_STREAM:()=>Wa,ErrorWithLocation:()=>Fi,GrammarUtils:()=>fl,MultiMap:()=>Yr,OperationCancelled:()=>Rn,Reduction:()=>ko,RegExpUtils:()=>ll,SimpleCache:()=>Jc,StreamImpl:()=>Rr,TreeStreamImpl:()=>rn,URI:()=>vt,UriUtils:()=>ge,WorkspaceCache:()=>ma,assertUnreachable:()=>on,delayNextTick:()=>Fm,interruptAndCheck:()=>ot,isOperationCancelled:()=>bn,loadGrammarFromJson:()=>Xd,setInterruptionPeriod:()=>z_,startCancelableOperation:()=>Fd,stream:()=>ce});ve(Re,Ve);var Kd=class{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}},_u={fileSystemProvider:()=>new Kd};var WF={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},BF={AstReflection:()=>new fs};function HF(){let t=fo(Ru(_u),BF),e=fo(Tu({shared:t}),WF);return t.ServiceRegistry.register(e),e}function Xd(t){var e;let r=HF(),n=r.serializer.JsonSerializer.deserialize(t);return r.shared.workspace.LangiumDocumentFactory.fromModel(n,vt.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}ve(dt,Re);var Fa=Nr(kn(),1);function Uy(t,e){let r={stacks:t,tokens:e};return Jq(r),r.stacks.flat().forEach(i=>{i.property=void 0}),wA(r.stacks).map(i=>i[i.length-1])}function Wy(t){let{next:e,cardinalities:r,visited:n,plus:i}=t,o=[],s=e.feature;if(n.has(s))return[];Pr(s)||n.add(s);let a,c=s;for(;c.$container;)if(Pr(c.$container)){a=c.$container;break}else if(qi(c.$container))c=c.$container;else break;if(bp(c.cardinality)){let u=Ma({next:{feature:c,type:e.type},cardinalities:r,visited:n,plus:i});for(let l of u)i.add(l.feature);o.push(...u)}if(a){let u=a.elements.indexOf(c);u!==void 0&&u<a.elements.length-1&&o.push(...AA({feature:a,type:e.type},u+1,r,n,i)),o.every(l=>Gi(l.feature.cardinality,l.feature)||Gi(r.get(l.feature))||i.has(l.feature))&&o.push(...Wy({next:{feature:a,type:e.type},cardinalities:r,visited:n,plus:i}))}return o}function lh(t){return Ge(t)&&(t={feature:t}),Ma({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function Ma(t){var e,r,n;let{next:i,cardinalities:o,visited:s,plus:a}=t;if(i===void 0)return[];let{feature:c,type:u}=i;if(Pr(c))return s.has(c)?[]:(s.add(c),AA(i,0,o,s,a).map(l=>uh(l,c.cardinality,o)));if(hs(c)||ps(c))return c.elements.flatMap(l=>Ma({next:{feature:l,type:u,property:i.property},cardinalities:o,visited:s,plus:a})).map(l=>uh(l,c.cardinality,o));if(Vt(c)){let l={feature:c.terminal,type:u,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return Ma({next:l,cardinalities:o,visited:s,plus:a}).map(h=>uh(h,c.cardinality,o))}else{if(Vr(c))return Wy({next:{feature:c,type:zi(c),property:(r=i.property)!==null&&r!==void 0?r:c.feature},cardinalities:o,visited:s,plus:a});if(ur(c)&&Ye(c.rule.ref)){let l=c.rule.ref,h={feature:l.definition,type:l.fragment||l.dataType?void 0:(n=an(l))!==null&&n!==void 0?n:l.name,property:i.property};return Ma({next:h,cardinalities:o,visited:s,plus:a}).map(p=>uh(p,c.cardinality,o))}else return[i]}}function uh(t,e,r){return r.set(t.feature,e),t}function AA(t,e,r,n,i){var o;let s=[],a;for(;e<t.feature.elements.length&&(a={feature:t.feature.elements[e++],type:t.type},s.push(...Ma({next:a,cardinalities:r,visited:n,plus:i})),!!Gi((o=a.feature.cardinality)!==null&&o!==void 0?o:r.get(a.feature),a.feature)););return s}function Jq(t){for(let e of t.tokens){let r=wA(t.stacks,e);t.stacks=r}}function wA(t,e){let r=[];for(let n of t)r.push(...Qq(n,e));return r}function Qq(t,e){let r=new Map,n=new Set(t.map(o=>o.feature).filter(Zq)),i=[];for(;t.length>0;){let o=t.pop(),s=Wy({next:o,cardinalities:r,plus:n,visited:new Set}).filter(a=>e?By(a.feature,e):!0);for(let a of s)i.push([...t,a]);if(!s.every(a=>Gi(a.feature.cardinality,a.feature)||Gi(r.get(a.feature))))break}return i}function Zq(t){if(t.cardinality==="+")return!0;let e=_r(t,Vt);return!!(e&&e.cardinality==="+")}function By(t,e){if(Et(t))return t.value===e.image;if(ur(t))return ej(t.rule.ref,e);if(br(t)){let r=ac(t);if(r)return By(r,e)}return!1}function ej(t,e){return Ye(t)?lh(t.definition).some(n=>By(n.feature,e)):er(t)?Jn(t).test(e.image):!1}function NA(t){let e=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.triggerCharacters)!==null&&i!==void 0?i:[]}))),r=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.allCommitCharacters)!==null&&i!==void 0?i:[]})));return{triggerCharacters:e.length>0?e:void 0,allCommitCharacters:r.length>0?r:void 0}}var dh=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,r,n){let i=[],o=this.buildContexts(e,r.position),s=(u,l)=>{let h=this.fillCompletionItem(u,l);h&&i.push(h)},a=u=>Et(u.feature)?u.feature.value:u.feature,c=[];for(let u of o)if(await Promise.all(ce(u.features).distinct(a).exclude(c).map(l=>this.completionFor(u,l,s))),c.push(...u.features),!this.continueCompletion(i))break;return Fa.CompletionList.create(this.deduplicateItems(i),!0)}deduplicateItems(e){return ce(e).distinct(r=>`${r.kind}_${r.label}_${r.detail}`).toArray()}findFeaturesAt(e,r){let n=e.getText({start:Fa.Position.create(0,0),end:e.positionAt(r)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let c=oc(this.grammar),u=lh({feature:c.definition,type:an(c)});return o.length>0?(o.shift(),Uy(u.map(l=>[l]),o)):u}let s=[...o].splice(i.tokenIndex);return Uy([i.elementStack.map(c=>({feature:c}))],s)}*buildContexts(e,r){var n,i;let o=e.parseResult.value.$cstNode;if(!o)return;let s=e.textDocument,a=s.getText(),c=s.offsetAt(r),u={document:e,textDocument:s,offset:c,position:r},l=this.findDataTypeRuleStart(o,c);if(l){let[x,g]=l,A=(n=Ha(o,x))===null||n===void 0?void 0:n.astNode;yield Object.assign(Object.assign({},u),{node:A,tokenOffset:x,tokenEndOffset:g,features:this.findFeaturesAt(s,x)})}let{nextTokenStart:h,nextTokenEnd:p,previousTokenStart:y,previousTokenEnd:_}=this.backtrackToAnyToken(a,c),E=h;c<=h&&y!==void 0&&(E=y);let D=(i=Ha(o,E))===null||i===void 0?void 0:i.astNode,w=!0;if(y!==void 0&&_!==void 0&&_===c&&(yield Object.assign(Object.assign({},u),{node:D,tokenOffset:y,tokenEndOffset:_,features:this.findFeaturesAt(s,y)}),w=this.performNextTokenCompletion(e,a.substring(y,_),y,_),w&&(yield Object.assign(Object.assign({},u),{node:D,tokenOffset:_,tokenEndOffset:_,features:this.findFeaturesAt(s,_)}))),D)w&&(yield Object.assign(Object.assign({},u),{node:D,tokenOffset:h,tokenEndOffset:p,features:this.findFeaturesAt(s,h)}));else{let x=oc(this.grammar);if(!x)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},u),{tokenOffset:h,tokenEndOffset:p,features:lh(x.definition)})}}performNextTokenCompletion(e,r,n,i){return/\P{L}$/u.test(r)}findDataTypeRuleStart(e,r){var n,i;let o=cr(e,r,this.grammarConfig.nameRegexp),s=!!(!((n=_r(o?.grammarSource,Ye))===null||n===void 0)&&n.dataType);if(s){for(;s;)o=o?.container,s=!!(!((i=_r(o?.grammarSource,Ye))===null||i===void 0)&&i.dataType);if(o)return[o.offset,o.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,r){let n=this.lexer.tokenize(e).tokens;if(n.length===0)return{nextTokenStart:r,nextTokenEnd:r};let i;for(let o of n){if(o.startOffset>=r)return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};if(o.endOffset>=r)return{nextTokenStart:o.startOffset,nextTokenEnd:o.endOffset+1,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};i=o}return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0}}completionFor(e,r,n){if(Et(r.feature))return this.completionForKeyword(e,r.feature,n);if(br(r.feature)&&e.node)return this.completionForCrossReference(e,r,n)}completionForCrossReference(e,r,n){let i=_r(r.feature,Vt),o=e.node;if(i&&o){r.type&&(o={$type:r.type,$container:o,$containerProperty:r.property},ec(this.astReflection,o));let s={reference:{$refText:""},container:o,property:i.feature};try{for(let a of this.getReferenceCandidates(s,e))n(e,this.createReferenceCompletionItem(a))}catch(a){console.error(a)}}}getReferenceCandidates(e,r){return this.scopeProvider.getScope(e).getAllElements()}createReferenceCompletionItem(e){let r=this.nodeKindProvider.getCompletionItemKind(e),n=this.getReferenceDocumentation(e);return{nodeDescription:e,kind:r,documentation:n,detail:e.type,sortText:"0"}}getReferenceDocumentation(e){if(!e.node)return;let r=this.documentationProvider.getDocumentation(e.node);if(r)return{kind:"markdown",value:r}}completionForKeyword(e,r,n){this.filterKeyword(e,r)&&n(e,{label:r.value,kind:this.getKeywordCompletionItemKind(r),detail:"Keyword",sortText:"1"})}getKeywordCompletionItemKind(e){return Fa.CompletionItemKind.Keyword}filterKeyword(e,r){return/\p{L}/u.test(r.value)}fillCompletionItem(e,r){var n,i;let o;if(typeof r.label=="string")o=r.label;else if("node"in r){let u=this.nameProvider.getName(r.node);if(!u)return;o=u}else if("nodeDescription"in r)o=r.nodeDescription.name;else return;let s;typeof((n=r.textEdit)===null||n===void 0?void 0:n.newText)=="string"?s=r.textEdit.newText:typeof r.insertText=="string"?s=r.insertText:s=o;let a=(i=r.textEdit)!==null&&i!==void 0?i:this.buildCompletionTextEdit(e,o,s);return a?{additionalTextEdits:r.additionalTextEdits,command:r.command,commitCharacters:r.commitCharacters,data:r.data,detail:r.detail,documentation:r.documentation,filterText:r.filterText,insertText:r.insertText,insertTextFormat:r.insertTextFormat,insertTextMode:r.insertTextMode,kind:r.kind,labelDetails:r.labelDetails,preselect:r.preselect,sortText:r.sortText,tags:r.tags,textEditText:r.textEditText,textEdit:a,label:o}:void 0}buildCompletionTextEdit(e,r,n){let o=e.textDocument.getText().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(o,r)){let s=e.textDocument.positionAt(e.tokenOffset),a=e.position;return{newText:n,range:{start:s,end:a}}}else return}};var PA=Nr(kn(),1);var fh=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,r,n){let i=e.parseResult.value;if(i.$cstNode){let o=i.$cstNode,s=cr(o,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(s)return this.collectLocationLinks(s,r)}}collectLocationLinks(e,r){var n;let i=this.findLink(e);if(i)return[PA.LocationLink.create(i.targetDocument.textDocument.uri,((n=i.target.astNode.$cstNode)!==null&&n!==void 0?n:i.target).range,i.target.range,i.source.range)]}findLink(e){let r=this.references.findDeclarationNode(e);if(r?.astNode){let n=Rt(r.astNode);if(r&&n)return{source:e,target:r,targetDocument:n}}}};var IA=Nr(kn(),1);var hh=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,r,n){let i=e.parseResult.value.$cstNode;if(!i)return;let o=cr(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!o)return;let s=this.references.findDeclaration(o);if(s){let a=ge.equals(Rt(s).uri,e.uri),c={documentUri:e.uri,includeDeclaration:a};return this.references.findReferences(s,c).map(l=>this.createDocumentHighlight(l)).toArray()}}createDocumentHighlight(e){return IA.DocumentHighlight.create(e.segment.range)}};var ph=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e,r,n){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,r){let n=r.$cstNode,i=this.nameProvider.getNameNode(r);if(i&&n){let o=this.nameProvider.getName(r);return[{kind:this.nodeKindProvider.getSymbolKind(r),name:o||i.text,range:n.range,selectionRange:i.range,children:this.getChildSymbols(e,r)}]}else return this.getChildSymbols(e,r)||[]}getChildSymbols(e,r){let n=[];for(let i of Ui(r)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}};var qu=Nr(kn(),1);var mh=class{constructor(e){this.workspaceManager=e.workspace.WorkspaceManager,this.documentBuilder=e.workspace.DocumentBuilder,this.workspaceLock=e.workspace.WorkspaceLock,this.serviceRegistry=e.ServiceRegistry;let r=!1;e.lsp.LanguageServer.onInitialize(n=>{var i,o;r=!!(!((o=(i=n.capabilities.workspace)===null||i===void 0?void 0:i.didChangeWatchedFiles)===null||o===void 0)&&o.dynamicRegistration)}),e.lsp.LanguageServer.onInitialized(n=>{r&&this.registerFileWatcher(e)})}registerFileWatcher(e){let r=[],n=ce(e.ServiceRegistry.all).flatMap(o=>o.LanguageMetaData.fileExtensions).map(o=>o.startsWith(".")?o.substring(1):o).distinct().toArray();n.length>0&&r.push({globPattern:n.length===1?`**/*.${n[0]}`:`**/*.{${n.join(",")}}`});let i=ce(e.ServiceRegistry.all).flatMap(o=>{var s;return(s=o.LanguageMetaData.fileNames)!==null&&s!==void 0?s:[]}).distinct().toArray();if(i.length>0&&r.push({globPattern:i.length===1?`**/${i[0]}`:`**/{${i.join(",")}}`}),r.length>0){let o=e.lsp.Connection,s={watchers:r};o?.client.register(qu.DidChangeWatchedFilesNotification.type,s)}}fireDocumentUpdate(e,r){e=e.filter(n=>this.serviceRegistry.hasServices(n)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(n=>this.documentBuilder.update(e,r,n))}).catch(n=>{console.error("Workspace initialization failed. Could not perform document update.",n)})}didChangeContent(e){this.fireDocumentUpdate([vt.parse(e.document.uri)],[])}didChangeWatchedFiles(e){let r=ce(e.changes).filter(i=>i.type!==qu.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>vt.parse(i.uri)).toArray(),n=ce(e.changes).filter(i=>i.type===qu.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>vt.parse(i.uri)).toArray();this.fireDocumentUpdate(r,n)}};var ju=Nr(kn(),1);var gh=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,r,n){let i=[],o=s=>i.push(s);return this.collectFolding(e,o),i}collectFolding(e,r){var n;let i=(n=e.parseResult)===null||n===void 0?void 0:n.value;if(i){if(this.shouldProcessContent(i)){let o=Cr(i).iterator(),s;do if(s=o.next(),!s.done){let a=s.value;this.shouldProcess(a)&&this.collectObjectFolding(e,a,r),this.shouldProcessContent(a)||o.prune()}while(!s.done)}this.collectCommentFolding(e,i,r)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,r,n){let i=r.$cstNode;if(i){let o=this.toFoldingRange(e,i);o&&n(o)}}collectCommentFolding(e,r,n){let i=r.$cstNode;if(i){for(let o of qh(i))if(this.commentNames.includes(o.tokenType.name)){let s=this.toFoldingRange(e,o,ju.FoldingRangeKind.Comment);s&&n(s)}}}toFoldingRange(e,r,n){let i=r.range,o=i.start,s=i.end;if(!(s.line-o.line<2))return this.includeLastFoldingLine(r,n)||(s=e.textDocument.positionAt(e.textDocument.offsetAt({line:s.line,character:0})-1)),ju.FoldingRange.create(o.line,s.line,o.character,s.character,n)}includeLastFoldingLine(e,r){if(r===ju.FoldingRangeKind.Comment)return!1;let n=e.text,i=n.charAt(n.length-1);return!(i==="}"||i===")"||i==="]")}};var yh=class{match(e,r){if(e.length===0)return!0;let n=!1,i,o=0,s=r.length;for(let a=0;a<s;a++){let c=r.charCodeAt(a),u=e.charCodeAt(o);if((c===u||this.toUpperCharCode(c)===this.toUpperCharCode(u))&&(n||(n=i===void 0||this.isWordTransition(i,c)),n&&o++,o===e.length))return!0;i=c}return!1}isWordTransition(e,r){return DA<=e&&e<=OA&&tj<=r&&r<=rj||e===LA&&r!==LA}toUpperCharCode(e){return DA<=e&&e<=OA?e-32:e}},DA=97,OA=122,tj=65,rj=90,LA=95;var Hy=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,r){var n,i;let o=(i=(n=e.parseResult)===null||n===void 0?void 0:n.value)===null||i===void 0?void 0:i.$cstNode;if(o){let s=e.textDocument.offsetAt(r.position),a=cr(o,s,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>s){let c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c);if(Et(a.grammarSource))return this.getKeywordHoverContent(a.grammarSource)}}}getKeywordHoverContent(e){var r;let n=eu(e)?e.$comment:void 0;if(n||(n=(r=Ba(e.$cstNode,["ML_COMMENT"]))===null||r===void 0?void 0:r.text),n&&pu(n)){let i=hu(n).toMarkdown();if(i)return{contents:{kind:"markdown",value:i}}}}},vh=class extends Hy{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){let r=this.documentationProvider.getDocumentation(e);if(r)return{contents:{kind:"markdown",value:r}}}};var Gn=Nr(ht(),1);var fe=Nr(kn(),1);var nj={[fe.SemanticTokenTypes.class]:0,[fe.SemanticTokenTypes.comment]:1,[fe.SemanticTokenTypes.enum]:2,[fe.SemanticTokenTypes.enumMember]:3,[fe.SemanticTokenTypes.event]:4,[fe.SemanticTokenTypes.function]:5,[fe.SemanticTokenTypes.interface]:6,[fe.SemanticTokenTypes.keyword]:7,[fe.SemanticTokenTypes.macro]:8,[fe.SemanticTokenTypes.method]:9,[fe.SemanticTokenTypes.modifier]:10,[fe.SemanticTokenTypes.namespace]:11,[fe.SemanticTokenTypes.number]:12,[fe.SemanticTokenTypes.operator]:13,[fe.SemanticTokenTypes.parameter]:14,[fe.SemanticTokenTypes.property]:15,[fe.SemanticTokenTypes.regexp]:16,[fe.SemanticTokenTypes.string]:17,[fe.SemanticTokenTypes.struct]:18,[fe.SemanticTokenTypes.type]:19,[fe.SemanticTokenTypes.typeParameter]:20,[fe.SemanticTokenTypes.variable]:21,[fe.SemanticTokenTypes.decorator]:22},ij={[fe.SemanticTokenModifiers.abstract]:1,[fe.SemanticTokenModifiers.async]:2,[fe.SemanticTokenModifiers.declaration]:4,[fe.SemanticTokenModifiers.defaultLibrary]:8,[fe.SemanticTokenModifiers.definition]:16,[fe.SemanticTokenModifiers.deprecated]:32,[fe.SemanticTokenModifiers.documentation]:64,[fe.SemanticTokenModifiers.modification]:128,[fe.SemanticTokenModifiers.readonly]:256,[fe.SemanticTokenModifiers.static]:512},dre={legend:{tokenTypes:Object.keys(nj),tokenModifiers:Object.keys(ij)},full:{delta:!0},range:!0};function FA(t){let e=[],r=[],n=!0,i=!0,o=!0;for(let s of t)s&&(s.legend.tokenTypes.forEach((a,c)=>{let u=e[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token types. They use the same index ${c}.`);e[c]=a}),s.legend.tokenModifiers.forEach((a,c)=>{let u=r[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token modifier. They use the same index ${c}.`);r[c]=a}),s.full?typeof s.full=="object"&&!s.full.delta&&(i=!1):n=!1,s.range||(o=!1));return{legend:{tokenTypes:e,tokenModifiers:r},full:n&&{delta:i},range:o}}var MA;(function(t){function e(n,i,o){let s=new Map;Object.entries(i).forEach(([u,l])=>s.set(l,u));let a=0,c=0;return r(n.data,5).map(u=>{a+=u[0],u[0]!==0&&(c=0),c+=u[1];let l=u[2];return{offset:o.textDocument.offsetAt({line:a,character:c}),tokenType:s.get(u[3]),tokenModifiers:u[4],text:o.textDocument.getText({start:{line:a,character:c},end:{line:a,character:c+l}})}})}t.decode=e;function r(n,i){let o=[];for(let s=0;s<n.length;s+=i){let a=n.slice(s,s+i);o.push(a)}return o}})(MA||(MA={}));function $A(t){let e=[],r=[];t.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&r.push(...i.retriggerCharacters)});let n={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:r.length>0?Array.from(new Set(r)).sort():void 0};return n.triggerCharacters?n:void 0}var xh=class{constructor(e){this.onInitializeEmitter=new Gn.Emitter,this.onInitializedEmitter=new Gn.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(){bu(this.services),this.services.ServiceRegistry.all.forEach(e=>bu(e))}hasService(e){return this.services.ServiceRegistry.all.some(n=>e(n)!==void 0)}buildInitializeResult(e){var r,n,i,o;let s=this.services.lsp.DocumentUpdateHandler,a=(r=this.services.lsp.FileOperationHandler)===null||r===void 0?void 0:r.fileOperationOptions,c=this.services.ServiceRegistry.all,u=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.Formatter}),l=c.map(B=>{var N,ke;return(ke=(N=B.lsp)===null||N===void 0?void 0:N.Formatter)===null||ke===void 0?void 0:ke.formatOnTypeOptions}).find(B=>!!B),h=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.CodeActionProvider}),p=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.SemanticTokenProvider}),y=FA(c.map(B=>{var N,ke;return(ke=(N=B.lsp)===null||N===void 0?void 0:N.SemanticTokenProvider)===null||ke===void 0?void 0:ke.semanticTokensOptions})),_=(i=(n=this.services.lsp)===null||n===void 0?void 0:n.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,E=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DocumentLinkProvider}),D=$A(c.map(B=>{var N,ke;return(ke=(N=B.lsp)===null||N===void 0?void 0:N.SignatureHelp)===null||ke===void 0?void 0:ke.signatureHelpOptions})),w=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.TypeProvider}),x=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.ImplementationProvider}),g=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.CompletionProvider}),A=NA(c.map(B=>{var N,ke;return(ke=(N=B.lsp)===null||N===void 0?void 0:N.CompletionProvider)===null||ke===void 0?void 0:ke.completionOptions})),M=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.ReferencesProvider}),te=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DocumentSymbolProvider}),_e=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DefinitionProvider}),Se=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DocumentHighlightProvider}),Nt=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.FoldingRangeProvider}),xt=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.HoverProvider}),$=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.RenameProvider}),I=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.CallHierarchyProvider}),z=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.TypeHierarchyProvider}),W=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.CodeLensProvider}),le=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.DeclarationProvider}),Z=this.hasService(B=>{var N;return(N=B.lsp)===null||N===void 0?void 0:N.InlayHintProvider}),Q=(o=this.services.lsp)===null||o===void 0?void 0:o.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:a},executeCommandProvider:_&&{commands:_},textDocumentSync:{change:Gn.TextDocumentSyncKind.Incremental,openClose:!0,save:!!s.didSaveDocument,willSave:!!s.willSaveDocument,willSaveWaitUntil:!!s.willSaveDocumentWaitUntil},completionProvider:g?A:void 0,referencesProvider:M,documentSymbolProvider:te,definitionProvider:_e,typeDefinitionProvider:w,documentHighlightProvider:Se,codeActionProvider:h,documentFormattingProvider:u,documentRangeFormattingProvider:u,documentOnTypeFormattingProvider:l,foldingRangeProvider:Nt,hoverProvider:xt,renameProvider:$?{prepareProvider:!0}:void 0,semanticTokensProvider:p?y:void 0,signatureHelpProvider:D,implementationProvider:x,callHierarchyProvider:I?{}:void 0,typeHierarchyProvider:z?{}:void 0,documentLinkProvider:E?{resolveProvider:!1}:void 0,codeLensProvider:W?{resolveProvider:!1}:void 0,declarationProvider:le,inlayHintProvider:Z?{resolveProvider:!1}:void 0,workspaceSymbolProvider:Q?{resolveProvider:!!Q.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 r=this.services.lsp.Connection,n=r?Object.assign(Object.assign({},e),{register:i=>r.client.register(Gn.DidChangeConfigurationNotification.type,i),fetchConfiguration:i=>r.workspace.getConfiguration(i)}):e;this.services.workspace.ConfigurationProvider.initialized(n).catch(i=>console.error("Error in ConfigurationProvider initialization:",i)),this.services.workspace.WorkspaceManager.initialized(e).catch(i=>console.error("Error in WorkspaceManager initialization:",i))}};var Rh=Nr(kn(),1),Th=class{getSymbolKind(e){return Rh.SymbolKind.Field}getCompletionItemKind(e){return Rh.CompletionItemKind.Reference}};var qA=Nr(kn(),1);var bh=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,r,n){let i=e.parseResult.value.$cstNode;if(!i)return[];let o=cr(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);return o?this.getReferences(o,r,e):[]}getReferences(e,r,n){let i=[],o=this.references.findDeclaration(e);if(o){let s={includeDeclaration:r.context.includeDeclaration};this.references.findReferences(o,s).forEach(a=>{i.push(qA.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}};var _h=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,r,n){let i={},o=e.parseResult.value.$cstNode;if(!o)return;let s=e.textDocument.offsetAt(r.position),a=cr(o,s,this.grammarConfig.nameRegexp);if(!a)return;let c=this.references.findDeclaration(a);if(!c)return;let u={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(c,u).forEach(h=>{let p=gi.replace(h.segment.range,r.newName),y=h.sourceUri.toString();i[y]?i[y].push(p):i[y]=[p]}),{changes:i}}prepareRename(e,r,n){return this.renameNodeRange(e,r.position)}renameNodeRange(e,r){let n=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(r);if(n&&i){let o=cr(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.astNode&&qd(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}};var Ch=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,r=J.CancellationToken.None){let n=[],i=e.query.toLowerCase();for(let o of this.indexManager.allElements())if(await ot(r),this.fuzzyMatcher.match(i,o.name)){let s=this.getWorkspaceSymbol(o);s&&n.push(s)}return n}getWorkspaceSymbol(e){let r=e.nameSegment;if(r)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:r.range,uri:e.documentUri.toString()}}}};var $t=Nr(kn(),1);var Uu=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(ge.normalize(e))}set(e){let r=ge.normalize(e.uri),n=!0;this._syncedDocuments.has(r)&&(n=!1),this._syncedDocuments.set(r,e);let i=Object.freeze({document:e});return this._onDidOpen.fire(i),this._onDidChangeContent.fire(i),n}delete(e){let r=ge.normalize(typeof e=="object"&&"uri"in e?e.uri:e),n=this._syncedDocuments.get(r);n!==void 0&&(this._syncedDocuments.delete(r),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=$t.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=ge.normalize(i.uri),s=this._configuration.create(o,i.languageId,i.version,i.text);this._syncedDocuments.set(o,s);let a=Object.freeze({document:s});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:s}=i;if(s==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=ge.normalize(i.uri),c=this._syncedDocuments.get(a);c!==void 0&&(c=this._configuration.update(c,o,s),this._syncedDocuments.set(a,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),r.push(e.onDidCloseTextDocument(n=>{let i=ge.normalize(n.textDocument.uri),o=this._syncedDocuments.get(i);o!==void 0&&(this._syncedDocuments.delete(i),this._onDidClose.fire(Object.freeze({document:o})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(ge.normalize(n.textDocument.uri));i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(ge.normalize(n.textDocument.uri));return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(ge.normalize(n.textDocument.uri));i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),$t.Disposable.create(()=>{r.forEach(n=>n.dispose())})}},Sh=class{constructor(e){this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new $t.Emitter,this._onDidSave=new $t.Emitter,this._onDidChange=new $t.Emitter,this._onDidClose=new $t.Emitter,"listen"in e?this._cellTextDocuments=e:this._cellTextDocuments=new Uu(e)}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(ge.normalize(e))}getNotebookCell(e){let r=this.notebookCellMap.get(ge.normalize(e));return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"||"scheme"in e?e:e.document,n=this.notebookCellMap.get(ge.normalize(r));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 r=new kh,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{let o=ge.normalize(i.notebookDocument.uri);this.notebookDocuments.set(o,i.notebookDocument);for(let s of i.cellTextDocuments)r.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=ge.normalize(i.notebookDocument.uri),s=this.notebookDocuments.get(o);if(s===void 0)return;s.version=i.notebookDocument.version;let a=s.metadata,c=!1,u=i.change;u.metadata!==void 0&&(c=!0,s.metadata=u.metadata);let l=[],h=[],p=[],y=[];if(u.cells!==void 0){let x=u.cells;if(x.structure!==void 0){let g=x.structure.array;if(s.cells.splice(g.start,g.deleteCount,...g.cells!==void 0?g.cells:[]),x.structure.didOpen!==void 0)for(let A of x.structure.didOpen)r.openTextDocument({textDocument:A}),l.push(A.uri);if(x.structure.didClose)for(let A of x.structure.didClose)r.closeTextDocument({textDocument:A}),h.push(A.uri)}if(x.data!==void 0){let g=new Map(x.data.map(A=>[A.document,A]));for(let A=0;A<=s.cells.length;A++){let M=g.get(s.cells[A].document);if(M!==void 0){let te=s.cells.splice(A,1,M);if(p.push({old:te[0],new:M}),g.delete(M.document),g.size===0)break}}}if(x.textContent!==void 0)for(let g of x.textContent)r.changeTextDocument({textDocument:g.document,contentChanges:g.changes}),y.push(g.document.uri)}this.updateCellMap(s);let _={notebookDocument:s};c&&(_.metadata={old:a,new:s.metadata});let E=[];for(let x of l)E.push(this.getNotebookCell(x));let D=[];for(let x of h)D.push(this.getNotebookCell(x));let w=[];for(let x of y)w.push(this.getNotebookCell(x));(E.length>0||D.length>0||p.length>0||w.length>0)&&(_.cells={added:E,removed:D,changed:{data:p,textContent:w}}),(_.metadata!==void 0||_.cells!==void 0)&&this._onDidChange.fire(_)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.getNotebookDocument(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=ge.normalize(i.notebookDocument.uri),s=this.notebookDocuments.get(o);if(s!==void 0){this._onDidClose.fire(s);for(let a of i.cellTextDocuments)r.closeTextDocument({textDocument:a});this.notebookDocuments.delete(o);for(let a of s.cells)this.notebookCellMap.delete(a.document)}})),$t.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}},kh=class t{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 t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};kh.NULL_DISPOSE=Object.freeze({dispose:()=>{}});function jA(t){return ya.merge(Tu(t),oj(t))}function oj(t){return{lsp:{CompletionProvider:e=>new dh(e),DocumentSymbolProvider:e=>new ph(e),HoverProvider:e=>new vh(e),FoldingRangeProvider:e=>new gh(e),ReferencesProvider:e=>new bh(e),DefinitionProvider:e=>new fh(e),DocumentHighlightProvider:e=>new hh(e),RenameProvider:e=>new _h(e)},shared:()=>t.shared}}function UA(t){return ya.merge(Ru(t),sj(t))}function sj(t){return{lsp:{Connection:()=>t.connection,LanguageServer:e=>new xh(e),DocumentUpdateHandler:e=>new mh(e),WorkspaceSymbolProvider:e=>new Ch(e),NodeKindProvider:()=>new Th,FuzzyMatcher:()=>new yh},workspace:{TextDocuments:()=>new Uu(vi),NotebookDocuments:e=>new Sh(e.workspace.TextDocuments)}}}var WA="BlockCommand";var BA="LineCommand";var Gy="AddressParam";var Eh="CheckActionCommand";var Ah="CheckAlarmCommand";var wh="CheckCommand";var zy="CodeParam";var Wu="CountCommand";function Xy(t){return Qy.isInstance(t,Wu)}var Nh="DelayCommand";var Bu="LoopCommand";function Yy(t){return Qy.isInstance(t,Bu)}var Ph="Model";var Hu="ScheduleCommand";function Jy(t){return Qy.isInstance(t,Hu)}var Vy="TimeParam";var Ih="UnwatchCommand";var Ky="ValueParam";var Dh="WatchCommand";var Oh="WriteCommand";var Lh="TypeDeclare";var Gu=class extends Di{getAllTypes(){return[Gy,WA,Eh,Ah,wh,zy,Wu,Nh,BA,Bu,Ph,Hu,Vy,Lh,Ih,Ky,Dh,Oh]}computeIsSubtype(e,r){switch(e){case Eh:case Ah:case wh:case Nh:case Ih:case Dh:case Oh:return this.isSubtype(BA,r);case Wu:case Bu:case Hu:return this.isSubtype(WA,r);case Lh:return this.isSubtype(Ph,r);default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;throw new Error(`${r} is not a valid reference id.`)}getTypeMetaData(e){switch(e){case Gy:return{name:Gy,properties:[{name:"module"},{name:"value"}]};case Eh:return{name:Eh,properties:[{name:"code"}]};case Ah:return{name:Ah,properties:[{name:"codes",defaultValue:[]},{name:"codes2",defaultValue:[]}]};case wh:return{name:wh,properties:[{name:"address"},{name:"address2"},{name:"value"},{name:"value2"}]};case zy:return{name:zy,properties:[{name:"value"}]};case Wu:return{name:Wu,properties:[{name:"commands",defaultValue:[]},{name:"times"}]};case Nh:return{name:Nh,properties:[{name:"time"}]};case Bu:return{name:Bu,properties:[{name:"commands",defaultValue:[]},{name:"time"}]};case Ph:return{name:Ph,properties:[{name:"commands",defaultValue:[]}]};case Hu:return{name:Hu,properties:[{name:"commands",defaultValue:[]},{name:"time"}]};case Vy:return{name:Vy,properties:[{name:"value"}]};case Ih:return{name:Ih,properties:[{name:"address"}]};case Ky:return{name:Ky,properties:[{name:"value"}]};case Dh:return{name:Dh,properties:[{name:"address"},{name:"value"},{name:"value2"}]};case Oh:return{name:Oh,properties:[{name:"address"},{name:"address2"},{name:"value"}]};case Lh:return{name:Lh,properties:[{name:"commands",defaultValue:[]},{name:"value"}]};default:return{name:e,properties:[]}}}},Qy=new Gu;var HA,GA=()=>HA??(HA=Xd('{"$type":"Grammar","isDeclared":true,"name":"Acspec","rules":[{"$type":"ParserRule","entry":true,"name":"Model","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TypeDeclare","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"use"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"unit"},{"$type":"Keyword","value":"init"}]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineCommand","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BlockCommand","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WriteCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"write"},{"$type":"Keyword","value":"write!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"address2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check"},{"$type":"Keyword","value":"check!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Assignment","feature":"address2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckAlarmCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check_alarm"},{"$type":"Keyword","value":"check_alarm!"}]},{"$type":"Assignment","feature":"codes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"codes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"codes2","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"codes2","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CheckActionCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"check_action"},{"$type":"Keyword","value":"check_action!"}]},{"$type":"Assignment","feature":"code","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WatchCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"watch"},{"$type":"Keyword","value":"watch!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value2","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UnwatchCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"unwatch"},{"$type":"Keyword","value":"unwatch!"}]},{"$type":"Assignment","feature":"address","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DelayCommand","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"delay"},{"$type":"Keyword","value":"delay!"}]},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ScheduleCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"schedule"},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LoopCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"loop"},{"$type":"Assignment","feature":"time","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CountCommand","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"count"},{"$type":"Assignment","feature":"times","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"commands","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AddressParam","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"module","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ValueParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CodeParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TimeParam","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/"},"fragment":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[_a-zA-Z][\\\\w_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?\\\\d+(\\\\.\\\\d+)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SL_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"types":[],"usedGrammars":[]}'));var cj={languageId:"acspec",fileExtensions:[".tsc"],caseInsensitive:!1,mode:"production"},zA={AstReflection:()=>new Gu},VA={Grammar:()=>GA(),LanguageMetaData:()=>cj,parser:{}};function KA(t){let e=t.validation.ValidationRegistry,r=t.validation.AcspecValidator,n={WriteCommand:r.checkWriteCommand,CheckCommand:r.checkCheckCommand,DelayCommand:r.checkDelayCommand,CheckAlarmCommand:r.checkAlarmCommand,CheckActionCommand:r.checkActionCommand,WatchCommand:r.checkWatchCommand,UnwatchCommand:r.checkUnwatchCommand,ScheduleCommand:r.checkScheduleCommand,LoopCommand:r.checkLoopCommand,CountCommand:r.checkCountCommand};e.register(n,r)}var Mh=class{validateAddress(e){return e?/^[A-Z]+[0-9]+$/.test(e):!1}checkAddressParam(e,r){e&&(this.validateAddress(e.value)||r("error","\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5BC4\u5B58\u5668\u5730\u5740\uFF0C\u4F8B\u5982\uFF1AM0100",{node:e,property:"value"}),e.module!==void 0&&(!Number.isInteger(e.module)||e.module<0)&&r("error","\u6A21\u5757\u53F7\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:e,property:"module"}))}checkWriteCommand(e,r){this.checkAddressParam(e.address,r),this.checkAddressParam(e.address2,r)}checkCheckCommand(e,r){this.checkAddressParam(e.address,r),this.checkAddressParam(e.address2,r),e.value&&e.value2&&e.value2.value<=e.value.value&&r("error","\u6700\u5927\u503C\u5FC5\u987B\u5927\u4E8E\u6700\u5C0F\u503C",{node:e.value2,property:"value"})}checkAlarmCommand(e,r){Array.isArray(e.codes)&&(e.codes.forEach(n=>{(!Number.isInteger(n.value)||n.value<0)&&r("error","\u544A\u8B66\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:n,property:"value"})}),Array.isArray(e.codes2)&&e.codes2.forEach(n=>{(!Number.isInteger(n.value)||n.value<0)&&r("error","\u544A\u8B66\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:n,property:"value"})}))}checkActionCommand(e,r){e.code&&(!Number.isInteger(e.code.value)||e.code.value<0)&&r("error","\u52A8\u4F5C\u72B6\u6001\u7801\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570",{node:e.code,property:"value"})}checkWatchCommand(e,r){this.checkAddressParam(e.address,r),e.value&&e.value2&&e.value2.value<=e.value.value&&r("error","\u6700\u5927\u503C\u5FC5\u987B\u5927\u4E8E\u6700\u5C0F\u503C",{node:e.value2,property:"value"})}checkUnwatchCommand(e,r){this.checkAddressParam(e.address,r)}checkDelayCommand(e,r){e.time&&(typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5EF6\u8FDF\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"})}checkScheduleCommand(e,r){e.time&&((typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5B9A\u65F6\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757\uFF0C\u53EF\u4EE5\u4F7F\u7528\u66F4\u7B80\u6D01\u7684delay\u547D\u4EE4\u66FF\u4EE3\uFF0C\u4F8B\u5982\uFF1Adelay "+e.time.value,{node:e}))}checkLoopCommand(e,r){e.time&&((typeof e.time.value!="number"||isNaN(e.time.value)||e.time.value<=0)&&r("error","\u5B9A\u65F6\u65F6\u95F4\uFF08\u79D2\uFF09\u5FC5\u987B\u662F\u6B63\u6570",{node:e.time,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757\uFF0C\u53EF\u4EE5\u4F7F\u7528\u66F4\u7B80\u6D01\u7684delay\u547D\u4EE4\u66FF\u4EE3\uFF0C\u4F8B\u5982\uFF1Adelay "+e.time.value,{node:e}))}checkCountCommand(e,r){e.times&&((!Number.isInteger(e.times.value)||e.times.value<=0)&&r("error","\u91CD\u590D\u6B21\u6570\u5FC5\u987B\u662F\u6B63\u6574\u6570",{node:e.times,property:"value"}),e.commands.length===0&&r("error","\u4E0D\u5141\u8BB8\u4F7F\u7528\u7A7A\u7684\u5757",{node:e}))}};var uj={validation:{AcspecValidator:()=>new Mh}};function XA(t){let e=fo(UA(t),zA),r=fo(jA({shared:e}),VA,uj);return e.ServiceRegistry.register(r),KA(r),{shared:e,Acspec:r}}var{shared:YA,Acspec:lj}=XA(_u),dj=new uo(lj),JA=new Set(["address","address2","value","value2","time","times","code","codes","codes2"]),QA=new Set(["value","module"]);async function fj(t){let e="file:///example.tcs",r={},n,i=YA.workspace.LangiumDocuments.createDocument(e,t),o=await dj.validateDocument(i),s=i.parseResult.value;if(!Array.isArray(o)||o.length===0){r.$type=s.$type,r.value=s.value,r.commands=[];for(let a of s.commands){let c={};if(Jy(a)||Yy(a)||Xy(a)){c.$type=a.$type,Jy(a)||Yy(a)?c.time=a.time.value:Xy(a)&&(c.times=a.times.value),c.commands=[];for(let u of a.commands){let l={};Object.keys(u).forEach(h=>{if(JA.has(h)){let p=u[h];h==="codes"||h==="codes2"?l[h]=p.map(y=>y.value):h==="address"||h==="address2"?l[h]=Array.from(QA).reduce((y,_)=>(_ in p&&(y[_]=p[_]),y),{}):l[h]=p.value}}),l.$type=u.$type,l.text=u.$cstNode.text,l.important=u.$cstNode.text.includes("!"),l.range=u.$cstNode.range,c.commands.push(l)}}else Object.keys(a).forEach(u=>{if(JA.has(u)){let l=a[u];u==="codes"||u==="codes2"?c[u]=l.map(h=>h.value):u==="address"||u==="address2"?c[u]=Array.from(QA).reduce((h,p)=>(p in l&&(h[p]=l[p]),h),{}):c[u]=l.value}}),c.$type=a.$type,c.text=a.$cstNode.text,c.important=a.$cstNode.text.includes("!"),c.range=a.$cstNode.range;r.commands.push(c)}}return YA.workspace.LangiumDocuments.deleteDocument(e),Object.keys(r).length>0&&(n=JSON.stringify(r)),{syntaxTree:n,diagnostics:o}}0&&(module.exports={getSyntaxTree});
162
162
  /*! Bundled license information:
163
163
 
164
164
  lodash-es/lodash.js: